@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.js CHANGED
@@ -48,11 +48,6 @@ import {
48
48
  getRetryableErrors,
49
49
  hasRetryableErrors,
50
50
  hasToolCalls,
51
- isAutoProvisionDisabled,
52
- isAutoProvisionMisconfigured,
53
- isEmailRequired,
54
- isIdentityRequired,
55
- isProvisioningError,
56
51
  mergeMetrics,
57
52
  mergeTrace,
58
53
  modelToString,
@@ -69,39 +64,27 @@ import {
69
64
  toolResultMessage,
70
65
  tryParseToolArgs,
71
66
  zodToJsonSchema
72
- } from "./chunk-CYGWZYYJ.js";
67
+ } from "./chunk-AZD5EKLV.js";
73
68
  import {
74
69
  __export
75
70
  } from "./chunk-MLKGABMK.js";
76
71
 
77
72
  // src/api_keys.ts
78
- var PUBLISHABLE_PREFIX = "mr_pk_";
79
73
  var SECRET_PREFIX = "mr_sk_";
80
74
  function keyKindHint(raw) {
81
75
  const value = raw?.trim?.() ? raw.trim() : "";
82
- if (value.startsWith(PUBLISHABLE_PREFIX)) return "publishable";
83
76
  if (value.startsWith(SECRET_PREFIX)) return "secret";
84
77
  return "unknown";
85
78
  }
