@runtypelabs/sdk 4.0.0 → 4.0.2

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 CHANGED
@@ -62,12 +62,23 @@ interface FlowFallback extends BaseFallback {
62
62
  /**
63
63
  * A single fallback trigger - the condition that activates the fallback chain.
64
64
  * `error` (the default) fires fallbacks when the step errors; `empty-output`
65
- * fires them when the step finished successfully but produced no visible text.
65
+ * fires them when the step finished successfully but produced no visible text;
66
+ * `slow` fires them when the model streams continuously but exceeds a total
67
+ * wall-clock duration cap (`afterMs`, in ms) — a slow-but-not-stalled call.
66
68
  */
67
- type FallbackTriggerType = 'error' | 'empty-output';
68
- interface FallbackTrigger {
69
- type: FallbackTriggerType;
70
- }
69
+ type FallbackTriggerType = 'error' | 'empty-output' | 'slow';
70
+ /**
71
+ * Discriminated by `type`: the `error` / `empty-output` variants are
72
+ * parameter-less; `slow` carries the total-duration cap (`afterMs`).
73
+ */
74
+ type FallbackTrigger = {
75
+ type: 'error';
76
+ } | {
77
+ type: 'empty-output';
78
+ } | {
79
+ type: 'slow';
80
+ afterMs: number;
81
+ };
71
82
  /**
72
83
  * Union of all prompt fallback types
73
84
  */
@@ -85,7 +96,9 @@ interface PromptErrorHandling {
85
96
  /**
86
97
  * Conditions that activate the fallback chain. Defaults to `[{ type: 'error' }]`
87
98
  * when omitted. Add `{ type: 'empty-output' }` to also run the chain when the
88
- * model finishes successfully but returns no visible text.
99
+ * model finishes successfully but returns no visible text, or
100
+ * `{ type: 'slow', afterMs }` to run it when the model exceeds a total
101
+ * wall-clock duration cap while still streaming.
89
102
  */
90
103
  triggers?: FallbackTrigger[];
91
104
  }
@@ -33707,11 +33720,13 @@ interface paths {
33707
33720
  "application/json": {
33708
33721
  data: {
33709
33722
  agentExecutionId: string | null;
33723
+ agentId: string | null;
33710
33724
  batchExecutionId: string | null;
33711
33725
  completedAt: string | null;
33712
33726
  createdAt: string;
33713
33727
  error: string | null;
33714
33728
  failedRecords: number | null;
33729
+ flowId: string | null;
33715
33730
  id: string;
33716
33731
  processedRecords: number | null;
33717
33732
  scheduleId: string;
@@ -41594,12 +41609,13 @@ declare class ClientFlowBuilder extends FlowBuilder {
41594
41609
  * Create an external runtime tool definition.
41595
41610
  *
41596
41611
  * External tools make HTTP requests to external APIs with support for
41597
- * variable substitution in URLs and headers.
41612
+ * variable substitution in URLs and headers. Reference tool parameters and
41613
+ * flow/execution context variables (e.g. `{{_flow}}`, `{{_user}}`,
41614
+ * `{{_execution}}`, `{{_record}}`) directly in the URL, headers, and body.
41598
41615
  *
41599
- * Special internal variables are available for auth:
41600
- * - `{{_internal.auth_token}}` - Bearer token for Runtype API auth
41601
- * - `{{_internal.user_id}}` - Current user ID
41602
- * - `{{_internal.org_id}}` - Current organization ID
41616
+ * Note: `{{_internal.*}}` variables (such as `_internal.auth_token`) are NOT
41617
+ * populated at runtime and are reserved/blocked by the execution engine.
41618
+ * Pass credentials via secret references (`{{secret:NAME}}`) instead.
41603
41619
  *
41604
41620
  * @example
41605
41621
  * ```typescript
@@ -41614,7 +41630,7 @@ declare class ClientFlowBuilder extends FlowBuilder {
41614
41630
  * },
41615
41631
  * url: 'https://api.runtype.com/v1/flows',
41616
41632
  * method: 'GET',
41617
- * headers: { Authorization: '{{_internal.auth_token}}' }
41633
+ * headers: { Authorization: 'Bearer {{secret:RUNTYPE_API_KEY}}' }
41618
41634
  * })
41619
41635
  * ```
41620
41636
  */
package/dist/index.d.ts CHANGED
@@ -62,12 +62,23 @@ interface FlowFallback extends BaseFallback {
62
62
  /**
63
63
  * A single fallback trigger - the condition that activates the fallback chain.
64
64
  * `error` (the default) fires fallbacks when the step errors; `empty-output`
65
- * fires them when the step finished successfully but produced no visible text.
65
+ * fires them when the step finished successfully but produced no visible text;
66
+ * `slow` fires them when the model streams continuously but exceeds a total
67
+ * wall-clock duration cap (`afterMs`, in ms) — a slow-but-not-stalled call.
66
68
  */
67
- type FallbackTriggerType = 'error' | 'empty-output';
68
- interface FallbackTrigger {
69
- type: FallbackTriggerType;
70
- }
69
+ type FallbackTriggerType = 'error' | 'empty-output' | 'slow';
70
+ /**
71
+ * Discriminated by `type`: the `error` / `empty-output` variants are
72
+ * parameter-less; `slow` carries the total-duration cap (`afterMs`).
73
+ */
74
+ type FallbackTrigger = {
75
+ type: 'error';
76
+ } | {
77
+ type: 'empty-output';
78
+ } | {
79
+ type: 'slow';
80
+ afterMs: number;
81
+ };
71
82
  /**
72
83
  * Union of all prompt fallback types
73
84
  */
@@ -85,7 +96,9 @@ interface PromptErrorHandling {
85
96
  /**
86
97
  * Conditions that activate the fallback chain. Defaults to `[{ type: 'error' }]`
87
98
  * when omitted. Add `{ type: 'empty-output' }` to also run the chain when the
88
- * model finishes successfully but returns no visible text.
99
+ * model finishes successfully but returns no visible text, or
100
+ * `{ type: 'slow', afterMs }` to run it when the model exceeds a total
101
+ * wall-clock duration cap while still streaming.
89
102
  */
90
103
  triggers?: FallbackTrigger[];
91
104
  }
@@ -33707,11 +33720,13 @@ interface paths {
33707
33720
  "application/json": {
33708
33721
  data: {
33709
33722
  agentExecutionId: string | null;
33723
+ agentId: string | null;
33710
33724
  batchExecutionId: string | null;
33711
33725
  completedAt: string | null;
33712
33726
  createdAt: string;
33713
33727
  error: string | null;
33714
33728
  failedRecords: number | null;
33729
+ flowId: string | null;
33715
33730
  id: string;
33716
33731
  processedRecords: number | null;
33717
33732
  scheduleId: string;
@@ -41594,12 +41609,13 @@ declare class ClientFlowBuilder extends FlowBuilder {
41594
41609
  * Create an external runtime tool definition.
41595
41610
  *
41596
41611
  * External tools make HTTP requests to external APIs with support for
41597
- * variable substitution in URLs and headers.
41612
+ * variable substitution in URLs and headers. Reference tool parameters and
41613
+ * flow/execution context variables (e.g. `{{_flow}}`, `{{_user}}`,
41614
+ * `{{_execution}}`, `{{_record}}`) directly in the URL, headers, and body.
41598
41615
  *
41599
- * Special internal variables are available for auth:
41600
- * - `{{_internal.auth_token}}` - Bearer token for Runtype API auth
41601
- * - `{{_internal.user_id}}` - Current user ID
41602
- * - `{{_internal.org_id}}` - Current organization ID
41616
+ * Note: `{{_internal.*}}` variables (such as `_internal.auth_token`) are NOT
41617
+ * populated at runtime and are reserved/blocked by the execution engine.
41618
+ * Pass credentials via secret references (`{{secret:NAME}}`) instead.
41603
41619
  *
41604
41620
  * @example
41605
41621
  * ```typescript
@@ -41614,7 +41630,7 @@ declare class ClientFlowBuilder extends FlowBuilder {
41614
41630
  * },
41615
41631
  * url: 'https://api.runtype.com/v1/flows',
41616
41632
  * method: 'GET',
41617
- * headers: { Authorization: '{{_internal.auth_token}}' }
41633
+ * headers: { Authorization: 'Bearer {{secret:RUNTYPE_API_KEY}}' }
41618
41634
  * })
41619
41635
  * ```
41620
41636
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
6
6
  "main": "dist/index.cjs",