@modelrelay/sdk 1.44.0 → 2.1.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.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as ApiKey, R as RetryConfig, M as MetricsCallbacks, T as TraceCallbacks, a as RequestContext, F as FrontendCustomer, b as TokenProvider, c as FrontendTokenRequest, d as FrontendToken, e as FrontendTokenAutoProvisionRequest, C as CustomerTokenRequest, f as CustomerToken, O as OIDCExchangeRequest, P as ProviderId, g as ModelId, I as InputItem, h as OutputFormat, i as Tool, j as ToolChoice, Z as ZodLikeSchema, k as ResponseEvent, l as Response$1, S as StructuredJSONEvent, m as FieldError, n as RetryMetadata, o as TransportErrorKind, p as ToolRegistry, q as ToolExecutionResult, r as TierCode, s as PublishableKey, t as SecretKey, u as ModelRelayKeyOptions, v as ModelRelayOptions } from './tools-CvfwPjC5.cjs';
2
- export { bg as APICheckoutSession, bf as APICustomerRef, be as APIFrontendToken, bj as APIKey, bi as APIResponsesResponse, bh as APIUsage, ap as BillingProvider, ao as BillingProviders, aY as Citation, aQ as CodeExecConfig, aD as ContentPart, aC as ContentPartType, aB as ContentPartTypes, aq as CustomerMetadata, D as DEFAULT_BASE_URL, ac as DEFAULT_CLIENT_HEADER, ad as DEFAULT_CONNECT_TIMEOUT_MS, ae as DEFAULT_REQUEST_TIMEOUT_MS, bd as DeepPartial, aT as FunctionCall, bb as FunctionCallDelta, aN as FunctionTool, aZ as HttpRequestMetrics, aF as InputItemType, aE as InputItemTypes, aX as JSONSchemaFormat, a7 as JsonSchemaOptions, ah as KnownStopReason, b8 as MessageDeltaData, aA as MessageRole, az as MessageRoles, b7 as MessageStartData, b9 as MessageStopData, ar as ModelRelayBaseOptions, as as ModelRelayTokenOptions, at as ModelRelayTokenProviderOptions, af as NonEmptyArray, aW as OutputFormatType, aV as OutputFormatTypes, aI as OutputItem, aH as OutputItemType, aG as OutputItemTypes, ay as Project, b6 as ResponseEventType, aa as RetryOptions, ab as SDK_VERSION, a8 as Schema, ai as StopReason, ag as StopReasons, a_ as StreamFirstTokenMetrics, bc as StructuredJSONRecordType, an as SubscriptionStatusKind, am as SubscriptionStatuses, au as TokenType, a$ as TokenUsageMetrics, a1 as ToolArgsError, aU as ToolCall, X as ToolCallAccumulator, ba as ToolCallDelta, aS as ToolChoiceType, aR as ToolChoiceTypes, a9 as ToolHandler, aK as ToolType, aJ as ToolTypes, av as Usage, ax as UsageSummary, aO as WebSearchConfig, aM as WebToolIntent, aL as WebToolIntents, aP as XSearchConfig, ak as asModelId, aj as asProviderId, al as asTierCode, U as assistantMessageWithToolCalls, K as createAssistantMessage, W as createFunctionCall, w as createFunctionTool, x as createFunctionToolFromSchema, a5 as createRetryMessages, L as createSystemMessage, V as createToolCall, aw as createUsage, J as createUserMessage, y as createWebTool, a6 as executeWithRetry, H as firstToolCall, a2 as formatToolErrorForModel, a4 as getRetryableErrors, a3 as hasRetryableErrors, G as hasToolCalls, b0 as mergeMetrics, b1 as mergeTrace, b5 as modelToString, b4 as normalizeModelId, b2 as normalizeStopReason, _ as parseToolArgs, a0 as parseToolArgsRaw, Q as respondToToolCall, b3 as stopReasonToString, z as toolChoiceAuto, E as toolChoiceNone, B as toolChoiceRequired, N as toolResultMessage, $ as tryParseToolArgs, Y as zodToJsonSchema } from './tools-CvfwPjC5.cjs';
3
- import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-DZpC1zuz.cjs';
1
+ import { A as ApiKey, R as RetryConfig, M as MetricsCallbacks, T as TraceCallbacks, a as RequestContext, b as TokenProvider, C as CustomerTokenRequest, c as CustomerToken, G as GetOrCreateCustomerTokenRequest, P as ProviderId, d as ModelId, I as InputItem, O as OutputFormat, e as Tool, f as ToolChoice, Z as ZodLikeSchema, g as ResponseEvent, h as Response$1, S as StructuredJSONEvent, F as FieldError, i as RetryMetadata, j as TransportErrorKind, k as ToolRegistry, l as ToolExecutionResult, m as TierCode, n as SecretKey, o as ModelRelayKeyOptions, p as ModelRelayOptions } from './tools-bCt1QwNk.cjs';
2
+ export { ba as APICheckoutSession, b9 as APICustomerRef, bd as APIKey, bc as APIResponsesResponse, bb as APIUsage, ak as BillingProvider, aj as BillingProviders, aT as Citation, aL as CodeExecConfig, ay as ContentPart, ax as ContentPartType, aw as ContentPartTypes, al as CustomerMetadata, D as DEFAULT_BASE_URL, a7 as DEFAULT_CLIENT_HEADER, a8 as DEFAULT_CONNECT_TIMEOUT_MS, a9 as DEFAULT_REQUEST_TIMEOUT_MS, b8 as DeepPartial, aO as FunctionCall, b6 as FunctionCallDelta, aI as FunctionTool, aU as HttpRequestMetrics, aA as InputItemType, az as InputItemTypes, aS as JSONSchemaFormat, a2 as JsonSchemaOptions, ac as KnownStopReason, b3 as MessageDeltaData, av as MessageRole, au as MessageRoles, b2 as MessageStartData, b4 as MessageStopData, am as ModelRelayBaseOptions, an as ModelRelayTokenOptions, ao as ModelRelayTokenProviderOptions, aa as NonEmptyArray, aR as OutputFormatType, aQ as OutputFormatTypes, aD as OutputItem, aC as OutputItemType, aB as OutputItemTypes, at as Project, b1 as ResponseEventType, a5 as RetryOptions, a6 as SDK_VERSION, a3 as Schema, ad as StopReason, ab as StopReasons, aV as StreamFirstTokenMetrics, b7 as StructuredJSONRecordType, ai as SubscriptionStatusKind, ah as SubscriptionStatuses, ap as TokenType, aW as TokenUsageMetrics, X as ToolArgsError, aP as ToolCall, N as ToolCallAccumulator, b5 as ToolCallDelta, aN as ToolChoiceType, aM as ToolChoiceTypes, a4 as ToolHandler, aF as ToolType, aE as ToolTypes, aq as Usage, as as UsageSummary, aJ as WebSearchConfig, aH as WebToolIntent, aG as WebToolIntents, aK as XSearchConfig, af as asModelId, ae as asProviderId, ag as asTierCode, J as assistantMessageWithToolCalls, z as createAssistantMessage, L as createFunctionCall, q as createFunctionTool, r as createFunctionToolFromSchema, a0 as createRetryMessages, B as createSystemMessage, K as createToolCall, ar as createUsage, y as createUserMessage, s as createWebTool, a1 as executeWithRetry, x as firstToolCall, Y as formatToolErrorForModel, $ as getRetryableErrors, _ as hasRetryableErrors, w as hasToolCalls, aX as mergeMetrics, aY as mergeTrace, b0 as modelToString, a$ as normalizeModelId, aZ as normalizeStopReason, U as parseToolArgs, W as parseToolArgsRaw, H as respondToToolCall, a_ as stopReasonToString, t as toolChoiceAuto, v as toolChoiceNone, u as toolChoiceRequired, E as toolResultMessage, V as tryParseToolArgs, Q as zodToJsonSchema } from './tools-bCt1QwNk.cjs';
3
+ import { c as components, $ as $defs, o as operations, p as paths, w as webhooks } from './api-D_hE36Ps.cjs';
4
4
 
