@runtypelabs/sdk 1.15.2 → 1.16.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.
- package/dist/index.cjs +33 -11
- package/dist/index.d.cts +105 -20
- package/dist/index.d.ts +105 -20
- package/dist/index.mjs +33 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -991,18 +991,19 @@ var RuntypeFlowBuilder = class {
|
|
|
991
991
|
const { streamEvents: streamEvents2 } = await Promise.resolve().then(() => (init_stream_utils(), stream_utils_exports));
|
|
992
992
|
try {
|
|
993
993
|
for await (const event of streamEvents2(response)) {
|
|
994
|
-
|
|
994
|
+
const awaitEvent = event;
|
|
995
|
+
if (awaitEvent.type === "flow_await") {
|
|
995
996
|
pausedState = {
|
|
996
|
-
toolName:
|
|
997
|
-
parameters:
|
|
998
|
-
executionId:
|
|
997
|
+
toolName: awaitEvent.toolName || "",
|
|
998
|
+
parameters: awaitEvent.parameters,
|
|
999
|
+
executionId: awaitEvent.executionId || ""
|
|
999
1000
|
};
|
|
1000
1001
|
}
|
|
1001
|
-
if (
|
|
1002
|
+
if (awaitEvent.type === "step_await") {
|
|
1002
1003
|
pausedState = {
|
|
1003
|
-
toolName:
|
|
1004
|
-
parameters:
|
|
1005
|
-
executionId:
|
|
1004
|
+
toolName: awaitEvent.toolName || "",
|
|
1005
|
+
parameters: awaitEvent.parameters,
|
|
1006
|
+
executionId: awaitEvent.executionId || ""
|
|
1006
1007
|
};
|
|
1007
1008
|
}
|
|
1008
1009
|
switch (event.type) {
|
|
@@ -1013,7 +1014,7 @@ var RuntypeFlowBuilder = class {
|
|
|
1013
1014
|
wrappedCallbacks.onStepStart?.(event);
|
|
1014
1015
|
break;
|
|
1015
1016
|
case "step_delta": {
|
|
1016
|
-
const chunkText =
|
|
1017
|
+
const chunkText = awaitEvent.chunk || awaitEvent.text || "";
|
|
1017
1018
|
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
1018
1019
|
break;
|
|
1019
1020
|
}
|
|
@@ -1071,8 +1072,9 @@ var RuntypeFlowBuilder = class {
|
|
|
1071
1072
|
new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } })
|
|
1072
1073
|
);
|
|
1073
1074
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1075
|
+
const pausedResult = result;
|
|
1076
|
+
if (pausedResult.status === "paused" && pausedResult.pausedReason?.type === "local_action") {
|
|
1077
|
+
const { toolName, parameters, executionId } = pausedResult.pausedReason;
|
|
1076
1078
|
if (!localTools[toolName]) {
|
|
1077
1079
|
throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
1078
1080
|
}
|
|
@@ -1527,6 +1529,21 @@ var PromptRunner = class {
|
|
|
1527
1529
|
if (this.options.temperature !== void 0) {
|
|
1528
1530
|
payload.temperature = this.options.temperature;
|
|
1529
1531
|
}
|
|
1532
|
+
if (this.options.topP !== void 0) {
|
|
1533
|
+
payload.topP = this.options.topP;
|
|
1534
|
+
}
|
|
1535
|
+
if (this.options.topK !== void 0) {
|
|
1536
|
+
payload.topK = this.options.topK;
|
|
1537
|
+
}
|
|
1538
|
+
if (this.options.frequencyPenalty !== void 0) {
|
|
1539
|
+
payload.frequencyPenalty = this.options.frequencyPenalty;
|
|
1540
|
+
}
|
|
1541
|
+
if (this.options.presencePenalty !== void 0) {
|
|
1542
|
+
payload.presencePenalty = this.options.presencePenalty;
|
|
1543
|
+
}
|
|
1544
|
+
if (this.options.seed !== void 0) {
|
|
1545
|
+
payload.seed = this.options.seed;
|
|
1546
|
+
}
|
|
1530
1547
|
if (this.options.maxTokens !== void 0) {
|
|
1531
1548
|
payload.maxTokens = this.options.maxTokens;
|
|
1532
1549
|
}
|
|
@@ -7103,6 +7120,11 @@ var FlowBuilder = class {
|
|
|
7103
7120
|
outputVariable: config.outputVariable,
|
|
7104
7121
|
responseFormat: config.responseFormat,
|
|
7105
7122
|
temperature: config.temperature,
|
|
7123
|
+
topP: config.topP,
|
|
7124
|
+
topK: config.topK,
|
|
7125
|
+
frequencyPenalty: config.frequencyPenalty,
|
|
7126
|
+
presencePenalty: config.presencePenalty,
|
|
7127
|
+
seed: config.seed,
|
|
7106
7128
|
maxTokens: config.maxTokens,
|
|
7107
7129
|
reasoning: config.reasoning,
|
|
7108
7130
|
streamOutput: config.streamOutput,
|
package/dist/index.d.cts
CHANGED
|
@@ -473,6 +473,11 @@ interface DeployCfSandboxResponse {
|
|
|
473
473
|
previewUrl: string;
|
|
474
474
|
output: string;
|
|
475
475
|
status: 'running' | 'error';
|
|
476
|
+
/**
|
|
477
|
+
* Last pipeline step that ran. On failure, identifies where it failed
|
|
478
|
+
* (e.g. 'npm_install', 'start_process').
|
|
479
|
+
*/
|
|
480
|
+
stage?: 'validate_port' | 'validate_files' | 'write_package_json' | 'npm_install' | 'write_main_file' | 'write_additional_files' | 'start_process' | 'expose_port';
|
|
476
481
|
error?: string;
|
|
477
482
|
}
|
|
478
483
|
interface ModelUsageQueryParams {
|
|
@@ -783,6 +788,11 @@ interface ModelFallback extends BaseFallback {
|
|
|
783
788
|
model: string;
|
|
784
789
|
temperature?: number;
|
|
785
790
|
maxTokens?: number;
|
|
791
|
+
topP?: number;
|
|
792
|
+
topK?: number;
|
|
793
|
+
frequencyPenalty?: number;
|
|
794
|
+
presencePenalty?: number;
|
|
795
|
+
seed?: number;
|
|
786
796
|
}
|
|
787
797
|
/**
|
|
788
798
|
* Step fallback for context steps - run a different step type
|
|
@@ -790,7 +800,7 @@ interface ModelFallback extends BaseFallback {
|
|
|
790
800
|
interface StepFallback extends BaseFallback {
|
|
791
801
|
type: 'step';
|
|
792
802
|
stepType: string;
|
|
793
|
-
stepConfig: Record<string,
|
|
803
|
+
stepConfig: Record<string, unknown>;
|
|
794
804
|
}
|
|
795
805
|
/**
|
|
796
806
|
* Flow fallback - call another flow
|
|
@@ -798,7 +808,7 @@ interface StepFallback extends BaseFallback {
|
|
|
798
808
|
interface FlowFallback extends BaseFallback {
|
|
799
809
|
type: 'flow';
|
|
800
810
|
flowId: string;
|
|
801
|
-
inputs?: Record<string,
|
|
811
|
+
inputs?: Record<string, unknown>;
|
|
802
812
|
}
|
|
803
813
|
/**
|
|
804
814
|
* Union of all prompt fallback types
|
|
@@ -855,6 +865,11 @@ interface PromptStepConfig$1 {
|
|
|
855
865
|
outputVariable?: string;
|
|
856
866
|
responseFormat?: 'text' | 'json';
|
|
857
867
|
temperature?: number;
|
|
868
|
+
topP?: number;
|
|
869
|
+
topK?: number;
|
|
870
|
+
frequencyPenalty?: number;
|
|
871
|
+
presencePenalty?: number;
|
|
872
|
+
seed?: number;
|
|
858
873
|
maxTokens?: number;
|
|
859
874
|
/**
|
|
860
875
|
* Enable reasoning/extended thinking for models that support it.
|
|
@@ -1697,7 +1712,7 @@ declare class FlowResult {
|
|
|
1697
1712
|
*/
|
|
1698
1713
|
|
|
1699
1714
|
interface LocalToolsOptions {
|
|
1700
|
-
localTools?: Record<string, (args:
|
|
1715
|
+
localTools?: Record<string, (args: unknown) => Promise<unknown>>;
|
|
1701
1716
|
}
|
|
1702
1717
|
interface FlowConfig {
|
|
1703
1718
|
name: string;
|
|
@@ -1713,7 +1728,7 @@ interface RecordConfig {
|
|
|
1713
1728
|
id?: number | string;
|
|
1714
1729
|
name?: string;
|
|
1715
1730
|
type?: string;
|
|
1716
|
-
metadata?:
|
|
1731
|
+
metadata?: JsonObject;
|
|
1717
1732
|
}
|
|
1718
1733
|
interface Message {
|
|
1719
1734
|
role: 'system' | 'user' | 'assistant';
|
|
@@ -1731,13 +1746,18 @@ interface PromptStepConfig {
|
|
|
1731
1746
|
outputVariable?: string;
|
|
1732
1747
|
responseFormat?: 'text' | 'json';
|
|
1733
1748
|
temperature?: number;
|
|
1749
|
+
topP?: number;
|
|
1750
|
+
topK?: number;
|
|
1751
|
+
frequencyPenalty?: number;
|
|
1752
|
+
presencePenalty?: number;
|
|
1753
|
+
seed?: number;
|
|
1734
1754
|
maxTokens?: number;
|
|
1735
1755
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
1736
1756
|
reasoning?: boolean | ReasoningConfig;
|
|
1737
1757
|
streamOutput?: boolean;
|
|
1738
1758
|
tools?: {
|
|
1739
1759
|
toolIds?: string[];
|
|
1740
|
-
[key: string]:
|
|
1760
|
+
[key: string]: unknown;
|
|
1741
1761
|
};
|
|
1742
1762
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1743
1763
|
errorHandling?: ErrorHandlingMode | PromptErrorHandling;
|
|
@@ -1755,7 +1775,7 @@ interface FetchUrlStepConfig {
|
|
|
1755
1775
|
fetchMethod?: 'http' | 'firecrawl';
|
|
1756
1776
|
firecrawl?: {
|
|
1757
1777
|
formats?: string[];
|
|
1758
|
-
[key: string]:
|
|
1778
|
+
[key: string]: unknown;
|
|
1759
1779
|
};
|
|
1760
1780
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1761
1781
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -1778,8 +1798,8 @@ interface SetVariableStepConfig {
|
|
|
1778
1798
|
interface ConditionalStepConfig {
|
|
1779
1799
|
name: string;
|
|
1780
1800
|
condition: string;
|
|
1781
|
-
trueSteps?:
|
|
1782
|
-
falseSteps?:
|
|
1801
|
+
trueSteps?: unknown[];
|
|
1802
|
+
falseSteps?: unknown[];
|
|
1783
1803
|
enabled?: boolean;
|
|
1784
1804
|
}
|
|
1785
1805
|
interface SearchStepConfig {
|
|
@@ -1873,7 +1893,7 @@ interface SendEventStepConfig {
|
|
|
1873
1893
|
name: string;
|
|
1874
1894
|
provider: string;
|
|
1875
1895
|
eventName: string;
|
|
1876
|
-
properties?: Record<string,
|
|
1896
|
+
properties?: Record<string, unknown>;
|
|
1877
1897
|
outputVariable?: string;
|
|
1878
1898
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1879
1899
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -2119,7 +2139,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2119
2139
|
* @param localTools - Map of tool names to async functions that execute the tool logic
|
|
2120
2140
|
* @returns The final result of the flow execution
|
|
2121
2141
|
*/
|
|
2122
|
-
runWithLocalTools(localTools: Record<string, (args:
|
|
2142
|
+
runWithLocalTools(localTools: Record<string, (args: unknown) => Promise<unknown>>, callbacks?: StreamCallbacks): Promise<FlowResult>;
|
|
2123
2143
|
build(): DispatchRequest;
|
|
2124
2144
|
private addStep;
|
|
2125
2145
|
}
|
|
@@ -2270,6 +2290,16 @@ interface ModelOverride$1 {
|
|
|
2270
2290
|
model: string;
|
|
2271
2291
|
/** Optional temperature override */
|
|
2272
2292
|
temperature?: number;
|
|
2293
|
+
/** Optional top-p (nucleus sampling) override */
|
|
2294
|
+
topP?: number;
|
|
2295
|
+
/** Optional top-k override */
|
|
2296
|
+
topK?: number;
|
|
2297
|
+
/** Optional frequency penalty override */
|
|
2298
|
+
frequencyPenalty?: number;
|
|
2299
|
+
/** Optional presence penalty override */
|
|
2300
|
+
presencePenalty?: number;
|
|
2301
|
+
/** Optional seed override */
|
|
2302
|
+
seed?: number;
|
|
2273
2303
|
/** Optional max tokens override */
|
|
2274
2304
|
maxTokens?: number;
|
|
2275
2305
|
}
|
|
@@ -2279,7 +2309,7 @@ interface EvalRunConfig {
|
|
|
2279
2309
|
/** Virtual flow definition (alternative to flowId) */
|
|
2280
2310
|
flow?: {
|
|
2281
2311
|
name: string;
|
|
2282
|
-
steps:
|
|
2312
|
+
steps: unknown[];
|
|
2283
2313
|
};
|
|
2284
2314
|
/** Record type to evaluate against */
|
|
2285
2315
|
recordType?: string;
|
|
@@ -2287,7 +2317,7 @@ interface EvalRunConfig {
|
|
|
2287
2317
|
records?: Array<{
|
|
2288
2318
|
name: string;
|
|
2289
2319
|
type: string;
|
|
2290
|
-
metadata: Record<string,
|
|
2320
|
+
metadata: Record<string, unknown>;
|
|
2291
2321
|
}>;
|
|
2292
2322
|
/** Model overrides for single-model evaluation */
|
|
2293
2323
|
models?: ModelOverride$1[];
|
|
@@ -2302,7 +2332,7 @@ interface EvalRunConfig {
|
|
|
2302
2332
|
/** Continue on individual record failures */
|
|
2303
2333
|
continueOnError?: boolean;
|
|
2304
2334
|
/** Optional filter for records */
|
|
2305
|
-
filter?: Record<string,
|
|
2335
|
+
filter?: Record<string, unknown>;
|
|
2306
2336
|
/** Optional limit on number of records */
|
|
2307
2337
|
limit?: number;
|
|
2308
2338
|
}
|
|
@@ -2317,7 +2347,7 @@ interface EvalStatus {
|
|
|
2317
2347
|
records: Array<{
|
|
2318
2348
|
recordId: string;
|
|
2319
2349
|
status: 'success' | 'error';
|
|
2320
|
-
result?:
|
|
2350
|
+
result?: unknown;
|
|
2321
2351
|
error?: string;
|
|
2322
2352
|
executionTime: number;
|
|
2323
2353
|
}>;
|
|
@@ -2481,6 +2511,16 @@ interface CreatePromptData {
|
|
|
2481
2511
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2482
2512
|
/** Temperature */
|
|
2483
2513
|
temperature?: number;
|
|
2514
|
+
/** Top-p (nucleus) sampling */
|
|
2515
|
+
topP?: number;
|
|
2516
|
+
/** Top-k sampling */
|
|
2517
|
+
topK?: number;
|
|
2518
|
+
/** Frequency penalty */
|
|
2519
|
+
frequencyPenalty?: number;
|
|
2520
|
+
/** Presence penalty */
|
|
2521
|
+
presencePenalty?: number;
|
|
2522
|
+
/** Seed for reproducible sampling */
|
|
2523
|
+
seed?: number;
|
|
2484
2524
|
/** Max tokens */
|
|
2485
2525
|
maxTokens?: number;
|
|
2486
2526
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2503,6 +2543,16 @@ interface UpdatePromptData {
|
|
|
2503
2543
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2504
2544
|
/** Temperature */
|
|
2505
2545
|
temperature?: number;
|
|
2546
|
+
/** Top-p (nucleus) sampling */
|
|
2547
|
+
topP?: number;
|
|
2548
|
+
/** Top-k sampling */
|
|
2549
|
+
topK?: number;
|
|
2550
|
+
/** Frequency penalty */
|
|
2551
|
+
frequencyPenalty?: number;
|
|
2552
|
+
/** Presence penalty */
|
|
2553
|
+
presencePenalty?: number;
|
|
2554
|
+
/** Seed for reproducible sampling */
|
|
2555
|
+
seed?: number;
|
|
2506
2556
|
/** Max tokens */
|
|
2507
2557
|
maxTokens?: number;
|
|
2508
2558
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2518,6 +2568,11 @@ interface Prompt {
|
|
|
2518
2568
|
userPrompt: string;
|
|
2519
2569
|
responseFormat?: string;
|
|
2520
2570
|
temperature?: number;
|
|
2571
|
+
topP?: number;
|
|
2572
|
+
topK?: number;
|
|
2573
|
+
frequencyPenalty?: number;
|
|
2574
|
+
presencePenalty?: number;
|
|
2575
|
+
seed?: number;
|
|
2521
2576
|
maxTokens?: number;
|
|
2522
2577
|
reasoning?: boolean | ReasoningConfig;
|
|
2523
2578
|
createdAt: string;
|
|
@@ -2530,12 +2585,22 @@ interface PromptRunOptions {
|
|
|
2530
2585
|
record?: {
|
|
2531
2586
|
name?: string;
|
|
2532
2587
|
type?: string;
|
|
2533
|
-
metadata?: Record<string,
|
|
2588
|
+
metadata?: Record<string, unknown>;
|
|
2534
2589
|
};
|
|
2535
2590
|
/** Model override */
|
|
2536
2591
|
modelOverride?: string;
|
|
2537
2592
|
/** Temperature override */
|
|
2538
2593
|
temperature?: number;
|
|
2594
|
+
/** Top-p (nucleus) sampling override */
|
|
2595
|
+
topP?: number;
|
|
2596
|
+
/** Top-k sampling override */
|
|
2597
|
+
topK?: number;
|
|
2598
|
+
/** Frequency penalty override */
|
|
2599
|
+
frequencyPenalty?: number;
|
|
2600
|
+
/** Presence penalty override */
|
|
2601
|
+
presencePenalty?: number;
|
|
2602
|
+
/** Seed override */
|
|
2603
|
+
seed?: number;
|
|
2539
2604
|
/** Max tokens override */
|
|
2540
2605
|
maxTokens?: number;
|
|
2541
2606
|
/** Store the result */
|
|
@@ -4236,6 +4301,16 @@ interface AgentExecuteRequest {
|
|
|
4236
4301
|
debugMode?: boolean;
|
|
4237
4302
|
/** Model ID to use for this session (overrides agent config) */
|
|
4238
4303
|
model?: string;
|
|
4304
|
+
/** Nucleus sampling override */
|
|
4305
|
+
topP?: number;
|
|
4306
|
+
/** Top-k sampling override */
|
|
4307
|
+
topK?: number;
|
|
4308
|
+
/** Frequency penalty override */
|
|
4309
|
+
frequencyPenalty?: number;
|
|
4310
|
+
/** Presence penalty override */
|
|
4311
|
+
presencePenalty?: number;
|
|
4312
|
+
/** Deterministic seed override */
|
|
4313
|
+
seed?: number;
|
|
4239
4314
|
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4240
4315
|
reasoning?: boolean;
|
|
4241
4316
|
/** Runtime tools to make available during execution */
|
|
@@ -5191,6 +5266,16 @@ interface ModelOverride {
|
|
|
5191
5266
|
model: string;
|
|
5192
5267
|
/** Optional temperature override */
|
|
5193
5268
|
temperature?: number;
|
|
5269
|
+
/** Optional top-p override */
|
|
5270
|
+
topP?: number;
|
|
5271
|
+
/** Optional top-k override */
|
|
5272
|
+
topK?: number;
|
|
5273
|
+
/** Optional frequency penalty override */
|
|
5274
|
+
frequencyPenalty?: number;
|
|
5275
|
+
/** Optional presence penalty override */
|
|
5276
|
+
presencePenalty?: number;
|
|
5277
|
+
/** Optional seed override */
|
|
5278
|
+
seed?: number;
|
|
5194
5279
|
/** Optional max tokens override */
|
|
5195
5280
|
maxTokens?: number;
|
|
5196
5281
|
}
|
|
@@ -5210,7 +5295,7 @@ interface EvalRecord {
|
|
|
5210
5295
|
/** Record type */
|
|
5211
5296
|
type: string;
|
|
5212
5297
|
/** Record metadata */
|
|
5213
|
-
metadata: Record<string,
|
|
5298
|
+
metadata: Record<string, unknown>;
|
|
5214
5299
|
}
|
|
5215
5300
|
interface EvalRequest {
|
|
5216
5301
|
/** Flow ID (for existing flow) */
|
|
@@ -5218,7 +5303,7 @@ interface EvalRequest {
|
|
|
5218
5303
|
/** Virtual flow definition */
|
|
5219
5304
|
flow?: {
|
|
5220
5305
|
name: string;
|
|
5221
|
-
steps:
|
|
5306
|
+
steps: unknown[];
|
|
5222
5307
|
};
|
|
5223
5308
|
/** Record type to evaluate against */
|
|
5224
5309
|
recordType?: string;
|
|
@@ -5231,7 +5316,7 @@ interface EvalRequest {
|
|
|
5231
5316
|
/** Eval options */
|
|
5232
5317
|
options?: EvalOptions;
|
|
5233
5318
|
/** Optional filter for records */
|
|
5234
|
-
filter?: Record<string,
|
|
5319
|
+
filter?: Record<string, unknown>;
|
|
5235
5320
|
/** Optional limit on number of records */
|
|
5236
5321
|
limit?: number;
|
|
5237
5322
|
}
|
|
@@ -5247,7 +5332,7 @@ interface EvalResult {
|
|
|
5247
5332
|
records: Array<{
|
|
5248
5333
|
recordId: string;
|
|
5249
5334
|
status: 'success' | 'error';
|
|
5250
|
-
result?:
|
|
5335
|
+
result?: unknown;
|
|
5251
5336
|
error?: string;
|
|
5252
5337
|
executionTime: number;
|
|
5253
5338
|
}>;
|
|
@@ -5330,7 +5415,7 @@ declare class EvalBuilder {
|
|
|
5330
5415
|
/**
|
|
5331
5416
|
* Filter records to evaluate
|
|
5332
5417
|
*/
|
|
5333
|
-
withFilter(filter: Record<string,
|
|
5418
|
+
withFilter(filter: Record<string, unknown>): this;
|
|
5334
5419
|
/**
|
|
5335
5420
|
* Limit the number of records to evaluate
|
|
5336
5421
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -473,6 +473,11 @@ interface DeployCfSandboxResponse {
|
|
|
473
473
|
previewUrl: string;
|
|
474
474
|
output: string;
|
|
475
475
|
status: 'running' | 'error';
|
|
476
|
+
/**
|
|
477
|
+
* Last pipeline step that ran. On failure, identifies where it failed
|
|
478
|
+
* (e.g. 'npm_install', 'start_process').
|
|
479
|
+
*/
|
|
480
|
+
stage?: 'validate_port' | 'validate_files' | 'write_package_json' | 'npm_install' | 'write_main_file' | 'write_additional_files' | 'start_process' | 'expose_port';
|
|
476
481
|
error?: string;
|
|
477
482
|
}
|
|
478
483
|
interface ModelUsageQueryParams {
|
|
@@ -783,6 +788,11 @@ interface ModelFallback extends BaseFallback {
|
|
|
783
788
|
model: string;
|
|
784
789
|
temperature?: number;
|
|
785
790
|
maxTokens?: number;
|
|
791
|
+
topP?: number;
|
|
792
|
+
topK?: number;
|
|
793
|
+
frequencyPenalty?: number;
|
|
794
|
+
presencePenalty?: number;
|
|
795
|
+
seed?: number;
|
|
786
796
|
}
|
|
787
797
|
/**
|
|
788
798
|
* Step fallback for context steps - run a different step type
|
|
@@ -790,7 +800,7 @@ interface ModelFallback extends BaseFallback {
|
|
|
790
800
|
interface StepFallback extends BaseFallback {
|
|
791
801
|
type: 'step';
|
|
792
802
|
stepType: string;
|
|
793
|
-
stepConfig: Record<string,
|
|
803
|
+
stepConfig: Record<string, unknown>;
|
|
794
804
|
}
|
|
795
805
|
/**
|
|
796
806
|
* Flow fallback - call another flow
|
|
@@ -798,7 +808,7 @@ interface StepFallback extends BaseFallback {
|
|
|
798
808
|
interface FlowFallback extends BaseFallback {
|
|
799
809
|
type: 'flow';
|
|
800
810
|
flowId: string;
|
|
801
|
-
inputs?: Record<string,
|
|
811
|
+
inputs?: Record<string, unknown>;
|
|
802
812
|
}
|
|
803
813
|
/**
|
|
804
814
|
* Union of all prompt fallback types
|
|
@@ -855,6 +865,11 @@ interface PromptStepConfig$1 {
|
|
|
855
865
|
outputVariable?: string;
|
|
856
866
|
responseFormat?: 'text' | 'json';
|
|
857
867
|
temperature?: number;
|
|
868
|
+
topP?: number;
|
|
869
|
+
topK?: number;
|
|
870
|
+
frequencyPenalty?: number;
|
|
871
|
+
presencePenalty?: number;
|
|
872
|
+
seed?: number;
|
|
858
873
|
maxTokens?: number;
|
|
859
874
|
/**
|
|
860
875
|
* Enable reasoning/extended thinking for models that support it.
|
|
@@ -1697,7 +1712,7 @@ declare class FlowResult {
|
|
|
1697
1712
|
*/
|
|
1698
1713
|
|
|
1699
1714
|
interface LocalToolsOptions {
|
|
1700
|
-
localTools?: Record<string, (args:
|
|
1715
|
+
localTools?: Record<string, (args: unknown) => Promise<unknown>>;
|
|
1701
1716
|
}
|
|
1702
1717
|
interface FlowConfig {
|
|
1703
1718
|
name: string;
|
|
@@ -1713,7 +1728,7 @@ interface RecordConfig {
|
|
|
1713
1728
|
id?: number | string;
|
|
1714
1729
|
name?: string;
|
|
1715
1730
|
type?: string;
|
|
1716
|
-
metadata?:
|
|
1731
|
+
metadata?: JsonObject;
|
|
1717
1732
|
}
|
|
1718
1733
|
interface Message {
|
|
1719
1734
|
role: 'system' | 'user' | 'assistant';
|
|
@@ -1731,13 +1746,18 @@ interface PromptStepConfig {
|
|
|
1731
1746
|
outputVariable?: string;
|
|
1732
1747
|
responseFormat?: 'text' | 'json';
|
|
1733
1748
|
temperature?: number;
|
|
1749
|
+
topP?: number;
|
|
1750
|
+
topK?: number;
|
|
1751
|
+
frequencyPenalty?: number;
|
|
1752
|
+
presencePenalty?: number;
|
|
1753
|
+
seed?: number;
|
|
1734
1754
|
maxTokens?: number;
|
|
1735
1755
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
1736
1756
|
reasoning?: boolean | ReasoningConfig;
|
|
1737
1757
|
streamOutput?: boolean;
|
|
1738
1758
|
tools?: {
|
|
1739
1759
|
toolIds?: string[];
|
|
1740
|
-
[key: string]:
|
|
1760
|
+
[key: string]: unknown;
|
|
1741
1761
|
};
|
|
1742
1762
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1743
1763
|
errorHandling?: ErrorHandlingMode | PromptErrorHandling;
|
|
@@ -1755,7 +1775,7 @@ interface FetchUrlStepConfig {
|
|
|
1755
1775
|
fetchMethod?: 'http' | 'firecrawl';
|
|
1756
1776
|
firecrawl?: {
|
|
1757
1777
|
formats?: string[];
|
|
1758
|
-
[key: string]:
|
|
1778
|
+
[key: string]: unknown;
|
|
1759
1779
|
};
|
|
1760
1780
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1761
1781
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -1778,8 +1798,8 @@ interface SetVariableStepConfig {
|
|
|
1778
1798
|
interface ConditionalStepConfig {
|
|
1779
1799
|
name: string;
|
|
1780
1800
|
condition: string;
|
|
1781
|
-
trueSteps?:
|
|
1782
|
-
falseSteps?:
|
|
1801
|
+
trueSteps?: unknown[];
|
|
1802
|
+
falseSteps?: unknown[];
|
|
1783
1803
|
enabled?: boolean;
|
|
1784
1804
|
}
|
|
1785
1805
|
interface SearchStepConfig {
|
|
@@ -1873,7 +1893,7 @@ interface SendEventStepConfig {
|
|
|
1873
1893
|
name: string;
|
|
1874
1894
|
provider: string;
|
|
1875
1895
|
eventName: string;
|
|
1876
|
-
properties?: Record<string,
|
|
1896
|
+
properties?: Record<string, unknown>;
|
|
1877
1897
|
outputVariable?: string;
|
|
1878
1898
|
/** Error handling configuration - supports simple mode or fallback chains */
|
|
1879
1899
|
errorHandling?: ErrorHandlingMode | ContextErrorHandling;
|
|
@@ -2119,7 +2139,7 @@ declare class RuntypeFlowBuilder {
|
|
|
2119
2139
|
* @param localTools - Map of tool names to async functions that execute the tool logic
|
|
2120
2140
|
* @returns The final result of the flow execution
|
|
2121
2141
|
*/
|
|
2122
|
-
runWithLocalTools(localTools: Record<string, (args:
|
|
2142
|
+
runWithLocalTools(localTools: Record<string, (args: unknown) => Promise<unknown>>, callbacks?: StreamCallbacks): Promise<FlowResult>;
|
|
2123
2143
|
build(): DispatchRequest;
|
|
2124
2144
|
private addStep;
|
|
2125
2145
|
}
|
|
@@ -2270,6 +2290,16 @@ interface ModelOverride$1 {
|
|
|
2270
2290
|
model: string;
|
|
2271
2291
|
/** Optional temperature override */
|
|
2272
2292
|
temperature?: number;
|
|
2293
|
+
/** Optional top-p (nucleus sampling) override */
|
|
2294
|
+
topP?: number;
|
|
2295
|
+
/** Optional top-k override */
|
|
2296
|
+
topK?: number;
|
|
2297
|
+
/** Optional frequency penalty override */
|
|
2298
|
+
frequencyPenalty?: number;
|
|
2299
|
+
/** Optional presence penalty override */
|
|
2300
|
+
presencePenalty?: number;
|
|
2301
|
+
/** Optional seed override */
|
|
2302
|
+
seed?: number;
|
|
2273
2303
|
/** Optional max tokens override */
|
|
2274
2304
|
maxTokens?: number;
|
|
2275
2305
|
}
|
|
@@ -2279,7 +2309,7 @@ interface EvalRunConfig {
|
|
|
2279
2309
|
/** Virtual flow definition (alternative to flowId) */
|
|
2280
2310
|
flow?: {
|
|
2281
2311
|
name: string;
|
|
2282
|
-
steps:
|
|
2312
|
+
steps: unknown[];
|
|
2283
2313
|
};
|
|
2284
2314
|
/** Record type to evaluate against */
|
|
2285
2315
|
recordType?: string;
|
|
@@ -2287,7 +2317,7 @@ interface EvalRunConfig {
|
|
|
2287
2317
|
records?: Array<{
|
|
2288
2318
|
name: string;
|
|
2289
2319
|
type: string;
|
|
2290
|
-
metadata: Record<string,
|
|
2320
|
+
metadata: Record<string, unknown>;
|
|
2291
2321
|
}>;
|
|
2292
2322
|
/** Model overrides for single-model evaluation */
|
|
2293
2323
|
models?: ModelOverride$1[];
|
|
@@ -2302,7 +2332,7 @@ interface EvalRunConfig {
|
|
|
2302
2332
|
/** Continue on individual record failures */
|
|
2303
2333
|
continueOnError?: boolean;
|
|
2304
2334
|
/** Optional filter for records */
|
|
2305
|
-
filter?: Record<string,
|
|
2335
|
+
filter?: Record<string, unknown>;
|
|
2306
2336
|
/** Optional limit on number of records */
|
|
2307
2337
|
limit?: number;
|
|
2308
2338
|
}
|
|
@@ -2317,7 +2347,7 @@ interface EvalStatus {
|
|
|
2317
2347
|
records: Array<{
|
|
2318
2348
|
recordId: string;
|
|
2319
2349
|
status: 'success' | 'error';
|
|
2320
|
-
result?:
|
|
2350
|
+
result?: unknown;
|
|
2321
2351
|
error?: string;
|
|
2322
2352
|
executionTime: number;
|
|
2323
2353
|
}>;
|
|
@@ -2481,6 +2511,16 @@ interface CreatePromptData {
|
|
|
2481
2511
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2482
2512
|
/** Temperature */
|
|
2483
2513
|
temperature?: number;
|
|
2514
|
+
/** Top-p (nucleus) sampling */
|
|
2515
|
+
topP?: number;
|
|
2516
|
+
/** Top-k sampling */
|
|
2517
|
+
topK?: number;
|
|
2518
|
+
/** Frequency penalty */
|
|
2519
|
+
frequencyPenalty?: number;
|
|
2520
|
+
/** Presence penalty */
|
|
2521
|
+
presencePenalty?: number;
|
|
2522
|
+
/** Seed for reproducible sampling */
|
|
2523
|
+
seed?: number;
|
|
2484
2524
|
/** Max tokens */
|
|
2485
2525
|
maxTokens?: number;
|
|
2486
2526
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2503,6 +2543,16 @@ interface UpdatePromptData {
|
|
|
2503
2543
|
responseFormat?: 'text' | 'json' | 'markdown';
|
|
2504
2544
|
/** Temperature */
|
|
2505
2545
|
temperature?: number;
|
|
2546
|
+
/** Top-p (nucleus) sampling */
|
|
2547
|
+
topP?: number;
|
|
2548
|
+
/** Top-k sampling */
|
|
2549
|
+
topK?: number;
|
|
2550
|
+
/** Frequency penalty */
|
|
2551
|
+
frequencyPenalty?: number;
|
|
2552
|
+
/** Presence penalty */
|
|
2553
|
+
presencePenalty?: number;
|
|
2554
|
+
/** Seed for reproducible sampling */
|
|
2555
|
+
seed?: number;
|
|
2506
2556
|
/** Max tokens */
|
|
2507
2557
|
maxTokens?: number;
|
|
2508
2558
|
/** Enable reasoning/extended thinking. Use `true` for defaults or `ReasoningConfig` for fine-grained control */
|
|
@@ -2518,6 +2568,11 @@ interface Prompt {
|
|
|
2518
2568
|
userPrompt: string;
|
|
2519
2569
|
responseFormat?: string;
|
|
2520
2570
|
temperature?: number;
|
|
2571
|
+
topP?: number;
|
|
2572
|
+
topK?: number;
|
|
2573
|
+
frequencyPenalty?: number;
|
|
2574
|
+
presencePenalty?: number;
|
|
2575
|
+
seed?: number;
|
|
2521
2576
|
maxTokens?: number;
|
|
2522
2577
|
reasoning?: boolean | ReasoningConfig;
|
|
2523
2578
|
createdAt: string;
|
|
@@ -2530,12 +2585,22 @@ interface PromptRunOptions {
|
|
|
2530
2585
|
record?: {
|
|
2531
2586
|
name?: string;
|
|
2532
2587
|
type?: string;
|
|
2533
|
-
metadata?: Record<string,
|
|
2588
|
+
metadata?: Record<string, unknown>;
|
|
2534
2589
|
};
|
|
2535
2590
|
/** Model override */
|
|
2536
2591
|
modelOverride?: string;
|
|
2537
2592
|
/** Temperature override */
|
|
2538
2593
|
temperature?: number;
|
|
2594
|
+
/** Top-p (nucleus) sampling override */
|
|
2595
|
+
topP?: number;
|
|
2596
|
+
/** Top-k sampling override */
|
|
2597
|
+
topK?: number;
|
|
2598
|
+
/** Frequency penalty override */
|
|
2599
|
+
frequencyPenalty?: number;
|
|
2600
|
+
/** Presence penalty override */
|
|
2601
|
+
presencePenalty?: number;
|
|
2602
|
+
/** Seed override */
|
|
2603
|
+
seed?: number;
|
|
2539
2604
|
/** Max tokens override */
|
|
2540
2605
|
maxTokens?: number;
|
|
2541
2606
|
/** Store the result */
|
|
@@ -4236,6 +4301,16 @@ interface AgentExecuteRequest {
|
|
|
4236
4301
|
debugMode?: boolean;
|
|
4237
4302
|
/** Model ID to use for this session (overrides agent config) */
|
|
4238
4303
|
model?: string;
|
|
4304
|
+
/** Nucleus sampling override */
|
|
4305
|
+
topP?: number;
|
|
4306
|
+
/** Top-k sampling override */
|
|
4307
|
+
topK?: number;
|
|
4308
|
+
/** Frequency penalty override */
|
|
4309
|
+
frequencyPenalty?: number;
|
|
4310
|
+
/** Presence penalty override */
|
|
4311
|
+
presencePenalty?: number;
|
|
4312
|
+
/** Deterministic seed override */
|
|
4313
|
+
seed?: number;
|
|
4239
4314
|
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4240
4315
|
reasoning?: boolean;
|
|
4241
4316
|
/** Runtime tools to make available during execution */
|
|
@@ -5191,6 +5266,16 @@ interface ModelOverride {
|
|
|
5191
5266
|
model: string;
|
|
5192
5267
|
/** Optional temperature override */
|
|
5193
5268
|
temperature?: number;
|
|
5269
|
+
/** Optional top-p override */
|
|
5270
|
+
topP?: number;
|
|
5271
|
+
/** Optional top-k override */
|
|
5272
|
+
topK?: number;
|
|
5273
|
+
/** Optional frequency penalty override */
|
|
5274
|
+
frequencyPenalty?: number;
|
|
5275
|
+
/** Optional presence penalty override */
|
|
5276
|
+
presencePenalty?: number;
|
|
5277
|
+
/** Optional seed override */
|
|
5278
|
+
seed?: number;
|
|
5194
5279
|
/** Optional max tokens override */
|
|
5195
5280
|
maxTokens?: number;
|
|
5196
5281
|
}
|
|
@@ -5210,7 +5295,7 @@ interface EvalRecord {
|
|
|
5210
5295
|
/** Record type */
|
|
5211
5296
|
type: string;
|
|
5212
5297
|
/** Record metadata */
|
|
5213
|
-
metadata: Record<string,
|
|
5298
|
+
metadata: Record<string, unknown>;
|
|
5214
5299
|
}
|
|
5215
5300
|
interface EvalRequest {
|
|
5216
5301
|
/** Flow ID (for existing flow) */
|
|
@@ -5218,7 +5303,7 @@ interface EvalRequest {
|
|
|
5218
5303
|
/** Virtual flow definition */
|
|
5219
5304
|
flow?: {
|
|
5220
5305
|
name: string;
|
|
5221
|
-
steps:
|
|
5306
|
+
steps: unknown[];
|
|
5222
5307
|
};
|
|
5223
5308
|
/** Record type to evaluate against */
|
|
5224
5309
|
recordType?: string;
|
|
@@ -5231,7 +5316,7 @@ interface EvalRequest {
|
|
|
5231
5316
|
/** Eval options */
|
|
5232
5317
|
options?: EvalOptions;
|
|
5233
5318
|
/** Optional filter for records */
|
|
5234
|
-
filter?: Record<string,
|
|
5319
|
+
filter?: Record<string, unknown>;
|
|
5235
5320
|
/** Optional limit on number of records */
|
|
5236
5321
|
limit?: number;
|
|
5237
5322
|
}
|
|
@@ -5247,7 +5332,7 @@ interface EvalResult {
|
|
|
5247
5332
|
records: Array<{
|
|
5248
5333
|
recordId: string;
|
|
5249
5334
|
status: 'success' | 'error';
|
|
5250
|
-
result?:
|
|
5335
|
+
result?: unknown;
|
|
5251
5336
|
error?: string;
|
|
5252
5337
|
executionTime: number;
|
|
5253
5338
|
}>;
|
|
@@ -5330,7 +5415,7 @@ declare class EvalBuilder {
|
|
|
5330
5415
|
/**
|
|
5331
5416
|
* Filter records to evaluate
|
|
5332
5417
|
*/
|
|
5333
|
-
withFilter(filter: Record<string,
|
|
5418
|
+
withFilter(filter: Record<string, unknown>): this;
|
|
5334
5419
|
/**
|
|
5335
5420
|
* Limit the number of records to evaluate
|
|
5336
5421
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -921,18 +921,19 @@ var RuntypeFlowBuilder = class {
|
|
|
921
921
|
const { streamEvents: streamEvents2 } = await Promise.resolve().then(() => (init_stream_utils(), stream_utils_exports));
|
|
922
922
|
try {
|
|
923
923
|
for await (const event of streamEvents2(response)) {
|
|
924
|
-
|
|
924
|
+
const awaitEvent = event;
|
|
925
|
+
if (awaitEvent.type === "flow_await") {
|
|
925
926
|
pausedState = {
|
|
926
|
-
toolName:
|
|
927
|
-
parameters:
|
|
928
|
-
executionId:
|
|
927
|
+
toolName: awaitEvent.toolName || "",
|
|
928
|
+
parameters: awaitEvent.parameters,
|
|
929
|
+
executionId: awaitEvent.executionId || ""
|
|
929
930
|
};
|
|
930
931
|
}
|
|
931
|
-
if (
|
|
932
|
+
if (awaitEvent.type === "step_await") {
|
|
932
933
|
pausedState = {
|
|
933
|
-
toolName:
|
|
934
|
-
parameters:
|
|
935
|
-
executionId:
|
|
934
|
+
toolName: awaitEvent.toolName || "",
|
|
935
|
+
parameters: awaitEvent.parameters,
|
|
936
|
+
executionId: awaitEvent.executionId || ""
|
|
936
937
|
};
|
|
937
938
|
}
|
|
938
939
|
switch (event.type) {
|
|
@@ -943,7 +944,7 @@ var RuntypeFlowBuilder = class {
|
|
|
943
944
|
wrappedCallbacks.onStepStart?.(event);
|
|
944
945
|
break;
|
|
945
946
|
case "step_delta": {
|
|
946
|
-
const chunkText =
|
|
947
|
+
const chunkText = awaitEvent.chunk || awaitEvent.text || "";
|
|
947
948
|
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
948
949
|
break;
|
|
949
950
|
}
|
|
@@ -1001,8 +1002,9 @@ var RuntypeFlowBuilder = class {
|
|
|
1001
1002
|
new Response(JSON.stringify(result), { headers: { "content-type": "application/json" } })
|
|
1002
1003
|
);
|
|
1003
1004
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1005
|
+
const pausedResult = result;
|
|
1006
|
+
if (pausedResult.status === "paused" && pausedResult.pausedReason?.type === "local_action") {
|
|
1007
|
+
const { toolName, parameters, executionId } = pausedResult.pausedReason;
|
|
1006
1008
|
if (!localTools[toolName]) {
|
|
1007
1009
|
throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
1008
1010
|
}
|
|
@@ -1457,6 +1459,21 @@ var PromptRunner = class {
|
|
|
1457
1459
|
if (this.options.temperature !== void 0) {
|
|
1458
1460
|
payload.temperature = this.options.temperature;
|
|
1459
1461
|
}
|
|
1462
|
+
if (this.options.topP !== void 0) {
|
|
1463
|
+
payload.topP = this.options.topP;
|
|
1464
|
+
}
|
|
1465
|
+
if (this.options.topK !== void 0) {
|
|
1466
|
+
payload.topK = this.options.topK;
|
|
1467
|
+
}
|
|
1468
|
+
if (this.options.frequencyPenalty !== void 0) {
|
|
1469
|
+
payload.frequencyPenalty = this.options.frequencyPenalty;
|
|
1470
|
+
}
|
|
1471
|
+
if (this.options.presencePenalty !== void 0) {
|
|
1472
|
+
payload.presencePenalty = this.options.presencePenalty;
|
|
1473
|
+
}
|
|
1474
|
+
if (this.options.seed !== void 0) {
|
|
1475
|
+
payload.seed = this.options.seed;
|
|
1476
|
+
}
|
|
1460
1477
|
if (this.options.maxTokens !== void 0) {
|
|
1461
1478
|
payload.maxTokens = this.options.maxTokens;
|
|
1462
1479
|
}
|
|
@@ -7033,6 +7050,11 @@ var FlowBuilder = class {
|
|
|
7033
7050
|
outputVariable: config.outputVariable,
|
|
7034
7051
|
responseFormat: config.responseFormat,
|
|
7035
7052
|
temperature: config.temperature,
|
|
7053
|
+
topP: config.topP,
|
|
7054
|
+
topK: config.topK,
|
|
7055
|
+
frequencyPenalty: config.frequencyPenalty,
|
|
7056
|
+
presencePenalty: config.presencePenalty,
|
|
7057
|
+
seed: config.seed,
|
|
7036
7058
|
maxTokens: config.maxTokens,
|
|
7037
7059
|
reasoning: config.reasoning,
|
|
7038
7060
|
streamOutput: config.streamOutput,
|
package/package.json
CHANGED