@valerypopoff/rivet2-core 2.15.0 → 2.19.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.
Files changed (187) hide show
  1. package/dist/cjs/bundle.cjs +7906 -3980
  2. package/dist/cjs/bundle.cjs.map +4 -4
  3. package/dist/cjs/interpolationRuntime.cjs +62 -7
  4. package/dist/cjs/interpolationRuntime.cjs.map +3 -3
  5. package/dist/cjs/interpolationSyntax.cjs +9 -5
  6. package/dist/cjs/interpolationSyntax.cjs.map +2 -2
  7. package/dist/cjs/serialization.cjs +1880 -0
  8. package/dist/cjs/serialization.cjs.map +7 -0
  9. package/dist/cjs/webAppRuntime.cjs +168 -6
  10. package/dist/cjs/webAppRuntime.cjs.map +3 -3
  11. package/dist/esm/api/createProcessor.js +5 -2
  12. package/dist/esm/api/processSettings.js +1 -0
  13. package/dist/esm/exports.js +4 -0
  14. package/dist/esm/model/AgentResponseTrace.js +99 -34
  15. package/dist/esm/model/AgentResponseTracePresentation.js +130 -0
  16. package/dist/esm/model/DataValue.js +11 -2
  17. package/dist/esm/model/GlobalVariables.js +2 -1
  18. package/dist/esm/model/GraphBoundaryCache.js +2 -1
  19. package/dist/esm/model/GraphBoundaryEffects.js +38 -1
  20. package/dist/esm/model/GraphExecutionState.js +81 -0
  21. package/dist/esm/model/GraphProcessor.js +825 -884
  22. package/dist/esm/model/GraphSchedulerBoundaryState.js +64 -0
  23. package/dist/esm/model/Nodes.js +15 -0
  24. package/dist/esm/model/ProjectBundle.js +248 -0
  25. package/dist/esm/model/ProjectBundleRuntime.js +54 -0
  26. package/dist/esm/model/SchedulerBoundaryPlanner.js +233 -0
  27. package/dist/esm/model/SplitRunProcessor.js +28 -7
  28. package/dist/esm/model/StreamingWatchTopology.js +118 -8
  29. package/dist/esm/model/SubgraphProjectTarget.js +7 -0
  30. package/dist/esm/model/SubprocessorBridge.js +125 -87
  31. package/dist/esm/model/ToolCallContinuationCoordinator.js +1 -1
  32. package/dist/esm/model/chat-v2/aiSdkBridge.js +22 -17
  33. package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -4
  34. package/dist/esm/model/chat-v2/chatV2CredentialNames.js +5 -1
  35. package/dist/esm/model/chat-v2/chatV2Outputs.js +2 -2
  36. package/dist/esm/model/chat-v2/chatV2Pipeline.js +24 -9
  37. package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +3 -2
  38. package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +46 -6
  39. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +26 -1
  40. package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
  41. package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +10 -0
  42. package/dist/esm/model/chat-v2/llmChatV2Body.js +13 -10
  43. package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +5 -2
  44. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +3 -0
  45. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +33 -9
  46. package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
  47. package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +10 -2
  48. package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +17 -0
  49. package/dist/esm/model/chat-v2/llmModelCandidate.js +2 -1
  50. package/dist/esm/model/chat-v2/llmProfile.js +5 -1
  51. package/dist/esm/model/chat-v2/llmProfileBody.js +11 -2
  52. package/dist/esm/model/chat-v2/llmProfileFallback.js +7 -4
  53. package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +2 -1
  54. package/dist/esm/model/chat-v2/llmProfileHealthStore.js +16 -3
  55. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
  56. package/dist/esm/model/chat-v2/messageConverter.js +18 -16
  57. package/dist/esm/model/chat-v2/modelRegistry.js +14 -4
  58. package/dist/esm/model/chat-v2/openRouterModel.js +73 -0
  59. package/dist/esm/model/chat-v2/parallelToolCalls.js +2 -0
  60. package/dist/esm/model/chat-v2/providerOptions.js +30 -25
  61. package/dist/esm/model/chat-v2/temperature.js +9 -0
  62. package/dist/esm/model/classifier/credentials.js +42 -6
  63. package/dist/esm/model/classifier/images.js +176 -0
  64. package/dist/esm/model/classifier/json.js +57 -0
  65. package/dist/esm/model/classifier/limits.js +300 -0
  66. package/dist/esm/model/classifier/openai.js +118 -0
  67. package/dist/esm/model/classifier/perplexity.js +63 -0
  68. package/dist/esm/model/classifier/preparation.js +74 -0
  69. package/dist/esm/model/classifier/profile.js +151 -0
  70. package/dist/esm/model/classifier/profileExecution.js +294 -0
  71. package/dist/esm/model/classifier/providers.js +454 -192
  72. package/dist/esm/model/classifier/questionHelpers.js +29 -45
  73. package/dist/esm/model/classifier/questions.js +53 -0
  74. package/dist/esm/model/classifier/response.js +75 -0
  75. package/dist/esm/model/classifier/state.js +207 -0
  76. package/dist/esm/model/classifier/types.js +11 -1
  77. package/dist/esm/model/nodeRunFailure.js +54 -0
  78. package/dist/esm/model/nodes/CallGraphNode.js +6 -0
  79. package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
  80. package/dist/esm/model/nodes/ClassifierEvaluateNode.js +385 -154
  81. package/dist/esm/model/nodes/ClassifierProfileNode.js +133 -0
  82. package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
  83. package/dist/esm/model/nodes/DelegateFunctionCallNode.js +1 -1
  84. package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
  85. package/dist/esm/model/nodes/HttpCallNode.js +44 -75
  86. package/dist/esm/model/nodes/ImageNode.js +44 -3
  87. package/dist/esm/model/nodes/LLMChatV2Node.js +26 -4
  88. package/dist/esm/model/nodes/ObjectNode.js +29 -18
  89. package/dist/esm/model/nodes/PromptNode.js +2 -1
  90. package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
  91. package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
  92. package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
  93. package/dist/esm/model/nodes/StreamValueNode.js +38 -0
  94. package/dist/esm/model/nodes/SubGraphNode.js +199 -35
  95. package/dist/esm/model/nodes/ToBase64Node.js +106 -0
  96. package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
  97. package/dist/esm/model/nodes/toolCallDelegation.js +5 -1
  98. package/dist/esm/model/profileSuspensionHints.js +8 -0
  99. package/dist/esm/recording/ExecutionRecorder.js +26 -0
  100. package/dist/esm/serialization.js +2 -0
  101. package/dist/esm/utils/base64.js +18 -15
  102. package/dist/esm/utils/coerceType.js +11 -1
  103. package/dist/esm/utils/errors.js +41 -0
  104. package/dist/esm/utils/interpolation.js +44 -22
  105. package/dist/esm/utils/interpolationSyntax.js +15 -6
  106. package/dist/esm/utils/serialization/serialization.js +3 -2
  107. package/dist/esm/utils/serialization/serializationUtils.js +6 -0
  108. package/dist/esm/utils/serialization/serialization_v4.js +15 -3
  109. package/dist/esm/webAppRuntime.js +1 -0
  110. package/dist/types/api/createProcessor.d.ts +7 -1
  111. package/dist/types/exports.d.ts +4 -0
  112. package/dist/types/model/AgentResponseTrace.d.ts +15 -4
  113. package/dist/types/model/AgentResponseTracePresentation.d.ts +15 -0
  114. package/dist/types/model/CycleDetector.d.ts +1 -2
  115. package/dist/types/model/DataValue.d.ts +12 -8
  116. package/dist/types/model/ExecutorProtocol.d.ts +9 -0
  117. package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
  118. package/dist/types/model/GraphBoundaryEffects.d.ts +10 -1
  119. package/dist/types/model/GraphExecutionState.d.ts +68 -0
  120. package/dist/types/model/GraphProcessor.d.ts +2 -0
  121. package/dist/types/model/GraphSchedulerBoundaryState.d.ts +96 -0
  122. package/dist/types/model/Nodes.d.ts +11 -4
  123. package/dist/types/model/ProcessContext.d.ts +24 -3
  124. package/dist/types/model/ProjectBundle.d.ts +59 -0
  125. package/dist/types/model/ProjectBundleRuntime.d.ts +24 -0
  126. package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
  127. package/dist/types/model/RivetUIContext.d.ts +1 -1
  128. package/dist/types/model/SchedulerBoundaryPlanner.d.ts +42 -0
  129. package/dist/types/model/Settings.d.ts +1 -0
  130. package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
  131. package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
  132. package/dist/types/model/SubprocessorBridge.d.ts +2 -0
  133. package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +4 -0
  134. package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
  135. package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +79 -1
  136. package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -1
  137. package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
  138. package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +2 -0
  139. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +4 -1
  140. package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
  141. package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +2 -0
  142. package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +2 -0
  143. package/dist/types/model/chat-v2/llmProfileFallback.d.ts +51 -3
  144. package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +10 -7
  145. package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +6 -2
  146. package/dist/types/model/chat-v2/modelRegistry.d.ts +5 -4
  147. package/dist/types/model/chat-v2/openRouterModel.d.ts +2 -0
  148. package/dist/types/model/chat-v2/providerOptions.d.ts +2 -13
  149. package/dist/types/model/chat-v2/temperature.d.ts +2 -0
  150. package/dist/types/model/classifier/credentials.d.ts +7 -1
  151. package/dist/types/model/classifier/images.d.ts +18 -0
  152. package/dist/types/model/classifier/json.d.ts +19 -0
  153. package/dist/types/model/classifier/limits.d.ts +45 -0
  154. package/dist/types/model/classifier/openai.d.ts +5 -0
  155. package/dist/types/model/classifier/perplexity.d.ts +7 -0
  156. package/dist/types/model/classifier/preparation.d.ts +16 -0
  157. package/dist/types/model/classifier/profile.d.ts +46 -0
  158. package/dist/types/model/classifier/profileExecution.d.ts +32 -0
  159. package/dist/types/model/classifier/providers.d.ts +98 -9
  160. package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
  161. package/dist/types/model/classifier/questions.d.ts +4 -0
  162. package/dist/types/model/classifier/response.d.ts +4 -0
  163. package/dist/types/model/classifier/state.d.ts +37 -0
  164. package/dist/types/model/classifier/types.d.ts +11 -0
  165. package/dist/types/model/nodeRunFailure.d.ts +13 -0
  166. package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
  167. package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +17 -12
  168. package/dist/types/model/nodes/ClassifierProfileNode.d.ts +20 -0
  169. package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
  170. package/dist/types/model/nodes/ImageNode.d.ts +4 -0
  171. package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
  172. package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
  173. package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
  174. package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
  175. package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
  176. package/dist/types/model/nodes/toolCallDelegation.d.ts +3 -1
  177. package/dist/types/model/profileSuspensionHints.d.ts +8 -0
  178. package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
  179. package/dist/types/serialization.d.ts +2 -0
  180. package/dist/types/utils/base64.d.ts +1 -1
  181. package/dist/types/utils/errors.d.ts +4 -0
  182. package/dist/types/utils/interpolation.d.ts +13 -2
  183. package/dist/types/utils/interpolationSyntax.d.ts +1 -1
  184. package/dist/types/utils/serialization/serialization.d.ts +3 -1
  185. package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
  186. package/dist/types/webAppRuntime.d.ts +1 -0
  187. package/package.json +7 -1
