@runtypelabs/sdk 1.21.0 → 1.21.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/dist/index.d.cts +17 -242
- package/dist/index.d.ts +17 -242
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* SDK type definitions — self-contained for zero-dependency npm distribution.
|
|
3
|
+
*
|
|
4
|
+
* These types mirror the canonical entity definitions in @runtypelabs/shared
|
|
5
|
+
* (packages/shared/src/types/entities.ts and client-types.ts). When adding or
|
|
6
|
+
* modifying entity fields, update both locations.
|
|
4
7
|
*/
|
|
5
8
|
type JsonPrimitive = string | number | boolean | null;
|
|
6
9
|
type JsonArray = JsonValue[];
|
|
@@ -52,24 +55,29 @@ interface ApiResponse<T> {
|
|
|
52
55
|
}
|
|
53
56
|
interface FlowStep {
|
|
54
57
|
id: string;
|
|
58
|
+
flowId: string;
|
|
55
59
|
type: string;
|
|
56
60
|
name: string;
|
|
57
61
|
order: number;
|
|
58
62
|
enabled: boolean;
|
|
59
|
-
config:
|
|
63
|
+
config: Record<string, unknown>;
|
|
64
|
+
outputVariable?: string | null;
|
|
65
|
+
streamOutput?: boolean;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
60
68
|
}
|
|
61
69
|
interface Flow {
|
|
62
70
|
id: string;
|
|
63
71
|
name: string;
|
|
64
|
-
description?: string;
|
|
72
|
+
description?: string | null;
|
|
65
73
|
status: 'draft' | 'active' | 'paused' | 'failed';
|
|
74
|
+
config?: JsonObject;
|
|
66
75
|
userId: string;
|
|
67
|
-
organizationId
|
|
76
|
+
organizationId: string | null;
|
|
68
77
|
createdAt: string;
|
|
69
78
|
updatedAt: string;
|
|
70
|
-
lastRunAt?: string;
|
|
71
|
-
|
|
72
|
-
/** Flow steps embedded in the flow response (consolidated from flow_steps endpoint) */
|
|
79
|
+
lastRunAt?: string | null;
|
|
80
|
+
/** Flow steps embedded in the flow response */
|
|
73
81
|
flowSteps?: FlowStep[];
|
|
74
82
|
/** Number of steps in the flow */
|
|
75
83
|
stepCount?: number;
|
|
@@ -124,6 +132,7 @@ interface RuntypeRecord {
|
|
|
124
132
|
}> | null;
|
|
125
133
|
availableFields?: string[];
|
|
126
134
|
userId: string;
|
|
135
|
+
organizationId?: string | null;
|
|
127
136
|
createdAt: string;
|
|
128
137
|
updatedAt: string;
|
|
129
138
|
}
|
|
@@ -286,8 +295,6 @@ interface UpsertOptions$2 {
|
|
|
286
295
|
}
|
|
287
296
|
/**
|
|
288
297
|
* Environment type for dispatch requests
|
|
289
|
-
* - 'development': Use development credentials (default for testing in dashboard)
|
|
290
|
-
* - 'production': Use production credentials (shows warning in UI)
|
|
291
298
|
*/
|
|
292
299
|
type DispatchEnvironment = 'development' | 'production';
|
|
293
300
|
interface DispatchRequest {
|
|
@@ -306,19 +313,7 @@ interface DispatchRequest {
|
|
|
306
313
|
role: 'system' | 'user' | 'assistant';
|
|
307
314
|
content: MessageContent;
|
|
308
315
|
}>;
|
|
309
|
-
/**
|
|
310
|
-
* Secure credentials for tool authentication
|
|
311
|
-
* - Never logged or returned in responses
|
|
312
|
-
* - Only used for variable substitution in tool headers/URLs
|
|
313
|
-
* - Available as {{secrets.key_name}} in tool configurations
|
|
314
|
-
*/
|
|
315
316
|
secrets?: Record<string, string>;
|
|
316
|
-
/**
|
|
317
|
-
* Top-level input variables accessible as {{varName}} in templates
|
|
318
|
-
* - Allows simple syntax without _record.metadata prefix
|
|
319
|
-
* - Takes precedence over record.metadata when resolving variables
|
|
320
|
-
* - Keys cannot start with '_' (reserved for system variables)
|
|
321
|
-
*/
|
|
322
317
|
inputs?: Record<string, unknown>;
|
|
323
318
|
options?: {
|
|
324
319
|
streamResponse?: boolean;
|
|
@@ -328,12 +323,6 @@ interface DispatchRequest {
|
|
|
328
323
|
storeResults?: boolean;
|
|
329
324
|
autoAppendMetadata?: boolean;
|
|
330
325
|
debugMode?: boolean;
|
|
331
|
-
/**
|
|
332
|
-
* Environment for credential lookup
|
|
333
|
-
* - 'development': Use development credentials (default)
|
|
334
|
-
* - 'production': Use production credentials
|
|
335
|
-
* Credentials are looked up with environment-specific first, then fallback to "all environments"
|
|
336
|
-
*/
|
|
337
326
|
environment?: DispatchEnvironment;
|
|
338
327
|
createVersion?: boolean;
|
|
339
328
|
versionType?: 'published' | 'draft' | 'test' | 'virtual';
|
|
@@ -398,33 +387,15 @@ interface ExternalToolConfig {
|
|
|
398
387
|
interface LocalToolConfig {
|
|
399
388
|
[key: string]: JsonValue;
|
|
400
389
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Subagent tool configuration (surfaces A + B in the subagent design plan).
|
|
403
|
-
*
|
|
404
|
-
* Surface A — saved subagent: set `agentId` to a saved agent in the same org.
|
|
405
|
-
* Surface B — inline subagent: set `agent` to a full exported agent JSON shape
|
|
406
|
-
* validated by the API at dispatch time.
|
|
407
|
-
*
|
|
408
|
-
* Exactly one of `agentId` / `agent` must be present; the API validator enforces this.
|
|
409
|
-
*/
|
|
410
390
|
interface SubagentToolConfig {
|
|
411
|
-
/** (A) Saved agent — org-scoped, ownership-checked at dispatch. */
|
|
412
391
|
agentId?: string;
|
|
413
|
-
/** (B) Inline agent definition. Full exported-agent JSON shape. */
|
|
414
392
|
agent?: JsonObject;
|
|
415
|
-
/** Tool subset granted to the child. REQUIRED. Must be a subset of the parent's resolved tools. */
|
|
416
393
|
allowedTools: string[];
|
|
417
|
-
/** Override the child agent's loop maxTurns. Default 5. */
|
|
418
394
|
maxTurns?: number;
|
|
419
|
-
/** Optional cap on the child's running cost. Default: inherits parent budget. */
|
|
420
395
|
maxCost?: number;
|
|
421
|
-
/** Per-invocation timeout in ms. Default 300_000 (5 min). */
|
|
422
396
|
timeoutMs?: number;
|
|
423
|
-
/** How the child's result is returned. Default 'text'. */
|
|
424
397
|
outputFormat?: 'text' | 'json' | 'last_message';
|
|
425
|
-
/** If true, prepend the parent's current messages to the child's initial context. Default false. */
|
|
426
398
|
inheritMessages?: boolean;
|
|
427
|
-
/** Optional template rendering the child's initial user message from the tool-call `parameters`. */
|
|
428
399
|
taskTemplate?: string;
|
|
429
400
|
}
|
|
430
401
|
interface BuiltInTool {
|
|
@@ -505,10 +476,6 @@ interface DeployCfSandboxResponse {
|
|
|
505
476
|
previewUrl: string;
|
|
506
477
|
output: string;
|
|
507
478
|
status: 'running' | 'error';
|
|
508
|
-
/**
|
|
509
|
-
* Last pipeline step that ran. On failure, identifies where it failed
|
|
510
|
-
* (e.g. 'npm_install', 'start_process').
|
|
511
|
-
*/
|
|
512
479
|
stage?: 'validate_port' | 'validate_files' | 'write_package_json' | 'npm_install' | 'write_main_file' | 'write_additional_files' | 'start_process' | 'expose_port';
|
|
513
480
|
error?: string;
|
|
514
481
|
}
|
|
@@ -554,36 +521,6 @@ interface ModelUsageResponse {
|
|
|
554
521
|
usageByModel: Record<string, ModelUsageDetail>;
|
|
555
522
|
timeSeries?: ModelUsageTimeSeries[];
|
|
556
523
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Runtime tool definition for inline tool definitions in requests.
|
|
559
|
-
* These are not persisted - they're defined and used within a single request.
|
|
560
|
-
*
|
|
561
|
-
* Runtime tools allow you to define tools dynamically without saving them
|
|
562
|
-
* to the database. They support the same tool types as saved tools:
|
|
563
|
-
* - external: HTTP API calls with variable substitution
|
|
564
|
-
* - custom: JavaScript/Python code execution
|
|
565
|
-
* - flow: Execute another Runtype flow
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```typescript
|
|
569
|
-
* const runtimeTool: RuntimeTool = {
|
|
570
|
-
* name: 'list_flows',
|
|
571
|
-
* description: 'List all flows in the workspace',
|
|
572
|
-
* toolType: 'external',
|
|
573
|
-
* parametersSchema: {
|
|
574
|
-
* type: 'object',
|
|
575
|
-
* properties: {
|
|
576
|
-
* limit: { type: 'number', default: 20 }
|
|
577
|
-
* }
|
|
578
|
-
* },
|
|
579
|
-
* config: {
|
|
580
|
-
* url: 'https://api.runtype.com/v1/flows',
|
|
581
|
-
* method: 'GET',
|
|
582
|
-
* headers: { Authorization: '{{_internal.auth_token}}' }
|
|
583
|
-
* }
|
|
584
|
-
* }
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
524
|
interface RuntimeTool {
|
|
588
525
|
name: string;
|
|
589
526
|
description: string;
|
|
@@ -591,9 +528,6 @@ interface RuntimeTool {
|
|
|
591
528
|
parametersSchema: JSONSchema;
|
|
592
529
|
config?: RuntimeToolConfig;
|
|
593
530
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Config options for runtime tools
|
|
596
|
-
*/
|
|
597
531
|
type RuntimeToolConfig = RuntimeFlowToolConfig | RuntimeCustomToolConfig | RuntimeExternalToolConfig | RuntimeLocalToolConfig | RuntimeSubagentToolConfig;
|
|
598
532
|
interface RuntimeLocalToolConfig {
|
|
599
533
|
[key: string]: JsonValue;
|
|
@@ -616,80 +550,22 @@ interface RuntimeExternalToolConfig {
|
|
|
616
550
|
headers?: Record<string, string>;
|
|
617
551
|
body?: string;
|
|
618
552
|
}
|
|
619
|
-
/**
|
|
620
|
-
* Runtime subagent tool config — inline form used when passing a subagent
|
|
621
|
-
* tool via `runtimeTools[]` rather than saving it.
|
|
622
|
-
*
|
|
623
|
-
* Structurally identical to `SubagentToolConfig`: the API validates the same
|
|
624
|
-
* fields on both paths, so keeping a single source of truth avoids silent
|
|
625
|
-
* divergence if a field is added on one side only. Kept as a named alias for
|
|
626
|
-
* readability at call sites that deal with runtime-only tools.
|
|
627
|
-
*/
|
|
628
553
|
type RuntimeSubagentToolConfig = SubagentToolConfig;
|
|
629
|
-
/**
|
|
630
|
-
* Opt-in configuration for agent-driven dynamic subagent spawning (surface C
|
|
631
|
-
* of the subagent design).
|
|
632
|
-
*
|
|
633
|
-
* When present on a prompt step's `tools.subagentConfig`, the API synthesizes
|
|
634
|
-
* a `spawn_subagent` tool that the parent LLM can call at runtime to spin off
|
|
635
|
-
* a focused child agent. The child's tools are drawn from `toolPool`, which
|
|
636
|
-
* must be a subset of the parent step's resolved tools.
|
|
637
|
-
*/
|
|
638
554
|
interface AgentSubagentConfig {
|
|
639
|
-
/** Pool of tool IDs the parent is permitted to grant. Supports wildcards (e.g. `mcp:*`). */
|
|
640
555
|
toolPool: string[];
|
|
641
|
-
/** Default iteration cap for spawned subagents. Default 5. */
|
|
642
556
|
defaultMaxTurns?: number;
|
|
643
|
-
/** Hard ceiling a subagent may request via maxTurns. Default 10. */
|
|
644
557
|
maxTurnsLimit?: number;
|
|
645
|
-
/** Total spawns per top-level parent run. Default 5. */
|
|
646
558
|
maxSpawnsPerRun?: number;
|
|
647
|
-
/** Default model for spawned subagents. Defaults to parent's model. */
|
|
648
559
|
defaultModel?: string;
|
|
649
|
-
/** Whether spawned subagents can themselves spawn. Default false. */
|
|
650
560
|
allowNesting?: boolean;
|
|
651
|
-
/** Default per-spawn timeout. Default 300_000. */
|
|
652
561
|
defaultTimeoutMs?: number;
|
|
653
562
|
}
|
|
654
|
-
/**
|
|
655
|
-
* Tools configuration for prompt steps.
|
|
656
|
-
* Supports both saved tools (by ID) and runtime tools (inline definitions).
|
|
657
|
-
*
|
|
658
|
-
* @example
|
|
659
|
-
* ```typescript
|
|
660
|
-
* const toolsConfig: ToolsConfig = {
|
|
661
|
-
* // Reference saved tools by ID
|
|
662
|
-
* toolIds: ['tool_abc123', 'tool_def456'],
|
|
663
|
-
* // Or define tools inline
|
|
664
|
-
* runtimeTools: [
|
|
665
|
-
* {
|
|
666
|
-
* name: 'search_docs',
|
|
667
|
-
* description: 'Search documentation',
|
|
668
|
-
* toolType: 'external',
|
|
669
|
-
* parametersSchema: { ... },
|
|
670
|
-
* config: { url: '...', method: 'GET' }
|
|
671
|
-
* }
|
|
672
|
-
* ],
|
|
673
|
-
* maxToolCalls: 10,
|
|
674
|
-
* toolCallStrategy: 'auto'
|
|
675
|
-
* }
|
|
676
|
-
* ```
|
|
677
|
-
*/
|
|
678
|
-
/**
|
|
679
|
-
* Authentication configuration for custom MCP servers
|
|
680
|
-
*/
|
|
681
563
|
interface CustomMCPServerAuth {
|
|
682
|
-
/** Authentication type */
|
|
683
564
|
type: 'bearer' | 'api_key' | 'basic' | 'custom_header' | 'oauth2' | 'none';
|
|
684
|
-
/** Header name for api_key or custom_header auth types */
|
|
685
565
|
headerName?: string;
|
|
686
|
-
/** Token/key value for bearer, api_key, or custom_header */
|
|
687
566
|
token?: string;
|
|
688
|
-
/** Username for basic auth */
|
|
689
567
|
username?: string;
|
|
690
|
-
/** Password for basic auth */
|
|
691
568
|
password?: string;
|
|
692
|
-
/** OAuth2 credentials (for oauth2 auth type) */
|
|
693
569
|
oauth2?: {
|
|
694
570
|
accessToken?: string;
|
|
695
571
|
refreshToken?: string;
|
|
@@ -701,135 +577,34 @@ interface CustomMCPServerAuth {
|
|
|
701
577
|
issuer?: string;
|
|
702
578
|
};
|
|
703
579
|
}
|
|
704
|
-
/**
|
|
705
|
-
* Custom MCP server configuration for runtime use.
|
|
706
|
-
*
|
|
707
|
-
* Allows connecting to custom MCP-compatible servers at dispatch time,
|
|
708
|
-
* with credentials passed inline (never logged or stored).
|
|
709
|
-
*
|
|
710
|
-
* @example
|
|
711
|
-
* ```typescript
|
|
712
|
-
* const mcpServer: CustomMCPServer = {
|
|
713
|
-
* id: 'notion',
|
|
714
|
-
* name: 'Notion Integration',
|
|
715
|
-
* url: 'https://my-notion-mcp.example.com/mcp',
|
|
716
|
-
* auth: {
|
|
717
|
-
* type: 'bearer',
|
|
718
|
-
* token: process.env.NOTION_MCP_TOKEN
|
|
719
|
-
* },
|
|
720
|
-
* timeout: 30000,
|
|
721
|
-
* allowedTools: ['create_page', 'search_pages']
|
|
722
|
-
* }
|
|
723
|
-
* ```
|
|
724
|
-
*/
|
|
725
580
|
interface CustomMCPServer {
|
|
726
|
-
/** Unique identifier for this server instance (used in tool IDs: mcp:custom_{id}:toolname) */
|
|
727
581
|
id: string;
|
|
728
|
-
/** Display name for UI/logging */
|
|
729
582
|
name?: string;
|
|
730
|
-
/** Server URL (required) */
|
|
731
583
|
url: string;
|
|
732
|
-
/** Authentication configuration (treated as secret, never logged) */
|
|
733
584
|
auth?: CustomMCPServerAuth;
|
|
734
|
-
/** Optional: filter to only allow specific tools (by name) */
|
|
735
585
|
allowedTools?: string[];
|
|
736
|
-
/** Optional: timeout in milliseconds (default: 30000, max: 60000) */
|
|
737
586
|
timeout?: number;
|
|
738
|
-
/** Optional: transport type (default: 'streamable_http') */
|
|
739
587
|
transport?: 'streamable_http' | 'rest';
|
|
740
|
-
/** Optional: whether the server is enabled (default: true) */
|
|
741
588
|
enabled?: boolean;
|
|
742
589
|
}
|
|
743
590
|
interface ToolsConfig {
|
|
744
|
-
/** IDs of saved tools to use */
|
|
745
591
|
toolIds?: string[];
|
|
746
|
-
/** Inline runtime tool definitions (not persisted) */
|
|
747
592
|
runtimeTools?: RuntimeTool[];
|
|
748
|
-
/**
|
|
749
|
-
* Opt-in agent-driven subagent spawning. When set, the API synthesizes a
|
|
750
|
-
* `spawn_subagent` tool that the step's model can call at runtime. Pool
|
|
751
|
-
* entries must be a subset of the parent step's resolved tools.
|
|
752
|
-
*/
|
|
753
593
|
subagentConfig?: AgentSubagentConfig;
|
|
754
|
-
/**
|
|
755
|
-
* Custom MCP servers with credentials passed at runtime.
|
|
756
|
-
* Maximum 5 servers per step.
|
|
757
|
-
*
|
|
758
|
-
* @example
|
|
759
|
-
* ```typescript
|
|
760
|
-
* mcpServers: [{
|
|
761
|
-
* id: 'notion',
|
|
762
|
-
* url: 'https://my-mcp.example.com/mcp',
|
|
763
|
-
* auth: { type: 'bearer', token: process.env.MCP_TOKEN }
|
|
764
|
-
* }]
|
|
765
|
-
* ```
|
|
766
|
-
*/
|
|
767
594
|
mcpServers?: CustomMCPServer[];
|
|
768
|
-
/** Maximum number of tool calls allowed per step */
|
|
769
595
|
maxToolCalls?: number;
|
|
770
|
-
/** Tool call strategy: 'auto' (model decides), 'required' (must call), 'none' (disabled) */
|
|
771
596
|
toolCallStrategy?: 'auto' | 'required' | 'none';
|
|
772
|
-
/** Whether to allow parallel tool calls */
|
|
773
597
|
parallelCalls?: boolean;
|
|
774
|
-
/** Per-tool configuration overrides */
|
|
775
598
|
toolConfigs?: Record<string, JsonObject>;
|
|
776
599
|
}
|
|
777
|
-
/**
|
|
778
|
-
* Reasoning configuration for AI models that support extended thinking.
|
|
779
|
-
*
|
|
780
|
-
* Enables models like GPT-5, Claude 4, Gemini 2.5 to show their reasoning process.
|
|
781
|
-
* Different providers have different configuration options.
|
|
782
|
-
*
|
|
783
|
-
* @example Simple boolean (uses provider defaults)
|
|
784
|
-
* ```typescript
|
|
785
|
-
* reasoning: true
|
|
786
|
-
* ```
|
|
787
|
-
*
|
|
788
|
-
* @example GPT-5 with detailed reasoning
|
|
789
|
-
* ```typescript
|
|
790
|
-
* reasoning: {
|
|
791
|
-
* enabled: true,
|
|
792
|
-
* reasoningEffort: 'high',
|
|
793
|
-
* reasoningSummary: 'detailed'
|
|
794
|
-
* }
|
|
795
|
-
* ```
|
|
796
|
-
*
|
|
797
|
-
* @example Claude with thinking budget
|
|
798
|
-
* ```typescript
|
|
799
|
-
* reasoning: {
|
|
800
|
-
* enabled: true,
|
|
801
|
-
* budgetTokens: 16000
|
|
802
|
-
* }
|
|
803
|
-
* ```
|
|
804
|
-
*/
|
|
805
600
|
interface ReasoningConfig {
|
|
806
|
-
/** Enable reasoning (required) */
|
|
807
601
|
enabled: boolean;
|
|
808
|
-
/** Reasoning effort level for OpenAI models. 'xhigh' only available for GPT-5.1-Codex-Max */
|
|
809
602
|
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
810
|
-
/** Reasoning summary mode - required for GPT-5 streaming. 'auto' for condensed, 'detailed' for comprehensive */
|
|
811
603
|
reasoningSummary?: 'auto' | 'detailed';
|
|
812
|
-
/** Maximum tokens for Claude extended thinking */
|
|
813
604
|
budgetTokens?: number;
|
|
814
|
-
/** Maximum tokens for Gemini thinking */
|
|
815
605
|
thinkingBudget?: number;
|
|
816
|
-
/** Whether to include thinking in the response */
|
|
817
606
|
includeThoughts?: boolean;
|
|
818
607
|
}
|
|
819
|
-
/**
|
|
820
|
-
* Reasoning configuration value - either a simple boolean or detailed config.
|
|
821
|
-
*
|
|
822
|
-
* @example Simple enable/disable
|
|
823
|
-
* ```typescript
|
|
824
|
-
* reasoning: true // Enable with provider defaults
|
|
825
|
-
* reasoning: false // Explicitly disable
|
|
826
|
-
* ```
|
|
827
|
-
*
|
|
828
|
-
* @example Detailed configuration
|
|
829
|
-
* ```typescript
|
|
830
|
-
* reasoning: { enabled: true, reasoningEffort: 'high' }
|
|
831
|
-
* ```
|
|
832
|
-
*/
|
|
833
608
|
type ReasoningValue = boolean | ReasoningConfig;
|
|
834
609
|
|
|
835
610
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* SDK type definitions — self-contained for zero-dependency npm distribution.
|
|
3
|
+
*
|
|
4
|
+
* These types mirror the canonical entity definitions in @runtypelabs/shared
|
|
5
|
+
* (packages/shared/src/types/entities.ts and client-types.ts). When adding or
|
|
6
|
+
* modifying entity fields, update both locations.
|
|
4
7
|
*/
|
|
5
8
|
type JsonPrimitive = string | number | boolean | null;
|
|
6
9
|
type JsonArray = JsonValue[];
|
|
@@ -52,24 +55,29 @@ interface ApiResponse<T> {
|
|
|
52
55
|
}
|
|
53
56
|
interface FlowStep {
|
|
54
57
|
id: string;
|
|
58
|
+
flowId: string;
|
|
55
59
|
type: string;
|
|
56
60
|
name: string;
|
|
57
61
|
order: number;
|
|
58
62
|
enabled: boolean;
|
|
59
|
-
config:
|
|
63
|
+
config: Record<string, unknown>;
|
|
64
|
+
outputVariable?: string | null;
|
|
65
|
+
streamOutput?: boolean;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
60
68
|
}
|
|
61
69
|
interface Flow {
|
|
62
70
|
id: string;
|
|
63
71
|
name: string;
|
|
64
|
-
description?: string;
|
|
72
|
+
description?: string | null;
|
|
65
73
|
status: 'draft' | 'active' | 'paused' | 'failed';
|
|
74
|
+
config?: JsonObject;
|
|
66
75
|
userId: string;
|
|
67
|
-
organizationId
|
|
76
|
+
organizationId: string | null;
|
|
68
77
|
createdAt: string;
|
|
69
78
|
updatedAt: string;
|
|
70
|
-
lastRunAt?: string;
|
|
71
|
-
|
|
72
|
-
/** Flow steps embedded in the flow response (consolidated from flow_steps endpoint) */
|
|
79
|
+
lastRunAt?: string | null;
|
|
80
|
+
/** Flow steps embedded in the flow response */
|
|
73
81
|
flowSteps?: FlowStep[];
|
|
74
82
|
/** Number of steps in the flow */
|
|
75
83
|
stepCount?: number;
|
|
@@ -124,6 +132,7 @@ interface RuntypeRecord {
|
|
|
124
132
|
}> | null;
|
|
125
133
|
availableFields?: string[];
|
|
126
134
|
userId: string;
|
|
135
|
+
organizationId?: string | null;
|
|
127
136
|
createdAt: string;
|
|
128
137
|
updatedAt: string;
|
|
129
138
|
}
|
|
@@ -286,8 +295,6 @@ interface UpsertOptions$2 {
|
|
|
286
295
|
}
|
|
287
296
|
/**
|
|
288
297
|
* Environment type for dispatch requests
|
|
289
|
-
* - 'development': Use development credentials (default for testing in dashboard)
|
|
290
|
-
* - 'production': Use production credentials (shows warning in UI)
|
|
291
298
|
*/
|
|
292
299
|
type DispatchEnvironment = 'development' | 'production';
|
|
293
300
|
interface DispatchRequest {
|
|
@@ -306,19 +313,7 @@ interface DispatchRequest {
|
|
|
306
313
|
role: 'system' | 'user' | 'assistant';
|
|
307
314
|
content: MessageContent;
|
|
308
315
|
}>;
|
|
309
|
-
/**
|
|
310
|
-
* Secure credentials for tool authentication
|
|
311
|
-
* - Never logged or returned in responses
|
|
312
|
-
* - Only used for variable substitution in tool headers/URLs
|
|
313
|
-
* - Available as {{secrets.key_name}} in tool configurations
|
|
314
|
-
*/
|
|
315
316
|
secrets?: Record<string, string>;
|
|
316
|
-
/**
|
|
317
|
-
* Top-level input variables accessible as {{varName}} in templates
|
|
318
|
-
* - Allows simple syntax without _record.metadata prefix
|
|
319
|
-
* - Takes precedence over record.metadata when resolving variables
|
|
320
|
-
* - Keys cannot start with '_' (reserved for system variables)
|
|
321
|
-
*/
|
|
322
317
|
inputs?: Record<string, unknown>;
|
|
323
318
|
options?: {
|
|
324
319
|
streamResponse?: boolean;
|
|
@@ -328,12 +323,6 @@ interface DispatchRequest {
|
|
|
328
323
|
storeResults?: boolean;
|
|
329
324
|
autoAppendMetadata?: boolean;
|
|
330
325
|
debugMode?: boolean;
|
|
331
|
-
/**
|
|
332
|
-
* Environment for credential lookup
|
|
333
|
-
* - 'development': Use development credentials (default)
|
|
334
|
-
* - 'production': Use production credentials
|
|
335
|
-
* Credentials are looked up with environment-specific first, then fallback to "all environments"
|
|
336
|
-
*/
|
|
337
326
|
environment?: DispatchEnvironment;
|
|
338
327
|
createVersion?: boolean;
|
|
339
328
|
versionType?: 'published' | 'draft' | 'test' | 'virtual';
|
|
@@ -398,33 +387,15 @@ interface ExternalToolConfig {
|
|
|
398
387
|
interface LocalToolConfig {
|
|
399
388
|
[key: string]: JsonValue;
|
|
400
389
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Subagent tool configuration (surfaces A + B in the subagent design plan).
|
|
403
|
-
*
|
|
404
|
-
* Surface A — saved subagent: set `agentId` to a saved agent in the same org.
|
|
405
|
-
* Surface B — inline subagent: set `agent` to a full exported agent JSON shape
|
|
406
|
-
* validated by the API at dispatch time.
|
|
407
|
-
*
|
|
408
|
-
* Exactly one of `agentId` / `agent` must be present; the API validator enforces this.
|
|
409
|
-
*/
|
|
410
390
|
interface SubagentToolConfig {
|
|
411
|
-
/** (A) Saved agent — org-scoped, ownership-checked at dispatch. */
|
|
412
391
|
agentId?: string;
|
|
413
|
-
/** (B) Inline agent definition. Full exported-agent JSON shape. */
|
|
414
392
|
agent?: JsonObject;
|
|
415
|
-
/** Tool subset granted to the child. REQUIRED. Must be a subset of the parent's resolved tools. */
|
|
416
393
|
allowedTools: string[];
|
|
417
|
-
/** Override the child agent's loop maxTurns. Default 5. */
|
|
418
394
|
maxTurns?: number;
|
|
419
|
-
/** Optional cap on the child's running cost. Default: inherits parent budget. */
|
|
420
395
|
maxCost?: number;
|
|
421
|
-
/** Per-invocation timeout in ms. Default 300_000 (5 min). */
|
|
422
396
|
timeoutMs?: number;
|
|
423
|
-
/** How the child's result is returned. Default 'text'. */
|
|
424
397
|
outputFormat?: 'text' | 'json' | 'last_message';
|
|
425
|
-
/** If true, prepend the parent's current messages to the child's initial context. Default false. */
|
|
426
398
|
inheritMessages?: boolean;
|
|
427
|
-
/** Optional template rendering the child's initial user message from the tool-call `parameters`. */
|
|
428
399
|
taskTemplate?: string;
|
|
429
400
|
}
|
|
430
401
|
interface BuiltInTool {
|
|
@@ -505,10 +476,6 @@ interface DeployCfSandboxResponse {
|
|
|
505
476
|
previewUrl: string;
|
|
506
477
|
output: string;
|
|
507
478
|
status: 'running' | 'error';
|
|
508
|
-
/**
|
|
509
|
-
* Last pipeline step that ran. On failure, identifies where it failed
|
|
510
|
-
* (e.g. 'npm_install', 'start_process').
|
|
511
|
-
*/
|
|
512
479
|
stage?: 'validate_port' | 'validate_files' | 'write_package_json' | 'npm_install' | 'write_main_file' | 'write_additional_files' | 'start_process' | 'expose_port';
|
|
513
480
|
error?: string;
|
|
514
481
|
}
|
|
@@ -554,36 +521,6 @@ interface ModelUsageResponse {
|
|
|
554
521
|
usageByModel: Record<string, ModelUsageDetail>;
|
|
555
522
|
timeSeries?: ModelUsageTimeSeries[];
|
|
556
523
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Runtime tool definition for inline tool definitions in requests.
|
|
559
|
-
* These are not persisted - they're defined and used within a single request.
|
|
560
|
-
*
|
|
561
|
-
* Runtime tools allow you to define tools dynamically without saving them
|
|
562
|
-
* to the database. They support the same tool types as saved tools:
|
|
563
|
-
* - external: HTTP API calls with variable substitution
|
|
564
|
-
* - custom: JavaScript/Python code execution
|
|
565
|
-
* - flow: Execute another Runtype flow
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```typescript
|
|
569
|
-
* const runtimeTool: RuntimeTool = {
|
|
570
|
-
* name: 'list_flows',
|
|
571
|
-
* description: 'List all flows in the workspace',
|
|
572
|
-
* toolType: 'external',
|
|
573
|
-
* parametersSchema: {
|
|
574
|
-
* type: 'object',
|
|
575
|
-
* properties: {
|
|
576
|
-
* limit: { type: 'number', default: 20 }
|
|
577
|
-
* }
|
|
578
|
-
* },
|
|
579
|
-
* config: {
|
|
580
|
-
* url: 'https://api.runtype.com/v1/flows',
|
|
581
|
-
* method: 'GET',
|
|
582
|
-
* headers: { Authorization: '{{_internal.auth_token}}' }
|
|
583
|
-
* }
|
|
584
|
-
* }
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
524
|
interface RuntimeTool {
|
|
588
525
|
name: string;
|
|
589
526
|
description: string;
|
|
@@ -591,9 +528,6 @@ interface RuntimeTool {
|
|
|
591
528
|
parametersSchema: JSONSchema;
|
|
592
529
|
config?: RuntimeToolConfig;
|
|
593
530
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Config options for runtime tools
|
|
596
|
-
*/
|
|
597
531
|
type RuntimeToolConfig = RuntimeFlowToolConfig | RuntimeCustomToolConfig | RuntimeExternalToolConfig | RuntimeLocalToolConfig | RuntimeSubagentToolConfig;
|
|
598
532
|
interface RuntimeLocalToolConfig {
|
|
599
533
|
[key: string]: JsonValue;
|
|
@@ -616,80 +550,22 @@ interface RuntimeExternalToolConfig {
|
|
|
616
550
|
headers?: Record<string, string>;
|
|
617
551
|
body?: string;
|
|
618
552
|
}
|
|
619
|
-
/**
|
|
620
|
-
* Runtime subagent tool config — inline form used when passing a subagent
|
|
621
|
-
* tool via `runtimeTools[]` rather than saving it.
|
|
622
|
-
*
|
|
623
|
-
* Structurally identical to `SubagentToolConfig`: the API validates the same
|
|
624
|
-
* fields on both paths, so keeping a single source of truth avoids silent
|
|
625
|
-
* divergence if a field is added on one side only. Kept as a named alias for
|
|
626
|
-
* readability at call sites that deal with runtime-only tools.
|
|
627
|
-
*/
|
|
628
553
|
type RuntimeSubagentToolConfig = SubagentToolConfig;
|
|
629
|
-
/**
|
|
630
|
-
* Opt-in configuration for agent-driven dynamic subagent spawning (surface C
|
|
631
|
-
* of the subagent design).
|
|
632
|
-
*
|
|
633
|
-
* When present on a prompt step's `tools.subagentConfig`, the API synthesizes
|
|
634
|
-
* a `spawn_subagent` tool that the parent LLM can call at runtime to spin off
|
|
635
|
-
* a focused child agent. The child's tools are drawn from `toolPool`, which
|
|
636
|
-
* must be a subset of the parent step's resolved tools.
|
|
637
|
-
*/
|
|
638
554
|
interface AgentSubagentConfig {
|
|
639
|
-
/** Pool of tool IDs the parent is permitted to grant. Supports wildcards (e.g. `mcp:*`). */
|
|
640
555
|
toolPool: string[];
|
|
641
|
-
/** Default iteration cap for spawned subagents. Default 5. */
|
|
642
556
|
defaultMaxTurns?: number;
|
|
643
|
-
/** Hard ceiling a subagent may request via maxTurns. Default 10. */
|
|
644
557
|
maxTurnsLimit?: number;
|
|
645
|
-
/** Total spawns per top-level parent run. Default 5. */
|
|
646
558
|
maxSpawnsPerRun?: number;
|
|
647
|
-
/** Default model for spawned subagents. Defaults to parent's model. */
|
|
648
559
|
defaultModel?: string;
|
|
649
|
-
/** Whether spawned subagents can themselves spawn. Default false. */
|
|
650
560
|
allowNesting?: boolean;
|
|
651
|
-
/** Default per-spawn timeout. Default 300_000. */
|
|
652
561
|
defaultTimeoutMs?: number;
|
|
653
562
|
}
|
|
654
|
-
/**
|
|
655
|
-
* Tools configuration for prompt steps.
|
|
656
|
-
* Supports both saved tools (by ID) and runtime tools (inline definitions).
|
|
657
|
-
*
|
|
658
|
-
* @example
|
|
659
|
-
* ```typescript
|
|
660
|
-
* const toolsConfig: ToolsConfig = {
|
|
661
|
-
* // Reference saved tools by ID
|
|
662
|
-
* toolIds: ['tool_abc123', 'tool_def456'],
|
|
663
|
-
* // Or define tools inline
|
|
664
|
-
* runtimeTools: [
|
|
665
|
-
* {
|
|
666
|
-
* name: 'search_docs',
|
|
667
|
-
* description: 'Search documentation',
|
|
668
|
-
* toolType: 'external',
|
|
669
|
-
* parametersSchema: { ... },
|
|
670
|
-
* config: { url: '...', method: 'GET' }
|
|
671
|
-
* }
|
|
672
|
-
* ],
|
|
673
|
-
* maxToolCalls: 10,
|
|
674
|
-
* toolCallStrategy: 'auto'
|
|
675
|
-
* }
|
|
676
|
-
* ```
|
|
677
|
-
*/
|
|
678
|
-
/**
|
|
679
|
-
* Authentication configuration for custom MCP servers
|
|
680
|
-
*/
|
|
681
563
|
interface CustomMCPServerAuth {
|
|
682
|
-
/** Authentication type */
|
|
683
564
|
type: 'bearer' | 'api_key' | 'basic' | 'custom_header' | 'oauth2' | 'none';
|
|
684
|
-
/** Header name for api_key or custom_header auth types */
|
|
685
565
|
headerName?: string;
|
|
686
|
-
/** Token/key value for bearer, api_key, or custom_header */
|
|
687
566
|
token?: string;
|
|
688
|
-
/** Username for basic auth */
|
|
689
567
|
username?: string;
|
|
690
|
-
/** Password for basic auth */
|
|
691
568
|
password?: string;
|
|
692
|
-
/** OAuth2 credentials (for oauth2 auth type) */
|
|
693
569
|
oauth2?: {
|
|
694
570
|
accessToken?: string;
|
|
695
571
|
refreshToken?: string;
|
|
@@ -701,135 +577,34 @@ interface CustomMCPServerAuth {
|
|
|
701
577
|
issuer?: string;
|
|
702
578
|
};
|
|
703
579
|
}
|
|
704
|
-
/**
|
|
705
|
-
* Custom MCP server configuration for runtime use.
|
|
706
|
-
*
|
|
707
|
-
* Allows connecting to custom MCP-compatible servers at dispatch time,
|
|
708
|
-
* with credentials passed inline (never logged or stored).
|
|
709
|
-
*
|
|
710
|
-
* @example
|
|
711
|
-
* ```typescript
|
|
712
|
-
* const mcpServer: CustomMCPServer = {
|
|
713
|
-
* id: 'notion',
|
|
714
|
-
* name: 'Notion Integration',
|
|
715
|
-
* url: 'https://my-notion-mcp.example.com/mcp',
|
|
716
|
-
* auth: {
|
|
717
|
-
* type: 'bearer',
|
|
718
|
-
* token: process.env.NOTION_MCP_TOKEN
|
|
719
|
-
* },
|
|
720
|
-
* timeout: 30000,
|
|
721
|
-
* allowedTools: ['create_page', 'search_pages']
|
|
722
|
-
* }
|
|
723
|
-
* ```
|
|
724
|
-
*/
|
|
725
580
|
interface CustomMCPServer {
|
|
726
|
-
/** Unique identifier for this server instance (used in tool IDs: mcp:custom_{id}:toolname) */
|
|
727
581
|
id: string;
|
|
728
|
-
/** Display name for UI/logging */
|
|
729
582
|
name?: string;
|
|
730
|
-
/** Server URL (required) */
|
|
731
583
|
url: string;
|
|
732
|
-
/** Authentication configuration (treated as secret, never logged) */
|
|
733
584
|
auth?: CustomMCPServerAuth;
|
|
734
|
-
/** Optional: filter to only allow specific tools (by name) */
|
|
735
585
|
allowedTools?: string[];
|
|
736
|
-
/** Optional: timeout in milliseconds (default: 30000, max: 60000) */
|
|
737
586
|
timeout?: number;
|
|
738
|
-
/** Optional: transport type (default: 'streamable_http') */
|
|
739
587
|
transport?: 'streamable_http' | 'rest';
|
|
740
|
-
/** Optional: whether the server is enabled (default: true) */
|
|
741
588
|
enabled?: boolean;
|
|
742
589
|
}
|
|
743
590
|
interface ToolsConfig {
|
|
744
|
-
/** IDs of saved tools to use */
|
|
745
591
|
toolIds?: string[];
|
|
746
|
-
/** Inline runtime tool definitions (not persisted) */
|
|
747
592
|
runtimeTools?: RuntimeTool[];
|
|
748
|
-
/**
|
|
749
|
-
* Opt-in agent-driven subagent spawning. When set, the API synthesizes a
|
|
750
|
-
* `spawn_subagent` tool that the step's model can call at runtime. Pool
|
|
751
|
-
* entries must be a subset of the parent step's resolved tools.
|
|
752
|
-
*/
|
|
753
593
|
subagentConfig?: AgentSubagentConfig;
|
|
754
|
-
/**
|
|
755
|
-
* Custom MCP servers with credentials passed at runtime.
|
|
756
|
-
* Maximum 5 servers per step.
|
|
757
|
-
*
|
|
758
|
-
* @example
|
|
759
|
-
* ```typescript
|
|
760
|
-
* mcpServers: [{
|
|
761
|
-
* id: 'notion',
|
|
762
|
-
* url: 'https://my-mcp.example.com/mcp',
|
|
763
|
-
* auth: { type: 'bearer', token: process.env.MCP_TOKEN }
|
|
764
|
-
* }]
|
|
765
|
-
* ```
|
|
766
|
-
*/
|
|
767
594
|
mcpServers?: CustomMCPServer[];
|
|
768
|
-
/** Maximum number of tool calls allowed per step */
|
|
769
595
|
maxToolCalls?: number;
|
|
770
|
-
/** Tool call strategy: 'auto' (model decides), 'required' (must call), 'none' (disabled) */
|
|
771
596
|
toolCallStrategy?: 'auto' | 'required' | 'none';
|
|
772
|
-
/** Whether to allow parallel tool calls */
|
|
773
597
|
parallelCalls?: boolean;
|
|
774
|
-
/** Per-tool configuration overrides */
|
|
775
598
|
toolConfigs?: Record<string, JsonObject>;
|
|
776
599
|
}
|
|
777
|
-
/**
|
|
778
|
-
* Reasoning configuration for AI models that support extended thinking.
|
|
779
|
-
*
|
|
780
|
-
* Enables models like GPT-5, Claude 4, Gemini 2.5 to show their reasoning process.
|
|
781
|
-
* Different providers have different configuration options.
|
|
782
|
-
*
|
|
783
|
-
* @example Simple boolean (uses provider defaults)
|
|
784
|
-
* ```typescript
|
|
785
|
-
* reasoning: true
|
|
786
|
-
* ```
|
|
787
|
-
*
|
|
788
|
-
* @example GPT-5 with detailed reasoning
|
|
789
|
-
* ```typescript
|
|
790
|
-
* reasoning: {
|
|
791
|
-
* enabled: true,
|
|
792
|
-
* reasoningEffort: 'high',
|
|
793
|
-
* reasoningSummary: 'detailed'
|
|
794
|
-
* }
|
|
795
|
-
* ```
|
|
796
|
-
*
|
|
797
|
-
* @example Claude with thinking budget
|
|
798
|
-
* ```typescript
|
|
799
|
-
* reasoning: {
|
|
800
|
-
* enabled: true,
|
|
801
|
-
* budgetTokens: 16000
|
|
802
|
-
* }
|
|
803
|
-
* ```
|
|
804
|
-
*/
|
|
805
600
|
interface ReasoningConfig {
|
|
806
|
-
/** Enable reasoning (required) */
|
|
807
601
|
enabled: boolean;
|
|
808
|
-
/** Reasoning effort level for OpenAI models. 'xhigh' only available for GPT-5.1-Codex-Max */
|
|
809
602
|
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
810
|
-
/** Reasoning summary mode - required for GPT-5 streaming. 'auto' for condensed, 'detailed' for comprehensive */
|
|
811
603
|
reasoningSummary?: 'auto' | 'detailed';
|
|
812
|
-
/** Maximum tokens for Claude extended thinking */
|
|
813
604
|
budgetTokens?: number;
|
|
814
|
-
/** Maximum tokens for Gemini thinking */
|
|
815
605
|
thinkingBudget?: number;
|
|
816
|
-
/** Whether to include thinking in the response */
|
|
817
606
|
includeThoughts?: boolean;
|
|
818
607
|
}
|
|
819
|
-
/**
|
|
820
|
-
* Reasoning configuration value - either a simple boolean or detailed config.
|
|
821
|
-
*
|
|
822
|
-
* @example Simple enable/disable
|
|
823
|
-
* ```typescript
|
|
824
|
-
* reasoning: true // Enable with provider defaults
|
|
825
|
-
* reasoning: false // Explicitly disable
|
|
826
|
-
* ```
|
|
827
|
-
*
|
|
828
|
-
* @example Detailed configuration
|
|
829
|
-
* ```typescript
|
|
830
|
-
* reasoning: { enabled: true, reasoningEffort: 'high' }
|
|
831
|
-
* ```
|
|
832
|
-
*/
|
|
833
608
|
type ReasoningValue = boolean | ReasoningConfig;
|
|
834
609
|
|
|
835
610
|
/**
|
package/package.json
CHANGED