@valerypopoff/rivet2-core 2.0.3 → 2.0.5

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @valerypopoff/rivet2-core
2
2
 
3
- Shared graph model, execution engine, built-in nodes, serialization, provider integrations, plugin assembly, and runtime contracts for Rivet 2.0.
3
+ Shared graph model, execution engine, built-in nodes, serialization, provider integrations, plugin assembly, and runtime contracts for Rivet 2.
4
4
 
5
5
  This package is the foundation used by the Rivet app, Node runtime, CLI, app executor, and Trivet tooling.
6
6
 
@@ -4894,7 +4894,8 @@ var TextNodeImpl = class extends NodeImpl {
4894
4894
  label: "",
4895
4895
  dataKey: "text",
4896
4896
  language: "prompt-interpolation-markdown",
4897
- theme: "prompt-interpolation"
4897
+ theme: "prompt-interpolation",
4898
+ showTextStats: true
4898
4899
  },
4899
4900
  {
4900
4901
  type: "toggle",
@@ -10574,7 +10575,6 @@ var llmChatV2Node = nodeDefinition(LLMChatV2NodeImpl, "LLM Chat");
10574
10575
 
10575
10576
  // src/model/nodes/PromptNode.ts
10576
10577
  var import_non_secure9 = require("nanoid/non-secure");
10577
- var import_lodash_es9 = require("lodash");
10578
10578
  var import_ts_dedent6 = require("ts-dedent");
10579
10579
  var import_ts_pattern3 = require("ts-pattern");
10580
10580
  var PromptNodeImpl = class extends NodeImpl {
@@ -10676,6 +10676,14 @@ var PromptNodeImpl = class extends NodeImpl {
10676
10676
  dataKey: "type",
10677
10677
  useInputToggleDataKey: "useTypeInput"
10678
10678
  },
10679
+ {
10680
+ type: "code",
10681
+ label: "Prompt Text",
10682
+ dataKey: "promptText",
10683
+ language: "prompt-interpolation-markdown",
10684
+ theme: "prompt-interpolation",
10685
+ showTextStats: true
10686
+ },
10679
10687
  {
10680
10688
  type: "string",
10681
10689
  label: "Name",
@@ -10701,13 +10709,6 @@ var PromptNodeImpl = class extends NodeImpl {
10701
10709
  dataKey: "isCacheBreakpoint",
10702
10710
  helperMessage: "For Anthropic, marks this message as a cache breakpoint - this message and every message before it will be cached using Prompt Caching.",
10703
10711
  useInputToggleDataKey: "useIsCacheBreakpointInput"
10704
- },
10705
- {
10706
- type: "code",
10707
- label: "Prompt Text",
10708
- dataKey: "promptText",
10709
- language: "prompt-interpolation-markdown",
10710
- theme: "prompt-interpolation"
10711
10712
  }
10712
10713
  ];
10713
10714
  }
@@ -10740,7 +10741,13 @@ var PromptNodeImpl = class extends NodeImpl {
10740
10741
  };
10741
10742
  }
