@modelrelay/sdk 1.14.0 → 1.25.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.d.ts CHANGED
@@ -563,7 +563,7 @@ interface RetryMetadata {
563
563
  lastStatus?: number;
564
564
  lastError?: string;
565
565
  }
566
- type TransportErrorKind = "timeout" | "connect" | "request" | "other";
566
+ type TransportErrorKind = "timeout" | "connect" | "request" | "empty_response" | "other";
567
567
  interface RequestContext {
568
568
  method: string;
569
569
  path: string;
@@ -1714,6 +1714,106 @@ declare class ResponsesClient {
1714
1714
  * This is a thin wrapper around `ResponseBuilder` and `extractAssistantText`.
1715
1715
  */
1716
1716
  text(model: ModelId, system: string, user: string, options?: ResponsesRequestOptions): Promise<string>;
1717
+ /**
1718
+ * Generate a typed object from a Zod schema with a single function call.
1719
+ *
1720
+ * This is the most ergonomic way to get structured output - all configuration
1721
+ * is passed in a single object argument, matching the Vercel AI SDK pattern.
1722
+ *
1723
+ * @example
1724
+ * ```typescript
1725
+ * import { z } from 'zod';
1726
+ *
1727
+ * const review = await client.responses.object({
1728
+ * model: 'claude-sonnet-4-20250514',
1729
+ * schema: z.object({
1730
+ * vulnerabilities: z.array(z.string()),
1731
+ * riskLevel: z.enum(['low', 'medium', 'high']),
1732
+ * }),
1733
+ * system: 'You are a security expert.',
1734
+ * prompt: `Review this code:\n${code}`,
1735
+ * });
1736
+ *
1737
+ * console.log(review.riskLevel); // 'low' | 'medium' | 'high'
1738
+ * ```
1739
+ *
1740
+ * @example Parallel execution with Promise.all
1741
+ * ```typescript
1742
+ * const [security, performance] = await Promise.all([
1743
+ * client.responses.object({
1744
+ * model,
1745
+ * schema: SecuritySchema,
1746
+ * system: 'Security expert...',
1747
+ * prompt: code,
1748
+ * }),
1749
+ * client.responses.object({
1750
+ * model,
1751
+ * schema: PerformanceSchema,
1752
+ * system: 'Performance expert...',
1753
+ * prompt: code,
1754
+ * }),
1755
+ * ]);
1756
+ * ```
1757
+ */
1758
+ object<T>(args: {
1759
+ /** The model to use for generation. */
1760
+ model: ModelId;
1761
+ /** Zod schema defining the expected output structure. */
1762
+ schema: ZodLikeSchema;
1763
+ /** The user prompt/input to send to the model. */
1764
+ prompt: string;
1765
+ /** Optional system prompt to set context for the model. */
1766
+ system?: string;
1767
+ /** Maximum retry attempts on validation failure (default: 0). */
1768
+ maxRetries?: number;
1769
+ /** Handler for customizing retry messages. */
1770
+ retryHandler?: RetryHandler;
1771
+ /** Override the schema name in the JSON schema (defaults to "response"). */
1772
+ schemaName?: string;
1773
+ /** Customer ID for billing attribution. */
1774
+ customerId?: string;
1775
+ /** Request options (timeout, headers, etc). */
1776
+ options?: ResponsesRequestOptions;
1777
+ }): Promise<T>;
1778
+ /**
1779
+ * Generate a typed object with full result metadata.
1780
+ *
1781
+ * Like `object()` but returns the full `StructuredResult<T>` including
1782
+ * attempt count and request ID.
1783
+ *
1784
+ * @example
1785
+ * ```typescript
1786
+ * const result = await client.responses.objectWithMetadata({
1787
+ * model: 'claude-sonnet-4-20250514',
1788
+ * schema: ReviewSchema,
1789
+ * prompt: 'Review this code...',
1790
+ * });
1791
+ *
1792
+ * console.log(result.value); // The parsed object
1793
+ * console.log(result.attempts); // Number of attempts (1 = first try succeeded)
1794
+ * console.log(result.requestId); // Server request ID
1795
+ * ```
1796
+ */
1797
+ objectWithMetadata<T>(args: {
1798
+ /** The model to use for generation. */
1799
+ model: ModelId;
1800
+ /** Zod schema defining the expected output structure. */
1801
+ schema: ZodLikeSchema;
1802
+ /** The user prompt/input to send to the model. */
1803
+ prompt: string;
1804
+ /** Optional system prompt to set context for the model. */
1805
+ system?: string;
1806
+ /** Maximum retry attempts on validation failure (default: 0). */
1807
+ maxRetries?: number;
1808
+ /** Handler for customizing retry messages. */
1809
+ retryHandler?: RetryHandler;
1810
+ /** Override the schema name in the JSON schema (defaults to "response"). */
1811
+ schemaName?: string;
1812
+ /** Customer ID for billing attribution. */
1813
+ customerId?: string;
1814
+ /** Request options (timeout, headers, etc). */
1815
+ options?: ResponsesRequestOptions;
1816
+ }): Promise<StructuredResult<T>>;
1717
1817
  /**
1718
1818
  * Convenience helper for customer-attributed requests where the backend selects the model.
1719
1819
  *
@@ -1788,16 +1888,28 @@ declare function parseOutputName(raw: string): OutputName$1;
1788
1888
 
1789
1889
  declare const WorkflowKinds: {
1790
1890
  readonly WorkflowV0: "workflow.v0";
1891
+ readonly WorkflowV1: "workflow.v1";
1791
1892
  };
1792
- type WorkflowKind = (typeof WorkflowKinds)[keyof typeof WorkflowKinds];
1893
+ type WorkflowKindV0 = (typeof WorkflowKinds)["WorkflowV0"];
1894
+ type WorkflowKindV1 = (typeof WorkflowKinds)["WorkflowV1"];
1895
+ type WorkflowKind = WorkflowKindV0 | WorkflowKindV1;
1793
1896
  declare const WorkflowNodeTypes: {
1794
1897
  readonly LLMResponses: "llm.responses";
1795
1898
  readonly JoinAll: "join.all";
1796
1899
  readonly TransformJSON: "transform.json";
1797
1900
  };
1798
1901
  type WorkflowNodeType = (typeof WorkflowNodeTypes)[keyof typeof WorkflowNodeTypes];
1902
+ declare const WorkflowNodeTypesV1: {
1903
+ readonly LLMResponses: "llm.responses";
1904
+ readonly RouteSwitch: "route.switch";
1905
+ readonly JoinAll: "join.all";
1906
+ readonly JoinAny: "join.any";
1907
+ readonly JoinCollect: "join.collect";
1908
+ readonly TransformJSON: "transform.json";
1909
+ readonly MapFanout: "map.fanout";
1910
+ };
1799
1911
  type WorkflowSpecV0 = {
1800
- kind: WorkflowKind;
1912
+ kind: WorkflowKindV0;
1801
1913
  name?: string;
1802
1914
  execution?: {
1803
1915
  max_parallelism?: number;
@@ -1849,7 +1961,8 @@ type LLMResponsesBindingEncodingV0 = "json" | "json_string";
1849
1961
  type LLMResponsesBindingV0 = {
1850
1962
  from: NodeId$1;
1851
1963
  pointer?: string;
1852
- to: string;
1964
+ to?: string;
1965
+ to_placeholder?: string;
1853
1966
  encoding?: LLMResponsesBindingEncodingV0;
1854
1967
  };
1855
1968
  type ToolExecutionModeV0$1 = "server" | "client";
@@ -1861,6 +1974,134 @@ type LLMResponsesToolLimitsV0 = {
1861
1974
  max_tool_calls_per_step?: number;
1862
1975
  wait_ttl_ms?: number;
1863
1976
  };
1977
+ type ConditionSourceV1$1 = "node_output" | "node_status";
1978
+ type ConditionOpV1$1 = "equals" | "matches" | "exists";
1979
+ type ConditionV1$1 = {
1980
+ source: ConditionSourceV1$1;
1981
+ op: ConditionOpV1$1;
1982
+ path: string;
1983
+ value?: unknown;
1984
+ };
1985
+ type WorkflowEdgeV1 = {
1986
+ from: NodeId$1;
1987
+ to: NodeId$1;
1988
+ when?: ConditionV1$1;
1989
+ };
1990
+ type WorkflowOutputRefV1 = {
1991
+ name: OutputName$1;
1992
+ from: NodeId$1;
1993
+ pointer?: string;
1994
+ };
1995
+ type WorkflowSpecV1 = {
1996
+ kind: WorkflowKindV1;
1997
+ name?: string;
1998
+ execution?: {
1999
+ max_parallelism?: number;
2000
+ node_timeout_ms?: number;
2001
+ run_timeout_ms?: number;
2002
+ };
2003
+ nodes: ReadonlyArray<WorkflowNodeV1>;
2004
+ edges?: ReadonlyArray<WorkflowEdgeV1>;
2005
+ outputs: ReadonlyArray<WorkflowOutputRefV1>;
2006
+ };
2007
+ type ToolExecutionModeV1$1 = "server" | "client";
2008
+ type ToolExecutionV1$1 = {
2009
+ mode: ToolExecutionModeV1$1;
2010
+ };
2011
+ type LLMResponsesToolLimitsV1 = {
2012
+ max_llm_calls?: number;
2013
+ max_tool_calls_per_step?: number;
2014
+ wait_ttl_ms?: number;
2015
+ };
2016
+ type LLMResponsesBindingEncodingV1 = "json" | "json_string";
2017
+ type LLMResponsesBindingV1 = {
2018
+ from: NodeId$1;
2019
+ pointer?: string;
2020
+ to?: string;
2021
+ to_placeholder?: string;
2022
+ encoding?: LLMResponsesBindingEncodingV1;
2023
+ };
2024
+ type LLMResponsesNodeInputV1 = {
2025
+ request: WireResponsesRequest;
2026
+ stream?: boolean;
2027
+ tool_execution?: ToolExecutionV1$1;
2028
+ tool_limits?: LLMResponsesToolLimitsV1;
2029
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
2030
+ };
2031
+ type TransformJSONValueV1$1 = {
2032
+ from: NodeId$1;
2033
+ pointer?: string;
2034
+ };
2035
+ type TransformJSONNodeInputV1 = {
2036
+ object?: Record<string, TransformJSONValueV1$1>;
2037
+ merge?: Array<TransformJSONValueV1$1>;
2038
+ };
2039
+ type JoinAnyNodeInputV1 = {
2040
+ predicate?: ConditionV1$1;
2041
+ };
2042
+ type JoinCollectNodeInputV1 = {
2043
+ predicate?: ConditionV1$1;
2044
+ limit?: number;
2045
+ timeout_ms?: number;
2046
+ };
2047
+ type MapFanoutItemsV1 = {
2048
+ from: NodeId$1;
2049
+ path?: string;
2050
+ };
2051
+ type MapFanoutItemBindingV1 = {
2052
+ path?: string;
2053
+ to?: string;
2054
+ to_placeholder?: string;
2055
+ encoding?: LLMResponsesBindingEncodingV1;
2056
+ };
2057
+ type MapFanoutSubNodeV1 = {
2058
+ id: NodeId$1;
2059
+ type: typeof WorkflowNodeTypesV1.LLMResponses;
2060
+ input: LLMResponsesNodeInputV1;
2061
+ } | {
2062
+ id: NodeId$1;
2063
+ type: typeof WorkflowNodeTypesV1.RouteSwitch;
2064
+ input: LLMResponsesNodeInputV1;
2065
+ } | {
2066
+ id: NodeId$1;
2067
+ type: typeof WorkflowNodeTypesV1.TransformJSON;
2068
+ input: TransformJSONNodeInputV1;
2069
+ };
2070
+ type MapFanoutNodeInputV1 = {
2071
+ items: MapFanoutItemsV1;
2072
+ item_bindings?: ReadonlyArray<MapFanoutItemBindingV1>;
2073
+ subnode: MapFanoutSubNodeV1;
2074
+ max_parallelism?: number;
2075
+ };
2076
+ type WorkflowNodeV1 = {
2077
+ id: NodeId$1;
2078
+ type: typeof WorkflowNodeTypesV1.LLMResponses;
2079
+ input: LLMResponsesNodeInputV1;
2080
+ } | {
2081
+ id: NodeId$1;
2082
+ type: typeof WorkflowNodeTypesV1.RouteSwitch;
2083
+ input: LLMResponsesNodeInputV1;
2084
+ } | {
2085
+ id: NodeId$1;
2086
+ type: typeof WorkflowNodeTypesV1.JoinAll;
2087
+ input?: Record<string, unknown>;
2088
+ } | {
2089
+ id: NodeId$1;
2090
+ type: typeof WorkflowNodeTypesV1.JoinAny;
2091
+ input?: JoinAnyNodeInputV1;
2092
+ } | {
2093
+ id: NodeId$1;
2094
+ type: typeof WorkflowNodeTypesV1.JoinCollect;
2095
+ input: JoinCollectNodeInputV1;
2096
+ } | {
2097
+ id: NodeId$1;
2098
+ type: typeof WorkflowNodeTypesV1.TransformJSON;
2099
+ input: TransformJSONNodeInputV1;
2100
+ } | {
2101
+ id: NodeId$1;
2102
+ type: typeof WorkflowNodeTypesV1.MapFanout;
2103
+ input: MapFanoutNodeInputV1;
2104
+ };
1864
2105
  type RunStatusV0 = "running" | "waiting" | "succeeded" | "failed" | "canceled";
1865
2106
  type PayloadInfoV0$1 = {
1866
2107
  bytes: number;
@@ -2097,6 +2338,7 @@ declare class RunsEventStream implements AsyncIterable<RunEventV0> {
2097
2338
 
2098
2339
  type RunsCreateOptions = {
2099
2340
  customerId?: string;
2341
+ sessionId?: string;
2100
2342
  idempotencyKey?: string;
2101
2343
  signal?: AbortSignal;
2102
2344
  headers?: Record<string, string>;
@@ -2253,8 +2495,8 @@ declare class StreamProtocolError extends TransportError {
2253
2495
  status: number;
2254
2496
  });
2255
2497
  }
2256
- declare class StreamTimeoutError extends TransportError {
2257
- streamKind: StreamTimeoutKind;
2498
+ declare class StreamTimeoutError extends ModelRelayError {
2499
+ kind: StreamTimeoutKind;
2258
2500
  timeoutMs: number;
2259
2501
  constructor(streamKind: StreamTimeoutKind, timeoutMs: number);
2260
2502
  }
@@ -2387,6 +2629,10 @@ type WorkflowsCompileResponseV0 = {
2387
2629
  plan_json: unknown;
2388
2630
  plan_hash: PlanHash$1;
2389
2631
  };
2632
+ type WorkflowsCompileResponseV1 = {
2633
+ plan_json: unknown;
2634
+ plan_hash: PlanHash$1;
2635
+ };
2390
2636
  type WorkflowsCompileV0Result = ({
2391
2637
  ok: true;
2392
2638
  } & WorkflowsCompileResponseV0) | {
@@ -2401,6 +2647,20 @@ type WorkflowsCompileV0Result = ({
2401
2647
  code?: string;
2402
2648
  requestId?: string;
2403
2649
  };
2650
+ type WorkflowsCompileV1Result = ({
2651
+ ok: true;
2652
+ } & WorkflowsCompileResponseV1) | {
2653
+ ok: false;
2654
+ error_type: "validation_error";
2655
+ issues: ReadonlyArray<WorkflowValidationIssue>;
2656
+ } | {
2657
+ ok: false;
2658
+ error_type: "internal_error";
2659
+ status: number;
2660
+ message: string;
2661
+ code?: string;
2662
+ requestId?: string;
2663
+ };
2404
2664
  declare class WorkflowsClient {
2405
2665
  private readonly http;
2406
2666
  private readonly auth;
@@ -2411,6 +2671,7 @@ declare class WorkflowsClient {
2411
2671
  trace?: TraceCallbacks;
2412
2672
  });
2413
2673
  compileV0(spec: WorkflowSpecV0, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV0Result>;
2674
+ compileV1(spec: WorkflowSpecV1, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV1Result>;
2414
2675
  }
2415
2676
 
2416
2677
  /**
@@ -2438,6 +2699,26 @@ interface paths {
2438
2699
  patch?: never;
2439
2700
  trace?: never;
2440
2701
  };
2702
+ "/schemas/workflow_v1.schema.json": {
2703
+ parameters: {
2704
+ query?: never;
2705
+ header?: never;
2706
+ path?: never;
2707
+ cookie?: never;
2708
+ };
2709
+ /**
2710
+ * Get JSON Schema for workflow.v1
2711
+ * @description Returns the canonical JSON Schema (draft-07) for `workflow.v1`.
2712
+ */
2713
+ get: operations["getWorkflowV1Schema"];
2714
+ put?: never;
2715
+ post?: never;
2716
+ delete?: never;
2717
+ options?: never;
2718
+ head?: never;
2719
+ patch?: never;
2720
+ trace?: never;
2721
+ };
2441
2722
  "/schemas/run_event_v0.schema.json": {
2442
2723
  parameters: {
2443
2724
  query?: never;
@@ -3004,7 +3285,10 @@ interface paths {
3004
3285
  };
3005
3286
  get?: never;
3006
3287
  put?: never;
3007
- /** Create a response via the provider-agnostic API */
3288
+ /**
3289
+ * Create a response via the provider-agnostic API
3290
+ * @description Creates a model response. Auth accepts secret API keys or bearer tokens. Bearer tokens may be owner session tokens (dashboard/server) or end-user tokens; publishable keys are not allowed.
3291
+ */
3008
3292
  post: operations["createResponse"];
3009
3293
  delete?: never;
3010
3294
  options?: never;
@@ -3049,6 +3333,56 @@ interface paths {
3049
3333
  patch?: never;
3050
3334
  trace?: never;
3051
3335
  };
3336
+ "/images/{image_id}": {
3337
+ parameters: {
3338
+ query?: never;
3339
+ header?: never;
3340
+ path: {
3341
+ /** @description Image ID */
3342
+ image_id: string;
3343
+ };
3344
+ cookie?: never;
3345
+ };
3346
+ /**
3347
+ * Get image details
3348
+ * @description Retrieve information about a specific image, including its pinned status and URL.
3349
+ */
3350
+ get: operations["getImage"];
3351
+ put?: never;
3352
+ post?: never;
3353
+ delete?: never;
3354
+ options?: never;
3355
+ head?: never;
3356
+ patch?: never;
3357
+ trace?: never;
3358
+ };
3359
+ "/images/{image_id}/pin": {
3360
+ parameters: {
3361
+ query?: never;
3362
+ header?: never;
3363
+ path: {
3364
+ /** @description Image ID */
3365
+ image_id: string;
3366
+ };
3367
+ cookie?: never;
3368
+ };
3369
+ get?: never;
3370
+ put?: never;
3371
+ /**
3372
+ * Pin an image
3373
+ * @description Pin an image to prevent it from expiring. Pinned images remain accessible permanently (subject to tier limits).
3374
+ */
3375
+ post: operations["pinImage"];
3376
+ /**
3377
+ * Unpin an image
3378
+ * @description Unpin an image, setting it to expire after the default ephemeral period (7 days).
3379
+ */
3380
+ delete: operations["unpinImage"];
3381
+ options?: never;
3382
+ head?: never;
3383
+ patch?: never;
3384
+ trace?: never;
3385
+ };
3052
3386
  "/runs": {
3053
3387
  parameters: {
3054
3388
  query?: never;
@@ -3059,8 +3393,8 @@ interface paths {
3059
3393
  get?: never;
3060
3394
  put?: never;
3061
3395
  /**
3062
- * Start a workflow run (workflow.v0)
3063
- * @description Starts a run for a `workflow.v0` spec and returns a `run_id`. Auth matches `/responses` (API key or frontend bearer token). Session owner tokens from `/auth/login` are not accepted.
3396
+ * Start a workflow run (workflow.v0 or workflow.v1)
3397
+ * @description Starts a run for a `workflow.v0` or `workflow.v1` spec and returns a `run_id`. Auth matches `/responses` (API key or frontend bearer token). Session owner tokens from `/auth/login` are not accepted. Provide `session_id` to link the run to a session; when linked, assistant messages are appended to the session on completion.
3064
3398
  */
3065
3399
  post: operations["createRun"];
3066
3400
  delete?: never;
@@ -3167,7 +3501,11 @@ interface paths {
3167
3501
  delete: operations["deleteSession"];
3168
3502
  options?: never;
3169
3503
  head?: never;
3170
- patch?: never;
3504
+ /**
3505
+ * Update session metadata
3506
+ * @description Updates session metadata. Keys with null values are removed.
3507
+ */
3508
+ patch: operations["updateSession"];
3171
3509
  trace?: never;
3172
3510
  };
3173
3511
  "/sessions/{session_id}/messages": {
@@ -3192,6 +3530,110 @@ interface paths {
3192
3530
  patch?: never;
3193
3531
  trace?: never;
3194
3532
  };
3533
+ "/projects/{id}/tool-hooks": {
3534
+ parameters: {
3535
+ query?: never;
3536
+ header?: never;
3537
+ path: {
3538
+ id: components["parameters"]["ProjectID"];
3539
+ };
3540
+ cookie?: never;
3541
+ };
3542
+ /** List project tool hooks */
3543
+ get: operations["listProjectToolHooks"];
3544
+ put?: never;
3545
+ /** Create a project tool hook */
3546
+ post: operations["createProjectToolHook"];
3547
+ delete?: never;
3548
+ options?: never;
3549
+ head?: never;
3550
+ patch?: never;
3551
+ trace?: never;
3552
+ };
3553
+ "/projects/{id}/tool-hooks/{hook_id}": {
3554
+ parameters: {
3555
+ query?: never;
3556
+ header?: never;
3557
+ path: {
3558
+ id: components["parameters"]["ProjectID"];
3559
+ hook_id: components["parameters"]["ToolHookID"];
3560
+ };
3561
+ cookie?: never;
3562
+ };
3563
+ /** Get a project tool hook */
3564
+ get: operations["getProjectToolHook"];
3565
+ /** Update a project tool hook */
3566
+ put: operations["updateProjectToolHook"];
3567
+ post?: never;
3568
+ /** Delete a project tool hook */
3569
+ delete: operations["deleteProjectToolHook"];
3570
+ options?: never;
3571
+ head?: never;
3572
+ patch?: never;
3573
+ trace?: never;
3574
+ };
3575
+ "/projects/{id}/tool-hooks/{hook_id}/events": {
3576
+ parameters: {
3577
+ query?: never;
3578
+ header?: never;
3579
+ path: {
3580
+ id: components["parameters"]["ProjectID"];
3581
+ hook_id: components["parameters"]["ToolHookID"];
3582
+ };
3583
+ cookie?: never;
3584
+ };
3585
+ /** List tool hook delivery events */
3586
+ get: operations["listProjectToolHookEvents"];
3587
+ put?: never;
3588
+ post?: never;
3589
+ delete?: never;
3590
+ options?: never;
3591
+ head?: never;
3592
+ patch?: never;
3593
+ trace?: never;
3594
+ };
3595
+ "/projects/{id}/tool-hooks/{hook_id}/test": {
3596
+ parameters: {
3597
+ query?: never;
3598
+ header?: never;
3599
+ path: {
3600
+ id: components["parameters"]["ProjectID"];
3601
+ hook_id: components["parameters"]["ToolHookID"];
3602
+ };
3603
+ cookie?: never;
3604
+ };
3605
+ get?: never;
3606
+ put?: never;
3607
+ /** Test a tool hook */
3608
+ post: operations["testProjectToolHook"];
3609
+ delete?: never;
3610
+ options?: never;
3611
+ head?: never;
3612
+ patch?: never;
3613
+ trace?: never;
3614
+ };
3615
+ "/sessions/{session_id}/clear": {
3616
+ parameters: {
3617
+ query?: never;
3618
+ header?: never;
3619
+ path: {
3620
+ session_id: string;
3621
+ };
3622
+ cookie?: never;
3623
+ };
3624
+ get?: never;
3625
+ put?: never;
3626
+ /**
3627
+ * Clear session messages
3628
+ * @description Deletes all messages in the session and returns the updated session.
3629
+ */
3630
+ post: operations["clearSession"];
3631
+ delete?: never;
3632
+ options?: never;
3633
+ head?: never;
3634
+ patch?: never;
3635
+ trace?: never;
3636
+ };
3195
3637
  }
3196
3638
  type webhooks = Record<string, never>;
3197
3639
  interface components {
@@ -3266,15 +3708,15 @@ interface components {
3266
3708
  /** @description Whether the model is deprecated */
3267
3709
  deprecated: boolean;
3268
3710
  /**
3269
- * Format: uint64
3270
- * @description Input token price in cents per million (e.g., 300 = $3.00/1M tokens)
3711
+ * Format: int64
3712
+ * @description Provider input cost in cents per million tokens. Customer price is derived as cost * (1 + platformFeePercent/100).
3271
3713
  */
3272
- input_price_per_million_cents: number;
3714
+ model_input_cost_cents: number;
3273
3715
  /**
3274
- * Format: uint64
3275
- * @description Output token price in cents per million (e.g., 1500 = $15.00/1M tokens)
3716
+ * Format: int64
3717
+ * @description Provider output cost in cents per million tokens. Customer price is derived as cost * (1 + platformFeePercent/100).
3276
3718
  */
3277
- output_price_per_million_cents: number;
3719
+ model_output_cost_cents: number;
3278
3720
  /** @description Whether this is the default model for the tier */
3279
3721
  is_default: boolean;
3280
3722
  /** Format: date-time */
@@ -3282,12 +3724,9 @@ interface components {
3282
3724
  /** Format: date-time */
3283
3725
  updated_at: string;
3284
3726
  };
3727
+ /** @description Model to add to a tier. Pricing is derived from the model_pricing table. */
3285
3728
  TierModelCreate: {
3286
3729
  model_id: components["schemas"]["ModelId"];
3287
- /** Format: uint64 */
3288
- input_price_per_million_cents: number;
3289
- /** Format: uint64 */
3290
- output_price_per_million_cents: number;
3291
3730
  /** @default false */
3292
3731
  is_default: boolean;
3293
3732
  };
@@ -3699,12 +4138,21 @@ interface components {
3699
4138
  WorkflowSpecV0: {
3700
4139
  [key: string]: unknown;
3701
4140
  };
4141
+ /** @description A `workflow.v1` spec. The canonical JSON Schema is available at `/schemas/workflow_v1.schema.json`. */
4142
+ WorkflowSpecV1: {
4143
+ [key: string]: unknown;
4144
+ };
3702
4145
  RunsCreateOptionsV0: {
3703
4146
  idempotency_key?: string;
3704
4147
  };
3705
4148
  RunsCreateRequest: {
3706
- spec: components["schemas"]["WorkflowSpecV0"];
3707
- /** @description Reserved for future use. */
4149
+ spec: components["schemas"]["WorkflowSpecV0"] | components["schemas"]["WorkflowSpecV1"];
4150
+ /**
4151
+ * Format: uuid
4152
+ * @description Optional session ID to link this run to a session.
4153
+ */
4154
+ session_id?: string;
4155
+ /** @description Runtime inputs for the workflow. Required when the spec uses from_input references (e.g., map.fanout with items.from_input). Each key is the input name, and the value is the JSON data to provide. */
3708
4156
  input?: {
3709
4157
  [key: string]: unknown;
3710
4158
  };
@@ -3958,7 +4406,7 @@ interface components {
3958
4406
  * @description Workflow-critical model capability identifier.
3959
4407
  * @enum {string}
3960
4408
  */
3961
- ModelCapability: "tools" | "vision" | "web_search" | "web_fetch" | "computer_use" | "code_execution";
4409
+ ModelCapability: "text_generation" | "tools" | "vision" | "web_search" | "web_fetch" | "computer_use" | "code_execution" | "image_generation";
3962
4410
  Model: {
3963
4411
  model_id: components["schemas"]["ModelId"];
3964
4412
  provider: components["schemas"]["ProviderId"];
@@ -4080,7 +4528,7 @@ interface components {
4080
4528
  * @description Type of workflow node.
4081
4529
  * @enum {string}
4082
4530
  */
4083
- NodeTypeV0: "llm.responses" | "join.all" | "transform.json";
4531
+ NodeTypeV0: "llm.responses" | "route.switch" | "join.all" | "join.any" | "join.collect" | "map.fanout" | "transform.json";
4084
4532
  /** @description Tier code identifier (e.g., free, pro, enterprise). */
4085
4533
  TierCode: string;
4086
4534
  /** @description Request to generate images from a text prompt. */
@@ -4120,6 +4568,15 @@ interface components {
4120
4568
  b64_json?: string;
4121
4569
  /** @description MIME type of the image (e.g., 'image/png', 'image/webp') */
4122
4570
  mime_type?: string;
4571
+ /** @description Unique identifier for the image (used for pinning) */
4572
+ image_id?: string;
4573
+ /**
4574
+ * Format: date-time
4575
+ * @description When the image URL expires (null if pinned)
4576
+ */
4577
+ expires_at?: string;
4578
+ /** @description URL to pin this image for permanent storage */
4579
+ pin_url?: string;
4123
4580
  };
4124
4581
  /** @description Usage statistics for image generation. */
4125
4582
  ImageUsage: {
@@ -4129,8 +4586,22 @@ interface components {
4129
4586
  */
4130
4587
  images: number;
4131
4588
  };
4132
- /** @description Request body for creating a session. */
4133
- SessionCreateRequest: {
4589
+ /** @description Response from pin/unpin operations. */
4590
+ ImagePinResponse: {
4591
+ /** @description Image ID */
4592
+ id: string;
4593
+ /** @description Whether the image is currently pinned */
4594
+ pinned: boolean;
4595
+ /**
4596
+ * Format: date-time
4597
+ * @description When the image expires (null if pinned)
4598
+ */
4599
+ expires_at?: string;
4600
+ /** @description URL of the image */
4601
+ url: string;
4602
+ };
4603
+ /** @description Request body for creating a session. */
4604
+ SessionCreateRequest: {
4134
4605
  /**
4135
4606
  * Format: uuid
4136
4607
  * @description Optional end user ID to associate with the session
@@ -4233,11 +4704,93 @@ interface components {
4233
4704
  */
4234
4705
  run_id?: string;
4235
4706
  };
4707
+ ToolHookConfig: {
4708
+ /** Format: uuid */
4709
+ id?: string;
4710
+ /** Format: uuid */
4711
+ project_id?: string;
4712
+ /** @enum {string} */
4713
+ hook_type?: "pre_tool_use" | "post_tool_use" | "tool_execute";
4714
+ /** Format: uri */
4715
+ endpoint_url?: string;
4716
+ enabled?: boolean;
4717
+ /** Format: int32 */
4718
+ timeout_ms?: number;
4719
+ /** @enum {string} */
4720
+ fail_behavior?: "fail_closed" | "fail_open";
4721
+ tools_allowlist?: string[];
4722
+ allow_mutation?: boolean;
4723
+ /** Format: date-time */
4724
+ created_at?: string;
4725
+ /** Format: date-time */
4726
+ updated_at?: string;
4727
+ };
4728
+ ToolHookConfigInput: {
4729
+ /** @enum {string} */
4730
+ hook_type: "pre_tool_use" | "post_tool_use" | "tool_execute";
4731
+ /** Format: uri */
4732
+ endpoint_url: string;
4733
+ enabled?: boolean;
4734
+ /** Format: int32 */
4735
+ timeout_ms?: number;
4736
+ /** @enum {string} */
4737
+ fail_behavior?: "fail_closed" | "fail_open";
4738
+ tools_allowlist?: string[];
4739
+ allow_mutation?: boolean;
4740
+ };
4741
+ ToolHookConfigUpdate: {
4742
+ /** Format: uri */
4743
+ endpoint_url?: string;
4744
+ enabled?: boolean;
4745
+ /** Format: int32 */
4746
+ timeout_ms?: number;
4747
+ /** @enum {string} */
4748
+ fail_behavior?: "fail_closed" | "fail_open";
4749
+ tools_allowlist?: string[];
4750
+ allow_mutation?: boolean;
4751
+ rotate_secret?: boolean;
4752
+ };
4753
+ ToolHookEvent: {
4754
+ /** Format: uuid */
4755
+ id?: string;
4756
+ /** Format: uuid */
4757
+ hook_config_id?: string;
4758
+ request_id?: string;
4759
+ tool_call_id?: string;
4760
+ /** @enum {string} */
4761
+ status?: "success" | "blocked" | "timeout" | "error";
4762
+ /** Format: int32 */
4763
+ response_status?: number;
4764
+ response_body?: string;
4765
+ /** Format: int32 */
4766
+ latency_ms?: number;
4767
+ error?: string;
4768
+ /** Format: date-time */
4769
+ created_at?: string;
4770
+ };
4771
+ ToolHookTestResult: {
4772
+ /** @enum {string} */
4773
+ status?: "success" | "blocked" | "timeout" | "error";
4774
+ /** Format: int32 */
4775
+ response_status?: number;
4776
+ response_body?: string;
4777
+ /** Format: int32 */
4778
+ latency_ms?: number;
4779
+ error?: string;
4780
+ };
4781
+ /** @description Request body for updating session metadata. Null values remove keys. */
4782
+ SessionUpdateRequest: {
4783
+ /** @description Metadata fields to set or remove */
4784
+ metadata: {
4785
+ [key: string]: unknown;
4786
+ };
4787
+ };
4236
4788
  };
4237
4789
  responses: never;
4238
4790
  parameters: {
4239
4791
  ProjectID: string;
4240
4792
  WebhookID: string;
4793
+ ToolHookID: string;
4241
4794
  };
4242
4795
  requestBodies: never;
4243
4796
  headers: never;
@@ -4265,6 +4818,26 @@ interface operations {
4265
4818
  };
4266
4819
  };
4267
4820
  };
4821
+ getWorkflowV1Schema: {
4822
+ parameters: {
4823
+ query?: never;
4824
+ header?: never;
4825
+ path?: never;
4826
+ cookie?: never;
4827
+ };
4828
+ requestBody?: never;
4829
+ responses: {
4830
+ /** @description Schema document */
4831
+ 200: {
4832
+ headers: {
4833
+ [name: string]: unknown;
4834
+ };
4835
+ content: {
4836
+ "application/schema+json": Record<string, never>;
4837
+ };
4838
+ };
4839
+ };
4840
+ };
4268
4841
  getRunEventV0Schema: {
4269
4842
  parameters: {
4270
4843
  query?: never;
@@ -5564,6 +6137,110 @@ interface operations {
5564
6137
  };
5565
6138
  };
5566
6139
  };
6140
+ getImage: {
6141
+ parameters: {
6142
+ query?: never;
6143
+ header?: never;
6144
+ path: {
6145
+ /** @description Image ID */
6146
+ image_id: string;
6147
+ };
6148
+ cookie?: never;
6149
+ };
6150
+ requestBody?: never;
6151
+ responses: {
6152
+ /** @description Image details */
6153
+ 200: {
6154
+ headers: {
6155
+ [name: string]: unknown;
6156
+ };
6157
+ content: {
6158
+ "application/json": components["schemas"]["ImagePinResponse"];
6159
+ };
6160
+ };
6161
+ /** @description Image not found */
6162
+ 404: {
6163
+ headers: {
6164
+ [name: string]: unknown;
6165
+ };
6166
+ content?: never;
6167
+ };
6168
+ };
6169
+ };
6170
+ pinImage: {
6171
+ parameters: {
6172
+ query?: never;
6173
+ header?: never;
6174
+ path: {
6175
+ /** @description Image ID */
6176
+ image_id: string;
6177
+ };
6178
+ cookie?: never;
6179
+ };
6180
+ requestBody?: never;
6181
+ responses: {
6182
+ /** @description Image pinned successfully */
6183
+ 200: {
6184
+ headers: {
6185
+ [name: string]: unknown;
6186
+ };
6187
+ content: {
6188
+ "application/json": components["schemas"]["ImagePinResponse"];
6189
+ };
6190
+ };
6191
+ /** @description Quota exceeded */
6192
+ 403: {
6193
+ headers: {
6194
+ [name: string]: unknown;
6195
+ };
6196
+ content?: never;
6197
+ };
6198
+ /** @description Image not found */
6199
+ 404: {
6200
+ headers: {
6201
+ [name: string]: unknown;
6202
+ };
6203
+ content?: never;
6204
+ };
6205
+ /** @description Image has expired */
6206
+ 410: {
6207
+ headers: {
6208
+ [name: string]: unknown;
6209
+ };
6210
+ content?: never;
6211
+ };
6212
+ };
6213
+ };
6214
+ unpinImage: {
6215
+ parameters: {
6216
+ query?: never;
6217
+ header?: never;
6218
+ path: {
6219
+ /** @description Image ID */
6220
+ image_id: string;
6221
+ };
6222
+ cookie?: never;
6223
+ };
6224
+ requestBody?: never;
6225
+ responses: {
6226
+ /** @description Image unpinned successfully */
6227
+ 200: {
6228
+ headers: {
6229
+ [name: string]: unknown;
6230
+ };
6231
+ content: {
6232
+ "application/json": components["schemas"]["ImagePinResponse"];
6233
+ };
6234
+ };
6235
+ /** @description Image not found */
6236
+ 404: {
6237
+ headers: {
6238
+ [name: string]: unknown;
6239
+ };
6240
+ content?: never;
6241
+ };
6242
+ };
6243
+ };
5567
6244
  createRun: {
5568
6245
  parameters: {
5569
6246
  query?: never;
@@ -5791,6 +6468,53 @@ interface operations {
5791
6468
  };
5792
6469
  };
5793
6470
  };
6471
+ updateSession: {
6472
+ parameters: {
6473
+ query?: never;
6474
+ header?: never;
6475
+ path: {
6476
+ session_id: string;
6477
+ };
6478
+ cookie?: never;
6479
+ };
6480
+ requestBody: {
6481
+ content: {
6482
+ "application/json": components["schemas"]["SessionUpdateRequest"];
6483
+ };
6484
+ };
6485
+ responses: {
6486
+ /** @description Session updated */
6487
+ 200: {
6488
+ headers: {
6489
+ [name: string]: unknown;
6490
+ };
6491
+ content: {
6492
+ "application/json": components["schemas"]["SessionResponse"];
6493
+ };
6494
+ };
6495
+ /** @description Invalid request */
6496
+ 400: {
6497
+ headers: {
6498
+ [name: string]: unknown;
6499
+ };
6500
+ content?: never;
6501
+ };
6502
+ /** @description API key required */
6503
+ 401: {
6504
+ headers: {
6505
+ [name: string]: unknown;
6506
+ };
6507
+ content?: never;
6508
+ };
6509
+ /** @description Session not found */
6510
+ 404: {
6511
+ headers: {
6512
+ [name: string]: unknown;
6513
+ };
6514
+ content?: never;
6515
+ };
6516
+ };
6517
+ };
5794
6518
  addSessionMessage: {
5795
6519
  parameters: {
5796
6520
  query?: never;
@@ -5838,52 +6562,274 @@ interface operations {
5838
6562
  };
5839
6563
  };
5840
6564
  };
5841
- }
5842
-
5843
- /**
5844
- * Customer represents a customer in a ModelRelay project.
5845
- */
5846
- interface Customer {
5847
- id: string;
5848
- project_id: string;
5849
- external_id: string;
5850
- email: string;
5851
- metadata?: CustomerMetadata;
5852
- created_at: string;
5853
- updated_at: string;
5854
- }
5855
- /**
5856
- * Subscription represents billing state for a customer.
5857
- */
5858
- interface Subscription {
5859
- id: string;
5860
- project_id: string;
5861
- customer_id: string;
5862
- tier_id: string;
5863
- tier_code?: TierCode;
5864
- billing_provider?: BillingProvider;
5865
- billing_customer_id?: string;
5866
- billing_subscription_id?: string;
5867
- subscription_status?: SubscriptionStatusKind;
5868
- current_period_start?: string;
5869
- current_period_end?: string;
5870
- created_at: string;
5871
- updated_at: string;
5872
- }
5873
- /**
5874
- * CustomerWithSubscription bundles customer identity with optional subscription state.
5875
- */
5876
- interface CustomerWithSubscription {
5877
- customer: Customer;
5878
- subscription?: Subscription;
5879
- }
5880
- /**
5881
- * Request to create a customer.
5882
- */
5883
- interface CustomerCreateRequest {
5884
- external_id: string;
5885
- email: string;
5886
- metadata?: CustomerMetadata;
6565
+ listProjectToolHooks: {
6566
+ parameters: {
6567
+ query?: never;
6568
+ header?: never;
6569
+ path: {
6570
+ id: components["parameters"]["ProjectID"];
6571
+ };
6572
+ cookie?: never;
6573
+ };
6574
+ requestBody?: never;
6575
+ responses: {
6576
+ /** @description Tool hook list */
6577
+ 200: {
6578
+ headers: {
6579
+ [name: string]: unknown;
6580
+ };
6581
+ content: {
6582
+ "application/json": {
6583
+ hooks?: components["schemas"]["ToolHookConfig"][];
6584
+ };
6585
+ };
6586
+ };
6587
+ };
6588
+ };
6589
+ createProjectToolHook: {
6590
+ parameters: {
6591
+ query?: never;
6592
+ header?: never;
6593
+ path: {
6594
+ id: components["parameters"]["ProjectID"];
6595
+ };
6596
+ cookie?: never;
6597
+ };
6598
+ requestBody: {
6599
+ content: {
6600
+ "application/json": components["schemas"]["ToolHookConfigInput"];
6601
+ };
6602
+ };
6603
+ responses: {
6604
+ /** @description Tool hook created */
6605
+ 201: {
6606
+ headers: {
6607
+ [name: string]: unknown;
6608
+ };
6609
+ content: {
6610
+ "application/json": {
6611
+ hook?: components["schemas"]["ToolHookConfig"];
6612
+ signing_secret?: string;
6613
+ };
6614
+ };
6615
+ };
6616
+ };
6617
+ };
6618
+ getProjectToolHook: {
6619
+ parameters: {
6620
+ query?: never;
6621
+ header?: never;
6622
+ path: {
6623
+ id: components["parameters"]["ProjectID"];
6624
+ hook_id: components["parameters"]["ToolHookID"];
6625
+ };
6626
+ cookie?: never;
6627
+ };
6628
+ requestBody?: never;
6629
+ responses: {
6630
+ /** @description Tool hook details */
6631
+ 200: {
6632
+ headers: {
6633
+ [name: string]: unknown;
6634
+ };
6635
+ content: {
6636
+ "application/json": {
6637
+ hook?: components["schemas"]["ToolHookConfig"];
6638
+ };
6639
+ };
6640
+ };
6641
+ };
6642
+ };
6643
+ updateProjectToolHook: {
6644
+ parameters: {
6645
+ query?: never;
6646
+ header?: never;
6647
+ path: {
6648
+ id: components["parameters"]["ProjectID"];
6649
+ hook_id: components["parameters"]["ToolHookID"];
6650
+ };
6651
+ cookie?: never;
6652
+ };
6653
+ requestBody: {
6654
+ content: {
6655
+ "application/json": components["schemas"]["ToolHookConfigUpdate"];
6656
+ };
6657
+ };
6658
+ responses: {
6659
+ /** @description Tool hook updated */
6660
+ 200: {
6661
+ headers: {
6662
+ [name: string]: unknown;
6663
+ };
6664
+ content: {
6665
+ "application/json": {
6666
+ hook?: components["schemas"]["ToolHookConfig"];
6667
+ signing_secret?: string;
6668
+ };
6669
+ };
6670
+ };
6671
+ };
6672
+ };
6673
+ deleteProjectToolHook: {
6674
+ parameters: {
6675
+ query?: never;
6676
+ header?: never;
6677
+ path: {
6678
+ id: components["parameters"]["ProjectID"];
6679
+ hook_id: components["parameters"]["ToolHookID"];
6680
+ };
6681
+ cookie?: never;
6682
+ };
6683
+ requestBody?: never;
6684
+ responses: {
6685
+ /** @description Tool hook deleted */
6686
+ 204: {
6687
+ headers: {
6688
+ [name: string]: unknown;
6689
+ };
6690
+ content?: never;
6691
+ };
6692
+ };
6693
+ };
6694
+ listProjectToolHookEvents: {
6695
+ parameters: {
6696
+ query?: {
6697
+ limit?: number;
6698
+ };
6699
+ header?: never;
6700
+ path: {
6701
+ id: components["parameters"]["ProjectID"];
6702
+ hook_id: components["parameters"]["ToolHookID"];
6703
+ };
6704
+ cookie?: never;
6705
+ };
6706
+ requestBody?: never;
6707
+ responses: {
6708
+ /** @description Tool hook events */
6709
+ 200: {
6710
+ headers: {
6711
+ [name: string]: unknown;
6712
+ };
6713
+ content: {
6714
+ "application/json": {
6715
+ events?: components["schemas"]["ToolHookEvent"][];
6716
+ };
6717
+ };
6718
+ };
6719
+ };
6720
+ };
6721
+ testProjectToolHook: {
6722
+ parameters: {
6723
+ query?: never;
6724
+ header?: never;
6725
+ path: {
6726
+ id: components["parameters"]["ProjectID"];
6727
+ hook_id: components["parameters"]["ToolHookID"];
6728
+ };
6729
+ cookie?: never;
6730
+ };
6731
+ requestBody?: never;
6732
+ responses: {
6733
+ /** @description Tool hook test result */
6734
+ 200: {
6735
+ headers: {
6736
+ [name: string]: unknown;
6737
+ };
6738
+ content: {
6739
+ "application/json": components["schemas"]["ToolHookTestResult"];
6740
+ };
6741
+ };
6742
+ /** @description Tool hook test failed */
6743
+ 502: {
6744
+ headers: {
6745
+ [name: string]: unknown;
6746
+ };
6747
+ content?: never;
6748
+ };
6749
+ };
6750
+ };
6751
+ clearSession: {
6752
+ parameters: {
6753
+ query?: never;
6754
+ header?: never;
6755
+ path: {
6756
+ session_id: string;
6757
+ };
6758
+ cookie?: never;
6759
+ };
6760
+ requestBody?: never;
6761
+ responses: {
6762
+ /** @description Session cleared */
6763
+ 200: {
6764
+ headers: {
6765
+ [name: string]: unknown;
6766
+ };
6767
+ content: {
6768
+ "application/json": components["schemas"]["SessionResponse"];
6769
+ };
6770
+ };
6771
+ /** @description API key required */
6772
+ 401: {
6773
+ headers: {
6774
+ [name: string]: unknown;
6775
+ };
6776
+ content?: never;
6777
+ };
6778
+ /** @description Session not found */
6779
+ 404: {
6780
+ headers: {
6781
+ [name: string]: unknown;
6782
+ };
6783
+ content?: never;
6784
+ };
6785
+ };
6786
+ };
6787
+ }
6788
+
6789
+ /**
6790
+ * Customer represents a customer in a ModelRelay project.
6791
+ */
6792
+ interface Customer {
6793
+ id: string;
6794
+ project_id: string;
6795
+ external_id: string;
6796
+ email: string;
6797
+ metadata?: CustomerMetadata;
6798
+ created_at: string;
6799
+ updated_at: string;
6800
+ }
6801
+ /**
6802
+ * Subscription represents billing state for a customer.
6803
+ */
6804
+ interface Subscription {
6805
+ id: string;
6806
+ project_id: string;
6807
+ customer_id: string;
6808
+ tier_id: string;
6809
+ tier_code?: TierCode;
6810
+ billing_provider?: BillingProvider;
6811
+ billing_customer_id?: string;
6812
+ billing_subscription_id?: string;
6813
+ subscription_status?: SubscriptionStatusKind;
6814
+ current_period_start?: string;
6815
+ current_period_end?: string;
6816
+ created_at: string;
6817
+ updated_at: string;
6818
+ }
6819
+ /**
6820
+ * CustomerWithSubscription bundles customer identity with optional subscription state.
6821
+ */
6822
+ interface CustomerWithSubscription {
6823
+ customer: Customer;
6824
+ subscription?: Subscription;
6825
+ }
6826
+ /**
6827
+ * Request to create a customer.
6828
+ */
6829
+ interface CustomerCreateRequest {
6830
+ external_id: string;
6831
+ email: string;
6832
+ metadata?: CustomerMetadata;
5887
6833
  }
5888
6834
  /**
5889
6835
  * Request to upsert a customer by external_id.
@@ -6008,7 +6954,8 @@ declare class CustomersClient {
6008
6954
  */
6009
6955
  type PriceInterval = "month" | "year";
6010
6956
  /**
6011
- * TierModel represents a model with pricing in a tier.
6957
+ * TierModel represents a model with cost information in a tier.
6958
+ * Customer prices are derived from model costs: price = cost * (1 + platformFeePercent/100).
6012
6959
  */
6013
6960
  interface TierModel {
6014
6961
  id: string;
@@ -6020,8 +6967,10 @@ interface TierModel {
6020
6967
  context_window: number;
6021
6968
  max_output_tokens: number;
6022
6969
  deprecated: boolean;
6023
- input_price_per_million_cents: number;
6024
- output_price_per_million_cents: number;
6970
+ /** Provider input cost in cents per million tokens */
6971
+ model_input_cost_cents: number;
6972
+ /** Provider output cost in cents per million tokens */
6973
+ model_output_cost_cents: number;
6025
6974
  is_default: boolean;
6026
6975
  created_at: string;
6027
6976
  updated_at: string;
@@ -6143,6 +7092,10 @@ type ImageUsage = components["schemas"]["ImageUsage"];
6143
7092
  * - "b64_json": Returns base64-encoded data, for testing/development
6144
7093
  */
6145
7094
  type ImageResponseFormat = components["schemas"]["ImageResponseFormat"];
7095
+ /**
7096
+ * Response from pin/unpin operations.
7097
+ */
7098
+ type ImagePinResponse = components["schemas"]["ImagePinResponse"];
6146
7099
  /**
6147
7100
  * ImagesClient provides methods for generating images using AI models.
6148
7101
  *
@@ -6179,6 +7132,36 @@ declare class ImagesClient {
6179
7132
  * @throws {Error} If prompt is empty
6180
7133
  */
6181
7134
  generate(request: ImageRequest): Promise<ImageResponse>;
7135
+ /**
7136
+ * Get information about a specific image.
7137
+ *
7138
+ * Returns the image's pinned status, expiration time, and URL.
7139
+ *
7140
+ * @param imageId - The image ID to retrieve
7141
+ * @returns Image details including pinned status and URL
7142
+ * @throws {Error} If imageId is empty
7143
+ */
7144
+ get(imageId: string): Promise<ImagePinResponse>;
7145
+ /**
7146
+ * Pin an image to prevent it from expiring.
7147
+ *
7148
+ * Pinned images remain accessible permanently (subject to tier limits).
7149
+ *
7150
+ * @param imageId - The image ID to pin
7151
+ * @returns Updated image state including permanent URL
7152
+ * @throws {Error} If imageId is empty
7153
+ */
7154
+ pin(imageId: string): Promise<ImagePinResponse>;
7155
+ /**
7156
+ * Unpin an image, allowing it to expire.
7157
+ *
7158
+ * The image will expire after the default ephemeral period (7 days).
7159
+ *
7160
+ * @param imageId - The image ID to unpin
7161
+ * @returns Updated image state including new expiration time
7162
+ * @throws {Error} If imageId is empty
7163
+ */
7164
+ unpin(imageId: string): Promise<ImagePinResponse>;
6182
7165
  }
6183
7166
 
6184
7167
  /**
@@ -6233,6 +7216,14 @@ interface SessionRunOptions {
6233
7216
  model?: ModelId;
6234
7217
  /** Override the provider for this run. */
6235
7218
  provider?: ProviderId$1;
7219
+ /** How to manage history when it approaches the model context window. */
7220
+ contextManagement?: SessionContextManagement;
7221
+ /** Max tokens allowed for history (derived from model if not set). */
7222
+ maxHistoryTokens?: number;
7223
+ /** Tokens to reserve for output (defaults to model metadata when available). */
7224
+ reserveOutputTokens?: number;
7225
+ /** Called when history is truncated to fit the context window. */
7226
+ onContextTruncate?: (info: SessionContextTruncateInfo) => void;
6236
7227
  /** Additional tools for this run (merged with session defaults). */
6237
7228
  tools?: Tool[];
6238
7229
  /** Maximum number of LLM turns (for tool loops). */
@@ -6246,6 +7237,16 @@ interface SessionRunOptions {
6246
7237
  * Status of a session run.
6247
7238
  */
6248
7239
  type SessionRunStatus = "complete" | "waiting_for_tools" | "error" | "canceled";
7240
+ /** Context management strategy for session history. */
7241
+ type SessionContextManagement = "none" | "truncate" | "summarize";
7242
+ /** Metadata for context truncation callbacks. */
7243
+ interface SessionContextTruncateInfo {
7244
+ readonly model: ModelId;
7245
+ readonly originalMessages: number;
7246
+ readonly keptMessages: number;
7247
+ readonly maxHistoryTokens: number;
7248
+ readonly reservedOutputTokens?: number;
7249
+ }
6249
7250
  /**
6250
7251
  * Pending tool call that needs client-side execution.
6251
7252
  */
@@ -6430,90 +7431,28 @@ interface SessionStore {
6430
7431
  /** Close the store and release resources. */
6431
7432
  close(): Promise<void>;
6432
7433
  }
6433
-
6434
7434
  /**
6435
- * Client-managed session implementation.
6436
- *
6437
- * LocalSession keeps conversation history on the client side with optional
6438
- * persistence to memory, file, or SQLite. Use for:
6439
- * - Local AI coding agents (Claude Code, Cursor)
6440
- * - Privacy-sensitive workflows (history never leaves device)
6441
- * - Offline-capable agents
6442
- *
6443
- * @module
6444
- */
6445
-
6446
- /**
6447
- * Client-managed session with optional persistence.
6448
- *
6449
- * @example
6450
- * ```typescript
6451
- * import { ModelRelay, LocalSession } from "modelrelay";
6452
- *
6453
- * const client = ModelRelay.fromSecretKey(process.env.MODELRELAY_SECRET_KEY!);
6454
- * const session = LocalSession.create(client, {
6455
- * toolRegistry: createLocalFSTools({ root: process.cwd() }),
6456
- * persistence: "sqlite",
6457
- * });
6458
- *
6459
- * const result1 = await session.run("Create a file called hello.txt with 'Hello World'");
6460
- * const result2 = await session.run("Now read that file back to me");
6461
- * ```
7435
+ * Options for syncing a local session to a remote session.
6462
7436
  */
6463
- declare class LocalSession implements Session {
6464
- readonly type: "local";
6465
- readonly id: SessionId;
6466
- private readonly client;
6467
- private readonly store;
6468
- private readonly toolRegistry?;
6469
- private readonly defaultModel?;
6470
- private readonly defaultProvider?;
6471
- private readonly defaultTools?;
6472
- private readonly metadata;
6473
- private messages;
6474
- private artifacts;
6475
- private nextSeq;
6476
- private createdAt;
6477
- private updatedAt;
6478
- private currentRunId?;
6479
- private currentNodeId?;
6480
- private currentWaiting?;
6481
- private currentEvents;
6482
- private currentUsage;
6483
- private constructor();
6484
- /**
6485
- * Create a new local session.
6486
- *
6487
- * @param client - ModelRelay client
6488
- * @param options - Session configuration
6489
- * @returns A new LocalSession instance
6490
- */
6491
- static create(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
7437
+ interface SessionSyncOptions {
6492
7438
  /**
6493
- * Resume an existing session from storage.
6494
- *
6495
- * @param client - ModelRelay client
6496
- * @param sessionId - ID of the session to resume
6497
- * @param options - Session configuration (must match original persistence settings)
6498
- * @returns The resumed LocalSession, or null if not found
7439
+ * Called for each message synced. Useful for progress indicators.
7440
+ * @param synced - Number of messages synced so far
7441
+ * @param total - Total messages to sync
6499
7442
  */
6500
- static resume(client: ModelRelay, sessionId: string | SessionId, options?: LocalSessionOptions): Promise<LocalSession | null>;
6501
- get history(): readonly SessionMessage[];
6502
- run(prompt: string, options?: SessionRunOptions): Promise<SessionRunResult>;
6503
- submitToolResults(results: ToolExecutionResult[]): Promise<SessionRunResult>;
6504
- getArtifacts(): SessionArtifacts;
6505
- close(): Promise<void>;
6506
- private addMessage;
6507
- private buildInput;
6508
- private processRunEvents;
6509
- private executeTools;
6510
- private persist;
7443
+ onProgress?: (synced: number, total: number) => void;
7444
+ /** Abort signal for cancellation. */
7445
+ signal?: AbortSignal;
6511
7446
  }
6512
7447
  /**
6513
- * Create a new local session.
6514
- * Convenience function for LocalSession.create().
7448
+ * Result of syncing a local session to a remote session.
6515
7449
  */
6516
- declare function createLocalSession(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
7450
+ interface SessionSyncResult {
7451
+ /** Number of messages synced. */
7452
+ readonly messagesSynced: number;
7453
+ /** The remote session ID messages were synced to. */
7454
+ readonly remoteSessionId: SessionId;
7455
+ }
6517
7456
 
6518
7457
  /**
6519
7458
  * Server-managed session implementation.
@@ -6560,6 +7499,7 @@ declare class RemoteSession implements Session {
6560
7499
  private readonly defaultTools?;
6561
7500
  private metadata;
6562
7501
  private endUserId?;
7502
+ private readonly resolveModelContext;
6563
7503
  private messages;
6564
7504
  private artifacts;
6565
7505
  private nextSeq;
@@ -6642,7 +7582,122 @@ declare class RemoteSession implements Session {
6642
7582
  private executeToolsLocally;
6643
7583
  private flushPendingMessages;
6644
7584
  private appendMessageToServer;
7585
+ private extractOutputText;
7586
+ private extractTextFromOutputValue;
7587
+ private extractTextFromOutputItems;
7588
+ private extractTextFromContentParts;
7589
+ }
7590
+
7591
+ /**
7592
+ * Client-managed session implementation.
7593
+ *
7594
+ * LocalSession keeps conversation history on the client side with optional
7595
+ * persistence to memory, file, or SQLite. Use for:
7596
+ * - Local AI coding agents (Claude Code, Cursor)
7597
+ * - Privacy-sensitive workflows (history never leaves device)
7598
+ * - Offline-capable agents
7599
+ *
7600
+ * @module
7601
+ */
7602
+
7603
+ /**
7604
+ * Client-managed session with optional persistence.
7605
+ *
7606
+ * @example
7607
+ * ```typescript
7608
+ * import { ModelRelay, LocalSession } from "modelrelay";
7609
+ *
7610
+ * const client = ModelRelay.fromSecretKey(process.env.MODELRELAY_SECRET_KEY!);
7611
+ * const session = LocalSession.create(client, {
7612
+ * toolRegistry: createLocalFSTools({ root: process.cwd() }),
7613
+ * persistence: "sqlite",
7614
+ * });
7615
+ *
7616
+ * const result1 = await session.run("Create a file called hello.txt with 'Hello World'");
7617
+ * const result2 = await session.run("Now read that file back to me");
7618
+ * ```
7619
+ */
7620
+ declare class LocalSession implements Session {
7621
+ readonly type: "local";
7622
+ readonly id: SessionId;
7623
+ private readonly client;
7624
+ private readonly store;
7625
+ private readonly toolRegistry?;
7626
+ private readonly defaultModel?;
7627
+ private readonly defaultProvider?;
7628
+ private readonly defaultTools?;
7629
+ private readonly metadata;
7630
+ private readonly resolveModelContext;
7631
+ private messages;
7632
+ private artifacts;
7633
+ private nextSeq;
7634
+ private createdAt;
7635
+ private updatedAt;
7636
+ private currentRunId?;
7637
+ private currentNodeId?;
7638
+ private currentWaiting?;
7639
+ private currentEvents;
7640
+ private currentUsage;
7641
+ private constructor();
7642
+ /**
7643
+ * Create a new local session.
7644
+ *
7645
+ * @param client - ModelRelay client
7646
+ * @param options - Session configuration
7647
+ * @returns A new LocalSession instance
7648
+ */
7649
+ static create(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
7650
+ /**
7651
+ * Resume an existing session from storage.
7652
+ *
7653
+ * @param client - ModelRelay client
7654
+ * @param sessionId - ID of the session to resume
7655
+ * @param options - Session configuration (must match original persistence settings)
7656
+ * @returns The resumed LocalSession, or null if not found
7657
+ */
7658
+ static resume(client: ModelRelay, sessionId: string | SessionId, options?: LocalSessionOptions): Promise<LocalSession | null>;
7659
+ get history(): readonly SessionMessage[];
7660
+ run(prompt: string, options?: SessionRunOptions): Promise<SessionRunResult>;
7661
+ submitToolResults(results: ToolExecutionResult[]): Promise<SessionRunResult>;
7662
+ getArtifacts(): SessionArtifacts;
7663
+ close(): Promise<void>;
7664
+ /**
7665
+ * Sync this local session's messages to a remote session.
7666
+ *
7667
+ * This uploads all local messages to the remote session, enabling
7668
+ * cross-device access and server-side backup. Messages are synced
7669
+ * in order and the remote session's history will contain all local
7670
+ * messages after sync completes.
7671
+ *
7672
+ * @param remoteSession - The remote session to sync to
7673
+ * @param options - Optional sync configuration
7674
+ * @returns Sync result with message count
7675
+ *
7676
+ * @example
7677
+ * ```typescript
7678
+ * // Create local session and work offline
7679
+ * const local = LocalSession.create(client, { ... });
7680
+ * await local.run("Implement the feature");
7681
+ *
7682
+ * // Later, sync to remote for backup/sharing
7683
+ * const remote = await RemoteSession.create(client);
7684
+ * const result = await local.syncTo(remote, {
7685
+ * onProgress: (synced, total) => console.log(`${synced}/${total}`),
7686
+ * });
7687
+ * ```
7688
+ */
7689
+ syncTo(remoteSession: RemoteSession, options?: SessionSyncOptions): Promise<SessionSyncResult>;
7690
+ private addMessage;
7691
+ private buildInput;
7692
+ private processRunEvents;
7693
+ private executeTools;
7694
+ private persist;
6645
7695
  }
7696
+ /**
7697
+ * Create a new local session.
7698
+ * Convenience function for LocalSession.create().
7699
+ */
7700
+ declare function createLocalSession(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
6646
7701
 
6647
7702
  /**
6648
7703
  * SessionsClient - Entry point for session management.
@@ -6891,6 +7946,21 @@ interface OAuthDeviceTokenPollRequest {
6891
7946
  fetch?: typeof fetch;
6892
7947
  signal?: AbortSignal;
6893
7948
  }
7949
+ type PollUntilResult<T> = {
7950
+ done: true;
7951
+ value: T;
7952
+ } | {
7953
+ done: false;
7954
+ retryAfterMs?: number;
7955
+ };
7956
+ interface PollUntilOptions<T> {
7957
+ intervalMs: number;
7958
+ deadline?: Date;
7959
+ signal?: AbortSignal;
7960
+ poll: (attempt: number) => Promise<PollUntilResult<T>>;
7961
+ onTimeout?: () => Error;
7962
+ }
7963
+ declare function pollUntil<T>(opts: PollUntilOptions<T>): Promise<T>;
6894
7964
  declare function startOAuthDeviceAuthorization(req: OAuthDeviceAuthorizationRequest): Promise<OAuthDeviceAuthorization>;
6895
7965
  declare function pollOAuthDeviceToken(req: OAuthDeviceTokenPollRequest): Promise<OAuthDeviceToken>;
6896
7966
  declare function runOAuthDeviceFlowForIDToken(cfg: {
@@ -6907,14 +7977,11 @@ declare function runOAuthDeviceFlowForIDToken(cfg: {
6907
7977
  signal?: AbortSignal;
6908
7978
  }): Promise<string>;
6909
7979
 
6910
- /**
6911
- * Semantic JSON pointer constants for LLM responses nodes.
6912
- * These eliminate magic strings and make bindings self-documenting.
6913
- */
6914
7980
  /** JSON pointer to extract text content from an LLM response output. */
6915
- declare const LLM_TEXT_OUTPUT$1: "/output/0/content/0/text";
6916
- /** JSON pointer to inject text into the user message of an LLM request. */
6917
- declare const LLM_USER_MESSAGE_TEXT$1: "/request/input/1/content/0/text";
7981
+ declare const LLM_TEXT_OUTPUT: string;
7982
+ /** JSON pointer to inject text into the user message of an LLM request.
7983
+ * The pointer is relative to the request object (not the full node input). */
7984
+ declare const LLM_USER_MESSAGE_TEXT: string;
6918
7985
  type TransformJSONValueV0 = {
6919
7986
  from: NodeId$1;
6920
7987
  pointer?: string;
@@ -6926,6 +7993,26 @@ declare function transformJSONObject(object: Record<string, TransformJSONValueV0
6926
7993
  declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV0>): {
6927
7994
  merge: Array<TransformJSONValueV0>;
6928
7995
  };
7996
+ type TransformJSONValueV1 = TransformJSONValueV0;
7997
+ declare const transformJSONValueV1: typeof transformJSONValue;
7998
+ declare const transformJSONObjectV1: typeof transformJSONObject;
7999
+ declare const transformJSONMergeV1: typeof transformJSONMerge;
8000
+ /**
8001
+ * Error thrown when a binding targets a non-existent path in the request.
8002
+ */
8003
+ declare class BindingTargetError extends Error {
8004
+ readonly nodeId: NodeId$1;
8005
+ readonly bindingIndex: number;
8006
+ readonly pointer: string;
8007
+ constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
8008
+ }
8009
+ /**
8010
+ * Error thrown when a map.fanout node input is invalid.
8011
+ */
8012
+ declare class MapFanoutInputError extends Error {
8013
+ readonly nodeId: NodeId$1;
8014
+ constructor(nodeId: NodeId$1, message: string);
8015
+ }
6929
8016
  type WorkflowBuilderV0State = {
6930
8017
  readonly name?: string;
6931
8018
  readonly execution?: WorkflowSpecV0["execution"];
@@ -6956,6 +8043,43 @@ declare class WorkflowBuilderV0 {
6956
8043
  build(): WorkflowSpecV0;
6957
8044
  }
6958
8045
  declare function workflowV0(): WorkflowBuilderV0;
8046
+ type WorkflowBuilderV1State = {
8047
+ readonly name?: string;
8048
+ readonly execution?: WorkflowSpecV1["execution"];
8049
+ readonly nodes: ReadonlyArray<WorkflowNodeV1>;
8050
+ readonly edges: ReadonlyArray<WorkflowEdgeV1>;
8051
+ readonly outputs: ReadonlyArray<WorkflowOutputRefV1>;
8052
+ };
8053
+ declare class WorkflowBuilderV1 {
8054
+ private readonly state;
8055
+ constructor(state?: WorkflowBuilderV1State);
8056
+ static new(): WorkflowBuilderV1;
8057
+ private with;
8058
+ name(name: string): WorkflowBuilderV1;
8059
+ execution(execution: WorkflowSpecV1["execution"]): WorkflowBuilderV1;
8060
+ node(node: WorkflowNodeV1): WorkflowBuilderV1;
8061
+ llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
8062
+ stream?: boolean;
8063
+ toolExecution?: ToolExecutionModeV1$1;
8064
+ toolLimits?: LLMResponsesToolLimitsV1;
8065
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
8066
+ }): WorkflowBuilderV1;
8067
+ routeSwitch(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
8068
+ stream?: boolean;
8069
+ toolExecution?: ToolExecutionModeV1$1;
8070
+ toolLimits?: LLMResponsesToolLimitsV1;
8071
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
8072
+ }): WorkflowBuilderV1;
8073
+ joinAll(id: NodeId$1): WorkflowBuilderV1;
8074
+ joinAny(id: NodeId$1, input?: JoinAnyNodeInputV1): WorkflowBuilderV1;
8075
+ joinCollect(id: NodeId$1, input: JoinCollectNodeInputV1): WorkflowBuilderV1;
8076
+ transformJSON(id: NodeId$1, input: TransformJSONNodeInputV1): WorkflowBuilderV1;
8077
+ mapFanout(id: NodeId$1, input: MapFanoutNodeInputV1): WorkflowBuilderV1;
8078
+ edge(from: NodeId$1, to: NodeId$1, when?: ConditionV1$1): WorkflowBuilderV1;
8079
+ output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV1;
8080
+ build(): WorkflowSpecV1;
8081
+ }
8082
+ declare function workflowV1(): WorkflowBuilderV1;
6959
8083
  type PendingLLMNode = {
6960
8084
  id: NodeId$1;
6961
8085
  request: WireResponsesRequest;
@@ -7059,6 +8183,18 @@ declare class LLMNodeBuilder {
7059
8183
  * The edge from the source node is automatically inferred.
7060
8184
  */
7061
8185
  bindFromTo(from: NodeId$1, fromPointer: string | undefined, toPointer: string, encoding?: LLMResponsesBindingEncodingV0): LLMNodeBuilder;
8186
+ /**
8187
+ * Add a binding that replaces a {{placeholder}} in the prompt text.
8188
+ * This is useful when the prompt contains placeholder markers like {{tier_data}}.
8189
+ * The edge from the source node is automatically inferred.
8190
+ */
8191
+ bindToPlaceholder(from: NodeId$1, fromPointer: string | undefined, placeholder: string): LLMNodeBuilder;
8192
+ /**
8193
+ * Add a binding from an LLM node's text output to a placeholder.
8194
+ * This is the most common placeholder binding: LLM text → {{placeholder}}.
8195
+ * The edge from the source node is automatically inferred.
8196
+ */
8197
+ bindTextToPlaceholder(from: NodeId$1, placeholder: string): LLMNodeBuilder;
7062
8198
  /**
7063
8199
  * Set the tool execution mode (server or client).
7064
8200
  */
@@ -7116,10 +8252,139 @@ declare class TransformJSONNodeBuilder {
7116
8252
  */
7117
8253
  declare function newWorkflow(name?: string): Workflow;
7118
8254
 
7119
- var $id = "https://modelrelay.ai/schemas/workflow_v0.schema.json";
7120
- var $schema = "http://json-schema.org/draft-07/schema#";
7121
- var additionalProperties = false;
7122
- var definitions = {
8255
+ /**
8256
+ * Type-safe JSON pointer construction for LLM request/response paths.
8257
+ *
8258
+ * Use these builders instead of raw strings to get compile-time safety
8259
+ * and IDE autocomplete for common LLM request/response paths.
8260
+ *
8261
+ * @example
8262
+ * ```typescript
8263
+ * // Instead of raw string:
8264
+ * const pointer = "/output/0/content/0/text";
8265
+ *
8266
+ * // Use typed builder:
8267
+ * const pointer = LLMOutput().content(0).text();
8268
+ *
8269
+ * // Or use pre-built paths:
8270
+ * import { LLMOutputText } from "./json_path";
8271
+ * ```
8272
+ */
8273
+ /** JSON pointer string type for type safety */
8274
+ type JSONPointer = string;
8275
+ /**
8276
+ * Path builder for LLM response output structures.
8277
+ * The output structure is: output[index].content[index].{text|...}
8278
+ */
8279
+ declare class LLMOutputPath {
8280
+ private readonly path;
8281
+ constructor(path?: string);
8282
+ /** Select an output by index */
8283
+ index(i: number): LLMOutputContentPath;
8284
+ /** Shorthand for index(0).content(i) */
8285
+ content(i: number): LLMOutputContentItemPath;
8286
+ }
8287
+ /** Path builder for output[i] level */
8288
+ declare class LLMOutputContentPath {
8289
+ private readonly path;
8290
+ constructor(path: string);
8291
+ /** Select a content item by index */
8292
+ content(i: number): LLMOutputContentItemPath;
8293
+ }
8294
+ /** Path builder for output[i].content[j] level */
8295
+ declare class LLMOutputContentItemPath {
8296
+ private readonly path;
8297
+ constructor(path: string);
8298
+ /** Get the text field pointer */
8299
+ text(): JSONPointer;
8300
+ /** Get the type field pointer */
8301
+ type(): JSONPointer;
8302
+ /** Get the path as a string */
8303
+ toString(): string;
8304
+ }
8305
+ /**
8306
+ * Path builder for LLM request input structures.
8307
+ * The input structure is: input[message_index].content[content_index].{text|...}
8308
+ */
8309
+ declare class LLMInputPath {
8310
+ private readonly path;
8311
+ constructor(path?: string);
8312
+ /**
8313
+ * Select a message by index.
8314
+ * Index 0 is typically the system message, index 1 is the first user message.
8315
+ */
8316
+ message(i: number): LLMInputMessagePath;
8317
+ /** Shorthand for message(0) - the first message slot */
8318
+ systemMessage(): LLMInputMessagePath;
8319
+ /** Shorthand for message(1) - typically the user message after system */
8320
+ userMessage(): LLMInputMessagePath;
8321
+ }
8322
+ /** Path builder for input[i] level */
8323
+ declare class LLMInputMessagePath {
8324
+ private readonly path;
8325
+ constructor(path: string);
8326
+ /** Select a content item by index */
8327
+ content(i: number): LLMInputContentItemPath;
8328
+ /** Shorthand for content(0).text() */
8329
+ text(): JSONPointer;
8330
+ }
8331
+ /** Path builder for input[i].content[j] level */
8332
+ declare class LLMInputContentItemPath {
8333
+ private readonly path;
8334
+ constructor(path: string);
8335
+ /** Get the text field pointer */
8336
+ text(): JSONPointer;
8337
+ /** Get the type field pointer */
8338
+ type(): JSONPointer;
8339
+ /** Get the path as a string */
8340
+ toString(): string;
8341
+ }
8342
+ /** Start building a path into an LLM response output */
8343
+ declare function LLMOutput(): LLMOutputPath;
8344
+ /** Start building a path into an LLM request input */
8345
+ declare function LLMInput(): LLMInputPath;
8346
+ /** Extracts text from the first content item of the first output */
8347
+ declare const LLMOutputText: JSONPointer;
8348
+ /** Targets the system message text (input[0].content[0].text) */
8349
+ declare const LLMInputSystemText: JSONPointer;
8350
+ /** Targets the user message text (input[1].content[0].text) */
8351
+ declare const LLMInputUserText: JSONPointer;
8352
+ /** Targets the first message text (input[0].content[0].text) */
8353
+ declare const LLMInputFirstMessageText: JSONPointer;
8354
+ /**
8355
+ * Path builder for accessing outputs from a join.all node.
8356
+ * A join.all node produces an object keyed by upstream node IDs.
8357
+ *
8358
+ * @example
8359
+ * ```typescript
8360
+ * // Access text from a specific node in the join output:
8361
+ * const pointer = JoinOutput("cost_analyst").text();
8362
+ * // Produces: "/cost_analyst/output/0/content/0/text"
8363
+ * ```
8364
+ */
8365
+ declare class JoinOutputPath {
8366
+ private readonly path;
8367
+ constructor(path: string);
8368
+ /** Access the output array of the node */
8369
+ output(): LLMOutputPath;
8370
+ /**
8371
+ * Shorthand for accessing the first text content from the node.
8372
+ * Equivalent to: JoinOutput(nodeId).output().content(0).text()
8373
+ */
8374
+ text(): JSONPointer;
8375
+ /** Get the path as a string */
8376
+ toString(): string;
8377
+ }
8378
+ /**
8379
+ * Start building a path to access a specific node's output from a join.all node.
8380
+ * @param nodeId The ID of the upstream node
8381
+ */
8382
+ declare function JoinOutput(nodeId: string): JoinOutputPath;
8383
+
8384
+ var $id$1 = "https://modelrelay.ai/schemas/workflow_v0.schema.json";
8385
+ var $schema$1 = "http://json-schema.org/draft-07/schema#";
8386
+ var additionalProperties$1 = false;
8387
+ var definitions$1 = {
7123
8388
  edge: {
7124
8389
  additionalProperties: false,
7125
8390
  properties: {
@@ -7140,6 +8405,18 @@ var definitions = {
7140
8405
  },
7141
8406
  llmResponsesBinding: {
7142
8407
  additionalProperties: false,
8408
+ oneOf: [
8409
+ {
8410
+ required: [
8411
+ "to"
8412
+ ]
8413
+ },
8414
+ {
8415
+ required: [
8416
+ "to_placeholder"
8417
+ ]
8418
+ }
8419
+ ],
7143
8420
  properties: {
7144
8421
  encoding: {
7145
8422
  "enum": [
@@ -7159,11 +8436,14 @@ var definitions = {
7159
8436
  to: {
7160
8437
  pattern: "^/.*$",
7161
8438
  type: "string"
8439
+ },
8440
+ to_placeholder: {
8441
+ minLength: 1,
8442
+ type: "string"
7162
8443
  }
7163
8444
  },
7164
8445
  required: [
7165
- "from",
7166
- "to"
8446
+ "from"
7167
8447
  ],
7168
8448
  type: "object"
7169
8449
  },
@@ -7230,9 +8510,662 @@ var definitions = {
7230
8510
  type: "object"
7231
8511
  }
7232
8512
  },
7233
- required: [
7234
- "request"
7235
- ],
8513
+ required: [
8514
+ "request"
8515
+ ],
8516
+ type: "object"
8517
+ }
8518
+ }
8519
+ }
8520
+ ],
8521
+ properties: {
8522
+ type: {
8523
+ "const": "llm.responses"
8524
+ }
8525
+ },
8526
+ required: [
8527
+ "input"
8528
+ ]
8529
+ },
8530
+ {
8531
+ properties: {
8532
+ type: {
8533
+ "const": "join.all"
8534
+ }
8535
+ }
8536
+ },
8537
+ {
8538
+ allOf: [
8539
+ {
8540
+ properties: {
8541
+ input: {
8542
+ additionalProperties: false,
8543
+ oneOf: [
8544
+ {
8545
+ not: {
8546
+ required: [
8547
+ "merge"
8548
+ ]
8549
+ },
8550
+ required: [
8551
+ "object"
8552
+ ]
8553
+ },
8554
+ {
8555
+ not: {
8556
+ required: [
8557
+ "object"
8558
+ ]
8559
+ },
8560
+ required: [
8561
+ "merge"
8562
+ ]
8563
+ }
8564
+ ],
8565
+ properties: {
8566
+ merge: {
8567
+ items: {
8568
+ $ref: "#/definitions/transformValue"
8569
+ },
8570
+ minItems: 1,
8571
+ type: "array"
8572
+ },
8573
+ object: {
8574
+ additionalProperties: {
8575
+ $ref: "#/definitions/transformValue"
8576
+ },
8577
+ minProperties: 1,
8578
+ type: "object"
8579
+ }
8580
+ },
8581
+ type: "object"
8582
+ }
8583
+ }
8584
+ }
8585
+ ],
8586
+ properties: {
8587
+ type: {
8588
+ "const": "transform.json"
8589
+ }
8590
+ },
8591
+ required: [
8592
+ "input"
8593
+ ]
8594
+ }
8595
+ ],
8596
+ properties: {
8597
+ id: {
8598
+ minLength: 1,
8599
+ type: "string"
8600
+ },
8601
+ input: {
8602
+ },
8603
+ type: {
8604
+ "enum": [
8605
+ "llm.responses",
8606
+ "join.all",
8607
+ "transform.json"
8608
+ ],
8609
+ type: "string"
8610
+ }
8611
+ },
8612
+ required: [
8613
+ "id",
8614
+ "type"
8615
+ ],
8616
+ type: "object"
8617
+ },
8618
+ output: {
8619
+ additionalProperties: false,
8620
+ properties: {
8621
+ from: {
8622
+ minLength: 1,
8623
+ type: "string"
8624
+ },
8625
+ name: {
8626
+ minLength: 1,
8627
+ type: "string"
8628
+ },
8629
+ pointer: {
8630
+ pattern: "^(/.*)?$",
8631
+ type: "string"
8632
+ }
8633
+ },
8634
+ required: [
8635
+ "name",
8636
+ "from"
8637
+ ],
8638
+ type: "object"
8639
+ },
8640
+ transformValue: {
8641
+ additionalProperties: false,
8642
+ properties: {
8643
+ from: {
8644
+ minLength: 1,
8645
+ type: "string"
8646
+ },
8647
+ pointer: {
8648
+ pattern: "^(/.*)?$",
8649
+ type: "string"
8650
+ }
8651
+ },
8652
+ required: [
8653
+ "from"
8654
+ ],
8655
+ type: "object"
8656
+ }
8657
+ };
8658
+ var properties$1 = {
8659
+ edges: {
8660
+ items: {
8661
+ $ref: "#/definitions/edge"
8662
+ },
8663
+ type: "array"
8664
+ },
8665
+ execution: {
8666
+ additionalProperties: false,
8667
+ properties: {
8668
+ max_parallelism: {
8669
+ minimum: 1,
8670
+ type: "integer"
8671
+ },
8672
+ node_timeout_ms: {
8673
+ minimum: 1,
8674
+ type: "integer"
8675
+ },
8676
+ run_timeout_ms: {
8677
+ minimum: 1,
8678
+ type: "integer"
8679
+ }
8680
+ },
8681
+ type: "object"
8682
+ },
8683
+ kind: {
8684
+ "const": "workflow.v0",
8685
+ type: "string"
8686
+ },
8687
+ name: {
8688
+ type: "string"
8689
+ },
8690
+ nodes: {
8691
+ items: {
8692
+ $ref: "#/definitions/node"
8693
+ },
8694
+ minItems: 1,
8695
+ type: "array"
8696
+ },
8697
+ outputs: {
8698
+ items: {
8699
+ $ref: "#/definitions/output"
8700
+ },
8701
+ minItems: 1,
8702
+ type: "array"
8703
+ }
8704
+ };
8705
+ var required$1 = [
8706
+ "kind",
8707
+ "nodes",
8708
+ "outputs"
8709
+ ];
8710
+ var title$1 = "ModelRelay workflow.v0";
8711
+ var type$1 = "object";
8712
+ var workflow_v0_schema = {
8713
+ $id: $id$1,
8714
+ $schema: $schema$1,
8715
+ additionalProperties: additionalProperties$1,
8716
+ definitions: definitions$1,
8717
+ properties: properties$1,
8718
+ required: required$1,
8719
+ title: title$1,
8720
+ type: type$1
8721
+ };
8722
+
8723
+ var $id = "https://modelrelay.ai/schemas/workflow_v1.schema.json";
8724
+ var $schema = "http://json-schema.org/draft-07/schema#";
8725
+ var additionalProperties = false;
8726
+ var definitions = {
8727
+ condition: {
8728
+ additionalProperties: false,
8729
+ properties: {
8730
+ op: {
8731
+ "enum": [
8732
+ "equals",
8733
+ "matches",
8734
+ "exists"
8735
+ ],
8736
+ type: "string"
8737
+ },
8738
+ path: {
8739
+ pattern: "^\\$.*$",
8740
+ type: "string"
8741
+ },
8742
+ source: {
8743
+ "enum": [
8744
+ "node_output",
8745
+ "node_status"
8746
+ ],
8747
+ type: "string"
8748
+ },
8749
+ value: {
8750
+ }
8751
+ },
8752
+ required: [
8753
+ "source",
8754
+ "op"
8755
+ ],
8756
+ type: "object"
8757
+ },
8758
+ edge: {
8759
+ additionalProperties: false,
8760
+ properties: {
8761
+ from: {
8762
+ minLength: 1,
8763
+ type: "string"
8764
+ },
8765
+ to: {
8766
+ minLength: 1,
8767
+ type: "string"
8768
+ },
8769
+ when: {
8770
+ $ref: "#/definitions/condition"
8771
+ }
8772
+ },
8773
+ required: [
8774
+ "from",
8775
+ "to"
8776
+ ],
8777
+ type: "object"
8778
+ },
8779
+ fragmentBindInput: {
8780
+ additionalProperties: false,
8781
+ oneOf: [
8782
+ {
8783
+ required: [
8784
+ "from_node"
8785
+ ]
8786
+ },
8787
+ {
8788
+ required: [
8789
+ "from_input"
8790
+ ]
8791
+ }
8792
+ ],
8793
+ properties: {
8794
+ from_input: {
8795
+ minLength: 1,
8796
+ type: "string"
8797
+ },
8798
+ from_node: {
8799
+ minLength: 1,
8800
+ type: "string"
8801
+ },
8802
+ pointer: {
8803
+ pattern: "^(/.*)?$",
8804
+ type: "string"
8805
+ }
8806
+ },
8807
+ type: "object"
8808
+ },
8809
+ fragmentDef: {
8810
+ additionalProperties: false,
8811
+ properties: {
8812
+ edges: {
8813
+ items: {
8814
+ $ref: "#/definitions/edge"
8815
+ },
8816
+ type: "array"
8817
+ },
8818
+ inputs: {
8819
+ items: {
8820
+ $ref: "#/definitions/fragmentInput"
8821
+ },
8822
+ type: "array"
8823
+ },
8824
+ nodes: {
8825
+ items: {
8826
+ $ref: "#/definitions/node"
8827
+ },
8828
+ minItems: 1,
8829
+ type: "array"
8830
+ },
8831
+ outputs: {
8832
+ items: {
8833
+ $ref: "#/definitions/fragmentOutput"
8834
+ },
8835
+ minItems: 1,
8836
+ type: "array"
8837
+ }
8838
+ },
8839
+ required: [
8840
+ "outputs",
8841
+ "nodes"
8842
+ ],
8843
+ type: "object"
8844
+ },
8845
+ fragmentInput: {
8846
+ additionalProperties: false,
8847
+ properties: {
8848
+ name: {
8849
+ minLength: 1,
8850
+ type: "string"
8851
+ },
8852
+ type: {
8853
+ type: "string"
8854
+ }
8855
+ },
8856
+ required: [
8857
+ "name"
8858
+ ],
8859
+ type: "object"
8860
+ },
8861
+ fragmentOutput: {
8862
+ additionalProperties: false,
8863
+ properties: {
8864
+ from_node: {
8865
+ minLength: 1,
8866
+ type: "string"
8867
+ },
8868
+ name: {
8869
+ minLength: 1,
8870
+ type: "string"
8871
+ },
8872
+ pointer: {
8873
+ pattern: "^(/.*)?$",
8874
+ type: "string"
8875
+ }
8876
+ },
8877
+ required: [
8878
+ "name",
8879
+ "from_node"
8880
+ ],
8881
+ type: "object"
8882
+ },
8883
+ llmResponsesBinding: {
8884
+ additionalProperties: false,
8885
+ oneOf: [
8886
+ {
8887
+ required: [
8888
+ "to"
8889
+ ]
8890
+ },
8891
+ {
8892
+ required: [
8893
+ "to_placeholder"
8894
+ ]
8895
+ }
8896
+ ],
8897
+ properties: {
8898
+ encoding: {
8899
+ "enum": [
8900
+ "json",
8901
+ "json_string"
8902
+ ],
8903
+ type: "string"
8904
+ },
8905
+ from: {
8906
+ minLength: 1,
8907
+ type: "string"
8908
+ },
8909
+ pointer: {
8910
+ pattern: "^(/.*)?$",
8911
+ type: "string"
8912
+ },
8913
+ to: {
8914
+ pattern: "^/.*$",
8915
+ type: "string"
8916
+ },
8917
+ to_placeholder: {
8918
+ minLength: 1,
8919
+ type: "string"
8920
+ }
8921
+ },
8922
+ required: [
8923
+ "from"
8924
+ ],
8925
+ type: "object"
8926
+ },
8927
+ mapFanoutItemBinding: {
8928
+ additionalProperties: false,
8929
+ oneOf: [
8930
+ {
8931
+ required: [
8932
+ "to"
8933
+ ]
8934
+ },
8935
+ {
8936
+ required: [
8937
+ "to_placeholder"
8938
+ ]
8939
+ }
8940
+ ],
8941
+ properties: {
8942
+ encoding: {
8943
+ "enum": [
8944
+ "json",
8945
+ "json_string"
8946
+ ],
8947
+ type: "string"
8948
+ },
8949
+ path: {
8950
+ pattern: "^(/.*)?$",
8951
+ type: "string"
8952
+ },
8953
+ to: {
8954
+ pattern: "^/.*$",
8955
+ type: "string"
8956
+ },
8957
+ to_placeholder: {
8958
+ minLength: 1,
8959
+ type: "string"
8960
+ }
8961
+ },
8962
+ type: "object"
8963
+ },
8964
+ node: {
8965
+ additionalProperties: false,
8966
+ oneOf: [
8967
+ {
8968
+ allOf: [
8969
+ {
8970
+ properties: {
8971
+ input: {
8972
+ properties: {
8973
+ bindings: {
8974
+ items: {
8975
+ $ref: "#/definitions/llmResponsesBinding"
8976
+ },
8977
+ type: "array"
8978
+ },
8979
+ request: {
8980
+ type: "object"
8981
+ },
8982
+ stream: {
8983
+ type: "boolean"
8984
+ },
8985
+ tool_execution: {
8986
+ additionalProperties: false,
8987
+ properties: {
8988
+ mode: {
8989
+ "default": "server",
8990
+ "enum": [
8991
+ "server",
8992
+ "client"
8993
+ ],
8994
+ type: "string"
8995
+ }
8996
+ },
8997
+ required: [
8998
+ "mode"
8999
+ ],
9000
+ type: "object"
9001
+ },
9002
+ tool_limits: {
9003
+ additionalProperties: false,
9004
+ properties: {
9005
+ max_llm_calls: {
9006
+ "default": 8,
9007
+ maximum: 64,
9008
+ minimum: 1,
9009
+ type: "integer"
9010
+ },
9011
+ max_tool_calls_per_step: {
9012
+ "default": 16,
9013
+ maximum: 64,
9014
+ minimum: 1,
9015
+ type: "integer"
9016
+ },
9017
+ wait_ttl_ms: {
9018
+ "default": 900000,
9019
+ maximum: 86400000,
9020
+ minimum: 1,
9021
+ type: "integer"
9022
+ }
9023
+ },
9024
+ type: "object"
9025
+ }
9026
+ },
9027
+ required: [
9028
+ "request"
9029
+ ],
9030
+ type: "object"
9031
+ }
9032
+ }
9033
+ }
9034
+ ],
9035
+ properties: {
9036
+ type: {
9037
+ "const": "llm.responses"
9038
+ }
9039
+ },
9040
+ required: [
9041
+ "input"
9042
+ ]
9043
+ },
9044
+ {
9045
+ allOf: [
9046
+ {
9047
+ properties: {
9048
+ input: {
9049
+ properties: {
9050
+ bindings: {
9051
+ items: {
9052
+ $ref: "#/definitions/llmResponsesBinding"
9053
+ },
9054
+ type: "array"
9055
+ },
9056
+ request: {
9057
+ type: "object"
9058
+ },
9059
+ stream: {
9060
+ type: "boolean"
9061
+ },
9062
+ tool_execution: {
9063
+ additionalProperties: false,
9064
+ properties: {
9065
+ mode: {
9066
+ "default": "server",
9067
+ "enum": [
9068
+ "server",
9069
+ "client"
9070
+ ],
9071
+ type: "string"
9072
+ }
9073
+ },
9074
+ required: [
9075
+ "mode"
9076
+ ],
9077
+ type: "object"
9078
+ },
9079
+ tool_limits: {
9080
+ additionalProperties: false,
9081
+ properties: {
9082
+ max_llm_calls: {
9083
+ "default": 8,
9084
+ maximum: 64,
9085
+ minimum: 1,
9086
+ type: "integer"
9087
+ },
9088
+ max_tool_calls_per_step: {
9089
+ "default": 16,
9090
+ maximum: 64,
9091
+ minimum: 1,
9092
+ type: "integer"
9093
+ },
9094
+ wait_ttl_ms: {
9095
+ "default": 900000,
9096
+ maximum: 86400000,
9097
+ minimum: 1,
9098
+ type: "integer"
9099
+ }
9100
+ },
9101
+ type: "object"
9102
+ }
9103
+ },
9104
+ required: [
9105
+ "request"
9106
+ ],
9107
+ type: "object"
9108
+ }
9109
+ }
9110
+ }
9111
+ ],
9112
+ properties: {
9113
+ type: {
9114
+ "const": "route.switch"
9115
+ }
9116
+ },
9117
+ required: [
9118
+ "input"
9119
+ ]
9120
+ },
9121
+ {
9122
+ properties: {
9123
+ type: {
9124
+ "const": "join.all"
9125
+ }
9126
+ }
9127
+ },
9128
+ {
9129
+ allOf: [
9130
+ {
9131
+ properties: {
9132
+ input: {
9133
+ additionalProperties: false,
9134
+ properties: {
9135
+ predicate: {
9136
+ $ref: "#/definitions/condition"
9137
+ }
9138
+ },
9139
+ type: "object"
9140
+ }
9141
+ }
9142
+ }
9143
+ ],
9144
+ properties: {
9145
+ type: {
9146
+ "const": "join.any"
9147
+ }
9148
+ }
9149
+ },
9150
+ {
9151
+ allOf: [
9152
+ {
9153
+ properties: {
9154
+ input: {
9155
+ additionalProperties: false,
9156
+ properties: {
9157
+ limit: {
9158
+ minimum: 1,
9159
+ type: "integer"
9160
+ },
9161
+ predicate: {
9162
+ $ref: "#/definitions/condition"
9163
+ },
9164
+ timeout_ms: {
9165
+ minimum: 1,
9166
+ type: "integer"
9167
+ }
9168
+ },
7236
9169
  type: "object"
7237
9170
  }
7238
9171
  }
@@ -7240,20 +9173,13 @@ var definitions = {
7240
9173
  ],
7241
9174
  properties: {
7242
9175
  type: {
7243
- "const": "llm.responses"
9176
+ "const": "join.collect"
7244
9177
  }
7245
9178
  },
7246
9179
  required: [
7247
9180
  "input"
7248
9181
  ]
7249
9182
  },
7250
- {
7251
- properties: {
7252
- type: {
7253
- "const": "join.all"
7254
- }
7255
- }
7256
- },
7257
9183
  {
7258
9184
  allOf: [
7259
9185
  {
@@ -7311,6 +9237,122 @@ var definitions = {
7311
9237
  required: [
7312
9238
  "input"
7313
9239
  ]
9240
+ },
9241
+ {
9242
+ allOf: [
9243
+ {
9244
+ properties: {
9245
+ input: {
9246
+ additionalProperties: false,
9247
+ properties: {
9248
+ item_bindings: {
9249
+ items: {
9250
+ $ref: "#/definitions/mapFanoutItemBinding"
9251
+ },
9252
+ type: "array"
9253
+ },
9254
+ items: {
9255
+ additionalProperties: false,
9256
+ properties: {
9257
+ from: {
9258
+ minLength: 1,
9259
+ type: "string"
9260
+ },
9261
+ path: {
9262
+ pattern: "^(/.*)?$",
9263
+ type: "string"
9264
+ },
9265
+ pointer: {
9266
+ pattern: "^(/.*)?$",
9267
+ type: "string"
9268
+ }
9269
+ },
9270
+ required: [
9271
+ "from"
9272
+ ],
9273
+ type: "object"
9274
+ },
9275
+ max_parallelism: {
9276
+ minimum: 1,
9277
+ type: "integer"
9278
+ },
9279
+ subnode: {
9280
+ additionalProperties: false,
9281
+ properties: {
9282
+ id: {
9283
+ minLength: 1,
9284
+ type: "string"
9285
+ },
9286
+ input: {
9287
+ },
9288
+ type: {
9289
+ "enum": [
9290
+ "llm.responses",
9291
+ "route.switch",
9292
+ "transform.json"
9293
+ ],
9294
+ type: "string"
9295
+ }
9296
+ },
9297
+ required: [
9298
+ "id",
9299
+ "type"
9300
+ ],
9301
+ type: "object"
9302
+ }
9303
+ },
9304
+ required: [
9305
+ "items",
9306
+ "subnode"
9307
+ ],
9308
+ type: "object"
9309
+ }
9310
+ }
9311
+ }
9312
+ ],
9313
+ properties: {
9314
+ type: {
9315
+ "const": "map.fanout"
9316
+ }
9317
+ },
9318
+ required: [
9319
+ "input"
9320
+ ]
9321
+ },
9322
+ {
9323
+ allOf: [
9324
+ {
9325
+ properties: {
9326
+ input: {
9327
+ additionalProperties: false,
9328
+ properties: {
9329
+ bind_inputs: {
9330
+ additionalProperties: {
9331
+ $ref: "#/definitions/fragmentBindInput"
9332
+ },
9333
+ type: "object"
9334
+ },
9335
+ ref: {
9336
+ minLength: 1,
9337
+ type: "string"
9338
+ }
9339
+ },
9340
+ required: [
9341
+ "ref"
9342
+ ],
9343
+ type: "object"
9344
+ }
9345
+ }
9346
+ }
9347
+ ],
9348
+ properties: {
9349
+ type: {
9350
+ "const": "fragment"
9351
+ }
9352
+ },
9353
+ required: [
9354
+ "input"
9355
+ ]
7314
9356
  }
7315
9357
  ],
7316
9358
  properties: {
@@ -7323,8 +9365,13 @@ var definitions = {
7323
9365
  type: {
7324
9366
  "enum": [
7325
9367
  "llm.responses",
9368
+ "route.switch",
7326
9369
  "join.all",
7327
- "transform.json"
9370
+ "join.any",
9371
+ "join.collect",
9372
+ "transform.json",
9373
+ "map.fanout",
9374
+ "fragment"
7328
9375
  ],
7329
9376
  type: "string"
7330
9377
  }
@@ -7346,6 +9393,10 @@ var definitions = {
7346
9393
  minLength: 1,
7347
9394
  type: "string"
7348
9395
  },
9396
+ output: {
9397
+ minLength: 1,
9398
+ type: "string"
9399
+ },
7349
9400
  pointer: {
7350
9401
  pattern: "^(/.*)?$",
7351
9402
  type: "string"
@@ -7400,8 +9451,14 @@ var properties = {
7400
9451
  },
7401
9452
  type: "object"
7402
9453
  },
9454
+ fragments: {
9455
+ additionalProperties: {
9456
+ $ref: "#/definitions/fragmentDef"
9457
+ },
9458
+ type: "object"
9459
+ },
7403
9460
  kind: {
7404
- "const": "workflow.v0",
9461
+ "const": "workflow.v1",
7405
9462
  type: "string"
7406
9463
  },
7407
9464
  name: {
@@ -7427,9 +9484,9 @@ var required = [
7427
9484
  "nodes",
7428
9485
  "outputs"
7429
9486
  ];
7430
- var title = "ModelRelay workflow.v0";
9487
+ var title = "ModelRelay workflow.v1";
7431
9488
  var type = "object";
7432
- var workflow_v0_schema = {
9489
+ var workflow_v1_schema = {
7433
9490
  $id: $id,
7434
9491
  $schema: $schema,
7435
9492
  additionalProperties: additionalProperties,
@@ -7442,6 +9499,7 @@ var workflow_v0_schema = {
7442
9499
 
7443
9500
  declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
7444
9501
  type WorkflowsCompileRequestV0 = WorkflowSpecV0;
9502
+ type WorkflowsCompileRequestV1 = WorkflowSpecV1;
7445
9503
 
7446
9504
  /**
7447
9505
  * High-level workflow pattern helpers for common workflow structures.
@@ -7725,6 +9783,22 @@ declare class MapReduceBuilder {
7725
9783
  */
7726
9784
  declare function MapReduce(name: string, items?: readonly MapItemConfig[]): MapReduceBuilder;
7727
9785
 
9786
+ type NDJSONDelayStep = {
9787
+ delayMs: number;
9788
+ line: string;
9789
+ };
9790
+ declare function buildNDJSONResponse(lines: string[], headers?: Record<string, string>, status?: number): Response;
9791
+ declare function buildDelayedNDJSONResponse(steps: NDJSONDelayStep[], headers?: Record<string, string>, status?: number): Response;
9792
+ type MockFetchCall = {
9793
+ url: string;
9794
+ init?: RequestInit;
9795
+ };
9796
+ type MockFetchResponder = Response | ((call: MockFetchCall, index: number) => Response | Promise<Response>);
9797
+ declare function createMockFetchQueue(responses: MockFetchResponder[]): {
9798
+ fetch: typeof fetch;
9799
+ calls: MockFetchCall[];
9800
+ };
9801
+
7728
9802
  declare function parseApiKey(raw: string): ApiKey;
7729
9803
  declare function parsePublishableKey(raw: string): PublishableKey;
7730
9804
  declare function parseSecretKey(raw: string): SecretKey;
@@ -8235,6 +10309,372 @@ declare namespace index$1 {
8235
10309
  export type { index$1_$defs as $defs, index$1_components as components, index$1_operations as operations, index$1_paths as paths, index$1_webhooks as webhooks };
8236
10310
  }
8237
10311
 
10312
+ /**
10313
+ * Helper functions for constructing workflow.v1 conditions and bindings.
10314
+ *
10315
+ * These factory functions reduce boilerplate when building conditional edges
10316
+ * and node bindings.
10317
+ *
10318
+ * @example
10319
+ * ```typescript
10320
+ * import { workflow, workflowV1 } from "@modelrelay/sdk";
10321
+ * import { whenOutputEquals, bindToPlaceholder } from "@modelrelay/sdk/workflow";
10322
+ *
10323
+ * const spec = workflowV1()
10324
+ * .routeSwitch("router", request)
10325
+ * .llmResponses("billing", billingReq, {
10326
+ * bindings: [bindToPlaceholder("router", "route_data")]
10327
+ * })
10328
+ * .edge("router", "billing", whenOutputEquals("$.route", "billing"))
10329
+ * .build();
10330
+ * ```
10331
+ */
10332
+
10333
+ /**
10334
+ * Create a condition that matches when a node's output equals a specific value.
10335
+ *
10336
+ * @param path - JSONPath expression to extract the value (must start with $)
10337
+ * @param value - The value to compare against
10338
+ * @returns A condition for use in edge `when` clauses
10339
+ *
10340
+ * @example
10341
+ * ```typescript
10342
+ * builder.edge("router", "billing", whenOutputEquals("$.route", "billing"))
10343
+ * ```
10344
+ */
10345
+ declare function whenOutputEquals(path: string, value: unknown): ConditionV1$1;
10346
+ /**
10347
+ * Create a condition that matches when a node's output matches a regex pattern.
10348
+ *
10349
+ * @param path - JSONPath expression to extract the value (must start with $)
10350
+ * @param pattern - Regular expression pattern to match
10351
+ * @returns A condition for use in edge `when` clauses
10352
+ *
10353
+ * @example
10354
+ * ```typescript
10355
+ * builder.edge("router", "handler", whenOutputMatches("$.category", "billing|support"))
10356
+ * ```
10357
+ */
10358
+ declare function whenOutputMatches(path: string, pattern: string): ConditionV1$1;
10359
+ /**
10360
+ * Create a condition that matches when a path exists in the node's output.
10361
+ *
10362
+ * @param path - JSONPath expression to check for existence (must start with $)
10363
+ * @returns A condition for use in edge `when` clauses
10364
+ *
10365
+ * @example
10366
+ * ```typescript
10367
+ * builder.edge("router", "handler", whenOutputExists("$.special_case"))
10368
+ * ```
10369
+ */
10370
+ declare function whenOutputExists(path: string): ConditionV1$1;
10371
+ /**
10372
+ * Create a condition that matches when a node's status equals a specific value.
10373
+ *
10374
+ * @param path - JSONPath expression to extract the status value (must start with $)
10375
+ * @param value - The status value to compare against
10376
+ * @returns A condition for use in edge `when` clauses
10377
+ *
10378
+ * @example
10379
+ * ```typescript
10380
+ * builder.edge("node", "handler", whenStatusEquals("$.status", "succeeded"))
10381
+ * ```
10382
+ */
10383
+ declare function whenStatusEquals(path: string, value: unknown): ConditionV1$1;
10384
+ /**
10385
+ * Create a condition that matches when a node's status matches a regex pattern.
10386
+ *
10387
+ * @param path - JSONPath expression to extract the status value (must start with $)
10388
+ * @param pattern - Regular expression pattern to match
10389
+ * @returns A condition for use in edge `when` clauses
10390
+ */
10391
+ declare function whenStatusMatches(path: string, pattern: string): ConditionV1$1;
10392
+ /**
10393
+ * Create a condition that matches when a path exists in the node's status.
10394
+ *
10395
+ * @param path - JSONPath expression to check for existence (must start with $)
10396
+ * @returns A condition for use in edge `when` clauses
10397
+ */
10398
+ declare function whenStatusExists(path: string): ConditionV1$1;
10399
+ /**
10400
+ * Options for binding factory functions.
10401
+ */
10402
+ interface BindingOptions {
10403
+ /** JSON pointer to extract from the source node's output */
10404
+ pointer?: string;
10405
+ /** Encoding to use (defaults to "json_string") */
10406
+ encoding?: LLMResponsesBindingEncodingV1;
10407
+ }
10408
+ /**
10409
+ * Create a binding that injects a value into a {{placeholder}} in the prompt.
10410
+ *
10411
+ * @param from - Source node ID
10412
+ * @param placeholder - Placeholder name (without the {{ }} delimiters)
10413
+ * @param opts - Optional pointer and encoding settings
10414
+ * @returns A binding for use in node input
10415
+ *
10416
+ * @example
10417
+ * ```typescript
10418
+ * builder.llmResponses("aggregate", request, {
10419
+ * bindings: [
10420
+ * bindToPlaceholder("join", "route_output"),
10421
+ * bindToPlaceholder("data", "user_data", { pointer: "/results" })
10422
+ * ]
10423
+ * })
10424
+ * ```
10425
+ */
10426
+ declare function bindToPlaceholder(from: NodeId$1, placeholder: string, opts?: BindingOptions): LLMResponsesBindingV1;
10427
+ /**
10428
+ * Create a binding that injects a value at a specific JSON pointer in the request.
10429
+ *
10430
+ * @param from - Source node ID
10431
+ * @param to - JSON pointer in the request to inject the value
10432
+ * @param opts - Optional pointer and encoding settings
10433
+ * @returns A binding for use in node input
10434
+ *
10435
+ * @example
10436
+ * ```typescript
10437
+ * builder.llmResponses("processor", request, {
10438
+ * bindings: [
10439
+ * bindToPointer("source", "/input/0/content/0/text")
10440
+ * ]
10441
+ * })
10442
+ * ```
10443
+ */
10444
+ declare function bindToPointer(from: NodeId$1, to: string, opts?: BindingOptions): LLMResponsesBindingV1;
10445
+ /**
10446
+ * Create a binding from a source node with full control over all fields.
10447
+ *
10448
+ * @param from - Source node ID
10449
+ * @returns A builder for fluent binding construction
10450
+ *
10451
+ * @example
10452
+ * ```typescript
10453
+ * const binding = bindFrom("source")
10454
+ * .pointer("/output/text")
10455
+ * .toPlaceholder("data")
10456
+ * .encoding("json")
10457
+ * .build();
10458
+ * ```
10459
+ */
10460
+ declare function bindFrom(from: NodeId$1): BindingBuilder;
10461
+ /**
10462
+ * Fluent builder for constructing bindings.
10463
+ */
10464
+ declare class BindingBuilder {
10465
+ private _from;
10466
+ private _pointer?;
10467
+ private _to?;
10468
+ private _toPlaceholder?;
10469
+ private _encoding;
10470
+ constructor(from: NodeId$1);
10471
+ /**
10472
+ * Set the source pointer to extract from the node's output.
10473
+ */
10474
+ pointer(ptr: string): BindingBuilder;
10475
+ /**
10476
+ * Set the destination JSON pointer in the request.
10477
+ */
10478
+ to(ptr: string): BindingBuilder;
10479
+ /**
10480
+ * Set the destination placeholder name.
10481
+ */
10482
+ toPlaceholder(name: string): BindingBuilder;
10483
+ /**
10484
+ * Set the encoding for the binding value.
10485
+ */
10486
+ encoding(enc: LLMResponsesBindingEncodingV1): BindingBuilder;
10487
+ /**
10488
+ * Build the binding object.
10489
+ */
10490
+ build(): LLMResponsesBindingV1;
10491
+ }
10492
+
10493
+ /**
10494
+ * High-level pattern builders for workflow.v1.
10495
+ *
10496
+ * These builders provide ergonomic construction of common workflow patterns
10497
+ * like routing and fan-out/reduce, similar to the v0 Chain/Parallel/MapReduce patterns.
10498
+ *
10499
+ * @example
10500
+ * ```typescript
10501
+ * import { RouterV1, FanoutReduceV1 } from "@modelrelay/sdk/workflow";
10502
+ *
10503
+ * // Router pattern: classify input and route to specialized handlers
10504
+ * const routerSpec = new RouterV1({
10505
+ * classifier: { model: "gpt-4o-mini", input: [...] },
10506
+ * routes: [
10507
+ * { value: "billing", handler: { model: "gpt-4o", input: [...] } },
10508
+ * { value: "support", handler: { model: "gpt-4o", input: [...] } },
10509
+ * ]
10510
+ * }).build();
10511
+ *
10512
+ * // FanoutReduce pattern: generate items, process each, aggregate
10513
+ * const fanoutSpec = new FanoutReduceV1({
10514
+ * generator: { model: "gpt-4o-mini", input: [...] },
10515
+ * itemsPath: "/questions",
10516
+ * mapperPlaceholder: "question",
10517
+ * mapper: { model: "gpt-4o", input: [...] },
10518
+ * reducer: { model: "gpt-4o", input: [...] },
10519
+ * }).build();
10520
+ * ```
10521
+ */
10522
+
10523
+ /**
10524
+ * A route definition for the router pattern.
10525
+ */
10526
+ interface RouterRouteV1 {
10527
+ /** The value to match in the router output (at routePath) */
10528
+ value: string;
10529
+ /** The handler node ID (auto-generated if not provided) */
10530
+ id?: NodeId$1;
10531
+ /** The LLM request for this route's handler */
10532
+ handler: WireResponsesRequest | ResponsesRequest;
10533
+ /** Optional bindings for the handler */
10534
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
10535
+ }
10536
+ /**
10537
+ * Configuration for the RouterV1 pattern builder.
10538
+ */
10539
+ interface RouterConfigV1 {
10540
+ /** Optional workflow name */
10541
+ name?: string;
10542
+ /** The classifier/router node configuration */
10543
+ classifier: WireResponsesRequest | ResponsesRequest;
10544
+ /** Optional classifier node ID (defaults to "router") */
10545
+ classifierId?: NodeId$1;
10546
+ /** JSONPath to extract the route value from classifier output (defaults to "$.route") */
10547
+ routePath?: string;
10548
+ /** Route definitions mapping values to handlers */
10549
+ routes: RouterRouteV1[];
10550
+ /** Optional aggregator node to combine results */
10551
+ aggregator?: {
10552
+ /** Aggregator node ID (defaults to "aggregate") */
10553
+ id?: NodeId$1;
10554
+ /** The LLM request for aggregation */
10555
+ request: WireResponsesRequest | ResponsesRequest;
10556
+ /** Placeholder name for injecting the routed result (defaults to "route_output") */
10557
+ placeholder?: string;
10558
+ };
10559
+ /** Output name (defaults to "final") */
10560
+ outputName?: OutputName$1;
10561
+ }
10562
+ /**
10563
+ * Builder for the Router pattern in workflow.v1.
10564
+ *
10565
+ * The router pattern classifies input and routes to specialized handlers
10566
+ * based on the classification result. A join.any node collects the first
10567
+ * successful handler response.
10568
+ *
10569
+ * Topology:
10570
+ * ```
10571
+ * classifier --[when=billing]--> billing_handler --\
10572
+ * --[when=support]--> support_handler --> join.any --> [aggregator]
10573
+ * --[when=sales]--> sales_handler ----/
10574
+ * ```
10575
+ *
10576
+ * @example
10577
+ * ```typescript
10578
+ * const spec = new RouterV1({
10579
+ * classifier: {
10580
+ * model: "gpt-4o-mini",
10581
+ * input: [{ role: "user", content: "Classify: {{query}}" }]
10582
+ * },
10583
+ * routes: [
10584
+ * { value: "billing", handler: { model: "gpt-4o", input: [...] } },
10585
+ * { value: "support", handler: { model: "gpt-4o", input: [...] } },
10586
+ * ],
10587
+ * aggregator: {
10588
+ * request: { model: "gpt-4o", input: [...] },
10589
+ * placeholder: "route_output"
10590
+ * }
10591
+ * }).build();
10592
+ * ```
10593
+ */
10594
+ declare class RouterV1 {
10595
+ private readonly config;
10596
+ constructor(config: RouterConfigV1);
10597
+ /**
10598
+ * Build the workflow specification.
10599
+ */
10600
+ build(): WorkflowSpecV1;
10601
+ }
10602
+ /**
10603
+ * Configuration for the FanoutReduceV1 pattern builder.
10604
+ */
10605
+ interface FanoutReduceConfigV1 {
10606
+ /** Optional workflow name */
10607
+ name?: string;
10608
+ /** The generator node that produces items to process */
10609
+ generator: WireResponsesRequest | ResponsesRequest;
10610
+ /** Generator node ID (defaults to "generator") */
10611
+ generatorId?: NodeId$1;
10612
+ /** JSON Pointer to extract items array from generator output (defaults to "/items") */
10613
+ itemsPath?: string;
10614
+ /** The mapper subnode template (processes each item) */
10615
+ mapper: WireResponsesRequest | ResponsesRequest;
10616
+ /** Placeholder name for item injection in mapper (defaults to "item") */
10617
+ mapperPlaceholder?: string;
10618
+ /** Maximum parallel mapper executions (defaults to 4) */
10619
+ maxParallelism?: number;
10620
+ /** The reducer node that aggregates results */
10621
+ reducer: WireResponsesRequest | ResponsesRequest;
10622
+ /** Reducer node ID (defaults to "reducer") */
10623
+ reducerId?: NodeId$1;
10624
+ /** How to inject fanout results into reducer */
10625
+ reducerBinding?: {
10626
+ /** Pointer to extract from fanout output (defaults to "/results") */
10627
+ pointer?: string;
10628
+ /** Placeholder name for injection (uses to_placeholder if set) */
10629
+ placeholder?: string;
10630
+ /** JSON pointer for injection (uses to if set, defaults to user message text) */
10631
+ to?: string;
10632
+ };
10633
+ /** Output name (defaults to "final") */
10634
+ outputName?: OutputName$1;
10635
+ }
10636
+ /**
10637
+ * Builder for the FanoutReduce pattern in workflow.v1.
10638
+ *
10639
+ * The fanout/reduce pattern generates a list of items, processes each item
10640
+ * in parallel using a mapper node, then aggregates all results.
10641
+ *
10642
+ * Topology:
10643
+ * ```
10644
+ * generator --> map.fanout(mapper) --> reducer
10645
+ * ```
10646
+ *
10647
+ * @example
10648
+ * ```typescript
10649
+ * const spec = new FanoutReduceV1({
10650
+ * generator: {
10651
+ * model: "gpt-4o-mini",
10652
+ * input: [{ role: "user", content: "Generate 3 questions about {{topic}}" }]
10653
+ * },
10654
+ * itemsPath: "/questions",
10655
+ * mapperPlaceholder: "question",
10656
+ * mapper: {
10657
+ * model: "gpt-4o",
10658
+ * input: [{ role: "system", content: "Answer: {{question}}" }]
10659
+ * },
10660
+ * reducer: {
10661
+ * model: "gpt-4o",
10662
+ * input: [{ role: "system", content: "Combine answers: {{results}}" }]
10663
+ * },
10664
+ * reducerBinding: { placeholder: "results" },
10665
+ * maxParallelism: 4,
10666
+ * }).build();
10667
+ * ```
10668
+ */
10669
+ declare class FanoutReduceV1 {
10670
+ private readonly config;
10671
+ constructor(config: FanoutReduceConfigV1);
10672
+ /**
10673
+ * Build the workflow specification.
10674
+ */
10675
+ build(): WorkflowSpecV1;
10676
+ }
10677
+
8238
10678
  /**
8239
10679
  * Workflow types with clean naming (no Workflow prefix).
8240
10680
  *
@@ -8257,14 +10697,26 @@ type PlanHash = PlanHash$1;
8257
10697
 
8258
10698
  type Kind = WorkflowKind;
8259
10699
  type SpecV0 = WorkflowSpecV0;
10700
+ type SpecV1 = WorkflowSpecV1;
8260
10701
  type NodeV0 = WorkflowNodeV0;
10702
+ type NodeV1 = WorkflowNodeV1;
8261
10703
  type EdgeV0 = WorkflowEdgeV0;
10704
+ type EdgeV1 = WorkflowEdgeV1;
8262
10705
  type OutputRefV0 = WorkflowOutputRefV0;
10706
+ type OutputRefV1 = WorkflowOutputRefV1;
8263
10707
  type BindingV0 = LLMResponsesBindingV0;
10708
+ type BindingV1 = LLMResponsesBindingV1;
8264
10709
  type BindingEncodingV0 = LLMResponsesBindingEncodingV0;
10710
+ type BindingEncodingV1 = LLMResponsesBindingEncodingV1;
8265
10711
  type ToolLimitsV0 = LLMResponsesToolLimitsV0;
10712
+ type ToolLimitsV1 = LLMResponsesToolLimitsV1;
8266
10713
  type ToolExecutionV0 = ToolExecutionV0$1;
10714
+ type ToolExecutionV1 = ToolExecutionV1$1;
8267
10715
  type ToolExecutionModeV0 = ToolExecutionModeV0$1;
10716
+ type ToolExecutionModeV1 = ToolExecutionModeV1$1;
10717
+ type ConditionV1 = ConditionV1$1;
10718
+ type ConditionOpV1 = ConditionOpV1$1;
10719
+ type ConditionSourceV1 = ConditionSourceV1$1;
8268
10720
  type StatusV0 = RunStatusV0;
8269
10721
  type EventTypeV0 = RunEventTypeV0;
8270
10722
  type EventV0 = RunEventV0;
@@ -8295,12 +10747,23 @@ type TokenUsageV0 = TokenUsageV0$1;
8295
10747
  type PayloadInfoV0 = PayloadInfoV0$1;
8296
10748
  type StreamEventKind = StreamEventKind$1;
8297
10749
  declare const KindV0: "workflow.v0";
10750
+ declare const KindV1: "workflow.v1";
8298
10751
  declare const NodeTypes: {
8299
10752
  readonly LLMResponses: "llm.responses";
8300
10753
  readonly JoinAll: "join.all";
8301
10754
  readonly TransformJSON: "transform.json";
8302
10755
  };
8303
10756
  type NodeType = (typeof NodeTypes)[keyof typeof NodeTypes];
10757
+ declare const NodeTypesV1: {
10758
+ readonly LLMResponses: "llm.responses";
10759
+ readonly RouteSwitch: "route.switch";
10760
+ readonly JoinAll: "join.all";
10761
+ readonly JoinAny: "join.any";
10762
+ readonly JoinCollect: "join.collect";
10763
+ readonly TransformJSON: "transform.json";
10764
+ readonly MapFanout: "map.fanout";
10765
+ };
10766
+ type NodeTypeV1 = (typeof NodeTypesV1)[keyof typeof NodeTypesV1];
8304
10767
  declare const BindingEncodings: {
8305
10768
  readonly JSON: "json";
8306
10769
  readonly JSONString: "json_string";
@@ -8309,15 +10772,20 @@ declare const ToolExecutionModes: {
8309
10772
  readonly Server: "server";
8310
10773
  readonly Client: "client";
8311
10774
  };
8312
- /** JSON pointer to extract text content from an LLM response output. */
8313
- declare const LLM_TEXT_OUTPUT = "/output/0/content/0/text";
8314
- /** JSON pointer to inject text into the user message of an LLM request. */
8315
- declare const LLM_USER_MESSAGE_TEXT = "/request/input/1/content/0/text";
8316
10775
 
10776
+ type index_BindingBuilder = BindingBuilder;
10777
+ declare const index_BindingBuilder: typeof BindingBuilder;
8317
10778
  type index_BindingEncodingV0 = BindingEncodingV0;
10779
+ type index_BindingEncodingV1 = BindingEncodingV1;
8318
10780
  declare const index_BindingEncodings: typeof BindingEncodings;
10781
+ type index_BindingOptions = BindingOptions;
8319
10782
  type index_BindingV0 = BindingV0;
10783
+ type index_BindingV1 = BindingV1;
10784
+ type index_ConditionOpV1 = ConditionOpV1;
10785
+ type index_ConditionSourceV1 = ConditionSourceV1;
10786
+ type index_ConditionV1 = ConditionV1;
8320
10787
  type index_EdgeV0 = EdgeV0;
10788
+ type index_EdgeV1 = EdgeV1;
8321
10789
  type index_EventBaseV0 = EventBaseV0;
8322
10790
  type index_EventNodeFailedV0 = EventNodeFailedV0;
8323
10791
  type index_EventNodeLLMCallV0 = EventNodeLLMCallV0;
@@ -8335,9 +10803,13 @@ type index_EventRunFailedV0 = EventRunFailedV0;
8335
10803
  type index_EventRunStartedV0 = EventRunStartedV0;
8336
10804
  type index_EventTypeV0 = EventTypeV0;
8337
10805
  type index_EventV0 = EventV0;
10806
+ type index_FanoutReduceConfigV1 = FanoutReduceConfigV1;
10807
+ type index_FanoutReduceV1 = FanoutReduceV1;
10808
+ declare const index_FanoutReduceV1: typeof FanoutReduceV1;
8338
10809
  type index_FunctionToolCallV0 = FunctionToolCallV0;
8339
10810
  type index_Kind = Kind;
8340
10811
  declare const index_KindV0: typeof KindV0;
10812
+ declare const index_KindV1: typeof KindV1;
8341
10813
  declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
8342
10814
  declare const index_LLM_USER_MESSAGE_TEXT: typeof LLM_USER_MESSAGE_TEXT;
8343
10815
  type index_NodeErrorV0 = NodeErrorV0;
@@ -8347,29 +10819,50 @@ type index_NodeOutputDeltaV0 = NodeOutputDeltaV0;
8347
10819
  type index_NodeToolCallV0 = NodeToolCallV0;
8348
10820
  type index_NodeToolResultV0 = NodeToolResultV0;
8349
10821
  type index_NodeType = NodeType;
10822
+ type index_NodeTypeV1 = NodeTypeV1;
8350
10823
  declare const index_NodeTypes: typeof NodeTypes;
10824
+ declare const index_NodeTypesV1: typeof NodeTypesV1;
8351
10825
  type index_NodeV0 = NodeV0;
10826
+ type index_NodeV1 = NodeV1;
8352
10827
  type index_NodeWaitingV0 = NodeWaitingV0;
8353
10828
  type index_OutputName = OutputName;
8354
10829
  type index_OutputRefV0 = OutputRefV0;
10830
+ type index_OutputRefV1 = OutputRefV1;
8355
10831
  type index_PayloadInfoV0 = PayloadInfoV0;
8356
10832
  type index_PendingToolCallV0 = PendingToolCallV0;
8357
10833
  type index_PlanHash = PlanHash;
10834
+ type index_RouterConfigV1 = RouterConfigV1;
10835
+ type index_RouterRouteV1 = RouterRouteV1;
10836
+ type index_RouterV1 = RouterV1;
10837
+ declare const index_RouterV1: typeof RouterV1;
8358
10838
  type index_RunId = RunId;
8359
10839
  type index_SpecV0 = SpecV0;
10840
+ type index_SpecV1 = SpecV1;
8360
10841
  type index_StatusV0 = StatusV0;
8361
10842
  type index_StreamEventKind = StreamEventKind;
8362
10843
  type index_TokenUsageV0 = TokenUsageV0;
8363
10844
  type index_ToolExecutionModeV0 = ToolExecutionModeV0;
10845
+ type index_ToolExecutionModeV1 = ToolExecutionModeV1;
8364
10846
  declare const index_ToolExecutionModes: typeof ToolExecutionModes;
8365
10847
  type index_ToolExecutionV0 = ToolExecutionV0;
10848
+ type index_ToolExecutionV1 = ToolExecutionV1;
8366
10849
  type index_ToolLimitsV0 = ToolLimitsV0;
10850
+ type index_ToolLimitsV1 = ToolLimitsV1;
10851
+ declare const index_bindFrom: typeof bindFrom;
10852
+ declare const index_bindToPlaceholder: typeof bindToPlaceholder;
10853
+ declare const index_bindToPointer: typeof bindToPointer;
8367
10854
  declare const index_parseNodeId: typeof parseNodeId;
8368
10855
  declare const index_parseOutputName: typeof parseOutputName;
8369
10856
  declare const index_parsePlanHash: typeof parsePlanHash;
8370
10857
  declare const index_parseRunId: typeof parseRunId;
10858
+ declare const index_whenOutputEquals: typeof whenOutputEquals;
10859
+ declare const index_whenOutputExists: typeof whenOutputExists;
10860
+ declare const index_whenOutputMatches: typeof whenOutputMatches;
10861
+ declare const index_whenStatusEquals: typeof whenStatusEquals;
10862
+ declare const index_whenStatusExists: typeof whenStatusExists;
10863
+ declare const index_whenStatusMatches: typeof whenStatusMatches;
8371
10864
  declare namespace index {
8372
- export { type index_BindingEncodingV0 as BindingEncodingV0, index_BindingEncodings as BindingEncodings, type index_BindingV0 as BindingV0, type index_EdgeV0 as EdgeV0, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_FunctionToolCallV0 as FunctionToolCallV0, type index_Kind as Kind, index_KindV0 as KindV0, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeType as NodeType, index_NodeTypes as NodeTypes, type index_NodeV0 as NodeV0, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefV0 as OutputRefV0, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RunId as RunId, type index_SpecV0 as SpecV0, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolExecutionModeV0 as ToolExecutionModeV0, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV0 as ToolExecutionV0, type index_ToolLimitsV0 as ToolLimitsV0, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId };
10865
+ export { index_BindingBuilder as BindingBuilder, type index_BindingEncodingV0 as BindingEncodingV0, type index_BindingEncodingV1 as BindingEncodingV1, index_BindingEncodings as BindingEncodings, type index_BindingOptions as BindingOptions, type index_BindingV0 as BindingV0, type index_BindingV1 as BindingV1, type index_ConditionOpV1 as ConditionOpV1, type index_ConditionSourceV1 as ConditionSourceV1, type index_ConditionV1 as ConditionV1, type index_EdgeV0 as EdgeV0, type index_EdgeV1 as EdgeV1, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_FanoutReduceConfigV1 as FanoutReduceConfigV1, index_FanoutReduceV1 as FanoutReduceV1, type index_FunctionToolCallV0 as FunctionToolCallV0, type index_Kind as Kind, index_KindV0 as KindV0, index_KindV1 as KindV1, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeType as NodeType, type index_NodeTypeV1 as NodeTypeV1, index_NodeTypes as NodeTypes, index_NodeTypesV1 as NodeTypesV1, type index_NodeV0 as NodeV0, type index_NodeV1 as NodeV1, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefV0 as OutputRefV0, type index_OutputRefV1 as OutputRefV1, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RouterConfigV1 as RouterConfigV1, type index_RouterRouteV1 as RouterRouteV1, index_RouterV1 as RouterV1, type index_RunId as RunId, type index_SpecV0 as SpecV0, type index_SpecV1 as SpecV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolExecutionModeV0 as ToolExecutionModeV0, type index_ToolExecutionModeV1 as ToolExecutionModeV1, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV0 as ToolExecutionV0, type index_ToolExecutionV1 as ToolExecutionV1, type index_ToolLimitsV0 as ToolLimitsV0, type index_ToolLimitsV1 as ToolLimitsV1, index_bindFrom as bindFrom, index_bindToPlaceholder as bindToPlaceholder, index_bindToPointer as bindToPointer, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId, index_whenOutputEquals as whenOutputEquals, index_whenOutputExists as whenOutputExists, index_whenOutputMatches as whenOutputMatches, index_whenStatusEquals as whenStatusEquals, index_whenStatusExists as whenStatusExists, index_whenStatusMatches as whenStatusMatches };
8373
10866
  }
8374
10867
 
8375
10868
  /**
@@ -8417,6 +10910,8 @@ declare class ModelRelay {
8417
10910
  readonly models: ModelsClient;
8418
10911
  readonly sessions: SessionsClient;
8419
10912
  readonly baseUrl: string;
10913
+ /** @internal HTTP client for internal use by session sync */
10914
+ readonly http: HTTPClient;
8420
10915
  static fromSecretKey(secretKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
8421
10916
  static fromPublishableKey(publishableKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
8422
10917
  static fromApiKey(apiKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
@@ -8424,4 +10919,4 @@ declare class ModelRelay {
8424
10919
  forCustomer(customerId: string): CustomerScopedModelRelay;
8425
10920
  }
8426
10921
 
8427
- export { type APICheckoutSession, type APICustomerRef, APIError, type APIFrontendToken, type APIKey, type APIResponsesResponse, type APIUsage, type ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, type BillingProvider, BillingProviders, BrowserDefaults, BrowserToolNames, BrowserToolPack, type BrowserToolPackOptions, type CatalogModel, Chain, ChainBuilder, type CheckoutSession, type Citation, type CodeExecConfig, ConfigError, type ContentPart, type ContentPartType, ContentPartTypes, type Customer, type CustomerClaimRequest, type CustomerCreateRequest, type CustomerMetadata, CustomerResponsesClient, CustomerScopedModelRelay, type CustomerSubscribeRequest, type CustomerToken, CustomerTokenProvider, type CustomerTokenRequest, type CustomerUpsertRequest, type CustomerWithSubscription, CustomersClient, DEFAULT_BASE_URL, DEFAULT_CLIENT_HEADER, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_IGNORE_DIRS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepPartial, type DeviceStartRequest, type DeviceStartResponse, type DeviceTokenPending, type DeviceTokenResponse, type DeviceTokenResult, type ErrorCategory, type ErrorCode, ErrorCodes, FSDefaults, ToolNames as FSToolNames, type FieldError, type FrontendCustomer, type FrontendToken, type FrontendTokenAutoProvisionRequest, FrontendTokenProvider, type FrontendTokenRequest, type FunctionCall, type FunctionCallDelta, type FunctionTool, type HandleWaitingResult, type HttpRequestMetrics, type ImageData, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, type InputItem, type InputItemType, InputItemTypes, type JSONSchemaFormat, type JsonSchemaOptions, type KnownStopReason, LLMNodeBuilder, LLMStep, type LLMStepConfig, LLM_TEXT_OUTPUT$1 as LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT$1 as LLM_USER_MESSAGE_TEXT, type ListSessionsOptions, type ListSessionsResponse, LocalFSToolPack, type LocalFSToolPackOptions, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MapItem, type MapItemConfig, MapReduce, MapReduceBuilder, MemorySessionStore, type MessageDeltaData, type MessageRole, MessageRoles, type MessageStartData, type MessageStopData, type MetricsCallbacks, type ModelCapability, type ModelId, ModelRelay, type ModelRelayBaseOptions, ModelRelayError, type ModelRelayKeyOptions, type ModelRelayOptions, type ModelRelayTokenOptions, type ModelRelayTokenProviderOptions, ModelsClient, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, type NonEmptyArray, type OAuthDeviceAuthorization, type OAuthDeviceAuthorizationRequest, type OAuthDeviceToken, type OAuthDeviceTokenPollRequest, type OIDCExchangeRequest, OIDCExchangeTokenProvider, type OutputFormat, type OutputFormatType, OutputFormatTypes, type OutputItem, type OutputItemType, OutputItemTypes, type OutputName$1 as OutputName, Parallel, ParallelBuilder, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PriceInterval, type Project, type ProviderId, type PublishableKey, type RemoteSessionInfo, type RemoteSessionOptions, type RequestContext, type Response$1 as Response, type ResponseEvent, type ResponseEventType, ResponsesClient, ResponsesStream, type RetryConfig, type RetryHandler, type RetryMetadata, type RetryOptions, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, SDK_VERSION, type Schema, type SecretKey, type Session, type SessionArtifacts, type SessionId, type SessionMessage, type SessionPendingToolCall, type SessionRunOptions, type SessionRunResult, type SessionRunStatus, type SessionState, type SessionStore, type SessionType, type SessionUsageSummary, SessionsClient, type StopReason, StopReasons, type StreamFirstTokenMetrics, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, type StructuredJSONEvent, type StructuredJSONRecordType, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Subscription, type SubscriptionStatusKind, SubscriptionStatuses, type Tier, type TierCheckoutRequest, type TierCheckoutSession, type TierCode, TiersClient, type TokenProvider, type TokenType, type TokenUsageMetrics, type Tool, ToolArgsError, ToolArgumentError, type ToolCall, ToolCallAccumulator, type ToolCallDelta, type ToolChoice, type ToolChoiceType, ToolChoiceTypes, type ToolExecutionResult, type ToolHandler, ToolRegistry, ToolRunner, type ToolRunnerOptions, type ToolType, ToolTypes, type TraceCallbacks, TransformJSONNodeBuilder, type TransformJSONValueV0, TransportError, type TransportErrorKind, type Usage, type UsageSummary, type ValidationIssue, WORKFLOWS_COMPILE_PATH, type WebSearchConfig, type WebToolMode, WebToolModes, Workflow, WorkflowBuilderV0, type WorkflowBuilderV0State, type WorkflowEdgeV0, type WorkflowKind, WorkflowKinds, type WorkflowNodeType, WorkflowNodeTypes, type WorkflowNodeV0, type WorkflowOutputRefV0, type WorkflowSpecV0, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequestV0, type WorkflowsCompileResponseV0, type WorkflowsCompileV0Result, type XSearchConfig, type ZodLikeSchema, asModelId, asProviderId, asSessionId, asTierCode, assistantMessageWithToolCalls, createAccessTokenAuth, createApiKeyAuth, createAssistantMessage, createBrowserToolPack, createBrowserTools, createFunctionCall, createFunctionTool, createFunctionToolFromSchema, createLocalFSToolPack, createLocalFSTools, createLocalSession, createMemorySessionStore, createRetryMessages, createSystemMessage, createToolCall, createToolRunner, createUsage, createUserMessage, createWebTool, defaultRetryHandler, executeWithRetry, firstToolCall, formatToolErrorForModel, generateSessionId, index$1 as generated, getRetryableErrors, hasRetryableErrors, hasToolCalls, isAutoProvisionDisabled, isAutoProvisionMisconfigured, isEmailRequired, isIdentityRequired, isProvisioningError, isPublishableKey, isSecretKey, mergeMetrics, mergeTrace, modelToString, newWorkflow, normalizeModelId, normalizeStopReason, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parsePublishableKey, parseRunId, parseSecretKey, parseToolArgs, parseToolArgsRaw, pollOAuthDeviceToken, respondToToolCall, runOAuthDeviceFlowForIDToken, startOAuthDeviceAuthorization, stopReasonToString, toolChoiceAuto, toolChoiceNone, toolChoiceRequired, toolResultMessage, transformJSONMerge, transformJSONObject, transformJSONValue, tryParseToolArgs, validateWithZod, index as workflow, workflowV0, workflow_v0_schema as workflowV0Schema, zodToJsonSchema };
10922
+ export { type APICheckoutSession, type APICustomerRef, APIError, type APIFrontendToken, type APIKey, type APIResponsesResponse, type APIUsage, type ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, type BillingProvider, BillingProviders, BindingTargetError, BrowserDefaults, BrowserToolNames, BrowserToolPack, type BrowserToolPackOptions, type CatalogModel, Chain, ChainBuilder, type CheckoutSession, type Citation, type CodeExecConfig, ConfigError, type ContentPart, type ContentPartType, ContentPartTypes, type Customer, type CustomerClaimRequest, type CustomerCreateRequest, type CustomerMetadata, CustomerResponsesClient, CustomerScopedModelRelay, type CustomerSubscribeRequest, type CustomerToken, CustomerTokenProvider, type CustomerTokenRequest, type CustomerUpsertRequest, type CustomerWithSubscription, CustomersClient, DEFAULT_BASE_URL, DEFAULT_CLIENT_HEADER, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_IGNORE_DIRS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepPartial, type DeviceStartRequest, type DeviceStartResponse, type DeviceTokenPending, type DeviceTokenResponse, type DeviceTokenResult, type ErrorCategory, type ErrorCode, ErrorCodes, FSDefaults, ToolNames as FSToolNames, type FieldError, type FrontendCustomer, type FrontendToken, type FrontendTokenAutoProvisionRequest, FrontendTokenProvider, type FrontendTokenRequest, type FunctionCall, type FunctionCallDelta, type FunctionTool, type HandleWaitingResult, type HttpRequestMetrics, type ImageData, type ImagePinResponse, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, type InputItem, type InputItemType, InputItemTypes, type JSONPointer, type JSONSchemaFormat, JoinOutput, JoinOutputPath, type JsonSchemaOptions, type KnownStopReason, LLMInput, LLMInputContentItemPath, LLMInputFirstMessageText, LLMInputMessagePath, LLMInputPath, LLMInputSystemText, LLMInputUserText, LLMNodeBuilder, LLMOutput, LLMOutputContentItemPath, LLMOutputContentPath, LLMOutputPath, LLMOutputText, LLMStep, type LLMStepConfig, LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT, type ListSessionsOptions, type ListSessionsResponse, LocalFSToolPack, type LocalFSToolPackOptions, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MapFanoutInputError, MapItem, type MapItemConfig, MapReduce, MapReduceBuilder, MemorySessionStore, type MessageDeltaData, type MessageRole, MessageRoles, type MessageStartData, type MessageStopData, type MetricsCallbacks, type MockFetchCall, type MockFetchResponder, type ModelCapability, type ModelId, ModelRelay, type ModelRelayBaseOptions, ModelRelayError, type ModelRelayKeyOptions, type ModelRelayOptions, type ModelRelayTokenOptions, type ModelRelayTokenProviderOptions, ModelsClient, type NDJSONDelayStep, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, type NonEmptyArray, type OAuthDeviceAuthorization, type OAuthDeviceAuthorizationRequest, type OAuthDeviceToken, type OAuthDeviceTokenPollRequest, type OIDCExchangeRequest, OIDCExchangeTokenProvider, type OutputFormat, type OutputFormatType, OutputFormatTypes, type OutputItem, type OutputItemType, OutputItemTypes, type OutputName$1 as OutputName, Parallel, ParallelBuilder, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PollUntilOptions, type PollUntilResult, type PriceInterval, type Project, type ProviderId, type PublishableKey, type RemoteSessionInfo, type RemoteSessionOptions, type RequestContext, type Response$1 as Response, type ResponseEvent, type ResponseEventType, ResponsesClient, ResponsesStream, type RetryConfig, type RetryHandler, type RetryMetadata, type RetryOptions, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, SDK_VERSION, type Schema, type SecretKey, type Session, type SessionArtifacts, type SessionContextManagement, type SessionContextTruncateInfo, type SessionId, type SessionMessage, type SessionPendingToolCall, type SessionRunOptions, type SessionRunResult, type SessionRunStatus, type SessionState, type SessionStore, type SessionSyncOptions, type SessionSyncResult, type SessionType, type SessionUsageSummary, SessionsClient, type StopReason, StopReasons, type StreamFirstTokenMetrics, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, type StructuredJSONEvent, type StructuredJSONRecordType, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Subscription, type SubscriptionStatusKind, SubscriptionStatuses, type Tier, type TierCheckoutRequest, type TierCheckoutSession, type TierCode, TiersClient, type TokenProvider, type TokenType, type TokenUsageMetrics, type Tool, ToolArgsError, ToolArgumentError, type ToolCall, ToolCallAccumulator, type ToolCallDelta, type ToolChoice, type ToolChoiceType, ToolChoiceTypes, type ToolExecutionResult, type ToolHandler, ToolRegistry, ToolRunner, type ToolRunnerOptions, type ToolType, ToolTypes, type TraceCallbacks, TransformJSONNodeBuilder, type TransformJSONValueV0, type TransformJSONValueV1, TransportError, type TransportErrorKind, type Usage, type UsageSummary, type ValidationIssue, WORKFLOWS_COMPILE_PATH, type WebSearchConfig, type WebToolMode, WebToolModes, Workflow, WorkflowBuilderV0, type WorkflowBuilderV0State, WorkflowBuilderV1, type WorkflowBuilderV1State, type WorkflowEdgeV0, type WorkflowKind, WorkflowKinds, type WorkflowNodeType, WorkflowNodeTypes, type WorkflowNodeV0, type WorkflowOutputRefV0, type WorkflowSpecV0, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequestV0, type WorkflowsCompileRequestV1, type WorkflowsCompileResponseV0, type WorkflowsCompileResponseV1, type WorkflowsCompileV0Result, type WorkflowsCompileV1Result, type XSearchConfig, type ZodLikeSchema, asModelId, asProviderId, asSessionId, asTierCode, assistantMessageWithToolCalls, buildDelayedNDJSONResponse, buildNDJSONResponse, createAccessTokenAuth, createApiKeyAuth, createAssistantMessage, createBrowserToolPack, createBrowserTools, createFunctionCall, createFunctionTool, createFunctionToolFromSchema, createLocalFSToolPack, createLocalFSTools, createLocalSession, createMemorySessionStore, createMockFetchQueue, createRetryMessages, createSystemMessage, createToolCall, createToolRunner, createUsage, createUserMessage, createWebTool, defaultRetryHandler, executeWithRetry, firstToolCall, formatToolErrorForModel, generateSessionId, index$1 as generated, getRetryableErrors, hasRetryableErrors, hasToolCalls, isAutoProvisionDisabled, isAutoProvisionMisconfigured, isEmailRequired, isIdentityRequired, isProvisioningError, isPublishableKey, isSecretKey, mergeMetrics, mergeTrace, modelToString, newWorkflow, normalizeModelId, normalizeStopReason, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parsePublishableKey, parseRunId, parseSecretKey, parseToolArgs, parseToolArgsRaw, pollOAuthDeviceToken, pollUntil, respondToToolCall, runOAuthDeviceFlowForIDToken, startOAuthDeviceAuthorization, stopReasonToString, toolChoiceAuto, toolChoiceNone, toolChoiceRequired, toolResultMessage, transformJSONMerge, transformJSONMergeV1, transformJSONObject, transformJSONObjectV1, transformJSONValue, transformJSONValueV1, tryParseToolArgs, validateWithZod, index as workflow, workflowV0, workflow_v0_schema as workflowV0Schema, workflowV1, workflow_v1_schema as workflowV1Schema, zodToJsonSchema };