@@ -16,6 +16,7 @@ import { shouldOutputChatV2RequestBody, shouldOutputChatV2ResponseBody } from '.
16
16
  import { buildLLMChatV2EditorCacheKey, resolveLLMChatV2RuntimeConfig, resolveLLMChatV2RuntimeProviderOptions, } from '../chat-v2/llmChatV2NodeRuntime.js';
17
17
  import { projectLLMChatV2EditorCacheHit, writeLLMChatV2EditorCache } from '../chat-v2/llmChatV2CacheBoundary.js';
18
18
  import { cloneLLMChatV2Outputs } from '../chat-v2/llmChatV2OutputClone.js';
19
+ import { createCaughtRunFailureOutputs, getRunFailureOutputDefinitions, shouldCatchRunFailure, withRunSuccessOutputs, } from '../nodeRunFailure.js';
19
20
  export { buildLLMChatV2EditorCacheKey, resolveLLMChatV2RuntimeProviderOptions };
20
21
  function usesBaseURLInput(data) {
21
22
  return data.provider === 'custom' && data.useCustomProviderBaseURLInput;
@@ -227,7 +228,7 @@ export class LLMChatV2NodeImpl extends NodeImpl {
227
228
  description: 'Human-readable profile fallback outcome for this LLM Chat run.',
228
229
  });