5
5
  interface RequestOptions {
6
6
  method?: string;
@@ -76,7 +76,6 @@ declare class HTTPClient {
76
76
  interface AuthConfig {
77
77
  apiKey?: ApiKey;
78
78
  accessToken?: string;
79
- customer?: FrontendCustomer;
80
79
  tokenProvider?: TokenProvider;
81
80
  }
82
81
  interface AuthHeaders {
@@ -94,48 +93,32 @@ declare function createAccessTokenAuth(accessToken: string): AuthHeaders;
94
93
  declare class AuthClient {
95
94
  private readonly http;
96
95
  private readonly apiKey?;
97
- private readonly apiKeyIsPublishable;
98
96
  private readonly accessToken?;
99
- private readonly customer?;
100
97
  private readonly tokenProvider?;
101
- private cachedFrontend;
102
98
  constructor(http: HTTPClient, cfg: AuthConfig);
103
- /**
104
- * Exchange a publishable key for a short-lived frontend token for an existing customer.
105
- * Tokens are cached until they are close to expiry.
106
- *
107
- * Use this method when the customer already exists in the system.
108
- * For auto-provisioning new customers, use frontendTokenAutoProvision instead.
109
- */
110
- frontendToken(request: FrontendTokenRequest): Promise<FrontendToken>;
111
- /**
112
- * Exchange a publishable key for a frontend token, creating the customer if needed.
113
- * The customer will be auto-provisioned on the project's free tier.
114
- * Tokens are cached until they are close to expiry.
115
- *
116
- * Use this method when the customer may not exist and should be created automatically.
117
- * The email is required for auto-provisioning.
118
- */
119
- frontendTokenAutoProvision(request: FrontendTokenAutoProvisionRequest): Promise<FrontendToken>;
120
- /**
121
- * Internal method to send frontend token requests.
122
- */
123
- private sendFrontendTokenRequest;
124
99
  /**
125
100
  * Determine the correct auth headers for /responses.
126
- * Publishable keys are automatically exchanged for frontend tokens.
127
101
  */
128
- authForResponses(overrides?: Partial<FrontendCustomer>): Promise<AuthHeaders>;
102
+ authForResponses(): Promise<AuthHeaders>;
129
103
  /**
130
104
  * Mint a customer-scoped bearer token (requires a secret key).
131
105
  */
132
106
  customerToken(request: CustomerTokenRequest): Promise<CustomerToken>;
133
107
  /**
134
- * Verify an OIDC id_token and exchange it for a customer bearer token.
108
+ * Get or create a customer and mint a bearer token.
109
+ *
110
+ * This is a convenience method that:
111
+ * 1. Upserts the customer (creates if not exists)
112
+ * 2. Mints a customer-scoped bearer token
113
+ *
114
+ * Use this when you want to ensure the customer exists before minting a token,
115
+ * without needing to handle 404 errors from customerToken().
116
+ *
117
+ * Requires a secret key.
135
118
  */
136
- oidcExchange(request: OIDCExchangeRequest): Promise<CustomerToken>;
119
+ getOrCreateCustomerToken(request: GetOrCreateCustomerTokenRequest): Promise<CustomerToken>;
137
120
  /**
138
- * Billing calls accept either bearer tokens or API keys (including publishable keys).
121
+ * Billing calls accept either bearer tokens or API keys.
139
122
  */
140
123
  authForBilling(): AuthHeaders;
141
124
  }
@@ -225,7 +208,7 @@ type ResponsesRequestOptions = {
225
208
  *
226
209
  * const result = await client.responses.structured(
227
210
  * PersonSchema,
228
- * client.responses.new().model("claude-sonnet-4-20250514").user("...").build(),
211
+ * client.responses.new().model("claude-sonnet-4-5").user("...").build(),
229
212
  * { maxRetries: 2 }
230
213
  * );
231
214
  *
@@ -507,7 +490,7 @@ declare class ResponsesClient {
507
490
  * import { z } from 'zod';
508
491
  *
509
492
  * const review = await client.responses.object({
510
- * model: 'claude-sonnet-4-20250514',
493
+ * model: 'claude-sonnet-4-5',
511
494
  * schema: z.object({
512
495
  * vulnerabilities: z.array(z.string()),
513
496
  * riskLevel: z.enum(['low', 'medium', 'high']),
@@ -566,7 +549,7 @@ declare class ResponsesClient {
566
549
  * @example
567
550
  * ```typescript
568
551
  * const result = await client.responses.objectWithMetadata({
569
- * model: 'claude-sonnet-4-20250514',
552
+ * model: 'claude-sonnet-4-5',
570
553
  * schema: ReviewSchema,
571
554
  * prompt: 'Review this code...',
572
555
  * });
@@ -669,18 +652,10 @@ declare function parsePlanHash(raw: string): PlanHash$1;
669
652
  declare function parseOutputName(raw: string): OutputName$1;
670
653
 
671
654
  declare const WorkflowKinds: {
672
- readonly WorkflowV0: "workflow.v0";
673
655
  readonly WorkflowV1: "workflow.v1";
674
656
  };
675
- type WorkflowKindV0 = (typeof WorkflowKinds)["WorkflowV0"];
676
657
  type WorkflowKindV1 = (typeof WorkflowKinds)["WorkflowV1"];
677
- type WorkflowKind = WorkflowKindV0 | WorkflowKindV1;
678
- declare const WorkflowNodeTypes: {
679
- readonly LLMResponses: "llm.responses";
680
- readonly JoinAll: "join.all";
681
- readonly TransformJSON: "transform.json";
682
- };
683
- type WorkflowNodeType = (typeof WorkflowNodeTypes)[keyof typeof WorkflowNodeTypes];
658
+ type WorkflowKind = WorkflowKindV1;
684
659
  declare const WorkflowNodeTypesV1: {
685
660
  readonly LLMResponses: "llm.responses";
686
661
  readonly RouteSwitch: "route.switch";
@@ -690,72 +665,6 @@ declare const WorkflowNodeTypesV1: {
690
665
  readonly TransformJSON: "transform.json";
691
666
  readonly MapFanout: "map.fanout";
692
667
  };
693
- type WorkflowSpecV0 = {
694
- kind: WorkflowKindV0;
695
- name?: string;
696
- execution?: {
697
- max_parallelism?: number;
698
- node_timeout_ms?: number;
699
- run_timeout_ms?: number;
700
- };
701
- nodes: ReadonlyArray<WorkflowNodeV0>;
702
- edges?: ReadonlyArray<WorkflowEdgeV0>;
703
- outputs: ReadonlyArray<WorkflowOutputRefV0>;
704
- };
705
- type WorkflowNodeV0 = {
706
- id: NodeId$1;
707
- type: typeof WorkflowNodeTypes.LLMResponses;
708
- input: {
709
- request: WireResponsesRequest;
710
- stream?: boolean;
711
- tool_execution?: ToolExecutionV0$1;
712
- tool_limits?: LLMResponsesToolLimitsV0;
713
- bindings?: ReadonlyArray<LLMResponsesBindingV0>;
714
- };
715
- } | {
716
- id: NodeId$1;
717
- type: typeof WorkflowNodeTypes.JoinAll;
718
- input?: Record<string, unknown>;
719
- } | {
720
- id: NodeId$1;
721
- type: typeof WorkflowNodeTypes.TransformJSON;
722
- input: {
723
- object?: Record<string, {
724
- from: NodeId$1;
725
- pointer?: string;
726
- }>;
727
- merge?: Array<{
728
- from: NodeId$1;
729
- pointer?: string;
730
- }>;
731
- };
732
- };
733
- type WorkflowEdgeV0 = {
734
- from: NodeId$1;
735
- to: NodeId$1;
736
- };
737
- type WorkflowOutputRefV0 = {
738
- name: OutputName$1;
739
- from: NodeId$1;
740
- pointer?: string;
741
- };
742
- type LLMResponsesBindingEncodingV0 = "json" | "json_string";
743
- type LLMResponsesBindingV0 = {
744
- from: NodeId$1;
745
- pointer?: string;
746
- to?: string;
747
- to_placeholder?: string;
748
- encoding?: LLMResponsesBindingEncodingV0;
749
- };
750
- type ToolExecutionModeV0$1 = "server" | "client";
751
- type ToolExecutionV0$1 = {
752
- mode: ToolExecutionModeV0$1;
753
- };
754
- type LLMResponsesToolLimitsV0 = {
755
- max_llm_calls?: number;
756
- max_tool_calls_per_step?: number;
757
- wait_ttl_ms?: number;
758
- };
759
668
  type ConditionSourceV1$1 = "node_output" | "node_status";
760
669
  type ConditionOpV1$1 = "equals" | "matches" | "exists";
761
670
  type ConditionV1$1 = {
@@ -1182,16 +1091,7 @@ declare class RunsClient {
1182
1091
  trace?: TraceCallbacks;
1183
1092
  });
1184
1093
  private applyCustomerHeader;
1185
- create(spec: WorkflowSpecV0, options?: RunsCreateOptions): Promise<RunsCreateResponse>;
1186
- schemaV0(options?: {
1187
- signal?: AbortSignal;
1188
- headers?: Record<string, string>;
1189
- timeoutMs?: number;
1190
- connectTimeoutMs?: number;
1191
- retry?: RetryConfig | false;
1192
- metrics?: MetricsCallbacks;
1193
- trace?: TraceCallbacks;
1194
- }): Promise<unknown>;
1094
+ create(spec: WorkflowSpecV1, options?: RunsCreateOptions): Promise<RunsCreateResponse>;
1195
1095
  runEventSchemaV0(options?: {
1196
1096
  signal?: AbortSignal;
1197
1097
  headers?: Record<string, string>;
@@ -1224,14 +1124,6 @@ declare const ErrorCodes: {
1224
1124
  readonly INVALID_INPUT: "INVALID_INPUT";
1225
1125
  readonly PAYMENT_REQUIRED: "PAYMENT_REQUIRED";
1226
1126
  readonly METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED";
1227
- /** Identity provider + subject required for identity-based auth. */
1228
- readonly IDENTITY_REQUIRED: "IDENTITY_REQUIRED";
1229
- /** Auto-provision disabled for the project. */
1230
- readonly AUTO_PROVISION_DISABLED: "AUTO_PROVISION_DISABLED";
1231
- /** Auto-provision tier misconfigured for the project. */
1232
- readonly AUTO_PROVISION_MISCONFIGURED: "AUTO_PROVISION_MISCONFIGURED";
1233
- /** Email required for auto-provisioning a new customer. */
1234
- readonly EMAIL_REQUIRED: "EMAIL_REQUIRED";
1235
1127
  };
1236
1128
  type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
1237
1129
  type ErrorCategory = "config" | "transport" | "api";
@@ -1303,29 +1195,6 @@ declare class APIError extends ModelRelayError {
1303
1195
  isForbidden(): boolean;
1304
1196
  /** Returns true if the error is a service unavailable error. */
1305
1197
  isUnavailable(): boolean;
1306
- /**
1307
- * Returns true if the error indicates identity is missing/invalid for identity-based auth.
1308
- */
1309
- isIdentityRequired(): boolean;
1310
- /**
1311
- * Returns true if auto-provisioning is disabled for the project.
1312
- * To resolve: configure customer auto-provisioning on the project (select a default tier).
1313
- */
1314
- isAutoProvisionDisabled(): boolean;
1315
- /**
1316
- * Returns true if email is required for auto-provisioning a new customer.
1317
- * To resolve: provide the 'email' field in your frontend token request.
1318
- */
1319
- isEmailRequired(): boolean;
1320
- /**
1321
- * Returns true if auto-provisioning is misconfigured for the project.
1322
- * To resolve: ensure the configured auto-provision tier exists and belongs to the project.
1323
- */
1324
- isAutoProvisionMisconfigured(): boolean;
1325
- /**
1326
- * Returns true if this is a customer provisioning error (identity not found + auto-provision disabled/misconfigured, or email required).
1327
- */
1328
- isProvisioningError(): boolean;
1329
1198
  }
1330
1199
  type WorkflowValidationIssue = {
1331
1200
  code: string;
@@ -1369,31 +1238,11 @@ declare class PathEscapeError extends ModelRelayError {
1369
1238
  resolvedPath: string;
1370
1239
  });
1371
1240
  }
1372
- /**
1373
- * Returns true if the error indicates email is required for auto-provisioning.
1374
- */
1375
- declare function isEmailRequired(err: unknown): boolean;
1376
- /**
1377
- * Returns true if the error indicates identity is required for identity-based auth.
1378
- */
1379
- declare function isIdentityRequired(err: unknown): boolean;
1380
- /**
1381
- * Returns true if the error indicates auto-provisioning is disabled.
1382
- */
1383
- declare function isAutoProvisionDisabled(err: unknown): boolean;
1384
- /**
1385
- * Returns true if the error indicates auto-provisioning is misconfigured.
1386
- */
1387
- declare function isAutoProvisionMisconfigured(err: unknown): boolean;
1388
- /**
1389
- * Returns true if the error is a customer provisioning error.
1390
- */
1391
- declare function isProvisioningError(err: unknown): boolean;
1392
1241
  declare function parseErrorResponse(response: Response, retries?: RetryMetadata): Promise<ModelRelayError>;
1393
1242
 
1394
1243
  type WorkflowsCompileOptions = {
1395
1244
  /**
1396
- * Optional customer attribution header (mainly for publishable-key contexts).
1245
+ * Optional customer attribution header for attributing requests to a customer.
1397
1246
  */
1398
1247
  customerId?: string;
1399
1248
  /**
@@ -1407,28 +1256,10 @@ type WorkflowsCompileOptions = {
1407
1256
  metrics?: MetricsCallbacks;
1408
1257
  trace?: TraceCallbacks;
1409
1258
  };
1410
- type WorkflowsCompileResponseV0 = {
1411
- plan_json: unknown;
1412
- plan_hash: PlanHash$1;
1413
- };
1414
1259
  type WorkflowsCompileResponseV1 = {
1415
1260
  plan_json: unknown;
1416
1261
  plan_hash: PlanHash$1;
1417
1262
  };
1418
- type WorkflowsCompileV0Result = ({
1419
- ok: true;
1420
- } & WorkflowsCompileResponseV0) | {
1421
- ok: false;
1422
- error_type: "validation_error";
1423
- issues: ReadonlyArray<WorkflowValidationIssue>;
1424
- } | {
1425
- ok: false;
1426
- error_type: "internal_error";
1427
- status: number;
1428
- message: string;
1429
- code?: string;
1430
- requestId?: string;
1431
- };
1432
1263
  type WorkflowsCompileV1Result = ({
1433
1264
  ok: true;
1434
1265
  } & WorkflowsCompileResponseV1) | {
@@ -1452,7 +1283,6 @@ declare class WorkflowsClient {
1452
1283
  metrics?: MetricsCallbacks;
1453
1284
  trace?: TraceCallbacks;
1454
1285
  });
1455
- compileV0(spec: WorkflowSpecV0, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV0Result>;
1456
1286
  compileV1(spec: WorkflowSpecV1, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV1Result>;
1457
1287
  }
1458
1288
 
@@ -1760,8 +1590,8 @@ interface RemoteSessionOptions {
1760
1590
  defaultTools?: Tool[];
1761
1591
  /** Session metadata (stored on server). */
1762
1592
  metadata?: Record<string, unknown>;
1763
- /** End user ID to associate with the session. */
1764
- endUserId?: string;
1593
+ /** Customer ID to associate with the session. */
1594
+ customerId?: string;
1765
1595
  }
1766
1596
  /**
1767
1597
  * Options for listing remote sessions.
@@ -1771,8 +1601,8 @@ interface ListSessionsOptions {
1771
1601
  limit?: number;
1772
1602
  /** Cursor for pagination. */
1773
1603
  cursor?: string;
1774
- /** End user ID to filter by. */
1775
- endUserId?: string;
1604
+ /** Customer ID to filter by. */
1605
+ customerId?: string;
1776
1606
  }
1777
1607
  /**
1778
1608
  * Response from listing sessions.
@@ -1884,7 +1714,7 @@ declare class RemoteSession implements Session {
1884
1714
  private readonly defaultProvider?;
1885
1715
  private readonly defaultTools?;
1886
1716
  private metadata;
1887
- private endUserId?;
1717
+ private customerId?;
1888
1718
  private readonly resolveModelContext;
1889
1719
  private messages;
1890
1720
  private artifacts;
@@ -1925,7 +1755,7 @@ declare class RemoteSession implements Session {
1925
1755
  static list(client: ModelRelay, options?: {
1926
1756
  limit?: number;
1927
1757
  offset?: number;
1928
- endUserId?: string;
1758
+ customerId?: string;
1929
1759
  }): Promise<{
1930
1760
  sessions: RemoteSessionInfo[];
1931
1761
  nextCursor?: string;
@@ -2195,7 +2025,7 @@ declare class SessionsClient {
2195
2025
  /**
2196
2026
  * List remote sessions.
2197
2027
  *
2198
- * @param options - List options (limit, cursor, endUserId)
2028
+ * @param options - List options (limit, cursor, customerId)
2199
2029
  * @returns Paginated list of session summaries
2200
2030
  *
2201
2031
  * @example
@@ -2210,7 +2040,7 @@ declare class SessionsClient {
2210
2040
  /**
2211
2041
  * Delete a remote session.
2212
2042
  *
2213
- * Requires a secret key (not publishable key).
2043
+ * Requires a secret key.
2214
2044
  *
2215
2045
  * @param sessionId - ID of the session to delete
2216
2046
  *
@@ -2288,17 +2118,19 @@ interface TierCheckoutSession {
2288
2118
  }
2289
2119
  interface TiersClientConfig {
2290
2120
  apiKey?: ApiKey;
2121
+ accessToken?: string;
2291
2122
  }
2292
2123
  /**
2293
2124
  * TiersClient provides methods to query tiers in a project.
2294
- * Works with both publishable keys (mr_pk_*) and secret keys (mr_sk_*).
2125
+ * Requires a secret key (mr_sk_*) or a bearer token.
2295
2126
  */
2296
2127
  declare class TiersClient {
2297
2128
  private readonly http;
2298
2129
  private readonly apiKey?;
2299
2130
  private readonly hasSecretKey;
2131
+ private readonly hasAccessToken;
2300
2132
  constructor(http: HTTPClient, cfg: TiersClientConfig);
2301
- private ensureApiKey;
2133
+ private ensureAuth;
2302
2134
  private ensureSecretKey;
2303
2135
  /**
2304
2136
  * List all tiers in the project.
@@ -2313,8 +2145,8 @@ declare class TiersClient {
2313
2145
  *
2314
2146
  * This enables users to subscribe before authenticating. Stripe collects
2315
2147
  * the customer's email during checkout. After checkout completes, a
2316
- * customer record is created with the email from Stripe. The customer
2317
- * can later be linked to an identity via POST /customers/claim.
2148
+ * customer record is created with the email from Stripe. Your backend
2149
+ * can map it to your app user and mint customer tokens as needed.
2318
2150
  *
2319
2151
  * Requires a secret key (mr_sk_*).
2320
2152
  *
@@ -2345,19 +2177,6 @@ declare class CustomerScopedModelRelay {
2345
2177
  constructor(responses: ResponsesClient, customerId: string, baseUrl: string);
2346
2178
  }
2347
2179
 
2348
- declare class FrontendTokenProvider implements TokenProvider {
2349
- private readonly auth;
2350
- private readonly customer?;
2351
- private readonly publishableKey;
2352
- constructor(cfg: {
2353
- baseUrl?: string;
2354
- fetch?: typeof fetch;
2355
- clientHeader?: string;
2356
- publishableKey: string;
2357
- customer?: FrontendCustomer;
2358
- });
2359
- getToken(): Promise<string>;
2360
- }
2361
2180
  declare class CustomerTokenProvider implements TokenProvider {
2362
2181
  private readonly auth;
2363
2182
  private readonly req;
@@ -2371,296 +2190,6 @@ declare class CustomerTokenProvider implements TokenProvider {
2371
2190
  });
2372
2191
  getToken(): Promise<string>;
2373
2192
  }
2374
- declare class OIDCExchangeTokenProvider implements TokenProvider {
2375
- private readonly auth;
2376
- private readonly idTokenProvider;
2377
- private readonly request;
2378
- private cached?;
2379
- constructor(cfg: {
2380
- baseUrl?: string;
2381
- fetch?: typeof fetch;
2382
- clientHeader?: string;
2383
- apiKey: string;
2384
- idTokenProvider: () => Promise<string>;
2385
- projectId?: string;
2386
- });
2387
- getToken(): Promise<string>;
2388
- }
2389
-
2390
- /** JSON pointer to extract text content from an LLM response output. */
2391
- declare const LLM_TEXT_OUTPUT: string;
2392
- /** JSON pointer to inject text into the user message of an LLM request.
2393
- * The pointer is relative to the request object (not the full node input). */
2394
- declare const LLM_USER_MESSAGE_TEXT: string;
2395
- type TransformJSONValueV0 = {
2396
- from: NodeId$1;
2397
- pointer?: string;
2398
- };
2399
- declare function transformJSONValue(from: NodeId$1, pointer?: string): TransformJSONValueV0;
2400
- declare function transformJSONObject(object: Record<string, TransformJSONValueV0>): {
2401
- object: Record<string, TransformJSONValueV0>;
2402
- };
2403
- declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV0>): {
2404
- merge: Array<TransformJSONValueV0>;
2405
- };
2406
- type TransformJSONValueV1 = TransformJSONValueV0;
2407
- declare const transformJSONValueV1: typeof transformJSONValue;
2408
- declare const transformJSONObjectV1: typeof transformJSONObject;
2409
- declare const transformJSONMergeV1: typeof transformJSONMerge;
2410
- /**
2411
- * Error thrown when a binding targets a non-existent path in the request.
2412
- */
2413
- declare class BindingTargetError extends Error {
2414
- readonly nodeId: NodeId$1;
2415
- readonly bindingIndex: number;
2416
- readonly pointer: string;
2417
- constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
2418
- }
2419
- /**
2420
- * Error thrown when a map.fanout node input is invalid.
2421
- */
2422
- declare class MapFanoutInputError extends Error {
2423
- readonly nodeId: NodeId$1;
2424
- constructor(nodeId: NodeId$1, message: string);
2425
- }
2426
- type WorkflowBuilderV0State = {
2427
- readonly name?: string;
2428
- readonly execution?: WorkflowSpecV0["execution"];
2429
- readonly nodes: ReadonlyArray<WorkflowNodeV0>;
2430
- readonly edges: ReadonlyArray<WorkflowEdgeV0>;
2431
- readonly outputs: ReadonlyArray<WorkflowOutputRefV0>;
2432
- };
2433
- declare class WorkflowBuilderV0 {
2434
- private readonly state;
2435
- constructor(state?: WorkflowBuilderV0State);
2436
- static new(): WorkflowBuilderV0;
2437
- private with;
2438
- name(name: string): WorkflowBuilderV0;
2439
- execution(execution: WorkflowSpecV0["execution"]): WorkflowBuilderV0;
2440
- node(node: WorkflowNodeV0): WorkflowBuilderV0;
2441
- llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
2442
- stream?: boolean;
2443
- toolExecution?: ToolExecutionModeV0$1;
2444
- toolLimits?: LLMResponsesToolLimitsV0;
2445
- bindings?: ReadonlyArray<LLMResponsesBindingV0>;
2446
- }): WorkflowBuilderV0;
2447
- joinAll(id: NodeId$1): WorkflowBuilderV0;
2448
- transformJSON(id: NodeId$1, input: Extract<WorkflowNodeV0, {
2449
- type: typeof WorkflowNodeTypes.TransformJSON;
2450
- }>["input"]): WorkflowBuilderV0;
2451
- edge(from: NodeId$1, to: NodeId$1): WorkflowBuilderV0;
2452
- output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV0;
2453
- build(): WorkflowSpecV0;
2454
- }
2455
- declare function workflowV0(): WorkflowBuilderV0;
2456
- type WorkflowBuilderV1State = {
2457
- readonly name?: string;
2458
- readonly execution?: WorkflowSpecV1["execution"];
2459
- readonly nodes: ReadonlyArray<WorkflowNodeV1>;
2460
- readonly edges: ReadonlyArray<WorkflowEdgeV1>;
2461
- readonly outputs: ReadonlyArray<WorkflowOutputRefV1>;
2462
- };
2463
- declare class WorkflowBuilderV1 {
2464
- private readonly state;
2465
- constructor(state?: WorkflowBuilderV1State);
2466
- static new(): WorkflowBuilderV1;
2467
- private with;
2468
- name(name: string): WorkflowBuilderV1;
2469
- execution(execution: WorkflowSpecV1["execution"]): WorkflowBuilderV1;
2470
- node(node: WorkflowNodeV1): WorkflowBuilderV1;
2471
- llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
2472
- stream?: boolean;
2473
- toolExecution?: ToolExecutionModeV1$1;
2474
- toolLimits?: LLMResponsesToolLimitsV1;
2475
- bindings?: ReadonlyArray<LLMResponsesBindingV1>;
2476
- }): WorkflowBuilderV1;
2477
- routeSwitch(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
2478
- stream?: boolean;
2479
- toolExecution?: ToolExecutionModeV1$1;
2480
- toolLimits?: LLMResponsesToolLimitsV1;
2481
- bindings?: ReadonlyArray<LLMResponsesBindingV1>;
2482
- }): WorkflowBuilderV1;
2483
- joinAll(id: NodeId$1): WorkflowBuilderV1;
2484
- joinAny(id: NodeId$1, input?: JoinAnyNodeInputV1): WorkflowBuilderV1;
2485
- joinCollect(id: NodeId$1, input: JoinCollectNodeInputV1): WorkflowBuilderV1;
2486
- transformJSON(id: NodeId$1, input: TransformJSONNodeInputV1): WorkflowBuilderV1;
2487
- mapFanout(id: NodeId$1, input: MapFanoutNodeInputV1): WorkflowBuilderV1;
2488
- edge(from: NodeId$1, to: NodeId$1, when?: ConditionV1$1): WorkflowBuilderV1;
2489
- output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV1;
2490
- build(): WorkflowSpecV1;
2491
- }
2492
- declare function workflowV1(): WorkflowBuilderV1;
2493
- type PendingLLMNode = {
2494
- id: NodeId$1;
2495
- request: WireResponsesRequest;
2496
- stream?: boolean;
2497
- bindings: LLMResponsesBindingV0[];
2498
- toolExecution?: ToolExecutionModeV0$1;
2499
- toolLimits?: LLMResponsesToolLimitsV0;
2500
- };
2501
- /**
2502
- * Ergonomic workflow builder with auto-edge inference from bindings.
2503
- *
2504
- * @example
2505
- * ```typescript
2506
- * const spec = newWorkflow("tier_generation")
2507
- * .addLLMNode("tier_generator", tierReq).stream(true)
2508
- * .addLLMNode("business_summary", summaryReq)
2509
- * .bindFrom("tier_generator", "/output/0/content/0/text")
2510
- * .output("tiers", "tier_generator")
2511
- * .output("summary", "business_summary")
2512
- * .build();
2513
- * ```
2514
- */
2515
- declare class Workflow {
2516
- private _name?;
2517
- private _execution?;
2518
- private readonly _nodes;
2519
- private readonly _edges;
2520
- private readonly _outputs;
2521
- private _pendingNode;
2522
- private constructor();
2523
- /**
2524
- * Create a new workflow builder with the given name.
2525
- */
2526
- static create(name?: string): Workflow;
2527
- /**
2528
- * Set the workflow execution configuration.
2529
- */
2530
- execution(exec: WorkflowSpecV0["execution"]): Workflow;
2531
- /**
2532
- * Add an LLM responses node and return a node builder for configuration.
2533
- */
2534
- addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
2535
- /**
2536
- * Add a join.all node that waits for all incoming edges.
2537
- */
2538
- addJoinAllNode(id: NodeId$1): Workflow;
2539
- /**
2540
- * Add a transform.json node and return a builder for configuration.
2541
- */
2542
- addTransformJSONNode(id: NodeId$1): TransformJSONNodeBuilder;
2543
- /**
2544
- * Add an output reference extracting the full node output.
2545
- */
2546
- output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
2547
- /**
2548
- * Add an output reference extracting text content from an LLM response.
2549
- * This is a convenience method that uses the LLM_TEXT_OUTPUT pointer.
2550
- */
2551
- outputText(name: OutputName$1, from: NodeId$1): Workflow;
2552
- /**
2553
- * Explicitly add an edge between nodes.
2554
- * Note: edges are automatically inferred from bindings, so this is rarely needed.
2555
- */
2556
- edge(from: NodeId$1, to: NodeId$1): Workflow;
2557
- /**
2558
- * Build the workflow specification.
2559
- */
2560
- build(): WorkflowSpecV0;
2561
- /** @internal */
2562
- _getPendingNode(): PendingLLMNode | null;
2563
- /** @internal */
2564
- _addEdge(from: NodeId$1, to: NodeId$1): void;
2565
- /** @internal */
2566
- _addNode(node: WorkflowNodeV0): void;
2567
- private flushPendingNode;
2568
- }
2569
- /**
2570
- * Builder for configuring an LLM responses node.
2571
- */
2572
- declare class LLMNodeBuilder {
2573
- private readonly workflow;
2574
- constructor(workflow: Workflow);
2575
- /**
2576
- * Enable or disable streaming for this node.
2577
- */
2578
- stream(enabled: boolean): LLMNodeBuilder;
2579
- /**
2580
- * Add a binding from another LLM node's text output to this node's user message.
2581
- * This is the most common binding pattern: LLM text → user message with json_string encoding.
2582
- * The edge from the source node is automatically inferred.
2583
- */
2584
- bindTextFrom(from: NodeId$1): LLMNodeBuilder;
2585
- /**
2586
- * Add a binding from another node's output to this node's user message text.
2587
- * Use bindTextFrom for the common case of binding LLM text output.
2588
- * The edge from the source node is automatically inferred.
2589
- */
2590
- bindFrom(from: NodeId$1, pointer?: string): LLMNodeBuilder;
2591
- /**
2592
- * Add a full binding with explicit source/destination pointers and encoding.
2593
- * The edge from the source node is automatically inferred.
2594
- */
2595
- bindFromTo(from: NodeId$1, fromPointer: string | undefined, toPointer: string, encoding?: LLMResponsesBindingEncodingV0): LLMNodeBuilder;
2596
- /**
2597
- * Add a binding that replaces a {{placeholder}} in the prompt text.
2598
- * This is useful when the prompt contains placeholder markers like {{tier_data}}.
2599
- * The edge from the source node is automatically inferred.
2600
- */
2601
- bindToPlaceholder(from: NodeId$1, fromPointer: string | undefined, placeholder: string): LLMNodeBuilder;
2602
- /**
2603
- * Add a binding from an LLM node's text output to a placeholder.
2604
- * This is the most common placeholder binding: LLM text → {{placeholder}}.
2605
- * The edge from the source node is automatically inferred.
2606
- */
2607
- bindTextToPlaceholder(from: NodeId$1, placeholder: string): LLMNodeBuilder;
2608
- /**
2609
- * Set the tool execution mode (server or client).
2610
- */
2611
- toolExecution(mode: ToolExecutionModeV0$1): LLMNodeBuilder;
2612
- /**
2613
- * Set the tool execution limits.
2614
- */
2615
- toolLimits(limits: LLMResponsesToolLimitsV0): LLMNodeBuilder;
2616
- addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
2617
- addJoinAllNode(id: NodeId$1): Workflow;
2618
- addTransformJSONNode(id: NodeId$1): TransformJSONNodeBuilder;
2619
- edge(from: NodeId$1, to: NodeId$1): Workflow;
2620
- output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
2621
- outputText(name: OutputName$1, from: NodeId$1): Workflow;
2622
- execution(exec: WorkflowSpecV0["execution"]): Workflow;
2623
- build(): WorkflowSpecV0;
2624
- }
2625
- /**
2626
- * Builder for configuring a transform.json node.
2627
- */
2628
- declare class TransformJSONNodeBuilder {
2629
- private readonly workflow;
2630
- private readonly id;
2631
- private _object?;
2632
- private _merge?;
2633
- constructor(workflow: Workflow, id: NodeId$1);
2634
- /**
2635
- * Set the object transformation with field mappings.
2636
- */
2637
- object(fields: Record<string, TransformJSONValueV0>): TransformJSONNodeBuilder;
2638
- /**
2639
- * Set the merge transformation with source references.
2640
- */
2641
- merge(items: TransformJSONValueV0[]): TransformJSONNodeBuilder;
2642
- private finalize;
2643
- addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
2644
- addJoinAllNode(id: NodeId$1): Workflow;
2645
- edge(from: NodeId$1, to: NodeId$1): Workflow;
2646
- output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
2647
- execution(exec: WorkflowSpecV0["execution"]): Workflow;
2648
- build(): WorkflowSpecV0;
2649
- }
2650
- /**
2651
- * Create a new ergonomic workflow builder with the given name.
2652
- *
2653
- * @example
2654
- * ```typescript
2655
- * const spec = newWorkflow("my_workflow")
2656
- * .addLLMNode("generator", request).stream(true)
2657
- * .addLLMNode("summarizer", summaryReq)
2658
- * .bindFrom("generator", "/output/0/content/0/text")
2659
- * .output("result", "summarizer")
2660
- * .build();
2661
- * ```
2662
- */
2663
- declare function newWorkflow(name?: string): Workflow;
2664
2193
 
2665
2194
  /**
2666
2195
  * Type-safe JSON pointer construction for LLM request/response paths.
@@ -2791,1407 +2320,78 @@ declare class JoinOutputPath {
2791
2320
  */
2792
2321
  declare function JoinOutput(nodeId: string): JoinOutputPath;
2793
2322
 
2794
- var $id$1 = "https://modelrelay.ai/schemas/workflow_v0.schema.json";
2795
- var $schema$1 = "http://json-schema.org/draft-07/schema#";
2796
- var additionalProperties$1 = false;
2797
- var definitions$1 = {
2798
- edge: {
2799
- additionalProperties: false,
2800
- properties: {
2801
- from: {
2802
- minLength: 1,
2803
- type: "string"
2804
- },
2805
- to: {
2806
- minLength: 1,
2807
- type: "string"
2808
- }
2809
- },
2810
- required: [
2811
- "from",
2812
- "to"
2813
- ],
2814
- type: "object"
2815
- },
2816
- llmResponsesBinding: {
2817
- additionalProperties: false,
2818
- oneOf: [
2819
- {
2820
- required: [
2821
- "to"
2822
- ]
2823
- },
2824
- {
2825
- required: [
2826
- "to_placeholder"
2827
- ]
2828
- }
2829
- ],
2830
- properties: {
2831
- encoding: {
2832
- "enum": [
2833
- "json",
2834
- "json_string"
2835
- ],
2836
- type: "string"
2837
- },
2838
- from: {
2839
- minLength: 1,
2840
- type: "string"
2841
- },
2842
- pointer: {
2843
- pattern: "^(/.*)?$",
2844
- type: "string"
2845
- },
2846
- to: {
2847
- pattern: "^/.*$",
2848
- type: "string"
2849
- },
2850
- to_placeholder: {
2851
- minLength: 1,
2852
- type: "string"
2853
- }
2854
- },
2855
- required: [
2856
- "from"
2857
- ],
2858
- type: "object"
2859
- },
2860
- node: {
2861
- additionalProperties: false,
2862
- oneOf: [
2863
- {
2864
- allOf: [
2865
- {
2866
- properties: {
2867
- input: {
2868
- properties: {
2869
- bindings: {
2870
- items: {
2871
- $ref: "#/definitions/llmResponsesBinding"
2872
- },
2873
- type: "array"
2874
- },
2875
- request: {
2876
- type: "object"
2877
- },
2878
- stream: {
2879
- type: "boolean"
2880
- },
2881
- tool_execution: {
2882
- additionalProperties: false,
2883
- properties: {
2884
- mode: {
2885
- "default": "server",
2886
- "enum": [
2887
- "server",
2888
- "client"
2889
- ],
2890
- type: "string"
2891
- }
2892
- },
2893
- required: [
2894
- "mode"
2895
- ],
2896
- type: "object"
2897
- },
2898
- tool_limits: {
2899
- additionalProperties: false,
2900
- properties: {
2901
- max_llm_calls: {
2902
- "default": 8,
2903
- maximum: 64,
2904
- minimum: 1,
2905
- type: "integer"
2906
- },
2907
- max_tool_calls_per_step: {
2908
- "default": 16,
2909
- maximum: 64,
2910
- minimum: 1,
2911
- type: "integer"
2912
- },
2913
- wait_ttl_ms: {
2914
- "default": 900000,
2915
- maximum: 86400000,
2916
- minimum: 1,
2917
- type: "integer"
2918
- }
2919
- },
2920
- type: "object"
2921
- }
2922
- },
2923
- required: [
2924
- "request"
2925
- ],
2926
- type: "object"
2927
- }
2928
- }
2929
- }
2930
- ],
2931
- properties: {
2932
- type: {
2933
- "const": "llm.responses"
2934
- }
2935
- },
2936
- required: [
2937
- "input"
2938
- ]
2939
- },
2940
- {
2941
- properties: {
2942
- type: {
2943
- "const": "join.all"
2944
- }
2945
- }
2946
- },
2947
- {
2948
- allOf: [
2949
- {
2950
- properties: {
2951
- input: {
2952
- additionalProperties: false,
2953
- oneOf: [
2954
- {
2955
- not: {
2956
- required: [
2957
- "merge"
2958
- ]
2959
- },
2960
- required: [
2961
- "object"
2962
- ]
2963
- },
2964
- {
2965
- not: {
2966
- required: [
2967
- "object"
2968
- ]
2969
- },
2970
- required: [
2971
- "merge"
2972
- ]
2973
- }
2974
- ],
2975
- properties: {
2976
- merge: {
2977
- items: {
2978
- $ref: "#/definitions/transformValue"
2979
- },
2980
- minItems: 1,
2981
- type: "array"
2982
- },
2983
- object: {
2984
- additionalProperties: {
2985
- $ref: "#/definitions/transformValue"
2986
- },
2987
- minProperties: 1,
2988
- type: "object"
2989
- }
2990
- },
2991
- type: "object"
2992
- }
2993
- }
2994
- }
2995
- ],
2996
- properties: {
2997
- type: {
2998
- "const": "transform.json"
2999
- }
3000
- },
3001
- required: [
3002
- "input"
3003
- ]
3004
- }
3005
- ],
3006
- properties: {
3007
- id: {
3008
- minLength: 1,
3009
- type: "string"
3010
- },
3011
- input: {
3012
- },
3013
- type: {
3014
- "enum": [
3015
- "llm.responses",
3016
- "join.all",
3017
- "transform.json"
3018
- ],
3019
- type: "string"
3020
- }
3021
- },
3022
- required: [
3023
- "id",
3024
- "type"
3025
- ],
3026
- type: "object"
3027
- },
3028
- output: {
3029
- additionalProperties: false,
3030
- properties: {
3031
- from: {
3032
- minLength: 1,
3033
- type: "string"
3034
- },
3035
- name: {
3036
- minLength: 1,
3037
- type: "string"
3038
- },
3039
- pointer: {
3040
- pattern: "^(/.*)?$",
3041
- type: "string"
3042
- }
3043
- },
3044
- required: [
3045
- "name",
3046
- "from"
3047
- ],
3048
- type: "object"
3049
- },
3050
- transformValue: {
3051
- additionalProperties: false,
3052
- properties: {
3053
- from: {
3054
- minLength: 1,
3055
- type: "string"
3056
- },
3057
- pointer: {
3058
- pattern: "^(/.*)?$",
3059
- type: "string"
3060
- }
3061
- },
3062
- required: [
3063
- "from"
3064
- ],
3065
- type: "object"
3066
- }
3067
- };
3068
- var properties$1 = {
3069
- edges: {
3070
- items: {
3071
- $ref: "#/definitions/edge"
3072
- },
3073
- type: "array"
3074
- },
3075
- execution: {
3076
- additionalProperties: false,
3077
- properties: {
3078
- max_parallelism: {
3079
- minimum: 1,
3080
- type: "integer"
3081
- },
3082
- node_timeout_ms: {
3083
- minimum: 1,
3084
- type: "integer"
3085
- },
3086
- run_timeout_ms: {
3087
- minimum: 1,
3088
- type: "integer"
3089
- }
3090
- },
3091
- type: "object"
3092
- },
3093
- kind: {
3094
- "const": "workflow.v0",
3095
- type: "string"
3096
- },
3097
- name: {
3098
- type: "string"
3099
- },
3100
- nodes: {
3101
- items: {
3102
- $ref: "#/definitions/node"
3103
- },
3104
- minItems: 1,
3105
- type: "array"
3106
- },
3107
- outputs: {
3108
- items: {
3109
- $ref: "#/definitions/output"
3110
- },
3111
- minItems: 1,
3112
- type: "array"
3113
- }
3114
- };
3115
- var required$1 = [
3116
- "kind",
3117
- "nodes",
3118
- "outputs"
3119
- ];
3120
- var title$1 = "ModelRelay workflow.v0";
3121
- var type$1 = "object";
3122
- var workflow_v0_schema = {
3123
- $id: $id$1,
3124
- $schema: $schema$1,
3125
- additionalProperties: additionalProperties$1,
3126
- definitions: definitions$1,
3127
- properties: properties$1,
3128
- required: required$1,
3129
- title: title$1,
3130
- type: type$1
3131
- };
3132
-
3133
- var $id = "https://modelrelay.ai/schemas/workflow_v1.schema.json";
3134
- var $schema = "http://json-schema.org/draft-07/schema#";
3135
- var additionalProperties = false;
3136
- var definitions = {
3137
- condition: {
3138
- additionalProperties: false,
3139
- properties: {
3140
- op: {
3141
- "enum": [
3142
- "equals",
3143
- "matches",
3144
- "exists"
3145
- ],
3146
- type: "string"
3147
- },
3148
- path: {
3149
- pattern: "^\\$.*$",
3150
- type: "string"
3151
- },
3152
- source: {
3153
- "enum": [
3154
- "node_output",
3155
- "node_status"
3156
- ],
3157
- type: "string"
3158
- },
3159
- value: {
3160
- }
3161
- },
3162
- required: [
3163
- "source",
3164
- "op"
3165
- ],
3166
- type: "object"
3167
- },
3168
- edge: {
3169
- additionalProperties: false,
3170
- properties: {
3171
- from: {
3172
- minLength: 1,
3173
- type: "string"
3174
- },
3175
- to: {
3176
- minLength: 1,
3177
- type: "string"
3178
- },
3179
- when: {
3180
- $ref: "#/definitions/condition"
3181
- }
3182
- },
3183
- required: [
3184
- "from",
3185
- "to"
3186
- ],
3187
- type: "object"
3188
- },
3189
- fragmentBindInput: {
3190
- additionalProperties: false,
3191
- oneOf: [
3192
- {
3193
- required: [
3194
- "from_node"
3195
- ]
3196
- },
3197
- {
3198
- required: [
3199
- "from_input"
3200
- ]
3201
- }
3202
- ],
3203
- properties: {
3204
- from_input: {
3205
- minLength: 1,
3206
- type: "string"
3207
- },
3208
- from_node: {
3209
- minLength: 1,
3210
- type: "string"
3211
- },
3212
- pointer: {
3213
- pattern: "^(/.*)?$",
3214
- type: "string"
3215
- }
3216
- },
3217
- type: "object"
3218
- },
3219
- fragmentDef: {
3220
- additionalProperties: false,
3221
- properties: {
3222
- edges: {
3223
- items: {
3224
- $ref: "#/definitions/edge"
3225
- },
3226
- type: "array"
3227
- },
3228
- inputs: {
3229
- items: {
3230
- $ref: "#/definitions/fragmentInput"
3231
- },
3232
- type: "array"
3233
- },
3234
- nodes: {
3235
- items: {
3236
- $ref: "#/definitions/node"
3237
- },
3238
- minItems: 1,
3239
- type: "array"
3240
- },
3241
- outputs: {
3242
- items: {
3243
- $ref: "#/definitions/fragmentOutput"
3244
- },
3245
- minItems: 1,
3246
- type: "array"
3247
- }
3248
- },
3249
- required: [
3250
- "outputs",
3251
- "nodes"
3252
- ],
3253
- type: "object"
3254
- },
3255
- fragmentInput: {
3256
- additionalProperties: false,
3257
- properties: {
3258
- name: {
3259
- minLength: 1,
3260
- type: "string"
3261
- },
3262
- type: {
3263
- type: "string"
3264
- }
3265
- },
3266
- required: [
3267
- "name"
3268
- ],
3269
- type: "object"
3270
- },
3271
- fragmentOutput: {
3272
- additionalProperties: false,
3273
- properties: {
3274
- from_node: {
3275
- minLength: 1,
3276
- type: "string"
3277
- },
3278
- name: {
3279
- minLength: 1,
3280
- type: "string"
3281
- },
3282
- pointer: {
3283
- pattern: "^(/.*)?$",
3284
- type: "string"
3285
- }
3286
- },
3287
- required: [
3288
- "name",
3289
- "from_node"
3290
- ],
3291
- type: "object"
3292
- },
3293
- llmResponsesBinding: {
3294
- additionalProperties: false,
3295
- oneOf: [
3296
- {
3297
- required: [
3298
- "to"
3299
- ]
3300
- },
3301
- {
3302
- required: [
3303
- "to_placeholder"
3304
- ]
3305
- }
3306
- ],
3307
- properties: {
3308
- encoding: {
3309
- "enum": [
3310
- "json",
3311
- "json_string"
3312
- ],
3313
- type: "string"
3314
- },
3315
- from: {
3316
- minLength: 1,
3317
- type: "string"
3318
- },
3319
- pointer: {
3320
- pattern: "^(/.*)?$",
3321
- type: "string"
3322
- },
3323
- to: {
3324
- pattern: "^/.*$",
3325
- type: "string"
3326
- },
3327
- to_placeholder: {
3328
- minLength: 1,
3329
- type: "string"
3330
- }
3331
- },
3332
- required: [
3333
- "from"
3334
- ],
3335
- type: "object"
3336
- },
3337
- mapFanoutItemBinding: {
3338
- additionalProperties: false,
3339
- oneOf: [
3340
- {
3341
- required: [
3342
- "to"
3343
- ]
3344
- },
3345
- {
3346
- required: [
3347
- "to_placeholder"
3348
- ]
3349
- }
3350
- ],
3351
- properties: {
3352
- encoding: {
3353
- "enum": [
3354
- "json",
3355
- "json_string"
3356
- ],
3357
- type: "string"
3358
- },
3359
- path: {
3360
- pattern: "^(/.*)?$",
3361
- type: "string"
3362
- },
3363
- to: {
3364
- pattern: "^/.*$",
3365
- type: "string"
3366
- },
3367
- to_placeholder: {
3368
- minLength: 1,
3369
- type: "string"
3370
- }
3371
- },
3372
- type: "object"
3373
- },
3374
- node: {
3375
- additionalProperties: false,
3376
- oneOf: [
3377
- {
3378
- allOf: [
3379
- {
3380
- properties: {
3381
- input: {
3382
- properties: {
3383
- bindings: {
3384
- items: {
3385
- $ref: "#/definitions/llmResponsesBinding"
3386
- },
3387
- type: "array"
3388
- },
3389
- request: {
3390
- type: "object"
3391
- },
3392
- stream: {
3393
- type: "boolean"
3394
- },
3395
- tool_execution: {
3396
- additionalProperties: false,
3397
- properties: {
3398
- mode: {
3399
- "default": "server",
3400
- "enum": [
3401
- "server",
3402
- "client"
3403
- ],
3404
- type: "string"
3405
- }
3406
- },
3407
- required: [
3408
- "mode"
3409
- ],
3410
- type: "object"
3411
- },
3412
- tool_limits: {
3413
- additionalProperties: false,
3414
- properties: {
3415
- max_llm_calls: {
3416
- "default": 8,
3417
- maximum: 64,
3418
- minimum: 1,
3419
- type: "integer"
3420
- },
3421
- max_tool_calls_per_step: {
3422
- "default": 16,
3423
- maximum: 64,
3424
- minimum: 1,
3425
- type: "integer"
3426
- },
3427
- wait_ttl_ms: {
3428
- "default": 900000,
3429
- maximum: 86400000,
3430
- minimum: 1,
3431
- type: "integer"
3432
- }
3433
- },
3434
- type: "object"
3435
- }
3436
- },
3437
- required: [
3438
- "request"
3439
- ],
3440
- type: "object"
3441
- }
3442
- }
3443
- }
3444
- ],
3445
- properties: {
3446
- type: {
3447
- "const": "llm.responses"
3448
- }
3449
- },
3450
- required: [
3451
- "input"
3452
- ]
3453
- },
3454
- {
3455
- allOf: [
3456
- {
3457
- properties: {
3458
- input: {
3459
- properties: {
3460
- bindings: {
3461
- items: {
3462
- $ref: "#/definitions/llmResponsesBinding"
3463
- },
3464
- type: "array"
3465
- },
3466
- request: {
3467
- type: "object"
3468
- },
3469
- stream: {
3470
- type: "boolean"
3471
- },
3472
- tool_execution: {
3473
- additionalProperties: false,
3474
- properties: {
3475
- mode: {
3476
- "default": "server",
3477
- "enum": [
3478
- "server",
3479
- "client"
3480
- ],
3481
- type: "string"
3482
- }
3483
- },
3484
- required: [
3485
- "mode"
3486
- ],
3487
- type: "object"
3488
- },
3489
- tool_limits: {
3490
- additionalProperties: false,
3491
- properties: {
3492
- max_llm_calls: {
3493
- "default": 8,
3494
- maximum: 64,
3495
- minimum: 1,
3496
- type: "integer"
3497
- },
3498
- max_tool_calls_per_step: {
3499
- "default": 16,
3500
- maximum: 64,
3501
- minimum: 1,
3502
- type: "integer"
3503
- },
3504
- wait_ttl_ms: {
3505
- "default": 900000,
3506
- maximum: 86400000,
3507
- minimum: 1,
3508
- type: "integer"
3509
- }
3510
- },
3511
- type: "object"
3512
- }
3513
- },
3514
- required: [
3515
- "request"
3516
- ],
3517
- type: "object"
3518
- }
3519
- }
3520
- }
3521
- ],
3522
- properties: {
3523
- type: {
3524
- "const": "route.switch"
3525
- }
3526
- },
3527
- required: [
3528
- "input"
3529
- ]
3530
- },
3531
- {
3532
- properties: {
3533
- type: {
3534
- "const": "join.all"
3535
- }
3536
- }
3537
- },
3538
- {
3539
- allOf: [
3540
- {
3541
- properties: {
3542
- input: {
3543
- additionalProperties: false,
3544
- properties: {
3545
- predicate: {
3546
- $ref: "#/definitions/condition"
3547
- }
3548
- },
3549
- type: "object"
3550
- }
3551
- }
3552
- }
3553
- ],
3554
- properties: {
3555
- type: {
3556
- "const": "join.any"
3557
- }
3558
- }
3559
- },
3560
- {
3561
- allOf: [
3562
- {
3563
- properties: {
3564
- input: {
3565
- additionalProperties: false,
3566
- properties: {
3567
- limit: {
3568
- minimum: 1,
3569
- type: "integer"
3570
- },
3571
- predicate: {
3572
- $ref: "#/definitions/condition"
3573
- },
3574
- timeout_ms: {
3575
- minimum: 1,
3576
- type: "integer"
3577
- }
3578
- },
3579
- type: "object"
3580
- }
3581
- }
3582
- }
3583
- ],
3584
- properties: {
3585
- type: {
3586
- "const": "join.collect"
3587
- }
3588
- },
3589
- required: [
3590
- "input"
3591
- ]
3592
- },
3593
- {
3594
- allOf: [
3595
- {
3596
- properties: {
3597
- input: {
3598
- additionalProperties: false,
3599
- oneOf: [
3600
- {
3601
- not: {
3602
- required: [
3603
- "merge"
3604
- ]
3605
- },
3606
- required: [
3607
- "object"
3608
- ]
3609
- },
3610
- {
3611
- not: {
3612
- required: [
3613
- "object"
3614
- ]
3615
- },
3616
- required: [
3617
- "merge"
3618
- ]
3619
- }
3620
- ],
3621
- properties: {
3622
- merge: {
3623
- items: {
3624
- $ref: "#/definitions/transformValue"
3625
- },
3626
- minItems: 1,
3627
- type: "array"
3628
- },
3629
- object: {
3630
- additionalProperties: {
3631
- $ref: "#/definitions/transformValue"
3632
- },
3633
- minProperties: 1,
3634
- type: "object"
3635
- }
3636
- },
3637
- type: "object"
3638
- }
3639
- }
3640
- }
3641
- ],
3642
- properties: {
3643
- type: {
3644
- "const": "transform.json"
3645
- }
3646
- },
3647
- required: [
3648
- "input"
3649
- ]
3650
- },
3651
- {
3652
- allOf: [
3653
- {
3654
- properties: {
3655
- input: {
3656
- additionalProperties: false,
3657
- properties: {
3658
- item_bindings: {
3659
- items: {
3660
- $ref: "#/definitions/mapFanoutItemBinding"
3661
- },
3662
- type: "array"
3663
- },
3664
- items: {
3665
- additionalProperties: false,
3666
- properties: {
3667
- from: {
3668
- minLength: 1,
3669
- type: "string"
3670
- },
3671
- path: {
3672
- pattern: "^(/.*)?$",
3673
- type: "string"
3674
- },
3675
- pointer: {
3676
- pattern: "^(/.*)?$",
3677
- type: "string"
3678
- }
3679
- },
3680
- required: [
3681
- "from"
3682
- ],
3683
- type: "object"
3684
- },
3685
- max_parallelism: {
3686
- minimum: 1,
3687
- type: "integer"
3688
- },
3689
- subnode: {
3690
- additionalProperties: false,
3691
- properties: {
3692
- id: {
3693
- minLength: 1,
3694
- type: "string"
3695
- },
3696
- input: {
3697
- },
3698
- type: {
3699
- "enum": [
3700
- "llm.responses",
3701
- "route.switch",
3702
- "transform.json"
3703
- ],
3704
- type: "string"
3705
- }
3706
- },
3707
- required: [
3708
- "id",
3709
- "type"
3710
- ],
3711
- type: "object"
3712
- }
3713
- },
3714
- required: [
3715
- "items",
3716
- "subnode"
3717
- ],
3718
- type: "object"
3719
- }
3720
- }
3721
- }
3722
- ],
3723
- properties: {
3724
- type: {
3725
- "const": "map.fanout"
3726
- }
3727
- },
3728
- required: [
3729
- "input"
3730
- ]
3731
- },
3732
- {
3733
- allOf: [
3734
- {
3735
- properties: {
3736
- input: {
3737
- additionalProperties: false,
3738
- properties: {
3739
- bind_inputs: {
3740
- additionalProperties: {
3741
- $ref: "#/definitions/fragmentBindInput"
3742
- },
3743
- type: "object"
3744
- },
3745
- ref: {
3746
- minLength: 1,
3747
- type: "string"
3748
- }
3749
- },
3750
- required: [
3751
- "ref"
3752
- ],
3753
- type: "object"
3754
- }
3755
- }
3756
- }
3757
- ],
3758
- properties: {
3759
- type: {
3760
- "const": "fragment"
3761
- }
3762
- },
3763
- required: [
3764
- "input"
3765
- ]
3766
- }
3767
- ],
3768
- properties: {
3769
- id: {
3770
- minLength: 1,
3771
- type: "string"
3772
- },
3773
- input: {
3774
- },
3775
- type: {
3776
- "enum": [
3777
- "llm.responses",
3778
- "route.switch",
3779
- "join.all",
3780
- "join.any",
3781
- "join.collect",
3782
- "transform.json",
3783
- "map.fanout",
3784
- "fragment"
3785
- ],
3786
- type: "string"
3787
- }
3788
- },
3789
- required: [
3790
- "id",
3791
- "type"
3792
- ],
3793
- type: "object"
3794
- },
3795
- output: {
3796
- additionalProperties: false,
3797
- properties: {
3798
- from: {
3799
- minLength: 1,
3800
- type: "string"
3801
- },
3802
- name: {
3803
- minLength: 1,
3804
- type: "string"
3805
- },
3806
- output: {
3807
- minLength: 1,
3808
- type: "string"
3809
- },
3810
- pointer: {
3811
- pattern: "^(/.*)?$",
3812
- type: "string"
3813
- }
3814
- },
3815
- required: [
3816
- "name",
3817
- "from"
3818
- ],
3819
- type: "object"
3820
- },
3821
- transformValue: {
3822
- additionalProperties: false,
3823
- properties: {
3824
- from: {
3825
- minLength: 1,
3826
- type: "string"
3827
- },
3828
- pointer: {
3829
- pattern: "^(/.*)?$",
3830
- type: "string"
3831
- }
3832
- },
3833
- required: [
3834
- "from"
3835
- ],
3836
- type: "object"
3837
- }
3838
- };
3839
- var properties = {
3840
- edges: {
3841
- items: {
3842
- $ref: "#/definitions/edge"
3843
- },
3844
- type: "array"
3845
- },
3846
- execution: {
3847
- additionalProperties: false,
3848
- properties: {
3849
- max_parallelism: {
3850
- minimum: 1,
3851
- type: "integer"
3852
- },
3853
- node_timeout_ms: {
3854
- minimum: 1,
3855
- type: "integer"
3856
- },
3857
- run_timeout_ms: {
3858
- minimum: 1,
3859
- type: "integer"
3860
- }
3861
- },
3862
- type: "object"
3863
- },
3864
- fragments: {
3865
- additionalProperties: {
3866
- $ref: "#/definitions/fragmentDef"
3867
- },
3868
- type: "object"
3869
- },
3870
- kind: {
3871
- "const": "workflow.v1",
3872
- type: "string"
3873
- },
3874
- name: {
3875
- type: "string"
3876
- },
3877
- nodes: {
3878
- items: {
3879
- $ref: "#/definitions/node"
3880
- },
3881
- minItems: 1,
3882
- type: "array"
3883
- },
3884
- outputs: {
3885
- items: {
3886
- $ref: "#/definitions/output"
3887
- },
3888
- minItems: 1,
3889
- type: "array"
3890
- }
3891
- };
3892
- var required = [
3893
- "kind",
3894
- "nodes",
3895
- "outputs"
3896
- ];
3897
- var title = "ModelRelay workflow.v1";
3898
- var type = "object";
3899
- var workflow_v1_schema = {
3900
- $id: $id,
3901
- $schema: $schema,
3902
- additionalProperties: additionalProperties,
3903
- definitions: definitions,
3904
- properties: properties,
3905
- required: required,
3906
- title: title,
3907
- type: type
2323
+ /** JSON pointer to extract text content from an LLM response output. */
2324
+ declare const LLM_TEXT_OUTPUT: string;
2325
+ /** JSON pointer to inject text into the user message of an LLM request.
2326
+ * The pointer is relative to the request object (not the full node input). */
2327
+ declare const LLM_USER_MESSAGE_TEXT: string;
2328
+ type TransformJSONValueV1 = {
2329
+ from: NodeId$1;
2330
+ pointer?: string;
3908
2331
  };
3909
-
3910
- declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
3911
- type WorkflowsCompileRequestV0 = WorkflowSpecV0;
3912
- type WorkflowsCompileRequestV1 = WorkflowSpecV1;
3913
-
3914
- /**
3915
- * High-level workflow pattern helpers for common workflow structures.
3916
- *
3917
- * These helpers reduce boilerplate for common patterns like sequential chains,
3918
- * parallel execution with aggregation, and map-reduce processing.
3919
- *
3920
- * All builders are immutable - each method returns a new builder instance.
3921
- *
3922
- * @example
3923
- * ```typescript
3924
- * import { Chain, Parallel, MapReduce, LLMStep, MapItem } from 'modelrelay';
3925
- *
3926
- * // Chain pattern - sequential steps
3927
- * const chainSpec = Chain('summarize-translate', [
3928
- * LLMStep('summarize', summarizeReq),
3929
- * LLMStep('translate', translateReq).withStream(),
3930
- * ])
3931
- * .outputLast('result')
3932
- * .build();
3933
- *
3934
- * // Parallel pattern - concurrent steps with aggregation
3935
- * const parallelSpec = Parallel('multi-model', [
3936
- * LLMStep('gpt4', gpt4Req),
3937
- * LLMStep('claude', claudeReq),
3938
- * ])
3939
- * .aggregate('synthesize', synthesizeReq)
3940
- * .output('result', 'synthesize')
3941
- * .build();
3942
- *
3943
- * // MapReduce pattern - parallel mappers with reducer
3944
- * const mapReduceSpec = MapReduce('process-docs', [
3945
- * MapItem('doc1', doc1Req),
3946
- * MapItem('doc2', doc2Req),
3947
- * ])
3948
- * .reduce('combine', combineReq)
3949
- * .output('result', 'combine')
3950
- * .build();
3951
- * ```
3952
- */
3953
-
3954
- /**
3955
- * Configuration for an LLM step in a workflow pattern.
3956
- */
3957
- type LLMStepConfig = {
3958
- readonly id: NodeId$1;
3959
- readonly request: WireResponsesRequest;
3960
- readonly stream: boolean;
2332
+ declare function transformJSONValue(from: NodeId$1, pointer?: string): TransformJSONValueV1;
2333
+ declare function transformJSONObject(object: Record<string, TransformJSONValueV1>): {
2334
+ object: Record<string, TransformJSONValueV1>;
3961
2335
  };
3962
- /**
3963
- * Creates an LLM step configuration for use with Chain or Parallel patterns.
3964
- *
3965
- * @param id - Unique node identifier
3966
- * @param request - The LLM request configuration
3967
- * @returns A step configuration object with fluent methods
3968
- *
3969
- * @example
3970
- * ```typescript
3971
- * const step = LLMStep('summarize', {
3972
- * model: 'claude-sonnet-4-20250514',
3973
- * input: [{ type: 'message', role: 'user', content: [{ type: 'text', text: 'Summarize...' }] }],
3974
- * });
3975
- *
3976
- * // Enable streaming
3977
- * const streamingStep = step.withStream();
3978
- * ```
3979
- */
3980
- declare function LLMStep(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): LLMStepConfig & {
3981
- withStream(): LLMStepConfig;
2336
+ declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV1>): {
2337
+ merge: Array<TransformJSONValueV1>;
3982
2338
  };
3983
2339
  /**
3984
- * Immutable builder for sequential workflow where each step's output feeds into the next.
2340
+ * Error thrown when a binding targets a non-existent path in the request.
3985
2341
  */
3986
- declare class ChainBuilder {
3987
- private readonly state;
3988
- private constructor();
3989
- static create(name: string, steps: readonly LLMStepConfig[]): ChainBuilder;
3990
- private with;
3991
- /**
3992
- * Sets the workflow execution configuration.
3993
- */
3994
- execution(exec: WorkflowSpecV0["execution"]): ChainBuilder;
3995
- /**
3996
- * Adds an output reference from a specific step.
3997
- */
3998
- output(name: OutputName$1 | string, from: NodeId$1 | string): ChainBuilder;
3999
- /**
4000
- * Adds an output reference from the last step.
4001
- */
4002
- outputLast(name: OutputName$1 | string): ChainBuilder;
4003
- /**
4004
- * Builds and returns the compiled workflow spec.
4005
- * @throws Error if no steps are provided
4006
- */
4007
- build(): WorkflowSpecV0;
2342
+ declare class BindingTargetError extends Error {
2343
+ readonly nodeId: NodeId$1;
2344
+ readonly bindingIndex: number;
2345
+ readonly pointer: string;
2346
+ constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
4008
2347
  }
4009
2348
  /**
4010
- * Creates a workflow builder for sequential LLM steps.
4011
- * Each step after the first automatically binds its input from the previous step's text output.
4012
- *
4013
- * @param name - Workflow name
4014
- * @param steps - Array of LLMStep configurations
4015
- * @returns A ChainBuilder for further configuration
4016
- *
4017
- * @example
4018
- * ```typescript
4019
- * const spec = Chain('summarize-translate', [
4020
- * LLMStep('summarize', summarizeReq),
4021
- * LLMStep('translate', translateReq).withStream(),
4022
- * LLMStep('format', formatReq),
4023
- * ])
4024
- * .outputLast('result')
4025
- * .build();
4026
- * ```
4027
- */
4028
- declare function Chain(name: string, steps: readonly LLMStepConfig[]): ChainBuilder;
4029
- /**
4030
- * Immutable builder for workflow where multiple LLM steps execute in parallel,
4031
- * with optional aggregation.
2349
+ * Error thrown when a map.fanout node input is invalid.
4032
2350
  */
4033
- declare class ParallelBuilder {
4034
- private readonly state;
4035
- private constructor();
4036
- static create(name: string, steps: readonly LLMStepConfig[]): ParallelBuilder;
4037
- private with;
4038
- /**
4039
- * Sets the workflow execution configuration.
4040
- */
4041
- execution(exec: WorkflowSpecV0["execution"]): ParallelBuilder;
4042
- /**
4043
- * Adds a join node that waits for all parallel steps,
4044
- * followed by an aggregator LLM node that receives the combined output.
4045
- * The join node ID is automatically generated as "<id>_join".
4046
- */
4047
- aggregate(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): ParallelBuilder;
4048
- /**
4049
- * Like aggregate() but enables streaming on the aggregator node.
4050
- */
4051
- aggregateWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): ParallelBuilder;
4052
- /**
4053
- * Adds an output reference from a specific step.
4054
- */
4055
- output(name: OutputName$1 | string, from: NodeId$1 | string): ParallelBuilder;
4056
- /**
4057
- * Builds and returns the compiled workflow spec.
4058
- * @throws Error if no steps are provided
4059
- */
4060
- build(): WorkflowSpecV0;
2351
+ declare class MapFanoutInputError extends Error {
2352
+ readonly nodeId: NodeId$1;
2353
+ constructor(nodeId: NodeId$1, message: string);
4061
2354
  }
4062
- /**
4063
- * Creates a workflow builder for parallel LLM steps.
4064
- * All steps execute concurrently with no dependencies between them.
4065
- *
4066
- * @param name - Workflow name
4067
- * @param steps - Array of LLMStep configurations
4068
- * @returns A ParallelBuilder for further configuration
4069
- *
4070
- * @example
4071
- * ```typescript
4072
- * // Without aggregation - just parallel execution
4073
- * const spec = Parallel('multi-model', [
4074
- * LLMStep('gpt4', gpt4Req),
4075
- * LLMStep('claude', claudeReq),
4076
- * ])
4077
- * .output('gpt4_result', 'gpt4')
4078
- * .output('claude_result', 'claude')
4079
- * .build();
4080
- *
4081
- * // With aggregation - parallel then combine
4082
- * const spec = Parallel('multi-model', [
4083
- * LLMStep('gpt4', gpt4Req),
4084
- * LLMStep('claude', claudeReq),
4085
- * ])
4086
- * .aggregate('synthesize', synthesizeReq)
4087
- * .output('result', 'synthesize')
4088
- * .build();
4089
- * ```
4090
- */
4091
- declare function Parallel(name: string, steps: readonly LLMStepConfig[]): ParallelBuilder;
4092
- /**
4093
- * Configuration for a map item in MapReduce.
4094
- */
4095
- type MapItemConfig = {
4096
- readonly id: string;
4097
- readonly request: WireResponsesRequest;
4098
- readonly stream: boolean;
4099
- };
4100
- /**
4101
- * Creates a map item configuration for use with MapReduce pattern.
4102
- * Each item becomes a separate mapper node that runs in parallel.
4103
- *
4104
- * @param id - Unique identifier for this item (becomes part of node ID: "map_<id>")
4105
- * @param request - The LLM request for processing this item
4106
- * @returns A map item configuration object with fluent methods
4107
- *
4108
- * @example
4109
- * ```typescript
4110
- * const item = MapItem('doc1', {
4111
- * model: 'claude-sonnet-4-20250514',
4112
- * input: [{ type: 'message', role: 'user', content: [{ type: 'text', text: 'Summarize doc1...' }] }],
4113
- * });
4114
- *
4115
- * // Enable streaming
4116
- * const streamingItem = item.withStream();
4117
- * ```
4118
- */
4119
- declare function MapItem(id: string, request: WireResponsesRequest | ResponsesRequest): MapItemConfig & {
4120
- withStream(): MapItemConfig;
2355
+ type WorkflowBuilderV1State = {
2356
+ readonly name?: string;
2357
+ readonly execution?: WorkflowSpecV1["execution"];
2358
+ readonly nodes: ReadonlyArray<WorkflowNodeV1>;
2359
+ readonly edges: ReadonlyArray<WorkflowEdgeV1>;
2360
+ readonly outputs: ReadonlyArray<WorkflowOutputRefV1>;
4121
2361
  };
4122
- /**
4123
- * Immutable builder for workflow where items are processed in parallel by mapper nodes,
4124
- * then combined by a reducer node.
4125
- *
4126
- * The pattern creates:
4127
- * - N mapper nodes (one per item), running in parallel
4128
- * - A join.all node to collect all mapper outputs
4129
- * - A reducer LLM node that receives the combined outputs
4130
- *
4131
- * Note: Items must be known at workflow build time. For dynamic array
4132
- * processing at runtime, server-side support for dynamic node instantiation
4133
- * would be required.
4134
- */
4135
- declare class MapReduceBuilder {
2362
+ declare class WorkflowBuilderV1 {
4136
2363
  private readonly state;
4137
- private constructor();
4138
- static create(name: string, items: readonly MapItemConfig[]): MapReduceBuilder;
2364
+ constructor(state?: WorkflowBuilderV1State);
2365
+ static new(): WorkflowBuilderV1;
4139
2366
  private with;
4140
- /**
4141
- * Adds a mapper item to the workflow.
4142
- * Each item becomes a separate LLM node that runs in parallel.
4143
- */
4144
- item(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
4145
- /**
4146
- * Adds a mapper item with streaming enabled.
4147
- */
4148
- itemWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
4149
- /**
4150
- * Sets the workflow execution configuration.
4151
- */
4152
- execution(exec: WorkflowSpecV0["execution"]): MapReduceBuilder;
4153
- /**
4154
- * Adds a reducer node that receives all mapper outputs.
4155
- * The reducer receives a JSON object mapping each mapper ID to its text output.
4156
- * The join node ID is automatically generated as "<id>_join".
4157
- */
4158
- reduce(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
4159
- /**
4160
- * Like reduce() but enables streaming on the reducer node.
4161
- */
4162
- reduceWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
4163
- /**
4164
- * Adds an output reference from a specific node.
4165
- * Typically used to output from the reducer node.
4166
- */
4167
- output(name: OutputName$1 | string, from: NodeId$1 | string): MapReduceBuilder;
4168
- /**
4169
- * Builds and returns the compiled workflow spec.
4170
- * @throws Error if no items are provided or no reducer is configured
4171
- */
4172
- build(): WorkflowSpecV0;
2367
+ name(name: string): WorkflowBuilderV1;
2368
+ execution(execution: WorkflowSpecV1["execution"]): WorkflowBuilderV1;
2369
+ node(node: WorkflowNodeV1): WorkflowBuilderV1;
2370
+ llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
2371
+ stream?: boolean;
2372
+ toolExecution?: ToolExecutionModeV1$1;
2373
+ toolLimits?: LLMResponsesToolLimitsV1;
2374
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
2375
+ }): WorkflowBuilderV1;
2376
+ routeSwitch(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
2377
+ stream?: boolean;
2378
+ toolExecution?: ToolExecutionModeV1$1;
2379
+ toolLimits?: LLMResponsesToolLimitsV1;
2380
+ bindings?: ReadonlyArray<LLMResponsesBindingV1>;
2381
+ }): WorkflowBuilderV1;
2382
+ joinAll(id: NodeId$1): WorkflowBuilderV1;
2383
+ joinAny(id: NodeId$1, input?: JoinAnyNodeInputV1): WorkflowBuilderV1;
2384
+ joinCollect(id: NodeId$1, input: JoinCollectNodeInputV1): WorkflowBuilderV1;
2385
+ transformJSON(id: NodeId$1, input: TransformJSONNodeInputV1): WorkflowBuilderV1;
2386
+ mapFanout(id: NodeId$1, input: MapFanoutNodeInputV1): WorkflowBuilderV1;
2387
+ edge(from: NodeId$1, to: NodeId$1, when?: ConditionV1$1): WorkflowBuilderV1;
2388
+ output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV1;
2389
+ build(): WorkflowSpecV1;
4173
2390
  }
4174
- /**
4175
- * Creates a workflow builder for parallel map-reduce processing.
4176
- * Each item is processed by a separate mapper node, and results are combined
4177
- * by a reducer node.
4178
- *
4179
- * @param name - Workflow name
4180
- * @param items - Optional array of MapItem configurations (can also use .item() builder)
4181
- * @returns A MapReduceBuilder for further configuration
4182
- *
4183
- * @example
4184
- * ```typescript
4185
- * // Fluent builder pattern (preferred)
4186
- * const spec = mapReduce('summarize-docs')
4187
- * .item('doc1', doc1Req)
4188
- * .item('doc2', doc2Req)
4189
- * .reduce('combine', combineReq)
4190
- * .output(parseOutputName('result'), 'combine')
4191
- * .build();
4192
- * ```
4193
- */
4194
- declare function MapReduce(name: string, items?: readonly MapItemConfig[]): MapReduceBuilder;
2391
+ declare function workflowV1(): WorkflowBuilderV1;
2392
+
2393
+ declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
2394
+ type WorkflowsCompileRequestV1 = WorkflowSpecV1;
4195
2395
 
4196
2396
  type NDJSONDelayStep = {
4197
2397
  delayMs: number;
@@ -4210,9 +2410,7 @@ declare function createMockFetchQueue(responses: MockFetchResponder[]): {
4210
2410
  };
4211
2411
 
4212
2412
  declare function parseApiKey(raw: string): ApiKey;
4213
- declare function parsePublishableKey(raw: string): PublishableKey;
4214
2413
  declare function parseSecretKey(raw: string): SecretKey;
4215
- declare function isPublishableKey(key: ApiKey): key is PublishableKey;
4216
2414
  declare function isSecretKey(key: ApiKey): key is SecretKey;
4217
2415
 
4218
2416
  /**
@@ -4747,9 +2945,9 @@ declare class FanoutReduceV1 {
4747
2945
  * ```typescript
4748
2946
  * import { workflow } from "@modelrelay/sdk";
4749
2947
  *
4750
- * const spec: workflow.SpecV0 = {
4751
- * kind: workflow.KindV0,
4752
- * nodes: [{ id: "my_node", type: workflow.NodeTypes.LLMResponses, input: {...} }],
2948
+ * const spec: workflow.SpecV1 = {
2949
+ * kind: workflow.KindV1,
2950
+ * nodes: [{ id: "my_node", type: workflow.NodeTypesV1.LLMResponses, input: {...} }],
4753
2951
  * outputs: [],
4754
2952
  * };
4755
2953
  * ```
@@ -4761,23 +2959,14 @@ type RunId = RunId$1;
4761
2959
  type PlanHash = PlanHash$1;
4762
2960
 
4763
2961
  type Kind = WorkflowKind;
4764
- type SpecV0 = WorkflowSpecV0;
4765
2962
  type SpecV1 = WorkflowSpecV1;
4766
- type NodeV0 = WorkflowNodeV0;
4767
2963
  type NodeV1 = WorkflowNodeV1;
4768
- type EdgeV0 = WorkflowEdgeV0;
4769
2964
  type EdgeV1 = WorkflowEdgeV1;
4770
- type OutputRefV0 = WorkflowOutputRefV0;
4771
2965
  type OutputRefV1 = WorkflowOutputRefV1;
4772
- type BindingV0 = LLMResponsesBindingV0;
4773
2966
  type BindingV1 = LLMResponsesBindingV1;
4774
- type BindingEncodingV0 = LLMResponsesBindingEncodingV0;
4775
2967
  type BindingEncodingV1 = LLMResponsesBindingEncodingV1;
4776
- type ToolLimitsV0 = LLMResponsesToolLimitsV0;
4777
2968
  type ToolLimitsV1 = LLMResponsesToolLimitsV1;
4778
- type ToolExecutionV0 = ToolExecutionV0$1;
4779
2969
  type ToolExecutionV1 = ToolExecutionV1$1;
4780
- type ToolExecutionModeV0 = ToolExecutionModeV0$1;
4781
2970
  type ToolExecutionModeV1 = ToolExecutionModeV1$1;
4782
2971
  type ConditionV1 = ConditionV1$1;
4783
2972
  type ConditionOpV1 = ConditionOpV1$1;
@@ -4811,14 +3000,7 @@ type FunctionToolCallV0 = FunctionToolCallV0$1;
4811
3000
  type TokenUsageV0 = TokenUsageV0$1;
4812
3001
  type PayloadInfoV0 = PayloadInfoV0$1;
4813
3002
  type StreamEventKind = StreamEventKind$1;
4814
- declare const KindV0: "workflow.v0";
4815
3003
  declare const KindV1: "workflow.v1";
4816
- declare const NodeTypes: {
4817
- readonly LLMResponses: "llm.responses";
4818
- readonly JoinAll: "join.all";
4819
- readonly TransformJSON: "transform.json";
4820
- };
4821
- type NodeType = (typeof NodeTypes)[keyof typeof NodeTypes];
4822
3004
  declare const NodeTypesV1: {
4823
3005
  readonly LLMResponses: "llm.responses";
4824
3006
  readonly RouteSwitch: "route.switch";
@@ -4840,16 +3022,13 @@ declare const ToolExecutionModes: {
4840
3022
 
4841
3023
  type index_BindingBuilder = BindingBuilder;
4842
3024
  declare const index_BindingBuilder: typeof BindingBuilder;
4843
- type index_BindingEncodingV0 = BindingEncodingV0;
4844
3025
  type index_BindingEncodingV1 = BindingEncodingV1;
4845
3026
  declare const index_BindingEncodings: typeof BindingEncodings;
4846
3027
  type index_BindingOptions = BindingOptions;
4847
- type index_BindingV0 = BindingV0;
4848
3028
  type index_BindingV1 = BindingV1;
4849
3029
  type index_ConditionOpV1 = ConditionOpV1;
4850
3030
  type index_ConditionSourceV1 = ConditionSourceV1;
4851
3031
  type index_ConditionV1 = ConditionV1;
4852
- type index_EdgeV0 = EdgeV0;
4853
3032
  type index_EdgeV1 = EdgeV1;
4854
3033
  type index_EventBaseV0 = EventBaseV0;
4855
3034
  type index_EventNodeFailedV0 = EventNodeFailedV0;
@@ -4873,7 +3052,6 @@ type index_FanoutReduceV1 = FanoutReduceV1;
4873
3052
  declare const index_FanoutReduceV1: typeof FanoutReduceV1;
4874
3053
  type index_FunctionToolCallV0 = FunctionToolCallV0;
4875
3054
  type index_Kind = Kind;
4876
- declare const index_KindV0: typeof KindV0;
4877
3055
  declare const index_KindV1: typeof KindV1;
4878
3056
  declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
4879
3057
  declare const index_LLM_USER_MESSAGE_TEXT: typeof LLM_USER_MESSAGE_TEXT;
@@ -4883,15 +3061,11 @@ type index_NodeLLMCallV0 = NodeLLMCallV0;
4883
3061
  type index_NodeOutputDeltaV0 = NodeOutputDeltaV0;
4884
3062
  type index_NodeToolCallV0 = NodeToolCallV0;
4885
3063
  type index_NodeToolResultV0 = NodeToolResultV0;
4886
- type index_NodeType = NodeType;
4887
3064
  type index_NodeTypeV1 = NodeTypeV1;
4888
- declare const index_NodeTypes: typeof NodeTypes;
4889
3065
  declare const index_NodeTypesV1: typeof NodeTypesV1;
4890
- type index_NodeV0 = NodeV0;
4891
3066
  type index_NodeV1 = NodeV1;
4892
3067
  type index_NodeWaitingV0 = NodeWaitingV0;
4893
3068
  type index_OutputName = OutputName;
4894
- type index_OutputRefV0 = OutputRefV0;
4895
3069
  type index_OutputRefV1 = OutputRefV1;
4896
3070
  type index_PayloadInfoV0 = PayloadInfoV0;
4897
3071
  type index_PendingToolCallV0 = PendingToolCallV0;
@@ -4901,18 +3075,16 @@ type index_RouterRouteV1 = RouterRouteV1;
4901
3075
  type index_RouterV1 = RouterV1;
4902
3076
  declare const index_RouterV1: typeof RouterV1;
4903
3077
  type index_RunId = RunId;
4904
- type index_SpecV0 = SpecV0;
4905
3078
  type index_SpecV1 = SpecV1;
4906
3079
  type index_StatusV0 = StatusV0;
4907
3080
  type index_StreamEventKind = StreamEventKind;
4908
3081
  type index_TokenUsageV0 = TokenUsageV0;
4909
- type index_ToolExecutionModeV0 = ToolExecutionModeV0;
4910
3082
  type index_ToolExecutionModeV1 = ToolExecutionModeV1;
4911
3083
  declare const index_ToolExecutionModes: typeof ToolExecutionModes;
4912
- type index_ToolExecutionV0 = ToolExecutionV0;
4913
3084
  type index_ToolExecutionV1 = ToolExecutionV1;
4914
- type index_ToolLimitsV0 = ToolLimitsV0;
4915
3085
  type index_ToolLimitsV1 = ToolLimitsV1;
3086
+ type index_WorkflowBuilderV1 = WorkflowBuilderV1;
3087
+ declare const index_WorkflowBuilderV1: typeof WorkflowBuilderV1;
4916
3088
  declare const index_bindFrom: typeof bindFrom;
4917
3089
  declare const index_bindToPlaceholder: typeof bindToPlaceholder;
4918
3090
  declare const index_bindToPointer: typeof bindToPointer;
@@ -4926,8 +3098,9 @@ declare const index_whenOutputMatches: typeof whenOutputMatches;
4926
3098
  declare const index_whenStatusEquals: typeof whenStatusEquals;
4927
3099
  declare const index_whenStatusExists: typeof whenStatusExists;
4928
3100
  declare const index_whenStatusMatches: typeof whenStatusMatches;
3101
+ declare const index_workflowV1: typeof workflowV1;
4929
3102
  declare namespace index {
4930
- 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 };
3103
+ export { index_BindingBuilder as BindingBuilder, type index_BindingEncodingV1 as BindingEncodingV1, index_BindingEncodings as BindingEncodings, type index_BindingOptions as BindingOptions, type index_BindingV1 as BindingV1, type index_ConditionOpV1 as ConditionOpV1, type index_ConditionSourceV1 as ConditionSourceV1, type index_ConditionV1 as ConditionV1, 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_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_NodeTypeV1 as NodeTypeV1, index_NodeTypesV1 as NodeTypesV1, type index_NodeV1 as NodeV1, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, 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_SpecV1 as SpecV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolExecutionModeV1 as ToolExecutionModeV1, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV1 as ToolExecutionV1, type index_ToolLimitsV1 as ToolLimitsV1, index_WorkflowBuilderV1 as WorkflowBuilderV1, 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, index_workflowV1 as workflowV1 };
4931
3104
  }
4932
3105
 
4933
3106
  /**
@@ -4976,10 +3149,9 @@ declare class ModelRelay {
4976
3149
  /** @internal HTTP client for internal use by session sync */
4977
3150
  readonly http: HTTPClient;
4978
3151
  static fromSecretKey(secretKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
4979
- static fromPublishableKey(publishableKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
4980
3152
  static fromApiKey(apiKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
4981
3153
  constructor(options: ModelRelayOptions);
4982
3154
  forCustomer(customerId: string): CustomerScopedModelRelay;
4983
3155
  }
4984
3156
 
4985
- export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, BindingTargetError, Chain, ChainBuilder, ConfigError, CustomerResponsesClient, CustomerScopedModelRelay, CustomerToken, CustomerTokenProvider, CustomerTokenRequest, type ErrorCategory, type ErrorCode, ErrorCodes, FieldError, FrontendCustomer, FrontendToken, FrontendTokenAutoProvisionRequest, FrontendTokenProvider, FrontendTokenRequest, type HandleWaitingResult, type ImageData, type ImagePinResponse, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, InputItem, type JSONPointer, JoinOutput, JoinOutputPath, 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, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MapFanoutInputError, MapItem, type MapItemConfig, MapReduce, MapReduceBuilder, MemorySessionStore, MetricsCallbacks, type MockFetchCall, type MockFetchResponder, ModelId, ModelRelay, ModelRelayError, ModelRelayKeyOptions, ModelRelayOptions, type NDJSONDelayStep, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, OIDCExchangeRequest, OIDCExchangeTokenProvider, OutputFormat, type OutputName$1 as OutputName, Parallel, ParallelBuilder, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PriceInterval, ProviderId, PublishableKey, type RemoteSessionInfo, type RemoteSessionOptions, RequestContext, Response$1 as Response, ResponseEvent, ResponsesClient, ResponsesStream, RetryConfig, type RetryHandler, RetryMetadata, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, 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, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, StructuredJSONEvent, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Tier, type TierCheckoutRequest, type TierCheckoutSession, TierCode, type TierModel, TiersClient, TokenProvider, Tool, ToolArgumentError, ToolChoice, ToolExecutionResult, ToolRegistry, ToolRunner, type ToolRunnerOptions, TraceCallbacks, TransformJSONNodeBuilder, type TransformJSONValueV0, type TransformJSONValueV1, TransportError, TransportErrorKind, type ValidationIssue, WORKFLOWS_COMPILE_PATH, 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, ZodLikeSchema, asSessionId, buildDelayedNDJSONResponse, buildNDJSONResponse, createAccessTokenAuth, createApiKeyAuth, createLocalSession, createMemorySessionStore, createMockFetchQueue, createToolRunner, defaultRetryHandler, defaultTierModelId, generateSessionId, index$1 as generated, isAutoProvisionDisabled, isAutoProvisionMisconfigured, isEmailRequired, isIdentityRequired, isProvisioningError, isPublishableKey, isSecretKey, newWorkflow, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parsePublishableKey, parseRunId, parseSecretKey, transformJSONMerge, transformJSONMergeV1, transformJSONObject, transformJSONObjectV1, transformJSONValue, transformJSONValueV1, validateWithZod, index as workflow, workflowV0, workflow_v0_schema as workflowV0Schema, workflowV1, workflow_v1_schema as workflowV1Schema };
3157
+ export { APIError, ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, BindingTargetError, ConfigError, CustomerResponsesClient, CustomerScopedModelRelay, CustomerToken, CustomerTokenProvider, CustomerTokenRequest, type ErrorCategory, type ErrorCode, ErrorCodes, FieldError, GetOrCreateCustomerTokenRequest, type HandleWaitingResult, type ImageData, type ImagePinResponse, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, InputItem, type JSONPointer, JoinOutput, JoinOutputPath, LLMInput, LLMInputContentItemPath, LLMInputFirstMessageText, LLMInputMessagePath, LLMInputPath, LLMInputSystemText, LLMInputUserText, LLMOutput, LLMOutputContentItemPath, LLMOutputContentPath, LLMOutputPath, LLMOutputText, LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT, type ListSessionsOptions, type ListSessionsResponse, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MapFanoutInputError, MemorySessionStore, MetricsCallbacks, type MockFetchCall, type MockFetchResponder, ModelId, ModelRelay, ModelRelayError, ModelRelayKeyOptions, ModelRelayOptions, type NDJSONDelayStep, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, OutputFormat, type OutputName$1 as OutputName, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PriceInterval, ProviderId, type RemoteSessionInfo, type RemoteSessionOptions, RequestContext, Response$1 as Response, ResponseEvent, ResponsesClient, ResponsesStream, RetryConfig, type RetryHandler, RetryMetadata, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, 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, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, StructuredJSONEvent, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Tier, type TierCheckoutRequest, type TierCheckoutSession, TierCode, type TierModel, TiersClient, TokenProvider, Tool, ToolArgumentError, ToolChoice, ToolExecutionResult, ToolRegistry, ToolRunner, type ToolRunnerOptions, TraceCallbacks, type TransformJSONValueV1, TransportError, TransportErrorKind, type ValidationIssue, WORKFLOWS_COMPILE_PATH, WorkflowBuilderV1, type WorkflowBuilderV1State, type WorkflowKind, WorkflowKinds, WorkflowNodeTypesV1 as WorkflowNodeTypes, WorkflowNodeTypesV1, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequestV1, type WorkflowsCompileResponseV1, type WorkflowsCompileV1Result, ZodLikeSchema, asSessionId, buildDelayedNDJSONResponse, buildNDJSONResponse, createAccessTokenAuth, createApiKeyAuth, createLocalSession, createMemorySessionStore, createMockFetchQueue, createToolRunner, defaultRetryHandler, defaultTierModelId, generateSessionId, index$1 as generated, isSecretKey, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parseRunId, parseSecretKey, transformJSONMerge, transformJSONObject, transformJSONValue, validateWithZod, index as workflow, workflowV1 };