@runtypelabs/sdk 4.13.1 → 4.15.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.cjs CHANGED
@@ -57,6 +57,9 @@ __export(index_exports, {
57
57
  LEDGER_ARTIFACT_LINE_PREFIX: () => LEDGER_ARTIFACT_LINE_PREFIX,
58
58
  LogsEndpoint: () => LogsEndpoint,
59
59
  ModelConfigsEndpoint: () => ModelConfigsEndpoint,
60
+ ProductDriftError: () => ProductDriftError,
61
+ ProductEnsureConflictError: () => ProductEnsureConflictError,
62
+ ProductsNamespace: () => ProductsNamespace,
60
63
  PromptRunner: () => PromptRunner,
61
64
  PromptsEndpoint: () => PromptsEndpoint,
62
65
  PromptsNamespace: () => PromptsNamespace,
@@ -88,6 +91,7 @@ __export(index_exports, {
88
91
  compileWorkflowConfig: () => compileWorkflowConfig,
89
92
  computeAgentContentHash: () => computeAgentContentHash,
90
93
  computeFlowContentHash: () => computeFlowContentHash,
94
+ computeProductContentHash: () => computeProductContentHash,
91
95
  computeToolContentHash: () => computeToolContentHash,
92
96
  createClient: () => createClient,
93
97
  createExternalTool: () => createExternalTool,
@@ -96,6 +100,7 @@ __export(index_exports, {
96
100
  defineAgent: () => defineAgent,
97
101
  defineFlow: () => defineFlow,
98
102
  definePlaybook: () => definePlaybook,
103
+ defineProduct: () => defineProduct,
99
104
  defineTool: () => defineTool,
100
105
  deployWorkflow: () => deployWorkflow,
101
106
  ensureDefaultWorkflowHooks: () => ensureDefaultWorkflowHooks,
@@ -112,6 +117,7 @@ __export(index_exports, {
112
117
  listWorkflowHooks: () => listWorkflowHooks,
113
118
  normalizeAgentDefinition: () => normalizeAgentDefinition,
114
119
  normalizeCandidatePath: () => normalizeCandidatePath,
120
+ normalizeProductDefinition: () => normalizeProductDefinition,
115
121
  normalizeToolDefinition: () => normalizeToolDefinition,
116
122
  parseFinalBuffer: () => parseFinalBuffer,
117
123
  parseLedgerArtifactRelativePath: () => parseLedgerArtifactRelativePath,
@@ -1225,20 +1231,20 @@ var FlowBuilder = class {
1225
1231
  */
1226
1232
  build() {
1227
1233
  const flow = this.existingFlowId ? { id: this.existingFlowId } : { name: this.flowConfig.name, steps: this.steps };
1228
- const request3 = { flow };
1234
+ const request4 = { flow };
1229
1235
  if (this.recordConfig) {
1230
- request3.record = this.recordConfig;
1236
+ request4.record = this.recordConfig;
1231
1237
  }
1232
1238
  if (this.messagesConfig) {
1233
- request3.messages = this.messagesConfig;
1239
+ request4.messages = this.messagesConfig;
1234
1240
  }
1235
1241
  if (this.inputsConfig) {
1236
- request3.inputs = this.inputsConfig;
1242
+ request4.inputs = this.inputsConfig;
1237
1243
  }
1238
1244
  if (Object.keys(this.optionsConfig).length > 0) {
1239
- request3.options = this.optionsConfig;
1245
+ request4.options = this.optionsConfig;
1240
1246
  }
1241
- return request3;
1247
+ return request4;
1242
1248
  }
1243
1249
  /**
1244
1250
  * Validate this prospective flow against the public validation endpoint
@@ -2632,15 +2638,15 @@ var RuntypeFlowBuilder = class {
2632
2638
  build() {
2633
2639
  const flowMode = this.mode === "existing" ? "existing" : this.mode;
2634
2640
  const flow = this.existingFlowId ? { id: this.existingFlowId } : { name: this.flowConfig.name, steps: this.steps };
2635
- const request3 = { flow };
2641
+ const request4 = { flow };
2636
2642
  if (this.recordConfig) {
2637
- request3.record = this.recordConfig;
2643
+ request4.record = this.recordConfig;
2638
2644
  }
2639
2645
  if (this.messagesConfig) {
2640
- request3.messages = this.messagesConfig;
2646
+ request4.messages = this.messagesConfig;
2641
2647
  }
2642
2648
  if (this.inputsConfig) {
2643
- request3.inputs = this.inputsConfig;
2649
+ request4.inputs = this.inputsConfig;
2644
2650
  }
2645
2651
  const options = {
2646
2652
  flowMode,
@@ -2658,8 +2664,8 @@ var RuntypeFlowBuilder = class {
2658
2664
  if (this.mode === "upsert" && Object.keys(this.upsertOptions).length > 0) {
2659
2665
  options.upsertOptions = this.upsertOptions;
2660
2666
  }
2661
- request3.options = options;
2662
- return request3;
2667
+ request4.options = options;
2668
+ return request4;
2663
2669
  }
2664
2670
  /**
2665
2671
  * Validate this prospective flow against the public validation endpoint
@@ -3442,6 +3448,7 @@ var AGENT_CONFIG_KEYS = [
3442
3448
  "model",
3443
3449
  "systemPrompt",
3444
3450
  "temperature",
3451
+ "maxTokens",
3445
3452
  "topP",
3446
3453
  "topK",
3447
3454
  "frequencyPenalty",
@@ -3939,6 +3946,219 @@ var ToolsNamespace = class {
3939
3946
  }
3940
3947
  };
3941
3948
 
3949
+ // src/products-ensure.ts
3950
+ function isPlainObject4(value) {
3951
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3952
+ }
3953
+ function normalizeValue3(value) {
3954
+ if (Array.isArray(value)) {
3955
+ return value.map((item) => normalizeValue3(item));
3956
+ }
3957
+ if (isPlainObject4(value)) {
3958
+ const normalized = {};
3959
+ for (const key of Object.keys(value).sort()) {
3960
+ const entry = value[key];
3961
+ if (entry === void 0 || entry === null) continue;
3962
+ normalized[key] = normalizeValue3(entry);
3963
+ }
3964
+ return normalized;
3965
+ }
3966
+ return value;
3967
+ }
3968
+ function normalizeProductDefinition(definition) {
3969
+ const spec = isPlainObject4(definition.spec) ? normalizeValue3(definition.spec) : {};
3970
+ return {
3971
+ ...definition.description ? { description: definition.description } : {},
3972
+ ...definition.icon ? { icon: definition.icon } : {},
3973
+ spec
3974
+ };
3975
+ }
3976
+ async function computeProductContentHash(definition) {
3977
+ const serialized = JSON.stringify(normalizeProductDefinition(definition));
3978
+ const encoded = new TextEncoder().encode(serialized);
3979
+ const hashBuffer = await crypto.subtle.digest("SHA-256", encoded);
3980
+ return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
3981
+ }
3982
+ var DEFINE_PRODUCT_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set(["name", "description", "icon", "spec"]);
3983
+ function defineProduct(input) {
3984
+ if (!input || typeof input !== "object") {
3985
+ throw new Error("defineProduct requires a definition object");
3986
+ }
3987
+ if (typeof input.name !== "string" || input.name.length === 0) {
3988
+ throw new Error('defineProduct requires a non-empty string "name"');
3989
+ }
3990
+ if (input.description != null && typeof input.description !== "string") {
3991
+ throw new Error('defineProduct "description" must be a string when provided');
3992
+ }
3993
+ if (input.icon != null && typeof input.icon !== "string") {
3994
+ throw new Error('defineProduct "icon" must be a string when provided');
3995
+ }
3996
+ if (input.spec != null && !isPlainObject4(input.spec)) {
3997
+ throw new Error('defineProduct "spec" must be an object when provided');
3998
+ }
3999
+ const unknownKeys = Object.keys(input).filter((key) => !DEFINE_PRODUCT_TOP_LEVEL_KEYS.has(key));
4000
+ if (unknownKeys.length > 0) {
4001
+ throw new Error(
4002
+ `defineProduct: unknown field(s): ${unknownKeys.join(", ")}. Allowed fields are name, description, icon, spec. (canvas / nested capabilities and surfaces are not converged by ensure.)`
4003
+ );
4004
+ }
4005
+ return {
4006
+ name: input.name,
4007
+ ...input.description !== void 0 ? { description: input.description } : {},
4008
+ ...input.icon !== void 0 ? { icon: input.icon } : {},
4009
+ ...input.spec !== void 0 ? { spec: input.spec } : {}
4010
+ };
4011
+ }
4012
+ var ProductEnsureConflictError = class extends Error {
4013
+ constructor(body) {
4014
+ super(body.error ?? `Product ensure conflict: ${body.code}`);
4015
+ this.name = "ProductEnsureConflictError";
4016
+ this.code = body.code;
4017
+ this.lastModifiedSource = body.lastModifiedSource;
4018
+ this.modifiedAt = body.modifiedAt;
4019
+ this.currentHash = body.currentHash;
4020
+ }
4021
+ };
4022
+ var ProductDriftError = class extends Error {
4023
+ constructor(plan) {
4024
+ super(
4025
+ `Product "${plan.productId ?? "definition"}" drifted: plan is '${plan.changes}' (changed: ${plan.changedKeys.join(", ") || "n/a"}). Run client.products.pull(name) to absorb the remote edit into your repo, or re-run ensure to converge.`
4026
+ );
4027
+ this.name = "ProductDriftError";
4028
+ this.plan = plan;
4029
+ }
4030
+ };
4031
+ function parseRequestError4(err) {
4032
+ if (!(err instanceof Error)) return { status: null, body: null };
4033
+ const match = err.message.match(/^API request failed: (\d{3}) .*? - ([\s\S]*)$/);
4034
+ if (!match) return { status: null, body: null };
4035
+ try {
4036
+ return { status: Number(match[1]), body: JSON.parse(match[2]) };
4037
+ } catch {
4038
+ return { status: Number(match[1]), body: null };
4039
+ }
4040
+ }
4041
+ function toConflictError4(err) {
4042
+ const { status, body } = parseRequestError4(err);
4043
+ if (status !== 409 || !isPlainObject4(body)) return null;
4044
+ const code = body.code;
4045
+ if (code !== "external_modification" && code !== "remote_changed") return null;
4046
+ return new ProductEnsureConflictError(
4047
+ body
4048
+ );
4049
+ }
4050
+ var serverHashMemo4 = /* @__PURE__ */ new WeakMap();
4051
+ function memoFor4(client) {
4052
+ let memo = serverHashMemo4.get(client);
4053
+ if (!memo) {
4054
+ memo = /* @__PURE__ */ new Map();
4055
+ serverHashMemo4.set(client, memo);
4056
+ }
4057
+ return memo;
4058
+ }
4059
+ function memoize3(memo, memoKey, result) {
4060
+ if (result.result !== "plan") memo.set(memoKey, result.contentHash);
4061
+ }
4062
+ async function request3(client, body) {
4063
+ try {
4064
+ return await client.post(
4065
+ "/products/ensure",
4066
+ body
4067
+ );
4068
+ } catch (err) {
4069
+ const conflict = toConflictError4(err);
4070
+ if (conflict) throw conflict;
4071
+ throw err;
4072
+ }
4073
+ }
4074
+ async function ensureProduct(client, definition, options = {}) {
4075
+ const { dryRun, onConflict, expectedRemoteHash, expectNoChanges } = options;
4076
+ const passthrough = {
4077
+ ...onConflict ? { onConflict } : {},
4078
+ ...expectedRemoteHash ? { expectedRemoteHash } : {}
4079
+ };
4080
+ if (dryRun || expectNoChanges) {
4081
+ const plan = await request3(client, {
4082
+ name: definition.name,
4083
+ definition,
4084
+ dryRun: true,
4085
+ ...passthrough
4086
+ });
4087
+ if (plan.result !== "plan") {
4088
+ throw new Error(`Expected a plan result from dryRun, got '${plan.result}'`);
4089
+ }
4090
+ if (expectNoChanges && plan.changes !== "none") {
4091
+ throw new ProductDriftError(plan);
4092
+ }
4093
+ return plan;
4094
+ }
4095
+ const memo = memoFor4(client);
4096
+ const localHash = await computeProductContentHash(definition);
4097
+ const memoKey = `${definition.name} ${localHash}`;
4098
+ const contentHash = memo.get(memoKey) ?? localHash;
4099
+ const probe = await request3(client, {
4100
+ name: definition.name,
4101
+ contentHash,
4102
+ ...passthrough
4103
+ });
4104
+ if (probe.result !== "definitionRequired") {
4105
+ memoize3(memo, memoKey, probe);
4106
+ return probe;
4107
+ }
4108
+ const converged = await request3(client, {
4109
+ name: definition.name,
4110
+ definition,
4111
+ ...passthrough
4112
+ });
4113
+ if (converged.result === "definitionRequired") {
4114
+ throw new Error("Server reported definitionRequired for a full-definition request");
4115
+ }
4116
+ memoize3(memo, memoKey, converged);
4117
+ return converged;
4118
+ }
4119
+ async function pullProduct(client, name) {
4120
+ return client.get("/products/pull", { name });
4121
+ }
4122
+
4123
+ // src/products-namespace.ts
4124
+ var ProductsNamespace = class {
4125
+ constructor(getClient) {
4126
+ this.getClient = getClient;
4127
+ }
4128
+ /**
4129
+ * Idempotently converge a `defineProduct` definition onto the platform.
4130
+ * Hash-first: the steady state is one tiny probe request. Creates or updates
4131
+ * the top-level product record; never deletes. Identity is name + account
4132
+ * scope.
4133
+ *
4134
+ * @example
4135
+ * ```typescript
4136
+ * const product = defineProduct({
4137
+ * name: 'Support Copilot',
4138
+ * description: 'An AI support assistant',
4139
+ * icon: '🤖',
4140
+ * spec: { productGoal: 'Deflect tier-1 tickets', productStage: 'beta' },
4141
+ * })
4142
+ *
4143
+ * // Converge (CI/deploy).
4144
+ * const result = await Runtype.products.ensure(product)
4145
+ *
4146
+ * // PR drift gate.
4147
+ * await Runtype.products.ensure(product, { expectNoChanges: true })
4148
+ * ```
4149
+ */
4150
+ async ensure(definition, options = {}) {
4151
+ return ensureProduct(this.getClient(), definition, options);
4152
+ }
4153
+ /**
4154
+ * Pull the canonical definition + provenance for a product by name — the
4155
+ * absorb-drift direction of the ensure protocol.
4156
+ */
4157
+ async pull(name) {
4158
+ return pullProduct(this.getClient(), name);
4159
+ }
4160
+ };
4161
+
3942
4162
  // src/transform.ts
3943
4163
  function transformResponse(data) {
3944
4164
  return data;
@@ -4355,6 +4575,37 @@ var Runtype = class {
4355
4575
  static get tools() {
4356
4576
  return new ToolsNamespace(() => this.getClient());
4357
4577
  }
4578
+ /**
4579
+ * Products namespace - Product config-as-code (define / ensure / pull)
4580
+ *
4581
+ * Converges the top-level product record (description, icon, spec). Nested
4582
+ * capabilities/surfaces/tools and the canvas UI layout state are not
4583
+ * converged by ensure.
4584
+ *
4585
+ * @example
4586
+ * ```typescript
4587
+ * import { defineProduct, Runtype } from '@runtypelabs/sdk'
4588
+ *
4589
+ * const product = defineProduct({
4590
+ * name: 'Support Copilot',
4591
+ * description: 'An AI support assistant',
4592
+ * icon: '🤖',
4593
+ * spec: { productGoal: 'Deflect tier-1 tickets', productStage: 'beta' },
4594
+ * })
4595
+ *
4596
+ * // Converge at deploy time (idempotent; one tiny probe in steady state)
4597
+ * await Runtype.products.ensure(product)
4598
+ *
4599
+ * // CI drift gate
4600
+ * await Runtype.products.ensure(product, { expectNoChanges: true })
4601
+ *
4602
+ * // Absorb a dashboard edit back into the repo
4603
+ * const { definition } = await Runtype.products.pull('Support Copilot')
4604
+ * ```
4605
+ */
4606
+ static get products() {
4607
+ return new ProductsNamespace(() => this.getClient());
4608
+ }
4358
4609
  };
4359
4610
 
4360
4611
  // src/generated-tool-gate.ts
@@ -4577,8 +4828,8 @@ function buildGeneratedRuntimeToolGateOutput(proposal, options = {}) {
4577
4828
  ...decision.tool ? { tool: decision.tool } : {}
4578
4829
  };
4579
4830
  }
4580
- function attachRuntimeToolsToDispatchRequest(request3, runtimeTools, options = {}) {
4581
- const stepList = request3.flow.steps;
4831
+ function attachRuntimeToolsToDispatchRequest(request4, runtimeTools, options = {}) {
4832
+ const stepList = request4.flow.steps;
4582
4833
  if (!stepList || !Array.isArray(stepList) || stepList.length === 0) {
4583
4834
  throw new Error("Cannot attach runtime tools: dispatch request must include flow.steps");
4584
4835
  }
@@ -4621,9 +4872,9 @@ function attachRuntimeToolsToDispatchRequest(request3, runtimeTools, options = {
4621
4872
  }
4622
4873
  };
4623
4874
  return {
4624
- ...request3,
4875
+ ...request4,
4625
4876
  flow: {
4626
- ...request3.flow,
4877
+ ...request4.flow,
4627
4878
  // `clonedSteps` is a structural clone of `request.flow.steps` (already
4628
4879
  // `FlowStepDefinition[]`); only the prompt step's `config.tools` was
4629
4880
  // merged, so every step's `type` discriminant is preserved. The clone is
@@ -4633,12 +4884,12 @@ function attachRuntimeToolsToDispatchRequest(request3, runtimeTools, options = {
4633
4884
  }
4634
4885
  };
4635
4886
  }
4636
- function applyGeneratedRuntimeToolProposalToDispatchRequest(request3, proposal, options = {}) {
4887
+ function applyGeneratedRuntimeToolProposalToDispatchRequest(request4, proposal, options = {}) {
4637
4888
  const decision = evaluateGeneratedRuntimeToolProposal(proposal, options.gate);
4638
4889
  if (!decision.approved || !decision.tool) {
4639
- return { decision, request: request3 };
4890
+ return { decision, request: request4 };
4640
4891
  }
4641
- const nextRequest = attachRuntimeToolsToDispatchRequest(request3, [decision.tool], options.attach);
4892
+ const nextRequest = attachRuntimeToolsToDispatchRequest(request4, [decision.tool], options.attach);
4642
4893
  return {
4643
4894
  decision,
4644
4895
  request: nextRequest
@@ -6888,15 +7139,15 @@ var DispatchEndpoint = class {
6888
7139
  * Attach approved runtime tools to a prompt step in a redispatch request.
6889
7140
  * Returns a new request object and does not mutate the original.
6890
7141
  */
6891
- attachApprovedRuntimeTools(request3, runtimeTools, options) {
6892
- return attachRuntimeToolsToDispatchRequest(request3, runtimeTools, options);
7142
+ attachApprovedRuntimeTools(request4, runtimeTools, options) {
7143
+ return attachRuntimeToolsToDispatchRequest(request4, runtimeTools, options);
6893
7144
  }
6894
7145
  /**
6895
7146
  * Validate a generated runtime tool proposal and attach it to the redispatch
6896
7147
  * request if approved, in one call.
6897
7148
  */
6898
- applyGeneratedRuntimeToolProposal(request3, proposal, options) {
6899
- return applyGeneratedRuntimeToolProposalToDispatchRequest(request3, proposal, options);
7149
+ applyGeneratedRuntimeToolProposal(request4, proposal, options) {
7150
+ return applyGeneratedRuntimeToolProposalToDispatchRequest(request4, proposal, options);
6900
7151
  }
6901
7152
  };
6902
7153
  var ChatEndpoint = class {
@@ -7448,8 +7699,8 @@ var GENERATED_RUNTIME_TOOL_PROPOSAL_SCHEMA = {
7448
7699
  },
7449
7700
  required: ["name", "description", "toolType", "parametersSchema", "config"]
7450
7701
  };
7451
- function appendRuntimeToolsToAgentRequest(request3, runtimeTools) {
7452
- const existing = request3.tools?.runtimeTools || [];
7702
+ function appendRuntimeToolsToAgentRequest(request4, runtimeTools) {
7703
+ const existing = request4.tools?.runtimeTools || [];
7453
7704
  const existingNames = new Set(existing.map((tool) => tool.name));
7454
7705
  const converted = runtimeTools.filter((tool) => !existingNames.has(tool.name)).map((tool) => ({
7455
7706
  name: tool.name,
@@ -7459,9 +7710,9 @@ function appendRuntimeToolsToAgentRequest(request3, runtimeTools) {
7459
7710
  ...tool.config ? { config: tool.config } : {}
7460
7711
  }));
7461
7712
  return {
7462
- ...request3,
7713
+ ...request4,
7463
7714
  tools: {
7464
- ...request3.tools,
7715
+ ...request4.tools,
7465
7716
  runtimeTools: [...existing, ...converted]
7466
7717
  }
7467
7718
  };
@@ -7537,21 +7788,21 @@ var _AgentsEndpoint = class _AgentsEndpoint {
7537
7788
  * Attach approved runtime tools to an agent execute request.
7538
7789
  * Returns a new request object and does not mutate the original.
7539
7790
  */
7540
- attachApprovedRuntimeTools(request3, runtimeTools) {
7541
- return appendRuntimeToolsToAgentRequest(request3, runtimeTools);
7791
+ attachApprovedRuntimeTools(request4, runtimeTools) {
7792
+ return appendRuntimeToolsToAgentRequest(request4, runtimeTools);
7542
7793
  }
7543
7794
  /**
7544
7795
  * Validate a generated runtime tool proposal and append it to an agent execute
7545
7796
  * request if approved, in one call.
7546
7797
  */
7547
- applyGeneratedRuntimeToolProposal(request3, proposal, options) {
7798
+ applyGeneratedRuntimeToolProposal(request4, proposal, options) {
7548
7799
  const decision = evaluateGeneratedRuntimeToolProposal(proposal, options);
7549
7800
  if (!decision.approved || !decision.tool) {
7550
- return { decision, request: request3 };
7801
+ return { decision, request: request4 };
7551
7802
  }
7552
7803
  return {
7553
7804
  decision,
7554
- request: appendRuntimeToolsToAgentRequest(request3, [decision.tool])
7805
+ request: appendRuntimeToolsToAgentRequest(request4, [decision.tool])
7555
7806
  };
7556
7807
  }
7557
7808
  /**
@@ -10787,7 +11038,7 @@ var RuntypeClient2 = class {
10787
11038
  clearApiKey() {
10788
11039
  delete this.headers.Authorization;
10789
11040
  }
10790
- async runWithLocalTools(request3, localTools, arg3, arg4) {
11041
+ async runWithLocalTools(request4, localTools, arg3, arg4) {
10791
11042
  const isOptionsObject = (val) => typeof val === "object" && val !== null && "scope" in val;
10792
11043
  const callbacks = isOptionsObject(arg3) ? void 0 : arg3;
10793
11044
  const options = (isOptionsObject(arg3) ? arg3 : arg4) ?? {};
@@ -10801,12 +11052,12 @@ var RuntypeClient2 = class {
10801
11052
  ...entry.pageOrigin ? { pageOrigin: entry.pageOrigin } : {}
10802
11053
  })) : [];
10803
11054
  const modifiedRequest = {
10804
- ...request3,
11055
+ ...request4,
10805
11056
  ...derivedClientTools.length > 0 ? {
10806
- clientTools: [...request3.clientTools ?? [], ...derivedClientTools]
11057
+ clientTools: [...request4.clientTools ?? [], ...derivedClientTools]
10807
11058
  } : {},
10808
11059
  options: {
10809
- ...request3.options || {},
11060
+ ...request4.options || {},
10810
11061
  streamResponse: isStreaming
10811
11062
  }
10812
11063
  };
@@ -11244,20 +11495,20 @@ var BatchBuilder = class {
11244
11495
  if (!this.recordType) {
11245
11496
  throw new Error("BatchBuilder: recordType is required. Call .forRecordType(type) first.");
11246
11497
  }
11247
- const request3 = {
11498
+ const request4 = {
11248
11499
  flowId: this.flowId,
11249
11500
  recordType: this.recordType
11250
11501
  };
11251
11502
  if (Object.keys(this.batchOptions).length > 0) {
11252
- request3.options = this.batchOptions;
11503
+ request4.options = this.batchOptions;
11253
11504
  }
11254
11505
  if (this.filterConfig) {
11255
- request3.filter = this.filterConfig;
11506
+ request4.filter = this.filterConfig;
11256
11507
  }
11257
11508
  if (this.limitConfig !== void 0) {
11258
- request3.limit = this.limitConfig;
11509
+ request4.limit = this.limitConfig;
11259
11510
  }
11260
- return request3;
11511
+ return request4;
11261
11512
  }
11262
11513
  /**
11263
11514
  * Execute the batch operation
@@ -11414,32 +11665,32 @@ var EvalBuilder = class {
11414
11665
  "EvalBuilder: records are required. Call .forRecordType(type) or .withRecords([...]) first."
11415
11666
  );
11416
11667
  }
11417
- const request3 = {};
11668
+ const request4 = {};
11418
11669
  if (this.flowId) {
11419
- request3.flowId = this.flowId;
11670
+ request4.flowId = this.flowId;
11420
11671
  } else if (this.virtualFlow) {
11421
- request3.flow = this.virtualFlow;
11672
+ request4.flow = this.virtualFlow;
11422
11673
  }
11423
11674
  if (this.recordType) {
11424
- request3.recordType = this.recordType;
11675
+ request4.recordType = this.recordType;
11425
11676
  } else if (this.inlineRecords) {
11426
- request3.records = this.inlineRecords;
11677
+ request4.records = this.inlineRecords;
11427
11678
  }
11428
11679
  if (this.modelOverrides) {
11429
- request3.modelOverrides = this.modelOverrides;
11680
+ request4.modelOverrides = this.modelOverrides;
11430
11681
  } else if (this.modelConfigs) {
11431
- request3.modelConfigs = this.modelConfigs;
11682
+ request4.modelConfigs = this.modelConfigs;
11432
11683
  }
11433
11684
  if (Object.keys(this.evalOptions).length > 0) {
11434
- request3.options = this.evalOptions;
11685
+ request4.options = this.evalOptions;
11435
11686
  }
11436
11687
  if (this.filterConfig) {
11437
- request3.filter = this.filterConfig;
11688
+ request4.filter = this.filterConfig;
11438
11689
  }
11439
11690
  if (this.limitConfig !== void 0) {
11440
- request3.limit = this.limitConfig;
11691
+ request4.limit = this.limitConfig;
11441
11692
  }
11442
- return request3;
11693
+ return request4;
11443
11694
  }
11444
11695
  /**
11445
11696
  * Execute the evaluation
@@ -11943,6 +12194,9 @@ var STEP_TYPE_TO_METHOD = {
11943
12194
  LEDGER_ARTIFACT_LINE_PREFIX,
11944
12195
  LogsEndpoint,
11945
12196
  ModelConfigsEndpoint,
12197
+ ProductDriftError,
12198
+ ProductEnsureConflictError,
12199
+ ProductsNamespace,
11946
12200
  PromptRunner,
11947
12201
  PromptsEndpoint,
11948
12202
  PromptsNamespace,
@@ -11974,6 +12228,7 @@ var STEP_TYPE_TO_METHOD = {
11974
12228
  compileWorkflowConfig,
11975
12229
  computeAgentContentHash,
11976
12230
  computeFlowContentHash,
12231
+ computeProductContentHash,
11977
12232
  computeToolContentHash,
11978
12233
  createClient,
11979
12234
  createExternalTool,
@@ -11982,6 +12237,7 @@ var STEP_TYPE_TO_METHOD = {
11982
12237
  defineAgent,
11983
12238
  defineFlow,
11984
12239
  definePlaybook,
12240
+ defineProduct,
11985
12241
  defineTool,
11986
12242
  deployWorkflow,
11987
12243
  ensureDefaultWorkflowHooks,
@@ -11998,6 +12254,7 @@ var STEP_TYPE_TO_METHOD = {
11998
12254
  listWorkflowHooks,
11999
12255
  normalizeAgentDefinition,
12000
12256
  normalizeCandidatePath,
12257
+ normalizeProductDefinition,
12001
12258
  normalizeToolDefinition,
12002
12259
  parseFinalBuffer,
12003
12260
  parseLedgerArtifactRelativePath,