229
230
  }
230
- return outputs;
231
+ return [...outputs, ...getRunFailureOutputDefinitions(this.data)];
231
232
  }
232
233
  static getUIData() {
233
234
  return {
@@ -253,6 +254,20 @@ export class LLMChatV2NodeImpl extends NodeImpl {
253
254
  };
254
255
  }
255
256
  async process(inputs, context) {
257
+ let failureEvidence;
258
+ try {
259
+ context.signal.throwIfAborted();
260
+ return await this.processRun(inputs, context, (outputs) => {
261
+ failureEvidence = outputs;
262
+ });
263
+ }
264
+ catch (error) {
265
+ if (!shouldCatchRunFailure(this.data, error, context.signal))
266
+ throw error;
267
+ return createCaughtRunFailureOutputs(this.getOutputDefinitions(), error, failureEvidence);
268
+ }
269
+ }
270
+ async processRun(inputs, context, onFailure) {
256
271
  const invocationJournal = new LLMInvocationJournal();
257
272
  let profileAttemptSequence = 0;
258
273
  let latestFailureEvidence;
@@ -287,11 +302,13 @@ export class LLMChatV2NodeImpl extends NodeImpl {
287
302
  });
288
303
  },
289
304
  });
305
+ context.signal.throwIfAborted();
290
306
  const toolCallContinuation = context.toolCallContinuation;
291
307
  const cacheHit = projectLLMChatV2EditorCacheHit(runtime);
292
308
  if (cacheHit != null) {
293
309
  context.markResultAsEditorCacheHit?.();
294
- return cacheHit;
310
+ context.signal.throwIfAborted();
311
+ return withRunSuccessOutputs(this.data, cacheHit);
295
312
  }
296
313
  let invocation;
297
314
  try {
@@ -324,7 +341,8 @@ export class LLMChatV2NodeImpl extends NodeImpl {
324
341
  profileSummary: runtime.getProfileSummary?.(),
325
342
  });
326
343
  const failureOutputs = mergeLLMInvocationFailureOutputs(latestFailureEvidence, diagnostics);
