@valerypopoff/rivet2-core 2.27.1 → 2.28.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.
@@ -496,8 +496,6 @@ __export(src_exports, {
496
496
  getSingleNodeStream: () => getSingleNodeStream,
497
497
  getStoredValueNode: () => getStoredValueNode,
498
498
  getSubgraphProjectKey: () => getSubgraphProjectKey,
499
- getSubgraphTargetBoundaryChange: () => getSubgraphTargetBoundaryChange,
500
- getSubgraphTargetBoundaryIssue: () => getSubgraphTargetBoundaryIssue,
501
499
  getToolNodeBodyPreview: () => getToolNodeBodyPreview,
502
500
  getUiGraphActionComponent: () => getUiGraphActionComponent,
503
501
  getUiGraphActionInputBindings: () => getUiGraphActionInputBindings,
@@ -801,6 +799,7 @@ __export(src_exports, {
801
799
  subGraphNode: () => subGraphNode,
802
800
  subqClassifierProvider: () => subqClassifierProvider,
803
801
  summarizeAgentResponseCalls: () => summarizeAgentResponseCalls,
802
+ summarizeAgentResponseCosts: () => summarizeAgentResponseCosts,
804
803
  summarizeChatV2RequestPlan: () => summarizeChatV2RequestPlan,
805
804
  summarizeDataValueForLog: () => summarizeDataValueForLog,
806
805
  summarizeErrorForLog: () => summarizeErrorForLog,
@@ -1308,8 +1307,6 @@ __export(exports_exports, {
1308
1307
  getSingleNodeStream: () => getSingleNodeStream,
1309
1308
  getStoredValueNode: () => getStoredValueNode,
1310
1309
  getSubgraphProjectKey: () => getSubgraphProjectKey,
1311
- getSubgraphTargetBoundaryChange: () => getSubgraphTargetBoundaryChange,
1312
- getSubgraphTargetBoundaryIssue: () => getSubgraphTargetBoundaryIssue,
1313
1310
  getToolNodeBodyPreview: () => getToolNodeBodyPreview,
1314
1311
  getUiGraphActionComponent: () => getUiGraphActionComponent,
1315
1312
  getUiGraphActionInputBindings: () => getUiGraphActionInputBindings,
@@ -1613,6 +1610,7 @@ __export(exports_exports, {
1613
1610
  subGraphNode: () => subGraphNode,
1614
1611
  subqClassifierProvider: () => subqClassifierProvider,
1615
1612
  summarizeAgentResponseCalls: () => summarizeAgentResponseCalls,
1613
+ summarizeAgentResponseCosts: () => summarizeAgentResponseCosts,
1616
1614
  summarizeChatV2RequestPlan: () => summarizeChatV2RequestPlan,
1617
1615
  summarizeDataValueForLog: () => summarizeDataValueForLog,
1618
1616
  summarizeErrorForLog: () => summarizeErrorForLog,
@@ -8163,15 +8161,18 @@ function getGraphBoundaryOutputDefinitions(boundary, outputPortOrder) {
8163
8161
  })
8164
8162
  );
8165
8163
  }
8166
- function buildGraphBoundaryInputData(boundary, inputs, defaults) {
8164
+ function buildGraphBoundaryInputData(boundary, inputs, defaults, previousBoundary) {
8167
8165
  const inputData = {};
8166
+ const callerPortIds = new Set(boundary.inputs.map((input) => input.portId));
8168
8167
  for (const input of boundary.inputs) {
8169
8168
  const inputValue = inputs[input.portId];
8170
8169
  if (inputValue != null) {
8171
8170
  inputData[input.portId] = inputValue;
8172
8171
  continue;
8173
8172
  }
8174
- const defaultValue = (defaults == null ? void 0 : defaults[input.portId]) ?? (defaults == null ? void 0 : defaults[input.id]);
8173
+ const defaultValue = (defaults == null ? void 0 : defaults[input.portId]) ?? (!callerPortIds.has(input.id) && !(previousBoundary == null ? void 0 : previousBoundary.inputs.some(
8174
+ (previous) => previous.portId !== input.portId && (previous.portId === input.id || previous.id === input.id)
8175
+ )) ? defaults == null ? void 0 : defaults[input.id] : void 0);
8175
8176
  if (defaultValue != null) {
8176
8177
  inputData[input.portId] = defaultValue;
8177
8178
  }
@@ -11942,51 +11943,32 @@ function getEventProjectScope(data) {
11942
11943
  }
11943
11944
 
11944
11945
  // src/model/nodes/SubGraphNode.ts
11945
- function getSubgraphTargetBoundaryChange(expected, actual) {
11946
- if (!expected) return null;
11947
- for (const side of ["inputs", "outputs"]) {
11948
- for (const port of expected[side]) {
11949
- const match9 = actual[side].find(
11950
- (candidate) => port.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId
11951
- );
11952
- if ((match9 == null ? void 0 : match9.dataType) !== port.dataType) {
11953
- return { side: side === "inputs" ? "input" : "output", id: port.id };
11954
- }
11955
- }
11956
- const callerIds = /* @__PURE__ */ new Set();
11957
- for (const port of actual[side]) {
11958
- const saved = expected[side].find(
11959
- (candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId
11960
- );
11961
- const callerId = (saved == null ? void 0 : saved.portId) ?? port.portId;
11962
- if (callerIds.has(callerId)) {
11963
- return { side: side === "inputs" ? "input" : "output", id: port.id };
11964
- }
11965
- callerIds.add(callerId);
11966
- }
11967
- }
11968
- return null;
11969
- }
11970
11946
  function reconcileSubgraphTargetBoundary(expected, actual) {
11971
11947
  if (!expected) return actual;
11972
11948
  return {
11973
- inputs: actual.inputs.map((port) => {
11974
- const saved = expected.inputs.find(
11975
- (candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId
11976
- );
11977
- return saved && saved.dataType === port.dataType ? { ...port, portId: saved.portId } : port;
11978
- }),
11979
- outputs: actual.outputs.map((port) => {
11980
- const saved = expected.outputs.find(
11981
- (candidate) => candidate.nodeId ? candidate.nodeId === port.nodeId : candidate.portId === port.portId
11982
- );
11983
- return saved && saved.dataType === port.dataType ? { ...port, portId: saved.portId } : port;
11984
- })
11949
+ inputs: reconcileSubgraphPorts(expected.inputs, actual.inputs),
11950
+ outputs: reconcileSubgraphPorts(expected.outputs, actual.outputs)
11985
11951
  };
11986
11952
  }
11987
- function getSubgraphTargetBoundaryIssue(expected, actual) {
11988
- const change = getSubgraphTargetBoundaryChange(expected, actual);
11989
- return change ? `The selected project's graph changed its ${change.side} "${change.id}". Re-select the graph and review its connections.` : null;
11953
+ function reconcileSubgraphPorts(expected, actual) {
11954
+ const matches = actual.map(
11955
+ (port) => expected.find((saved) => saved.nodeId ? saved.nodeId === port.nodeId : saved.portId === port.portId)
11956
+ );
11957
+ const reserved = new Set(matches.flatMap((saved) => saved ? [saved.portId] : []));
11958
+ const used = /* @__PURE__ */ new Set();
11959
+ return actual.map((port, index) => {
11960
+ const saved = matches[index];
11961
+ let portId = (saved == null ? void 0 : saved.portId) ?? port.portId;
11962
+ if (used.has(portId) || !saved && reserved.has(portId)) {
11963
+ const base = port.nodeId ?? port.portId;
11964
+ portId = base;
11965
+ for (let suffix = 2; used.has(portId) || reserved.has(portId); suffix++) {
11966
+ portId = `${base}:${suffix}`;
11967
+ }
11968
+ }
11969
+ used.add(portId);
11970
+ return portId === port.portId ? port : { ...port, portId };
11971
+ });
11990
11972
  }
11991
11973
  var SubGraphNodeImpl = class extends NodeImpl {
11992
11974
  static create() {
@@ -12040,13 +12022,10 @@ var SubGraphNodeImpl = class extends NodeImpl {
12040
12022
  })];
12041
12023
  }
12042
12024
  getTargetBoundary(project, referencedProjects, definitionContext) {
12043
- if (this.data.targetProjectId && this.data.targetBoundary) {
12044
- const target2 = this.getTargetProject(project, referencedProjects);
12045
- const actual = target2 && this.getBoundary(target2, definitionContext);
12046
- return actual && !getSubgraphTargetBoundaryChange(this.data.targetBoundary, actual) ? reconcileSubgraphTargetBoundary(this.data.targetBoundary, actual) : this.data.targetBoundary;
12047
- }
12048
12025
  const target = this.getTargetProject(project, referencedProjects);
12049
- return (target && this.getBoundary(target, definitionContext)) ?? (this.data.targetProjectId ? this.data.targetBoundary : void 0);
12026
+ const actual = target && this.getBoundary(target, definitionContext);
12027
+ if (!this.data.targetProjectId) return actual;
12028
+ return actual ? reconcileSubgraphTargetBoundary(this.data.targetBoundary, actual) : this.data.targetBoundary;
12050
12029
  }
12051
12030
  getEditors(context) {
12052
12031
  const definitions = [
@@ -12118,12 +12097,13 @@ var SubGraphNodeImpl = class extends NodeImpl {
12118
12097
  throw new Error(`SubGraphNode requires a graph with id ${this.data.graphId} to be present in the project.`);
12119
12098
  }
12120
12099
  const boundary = ((_a = context.getGraphBoundary) == null ? void 0 : _a.call(context, target, this.data.graphId)) ?? getGraphBoundary(target, this.data.graphId);
12121
- if (this.data.targetProjectId) {
12122
- const boundaryIssue = getSubgraphTargetBoundaryIssue(this.data.targetBoundary, boundary);
12123
- if (boundaryIssue) throw new Error(boundaryIssue);
12124
- }
12125
12100
  const callerBoundary = this.data.targetProjectId ? reconcileSubgraphTargetBoundary(this.data.targetBoundary, boundary) : boundary;
12126
- const callerInputData = buildGraphBoundaryInputData(callerBoundary, inputs, this.data.inputData);
12101
+ const callerInputData = buildGraphBoundaryInputData(
12102
+ callerBoundary,
12103
+ inputs,
12104
+ this.data.inputData,
12105
+ this.data.targetProjectId ? this.data.targetBoundary : void 0
12106
+ );
12127
12107
  const inputData = this.data.targetProjectId ? {} : callerInputData;
12128
12108
  if (this.data.targetProjectId) {
12129
12109
  for (const input of callerBoundary.inputs) {
@@ -12198,7 +12178,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
12198
12178
  value: void 0
12199
12179
  };
12200
12180
  }
12201
- if (outputs["duration"] == null) {
12181
+ if (!getSubgraphOutputNames(callerBoundary).has("duration") && outputs["duration"] == null) {
12202
12182
  outputs["duration"] = {
12203
12183
  type: "number",
12204
12184
  value: duration
@@ -12239,10 +12219,13 @@ var SubGraphNodeImpl = class extends NodeImpl {
12239
12219
  }
12240
12220
  };
12241
12221
  var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
12222
+ function getSubgraphOutputNames(boundary) {
12223
+ return new Set(boundary.outputs.flatMap((output) => [output.id, output.portId]));
12224
+ }
12242
12225
  function mapSubgraphTargetOutputs(boundary, graphOutputs) {
12243
- const targetNames = new Set(boundary.outputs.map((output) => output.id));
12226
+ const ownedNames = getSubgraphOutputNames(boundary);
12244
12227
  const outputs = Object.fromEntries(
12245
- Object.entries(graphOutputs).filter(([name]) => !targetNames.has(name))
12228
+ Object.entries(graphOutputs).filter(([name]) => !ownedNames.has(name))
12246
12229
  );
12247
12230
  for (const output of boundary.outputs) {
12248
12231
  if (Object.hasOwn(graphOutputs, output.id)) outputs[output.portId] = graphOutputs[output.id];
@@ -12266,13 +12249,14 @@ function buildOptimizedSubgraphOutputs(boundary, requestedOutputIds, graphOutput
12266
12249
  value: void 0
12267
12250
  };
12268
12251
  }
12269
- if (!boundary.outputs.some((output) => output.id === "cost")) {
12252
+ const ownedNames = getSubgraphOutputNames(boundary);
12253
+ if (!ownedNames.has("cost")) {
12270
12254
  outputs["cost"] = graphOutputs["cost"] ?? { type: "number", value: 0 };
12271
12255
  }
12272
- if (!boundary.outputs.some((output) => output.id === "costBreakdown") && graphOutputs["costBreakdown"]) {
12256
+ if (!ownedNames.has("costBreakdown") && graphOutputs["costBreakdown"]) {
12273
12257
  outputs["costBreakdown"] = graphOutputs["costBreakdown"];
12274
12258
  }
12275
- if (!boundary.outputs.some((output) => output.id === "duration")) {
12259
+ if (!ownedNames.has("duration")) {
12276
12260
  outputs["duration"] = { type: "number", value: duration };
12277
12261
  }
12278
12262
  return outputs;
@@ -12310,7 +12294,7 @@ function getCallerProject(owner, caller, projects) {
12310
12294
  function getCallerBoundary(caller, target) {
12311
12295
  if (caller.type !== "subGraph") return void 0;
12312
12296
  const actual = getGraphBoundary(target, caller.data.graphId);
12313
- if (!actual || getSubgraphTargetBoundaryChange(caller.data.targetBoundary, actual)) return void 0;
12297
+ if (!actual) return void 0;
12314
12298
  return reconcileSubgraphTargetBoundary(caller.data.targetBoundary, actual);
12315
12299
  }
12316
12300
  function canForwardGraphCallerOutputPartials(node) {
@@ -12432,7 +12416,8 @@ function getProjectStreamingOutputWatchConnections({
12432
12416
  const watchInputs = [];
12433
12417
  for (const [candidate, context] of contexts) {
12434
12418
  for (const node of Object.values(context.nodes)) {
12435
- if (node.type !== "watchStreamingOutput" && node.type !== "catchStreamingChunks" || node.disabled || isFrozen(context.project, candidate, node)) continue;
12419
+ if (node.type !== "watchStreamingOutput" && node.type !== "catchStreamingChunks" || node.disabled || isFrozen(context.project, candidate, node))
12420
+ continue;
12436
12421
  const inputs = context.incoming(node.id).filter((edge) => edge.inputId === "stream");
12437
12422
  if (inputs.length === 1) watchInputs.push({ graph: candidate, edge: inputs[0] });
12438
12423
  }
@@ -12530,7 +12515,13 @@ function getProjectStreamableGraphOutputNodeIdsByGraph({
12530
12515
  nodes.push({ id: callerId, type: "subGraph", title: "Probe", data: { graphId: graphId2 }, visualData: { x: 0, y: 0 } });
12531
12516
  for (const output of boundary.outputs) {
12532
12517
  const watchId = (0, import_non_secure9.nanoid)();
12533
- nodes.push({ id: watchId, type: "watchStreamingOutput", title: "Probe watch", data: {}, visualData: { x: 0, y: 0 } });
12518
+ nodes.push({
12519
+ id: watchId,
12520
+ type: "watchStreamingOutput",
12521
+ title: "Probe watch",
12522
+ data: {},
12523
+ visualData: { x: 0, y: 0 }
12524
+ });
12534
12525
  probes.push({
12535
12526
  graphId: graphId2,
12536
12527
  outputNodeId: output.nodeId,
@@ -19050,11 +19041,32 @@ function toProfileAttemptTrace(event) {
19050
19041
  const { type: _type, execution: _execution, ...trace } = event;
19051
19042
  return trace;
19052
19043
  }
19044
+ function summarizeAgentResponseCosts(modelCalls, profileAttempts) {
19045
+ var _a;
19046
+ let knownCostUsd = 0;
19047
+ let knownCount = 0;
19048
+ let callCount = 0;
19049
+ const add = (cost) => {
19050
+ callCount++;
19051
+ if (cost != null && Number.isFinite(cost) && cost >= 0) {
19052
+ knownCostUsd += cost;
19053
+ knownCount++;
19054
+ }
19055
+ };
19056
+ for (const call of modelCalls) add(call.pricing.status === "known" ? call.pricing.costUsd : void 0);
19057
+ for (const attempt of profileAttempts) {
19058
+ if (attempt.family === "classifier" && attempt.attemptIndex != null) add((_a = attempt.classifierUsage) == null ? void 0 : _a.estimatedCostUsd);
19059
+ }
19060
+ if (!Number.isFinite(knownCostUsd)) return { knownCostUsd: 0, costStatus: "unknown" };
19061
+ return {
19062
+ knownCostUsd,
19063
+ costStatus: knownCount === 0 ? "unknown" : knownCount < callCount ? "partial" : "known"
19064
+ };
19065
+ }
19053
19066
  function summarizeAgentResponseCalls(modelCalls, profileAttempts, toolCalls) {
19054
19067
  const classifierCalls = profileAttempts.filter(
19055
19068
  (attempt) => attempt.family === "classifier" && attempt.attemptIndex != null
19056
19069
  );
19057
- const accountedCallCount = modelCalls.length + classifierCalls.length;
19058
19070
  const usageKeys = ["promptTokens", "completionTokens", "totalTokens", "cachedTokens", "reasoningTokens"];
19059
19071
  const usage = Object.fromEntries(
19060
19072
  usageKeys.flatMap((key) => {
@@ -19072,19 +19084,6 @@ function summarizeAgentResponseCalls(modelCalls, profileAttempts, toolCalls) {
19072
19084
  return values2.length === 0 ? [] : [[key, values2.reduce((sum, value) => sum + value, 0)]];
19073
19085
  })
19074
19086
  );
19075
- const knownCosts = [
19076
- ...modelCalls.map((call) => call.pricing.costUsd).filter((value) => value != null && Number.isFinite(value)),
19077
- ...classifierCalls.flatMap(
19078
- (attempt) => {
19079
- var _a;
19080
- return ((_a = attempt.classifierUsage) == null ? void 0 : _a.estimatedCostUsd) == null ? [] : [attempt.classifierUsage.estimatedCostUsd];
19081
- }
19082
- )
19083
- ];
19084
- const unknownCostCount = modelCalls.filter((call) => call.pricing.status === "unknown" || !Number.isFinite(call.pricing.costUsd)).length + classifierCalls.filter((attempt) => {
19085
- var _a;
19086
- return ((_a = attempt.classifierUsage) == null ? void 0 : _a.estimatedCostUsd) == null;
19087
- }).length;
19088
19087
  const profileTransitions = countProfileFallbacks(modelCalls, profileAttempts);
19089
19088
  return {
19090
19089
  modelCallCount: modelCalls.length,
@@ -19093,8 +19092,7 @@ function summarizeAgentResponseCalls(modelCalls, profileAttempts, toolCalls) {
19093
19092
  retryCount: modelCalls.filter((call) => call.attemptIndex > 0).length + classifierCalls.filter((attempt) => attempt.attemptIndex > 0).length,
19094
19093
  fallbackCount: profileTransitions,
19095
19094
  ...usage,
19096
- knownCostUsd: knownCosts.reduce((sum, value) => sum + value, 0),
19097
- costStatus: accountedCallCount === 0 || unknownCostCount === accountedCallCount ? "unknown" : unknownCostCount > 0 ? "partial" : "known"
19095
+ ...summarizeAgentResponseCosts(modelCalls, profileAttempts)
19098
19096
  };
19099
19097
  }
19100
19098
  function countProfileFallbacks(modelCalls, profileAttempts) {
@@ -48324,50 +48322,66 @@ function samePluginRequirement(left, right) {
48324
48322
  return left.package === right.package && left.tag === right.tag;
48325
48323
  return left.type === "uri" && right.type === "uri" && left.uri === right.uri;
48326
48324
  }
48325
+ function describeBundleCallSource(source) {
48326
+ return `node "${source.nodeTitle}" (${source.nodeId}) in graph "${source.graphName}" of project "${source.projectName}"`;
48327
+ }
48327
48328
  function* projectSubgraphs(project) {
48329
+ var _a;
48328
48330
  for (const [sourceGraphId, graph] of Object.entries(project.graphs)) {
48329
48331
  for (const authored of graph.nodes) {
48330
48332
  const node = resolveNodePrefabInstance(project, authored);
48331
- if (!node.disabled && node.type === "nodePrefabInstance")
48332
- throw new ProjectBundleError(`Bundle contains an unresolved library node ${node.id}.`);
48333
- if (node.disabled || node.type !== "subGraph") continue;
48333
+ if (node.disabled || node.type !== "subGraph" && node.type !== "nodePrefabInstance") continue;
48334
+ const source = {
48335
+ projectName: project.metadata.title || project.metadata.id,
48336
+ graphName: ((_a = graph.metadata) == null ? void 0 : _a.name) || sourceGraphId,
48337
+ nodeId: authored.id,
48338
+ nodeTitle: node.title || "Subgraph"
48339
+ };
48340
+ if (node.type === "nodePrefabInstance")
48341
+ throw new ProjectBundleError(`Bundle contains an unresolved library ${describeBundleCallSource(source)}.`);
48334
48342
  const data = node.data;
48335
48343
  if (data.targetProjectId) {
48336
48344
  if (data.targetVersion !== void 0 && data.targetVersion !== "latest" && data.targetVersion !== "published")
48337
- throw new ProjectBundleError("Invalid Subgraph project version.");
48345
+ throw new ProjectBundleError(
48346
+ `Invalid Subgraph project version. Check Subgraph ${describeBundleCallSource(source)}.`
48347
+ );
48338
48348
  } else if (data.targetScope) {
48339
- throw new ProjectBundleError(`Subgraph ${node.title || node.id} has no selected project.`);
48349
+ throw new ProjectBundleError(
48350
+ `Subgraph has no selected project. Check Subgraph ${describeBundleCallSource(source)}.`
48351
+ );
48340
48352
  }
48341
- yield { sourceGraphId, data };
48353
+ yield { sourceGraphId, data, source };
48342
48354
  }
48343
48355
  }
48344
48356
  }
48345
48357
  function listProjectBundleCalls(project) {
48346
48358
  const calls = [];
48347
- for (const { data } of projectSubgraphs(project)) {
48359
+ for (const { data, source } of projectSubgraphs(project)) {
48348
48360
  if (data.targetProjectId)
48349
48361
  calls.push({
48350
48362
  projectId: data.targetProjectId,
48351
48363
  version: data.targetVersion ?? "latest",
48352
48364
  graphId: data.graphId,
48353
- boundary: data.targetBoundary
48365
+ boundary: data.targetBoundary,
48366
+ source
48354
48367
  });
48355
48368
  }
48356
48369
  return calls;
48357
48370
  }
48358
- function validateProjectBundleCall(call, target) {
48359
- if (!Object.hasOwn(target.graphs, call.graphId))
48360
- throw new ProjectBundleError(`Subgraph dependency is missing graph ${call.graphId}.`);
48361
- const boundary = getGraphBoundary(target, call.graphId);
48362
- if (!boundary) throw new ProjectBundleError(`Subgraph dependency is missing graph ${call.graphId}.`);
48363
- const issue = getSubgraphTargetBoundaryIssue(call.boundary, boundary);
48364
- if (issue) throw new ProjectBundleError(`Subgraph dependency has an incompatible boundary. ${issue}`);
48371
+ function validateProjectBundleCall(call, target, selectedVersion) {
48372
+ const graph = Object.hasOwn(target.graphs, call.graphId) ? target.graphs[call.graphId] : void 0;
48373
+ if (graph) return;
48374
+ const source = call.source ? `Check Subgraph ${describeBundleCallSource(call.source)}. ` : "";
48375
+ const version = selectedVersion ? ` (${selectedVersion === "published" ? "Published" : "Saved latest"})` : "";
48376
+ const location = `${source}Target: graph "${call.graphId}" in project "${target.metadata.title || target.metadata.id}"${version}.`;
48377
+ throw new ProjectBundleError(`Subgraph dependency is missing graph ${call.graphId}. ${location}`);
48365
48378
  }
48366
48379
  function validateProjectBundleProjects(manifest, projects) {
48367
48380
  const targets = new Map(manifest.targets.map((t) => [projectBundleTargetKey(t.projectId, t.version), t.artifact]));
48368
48381
  const references = new Map(manifest.references.map((r) => [r.projectId, r.artifact]));
48369
48382
  const plugins2 = new Map(manifest.plugins.map((plugin) => [plugin.id, plugin]));
48370
48383
  const members = manifest.workspace ? new Set(manifest.workspace.members.map((m) => m.projectId)) : void 0;
48384
+ const versions = new Map(manifest.artifacts.map((artifact) => [artifact.id, artifact.version]));
48371
48385
  const vertices = /* @__PURE__ */ new Map();
48372
48386
  const graphKey = (artifact, graph) => JSON.stringify([artifact, graph]);
48373
48387
  for (const artifact of manifest.artifacts) {
@@ -48383,7 +48397,7 @@ function validateProjectBundleProjects(manifest, projects) {
48383
48397
  }
48384
48398
  for (const artifact of manifest.artifacts) {
48385
48399
  const project = projects.get(artifact.id);
48386
- for (const { sourceGraphId, data } of projectSubgraphs(project)) {
48400
+ for (const { sourceGraphId, data, source } of projectSubgraphs(project)) {
48387
48401
  let targetId = artifact.id;
48388
48402
  if (data.targetProjectId) {
48389
48403
  if ((members == null ? void 0 : members.has(data.targetProjectId)) && !members.has(project.metadata.id))
@@ -48394,13 +48408,16 @@ function validateProjectBundleProjects(manifest, projects) {
48394
48408
  projectId: data.targetProjectId,
48395
48409
  version: data.targetVersion ?? "latest",
48396
48410
  graphId: data.graphId,
48397
- boundary: data.targetBoundary
48411
+ boundary: data.targetBoundary,
48412
+ source
48398
48413
  };
48399
48414
  const id = targets.get(projectBundleTargetKey(call.projectId, call.version));
48400
48415
  const target2 = id && projects.get(id);
48401
48416
  if (!id || !target2)
48402
- throw new ProjectBundleError(`Bundle is missing Subgraph ${call.projectId}:${call.version}:${call.graphId}`);
48403
- validateProjectBundleCall(call, target2);
48417
+ throw new ProjectBundleError(
48418
+ `Bundle is missing Subgraph ${call.projectId}:${call.version}:${call.graphId}. Check Subgraph ${describeBundleCallSource(source)}.`
48419
+ );
48420
+ validateProjectBundleCall(call, target2, versions.get(id));
48404
48421
  targetId = id;
48405
48422
  }
48406
48423
  const target = vertices.get(graphKey(targetId, data.graphId));
@@ -56465,8 +56482,6 @@ var Rivet = void 0;
56465
56482
  getSingleNodeStream,
56466
56483
  getStoredValueNode,
56467
56484
  getSubgraphProjectKey,
56468
- getSubgraphTargetBoundaryChange,
56469
- getSubgraphTargetBoundaryIssue,
56470
56485
  getToolNodeBodyPreview,
56471
56486
  getUiGraphActionComponent,
56472
56487
  getUiGraphActionInputBindings,
@@ -56770,6 +56785,7 @@ var Rivet = void 0;
56770
56785
  subGraphNode,
56771
56786
  subqClassifierProvider,
56772
56787
  summarizeAgentResponseCalls,
56788
+ summarizeAgentResponseCosts,
56773
56789
  summarizeChatV2RequestPlan,
56774
56790
  summarizeDataValueForLog,
56775
56791
  summarizeErrorForLog,