@inkeep/agents-run-api 0.16.3 → 0.18.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.
@@ -303,13 +303,26 @@ var _LocalSandboxExecutor = class _LocalSandboxExecutor {
303
303
  const execute = ${executeCode};
304
304
  const args = ${JSON.stringify(args)};
305
305
 
306
- execute(args)
307
- .then(result => {
306
+ try {
307
+ const result = execute(args);
308
+
309
+ // Handle both sync and async functions
310
+ if (result && typeof result.then === 'function') {
311
+ // Async function - result is a Promise
312
+ result
313
+ .then(result => {
314
+ console.log(JSON.stringify({ success: true, result }));
315
+ })
316
+ .catch(error => {
317
+ console.log(JSON.stringify({ success: false, error: error.message }));
318
+ });
319
+ } else {
320
+ // Sync function - result is immediate
308
321
  console.log(JSON.stringify({ success: true, result }));
309
- })
310
- .catch(error => {
311
- console.log(JSON.stringify({ success: false, error: error.message }));
312
- });
322
+ }
323
+ } catch (error) {
324
+ console.log(JSON.stringify({ success: false, error: error.message }));
325
+ }
313
326
  `;
314
327
  }
315
328
  };
@@ -45,8 +45,8 @@ async function saveA2AMessageResponse(response, params) {
45
45
  },
46
46
  visibility: params.visibility,
47
47
  messageType: params.messageType,
48
- fromAgentId: params.fromAgentId,
49
- toAgentId: params.toAgentId,
48
+ fromSubAgentId: params.fromSubAgentId,
49
+ toSubAgentId: params.toSubAgentId,
50
50
  fromExternalAgentId: params.fromExternalAgentId,
51
51
  toExternalAgentId: params.toExternalAgentId,
52
52
  a2aTaskId: params.a2aTaskId,
@@ -67,23 +67,23 @@ async function getScopedHistory({
67
67
  conversationId,
68
68
  options
69
69
  });
70
- if (!filters || !filters.agentId && !filters.taskId) {
70
+ if (!filters || !filters.subAgentId && !filters.taskId) {
71
71
  return messages;
72
72
  }
73
73
  const relevantMessages = messages.filter((msg) => {
74
74
  if (msg.role === "user") return true;
75
75
  let matchesAgent = true;
76
76
  let matchesTask = true;
77
- if (filters.agentId) {
78
- matchesAgent = msg.role === "agent" && msg.visibility === "user-facing" || msg.toAgentId === filters.agentId || msg.fromAgentId === filters.agentId;
77
+ if (filters.subAgentId) {
78
+ matchesAgent = msg.role === "agent" && msg.visibility === "user-facing" || msg.toAgentId === filters.subAgentId || msg.fromAgentId === filters.subAgentId;
79
79
  }
80
80
  if (filters.taskId) {
81
81
  matchesTask = msg.taskId === filters.taskId || msg.a2aTaskId === filters.taskId;
82
82
  }
83
- if (filters.agentId && filters.taskId) {
83
+ if (filters.subAgentId && filters.taskId) {
84
84
  return matchesAgent && matchesTask;
85
85
  }
86
- if (filters.agentId) {
86
+ if (filters.subAgentId) {
87
87
  return matchesAgent;
88
88
  }
89
89
  if (filters.taskId) {
@@ -184,7 +184,9 @@ async function getConversationScopedArtifacts(params) {
184
184
  if (visibleMessages.length === 0) {
185
185
  return [];
186
186
  }
187
- const visibleMessageIds = visibleMessages.filter((msg) => !(msg.messageType === "system" && msg.content?.text?.includes("Previous conversation history truncated"))).map((msg) => msg.id);
187
+ const visibleMessageIds = visibleMessages.filter(
188
+ (msg) => !(msg.messageType === "system" && msg.content?.text?.includes("Previous conversation history truncated"))
189
+ ).map((msg) => msg.id);
188
190
  if (visibleMessageIds.length === 0) {
189
191
  return [];
190
192
  }
@@ -1 +1 @@
1
- export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-5GUNCN5X.js';
1
+ export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-DQQRVSJS.js';