327
- if (Object.keys(failureOutputs).length > 0) {
344
+ onFailure(failureOutputs);
345
+ if (!shouldCatchRunFailure(this.data, error, context.signal) && Object.keys(failureOutputs).length > 0) {
328
346
  // This checkpoint is the durable terminal counterpart to the live
329
347
  // partial-output stream. GraphProcessor attaches it to nodeError,
330
348
  // so recordings and remote executors cannot lose evidence merely
@@ -345,7 +363,8 @@ export class LLMChatV2NodeImpl extends NodeImpl {
345
363
  }
346
364
  throw error;
347
365
  }
348
- const { result, terminalSnapshot } = invocation;
366
+ context.signal.throwIfAborted();
367
+ const { result, terminalSnapshot, toolCost } = invocation;
349
368
  projectLLMInvocationResult({
350
369
  result,
351
370
  modelCalls: invocationJournal.modelCalls,
@@ -353,7 +372,9 @@ export class LLMChatV2NodeImpl extends NodeImpl {
353
372
  outputLLMAttempts: this.data.outputLLMAttempts,
354
373
  llmAttempts: invocationJournal.llmAttempts,
355
374
  profileSummary: runtime.getProfileSummary?.(),
375
+ toolCost,
356
376
  });
377
+ result.commonOutputs = withRunSuccessOutputs(this.data, result.commonOutputs);
357
378
  // The final display page is taken after result projection, so it exactly
358
379
  // matches the one graph-semantic output map returned below.
359
380
  if (terminalSnapshot != null) {
@@ -374,6 +395,7 @@ export class LLMChatV2NodeImpl extends NodeImpl {
374
395
  if (toolCallContinuation && !isChatV2PipelineProviderFailureResult(result) && result.functionCalls.length > 0) {
375
396
  toolCallContinuation.release();
376
397
  }
398
+ context.signal.throwIfAborted();
377
399
  writeLLMChatV2EditorCache({ runtime, result });
378
400
  return result.commonOutputs;
379
401
  }
@@ -20,15 +20,6 @@ function isEscapedCharacter(value, index) {
20
20
  function isUnescapedQuoteAt(value, index) {
21
21
  return index >= 0 && index < value.length && value[index] === '"' && !isEscapedCharacter(value, index);
22
22
  }
23
- function isInsideJsonString(value, index) {
24
- let insideString = false;
25
- for (let i = 0; i < index; i++) {
26
- if (isUnescapedQuoteAt(value, i)) {
27
- insideString = !insideString;
28
- }
29
- }
30
- return insideString;
31
- }
32
23
  function stringifyJsonValue(value) {
33
24
  if (value == null) {
34
25
  return 'null';
@@ -52,17 +43,36 @@ function stringifyEmbeddedJsonStringFragment(value) {
52
43
  * Interpolates a JSON template without parsing it. Shared by Object and other
53
44
  * first-party nodes which author structured EntryType values.
54
45
  */
55
- export function interpolateJsonTemplate(baseString, values, graphInputNodeValues, contextValues, globalValues) {
46
+ export function interpolateJsonTemplate(baseString, values, graphInputNodeValues, contextValues, globalValues, guard, unwrapVariableDataValues = false) {
47
+ guard?.check();
56
48
  const protectedBaseString = protectEscapedInterpolationTokens(baseString);
57
- const parsedTemplate = parseInterpolationTemplate(protectedBaseString);
49
+ const parsedTemplate = parseInterpolationTemplate(protectedBaseString, guard?.check, guard?.tokenLimit);
58
50
  if (parsedTemplate.tokens.length === 0) {
59
51
  return restoreEscapedInterpolationTokens(protectedBaseString);
60
52
  }
61
53
  let result = '';
62
54
  let cursor = 0;
55
+ let quoteCursor = 0;
56
+ let insideString = false;
57
+ let escaped = false;
58
+ const append = (fragment) => {
59
+ guard?.output(fragment, result.length);
60
+ result += fragment;
61
+ };
63
62
  for (const token of parsedTemplate.tokens) {
64
63
  const tokenSpan = token.span;
65
- const isInsideString = isInsideJsonString(protectedBaseString, tokenSpan.start);
64
+ guard?.check();
65
+ // Scan authored quotes once, including token contents, matching the old
66
+ // per-token scan without repeatedly walking the entire template prefix.
67
+ for (; quoteCursor < tokenSpan.start; quoteCursor++) {
68
+ if ((quoteCursor & 4095) === 0)
69
+ guard?.check();
70
+ const character = protectedBaseString[quoteCursor];
71
+ if (character === '"' && !escaped)
72
+ insideString = !insideString;
73
+ escaped = character === '\\' && !escaped;
74
+ }
75
+ const isInsideString = insideString;
66
76
  const isWholeQuotedToken = isInsideString &&
67
77
  isUnescapedQuoteAt(protectedBaseString, tokenSpan.start - 1) &&
68
78
  isUnescapedQuoteAt(protectedBaseString, tokenSpan.end);
@@ -74,25 +84,26 @@ export function interpolateJsonTemplate(baseString, values, graphInputNodeValues
74
84
  graphInputValues: graphInputNodeValues,
75
85
  contextValues,
76
86
  globalValues,
77
- unwrapVariableDataValues: false,
87
+ unwrapVariableDataValues,
88
+ guard,
78
89
  })
79
90
  : undefined;
80
91
  // Restore escaped delimiters only from the authored JSON template. An
81
92
  // interpolated string may itself contain literal interpolation syntax and
82
93
  // must not be processed again while the final JSON is assembled.
83
- result += restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor, replacementStart));
94
+ append(restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor, replacementStart)));
84
95
  if (isInsideString && !isWholeQuotedToken) {
85
- result += stringifyEmbeddedJsonStringFragment(value);
96
+ append(stringifyEmbeddedJsonStringFragment(value));
86
97
  }
87
98
  else if (isWholeQuotedToken) {
88
- result += stringifyWholeQuotedJsonValue(value);
99
+ append(stringifyWholeQuotedJsonValue(value));
89
100
  }
90
101
  else {
91
- result += stringifyJsonValue(value);
102
+ append(stringifyJsonValue(value));
92
103
  }
93
104
  cursor = replacementEnd;
94
105
  }
95
- result += restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor));
106
+ append(restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor)));
96
107
  return result;
97
108
  }