10742
10743
  async process(inputs, context) {
10743
- const inputMap = (0, import_lodash_es9.mapValues)(inputs, (input) => coerceType(input, "string"));
10744
+ const inputMap = Object.keys(inputs).reduce(
10745
+ (acc, key) => {
10746
+ acc[key] = coerceTypeOptional(inputs[key], "string") ?? "";
10747
+ return acc;
10748
+ },
10749
+ {}
10750
+ );
10744
10751
  const outputValue = interpolate(
10745
10752
  this.chartNode.data.promptText,
10746
10753
  inputMap,
@@ -11306,7 +11313,7 @@ var CodeNodeImpl = class extends NodeImpl {
11306
11313
  const missingOutputs = this.getOutputDefinitions().filter((output) => !(output.id in outputs));
11307
11314
  if (missingOutputs.length > 0) {
11308
11315
  throw new Error(
11309
- `Code node must return an object with output values for all outputs. To not run an output, return { "type": "control-flow-excluded", "value": undefiend }. To return undefined, return { "type": "any", "value": undefined }. Missing: ${missingOutputs.map((output) => output.id).join(", ")}`
11316
+ `Code node must return an object with output values for all outputs. To not run an output, return { "type": "control-flow-excluded", "value": undefined }. To return undefined, return { "type": "any", "value": undefined }. Missing: ${missingOutputs.map((output) => output.id).join(", ")}`
11310
11317
  );
11311
11318
  }
11312
11319
  return outputs;
@@ -12952,7 +12959,7 @@ var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
12952
12959
 
12953
12960
  // src/model/nodes/ArrayNode.ts
12954
12961
  var import_non_secure22 = require("nanoid/non-secure");
12955
- var import_lodash_es10 = require("lodash");
12962
+ var import_lodash_es9 = require("lodash");
12956
12963
  var import_ts_dedent20 = require("ts-dedent");
12957
12964
  var ArrayNodeImpl = class extends NodeImpl {
12958
12965
  static create() {
@@ -13058,7 +13065,7 @@ var ArrayNodeImpl = class extends NodeImpl {
13058
13065
  if (Array.isArray(input == null ? void 0 : input.value)) {
13059
13066
  for (const value of (input == null ? void 0 : input.value) ?? []) {
13060
13067
  if (this.data.flattenDeep) {
13061
- outputArray.push(...Array.isArray(value) ? (0, import_lodash_es10.flattenDeep)(value) : [value]);
13068
+ outputArray.push(...Array.isArray(value) ? (0, import_lodash_es9.flattenDeep)(value) : [value]);
13062
13069
  } else {
13063
13070
  outputArray.push(value);
13064
13071
  }
@@ -13215,7 +13222,7 @@ function createMatchedOutput(value) {
13215
13222
 
13216
13223
  // src/model/nodes/AssemblePromptNode.ts
13217
13224
  var import_non_secure24 = require("nanoid/non-secure");
13218
- var import_lodash_es11 = require("lodash");
13225
+ var import_lodash_es10 = require("lodash");
13219
13226
  var import_ts_dedent22 = require("ts-dedent");
13220
13227
  var AssemblePromptNodeImpl = class extends NodeImpl {
13221
13228
  static create() {
@@ -13322,7 +13329,7 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
13322
13329
  const output = {};
13323
13330
  const isLastMessageCacheBreakpoint = getInputOrData(this.data, inputs, "isLastMessageCacheBreakpoint", "boolean");
13324
13331
  const outMessages = [];
13325
- const inputMessages = (0, import_lodash_es11.orderBy)(
13332
+ const inputMessages = (0, import_lodash_es10.orderBy)(
13326
13333
  Object.entries(inputs).filter(([key]) => key.startsWith("message")),
13327
13334
  ([key]) => key,
13328
13335
  "asc"
@@ -13876,7 +13883,7 @@ var trimChatMessagesNode = nodeDefinition(TrimChatMessagesNodeImpl, "Trim Chat M
13876
13883
 
13877
13884
  // src/model/nodes/ExternalCallNode.ts
13878
13885
  var import_non_secure28 = require("nanoid/non-secure");
13879
- var import_lodash_es12 = require("lodash");
13886
+ var import_lodash_es11 = require("lodash");
13880
13887
  var import_ts_dedent26 = require("ts-dedent");
13881
13888
  var ExternalCallNodeImpl = class extends NodeImpl {
13882
13889
  static create() {
@@ -13971,7 +13978,7 @@ var ExternalCallNodeImpl = class extends NodeImpl {
13971
13978
  }
13972
13979
  }
13973
13980
  const fn = context.externalFunctions[functionName];
13974
- const externalContext = (0, import_lodash_es12.omit)(context, ["setGlobal"]);
13981
+ const externalContext = (0, import_lodash_es11.omit)(context, ["setGlobal"]);
13975
13982
  if (!fn) {
13976
13983
  if (this.data.useErrorOutput) {
13977
13984
  return {
@@ -14357,13 +14364,19 @@ var contextNode = nodeDefinition(ContextNodeImpl, "Context");
14357
14364
  // src/model/nodes/CoalesceNode.ts
14358
14365
  var import_non_secure32 = require("nanoid/non-secure");
14359
14366
  var import_ts_dedent30 = require("ts-dedent");
14367
+ var INPUT_PORT_ID_PATTERN = /^input(\d+)$/;
14368
+ var IGNORE_NULL_LABEL = "Ignore 'null'";
14369
+ var IGNORE_UNDEFINED_LABEL = "Ignore 'undefined'";
14360
14370
  var CoalesceNodeImpl = class extends NodeImpl {
14361
14371
  static create = () => {
14362
14372
  const chartNode = {
14363
14373
  type: "coalesce",
14364
14374
  title: "Coalesce",
14365
14375
  id: (0, import_non_secure32.nanoid)(),
14366
- data: {},
14376
+ data: {
14377
+ ignoreNull: false,
14378
+ ignoreUndefined: false
14379
+ },
14367
14380
  visualData: {
14368
14381
  x: 0,
14369
14382
  y: 0,
@@ -14398,10 +14411,36 @@ var CoalesceNodeImpl = class extends NodeImpl {
14398
14411
  }
14399
14412
  ];
14400
14413
  }
14414
+ getEditors() {
14415
+ return [
14416
+ {
14417
+ type: "toggle",
14418
+ label: IGNORE_NULL_LABEL,
14419
+ dataKey: "ignoreNull"
14420
+ },
14421
+ {
14422
+ type: "toggle",
14423
+ label: IGNORE_UNDEFINED_LABEL,
14424
+ dataKey: "ignoreUndefined"
14425
+ }
14426
+ ];
14427
+ }
14428
+ getBody() {
14429
+ const ignoredValues = [];
14430
+ if (this.data.ignoreNull) {
14431
+ ignoredValues.push(IGNORE_NULL_LABEL);
14432
+ }
14433
+ if (this.data.ignoreUndefined) {
14434
+ ignoredValues.push(IGNORE_UNDEFINED_LABEL);
14435
+ }
14436
+ return ignoredValues.length > 0 ? ignoredValues.join("\n") : void 0;
14437
+ }
14401
14438
  static getUIData() {
14402
14439
  return {
14403
14440
  infoBoxBody: import_ts_dedent30.dedent`
14404
- Takes in any number of inputs and outputs the first value that exists. Useful for consolidating branches after a Match node. This node can also "consume" the "Not Ran" value.
14441
+ Takes in any number of inputs and outputs the first value that is not "Not Ran". Useful for consolidating branches after a Match node.
14442
+
14443
+ Null and undefined input values are emitted by default, but the node can be configured to skip either value and continue checking later inputs.
14405
14444
  `,
14406
14445
  infoBoxTitle: "Coalesce Node",
14407
14446
  contextMenuTitle: "Coalesce",
@@ -14410,14 +14449,14 @@ var CoalesceNodeImpl = class extends NodeImpl {
14410
14449
  }
14411
14450
  #getInputPortCount(connections) {
14412
14451
  const inputNodeId = this.chartNode.id;
14413
- const inputConnections = connections.filter(
14414
- (connection) => connection.inputNodeId === inputNodeId && connection.inputId.startsWith("input")
14415
- );
14416
14452
  let maxInputNumber = 0;
14417
- for (const connection of inputConnections) {
14418
- const messageNumber = parseInt(connection.inputId.replace("input", ""), 10);
14419
- if (messageNumber > maxInputNumber) {
14420
- maxInputNumber = messageNumber;
14453
+ for (const connection of connections) {
14454
+ if (connection.inputNodeId !== inputNodeId) {
14455
+ continue;
14456
+ }
14457
+ const inputNumber = this.#getInputPortNumber(connection.inputId);
14458
+ if (inputNumber && inputNumber > maxInputNumber) {
14459
+ maxInputNumber = inputNumber;
14421
14460
  }
14422
14461
  }
14423
14462
  return maxInputNumber + 1;
@@ -14432,26 +14471,44 @@ var CoalesceNodeImpl = class extends NodeImpl {
14432
14471
  }
14433
14472
  };
14434
14473
  }
14435
- const inputCount = Object.keys(inputData).filter((key) => key.startsWith("input")).length;
14436
- const okInputValues = [];
14474
+ const inputCount = this.#getInputCountFromValues(inputData);
14437
14475
  for (let i = 1; i <= inputCount; i++) {
14438
14476
  const inputValue = inputData[`input${i}`];
14439
- if (inputValue && inputValue.type !== "control-flow-excluded" && unwrapDataValue(inputValue) != null) {
14440
- okInputValues.push(inputValue);
14477
+ if (inputValue && inputValue.type !== "control-flow-excluded" && !this.#shouldSkipInputValue(inputValue)) {
14478
+ return {
14479
+ ["output"]: inputValue
14480
+ };
14441
14481
  }
14442
14482
  }
14443
- if (okInputValues.length === 0) {
14444
- return {
14445
- ["output"]: {
14446
- type: "control-flow-excluded",
14447
- value: void 0
14448
- }
14449
- };
14450
- }
14451
14483
  return {
14452
- ["output"]: okInputValues[0]
14484
+ ["output"]: {
14485
+ type: "control-flow-excluded",
14486
+ value: void 0
14487
+ }
14453
14488
  };
14454
14489
  }
14490
+ #getInputCountFromValues(inputData) {
14491
+ let maxInputNumber = 0;
14492
+ for (const inputId of Object.keys(inputData)) {
14493
+ const inputNumber = this.#getInputPortNumber(inputId);
14494
+ if (inputNumber && inputNumber > maxInputNumber) {
14495
+ maxInputNumber = inputNumber;
14496
+ }
14497
+ }
14498
+ return maxInputNumber;
14499
+ }
14500
+ #getInputPortNumber(inputId) {
14501
+ const match10 = INPUT_PORT_ID_PATTERN.exec(inputId);
14502
+ if (!match10) {
14503
+ return void 0;
14504
+ }
14505
+ const inputNumber = Number(match10[1]);
14506
+ return Number.isSafeInteger(inputNumber) && inputNumber > 0 ? inputNumber : void 0;
14507
+ }
14508
+ #shouldSkipInputValue(inputValue) {
14509
+ const value = unwrapDataValue(inputValue).value;
14510
+ return this.data.ignoreNull === true && value === null || this.data.ignoreUndefined === true && value === void 0;
14511
+ }
14455
14512
  };
14456
14513
  var coalesceNode = nodeDefinition(CoalesceNodeImpl, "Coalesce");
14457
14514
 
@@ -16109,7 +16166,7 @@ var joinNode = nodeDefinition(JoinNodeImpl, "Coalesce");
16109
16166
 
16110
16167
  // src/model/nodes/FilterNode.ts
16111
16168
  var import_non_secure49 = require("nanoid/non-secure");
16112
- var import_lodash_es13 = require("lodash");
16169
+ var import_lodash_es12 = require("lodash");
16113
16170
  var import_ts_dedent47 = require("ts-dedent");
16114
16171
  var FilterNodeImpl = class extends NodeImpl {
16115
16172
  static create() {
@@ -16165,7 +16222,7 @@ var FilterNodeImpl = class extends NodeImpl {
16165
16222
  var _a;
16166
16223
  const array = coerceType(inputs["array"], "any[]");
16167
16224
  const include = coerceType(inputs["include"], "boolean[]");
16168
- const zipped = (0, import_lodash_es13.zip)(array, include);
16225
+ const zipped = (0, import_lodash_es12.zip)(array, include);
16169
16226
  const filtered = zipped.filter(([_, include2]) => include2).map(([value, _]) => value);
16170
16227
  return {
16171
16228
  ["filtered"]: {
@@ -16523,6 +16580,44 @@ var import_ts_dedent51 = require("ts-dedent");
16523
16580
  var DEFAULT_JSON_TEMPLATE = `{
16524
16581
  "key": "{{input}}"
16525
16582
  }`;
16583
+ function isEscapedCharacter(value, index) {
16584
+ let backslashCount = 0;
16585
+ for (let i = index - 1; i >= 0 && value[i] === "\\"; i--) {
16586
+ backslashCount++;
16587
+ }
16588
+ return backslashCount % 2 === 1;
16589
+ }
16590
+ function isUnescapedQuoteAt(value, index) {
16591
+ return index >= 0 && index < value.length && value[index] === '"' && !isEscapedCharacter(value, index);
16592
+ }
16593
+ function isInsideJsonString(value, index) {
16594
+ let insideString = false;
16595
+ for (let i = 0; i < index; i++) {
16596
+ if (isUnescapedQuoteAt(value, i)) {
16597
+ insideString = !insideString;
16598
+ }
16599
+ }
16600
+ return insideString;
16601
+ }
16602
+ function stringifyJsonValue(value) {
16603
+ if (value == null) {
16604
+ return "null";
16605
+ }
16606
+ return JSON.stringify(value);
16607
+ }
16608
+ function stringifyWholeQuotedJsonValue(value) {
16609
+ if (value == null) {
16610
+ return "null";
16611
+ }
16612
+ if (typeof value === "string") {
16613
+ return JSON.stringify(value);
16614
+ }
16615
+ return JSON.stringify(JSON.stringify(value));
16616
+ }
16617
+ function stringifyEmbeddedJsonStringFragment(value) {
16618
+ const fragment = value == null ? "null" : typeof value === "string" ? value : JSON.stringify(value) ?? "null";
16619
+ return JSON.stringify(fragment).slice(1, -1);
16620
+ }
16526
16621
  var ObjectNodeImpl = class extends NodeImpl {
16527
16622
  static create() {
16528
16623
  const chartNode = {
@@ -16599,12 +16694,11 @@ var ObjectNodeImpl = class extends NodeImpl {
16599
16694
  let result = "";
16600
16695
  let cursor = 0;
16601
16696
  for (const tokenSpan of tokenSpans) {
16602
- const hasLeadingQuote = tokenSpan.start > 0 && protectedBaseString[tokenSpan.start - 1] === '"';
16603
- const hasTrailingQuote = tokenSpan.end < protectedBaseString.length && protectedBaseString[tokenSpan.end] === '"';
16604
- const replacementStart = hasLeadingQuote ? tokenSpan.start - 1 : tokenSpan.start;
16605
- const replacementEnd = hasTrailingQuote ? tokenSpan.end + 1 : tokenSpan.end;
16697
+ const isInsideString = isInsideJsonString(protectedBaseString, tokenSpan.start);
16698
+ const isWholeQuotedToken = isInsideString && isUnescapedQuoteAt(protectedBaseString, tokenSpan.start - 1) && isUnescapedQuoteAt(protectedBaseString, tokenSpan.end);
16699
+ const replacementStart = isWholeQuotedToken ? tokenSpan.start - 1 : tokenSpan.start;
16700
+ const replacementEnd = isWholeQuotedToken ? tokenSpan.end + 1 : tokenSpan.end;
16606
16701
  const trimmedKey = getInterpolationTokenName(tokenSpan.rawInner) ?? tokenSpan.rawInner.trim();
16607
- const isQuoted = hasLeadingQuote;
16608
16702
  let value;
16609
16703
  const graphInputPrefix = "@graphInputs.";
16610
16704
  const contextPrefix = "@context.";
@@ -16615,23 +16709,17 @@ var ObjectNodeImpl = class extends NodeImpl {
16615
16709
  "graphInputs"
16616
16710
  );
16617
16711
  } else if (trimmedKey.startsWith(contextPrefix) && contextValues) {
16618
- value = resolveExpressionRawValue(
16619
- contextValues,
16620
- trimmedKey.substring(contextPrefix.length),
16621
- "context"
16622
- );
16712
+ value = resolveExpressionRawValue(contextValues, trimmedKey.substring(contextPrefix.length), "context");
16623
16713
  } else {
16624
16714
  value = values2[trimmedKey];
16625
16715
  }
16626
16716
  result += protectedBaseString.slice(cursor, replacementStart);
16627
- if (value == null) {
16628
- result += "null";
16629
- } else if (isQuoted && typeof value === "string") {
16630
- result += JSON.stringify(value);
16631
- } else if (isQuoted) {
16632
- result += JSON.stringify(JSON.stringify(value));
16717
+ if (isInsideString && !isWholeQuotedToken) {
16718
+ result += stringifyEmbeddedJsonStringFragment(value);
16719
+ } else if (isWholeQuotedToken) {
16720
+ result += stringifyWholeQuotedJsonValue(value);
16633
16721
  } else {
16634
- result += JSON.stringify(value);
16722
+ result += stringifyJsonValue(value);
16635
16723
  }
16636
16724
  cursor = replacementEnd;
16637
16725
  }
@@ -16739,7 +16827,7 @@ var booleanNode = nodeDefinition(BooleanNodeImpl, "Boolean");
16739
16827
 
16740
16828
  // src/model/nodes/CompareNode.ts
16741
16829
  var import_non_secure54 = require("nanoid/non-secure");
16742
- var import_lodash_es14 = require("lodash");
16830
+ var import_lodash_es13 = require("lodash");
16743
16831
  var import_ts_pattern5 = require("ts-pattern");
16744
16832
  var import_ts_dedent53 = require("ts-dedent");
16745
16833
  var CompareNodeImpl = class extends NodeImpl {
@@ -16852,7 +16940,7 @@ var CompareNodeImpl = class extends NodeImpl {
16852
16940
  return {
16853
16941
  ["output"]: {
16854
16942
  type: "boolean",
16855
- value: (0, import_ts_pattern5.match)(comparisonFunction).with("==", () => (0, import_lodash_es14.isEqual)(value1, value2)).with("!=", () => !(0, import_lodash_es14.isEqual)(value1, value2)).with("<", () => compareValues(value1, value2)["<"]).with(">", () => compareValues(value1, value2)[">"]).with("<=", () => compareValues(value1, value2)["<="]).with(">=", () => compareValues(value1, value2)[">="]).with("and", () => !!(value1 && value2)).with("or", () => !!(value1 || value2)).with("xor", () => !!(value1 ? !value2 : value2)).with("nand", () => !(value1 && value2)).with("nor", () => !(value1 || value2)).with("xnor", () => !(value1 ? !value2 : value2)).exhaustive()
16943
+ value: (0, import_ts_pattern5.match)(comparisonFunction).with("==", () => (0, import_lodash_es13.isEqual)(value1, value2)).with("!=", () => !(0, import_lodash_es13.isEqual)(value1, value2)).with("<", () => compareValues(value1, value2)["<"]).with(">", () => compareValues(value1, value2)[">"]).with("<=", () => compareValues(value1, value2)["<="]).with(">=", () => compareValues(value1, value2)[">="]).with("and", () => !!(value1 && value2)).with("or", () => !!(value1 || value2)).with("xor", () => !!(value1 ? !value2 : value2)).with("nand", () => !(value1 && value2)).with("nor", () => !(value1 || value2)).with("xnor", () => !(value1 ? !value2 : value2)).exhaustive()
16856
16944
  }
16857
16945
  };
16858
16946
  }
@@ -17172,7 +17260,7 @@ var randomNumberNode = nodeDefinition(RandomNumberNodeImpl, "Random number");
17172
17260
 
17173
17261
  // src/model/nodes/ShuffleNode.ts
17174
17262
  var import_non_secure58 = require("nanoid/non-secure");
17175
- var import_lodash_es15 = require("lodash");
17263
+ var import_lodash_es14 = require("lodash");
17176
17264
  var import_ts_dedent57 = require("ts-dedent");
17177
17265
  var ShuffleNodeImpl = class extends NodeImpl {
17178
17266
  static create() {
@@ -17221,7 +17309,7 @@ var ShuffleNodeImpl = class extends NodeImpl {
17221
17309
  var _a;
17222
17310
  const input = inputs["array"];
17223
17311
  const items = input ? isArrayDataValue(input) ? input.value : [input.value] : [];
17224
- const shuffled = (0, import_lodash_es15.shuffle)(items);
17312
+ const shuffled = (0, import_lodash_es14.shuffle)(items);
17225
17313
  return {
17226
17314
  ["shuffled"]: {
17227
17315
  type: ((_a = inputs["array"]) == null ? void 0 : _a.type) ?? "any[]",
@@ -18975,7 +19063,7 @@ var extractMarkdownCodeBlocksNode = nodeDefinition(
18975
19063
 
18976
19064
  // src/model/nodes/AssembleMessageNode.ts
18977
19065
  var import_non_secure67 = require("nanoid/non-secure");
18978
- var import_lodash_es16 = require("lodash");
19066
+ var import_lodash_es15 = require("lodash");
18979
19067
  var import_ts_pattern7 = require("ts-pattern");
18980
19068
  var messageTypeToTitle = {
18981
19069
  assistant: "Assistant",
@@ -19132,7 +19220,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
19132
19220
  ).otherwise(() => {
19133
19221
  throw new Error(`Invalid type: ${type}`);
19134
19222
  });
19135
- const inputParts = (0, import_lodash_es16.orderBy)(
19223
+ const inputParts = (0, import_lodash_es15.orderBy)(
19136
19224
  Object.entries(inputs).filter(([key]) => key.startsWith("part")),
19137
19225
  ([key]) => key,
19138
19226
  "asc"
@@ -19666,9 +19754,9 @@ var import_non_secure72 = require("nanoid/non-secure");
19666
19754
  var import_ts_dedent66 = require("ts-dedent");
19667
19755
 
19668
19756
  // src/api/looseDataValue.ts
19669
- var import_lodash_es17 = require("lodash");
19757
+ var import_lodash_es16 = require("lodash");
19670
19758
  function looseDataValuesToDataValues(values2) {
19671
- return (0, import_lodash_es17.mapValues)(values2, (val) => looseDataValueToDataValue(val));
19759
+ return (0, import_lodash_es16.mapValues)(values2, (val) => looseDataValueToDataValue(val));
19672
19760
  }
19673
19761
  function looseDataValueToDataValue(value) {
19674
19762
  if (typeof value === "string") {
@@ -20908,7 +20996,7 @@ var cronNode = nodeDefinition(CronNodeImpl, "Cron");
20908
20996
  // src/model/nodes/ToTreeNode.ts
20909
20997
  var import_non_secure78 = require("nanoid/non-secure");
20910
20998
  var import_ts_dedent72 = require("ts-dedent");
20911
- var import_lodash_es18 = require("lodash");
20999
+ var import_lodash_es17 = require("lodash");
20912
21000
  var ToTreeNodeImpl = class extends NodeImpl {
20913
21001
  static create() {
20914
21002
  const chartNode = {
@@ -20994,7 +21082,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
20994
21082
  if (!Array.isArray(objects) || objects.length === 0)
20995
21083
  return "";
20996
21084
  let result = "";
20997
- const sortedObjects = this.data.useSortAlphabetically ? (0, import_lodash_es18.sortBy)(objects, (obj) => String((0, import_lodash_es18.get)(obj, "path", ""))) : objects;
21085
+ const sortedObjects = this.data.useSortAlphabetically ? (0, import_lodash_es17.sortBy)(objects, (obj) => String((0, import_lodash_es17.get)(obj, "path", ""))) : objects;
20998
21086
  sortedObjects.forEach((obj, index) => {
20999
21087
  const isLastItem = index === sortedObjects.length - 1;
21000
21088
  const prefix = level === 0 ? "" : isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
@@ -21003,14 +21091,14 @@ var ToTreeNodeImpl = class extends NodeImpl {
21003
21091
  const interpolationVars = matches.reduce(
21004
21092
  (acc, match10) => {
21005
21093
  const key = match10;
21006
- acc[key] = String((0, import_lodash_es18.get)(obj, key, ""));
21094
+ acc[key] = String((0, import_lodash_es17.get)(obj, key, ""));
21007
21095
  return acc;
21008
21096
  },
21009
21097
  {}
21010
21098
  );
21011
21099
  const formattedNode = interpolate(this.data.format, interpolationVars);
21012
21100
  result += indent + prefix + formattedNode + "\n";
21013
- const children = (0, import_lodash_es18.get)(obj, this.data.childrenProperty);
21101
+ const children = (0, import_lodash_es17.get)(obj, this.data.childrenProperty);
21014
21102
  if (Array.isArray(children) && children.length > 0) {
21015
21103
  const newPath = parentPath ? `${parentPath}/${formattedNode}` : formattedNode;
21016
21104
  result += this.buildTree(children, newPath, level + 1, isLastItem);
@@ -22294,7 +22382,7 @@ registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbed
22294
22382
  // src/recording/ExecutionRecorder.ts
22295
22383
  var import_non_secure83 = require("nanoid/non-secure");
22296
22384
  var import_emittery2 = __toESM(require("emittery-0-13"), 1);
22297
- var import_lodash_es19 = require("lodash");
22385
+ var import_lodash_es18 = require("lodash");
22298
22386
  var import_json_stream_es = require("json-stream-es");
22299
22387
 
22300
22388
  // src/vendor/fnv1a.js
@@ -22455,16 +22543,16 @@ function toRecordedEvent(event, data) {
22455
22543
  function mapValuesDeep(obj, fn) {
22456
22544
  if (Array.isArray(obj)) {
22457
22545
  return obj.map((value) => {
22458
- if ((0, import_lodash_es19.isPlainObject)(value) || Array.isArray(value)) {
22546
+ if ((0, import_lodash_es18.isPlainObject)(value) || Array.isArray(value)) {
22459
22547
  return mapValuesDeep(value, fn);
22460
22548
  }
22461
22549
  return fn(value);
22462
22550
  });
22463
22551
  }
22464
- if ((0, import_lodash_es19.isPlainObject)(obj)) {
22552
+ if ((0, import_lodash_es18.isPlainObject)(obj)) {
22465
22553
  return Object.fromEntries(
22466
22554
  Object.entries(obj).map(([key, value]) => {
22467
- if ((0, import_lodash_es19.isPlainObject)(value) || Array.isArray(value)) {
22555
+ if ((0, import_lodash_es18.isPlainObject)(value) || Array.isArray(value)) {
22468
22556
  return [key, mapValuesDeep(value, fn)];
22469
22557
  }
22470
22558
  return [key, fn(value)];
@@ -24800,7 +24888,7 @@ var pinecone_default = pineconePlugin;
24800
24888
 
24801
24889
  // src/plugins/gentrace/plugin.ts
24802
24890
  var import_core = require("@gentrace/core");
24803
- var import_lodash_es20 = require("lodash");
24891
+ var import_lodash_es19 = require("lodash");
24804
24892
 
24805
24893
  // src/integrations/GptTokenizerTokenizer.ts
24806
24894
  var import_emittery3 = __toESM(require("emittery-0-13"), 1);
@@ -24898,7 +24986,7 @@ var runGentraceTests = async (gentracePipelineSlug, settings, project, graph, na
24898
24986
  slug: gentracePipelineSlug
24899
24987
  });
24900
24988
  const runner = pipeline.start();
24901
- const rivetFormattedInputs = (0, import_lodash_es20.mapValues)(testCase.inputs, inferType);
24989
+ const rivetFormattedInputs = (0, import_lodash_es19.mapValues)(testCase.inputs, inferType);
24902
24990
  const tempProject = {
24903
24991
  ...project,
24904
24992
  graphs: {
@@ -24910,7 +24998,7 @@ var runGentraceTests = async (gentracePipelineSlug, settings, project, graph, na
24910
24998
  const processor = new GraphProcessor(tempProject, graphId, globalRivetNodeRegistry);
24911
24999
  processor.executor = "browser";
24912
25000
  recorder.record(processor);
24913
- const runContextValues = (0, import_lodash_es20.cloneDeep)(contextValues);
25001
+ const runContextValues = (0, import_lodash_es19.cloneDeep)(contextValues);
24914
25002
  await processor.processGraph(
24915
25003
  {
24916
25004
  settings,
@@ -24948,7 +25036,7 @@ var runRemoteGentraceTests = async (gentracePipelineSlug, settings, project, gra
24948
25036
  slug: gentracePipelineSlug
24949
25037
  });
24950
25038
  const runner = pipeline.start();
24951
- const rivetFormattedInputs = (0, import_lodash_es20.mapValues)(testCase.inputs, inferType);
25039
+ const rivetFormattedInputs = (0, import_lodash_es19.mapValues)(testCase.inputs, inferType);
24952
25040
  const fullRecording = await runAndRecord(rivetFormattedInputs);
24953
25041
  const stepRuns = convertRecordingToStepRuns(fullRecording, project, graphId);
24954
25042
  for (const stepRun of stepRuns) {
@@ -27628,7 +27716,7 @@ ${additional.join("\n")}`;
27628
27716
  var runThreadNode = pluginNodeDefinition(RunThreadNodeImpl, "Run Thread");
27629
27717
 
27630
27718
  // src/plugins/openai/nodes/ThreadMessageNode.ts
27631
- var import_lodash_es21 = require("lodash");
27719
+ var import_lodash_es20 = require("lodash");
27632
27720
  var ThreadMessageNodeImpl = {
27633
27721
  create() {
27634
27722
  return {
@@ -27751,7 +27839,7 @@ var ThreadMessageNodeImpl = {
27751
27839
  if (data.useMetadataInput && inputData["metadata"]) {
27752
27840
  metadata = coerceTypeOptional(inputData["metadata"], "object");
27753
27841
  }
27754
- const inputMap = (0, import_lodash_es21.mapValues)(inputData, (input) => coerceType(input, "string"));
27842
+ const inputMap = (0, import_lodash_es20.mapValues)(inputData, (input) => coerceType(input, "string"));
27755
27843
  const interpolated = interpolate(text, inputMap);
27756
27844
  return {
27757
27845
  ["message"]: {
@@ -27804,7 +27892,7 @@ var import_ts_dedent84 = require("ts-dedent");
27804
27892
  var import_p_retry3 = __toESM(require("p-retry-4"), 1);
27805
27893
  var import_ts_pattern9 = require("ts-pattern");
27806
27894
  var import_genai2 = require("@google/genai");
27807
- var import_lodash_es22 = require("lodash");
27895
+ var import_lodash_es21 = require("lodash");
27808
27896
  function toGoogleSchemaType(type) {
27809
27897
  switch (type) {
27810
27898
  case "string":
@@ -28176,7 +28264,7 @@ var ChatGoogleNodeImpl = {
28176
28264
  description: tool.description,
28177
28265
  parameters: Object.keys(parameters.properties ?? {}).length === 0 ? void 0 : {
28178
28266
  type: import_genai2.Type.OBJECT,
28179
- properties: (0, import_lodash_es22.mapValues)(parameters.properties ?? {}, (property) => ({
28267
+ properties: (0, import_lodash_es21.mapValues)(parameters.properties ?? {}, (property) => ({
28180
28268
  // gemini doesn't support union property types, it uses openapi style not jsonschema, what a mess
28181
28269
  type: toGoogleSchemaType(
28182
28270
  Array.isArray(property.type) ? property.type.find((type) => type !== "null") : property.type
@@ -28459,7 +28547,7 @@ async function assembleRegistry(specs, loadPlugin) {
28459
28547
  }
28460
28548
 
28461
28549
  // src/integrations/DatasetProvider.ts
28462
- var import_lodash_es23 = require("lodash");
28550
+ var import_lodash_es22 = require("lodash");
28463
28551
  var InMemoryDatasetProvider = class {
28464
28552
  #datasets;
28465
28553
  constructor(datasets) {
@@ -28539,7 +28627,7 @@ var InMemoryDatasetProvider = class {
28539
28627
  return sorted.slice(0, k).map((r) => ({ ...r.row, distance: r.similarity }));
28540
28628
  }
28541
28629
  async exportDatasetsForProject(_projectId) {
28542
- return (0, import_lodash_es23.cloneDeep)(this.#datasets);
28630
+ return (0, import_lodash_es22.cloneDeep)(this.#datasets);
28543
28631
  }
28544
28632
  };
28545
28633
  var dotProductSimilarity = (a, b) => {