86
79
  function parseApiKey(raw) {
87
80
  const value = raw?.trim?.() ? raw.trim() : "";
88
- if (value.startsWith(PUBLISHABLE_PREFIX) && value.length > PUBLISHABLE_PREFIX.length) {
89
- return value;
90
- }
91
81
  if (value.startsWith(SECRET_PREFIX) && value.length > SECRET_PREFIX.length) {
92
82
  return value;
93
83
  }
94
- throw new ConfigError("Invalid API key format (expected mr_pk_* or mr_sk_*)", {
84
+ throw new ConfigError("Invalid API key format (expected mr_sk_*)", {
95
85
  keyKind: keyKindHint(raw)
96
86
  });
97
87
  }
98
- function parsePublishableKey(raw) {
99
- const key = parseApiKey(raw);
100
- if (!isPublishableKey(key)) {
101
- throw new ConfigError("Publishable key required (expected mr_pk_*)", { keyKind: keyKindHint(raw) });
102
- }
103
- return key;
104
- }
105
88
  function parseSecretKey(raw) {
106
89
  const key = parseApiKey(raw);
107
90
  if (!isSecretKey(key)) {
@@ -109,9 +92,6 @@ function parseSecretKey(raw) {
109
92
  }
110
93
  return key;
111
94
  }
112
- function isPublishableKey(key) {
113
- return key.startsWith(PUBLISHABLE_PREFIX);
114
- }
115
95
  function isSecretKey(key) {
116
96
  return key.startsWith(SECRET_PREFIX);
117
97
  }
@@ -125,102 +105,15 @@ function createAccessTokenAuth(accessToken) {
125
105
  }
126
106
  var AuthClient = class {
127
107
  constructor(http, cfg) {
128
- this.cachedFrontend = /* @__PURE__ */ new Map();
129
108
  this.http = http;
130
109
  this.apiKey = cfg.apiKey ? parseApiKey(cfg.apiKey) : void 0;
131
- this.apiKeyIsPublishable = this.apiKey ? isPublishableKey(this.apiKey) : false;
132
110
  this.accessToken = cfg.accessToken;
133
- this.customer = cfg.customer;
134
111
  this.tokenProvider = cfg.tokenProvider;
135
112
  }
136
- /**
137
- * Exchange a publishable key for a short-lived frontend token for an existing customer.
138
- * Tokens are cached until they are close to expiry.
139
- *
140
- * Use this method when the customer already exists in the system.
141
- * For auto-provisioning new customers, use frontendTokenAutoProvision instead.
142
- */
143
- async frontendToken(request) {
144
- if (!request.publishableKey?.trim()) {
145
- throw new ConfigError("publishableKey is required");
146
- }
147
- if (!request.identityProvider?.trim()) {
148
- throw new ConfigError("identityProvider is required");
149
- }
150
- if (!request.identitySubject?.trim()) {
151
- throw new ConfigError("identitySubject is required");
152
- }
153
- return this.sendFrontendTokenRequest(request);
154
- }
155
- /**
156
- * Exchange a publishable key for a frontend token, creating the customer if needed.
157
- * The customer will be auto-provisioned on the project's free tier.
158
- * Tokens are cached until they are close to expiry.
159
- *
160
- * Use this method when the customer may not exist and should be created automatically.
161
- * The email is required for auto-provisioning.
162
- */
163
- async frontendTokenAutoProvision(request) {
164
- if (!request.publishableKey?.trim()) {
165
- throw new ConfigError("publishableKey is required");
166
- }
167
- if (!request.identityProvider?.trim()) {
168
- throw new ConfigError("identityProvider is required");
169
- }
170
- if (!request.identitySubject?.trim()) {
171
- throw new ConfigError("identitySubject is required");
172
- }
173
- if (!request.email?.trim()) {
174
- throw new ConfigError("email is required for auto-provisioning");
175
- }
176
- return this.sendFrontendTokenRequest(request);
177
- }
178
- /**
179
- * Internal method to send frontend token requests.
180
- */
181
- async sendFrontendTokenRequest(request) {
182
- const { publishableKey, identityProvider, identitySubject, deviceId, ttlSeconds } = request;
183
- const email = "email" in request ? request.email : void 0;
184
- const cacheKey = `${publishableKey}:${identityProvider}:${identitySubject}:${deviceId || ""}`;
185
- const cached = this.cachedFrontend.get(cacheKey);
186
- if (cached && isTokenReusable(cached)) {
187
- return cached;
188
- }
189
- const payload = {
190
- publishable_key: publishableKey,
191
- identity_provider: identityProvider,
192
- identity_subject: identitySubject
193
- };
194
- if (deviceId) {
195
- payload.device_id = deviceId;
196
- }
197
- if (typeof ttlSeconds === "number" && ttlSeconds > 0) {
198
- payload.ttl_seconds = ttlSeconds;
199
- }
200
- if (email) {
201
- payload.email = email;
202
- }
203
- const response = await this.http.json(
204
- "/auth/frontend-token",
205
- {
206
- method: "POST",
207
- body: payload
208
- }
209
- );
210
- const token = normalizeFrontendToken(response, {
211
- publishableKey,
212
- deviceId,
213
- identityProvider,
214
- identitySubject
215
- });
216
- this.cachedFrontend.set(cacheKey, token);
217
- return token;
218
- }
219
113
  /**
220
114
  * Determine the correct auth headers for /responses.
221
- * Publishable keys are automatically exchanged for frontend tokens.
222
115
  */
223
- async authForResponses(overrides) {
116
+ async authForResponses() {
224
117
  if (this.accessToken) {
225
118
  return createAccessTokenAuth(this.accessToken);
226
119
  }
@@ -234,32 +127,6 @@ var AuthClient = class {
234
127
  if (!this.apiKey) {
235
128
  throw new ConfigError("API key or token is required");
236
129
  }
237
- if (this.apiKeyIsPublishable) {
238
- const publishableKey = this.apiKey;
239
- const identityProvider = overrides?.provider || this.customer?.provider;
240
- const identitySubject = overrides?.subject || this.customer?.subject;
241
- const deviceId = overrides?.deviceId || this.customer?.deviceId;
242
- const ttlSeconds = overrides?.ttlSeconds ?? this.customer?.ttlSeconds;
243
- const email = overrides?.email || this.customer?.email;
244
- if (!identityProvider || !identitySubject) {
245
- throw new ConfigError("identity provider + subject are required to mint a frontend token");
246
- }
247
- const token = email ? await this.frontendTokenAutoProvision({
248
- publishableKey,
249
- identityProvider,
250
- identitySubject,
251
- email,
252
- deviceId,
253
- ttlSeconds
254
- }) : await this.frontendToken({
255
- publishableKey,
256
- identityProvider,
257
- identitySubject,
258
- deviceId,
259
- ttlSeconds
260
- });
261
- return createAccessTokenAuth(token.token);
262
- }
263
130
  return createApiKeyAuth(this.apiKey);
264
131
  }
265
132
  /**
@@ -274,7 +141,7 @@ var AuthClient = class {
274
141
  if (request.ttlSeconds !== void 0 && request.ttlSeconds < 0) {
275
142
  throw new ConfigError("ttlSeconds must be non-negative when provided");
276
143
  }
277
- if (!this.apiKey || this.apiKeyIsPublishable) {
144
+ if (!this.apiKey) {
278
145
  throw new ConfigError("Secret API key is required to mint customer tokens");
279
146
  }
280
147
  const payload = {};
@@ -299,44 +166,54 @@ var AuthClient = class {
299
166
  tokenType: apiResp.token_type,
300
167
  projectId: apiResp.project_id,
301
168
  customerId: apiResp.customer_id,
169
+ billingProfileId: apiResp.billing_profile_id,
302
170
  customerExternalId: apiResp.customer_external_id,
303
171
  tierCode: apiResp.tier_code ? asTierCode(apiResp.tier_code) : void 0
304
172
  };
305
173
  }
306
174
  /**
307
- * Verify an OIDC id_token and exchange it for a customer bearer token.
175
+ * Get or create a customer and mint a bearer token.
176
+ *
177
+ * This is a convenience method that:
178
+ * 1. Upserts the customer (creates if not exists)
179
+ * 2. Mints a customer-scoped bearer token
180
+ *
181
+ * Use this when you want to ensure the customer exists before minting a token,
182
+ * without needing to handle 404 errors from customerToken().
183
+ *
184
+ * Requires a secret key.
308
185
  */
309
- async oidcExchange(request) {
310
- const idToken = request.idToken?.trim();
311
- if (!idToken) {
312
- throw new ConfigError("idToken is required");
186
+ async getOrCreateCustomerToken(request) {
187
+ const externalId = request.externalId?.trim();
188
+ const email = request.email?.trim();
189
+ if (!externalId) {
190
+ throw new ConfigError("externalId is required");
191
+ }
192
+ if (!email) {
193
+ throw new ConfigError("email is required");
313
194
  }
314
195
  if (!this.apiKey) {
315
- throw new ConfigError("API key is required for OIDC exchange");
196
+ throw new ConfigError("Secret API key is required to get or create customer tokens");
316
197
  }
317
- const payload = { id_token: idToken };
318
- const projectId = request.projectId?.trim();
319
- if (projectId) {
320
- payload.project_id = projectId;
198
+ const upsertPayload = {
199
+ external_id: externalId,
200
+ email
201
+ };
202
+ if (request.metadata) {
203
+ upsertPayload.metadata = request.metadata;
321
204
  }
322
- const apiResp = await this.http.json("/auth/oidc/exchange", {
323
- method: "POST",
324
- body: payload,
205
+ await this.http.json("/customers", {
206
+ method: "PUT",
207
+ body: upsertPayload,
325
208
  apiKey: this.apiKey
326
209
  });
327
- return {
328
- token: apiResp.token,
329
- expiresAt: new Date(apiResp.expires_at),
330
- expiresIn: apiResp.expires_in,
331
- tokenType: apiResp.token_type,
332
- projectId: apiResp.project_id,
333
- customerId: apiResp.customer_id,
334
- customerExternalId: apiResp.customer_external_id,
335
- tierCode: apiResp.tier_code ? asTierCode(apiResp.tier_code) : void 0
336
- };
210
+ return this.customerToken({
211
+ customerExternalId: externalId,
212
+ ttlSeconds: request.ttlSeconds
213
+ });
337
214
  }
338
215
  /**
339
- * Billing calls accept either bearer tokens or API keys (including publishable keys).
216
+ * Billing calls accept either bearer tokens or API keys.
340
217
  */
341
218
  authForBilling() {
342
219
  if (this.accessToken) {
@@ -348,30 +225,6 @@ var AuthClient = class {
348
225
  return createApiKeyAuth(this.apiKey);
349
226
  }
350
227
  };
351
- function normalizeFrontendToken(payload, meta) {
352
- return {
353
- token: payload.token,
354
- expiresAt: new Date(payload.expires_at),
355
- expiresIn: payload.expires_in,
356
- tokenType: payload.token_type,
357
- keyId: payload.key_id,
358
- sessionId: payload.session_id,
359
- projectId: payload.project_id,
360
- customerId: payload.customer_id,
361
- customerExternalId: payload.customer_external_id,
362
- tierCode: payload.tier_code,
363
- publishableKey: meta.publishableKey,
364
- deviceId: meta.deviceId,
365
- identityProvider: meta.identityProvider,
366
- identitySubject: meta.identitySubject
367
- };
368
- }
369
- function isTokenReusable(token) {
370
- if (!token.token) {
371
- return false;
372
- }
373
- return token.expiresAt.getTime() - Date.now() > 6e4;
374
- }
375
228
 
376
229
  // src/structured.ts
377
230
  var StructuredDecodeError = class extends Error {
@@ -1428,7 +1281,7 @@ var ResponsesClient = class {
1428
1281
  * import { z } from 'zod';
1429
1282
  *
1430
1283
  * const review = await client.responses.object({
1431
- * model: 'claude-sonnet-4-20250514',
1284
+ * model: 'claude-sonnet-4-5',
1432
1285
  * schema: z.object({
1433
1286
  * vulnerabilities: z.array(z.string()),
1434
1287
  * riskLevel: z.enum(['low', 'medium', 'high']),
@@ -1485,7 +1338,7 @@ var ResponsesClient = class {
1485
1338
  * @example
1486
1339
  * ```typescript
1487
1340
  * const result = await client.responses.objectWithMetadata({
1488
- * model: 'claude-sonnet-4-20250514',
1341
+ * model: 'claude-sonnet-4-5',
1489
1342
  * schema: ReviewSchema,
1490
1343
  * prompt: 'Review this code...',
1491
1344
  * });
@@ -1894,7 +1747,6 @@ var ResponsesClient = class {
1894
1747
 
1895
1748
  // src/runs_request.ts
1896
1749
  var RUNS_PATH = "/runs";
1897
- var WORKFLOW_V0_SCHEMA_PATH = "/schemas/workflow_v0.schema.json";
1898
1750
  var RUN_EVENT_V0_SCHEMA_PATH = "/schemas/run_event_v0.schema.json";
1899
1751
  function runByIdPath(runId) {
1900
1752
  return `${RUNS_PATH}/${encodeURIComponent(runId)}`;
@@ -1952,14 +1804,8 @@ function parseOutputName(raw) {
1952
1804
 
1953
1805
  // src/runs_types.ts
1954
1806
  var WorkflowKinds = {
1955
- WorkflowV0: "workflow.v0",
1956
1807
  WorkflowV1: "workflow.v1"
1957
1808
  };
1958
- var WorkflowNodeTypes = {
1959
- LLMResponses: "llm.responses",
1960
- JoinAll: "join.all",
1961
- TransformJSON: "transform.json"
1962
- };
1963
1809
  var WorkflowNodeTypesV1 = {
1964
1810
  LLMResponses: "llm.responses",
1965
1811
  RouteSwitch: "route.switch",
@@ -2348,22 +2194,6 @@ var RunsClient = class {
2348
2194
  });
2349
2195
  return { ...out, run_id: parseRunId(out.run_id), plan_hash: parsePlanHash(out.plan_hash) };
2350
2196
  }
2351
- async schemaV0(options = {}) {
2352
- const metrics = mergeMetrics(this.metrics, options.metrics);
2353
- const trace = mergeTrace(this.trace, options.trace);
2354
- return this.http.json(WORKFLOW_V0_SCHEMA_PATH, {
2355
- method: "GET",
2356
- headers: options.headers,
2357
- signal: options.signal,
2358
- timeoutMs: options.timeoutMs,
2359
- connectTimeoutMs: options.connectTimeoutMs,
2360
- retry: options.retry,
2361
- metrics,
2362
- trace,
2363
- context: { method: "GET", path: WORKFLOW_V0_SCHEMA_PATH },
2364
- accept: "application/schema+json"
2365
- });
2366
- }
2367
2197
  async runEventSchemaV0(options = {}) {
2368
2198
  const metrics = mergeMetrics(this.metrics, options.metrics);
2369
2199
  const trace = mergeTrace(this.trace, options.trace);
@@ -2538,65 +2368,6 @@ var WorkflowsClient = class {
2538
2368
  this.metrics = cfg.metrics;
2539
2369
  this.trace = cfg.trace;
2540
2370
  }
2541
- async compileV0(spec, options = {}) {
2542
- const metrics = mergeMetrics(this.metrics, options.metrics);
2543
- const trace = mergeTrace(this.trace, options.trace);
2544
- const authHeaders = await this.auth.authForResponses();
2545
- const headers = { ...options.headers || {} };
2546
- const customerId = options.customerId?.trim();
2547
- if (customerId) {
2548
- headers[CUSTOMER_ID_HEADER] = customerId;
2549
- }
2550
- try {
2551
- const out = await this.http.json(
2552
- WORKFLOWS_COMPILE_PATH,
2553
- {
2554
- method: "POST",
2555
- headers,
2556
- body: spec,
2557
- signal: options.signal,
2558
- apiKey: authHeaders.apiKey,
2559
- accessToken: authHeaders.accessToken,
2560
- timeoutMs: options.timeoutMs,
2561
- connectTimeoutMs: options.connectTimeoutMs,
2562
- retry: options.retry,
2563
- metrics,
2564
- trace,
2565
- context: { method: "POST", path: WORKFLOWS_COMPILE_PATH }
2566
- }
2567
- );
2568
- return {
2569
- ok: true,
2570
- plan_json: out.plan_json,
2571
- plan_hash: parsePlanHash(out.plan_hash)
2572
- };
2573
- } catch (err) {
2574
- if (err instanceof WorkflowValidationError) {
2575
- return { ok: false, error_type: "validation_error", issues: err.issues };
2576
- }
2577
- if (err instanceof APIError) {
2578
- return {
2579
- ok: false,
2580
- error_type: "internal_error",
2581
- status: err.status ?? 0,
2582
- message: err.message,
2583
- code: err.code,
2584
- requestId: err.requestId
2585
- };
2586
- }
2587
- if (err instanceof ModelRelayError && err.category === "api") {
2588
- return {
2589
- ok: false,
2590
- error_type: "internal_error",
2591
- status: err.status ?? 0,
2592
- message: err.message,
2593
- code: err.code,
2594
- requestId: err.requestId
2595
- };
2596
- }
2597
- throw err;
2598
- }
2599
- }
2600
2371
  async compileV1(spec, options = {}) {
2601
2372
  const metrics = mergeMetrics(this.metrics, options.metrics);
2602
2373
  const trace = mergeTrace(this.trace, options.trace);
@@ -3102,7 +2873,7 @@ var LocalSession = class _LocalSession {
3102
2873
  const input = await this.buildInput(options);
3103
2874
  const tools = mergeTools(this.defaultTools, options.tools);
3104
2875
  const spec = {
3105
- kind: "workflow.v0",
2876
+ kind: "workflow.v1",
3106
2877
  name: `session-${this.id}-turn-${this.nextSeq}`,
3107
2878
  nodes: [
3108
2879
  {
@@ -3415,21 +3186,34 @@ function mergeTools(defaults, overrides) {
3415
3186
  }
3416
3187
  return Array.from(merged.values());
3417
3188
  }
3189
+ function isOutputMessage(item) {
3190
+ return typeof item === "object" && item !== null && "type" in item && typeof item.type === "string";
3191
+ }
3192
+ function isContentPiece(c) {
3193
+ return typeof c === "object" && c !== null && "type" in c && typeof c.type === "string";
3194
+ }
3195
+ function hasOutputArray(obj) {
3196
+ return "output" in obj && Array.isArray(obj.output);
3197
+ }
3198
+ function hasContentArray(obj) {
3199
+ return "content" in obj && Array.isArray(obj.content);
3200
+ }
3418
3201
  function extractTextOutput(outputs) {
3419
3202
  const result = outputs.result;
3420
3203
  if (typeof result === "string") return result;
3421
3204
  if (result && typeof result === "object") {
3422
- const resp = result;
3423
- if (Array.isArray(resp.output)) {
3424
- const textParts = resp.output.filter((item) => item?.type === "message" && item?.role === "assistant").flatMap(
3425
- (item) => (item.content || []).filter((c) => c?.type === "text").map((c) => c.text)
3426
- );
3205
+ if (hasOutputArray(result)) {
3206
+ const textParts = result.output.filter(
3207
+ (item) => isOutputMessage(item) && item.type === "message" && item.role === "assistant"
3208
+ ).flatMap(
3209
+ (item) => (item.content || []).filter((c) => isContentPiece(c) && c.type === "text").map((c) => c.text ?? "")
3210
+ ).filter((text) => text.length > 0);
3427
3211
  if (textParts.length > 0) {
3428
3212
  return textParts.join("\n");
3429
3213
  }
3430
3214
  }
3431
- if (Array.isArray(resp.content)) {
3432
- const textParts = resp.content.filter((c) => c?.type === "text").map((c) => c.text);
3215
+ if (hasContentArray(result)) {
3216
+ const textParts = result.content.filter((c) => isContentPiece(c) && c.type === "text").map((c) => c.text ?? "").filter((text) => text.length > 0);
3433
3217
  if (textParts.length > 0) {
3434
3218
  return textParts.join("\n");
3435
3219
  }
@@ -3461,7 +3245,7 @@ var RemoteSession = class _RemoteSession {
3461
3245
  this.http = http;
3462
3246
  this.id = asSessionId(sessionData.id);
3463
3247
  this.metadata = sessionData.metadata;
3464
- this.endUserId = sessionData.end_user_id || options.endUserId;
3248
+ this.customerId = sessionData.customer_id || options.customerId;
3465
3249
  this.createdAt = new Date(sessionData.created_at);
3466
3250
  this.updatedAt = new Date(sessionData.updated_at);
3467
3251
  this.toolRegistry = options.toolRegistry;
@@ -3493,7 +3277,7 @@ var RemoteSession = class _RemoteSession {
3493
3277
  const response = await http.request("/sessions", {
3494
3278
  method: "POST",
3495
3279
  body: {
3496
- end_user_id: options.endUserId,
3280
+ customer_id: options.customerId,
3497
3281
  metadata: options.metadata || {}
3498
3282
  }
3499
3283
  });
@@ -3529,7 +3313,7 @@ var RemoteSession = class _RemoteSession {
3529
3313
  const params = new URLSearchParams();
3530
3314
  if (options.limit) params.set("limit", String(options.limit));
3531
3315
  if (options.offset) params.set("offset", String(options.offset));
3532
- if (options.endUserId) params.set("end_user_id", options.endUserId);
3316
+ if (options.customerId) params.set("customer_id", options.customerId);
3533
3317
  const response = await http.request(
3534
3318
  `/sessions${params.toString() ? `?${params.toString()}` : ""}`,
3535
3319
  { method: "GET" }
@@ -3582,7 +3366,7 @@ var RemoteSession = class _RemoteSession {
3582
3366
  const input = await this.buildInput(options);
3583
3367
  const tools = mergeTools2(this.defaultTools, options.tools);
3584
3368
  const spec = {
3585
- kind: "workflow.v0",
3369
+ kind: "workflow.v1",
3586
3370
  name: `session-${this.id}-turn-${this.nextSeq}`,
3587
3371
  nodes: [
3588
3372
  {
@@ -3602,7 +3386,7 @@ var RemoteSession = class _RemoteSession {
3602
3386
  outputs: [{ name: "result", from: "main" }]
3603
3387
  };
3604
3388
  const run = await this.client.runs.create(spec, {
3605
- customerId: options.customerId || this.endUserId,
3389
+ customerId: options.customerId || this.customerId,
3606
3390
  sessionId: String(this.id)
3607
3391
  });
3608
3392
  this.currentRunId = run.run_id;
@@ -4064,7 +3848,7 @@ var SessionsClient = class {
4064
3848
  /**
4065
3849
  * List remote sessions.
4066
3850
  *
4067
- * @param options - List options (limit, cursor, endUserId)
3851
+ * @param options - List options (limit, cursor, customerId)
4068
3852
  * @returns Paginated list of session summaries
4069
3853
  *
4070
3854
  * @example
@@ -4079,13 +3863,13 @@ var SessionsClient = class {
4079
3863
  return RemoteSession.list(this.modelRelay, {
4080
3864
  limit: options.limit,
4081
3865
  offset: options.cursor ? parseInt(options.cursor, 10) : void 0,
4082
- endUserId: options.endUserId
3866
+ customerId: options.customerId
4083
3867
  });
4084
3868
  }
4085
3869
  /**
4086
3870
  * Delete a remote session.
4087
3871
  *
4088
- * Requires a secret key (not publishable key).
3872
+ * Requires a secret key.
4089
3873
  *
4090
3874
  * @param sessionId - ID of the session to delete
4091
3875
  *
@@ -4111,11 +3895,12 @@ var TiersClient = class {
4111
3895
  this.http = http;
4112
3896
  this.apiKey = cfg.apiKey ? parseApiKey(cfg.apiKey) : void 0;
4113
3897
  this.hasSecretKey = this.apiKey ? isSecretKey(this.apiKey) : false;
3898
+ this.hasAccessToken = !!cfg.accessToken?.trim();
4114
3899
  }
4115
- ensureApiKey() {
4116
- if (!this.apiKey) {
3900
+ ensureAuth() {
3901
+ if (!this.apiKey && !this.hasAccessToken) {
4117
3902
  throw new ConfigError(
4118
- "API key (mr_pk_* or mr_sk_*) required for tier operations"
3903
+ "API key (mr_sk_*) or bearer token required for tier operations"
4119
3904
  );
4120
3905
  }
4121
3906
  }
@@ -4130,7 +3915,7 @@ var TiersClient = class {
4130
3915
  * List all tiers in the project.
4131
3916
  */
4132
3917
  async list() {
4133
- this.ensureApiKey();
3918
+ this.ensureAuth();
4134
3919
  const response = await this.http.json("/tiers", {
4135
3920
  method: "GET",
4136
3921
  apiKey: this.apiKey
@@ -4141,7 +3926,7 @@ var TiersClient = class {
4141
3926
  * Get a tier by ID.
4142
3927
  */
4143
3928
  async get(tierId) {
4144
- this.ensureApiKey();
3929
+ this.ensureAuth();
4145
3930
  if (!tierId?.trim()) {
4146
3931
  throw new ConfigError("tierId is required");
4147
3932
  }
@@ -4156,8 +3941,8 @@ var TiersClient = class {
4156
3941
  *
4157
3942
  * This enables users to subscribe before authenticating. Stripe collects
4158
3943
  * the customer's email during checkout. After checkout completes, a
4159
- * customer record is created with the email from Stripe. The customer
4160
- * can later be linked to an identity via POST /customers/claim.
3944
+ * customer record is created with the email from Stripe. Your backend
3945
+ * can map it to your app user and mint customer tokens as needed.
4161
3946
  *
4162
3947
  * Requires a secret key (mr_sk_*).
4163
3948
  *
@@ -4600,47 +4385,6 @@ function isReusable(token) {
4600
4385
  }
4601
4386
  return token.expiresAt.getTime() - Date.now() > 6e4;
4602
4387
  }
4603
- var FrontendTokenProvider = class {
4604
- constructor(cfg) {
4605
- const publishableKey = parsePublishableKey(cfg.publishableKey);
4606
- const http = new HTTPClient({
4607
- baseUrl: cfg.baseUrl || DEFAULT_BASE_URL,
4608
- fetchImpl: cfg.fetch,
4609
- clientHeader: cfg.clientHeader || DEFAULT_CLIENT_HEADER,
4610
- apiKey: publishableKey
4611
- });
4612
- this.publishableKey = publishableKey;
4613
- this.customer = cfg.customer;
4614
- this.auth = new AuthClient(http, { apiKey: publishableKey, customer: cfg.customer });
4615
- }
4616
- async getToken() {
4617
- if (!this.customer?.provider || !this.customer?.subject) {
4618
- throw new ConfigError("customer.provider and customer.subject are required");
4619
- }
4620
- const reqBase = {
4621
- publishableKey: this.publishableKey,
4622
- identityProvider: this.customer.provider,
4623
- identitySubject: this.customer.subject,
4624
- deviceId: this.customer.deviceId,
4625
- ttlSeconds: this.customer.ttlSeconds
4626
- };
4627
- let token;
4628
- if (this.customer.email) {
4629
- const req = {
4630
- ...reqBase,
4631
- email: this.customer.email
4632
- };
4633
- token = await this.auth.frontendTokenAutoProvision(req);
4634
- } else {
4635
- const req = reqBase;
4636
- token = await this.auth.frontendToken(req);
4637
- }
4638
- if (!token.token) {
4639
- throw new ConfigError("frontend token exchange returned an empty token");
4640
- }
4641
- return token.token;
4642
- }
4643
- };
4644
4388
  var CustomerTokenProvider = class {
4645
4389
  constructor(cfg) {
4646
4390
  const key = parseSecretKey(cfg.secretKey);
@@ -4662,32 +4406,6 @@ var CustomerTokenProvider = class {
4662
4406
  return token.token;
4663
4407
  }
4664
4408
  };
4665
- var OIDCExchangeTokenProvider = class {
4666
- constructor(cfg) {
4667
- const apiKey = parseApiKey(cfg.apiKey);
4668
- const http = new HTTPClient({
4669
- baseUrl: cfg.baseUrl || DEFAULT_BASE_URL,
4670
- fetchImpl: cfg.fetch,
4671
- clientHeader: cfg.clientHeader || DEFAULT_CLIENT_HEADER,
4672
- apiKey
4673
- });
4674
- this.auth = new AuthClient(http, { apiKey });
4675
- this.idTokenProvider = cfg.idTokenProvider;
4676
- this.request = { idToken: "", projectId: cfg.projectId };
4677
- }
4678
- async getToken() {
4679
- if (this.cached && isReusable(this.cached)) {
4680
- return this.cached.token;
4681
- }
4682
- const idToken = (await this.idTokenProvider())?.trim();
4683
- if (!idToken) {
4684
- throw new ConfigError("idTokenProvider returned an empty id_token");
4685
- }
4686
- const token = await this.auth.oidcExchange({ ...this.request, idToken });
4687
- this.cached = token;
4688
- return token.token;
4689
- }
4690
- };
4691
4409
 
4692
4410
  // src/json_path.ts
4693
4411
  var LLMOutputPath = class {
@@ -4825,9 +4543,6 @@ function transformJSONObject(object) {
4825
4543
  function transformJSONMerge(merge) {
4826
4544
  return { merge: merge.slice() };
4827
4545
  }
4828
- var transformJSONValueV1 = transformJSONValue;
4829
- var transformJSONObjectV1 = transformJSONObject;
4830
- var transformJSONMergeV1 = transformJSONMerge;
4831
4546
  function wireRequest(req) {
4832
4547
  const raw = req;
4833
4548
  if (raw && typeof raw === "object") {
@@ -4932,15 +4647,15 @@ function validateMapFanoutInput(nodeId, input) {
4932
4647
  }
4933
4648
  }
4934
4649
  }
4935
- var WorkflowBuilderV0 = class _WorkflowBuilderV0 {
4650
+ var WorkflowBuilderV1 = class _WorkflowBuilderV1 {
4936
4651
  constructor(state = { nodes: [], edges: [], outputs: [] }) {
4937
4652
  this.state = state;
4938
4653
  }
4939
4654
  static new() {
4940
- return new _WorkflowBuilderV0();
4655
+ return new _WorkflowBuilderV1();
4941
4656
  }
4942
4657
  with(patch) {
4943
- return new _WorkflowBuilderV0({
4658
+ return new _WorkflowBuilderV1({
4944
4659
  ...this.state,
4945
4660
  ...patch
4946
4661
  });
@@ -4968,18 +4683,52 @@ var WorkflowBuilderV0 = class _WorkflowBuilderV0 {
4968
4683
  };
4969
4684
  return this.node({
4970
4685
  id,
4971
- type: WorkflowNodeTypes.LLMResponses,
4686
+ type: WorkflowNodeTypesV1.LLMResponses,
4687
+ input
4688
+ });
4689
+ }
4690
+ routeSwitch(id, request, options = {}) {
4691
+ const wiredRequest = wireRequest(request);
4692
+ if (options.bindings) {
4693
+ validateBindingTargets(id, wiredRequest.input, options.bindings);
4694
+ }
4695
+ const input = {
4696
+ request: wiredRequest,
4697
+ ...options.stream === void 0 ? {} : { stream: options.stream },
4698
+ ...options.toolExecution === void 0 ? {} : { tool_execution: { mode: options.toolExecution } },
4699
+ ...options.toolLimits === void 0 ? {} : { tool_limits: { ...options.toolLimits } },
4700
+ ...options.bindings === void 0 ? {} : { bindings: options.bindings.slice() }
4701
+ };
4702
+ return this.node({
4703
+ id,
4704
+ type: WorkflowNodeTypesV1.RouteSwitch,
4972
4705
  input
4973
4706
  });
4974
4707
  }
4975
4708
  joinAll(id) {
4976
- return this.node({ id, type: WorkflowNodeTypes.JoinAll });
4709
+ return this.node({ id, type: WorkflowNodeTypesV1.JoinAll });
4710
+ }
4711
+ joinAny(id, input) {
4712
+ return this.node({
4713
+ id,
4714
+ type: WorkflowNodeTypesV1.JoinAny,
4715
+ ...input ? { input } : {}
4716
+ });
4717
+ }
4718
+ joinCollect(id, input) {
4719
+ return this.node({ id, type: WorkflowNodeTypesV1.JoinCollect, input });
4977
4720
  }
4978
4721
  transformJSON(id, input) {
4979
- return this.node({ id, type: WorkflowNodeTypes.TransformJSON, input });
4722
+ return this.node({ id, type: WorkflowNodeTypesV1.TransformJSON, input });
4723
+ }
4724
+ mapFanout(id, input) {
4725
+ validateMapFanoutInput(id, input);
4726
+ return this.node({ id, type: WorkflowNodeTypesV1.MapFanout, input });
4980
4727
  }
4981
- edge(from, to) {
4982
- return this.with({ edges: [...this.state.edges, { from, to }] });
4728
+ edge(from, to, when) {
4729
+ return this.with({
4730
+ edges: [...this.state.edges, { from, to, ...when ? { when } : {} }]
4731
+ });
4983
4732
  }
4984
4733
  output(name, from, pointer) {
4985
4734
  return this.with({
@@ -4999,6 +4748,10 @@ var WorkflowBuilderV0 = class _WorkflowBuilderV0 {
4999
4748
  const bt = String(b.to);
5000
4749
  if (at < bt) return -1;
5001
4750
  if (at > bt) return 1;
4751
+ const aw = a.when ? JSON.stringify(a.when) : "";
4752
+ const bw = b.when ? JSON.stringify(b.when) : "";
4753
+ if (aw < bw) return -1;
4754
+ if (aw > bw) return 1;
5002
4755
  return 0;
5003
4756
  });
5004
4757
  const outputs = this.state.outputs.slice().sort((a, b) => {
@@ -5017,7 +4770,7 @@ var WorkflowBuilderV0 = class _WorkflowBuilderV0 {
5017
4770
  return 0;
5018
4771
  });
5019
4772
  return {
5020
- kind: WorkflowKinds.WorkflowV0,
4773
+ kind: WorkflowKinds.WorkflowV1,
5021
4774
  ...this.state.name ? { name: this.state.name } : {},
5022
4775
  ...this.state.execution ? { execution: this.state.execution } : {},
5023
4776
  nodes: this.state.nodes.slice(),
@@ -5026,1997 +4779,8 @@ var WorkflowBuilderV0 = class _WorkflowBuilderV0 {
5026
4779
  };
5027
4780
  }
5028
4781
  };
5029
- function workflowV0() {
5030
- return WorkflowBuilderV0.new();
5031
- }
5032
- var WorkflowBuilderV1 = class _WorkflowBuilderV1 {
5033
- constructor(state = { nodes: [], edges: [], outputs: [] }) {
5034
- this.state = state;
5035
- }
5036
- static new() {
5037
- return new _WorkflowBuilderV1();
5038
- }
5039
- with(patch) {
5040
- return new _WorkflowBuilderV1({
5041
- ...this.state,
5042
- ...patch
5043
- });
5044
- }
5045
- name(name) {
5046
- return this.with({ name: name.trim() || void 0 });
5047
- }
5048
- execution(execution) {
5049
- return this.with({ execution });
5050
- }
5051
- node(node) {
5052
- return this.with({ nodes: [...this.state.nodes, node] });
5053
- }
5054
- llmResponses(id, request, options = {}) {
5055
- const wiredRequest = wireRequest(request);
5056
- if (options.bindings) {
5057
- validateBindingTargets(id, wiredRequest.input, options.bindings);
5058
- }
5059
- const input = {
5060
- request: wiredRequest,
5061
- ...options.stream === void 0 ? {} : { stream: options.stream },
5062
- ...options.toolExecution === void 0 ? {} : { tool_execution: { mode: options.toolExecution } },
5063
- ...options.toolLimits === void 0 ? {} : { tool_limits: { ...options.toolLimits } },
5064
- ...options.bindings === void 0 ? {} : { bindings: options.bindings.slice() }
5065
- };
5066
- return this.node({
5067
- id,
5068
- type: WorkflowNodeTypesV1.LLMResponses,
5069
- input
5070
- });
5071
- }
5072
- routeSwitch(id, request, options = {}) {
5073
- const wiredRequest = wireRequest(request);
5074
- if (options.bindings) {
5075
- validateBindingTargets(id, wiredRequest.input, options.bindings);
5076
- }
5077
- const input = {
5078
- request: wiredRequest,
5079
- ...options.stream === void 0 ? {} : { stream: options.stream },
5080
- ...options.toolExecution === void 0 ? {} : { tool_execution: { mode: options.toolExecution } },
5081
- ...options.toolLimits === void 0 ? {} : { tool_limits: { ...options.toolLimits } },
5082
- ...options.bindings === void 0 ? {} : { bindings: options.bindings.slice() }
5083
- };
5084
- return this.node({
5085
- id,
5086
- type: WorkflowNodeTypesV1.RouteSwitch,
5087
- input
5088
- });
5089
- }
5090
- joinAll(id) {
5091
- return this.node({ id, type: WorkflowNodeTypesV1.JoinAll });
5092
- }
5093
- joinAny(id, input) {
5094
- return this.node({
5095
- id,
5096
- type: WorkflowNodeTypesV1.JoinAny,
5097
- ...input ? { input } : {}
5098
- });
5099
- }
5100
- joinCollect(id, input) {
5101
- return this.node({ id, type: WorkflowNodeTypesV1.JoinCollect, input });
5102
- }
5103
- transformJSON(id, input) {
5104
- return this.node({ id, type: WorkflowNodeTypesV1.TransformJSON, input });
5105
- }
5106
- mapFanout(id, input) {
5107
- validateMapFanoutInput(id, input);
5108
- return this.node({ id, type: WorkflowNodeTypesV1.MapFanout, input });
5109
- }
5110
- edge(from, to, when) {
5111
- return this.with({
5112
- edges: [...this.state.edges, { from, to, ...when ? { when } : {} }]
5113
- });
5114
- }
5115
- output(name, from, pointer) {
5116
- return this.with({
5117
- outputs: [
5118
- ...this.state.outputs,
5119
- { name, from, ...pointer ? { pointer } : {} }
5120
- ]
5121
- });
5122
- }
5123
- build() {
5124
- const edges = this.state.edges.slice().sort((a, b) => {
5125
- const af = String(a.from);
5126
- const bf = String(b.from);
5127
- if (af < bf) return -1;
5128
- if (af > bf) return 1;
5129
- const at = String(a.to);
5130
- const bt = String(b.to);
5131
- if (at < bt) return -1;
5132
- if (at > bt) return 1;
5133
- const aw = a.when ? JSON.stringify(a.when) : "";
5134
- const bw = b.when ? JSON.stringify(b.when) : "";
5135
- if (aw < bw) return -1;
5136
- if (aw > bw) return 1;
5137
- return 0;
5138
- });
5139
- const outputs = this.state.outputs.slice().sort((a, b) => {
5140
- const an = String(a.name);
5141
- const bn = String(b.name);
5142
- if (an < bn) return -1;
5143
- if (an > bn) return 1;
5144
- const af = String(a.from);
5145
- const bf = String(b.from);
5146
- if (af < bf) return -1;
5147
- if (af > bf) return 1;
5148
- const ap = a.pointer ?? "";
5149
- const bp = b.pointer ?? "";
5150
- if (ap < bp) return -1;
5151
- if (ap > bp) return 1;
5152
- return 0;
5153
- });
5154
- return {
5155
- kind: WorkflowKinds.WorkflowV1,
5156
- ...this.state.name ? { name: this.state.name } : {},
5157
- ...this.state.execution ? { execution: this.state.execution } : {},
5158
- nodes: this.state.nodes.slice(),
5159
- ...edges.length ? { edges } : {},
5160
- outputs
5161
- };
5162
- }
5163
- };
5164
- function workflowV1() {
5165
- return WorkflowBuilderV1.new();
5166
- }
5167
- var Workflow = class _Workflow {
5168
- constructor(name) {
5169
- this._nodes = [];
5170
- this._edges = /* @__PURE__ */ new Set();
5171
- this._outputs = [];
5172
- this._pendingNode = null;
5173
- this._name = name?.trim() || void 0;
5174
- }
5175
- /**
5176
- * Create a new workflow builder with the given name.
5177
- */
5178
- static create(name) {
5179
- return new _Workflow(name);
5180
- }
5181
- /**
5182
- * Set the workflow execution configuration.
5183
- */
5184
- execution(exec) {
5185
- this.flushPendingNode();
5186
- this._execution = exec;
5187
- return this;
5188
- }
5189
- /**
5190
- * Add an LLM responses node and return a node builder for configuration.
5191
- */
5192
- addLLMNode(id, request) {
5193
- this.flushPendingNode();
5194
- this._pendingNode = {
5195
- id,
5196
- request: wireRequest(request),
5197
- bindings: []
5198
- };
5199
- return new LLMNodeBuilder(this);
5200
- }
5201
- /**
5202
- * Add a join.all node that waits for all incoming edges.
5203
- */
5204
- addJoinAllNode(id) {
5205
- this.flushPendingNode();
5206
- this._nodes.push({ id, type: WorkflowNodeTypes.JoinAll });
5207
- return this;
5208
- }
5209
- /**
5210
- * Add a transform.json node and return a builder for configuration.
5211
- */
5212
- addTransformJSONNode(id) {
5213
- this.flushPendingNode();
5214
- return new TransformJSONNodeBuilder(this, id);
5215
- }
5216
- /**
5217
- * Add an output reference extracting the full node output.
5218
- */
5219
- output(name, from, pointer) {
5220
- this.flushPendingNode();
5221
- this._outputs.push({ name, from, ...pointer ? { pointer } : {} });
5222
- return this;
5223
- }
5224
- /**
5225
- * Add an output reference extracting text content from an LLM response.
5226
- * This is a convenience method that uses the LLM_TEXT_OUTPUT pointer.
5227
- */
5228
- outputText(name, from) {
5229
- return this.output(name, from, LLM_TEXT_OUTPUT);
5230
- }
5231
- /**
5232
- * Explicitly add an edge between nodes.
5233
- * Note: edges are automatically inferred from bindings, so this is rarely needed.
5234
- */
5235
- edge(from, to) {
5236
- this.flushPendingNode();
5237
- this._edges.add(`${from}->${to}`);
5238
- return this;
5239
- }
5240
- /**
5241
- * Build the workflow specification.
5242
- */
5243
- build() {
5244
- this.flushPendingNode();
5245
- const edges = Array.from(this._edges).map((key) => {
5246
- const [from, to] = key.split("->");
5247
- return { from, to };
5248
- }).sort((a, b) => {
5249
- const af = String(a.from);
5250
- const bf = String(b.from);
5251
- if (af < bf) return -1;
5252
- if (af > bf) return 1;
5253
- const at = String(a.to);
5254
- const bt = String(b.to);
5255
- if (at < bt) return -1;
5256
- if (at > bt) return 1;
5257
- return 0;
5258
- });
5259
- const outputs = this._outputs.slice().sort((a, b) => {
5260
- const an = String(a.name);
5261
- const bn = String(b.name);
5262
- if (an < bn) return -1;
5263
- if (an > bn) return 1;
5264
- const af = String(a.from);
5265
- const bf = String(b.from);
5266
- if (af < bf) return -1;
5267
- if (af > bf) return 1;
5268
- const ap = a.pointer ?? "";
5269
- const bp = b.pointer ?? "";
5270
- if (ap < bp) return -1;
5271
- if (ap > bp) return 1;
5272
- return 0;
5273
- });
5274
- return {
5275
- kind: WorkflowKinds.WorkflowV0,
5276
- ...this._name ? { name: this._name } : {},
5277
- ...this._execution ? { execution: this._execution } : {},
5278
- nodes: this._nodes.slice(),
5279
- ...edges.length ? { edges } : {},
5280
- outputs
5281
- };
5282
- }
5283
- /** @internal */
5284
- _getPendingNode() {
5285
- return this._pendingNode;
5286
- }
5287
- /** @internal */
5288
- _addEdge(from, to) {
5289
- this._edges.add(`${from}->${to}`);
5290
- }
5291
- /** @internal */
5292
- _addNode(node) {
5293
- this._nodes.push(node);
5294
- }
5295
- flushPendingNode() {
5296
- const pending = this._pendingNode;
5297
- if (!pending) return;
5298
- this._pendingNode = null;
5299
- if (pending.bindings.length > 0) {
5300
- validateBindingTargets(pending.id, pending.request.input, pending.bindings);
5301
- }
5302
- const input = {
5303
- id: pending.id,
5304
- type: WorkflowNodeTypes.LLMResponses,
5305
- input: {
5306
- request: pending.request,
5307
- ...pending.stream !== void 0 ? { stream: pending.stream } : {},
5308
- ...pending.toolExecution ? { tool_execution: { mode: pending.toolExecution } } : {},
5309
- ...pending.toolLimits ? { tool_limits: pending.toolLimits } : {},
5310
- ...pending.bindings.length ? { bindings: pending.bindings } : {}
5311
- }
5312
- };
5313
- this._nodes.push(input);
5314
- for (const binding of pending.bindings) {
5315
- this._edges.add(`${binding.from}->${pending.id}`);
5316
- }
5317
- }
5318
- };
5319
- var LLMNodeBuilder = class {
5320
- constructor(workflow) {
5321
- this.workflow = workflow;
5322
- }
5323
- /**
5324
- * Enable or disable streaming for this node.
5325
- */
5326
- stream(enabled) {
5327
- const pending = this.workflow._getPendingNode();
5328
- if (pending) {
5329
- pending.stream = enabled;
5330
- }
5331
- return this;
5332
- }
5333
- /**
5334
- * Add a binding from another LLM node's text output to this node's user message.
5335
- * This is the most common binding pattern: LLM text → user message with json_string encoding.
5336
- * The edge from the source node is automatically inferred.
5337
- */
5338
- bindTextFrom(from) {
5339
- return this.bindFromTo(from, LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT, "json_string");
5340
- }
5341
- /**
5342
- * Add a binding from another node's output to this node's user message text.
5343
- * Use bindTextFrom for the common case of binding LLM text output.
5344
- * The edge from the source node is automatically inferred.
5345
- */
5346
- bindFrom(from, pointer) {
5347
- return this.bindFromTo(from, pointer, LLM_USER_MESSAGE_TEXT, "json_string");
5348
- }
5349
- /**
5350
- * Add a full binding with explicit source/destination pointers and encoding.
5351
- * The edge from the source node is automatically inferred.
5352
- */
5353
- bindFromTo(from, fromPointer, toPointer, encoding) {
5354
- const pending = this.workflow._getPendingNode();
5355
- if (pending) {
5356
- pending.bindings.push({
5357
- from,
5358
- ...fromPointer ? { pointer: fromPointer } : {},
5359
- to: toPointer,
5360
- ...encoding ? { encoding } : {}
5361
- });
5362
- }
5363
- return this;
5364
- }
5365
- /**
5366
- * Add a binding that replaces a {{placeholder}} in the prompt text.
5367
- * This is useful when the prompt contains placeholder markers like {{tier_data}}.
5368
- * The edge from the source node is automatically inferred.
5369
- */
5370
- bindToPlaceholder(from, fromPointer, placeholder) {
5371
- const pending = this.workflow._getPendingNode();
5372
- if (pending) {
5373
- pending.bindings.push({
5374
- from,
5375
- ...fromPointer ? { pointer: fromPointer } : {},
5376
- to_placeholder: placeholder,
5377
- encoding: "json_string"
5378
- });
5379
- }
5380
- return this;
5381
- }
5382
- /**
5383
- * Add a binding from an LLM node's text output to a placeholder.
5384
- * This is the most common placeholder binding: LLM text → {{placeholder}}.
5385
- * The edge from the source node is automatically inferred.
5386
- */
5387
- bindTextToPlaceholder(from, placeholder) {
5388
- return this.bindToPlaceholder(from, LLM_TEXT_OUTPUT, placeholder);
5389
- }
5390
- /**
5391
- * Set the tool execution mode (server or client).
5392
- */
5393
- toolExecution(mode) {
5394
- const pending = this.workflow._getPendingNode();
5395
- if (pending) {
5396
- pending.toolExecution = mode;
5397
- }
5398
- return this;
5399
- }
5400
- /**
5401
- * Set the tool execution limits.
5402
- */
5403
- toolLimits(limits) {
5404
- const pending = this.workflow._getPendingNode();
5405
- if (pending) {
5406
- pending.toolLimits = limits;
5407
- }
5408
- return this;
5409
- }
5410
- // Workflow methods for chaining back
5411
- addLLMNode(id, request) {
5412
- return this.workflow.addLLMNode(id, request);
5413
- }
5414
- addJoinAllNode(id) {
5415
- return this.workflow.addJoinAllNode(id);
5416
- }
5417
- addTransformJSONNode(id) {
5418
- return this.workflow.addTransformJSONNode(id);
5419
- }
5420
- edge(from, to) {
5421
- return this.workflow.edge(from, to);
5422
- }
5423
- output(name, from, pointer) {
5424
- return this.workflow.output(name, from, pointer);
5425
- }
5426
- outputText(name, from) {
5427
- return this.workflow.outputText(name, from);
5428
- }
5429
- execution(exec) {
5430
- return this.workflow.execution(exec);
5431
- }
5432
- build() {
5433
- return this.workflow.build();
5434
- }
5435
- };
5436
- var TransformJSONNodeBuilder = class {
5437
- constructor(workflow, id) {
5438
- this.workflow = workflow;
5439
- this.id = id;
5440
- }
5441
- /**
5442
- * Set the object transformation with field mappings.
5443
- */
5444
- object(fields) {
5445
- this._object = fields;
5446
- return this;
5447
- }
5448
- /**
5449
- * Set the merge transformation with source references.
5450
- */
5451
- merge(items) {
5452
- this._merge = items;
5453
- return this;
5454
- }
5455
- finalize() {
5456
- const input = {};
5457
- if (this._object) input.object = this._object;
5458
- if (this._merge) input.merge = this._merge;
5459
- this.workflow._addNode({
5460
- id: this.id,
5461
- type: WorkflowNodeTypes.TransformJSON,
5462
- input
5463
- });
5464
- if (this._object) {
5465
- for (const ref of Object.values(this._object)) {
5466
- this.workflow._addEdge(ref.from, this.id);
5467
- }
5468
- }
5469
- if (this._merge) {
5470
- for (const ref of this._merge) {
5471
- this.workflow._addEdge(ref.from, this.id);
5472
- }
5473
- }
5474
- }
5475
- // Workflow methods for chaining back
5476
- addLLMNode(id, request) {
5477
- this.finalize();
5478
- return this.workflow.addLLMNode(id, request);
5479
- }
5480
- addJoinAllNode(id) {
5481
- this.finalize();
5482
- return this.workflow.addJoinAllNode(id);
5483
- }
5484
- edge(from, to) {
5485
- this.finalize();
5486
- return this.workflow.edge(from, to);
5487
- }
5488
- output(name, from, pointer) {
5489
- this.finalize();
5490
- return this.workflow.output(name, from, pointer);
5491
- }
5492
- execution(exec) {
5493
- this.finalize();
5494
- return this.workflow.execution(exec);
5495
- }
5496
- build() {
5497
- this.finalize();
5498
- return this.workflow.build();
5499
- }
5500
- };
5501
- function newWorkflow(name) {
5502
- return Workflow.create(name);
5503
- }
5504
-
5505
- // src/workflow_v0.schema.json
5506
- var workflow_v0_schema_default = {
5507
- $id: "https://modelrelay.ai/schemas/workflow_v0.schema.json",
5508
- $schema: "http://json-schema.org/draft-07/schema#",
5509
- additionalProperties: false,
5510
- definitions: {
5511
- edge: {
5512
- additionalProperties: false,
5513
- properties: {
5514
- from: {
5515
- minLength: 1,
5516
- type: "string"
5517
- },
5518
- to: {
5519
- minLength: 1,
5520
- type: "string"
5521
- }
5522
- },
5523
- required: [
5524
- "from",
5525
- "to"
5526
- ],
5527
- type: "object"
5528
- },
5529
- llmResponsesBinding: {
5530
- additionalProperties: false,
5531
- oneOf: [
5532
- {
5533
- required: [
5534
- "to"
5535
- ]
5536
- },
5537
- {
5538
- required: [
5539
- "to_placeholder"
5540
- ]
5541
- }
5542
- ],
5543
- properties: {
5544
- encoding: {
5545
- enum: [
5546
- "json",
5547
- "json_string"
5548
- ],
5549
- type: "string"
5550
- },
5551
- from: {
5552
- minLength: 1,
5553
- type: "string"
5554
- },
5555
- pointer: {
5556
- pattern: "^(/.*)?$",
5557
- type: "string"
5558
- },
5559
- to: {
5560
- pattern: "^/.*$",
5561
- type: "string"
5562
- },
5563
- to_placeholder: {
5564
- minLength: 1,
5565
- type: "string"
5566
- }
5567
- },
5568
- required: [
5569
- "from"
5570
- ],
5571
- type: "object"
5572
- },
5573
- node: {
5574
- additionalProperties: false,
5575
- oneOf: [
5576
- {
5577
- allOf: [
5578
- {
5579
- properties: {
5580
- input: {
5581
- properties: {
5582
- bindings: {
5583
- items: {
5584
- $ref: "#/definitions/llmResponsesBinding"
5585
- },
5586
- type: "array"
5587
- },
5588
- request: {
5589
- type: "object"
5590
- },
5591
- stream: {
5592
- type: "boolean"
5593
- },
5594
- tool_execution: {
5595
- additionalProperties: false,
5596
- properties: {
5597
- mode: {
5598
- default: "server",
5599
- enum: [
5600
- "server",
5601
- "client"
5602
- ],
5603
- type: "string"
5604
- }
5605
- },
5606
- required: [
5607
- "mode"
5608
- ],
5609
- type: "object"
5610
- },
5611
- tool_limits: {
5612
- additionalProperties: false,
5613
- properties: {
5614
- max_llm_calls: {
5615
- default: 8,
5616
- maximum: 64,
5617
- minimum: 1,
5618
- type: "integer"
5619
- },
5620
- max_tool_calls_per_step: {
5621
- default: 16,
5622
- maximum: 64,
5623
- minimum: 1,
5624
- type: "integer"
5625
- },
5626
- wait_ttl_ms: {
5627
- default: 9e5,
5628
- maximum: 864e5,
5629
- minimum: 1,
5630
- type: "integer"
5631
- }
5632
- },
5633
- type: "object"
5634
- }
5635
- },
5636
- required: [
5637
- "request"
5638
- ],
5639
- type: "object"
5640
- }
5641
- }
5642
- }
5643
- ],
5644
- properties: {
5645
- type: {
5646
- const: "llm.responses"
5647
- }
5648
- },
5649
- required: [
5650
- "input"
5651
- ]
5652
- },
5653
- {
5654
- properties: {
5655
- type: {
5656
- const: "join.all"
5657
- }
5658
- }
5659
- },
5660
- {
5661
- allOf: [
5662
- {
5663
- properties: {
5664
- input: {
5665
- additionalProperties: false,
5666
- oneOf: [
5667
- {
5668
- not: {
5669
- required: [
5670
- "merge"
5671
- ]
5672
- },
5673
- required: [
5674
- "object"
5675
- ]
5676
- },
5677
- {
5678
- not: {
5679
- required: [
5680
- "object"
5681
- ]
5682
- },
5683
- required: [
5684
- "merge"
5685
- ]
5686
- }
5687
- ],
5688
- properties: {
5689
- merge: {
5690
- items: {
5691
- $ref: "#/definitions/transformValue"
5692
- },
5693
- minItems: 1,
5694
- type: "array"
5695
- },
5696
- object: {
5697
- additionalProperties: {
5698
- $ref: "#/definitions/transformValue"
5699
- },
5700
- minProperties: 1,
5701
- type: "object"
5702
- }
5703
- },
5704
- type: "object"
5705
- }
5706
- }
5707
- }
5708
- ],
5709
- properties: {
5710
- type: {
5711
- const: "transform.json"
5712
- }
5713
- },
5714
- required: [
5715
- "input"
5716
- ]
5717
- }
5718
- ],
5719
- properties: {
5720
- id: {
5721
- minLength: 1,
5722
- type: "string"
5723
- },
5724
- input: {},
5725
- type: {
5726
- enum: [
5727
- "llm.responses",
5728
- "join.all",
5729
- "transform.json"
5730
- ],
5731
- type: "string"
5732
- }
5733
- },
5734
- required: [
5735
- "id",
5736
- "type"
5737
- ],
5738
- type: "object"
5739
- },
5740
- output: {
5741
- additionalProperties: false,
5742
- properties: {
5743
- from: {
5744
- minLength: 1,
5745
- type: "string"
5746
- },
5747
- name: {
5748
- minLength: 1,
5749
- type: "string"
5750
- },
5751
- pointer: {
5752
- pattern: "^(/.*)?$",
5753
- type: "string"
5754
- }
5755
- },
5756
- required: [
5757
- "name",
5758
- "from"
5759
- ],
5760
- type: "object"
5761
- },
5762
- transformValue: {
5763
- additionalProperties: false,
5764
- properties: {
5765
- from: {
5766
- minLength: 1,
5767
- type: "string"
5768
- },
5769
- pointer: {
5770
- pattern: "^(/.*)?$",
5771
- type: "string"
5772
- }
5773
- },
5774
- required: [
5775
- "from"
5776
- ],
5777
- type: "object"
5778
- }
5779
- },
5780
- properties: {
5781
- edges: {
5782
- items: {
5783
- $ref: "#/definitions/edge"
5784
- },
5785
- type: "array"
5786
- },
5787
- execution: {
5788
- additionalProperties: false,
5789
- properties: {
5790
- max_parallelism: {
5791
- minimum: 1,
5792
- type: "integer"
5793
- },
5794
- node_timeout_ms: {
5795
- minimum: 1,
5796
- type: "integer"
5797
- },
5798
- run_timeout_ms: {
5799
- minimum: 1,
5800
- type: "integer"
5801
- }
5802
- },
5803
- type: "object"
5804
- },
5805
- kind: {
5806
- const: "workflow.v0",
5807
- type: "string"
5808
- },
5809
- name: {
5810
- type: "string"
5811
- },
5812
- nodes: {
5813
- items: {
5814
- $ref: "#/definitions/node"
5815
- },
5816
- minItems: 1,
5817
- type: "array"
5818
- },
5819
- outputs: {
5820
- items: {
5821
- $ref: "#/definitions/output"
5822
- },
5823
- minItems: 1,
5824
- type: "array"
5825
- }
5826
- },
5827
- required: [
5828
- "kind",
5829
- "nodes",
5830
- "outputs"
5831
- ],
5832
- title: "ModelRelay workflow.v0",
5833
- type: "object"
5834
- };
5835
-
5836
- // src/workflow_v1.schema.json
5837
- var workflow_v1_schema_default = {
5838
- $id: "https://modelrelay.ai/schemas/workflow_v1.schema.json",
5839
- $schema: "http://json-schema.org/draft-07/schema#",
5840
- additionalProperties: false,
5841
- definitions: {
5842
- condition: {
5843
- additionalProperties: false,
5844
- properties: {
5845
- op: {
5846
- enum: [
5847
- "equals",
5848
- "matches",
5849
- "exists"
5850
- ],
5851
- type: "string"
5852
- },
5853
- path: {
5854
- pattern: "^\\$.*$",
5855
- type: "string"
5856
- },
5857
- source: {
5858
- enum: [
5859
- "node_output",
5860
- "node_status"
5861
- ],
5862
- type: "string"
5863
- },
5864
- value: {}
5865
- },
5866
- required: [
5867
- "source",
5868
- "op"
5869
- ],
5870
- type: "object"
5871
- },
5872
- edge: {
5873
- additionalProperties: false,
5874
- properties: {
5875
- from: {
5876
- minLength: 1,
5877
- type: "string"
5878
- },
5879
- to: {
5880
- minLength: 1,
5881
- type: "string"
5882
- },
5883
- when: {
5884
- $ref: "#/definitions/condition"
5885
- }
5886
- },
5887
- required: [
5888
- "from",
5889
- "to"
5890
- ],
5891
- type: "object"
5892
- },
5893
- fragmentBindInput: {
5894
- additionalProperties: false,
5895
- oneOf: [
5896
- {
5897
- required: [
5898
- "from_node"
5899
- ]
5900
- },
5901
- {
5902
- required: [
5903
- "from_input"
5904
- ]
5905
- }
5906
- ],
5907
- properties: {
5908
- from_input: {
5909
- minLength: 1,
5910
- type: "string"
5911
- },
5912
- from_node: {
5913
- minLength: 1,
5914
- type: "string"
5915
- },
5916
- pointer: {
5917
- pattern: "^(/.*)?$",
5918
- type: "string"
5919
- }
5920
- },
5921
- type: "object"
5922
- },
5923
- fragmentDef: {
5924
- additionalProperties: false,
5925
- properties: {
5926
- edges: {
5927
- items: {
5928
- $ref: "#/definitions/edge"
5929
- },
5930
- type: "array"
5931
- },
5932
- inputs: {
5933
- items: {
5934
- $ref: "#/definitions/fragmentInput"
5935
- },
5936
- type: "array"
5937
- },
5938
- nodes: {
5939
- items: {
5940
- $ref: "#/definitions/node"
5941
- },
5942
- minItems: 1,
5943
- type: "array"
5944
- },
5945
- outputs: {
5946
- items: {
5947
- $ref: "#/definitions/fragmentOutput"
5948
- },
5949
- minItems: 1,
5950
- type: "array"
5951
- }
5952
- },
5953
- required: [
5954
- "outputs",
5955
- "nodes"
5956
- ],
5957
- type: "object"
5958
- },
5959
- fragmentInput: {
5960
- additionalProperties: false,
5961
- properties: {
5962
- name: {
5963
- minLength: 1,
5964
- type: "string"
5965
- },
5966
- type: {
5967
- type: "string"
5968
- }
5969
- },
5970
- required: [
5971
- "name"
5972
- ],
5973
- type: "object"
5974
- },
5975
- fragmentOutput: {
5976
- additionalProperties: false,
5977
- properties: {
5978
- from_node: {
5979
- minLength: 1,
5980
- type: "string"
5981
- },
5982
- name: {
5983
- minLength: 1,
5984
- type: "string"
5985
- },
5986
- pointer: {
5987
- pattern: "^(/.*)?$",
5988
- type: "string"
5989
- }
5990
- },
5991
- required: [
5992
- "name",
5993
- "from_node"
5994
- ],
5995
- type: "object"
5996
- },
5997
- llmResponsesBinding: {
5998
- additionalProperties: false,
5999
- oneOf: [
6000
- {
6001
- required: [
6002
- "to"
6003
- ]
6004
- },
6005
- {
6006
- required: [
6007
- "to_placeholder"
6008
- ]
6009
- }
6010
- ],
6011
- properties: {
6012
- encoding: {
6013
- enum: [
6014
- "json",
6015
- "json_string"
6016
- ],
6017
- type: "string"
6018
- },
6019
- from: {
6020
- minLength: 1,
6021
- type: "string"
6022
- },
6023
- pointer: {
6024
- pattern: "^(/.*)?$",
6025
- type: "string"
6026
- },
6027
- to: {
6028
- pattern: "^/.*$",
6029
- type: "string"
6030
- },
6031
- to_placeholder: {
6032
- minLength: 1,
6033
- type: "string"
6034
- }
6035
- },
6036
- required: [
6037
- "from"
6038
- ],
6039
- type: "object"
6040
- },
6041
- mapFanoutItemBinding: {
6042
- additionalProperties: false,
6043
- oneOf: [
6044
- {
6045
- required: [
6046
- "to"
6047
- ]
6048
- },
6049
- {
6050
- required: [
6051
- "to_placeholder"
6052
- ]
6053
- }
6054
- ],
6055
- properties: {
6056
- encoding: {
6057
- enum: [
6058
- "json",
6059
- "json_string"
6060
- ],
6061
- type: "string"
6062
- },
6063
- path: {
6064
- pattern: "^(/.*)?$",
6065
- type: "string"
6066
- },
6067
- to: {
6068
- pattern: "^/.*$",
6069
- type: "string"
6070
- },
6071
- to_placeholder: {
6072
- minLength: 1,
6073
- type: "string"
6074
- }
6075
- },
6076
- type: "object"
6077
- },
6078
- node: {
6079
- additionalProperties: false,
6080
- oneOf: [
6081
- {
6082
- allOf: [
6083
- {
6084
- properties: {
6085
- input: {
6086
- properties: {
6087
- bindings: {
6088
- items: {
6089
- $ref: "#/definitions/llmResponsesBinding"
6090
- },
6091
- type: "array"
6092
- },
6093
- request: {
6094
- type: "object"
6095
- },
6096
- stream: {
6097
- type: "boolean"
6098
- },
6099
- tool_execution: {
6100
- additionalProperties: false,
6101
- properties: {
6102
- mode: {
6103
- default: "server",
6104
- enum: [
6105
- "server",
6106
- "client"
6107
- ],
6108
- type: "string"
6109
- }
6110
- },
6111
- required: [
6112
- "mode"
6113
- ],
6114
- type: "object"
6115
- },
6116
- tool_limits: {
6117
- additionalProperties: false,
6118
- properties: {
6119
- max_llm_calls: {
6120
- default: 8,
6121
- maximum: 64,
6122
- minimum: 1,
6123
- type: "integer"
6124
- },
6125
- max_tool_calls_per_step: {
6126
- default: 16,
6127
- maximum: 64,
6128
- minimum: 1,
6129
- type: "integer"
6130
- },
6131
- wait_ttl_ms: {
6132
- default: 9e5,
6133
- maximum: 864e5,
6134
- minimum: 1,
6135
- type: "integer"
6136
- }
6137
- },
6138
- type: "object"
6139
- }
6140
- },
6141
- required: [
6142
- "request"
6143
- ],
6144
- type: "object"
6145
- }
6146
- }
6147
- }
6148
- ],
6149
- properties: {
6150
- type: {
6151
- const: "llm.responses"
6152
- }
6153
- },
6154
- required: [
6155
- "input"
6156
- ]
6157
- },
6158
- {
6159
- allOf: [
6160
- {
6161
- properties: {
6162
- input: {
6163
- properties: {
6164
- bindings: {
6165
- items: {
6166
- $ref: "#/definitions/llmResponsesBinding"
6167
- },
6168
- type: "array"
6169
- },
6170
- request: {
6171
- type: "object"
6172
- },
6173
- stream: {
6174
- type: "boolean"
6175
- },
6176
- tool_execution: {
6177
- additionalProperties: false,
6178
- properties: {
6179
- mode: {
6180
- default: "server",
6181
- enum: [
6182
- "server",
6183
- "client"
6184
- ],
6185
- type: "string"
6186
- }
6187
- },
6188
- required: [
6189
- "mode"
6190
- ],
6191
- type: "object"
6192
- },
6193
- tool_limits: {
6194
- additionalProperties: false,
6195
- properties: {
6196
- max_llm_calls: {
6197
- default: 8,
6198
- maximum: 64,
6199
- minimum: 1,
6200
- type: "integer"
6201
- },
6202
- max_tool_calls_per_step: {
6203
- default: 16,
6204
- maximum: 64,
6205
- minimum: 1,
6206
- type: "integer"
6207
- },
6208
- wait_ttl_ms: {
6209
- default: 9e5,
6210
- maximum: 864e5,
6211
- minimum: 1,
6212
- type: "integer"
6213
- }
6214
- },
6215
- type: "object"
6216
- }
6217
- },
6218
- required: [
6219
- "request"
6220
- ],
6221
- type: "object"
6222
- }
6223
- }
6224
- }
6225
- ],
6226
- properties: {
6227
- type: {
6228
- const: "route.switch"
6229
- }
6230
- },
6231
- required: [
6232
- "input"
6233
- ]
6234
- },
6235
- {
6236
- properties: {
6237
- type: {
6238
- const: "join.all"
6239
- }
6240
- }
6241
- },
6242
- {
6243
- allOf: [
6244
- {
6245
- properties: {
6246
- input: {
6247
- additionalProperties: false,
6248
- properties: {
6249
- predicate: {
6250
- $ref: "#/definitions/condition"
6251
- }
6252
- },
6253
- type: "object"
6254
- }
6255
- }
6256
- }
6257
- ],
6258
- properties: {
6259
- type: {
6260
- const: "join.any"
6261
- }
6262
- }
6263
- },
6264
- {
6265
- allOf: [
6266
- {
6267
- properties: {
6268
- input: {
6269
- additionalProperties: false,
6270
- properties: {
6271
- limit: {
6272
- minimum: 1,
6273
- type: "integer"
6274
- },
6275
- predicate: {
6276
- $ref: "#/definitions/condition"
6277
- },
6278
- timeout_ms: {
6279
- minimum: 1,
6280
- type: "integer"
6281
- }
6282
- },
6283
- type: "object"
6284
- }
6285
- }
6286
- }
6287
- ],
6288
- properties: {
6289
- type: {
6290
- const: "join.collect"
6291
- }
6292
- },
6293
- required: [
6294
- "input"
6295
- ]
6296
- },
6297
- {
6298
- allOf: [
6299
- {
6300
- properties: {
6301
- input: {
6302
- additionalProperties: false,
6303
- oneOf: [
6304
- {
6305
- not: {
6306
- required: [
6307
- "merge"
6308
- ]
6309
- },
6310
- required: [
6311
- "object"
6312
- ]
6313
- },
6314
- {
6315
- not: {
6316
- required: [
6317
- "object"
6318
- ]
6319
- },
6320
- required: [
6321
- "merge"
6322
- ]
6323
- }
6324
- ],
6325
- properties: {
6326
- merge: {
6327
- items: {
6328
- $ref: "#/definitions/transformValue"
6329
- },
6330
- minItems: 1,
6331
- type: "array"
6332
- },
6333
- object: {
6334
- additionalProperties: {
6335
- $ref: "#/definitions/transformValue"
6336
- },
6337
- minProperties: 1,
6338
- type: "object"
6339
- }
6340
- },
6341
- type: "object"
6342
- }
6343
- }
6344
- }
6345
- ],
6346
- properties: {
6347
- type: {
6348
- const: "transform.json"
6349
- }
6350
- },
6351
- required: [
6352
- "input"
6353
- ]
6354
- },
6355
- {
6356
- allOf: [
6357
- {
6358
- properties: {
6359
- input: {
6360
- additionalProperties: false,
6361
- properties: {
6362
- item_bindings: {
6363
- items: {
6364
- $ref: "#/definitions/mapFanoutItemBinding"
6365
- },
6366
- type: "array"
6367
- },
6368
- items: {
6369
- additionalProperties: false,
6370
- properties: {
6371
- from: {
6372
- minLength: 1,
6373
- type: "string"
6374
- },
6375
- path: {
6376
- pattern: "^(/.*)?$",
6377
- type: "string"
6378
- },
6379
- pointer: {
6380
- pattern: "^(/.*)?$",
6381
- type: "string"
6382
- }
6383
- },
6384
- required: [
6385
- "from"
6386
- ],
6387
- type: "object"
6388
- },
6389
- max_parallelism: {
6390
- minimum: 1,
6391
- type: "integer"
6392
- },
6393
- subnode: {
6394
- additionalProperties: false,
6395
- properties: {
6396
- id: {
6397
- minLength: 1,
6398
- type: "string"
6399
- },
6400
- input: {},
6401
- type: {
6402
- enum: [
6403
- "llm.responses",
6404
- "route.switch",
6405
- "transform.json"
6406
- ],
6407
- type: "string"
6408
- }
6409
- },
6410
- required: [
6411
- "id",
6412
- "type"
6413
- ],
6414
- type: "object"
6415
- }
6416
- },
6417
- required: [
6418
- "items",
6419
- "subnode"
6420
- ],
6421
- type: "object"
6422
- }
6423
- }
6424
- }
6425
- ],
6426
- properties: {
6427
- type: {
6428
- const: "map.fanout"
6429
- }
6430
- },
6431
- required: [
6432
- "input"
6433
- ]
6434
- },
6435
- {
6436
- allOf: [
6437
- {
6438
- properties: {
6439
- input: {
6440
- additionalProperties: false,
6441
- properties: {
6442
- bind_inputs: {
6443
- additionalProperties: {
6444
- $ref: "#/definitions/fragmentBindInput"
6445
- },
6446
- type: "object"
6447
- },
6448
- ref: {
6449
- minLength: 1,
6450
- type: "string"
6451
- }
6452
- },
6453
- required: [
6454
- "ref"
6455
- ],
6456
- type: "object"
6457
- }
6458
- }
6459
- }
6460
- ],
6461
- properties: {
6462
- type: {
6463
- const: "fragment"
6464
- }
6465
- },
6466
- required: [
6467
- "input"
6468
- ]
6469
- }
6470
- ],
6471
- properties: {
6472
- id: {
6473
- minLength: 1,
6474
- type: "string"
6475
- },
6476
- input: {},
6477
- type: {
6478
- enum: [
6479
- "llm.responses",
6480
- "route.switch",
6481
- "join.all",
6482
- "join.any",
6483
- "join.collect",
6484
- "transform.json",
6485
- "map.fanout",
6486
- "fragment"
6487
- ],
6488
- type: "string"
6489
- }
6490
- },
6491
- required: [
6492
- "id",
6493
- "type"
6494
- ],
6495
- type: "object"
6496
- },
6497
- output: {
6498
- additionalProperties: false,
6499
- properties: {
6500
- from: {
6501
- minLength: 1,
6502
- type: "string"
6503
- },
6504
- name: {
6505
- minLength: 1,
6506
- type: "string"
6507
- },
6508
- output: {
6509
- minLength: 1,
6510
- type: "string"
6511
- },
6512
- pointer: {
6513
- pattern: "^(/.*)?$",
6514
- type: "string"
6515
- }
6516
- },
6517
- required: [
6518
- "name",
6519
- "from"
6520
- ],
6521
- type: "object"
6522
- },
6523
- transformValue: {
6524
- additionalProperties: false,
6525
- properties: {
6526
- from: {
6527
- minLength: 1,
6528
- type: "string"
6529
- },
6530
- pointer: {
6531
- pattern: "^(/.*)?$",
6532
- type: "string"
6533
- }
6534
- },
6535
- required: [
6536
- "from"
6537
- ],
6538
- type: "object"
6539
- }
6540
- },
6541
- properties: {
6542
- edges: {
6543
- items: {
6544
- $ref: "#/definitions/edge"
6545
- },
6546
- type: "array"
6547
- },
6548
- execution: {
6549
- additionalProperties: false,
6550
- properties: {
6551
- max_parallelism: {
6552
- minimum: 1,
6553
- type: "integer"
6554
- },
6555
- node_timeout_ms: {
6556
- minimum: 1,
6557
- type: "integer"
6558
- },
6559
- run_timeout_ms: {
6560
- minimum: 1,
6561
- type: "integer"
6562
- }
6563
- },
6564
- type: "object"
6565
- },
6566
- fragments: {
6567
- additionalProperties: {
6568
- $ref: "#/definitions/fragmentDef"
6569
- },
6570
- type: "object"
6571
- },
6572
- kind: {
6573
- const: "workflow.v1",
6574
- type: "string"
6575
- },
6576
- name: {
6577
- type: "string"
6578
- },
6579
- nodes: {
6580
- items: {
6581
- $ref: "#/definitions/node"
6582
- },
6583
- minItems: 1,
6584
- type: "array"
6585
- },
6586
- outputs: {
6587
- items: {
6588
- $ref: "#/definitions/output"
6589
- },
6590
- minItems: 1,
6591
- type: "array"
6592
- }
6593
- },
6594
- required: [
6595
- "kind",
6596
- "nodes",
6597
- "outputs"
6598
- ],
6599
- title: "ModelRelay workflow.v1",
6600
- type: "object"
6601
- };
6602
-
6603
- // src/workflow_patterns.ts
6604
- var LLM_TEXT_OUTPUT_INTERNAL = "/output/0/content/0/text";
6605
- var LLM_USER_MESSAGE_TEXT_INTERNAL = "/input/1/content/0/text";
6606
- function wireRequest2(req) {
6607
- const raw = req;
6608
- if (raw && typeof raw === "object") {
6609
- if ("input" in raw) {
6610
- return req;
6611
- }
6612
- if ("body" in raw) {
6613
- return raw.body ?? {};
6614
- }
6615
- }
6616
- return asInternal(req).body;
6617
- }
6618
- function sortEdges(edges) {
6619
- return edges.slice().sort((a, b) => {
6620
- const af = String(a.from);
6621
- const bf = String(b.from);
6622
- if (af < bf) return -1;
6623
- if (af > bf) return 1;
6624
- const at = String(a.to);
6625
- const bt = String(b.to);
6626
- if (at < bt) return -1;
6627
- if (at > bt) return 1;
6628
- return 0;
6629
- });
6630
- }
6631
- function sortOutputs(outputs) {
6632
- return outputs.slice().sort((a, b) => {
6633
- const an = String(a.name);
6634
- const bn = String(b.name);
6635
- if (an < bn) return -1;
6636
- if (an > bn) return 1;
6637
- const af = String(a.from);
6638
- const bf = String(b.from);
6639
- if (af < bf) return -1;
6640
- if (af > bf) return 1;
6641
- const ap = a.pointer ?? "";
6642
- const bp = b.pointer ?? "";
6643
- if (ap < bp) return -1;
6644
- if (ap > bp) return 1;
6645
- return 0;
6646
- });
6647
- }
6648
- function LLMStep(id, request) {
6649
- const config = {
6650
- id,
6651
- request: wireRequest2(request),
6652
- stream: false
6653
- };
6654
- return {
6655
- ...config,
6656
- withStream() {
6657
- return { ...config, stream: true };
6658
- }
6659
- };
6660
- }
6661
- var ChainBuilder = class _ChainBuilder {
6662
- constructor(state) {
6663
- this.state = state;
6664
- }
6665
- static create(name, steps) {
6666
- return new _ChainBuilder({ name, steps, outputs: [] });
6667
- }
6668
- with(patch) {
6669
- return new _ChainBuilder({ ...this.state, ...patch });
6670
- }
6671
- /**
6672
- * Sets the workflow execution configuration.
6673
- */
6674
- execution(exec) {
6675
- return this.with({ execution: exec });
6676
- }
6677
- /**
6678
- * Adds an output reference from a specific step.
6679
- */
6680
- output(name, from) {
6681
- return this.with({
6682
- outputs: [
6683
- ...this.state.outputs,
6684
- {
6685
- name,
6686
- from,
6687
- pointer: LLM_TEXT_OUTPUT_INTERNAL
6688
- }
6689
- ]
6690
- });
6691
- }
6692
- /**
6693
- * Adds an output reference from the last step.
6694
- */
6695
- outputLast(name) {
6696
- if (this.state.steps.length === 0) {
6697
- return this;
6698
- }
6699
- return this.output(name, this.state.steps[this.state.steps.length - 1].id);
6700
- }
6701
- /**
6702
- * Builds and returns the compiled workflow spec.
6703
- * @throws Error if no steps are provided
6704
- */
6705
- build() {
6706
- if (this.state.steps.length === 0) {
6707
- throw new Error("chain requires at least one step");
6708
- }
6709
- const nodes = [];
6710
- const edges = [];
6711
- for (let i = 0; i < this.state.steps.length; i++) {
6712
- const step = this.state.steps[i];
6713
- const bindings = [];
6714
- if (i > 0) {
6715
- const prevId = this.state.steps[i - 1].id;
6716
- bindings.push({
6717
- from: prevId,
6718
- pointer: LLM_TEXT_OUTPUT_INTERNAL,
6719
- to: LLM_USER_MESSAGE_TEXT_INTERNAL,
6720
- encoding: "json_string"
6721
- });
6722
- edges.push({ from: prevId, to: step.id });
6723
- }
6724
- const input = {
6725
- id: step.id,
6726
- type: WorkflowNodeTypes.LLMResponses,
6727
- input: {
6728
- request: step.request,
6729
- ...step.stream ? { stream: true } : {},
6730
- ...bindings.length > 0 ? { bindings } : {}
6731
- }
6732
- };
6733
- nodes.push(input);
6734
- }
6735
- return {
6736
- kind: WorkflowKinds.WorkflowV0,
6737
- name: this.state.name,
6738
- ...this.state.execution ? { execution: this.state.execution } : {},
6739
- nodes,
6740
- ...edges.length > 0 ? { edges: sortEdges(edges) } : {},
6741
- outputs: sortOutputs(this.state.outputs)
6742
- };
6743
- }
6744
- };
6745
- function Chain(name, steps) {
6746
- return ChainBuilder.create(name, steps);
6747
- }
6748
- var ParallelBuilder = class _ParallelBuilder {
6749
- constructor(state) {
6750
- this.state = state;
6751
- }
6752
- static create(name, steps) {
6753
- return new _ParallelBuilder({ name, steps, outputs: [] });
6754
- }
6755
- with(patch) {
6756
- return new _ParallelBuilder({ ...this.state, ...patch });
6757
- }
6758
- /**
6759
- * Sets the workflow execution configuration.
6760
- */
6761
- execution(exec) {
6762
- return this.with({ execution: exec });
6763
- }
6764
- /**
6765
- * Adds a join node that waits for all parallel steps,
6766
- * followed by an aggregator LLM node that receives the combined output.
6767
- * The join node ID is automatically generated as "<id>_join".
6768
- */
6769
- aggregate(id, request) {
6770
- return this.with({
6771
- aggregate: {
6772
- id,
6773
- request: wireRequest2(request),
6774
- stream: false
6775
- }
6776
- });
6777
- }
6778
- /**
6779
- * Like aggregate() but enables streaming on the aggregator node.
6780
- */
6781
- aggregateWithStream(id, request) {
6782
- return this.with({
6783
- aggregate: {
6784
- id,
6785
- request: wireRequest2(request),
6786
- stream: true
6787
- }
6788
- });
6789
- }
6790
- /**
6791
- * Adds an output reference from a specific step.
6792
- */
6793
- output(name, from) {
6794
- return this.with({
6795
- outputs: [
6796
- ...this.state.outputs,
6797
- {
6798
- name,
6799
- from,
6800
- pointer: LLM_TEXT_OUTPUT_INTERNAL
6801
- }
6802
- ]
6803
- });
6804
- }
6805
- /**
6806
- * Builds and returns the compiled workflow spec.
6807
- * @throws Error if no steps are provided
6808
- */
6809
- build() {
6810
- if (this.state.steps.length === 0) {
6811
- throw new Error("parallel requires at least one step");
6812
- }
6813
- const nodes = [];
6814
- const edges = [];
6815
- for (const step of this.state.steps) {
6816
- const input = {
6817
- id: step.id,
6818
- type: WorkflowNodeTypes.LLMResponses,
6819
- input: {
6820
- request: step.request,
6821
- ...step.stream ? { stream: true } : {}
6822
- }
6823
- };
6824
- nodes.push(input);
6825
- }
6826
- if (this.state.aggregate) {
6827
- const joinId = `${this.state.aggregate.id}_join`;
6828
- nodes.push({ id: joinId, type: WorkflowNodeTypes.JoinAll });
6829
- for (const step of this.state.steps) {
6830
- edges.push({ from: step.id, to: joinId });
6831
- }
6832
- const aggInput = {
6833
- id: this.state.aggregate.id,
6834
- type: WorkflowNodeTypes.LLMResponses,
6835
- input: {
6836
- request: this.state.aggregate.request,
6837
- ...this.state.aggregate.stream ? { stream: true } : {},
6838
- bindings: [
6839
- {
6840
- from: joinId,
6841
- // Empty pointer = full join output
6842
- to: LLM_USER_MESSAGE_TEXT_INTERNAL,
6843
- encoding: "json_string"
6844
- }
6845
- ]
6846
- }
6847
- };
6848
- nodes.push(aggInput);
6849
- edges.push({ from: joinId, to: this.state.aggregate.id });
6850
- }
6851
- return {
6852
- kind: WorkflowKinds.WorkflowV0,
6853
- name: this.state.name,
6854
- ...this.state.execution ? { execution: this.state.execution } : {},
6855
- nodes,
6856
- ...edges.length > 0 ? { edges: sortEdges(edges) } : {},
6857
- outputs: sortOutputs(this.state.outputs)
6858
- };
6859
- }
6860
- };
6861
- function Parallel(name, steps) {
6862
- return ParallelBuilder.create(name, steps);
6863
- }
6864
- function MapItem(id, request) {
6865
- const config = {
6866
- id,
6867
- request: wireRequest2(request),
6868
- stream: false
6869
- };
6870
- return {
6871
- ...config,
6872
- withStream() {
6873
- return { ...config, stream: true };
6874
- }
6875
- };
6876
- }
6877
- var MapReduceBuilder = class _MapReduceBuilder {
6878
- constructor(state) {
6879
- this.state = state;
6880
- }
6881
- static create(name, items) {
6882
- return new _MapReduceBuilder({ name, items, outputs: [] });
6883
- }
6884
- with(patch) {
6885
- return new _MapReduceBuilder({ ...this.state, ...patch });
6886
- }
6887
- /**
6888
- * Adds a mapper item to the workflow.
6889
- * Each item becomes a separate LLM node that runs in parallel.
6890
- */
6891
- item(id, request) {
6892
- return this.with({
6893
- items: [...this.state.items, { id, request: wireRequest2(request), stream: false }]
6894
- });
6895
- }
6896
- /**
6897
- * Adds a mapper item with streaming enabled.
6898
- */
6899
- itemWithStream(id, request) {
6900
- return this.with({
6901
- items: [...this.state.items, { id, request: wireRequest2(request), stream: true }]
6902
- });
6903
- }
6904
- /**
6905
- * Sets the workflow execution configuration.
6906
- */
6907
- execution(exec) {
6908
- return this.with({ execution: exec });
6909
- }
6910
- /**
6911
- * Adds a reducer node that receives all mapper outputs.
6912
- * The reducer receives a JSON object mapping each mapper ID to its text output.
6913
- * The join node ID is automatically generated as "<id>_join".
6914
- */
6915
- reduce(id, request) {
6916
- return this.with({
6917
- reducer: {
6918
- id,
6919
- request: wireRequest2(request),
6920
- stream: false
6921
- }
6922
- });
6923
- }
6924
- /**
6925
- * Like reduce() but enables streaming on the reducer node.
6926
- */
6927
- reduceWithStream(id, request) {
6928
- return this.with({
6929
- reducer: {
6930
- id,
6931
- request: wireRequest2(request),
6932
- stream: true
6933
- }
6934
- });
6935
- }
6936
- /**
6937
- * Adds an output reference from a specific node.
6938
- * Typically used to output from the reducer node.
6939
- */
6940
- output(name, from) {
6941
- return this.with({
6942
- outputs: [
6943
- ...this.state.outputs,
6944
- {
6945
- name,
6946
- from,
6947
- pointer: LLM_TEXT_OUTPUT_INTERNAL
6948
- }
6949
- ]
6950
- });
6951
- }
6952
- /**
6953
- * Builds and returns the compiled workflow spec.
6954
- * @throws Error if no items are provided or no reducer is configured
6955
- */
6956
- build() {
6957
- if (this.state.items.length === 0) {
6958
- throw new Error("map-reduce requires at least one item");
6959
- }
6960
- if (!this.state.reducer) {
6961
- throw new Error("map-reduce requires a reducer (call reduce)");
6962
- }
6963
- const seenIds = /* @__PURE__ */ new Set();
6964
- for (const item of this.state.items) {
6965
- if (!item.id) {
6966
- throw new Error("item ID cannot be empty");
6967
- }
6968
- if (seenIds.has(item.id)) {
6969
- throw new Error(`duplicate item ID: "${item.id}"`);
6970
- }
6971
- seenIds.add(item.id);
6972
- }
6973
- const nodes = [];
6974
- const edges = [];
6975
- const joinId = `${this.state.reducer.id}_join`;
6976
- for (const item of this.state.items) {
6977
- const mapperId = `map_${item.id}`;
6978
- const input = {
6979
- id: mapperId,
6980
- type: WorkflowNodeTypes.LLMResponses,
6981
- input: {
6982
- request: item.request,
6983
- ...item.stream ? { stream: true } : {}
6984
- }
6985
- };
6986
- nodes.push(input);
6987
- edges.push({ from: mapperId, to: joinId });
6988
- }
6989
- nodes.push({ id: joinId, type: WorkflowNodeTypes.JoinAll });
6990
- const reducerInput = {
6991
- id: this.state.reducer.id,
6992
- type: WorkflowNodeTypes.LLMResponses,
6993
- input: {
6994
- request: this.state.reducer.request,
6995
- ...this.state.reducer.stream ? { stream: true } : {},
6996
- bindings: [
6997
- {
6998
- from: joinId,
6999
- // Empty pointer = full join output
7000
- to: LLM_USER_MESSAGE_TEXT_INTERNAL,
7001
- encoding: "json_string"
7002
- }
7003
- ]
7004
- }
7005
- };
7006
- nodes.push(reducerInput);
7007
- edges.push({ from: joinId, to: this.state.reducer.id });
7008
- return {
7009
- kind: WorkflowKinds.WorkflowV0,
7010
- name: this.state.name,
7011
- ...this.state.execution ? { execution: this.state.execution } : {},
7012
- nodes,
7013
- ...edges.length > 0 ? { edges: sortEdges(edges) } : {},
7014
- outputs: sortOutputs(this.state.outputs)
7015
- };
7016
- }
7017
- };
7018
- function MapReduce(name, items = []) {
7019
- return MapReduceBuilder.create(name, items);
4782
+ function workflowV1() {
4783
+ return WorkflowBuilderV1.new();
7020
4784
  }
7021
4785
 
7022
4786
  // src/testing.ts
@@ -7240,14 +5004,13 @@ __export(workflow_exports, {
7240
5004
  BindingBuilder: () => BindingBuilder,
7241
5005
  BindingEncodings: () => BindingEncodings,
7242
5006
  FanoutReduceV1: () => FanoutReduceV1,
7243
- KindV0: () => KindV0,
7244
5007
  KindV1: () => KindV1,
7245
5008
  LLM_TEXT_OUTPUT: () => LLM_TEXT_OUTPUT,
7246
5009
  LLM_USER_MESSAGE_TEXT: () => LLM_USER_MESSAGE_TEXT,
7247
- NodeTypes: () => NodeTypes,
7248
5010
  NodeTypesV1: () => NodeTypesV1,
7249
5011
  RouterV1: () => RouterV1,
7250
5012
  ToolExecutionModes: () => ToolExecutionModes,
5013
+ WorkflowBuilderV1: () => WorkflowBuilderV1,
7251
5014
  bindFrom: () => bindFrom,
7252
5015
  bindToPlaceholder: () => bindToPlaceholder,
7253
5016
  bindToPointer: () => bindToPointer,
@@ -7260,7 +5023,8 @@ __export(workflow_exports, {
7260
5023
  whenOutputMatches: () => whenOutputMatches,
7261
5024
  whenStatusEquals: () => whenStatusEquals,
7262
5025
  whenStatusExists: () => whenStatusExists,
7263
- whenStatusMatches: () => whenStatusMatches
5026
+ whenStatusMatches: () => whenStatusMatches,
5027
+ workflowV1: () => workflowV1
7264
5028
  });
7265
5029
 
7266
5030
  // src/workflow/helpers_v1.ts
@@ -7352,7 +5116,7 @@ var BindingBuilder = class {
7352
5116
  };
7353
5117
 
7354
5118
  // src/workflow/patterns_v1.ts
7355
- function wireRequest3(req) {
5119
+ function wireRequest2(req) {
7356
5120
  const raw = req;
7357
5121
  if (raw && typeof raw === "object") {
7358
5122
  if ("input" in raw) {
@@ -7445,7 +5209,7 @@ var FanoutReduceV1 = class {
7445
5209
  encoding: "json_string"
7446
5210
  }
7447
5211
  ];
7448
- const mapperRequest = wireRequest3(mapper);
5212
+ const mapperRequest = wireRequest2(mapper);
7449
5213
  builder = builder.mapFanout(fanoutId, {
7450
5214
  items: { from: generatorId, path: itemsPath },
7451
5215
  item_bindings: itemBindings,
@@ -7474,13 +5238,7 @@ var FanoutReduceV1 = class {
7474
5238
  };
7475
5239
 
7476
5240
  // src/workflow/index.ts
7477
- var KindV0 = WorkflowKinds.WorkflowV0;
7478
5241
  var KindV1 = WorkflowKinds.WorkflowV1;
7479
- var NodeTypes = {
7480
- LLMResponses: WorkflowNodeTypes.LLMResponses,
7481
- JoinAll: WorkflowNodeTypes.JoinAll,
7482
- TransformJSON: WorkflowNodeTypes.TransformJSON
7483
- };
7484
5242
  var NodeTypesV1 = {
7485
5243
  LLMResponses: WorkflowNodeTypesV1.LLMResponses,
7486
5244
  RouteSwitch: WorkflowNodeTypesV1.RouteSwitch,
@@ -7504,9 +5262,6 @@ var ModelRelay = class _ModelRelay {
7504
5262
  static fromSecretKey(secretKey, options = {}) {
7505
5263
  return new _ModelRelay({ ...options, key: parseSecretKey(secretKey) });
7506
5264
  }
7507
- static fromPublishableKey(publishableKey, options = {}) {
7508
- return new _ModelRelay({ ...options, key: parsePublishableKey(publishableKey) });
7509
- }
7510
5265
  static fromApiKey(apiKey, options = {}) {
7511
5266
  return new _ModelRelay({ ...options, key: parseApiKey(apiKey) });
7512
5267
  }
@@ -7535,7 +5290,6 @@ var ModelRelay = class _ModelRelay {
7535
5290
  const auth = new AuthClient(this.http, {
7536
5291
  apiKey,
7537
5292
  accessToken,
7538
- customer: cfg.customer,
7539
5293
  tokenProvider
7540
5294
  });
7541
5295
  this.auth = auth;
@@ -7553,7 +5307,7 @@ var ModelRelay = class _ModelRelay {
7553
5307
  });
7554
5308
  this.images = new ImagesClient(this.http, auth);
7555
5309
  this.sessions = new SessionsClient(this, this.http, auth);
7556
- this.tiers = new TiersClient(this.http, { apiKey });
5310
+ this.tiers = new TiersClient(this.http, { apiKey, accessToken });
7557
5311
  }
7558
5312
  forCustomer(customerId) {
7559
5313
  return new CustomerScopedModelRelay(this.responses, customerId, this.baseUrl);
@@ -7568,8 +5322,6 @@ export {
7568
5322
  AuthClient,
7569
5323
  BillingProviders,
7570
5324
  BindingTargetError,
7571
- Chain,
7572
- ChainBuilder,
7573
5325
  ConfigError,
7574
5326
  ContentPartTypes,
7575
5327
  CustomerResponsesClient,
@@ -7580,7 +5332,6 @@ export {
7580
5332
  DEFAULT_CONNECT_TIMEOUT_MS,
7581
5333
  DEFAULT_REQUEST_TIMEOUT_MS,
7582
5334
  ErrorCodes,
7583
- FrontendTokenProvider,
7584
5335
  ImagesClient,
7585
5336
  InputItemTypes,
7586
5337
  JoinOutput,
@@ -7592,29 +5343,21 @@ export {
7592
5343
  LLMInputPath,
7593
5344
  LLMInputSystemText,
7594
5345
  LLMInputUserText,
7595
- LLMNodeBuilder,
7596
5346
  LLMOutput,
7597
5347
  LLMOutputContentItemPath,
7598
5348
  LLMOutputContentPath,
7599
5349
  LLMOutputPath,
7600
5350
  LLMOutputText,
7601
- LLMStep,
7602
5351
  LLM_TEXT_OUTPUT,
7603
5352
  LLM_USER_MESSAGE_TEXT,
7604
5353
  LocalSession,
7605
5354
  MapFanoutInputError,
7606
- MapItem,
7607
- MapReduce,
7608
- MapReduceBuilder,
7609
5355
  MemorySessionStore,
7610
5356
  MessageRoles,
7611
5357
  ModelRelay,
7612
5358
  ModelRelayError,
7613
- OIDCExchangeTokenProvider,
7614
5359
  OutputFormatTypes,
7615
5360
  OutputItemTypes,
7616
- Parallel,
7617
- ParallelBuilder,
7618
5361
  PathEscapeError,
7619
5362
  ResponsesClient,
7620
5363
  ResponsesStream,
@@ -7637,15 +5380,13 @@ export {
7637
5380
  ToolRegistry,
7638
5381
  ToolRunner,
7639
5382
  ToolTypes,
7640
- TransformJSONNodeBuilder,
7641
5383
  TransportError,
7642
5384
  WORKFLOWS_COMPILE_PATH,
7643
5385
  WebToolIntents,
7644
- Workflow,
7645
- WorkflowBuilderV0,
7646
5386
  WorkflowBuilderV1,
7647
5387
  WorkflowKinds,
7648
- WorkflowNodeTypes,
5388
+ WorkflowNodeTypesV1 as WorkflowNodeTypes,
5389
+ WorkflowNodeTypesV1,
7649
5390
  WorkflowValidationError,
7650
5391
  WorkflowsClient,
7651
5392
  asModelId,
@@ -7681,17 +5422,10 @@ export {
7681
5422
  getRetryableErrors,
7682
5423
  hasRetryableErrors,
7683
5424
  hasToolCalls,
7684
- isAutoProvisionDisabled,
7685
- isAutoProvisionMisconfigured,
7686
- isEmailRequired,
7687
- isIdentityRequired,
7688
- isProvisioningError,
7689
- isPublishableKey,
7690
5425
  isSecretKey,
7691
5426
  mergeMetrics,
7692
5427
  mergeTrace,
7693
5428
  modelToString,
7694
- newWorkflow,
7695
5429
  normalizeModelId,
7696
5430
  normalizeStopReason,
7697
5431
  outputFormatFromZod,
@@ -7700,7 +5434,6 @@ export {
7700
5434
  parseNodeId,
7701
5435
  parseOutputName,
7702
5436
  parsePlanHash,
7703
- parsePublishableKey,
7704
5437
  parseRunId,
7705
5438
  parseSecretKey,
7706
5439
  parseToolArgs,
@@ -7712,17 +5445,11 @@ export {
7712
5445
  toolChoiceRequired,
7713
5446
  toolResultMessage,
7714
5447
  transformJSONMerge,
7715
- transformJSONMergeV1,
7716
5448
  transformJSONObject,
7717
- transformJSONObjectV1,
7718
5449
  transformJSONValue,
7719
- transformJSONValueV1,
7720
5450
  tryParseToolArgs,
7721
5451
  validateWithZod,
7722
5452
  workflow_exports as workflow,
7723
- workflowV0,
7724
- workflow_v0_schema_default as workflowV0Schema,
7725
5453
  workflowV1,
7726
- workflow_v1_schema_default as workflowV1Schema,
7727
5454
  zodToJsonSchema
7728
5455
  };