98
109
  export class ObjectNodeImpl extends NodeImpl {
@@ -9,6 +9,7 @@ import { getInputOrData } from '../../utils/index.js';
9
9
  import { extractInterpolationVariableReferences, getInterpolationGlobalValues, interpolate } from '../../utils/interpolation.js';
10
10
  import { match } from 'ts-pattern';
11
11
  import { createInterpolationInputDefinition } from '../interpolationInputDefinition.js';
12
+ import { buildNodeBodyPreview } from './nodeBodyPreview.js';
12
13
  export class PromptNodeImpl extends NodeImpl {
13
14
  static create() {
14
15
  const chartNode = {
@@ -164,7 +165,7 @@ export class PromptNodeImpl extends NodeImpl {
164
165
  },
165
166
  {
166
167
  type: 'colorized',
167
- text: this.data.promptText.split('\n').slice(0, 15).join('\n').trim(),
168
+ text: buildNodeBodyPreview(this.data.promptText),
168
169
  language: 'prompt-interpolation-markdown',
169
170
  theme: 'prompt-interpolation',
170
171
  },
@@ -124,7 +124,10 @@ export class ReferencedGraphAliasNodeImpl extends NodeImpl {
124
124
  });
125
125
  try {
126
126
  const startTime = Date.now();
127
- const outputs = await subGraphProcessor.processGraph(context, inputData, context.contextValues, {
127
+ const outputs = await subGraphProcessor.processGraph({
128
+ ...context,
129
+ datasetProvider: context.projectReferenceLoader?.getDatasetProvider?.(referencedProject) ?? context.datasetProvider,
130
+ }, inputData, context.contextValues, {
128
131
  graphInputStreams: context.graphInputStreams,
129
132
  // This node preserves the referenced graph's named boundary ports,
130
133
  // so it may relay their direct producer partials to a parent Watch.
@@ -46,15 +46,17 @@ export class SetGlobalNodeImpl extends NodeImpl {
46
46
  return inputs;
47
47
  }
48
48
  getOutputDefinitions() {
49
+ const { id, useIdInput } = this.data;
50
+ const fixedId = !useIdInput && typeof id === 'string' && id.trim() ? id : undefined;
49
51
  return [
50
52
  {
51
53
  id: 'saved-value',
52
- title: 'Value',
54
+ title: fixedId ?? 'Value',
53
55
  dataType: this.data.dataType,
54
56
  },
55
57
  {
56
58
  id: 'previous-value',
57
- title: 'Previous Value',
59
+ title: fixedId ? `Prev value of: ${fixedId}` : 'Previous Value',
58
60
  dataType: this.data.dataType,
59
61
  },
60
62
  {
@@ -83,7 +85,7 @@ export class SetGlobalNodeImpl extends NodeImpl {
83
85
  }
84
86
  getBody() {
85
87
  return dedent `
86
- ${this.data.id}
88
+ ${this.data.useIdInput ? '(ID from input)' : this.data.id}
87
89
  Type: ${this.data.dataType}
88
90
  `;
89
91
  }
@@ -7,7 +7,7 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
7
7
  return {
8
8
  data: {},
9
9
  id: nanoid(),
10
- title: 'Stop Watching Streaming Output',
10
+ title: 'Stop watching streaming',
11
11
  type: 'stopWatchingStreamingOutput',
12
12
  visualData: { x: 0, y: 0, width: 230 },
13
13
  };
@@ -20,11 +20,11 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
20
20
  }
21
21
  static getUIData() {
22
22
  return {
23
- contextMenuTitle: 'Stop Watching Streaming Output',
24
- group: ['Logic'],
25
- infoBoxTitle: 'Stop Watching Streaming Output Node',
23
+ contextMenuTitle: 'Stop watching streaming',
24
+ group: ['Streaming'],
25
+ infoBoxTitle: 'Stop watching streaming node',
26
26
  infoBoxBody: dedent `
27
- Accepts a value from a Watch Streaming Output branch, stops future streaming
27
+ Accepts a value from a Watch streaming branch, stops future streaming
28
28
  snapshots, and lets its completed output continue through the ordinary graph.
29
29
  In parallel mode, the first completed branch to reach this node wins.
30
30
  If the stream ends without a value reaching this node, it is shown as Not ran
@@ -38,13 +38,13 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
38
38
  async process(inputs, context) {
39
39
  const value = inputs['value'];
40
40
  if (!value) {
41
- throw new Error('Stop Watching Streaming Output requires a value.');
41
+ throw new Error('Stop watching streaming requires a value.');
42
42
  }
43
43
  if (!context.acceptStreamingWatchStop) {
44
- throw new Error('Stop Watching Streaming Output must be downstream of Watch Streaming Output.');
44
+ throw new Error('Stop watching streaming must be downstream of Watch streaming.');
45
45
  }
46
46
  context.acceptStreamingWatchStop();
47
47
  return { ['value']: value };
48
48
  }
49
49
  }
50
- export const stopWatchingStreamingOutputNode = nodeDefinition(StopWatchingStreamingOutputNodeImpl, 'Stop Watching Streaming Output');
50
+ export const stopWatchingStreamingOutputNode = nodeDefinition(StopWatchingStreamingOutputNodeImpl, 'Stop watching streaming');
@@ -0,0 +1,38 @@
1
+ import { nanoid } from 'nanoid/non-secure';
2
+ import { nodeDefinition } from '../NodeDefinition.js';
3
+ import { NodeImpl } from '../NodeImpl.js';
4
+ /** Emits one partial snapshot without changing the ordinary final value. */
5
+ export class StreamValueNodeImpl extends NodeImpl {
6
+ static create() {
7
+ return {
8
+ id: nanoid(),
9
+ type: 'streamValue',
10
+ title: 'Stream value',
11
+ data: {},
12
+ visualData: { x: 0, y: 0, width: 220 },
13
+ };
14
+ }
15
+ getInputDefinitions() {
16
+ return [{ id: 'value', title: 'Value', dataType: 'any', required: true, coerced: false }];
17
+ }
18
+ getOutputDefinitions() {
19
+ return [{ id: 'value', title: 'Value', dataType: 'any' }];
20
+ }
21
+ static getUIData() {
22
+ return {
23
+ contextMenuTitle: 'Stream value',
24
+ group: ['Streaming'],
25
+ infoBoxTitle: 'Stream value node',
26
+ infoBoxBody: 'Emits one streaming update as soon as its input is ready, then passes the same value through normally. Connect directly to Graph Output to send it to a caller before the child graph finishes.',
27
+ };
28
+ }
29
+ async process(inputs, context) {
30
+ const value = inputs['value'];
31
+ if (!value)
32
+ throw new Error('Stream value requires a value.');
33
+ const outputs = { ['value']: value };
34
+ context.onPartialOutputs?.(outputs);
35
+ return outputs;
36
+ }
37
+ }
38
+ export const streamValueNode = nodeDefinition(StreamValueNodeImpl, 'Stream value');
@@ -10,7 +10,53 @@ import {} from '../ProcessContext.js';
10
10
  import {} from '../../index.js';
11
11
  import { dedent } from 'ts-dedent';
12
12
  import { getError } from '../../utils/errors.js';
13
+ import { getSubgraphProjectKey } from '../SubgraphProjectTarget.js';
14
+ import { ExecutionRecorder } from '../../recording/ExecutionRecorder.js';
13
15
  import { applyGraphBoundaryPortOrder, buildExcludedGraphBoundaryOutputs, buildGraphBoundaryInputData, getGraphBoundary, getGraphBoundaryInputDefinitions, getGraphBoundaryOutputDefinitions, } from '../GraphBoundaryCache.js';
16
+ /** A saved cross-project boundary is the wire contract until the user explicitly selects a new target. */
17
+ export function getSubgraphTargetBoundaryChange(expected, actual) {
18
+ if (!expected)
19
+ return null;
20
+ for (const side of ['inputs', 'outputs']) {
21
+ for (const port of expected[side]) {
22
+ const match = actual[side].find((candidate) => port.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId);
23
+ if (match?.dataType !== port.dataType) {
24
+ return { side: side === 'inputs' ? 'input' : 'output', id: port.id };
25
+ }
26
+ }
27
+ const callerIds = new Set();
28
+ for (const port of actual[side]) {
29
+ const saved = expected[side].find((candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId);
30
+ const callerId = saved?.portId ?? port.portId;
31
+ if (callerIds.has(callerId)) {
32
+ return { side: side === 'inputs' ? 'input' : 'output', id: port.id };
33
+ }
34
+ callerIds.add(callerId);
35
+ }
36
+ }
37
+ return null;
38
+ }
39
+ /** Keep the caller's saved wire IDs while adopting current target names and metadata. */
40
+ export function reconcileSubgraphTargetBoundary(expected, actual) {
41
+ if (!expected)
42
+ return actual;
43
+ return {
44
+ inputs: actual.inputs.map((port) => {
45
+ const saved = expected.inputs.find((candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId);
46
+ return saved && saved.dataType === port.dataType ? { ...port, portId: saved.portId } : port;
47
+ }),
48
+ outputs: actual.outputs.map((port) => {
49
+ const saved = expected.outputs.find((candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId);
50
+ return saved && saved.dataType === port.dataType ? { ...port, portId: saved.portId } : port;
51
+ }),
52
+ };
53
+ }
54
+ export function getSubgraphTargetBoundaryIssue(expected, actual) {
55
+ const change = getSubgraphTargetBoundaryChange(expected, actual);
56
+ return change
57
+ ? `The selected project's graph changed its ${change.side} "${change.id}". Re-select the graph and review its connections.`
58
+ : null;
59
+ }
14
60
  export class SubGraphNodeImpl extends NodeImpl {
15
61
  static create() {
16
62
  const chartNode = {
@@ -31,17 +77,19 @@ export class SubGraphNodeImpl extends NodeImpl {
31
77
  };
32
78
  return chartNode;
33
79
  }
34
- getInputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
35
- const boundary = this.getBoundary(project, definitionContext);
80
+ getInputDefinitions(_connections, _nodes, project, referencedProjects, definitionContext) {
81
+ const boundary = this.getTargetBoundary(project, referencedProjects, definitionContext);
36
82
  return boundary ? getGraphBoundaryInputDefinitions(boundary, this.data.inputPortOrder) : [];
37
83
  }
38
84
  getGraphOutputs(project, definitionContext) {
39
85
  const boundary = this.getBoundary(project, definitionContext);
40
86
  return boundary ? getGraphBoundaryOutputDefinitions(boundary, this.data.outputPortOrder) : [];
41
87
  }
42
- getOutputDefinitions(_connections, _nodes, project, _referencedProjects, definitionContext) {
88
+ getOutputDefinitions(_connections, _nodes, project, referencedProjects, definitionContext) {
43
89
  const outputs = [];
44
- outputs.push(...this.getGraphOutputs(project, definitionContext));
90
+ const boundary = this.getTargetBoundary(project, referencedProjects, definitionContext);
91
+ if (boundary)
92
+ outputs.push(...getGraphBoundaryOutputDefinitions(boundary, this.data.outputPortOrder));
45
93
  if (this.data.useErrorOutput) {
46
94
  outputs.push({
47
95
  id: 'error',
@@ -54,34 +102,63 @@ export class SubGraphNodeImpl extends NodeImpl {
54
102
  getBoundary(project, definitionContext) {
55
103
  return (definitionContext?.getGraphBoundary(project, this.data.graphId) ?? getGraphBoundary(project, this.data.graphId));
56
104
  }
105
+ getTargetProject(project, referencedProjects) {
106
+ if (!this.data.targetProjectId)
107
+ return project;
108
+ return referencedProjects[getSubgraphProjectKey({
109
+ projectId: this.data.targetProjectId,
110
+ version: this.data.targetVersion ?? 'latest',
111
+ })];
112
+ }
113
+ getTargetBoundary(project, referencedProjects, definitionContext) {
114
+ // Keep the authored port contract visible even after a referenced project
115
+ // changes. Execution checks it against the resolved graph and fails with a
116
+ // reviewable error; replacing it here would hide existing wires in the UI.
117
+ if (this.data.targetProjectId && this.data.targetBoundary) {
118
+ const target = this.getTargetProject(project, referencedProjects);
119
+ const actual = target && this.getBoundary(target, definitionContext);
120
+ return actual && !getSubgraphTargetBoundaryChange(this.data.targetBoundary, actual)
121
+ ? reconcileSubgraphTargetBoundary(this.data.targetBoundary, actual)
122
+ : this.data.targetBoundary;
123
+ }
124
+ const target = this.getTargetProject(project, referencedProjects);
125
+ return ((target && this.getBoundary(target, definitionContext)) ??
126
+ (this.data.targetProjectId ? this.data.targetBoundary : undefined));
127
+ }
57
128
  getEditors(context) {
58
129
  const definitions = [
59
130
  {
60
- type: 'graphSelector',
131
+ type: 'custom',
61
132
  label: 'Graph',
62
- dataKey: 'graphId',
63
- },
64
- {
65
- type: 'toggle',
66
- label: 'Use Error Output',
67
- dataKey: 'useErrorOutput',
133
+ customEditorId: 'SubgraphTarget',
68
134
  },
69
135
  {
70
- type: 'toggle',
71
- label: 'Skip unused outputs',
72
- dataKey: 'skipUnusedOutputs',
73
- helperMessage: 'Only run branches needed by connected outputs. Skipped branches also skip their side effects and errors. ' +
74
- 'Runs the full subgraph for Run to here, partial-output forwarding, or a connected Error output.',
136
+ type: 'group',
137
+ label: 'Outputs',
138
+ editors: [
139
+ {
140
+ type: 'toggle',
141
+ label: 'Use Error Output',
142
+ dataKey: 'useErrorOutput',
143
+ },
144
+ {
145
+ type: 'toggle',
146
+ label: 'Skip unused outputs',
147
+ dataKey: 'skipUnusedOutputs',
148
+ helperMessage: 'Only run branches needed by connected outputs. Skipped branches also skip their side effects and errors. ' +
149
+ 'Runs the full subgraph for Run to here, partial-output forwarding, or a connected Error output.',
150
+ },
151
+ ],
75
152
  },
76
153
  ];
77
154
  if (this.data.graphId) {
78
- const boundary = getGraphBoundary(context.project, this.data.graphId);
155
+ const boundary = this.getTargetBoundary(context.project, context.referencedProjects);
79
156
  if (boundary) {
80
157
  for (const input of applyGraphBoundaryPortOrder(boundary.inputs, this.data.inputPortOrder)) {
81
158
  definitions.push({
82
159
  type: 'dynamic',
83
160
  dataKey: 'inputData',
84
- dynamicDataKey: input.id,
161
+ dynamicDataKey: input.portId,
85
162
  dataType: input.dataType,
86
163
  label: input.id,
87
164
  editor: input.editor ?? 'auto',
@@ -106,42 +183,92 @@ export class SubGraphNodeImpl extends NodeImpl {
106
183
  if (!project) {
107
184
  throw new Error('SubGraphNode requires a project to be set in the context.');
108
185
  }
109
- const graph = project.graphs[this.data.graphId];
186
+ const target = this.data.targetProjectId
187
+ ? context.referencedProjects[getSubgraphProjectKey({
188
+ projectId: this.data.targetProjectId,
189
+ version: this.data.targetVersion ?? 'latest',
190
+ })]
191
+ : project;
192
+ if (!target) {
193
+ throw new Error('The selected Studio Server project is unavailable. Refresh the target and try again.');
194
+ }
195
+ const graph = target.graphs[this.data.graphId];
110
196
  if (!graph) {
111
197
  throw new Error(`SubGraphNode requires a graph with id ${this.data.graphId} to be present in the project.`);
112
198
  }
113
- const boundary = context.getGraphBoundary?.(project, this.data.graphId) ?? getGraphBoundary(project, this.data.graphId);
114
- const inputData = buildGraphBoundaryInputData(boundary, inputs, this.data.inputData);
199
+ const boundary = context.getGraphBoundary?.(target, this.data.graphId) ?? getGraphBoundary(target, this.data.graphId);
200
+ if (this.data.targetProjectId) {
201
+ const boundaryIssue = getSubgraphTargetBoundaryIssue(this.data.targetBoundary, boundary);
202
+ if (boundaryIssue)
203
+ throw new Error(boundaryIssue);
204
+ }
205
+ const callerBoundary = this.data.targetProjectId
206
+ ? reconcileSubgraphTargetBoundary(this.data.targetBoundary, boundary)
207
+ : boundary;
208
+ const callerInputData = buildGraphBoundaryInputData(callerBoundary, inputs, this.data.inputData);
209
+ const inputData = this.data.targetProjectId ? {} : callerInputData;
210
+ if (this.data.targetProjectId) {
211
+ for (const input of callerBoundary.inputs) {
212
+ if (Object.hasOwn(callerInputData, input.portId))
213
+ inputData[input.id] = callerInputData[input.portId];
214
+ }
215
+ }
216
+ const graphInputStreams = this.data.targetProjectId
217
+ ? Object.fromEntries(callerBoundary.inputs.flatMap((input) => {
218
+ const stream = context.graphInputStreams?.[input.portId];
219
+ return stream ? [[input.id, stream]] : [];
220
+ }))
221
+ : context.graphInputStreams;
115
222
  const shouldRunWholeGraph = this.data.skipUnusedOutputs !== true ||
116
223
  context.isDirectRunTarget ||
117
224
  this.data.useAsGraphPartialOutput === true ||
118
225
  (this.data.useErrorOutput === true && context.activeOutputPortIds.has('error'));
119
226
  const requestedGraphOutputIds = shouldRunWholeGraph
120
227
  ? undefined
121
- : boundary.outputs.filter((output) => context.activeOutputPortIds.has(output.portId)).map((output) => output.id);
228
+ : callerBoundary.outputs
229
+ .filter((output) => context.activeOutputPortIds.has(output.portId))
230
+ .map((output) => output.id);
122
231
  if (requestedGraphOutputIds?.length === 0) {
123
- return buildOptimizedSubgraphOutputs(boundary, [], {}, 0, this.data.useErrorOutput);
232
+ return buildOptimizedSubgraphOutputs(callerBoundary, [], {}, 0, this.data.useErrorOutput);
124
233
  }
125
- const subGraphProcessor = context.createSubProcessor(this.data.graphId, { signal: context.signal });
234
+ const subGraphProcessor = context.createSubProcessor(this.data.graphId, {
235
+ signal: context.signal,
236
+ project: target,
237
+ });
238
+ const recordingTarget = this.data.targetProjectId && context.subgraphTarget;
239
+ const childRecorder = recordingTarget && context.onSubgraphProjectRun
240
+ ? new ExecutionRecorder(context.subgraphRecordingOptions)
241
+ : undefined;
242
+ const finishChildRecording = childRecorder?.record(subGraphProcessor);
243
+ const startedAt = Date.now();
244
+ let runError;
126
245
  try {
127
- const startTime = Date.now();
128
- const graphOutputs = await subGraphProcessor.processGraph(context, inputData, context.contextValues, {
246
+ const graphOutputs = await subGraphProcessor.processGraph(context.subgraphTarget
247
+ ? {
248
+ ...context,
249
+ datasetProvider: context.subgraphTarget.datasetProvider ?? context.datasetProvider,
250
+ projectPath: context.subgraphTarget.sourceProjectPath ?? context.projectPath,
251
+ }
252
+ : context, inputData, context.contextValues, {
129
253
  ...(requestedGraphOutputIds ? { requestedGraphOutputIds } : {}),
130
- graphInputStreams: context.graphInputStreams,
254
+ graphInputStreams,
131
255
  // A child Graph Output can relay a direct producer's partial value
132
256
  // under the public boundary port ID. An Error-output Subgraph may
133
257
  // later replace that same normal output with an exclusion, so it is
134
258
  // final-only even if a caller supplies this internal callback.
135
259
  // The parent owns all Watch scheduling.
136
260
  ...(context.onGraphOutputPartial && this.data.useErrorOutput !== true
137
- ? { onGraphOutputPartial: context.onGraphOutputPartial }
261
+ ? {
262
+ onGraphOutputPartial: (partial) => context.onGraphOutputPartial?.(this.data.targetProjectId ? mapSubgraphTargetOutputs(callerBoundary, partial) : partial),
263
+ }
138
264
  : {}),
139
265
  });
140
- const duration = Date.now() - startTime;
266
+ const duration = Date.now() - startedAt;
267
+ finishChildRecording?.({ type: 'done', results: graphOutputs });
141
268
  if (requestedGraphOutputIds) {
142
- return buildOptimizedSubgraphOutputs(boundary, requestedGraphOutputIds, graphOutputs, duration, this.data.useErrorOutput);
269
+ return buildOptimizedSubgraphOutputs(callerBoundary, requestedGraphOutputIds, graphOutputs, duration, this.data.useErrorOutput);
143
270
  }
144
- const outputs = graphOutputs;
271
+ const outputs = this.data.targetProjectId ? mapSubgraphTargetOutputs(callerBoundary, graphOutputs) : graphOutputs;
145
272
  if (this.data.useErrorOutput) {
146
273
  outputs['error'] = {
147
274
  type: 'control-flow-excluded',
@@ -157,29 +284,63 @@ export class SubGraphNodeImpl extends NodeImpl {
157
284
  return outputs;
158
285
  }
159
286
  catch (err) {
287
+ runError = getError(err);
288
+ finishChildRecording?.({ type: 'error', error: runError });
160
289
  if (!this.data.useErrorOutput) {
161
290
  throw err;
162
291
  }
163
- const outputs = buildExcludedGraphBoundaryOutputs(boundary);
292
+ const outputs = buildExcludedGraphBoundaryOutputs(callerBoundary);
164
293
  outputs['error'] = {
165
294
  type: 'string',
166
- value: getError(err).message,
295
+ value: runError.message,
167
296
  };
168
297
  return outputs;
169
298
  }
299
+ finally {
300
+ if (childRecorder && recordingTarget && this.data.targetProjectId) {
301
+ try {
302
+ // Hosted editor persistence uploads the replay over HTTP. Finish that
303
+ // upload before reporting the caller run complete, so closing its tab
304
+ // immediately after completion cannot discard the called-project run.
305
+ await context.onSubgraphProjectRun?.({
306
+ target: { projectId: this.data.targetProjectId, version: this.data.targetVersion ?? 'latest' },
307
+ resolved: recordingTarget,
308
+ graphId: this.data.graphId,
309
+ recorder: childRecorder,
310
+ status: runError ? 'failed' : 'succeeded',
311
+ durationMs: Math.max(0, Date.now() - startedAt),
312
+ ...(runError ? { errorMessage: runError.message } : {}),
313
+ correlationId: context.llmProfileHealthExecutionCorrelationId,
314
+ });
315
+ }
316
+ catch (error) {
317
+ console.error('Failed to retain Subgraph project run:', error);
318
+ }
319
+ }
320
+ }
170
321
  }
171
322
  }
172
323
  export const subGraphNode = nodeDefinition(SubGraphNodeImpl, 'Subgraph');
324
+ function mapSubgraphTargetOutputs(boundary, graphOutputs) {
325
+ const targetNames = new Set(boundary.outputs.map((output) => output.id));
326
+ const outputs = Object.fromEntries(Object.entries(graphOutputs).filter(([name]) => !targetNames.has(name)));
327
+ for (const output of boundary.outputs) {
328
+ if (Object.hasOwn(graphOutputs, output.id))
329
+ outputs[output.portId] = graphOutputs[output.id];
330
+ }
331
+ return outputs;
332
+ }
173
333
  function buildOptimizedSubgraphOutputs(boundary, requestedOutputIds, graphOutputs, duration, useErrorOutput) {
174
334
  const outputs = buildExcludedGraphBoundaryOutputs(boundary);
175
335
  for (const outputId of requestedOutputIds) {
336
+ const callerPortId = boundary.outputs.find((output) => output.id === outputId)?.portId ?? outputId;
176
337
  if (Object.hasOwn(graphOutputs, outputId)) {
177
- outputs[outputId] = graphOutputs[outputId];
338
+ outputs[callerPortId] = graphOutputs[outputId];
178
339
  }
179
340
  else {
180
341
  // Missing requested values must remain missing: downstream optional inputs
181
342
  // may use defaults, whereas an excluded value would skip their node.
182
- delete outputs[outputId];
343
+ delete outputs[callerPortId];
183
344
  }
184
345
  }
185
346
  if (useErrorOutput) {
@@ -194,6 +355,9 @@ function buildOptimizedSubgraphOutputs(boundary, requestedOutputIds, graphOutput
194
355
  if (!boundary.outputs.some((output) => output.id === 'cost')) {
195
356
  outputs['cost'] = graphOutputs['cost'] ?? { type: 'number', value: 0 };
196
357
  }
358
+ if (!boundary.outputs.some((output) => output.id === 'costBreakdown') && graphOutputs['costBreakdown']) {
359
+ outputs['costBreakdown'] = graphOutputs['costBreakdown'];
360
+ }
197
361
  if (!boundary.outputs.some((output) => output.id === 'duration')) {
198
362
  outputs['duration'] = { type: 'number', value: duration };
199
363
  }