@bubblelab/bubble-core 0.1.212 → 0.1.214

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 (97) hide show
  1. package/dist/bubble-bundle.d.ts +147 -147
  2. package/dist/bubbles/service-bubble/agi-inc.d.ts +132 -132
  3. package/dist/bubbles/service-bubble/ai-agent.d.ts +8 -8
  4. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  5. package/dist/bubbles/service-bubble/ai-agent.js +208 -25
  6. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  7. package/dist/bubbles/service-bubble/airtable.d.ts +106 -106
  8. package/dist/bubbles/service-bubble/apify/apify.d.ts +12 -12
  9. package/dist/bubbles/service-bubble/ashby/ashby.d.ts +88 -88
  10. package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +68 -68
  11. package/dist/bubbles/service-bubble/assembled/assembled.d.ts +53 -53
  12. package/dist/bubbles/service-bubble/assembled/assembled.schema.d.ts +24 -24
  13. package/dist/bubbles/service-bubble/attio/attio.d.ts +64 -64
  14. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +57 -57
  15. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +12 -12
  16. package/dist/bubbles/service-bubble/capability-pipeline.d.ts.map +1 -1
  17. package/dist/bubbles/service-bubble/capability-pipeline.js +14 -5
  18. package/dist/bubbles/service-bubble/capability-pipeline.js.map +1 -1
  19. package/dist/bubbles/service-bubble/confluence/confluence.d.ts +43 -43
  20. package/dist/bubbles/service-bubble/confluence/confluence.schema.d.ts +4 -4
  21. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +94 -94
  22. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +150 -150
  23. package/dist/bubbles/service-bubble/eleven-labs.d.ts +48 -48
  24. package/dist/bubbles/service-bubble/firecrawl.d.ts +407 -407
  25. package/dist/bubbles/service-bubble/followupboss.d.ts +256 -256
  26. package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +44 -44
  27. package/dist/bubbles/service-bubble/fullenrich/fullenrich.schema.d.ts +124 -124
  28. package/dist/bubbles/service-bubble/github.d.ts +162 -162
  29. package/dist/bubbles/service-bubble/gmail.d.ts +200 -200
  30. package/dist/bubbles/service-bubble/google-calendar.d.ts +138 -138
  31. package/dist/bubbles/service-bubble/google-drive.d.ts +122 -122
  32. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +52 -52
  33. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +26 -26
  34. package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
  35. package/dist/bubbles/service-bubble/http.d.ts +8 -8
  36. package/dist/bubbles/service-bubble/hubspot/hubspot.d.ts +20 -20
  37. package/dist/bubbles/service-bubble/insforge-db.d.ts +4 -4
  38. package/dist/bubbles/service-bubble/jira/jira.d.ts +96 -96
  39. package/dist/bubbles/service-bubble/jira/jira.schema.d.ts +77 -77
  40. package/dist/bubbles/service-bubble/linear/linear.d.ts +44 -44
  41. package/dist/bubbles/service-bubble/linear/linear.schema.d.ts +15 -15
  42. package/dist/bubbles/service-bubble/notion/notion.d.ts +794 -794
  43. package/dist/bubbles/service-bubble/postgresql.d.ts +4 -4
  44. package/dist/bubbles/service-bubble/posthog/posthog.d.ts +26 -26
  45. package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts +26 -26
  46. package/dist/bubbles/service-bubble/resend.d.ts +24 -24
  47. package/dist/bubbles/service-bubble/s3/s3.d.ts +44 -44
  48. package/dist/bubbles/service-bubble/s3/s3.schema.d.ts +14 -14
  49. package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts +18 -18
  50. package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.d.ts +6 -6
  51. package/dist/bubbles/service-bubble/slack/slack.d.ts +364 -364
  52. package/dist/bubbles/service-bubble/storage.d.ts +88 -88
  53. package/dist/bubbles/service-bubble/stripe/stripe.d.ts +99 -99
  54. package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +59 -59
  55. package/dist/bubbles/service-bubble/telegram.d.ts +120 -120
  56. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +26 -26
  57. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +3 -3
  58. package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/tool.d.ts +4 -4
  59. package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/tool.d.ts +4 -4
  60. package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/tool.d.ts +4 -4
  61. package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/tool.d.ts +4 -4
  62. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +8 -8
  63. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +8 -8
  64. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +4 -4
  65. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +14 -14
  66. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
  67. package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
  68. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +8 -8
  69. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +8 -8
  70. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +40 -40
  71. package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +4 -4
  72. package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +4 -4
  73. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
  74. package/dist/bubbles/tool-bubble/list-capabilities-tool.d.ts +4 -4
  75. package/dist/bubbles/tool-bubble/people-search-tool.d.ts +38 -38
  76. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +14 -14
  77. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
  78. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +4 -4
  79. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +8 -8
  80. package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
  81. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +8 -8
  82. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +8 -8
  83. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
  84. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +8 -8
  85. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +8 -8
  86. package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +8 -8
  87. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +8 -8
  88. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  89. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +4 -4
  90. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +8 -8
  91. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +58 -58
  92. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +24 -24
  93. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +6 -6
  94. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +22 -22
  95. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +4 -4
  96. package/dist/bubbles.json +1 -1
  97. package/package.json +2 -2
@@ -233,13 +233,13 @@ declare const AIAgentParamsSchema: z.ZodObject<{
233
233
  memoryEnabled: boolean;
234
234
  enableSlackHistory: boolean;
235
235
  name?: string | undefined;
236
- credentials?: Partial<Record<CredentialType, string>> | undefined;
237
236
  conversationHistory?: {
238
237
  role: "user" | "assistant" | "tool";
239
238
  content: string;
240
239
  toolCallId?: string | undefined;
241
240
  name?: string | undefined;
242
241
  }[] | undefined;
242
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
243
243
  customTools?: {
244
244
  description: string;
245
245
  name: string;
@@ -256,7 +256,6 @@ declare const AIAgentParamsSchema: z.ZodObject<{
256
256
  }, {
257
257
  message: string;
258
258
  name?: string | undefined;
259
- credentials?: Partial<Record<CredentialType, string>> | undefined;
260
259
  images?: ({
261
260
  data: string;
262
261
  type?: "base64" | undefined;
@@ -290,6 +289,7 @@ declare const AIAgentParamsSchema: z.ZodObject<{
290
289
  maxRetries?: number | undefined;
291
290
  } | undefined;
292
291
  } | undefined;
292
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
293
293
  tools?: {
294
294
  name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool";
295
295
  credentials?: Partial<Record<CredentialType, string>> | undefined;
@@ -334,8 +334,8 @@ declare const AIAgentResultSchema: z.ZodObject<{
334
334
  error: z.ZodString;
335
335
  success: z.ZodBoolean;
336
336
  }, "strip", z.ZodTypeAny, {
337
- success: boolean;
338
337
  error: string;
338
+ success: boolean;
339
339
  response: string;
340
340
  toolCalls: {
341
341
  tool: string;
@@ -346,8 +346,8 @@ declare const AIAgentResultSchema: z.ZodObject<{
346
346
  reasoning?: string | null | undefined;
347
347
  totalCost?: number | undefined;
348
348
  }, {
349
- success: boolean;
350
349
  error: string;
350
+ success: boolean;
351
351
  response: string;
352
352
  toolCalls: {
353
353
  tool: string;
@@ -572,13 +572,13 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
572
572
  memoryEnabled: boolean;
573
573
  enableSlackHistory: boolean;
574
574
  name?: string | undefined;
575
- credentials?: Partial<Record<CredentialType, string>> | undefined;
576
575
  conversationHistory?: {
577
576
  role: "user" | "assistant" | "tool";
578
577
  content: string;
579
578
  toolCallId?: string | undefined;
580
579
  name?: string | undefined;
581
580
  }[] | undefined;
581
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
582
582
  customTools?: {
583
583
  description: string;
584
584
  name: string;
@@ -595,7 +595,6 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
595
595
  }, {
596
596
  message: string;
597
597
  name?: string | undefined;
598
- credentials?: Partial<Record<CredentialType, string>> | undefined;
599
598
  images?: ({
600
599
  data: string;
601
600
  type?: "base64" | undefined;
@@ -629,6 +628,7 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
629
628
  maxRetries?: number | undefined;
630
629
  } | undefined;
631
630
  } | undefined;
631
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
632
632
  tools?: {
633
633
  name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool";
634
634
  credentials?: Partial<Record<CredentialType, string>> | undefined;
@@ -673,8 +673,8 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
673
673
  error: z.ZodString;
674
674
  success: z.ZodBoolean;
675
675
  }, "strip", z.ZodTypeAny, {
676
- success: boolean;
677
676
  error: string;
677
+ success: boolean;
678
678
  response: string;
679
679
  toolCalls: {
680
680
  tool: string;
@@ -685,8 +685,8 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
685
685
  reasoning?: string | null | undefined;
686
686
  totalCost?: number | undefined;
687
687
  }, {
688
- success: boolean;
689
688
  error: string;
689
+ success: boolean;
690
690
  response: string;
691
691
  toolCalls: {
692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;;OAGG;IACH,OAAO,CAAC,2BAA2B;IA2CnC,SAAS,CAAC,iBAAiB,IAAI,cAAc;IAI7C;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgBjC,SAAS,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;IA2BhD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;OAGG;YACW,gCAAgC;IA6J9C,OAAO,CAAC,eAAe;YAyKT,eAAe;IAwb7B;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAgCpC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAgDjC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuDvB;;OAEG;YACW,qBAAqB;YA6RrB,gBAAgB;YA2ahB,YAAY;CA2uB3B"}
@@ -1163,8 +1163,9 @@ export class AIAgentBubble extends ServiceBubble {
1163
1163
  capabilityTask: task,
1164
1164
  };
1165
1165
  this._trace('use-capability', `snapshotted master state before delegating`, {
1166
- masterMsgCount: this._currentGraphMessages.length,
1166
+ masterMessageCount: this._currentGraphMessages.length,
1167
1167
  capabilityId,
1168
+ capabilityTask: task,
1168
1169
  });
1169
1170
  }
1170
1171
  const subAgent = new AIAgentBubble({
@@ -1460,6 +1461,19 @@ export class AIAgentBubble extends ServiceBubble {
1460
1461
  messages: currentMessages,
1461
1462
  bubbleContext: this.context,
1462
1463
  });
1464
+ // Trace hook result
1465
+ if (beforeHook) {
1466
+ this._trace('hook', `beforeToolCall:${toolCall.name}`, {
1467
+ toolName: toolCall.name,
1468
+ shouldSkip: hookResult_before?.shouldSkip ?? false,
1469
+ messagesModified: !!hookResult_before?.messages,
1470
+ });
1471
+ }
1472
+ this._trace('tool', `start:${toolCall.name}`, {
1473
+ toolName: toolCall.name,
1474
+ toolCallId: toolCall.id ?? '',
1475
+ input: toolCall.args,
1476
+ });
1463
1477
  this.streamingCallback?.({
1464
1478
  type: 'tool_call_start',
1465
1479
  data: {
@@ -1480,6 +1494,13 @@ export class AIAgentBubble extends ServiceBubble {
1480
1494
  toolCall.args = hookResult_before.toolInput;
1481
1495
  // If hook requests skipping, create synthetic ToolMessage and stop agent loop
1482
1496
  if (hookResult_before.shouldSkip) {
1497
+ this._trace('tool', `skipped:${toolCall.name}`, {
1498
+ toolName: toolCall.name,
1499
+ toolCallId: toolCall.id ?? '',
1500
+ input: toolCall.args,
1501
+ skipMessage: hookResult_before.skipMessage || 'Tool execution was skipped.',
1502
+ reason: 'beforeToolCall hook requested skip',
1503
+ });
1483
1504
  const skipMsg = new ToolMessage({
1484
1505
  content: hookResult_before.skipMessage || 'Tool execution was skipped.',
1485
1506
  tool_call_id: toolCall.id,
@@ -1507,6 +1528,14 @@ export class AIAgentBubble extends ServiceBubble {
1507
1528
  });
1508
1529
  toolMessages.push(toolMessage);
1509
1530
  currentMessages = [...currentMessages, toolMessage];
1531
+ const toolDurationMs = Date.now() - startTime;
1532
+ this._trace('tool', `complete:${toolCall.name}`, {
1533
+ toolName: toolCall.name,
1534
+ toolCallId: toolCall.id ?? '',
1535
+ input: toolCall.args,
1536
+ output: toolOutput,
1537
+ durationMs: toolDurationMs,
1538
+ });
1510
1539
  // Call afterToolCall hook — capability-scoped hook takes priority, then global
1511
1540
  const afterHook = this.capabilityAfterHooks.get(toolCall.name) ??
1512
1541
  this.afterToolCallHook;
@@ -1517,6 +1546,14 @@ export class AIAgentBubble extends ServiceBubble {
1517
1546
  messages: currentMessages,
1518
1547
  bubbleContext: this.context,
1519
1548
  });
1549
+ // Trace hook result
1550
+ if (afterHook) {
1551
+ this._trace('hook', `afterToolCall:${toolCall.name}`, {
1552
+ toolName: toolCall.name,
1553
+ shouldStop: hookResult_after?.shouldStop ?? false,
1554
+ messagesModified: !!hookResult_after?.messages,
1555
+ });
1556
+ }
1520
1557
  // If hook returns modified messages, update current messages
1521
1558
  if (hookResult_after) {
1522
1559
  if (hookResult_after.messages) {
@@ -1535,7 +1572,7 @@ export class AIAgentBubble extends ServiceBubble {
1535
1572
  input: toolCall.args,
1536
1573
  tool: toolCall.name,
1537
1574
  output: toolOutput,
1538
- duration: Date.now() - startTime,
1575
+ duration: toolDurationMs,
1539
1576
  variableId: this.context?.variableId,
1540
1577
  },
1541
1578
  });
@@ -1543,6 +1580,13 @@ export class AIAgentBubble extends ServiceBubble {
1543
1580
  catch (error) {
1544
1581
  console.error(`Error executing tool ${toolCall.name}:`, error);
1545
1582
  const errorContent = `Error: ${error instanceof Error ? error.message : 'Unknown error'}`;
1583
+ this._trace('tool', `error:${toolCall.name}`, {
1584
+ toolName: toolCall.name,
1585
+ toolCallId: toolCall.id ?? '',
1586
+ input: toolCall.args,
1587
+ error: errorContent,
1588
+ durationMs: Date.now() - startTime,
1589
+ });
1546
1590
  const errorMessage = new ToolMessage({
1547
1591
  content: errorContent,
1548
1592
  tool_call_id: toolCall.id,
@@ -1584,17 +1628,29 @@ export class AIAgentBubble extends ServiceBubble {
1584
1628
  // Define the agent node
1585
1629
  const agentNode = async ({ messages }) => {
1586
1630
  this._trace('agentNode', `LLM CALL`, {
1587
- msgCount: messages.length,
1588
- lastMsgType: messages[messages.length - 1]?._getType(),
1589
- lastMsgPreview: (() => {
1590
- const last = messages[messages.length - 1];
1591
- if (!last)
1592
- return '';
1593
- const content = typeof last.content === 'string'
1594
- ? last.content
1595
- : JSON.stringify(last.content);
1596
- return content.slice(0, 120);
1597
- })(),
1631
+ model: this.params.model.model,
1632
+ temperature: this.params.model.temperature,
1633
+ messageCount: messages.length,
1634
+ messages: messages.map((m) => {
1635
+ const role = m._getType();
1636
+ const content = typeof m.content === 'string'
1637
+ ? m.content
1638
+ : JSON.stringify(m.content);
1639
+ const entry = { role, content };
1640
+ if ('tool_calls' in m &&
1641
+ Array.isArray(m.tool_calls) &&
1642
+ m.tool_calls.length > 0) {
1643
+ entry.toolCalls = m.tool_calls.map((tc) => ({
1644
+ name: tc.name,
1645
+ id: tc.id,
1646
+ args: tc.args,
1647
+ }));
1648
+ }
1649
+ if ('tool_call_id' in m) {
1650
+ entry.toolCallId = m.tool_call_id;
1651
+ }
1652
+ return entry;
1653
+ }),
1598
1654
  });
1599
1655
  // systemPrompt is already enhanced by beforeAction() if expectedOutputSchema was provided
1600
1656
  // Use cache_control for Anthropic models to cache the system prompt across iterations
@@ -1702,11 +1758,49 @@ export class AIAgentBubble extends ServiceBubble {
1702
1758
  },
1703
1759
  ],
1704
1760
  });
1761
+ this._trace('agentNode', 'LLM RESPONSE', {
1762
+ content: typeof response.content === 'string'
1763
+ ? response.content
1764
+ : JSON.stringify(response.content),
1765
+ toolCalls: 'tool_calls' in response && Array.isArray(response.tool_calls)
1766
+ ? response.tool_calls.map((tc) => ({
1767
+ name: tc.name,
1768
+ id: tc.id,
1769
+ args: tc.args,
1770
+ }))
1771
+ : undefined,
1772
+ tokenUsage: response.usage_metadata
1773
+ ? {
1774
+ inputTokens: response.usage_metadata.input_tokens,
1775
+ outputTokens: response.usage_metadata.output_tokens,
1776
+ totalTokens: response.usage_metadata.total_tokens,
1777
+ }
1778
+ : undefined,
1779
+ });
1705
1780
  return { messages: [response] };
1706
1781
  }
1707
1782
  else {
1708
1783
  // Non-streaming fallback
1709
1784
  const response = await modelWithTools.invoke(allMessages);
1785
+ this._trace('agentNode', 'LLM RESPONSE', {
1786
+ content: typeof response.content === 'string'
1787
+ ? response.content
1788
+ : JSON.stringify(response.content),
1789
+ toolCalls: 'tool_calls' in response && Array.isArray(response.tool_calls)
1790
+ ? response.tool_calls.map((tc) => ({
1791
+ name: tc.name,
1792
+ id: tc.id,
1793
+ args: tc.args,
1794
+ }))
1795
+ : undefined,
1796
+ tokenUsage: response.usage_metadata
1797
+ ? {
1798
+ inputTokens: response.usage_metadata.input_tokens,
1799
+ outputTokens: response.usage_metadata.output_tokens,
1800
+ totalTokens: response.usage_metadata.total_tokens,
1801
+ }
1802
+ : undefined,
1803
+ });
1710
1804
  return { messages: [response] };
1711
1805
  }
1712
1806
  }
@@ -1798,37 +1892,52 @@ export class AIAgentBubble extends ServiceBubble {
1798
1892
  // Check if the last AI message has tool calls
1799
1893
  if (lastAIMessage?.tool_calls && lastAIMessage.tool_calls.length > 0) {
1800
1894
  this._trace('afterLLMCheck', `→ tools`, {
1895
+ result: 'tools',
1896
+ toolCallCount: lastAIMessage.tool_calls.length,
1801
1897
  toolCalls: lastAIMessage.tool_calls
1802
1898
  .map((tc) => `${tc.name}(${tc.id?.slice(-8)})`)
1803
1899
  .join(', '),
1804
1900
  });
1805
1901
  return 'tools';
1806
1902
  }
1807
- this._trace('afterLLMCheck', `→ __end__ (no tool calls)`);
1903
+ this._trace('afterLLMCheck', `→ __end__ (no tool calls)`, {
1904
+ result: '__end__',
1905
+ reason: 'no tool calls',
1906
+ });
1808
1907
  return '__end__';
1809
1908
  };
1810
1909
  // Define conditional edge after tools to check if we should stop
1811
1910
  const shouldContinueAfterTools = () => {
1812
1911
  const execMeta = this.context?.executionMeta;
1813
1912
  this._trace('shouldContinueAfterTools', `CHECK`, {
1814
- shouldStop: this.shouldStopAfterTools,
1913
+ shouldStopAfterTools: this.shouldStopAfterTools,
1815
1914
  pendingApproval: !!execMeta?._pendingApproval,
1816
1915
  });
1817
1916
  // Check if the afterToolCall hook requested stopping
1818
1917
  if (this.shouldStopAfterTools) {
1819
- this._trace('shouldContinueAfterTools', `→ __end__ (shouldStopAfterTools)`);
1918
+ this._trace('shouldContinueAfterTools', `→ __end__ (shouldStopAfterTools)`, {
1919
+ result: '__end__',
1920
+ reason: 'shouldStopAfterTools',
1921
+ shouldStopAfterTools: true,
1922
+ });
1820
1923
  return '__end__';
1821
1924
  }
1822
1925
  // Check for pending approval signal from sub-agent (shared via executionMeta).
1823
1926
  // In multi-capability mode the master and sub-agent share the same BubbleContext,
1824
1927
  // so a sub-agent setting _pendingApproval is visible here.
1825
1928
  if (execMeta?._pendingApproval) {
1826
- this._trace('shouldContinueAfterTools', `→ __end__ (pendingApproval)`);
1929
+ this._trace('shouldContinueAfterTools', `→ __end__ (pendingApproval)`, {
1930
+ result: '__end__',
1931
+ reason: 'pendingApproval',
1932
+ pendingApproval: true,
1933
+ });
1827
1934
  this.shouldStopAfterTools = true;
1828
1935
  return '__end__';
1829
1936
  }
1830
1937
  // Otherwise continue back to agent
1831
- this._trace('shouldContinueAfterTools', `→ agent (continue)`);
1938
+ this._trace('shouldContinueAfterTools', `→ agent (continue)`, {
1939
+ result: 'agent',
1940
+ });
1832
1941
  return 'agent';
1833
1942
  };
1834
1943
  // Build the graph
@@ -1976,19 +2085,66 @@ export class AIAgentBubble extends ServiceBubble {
1976
2085
  shouldStopAfterTools: this.shouldStopAfterTools,
1977
2086
  });
1978
2087
  // If a new approval was triggered during V2 resume (subagent set _pendingApproval),
1979
- // we should stop the master loop immediately to avoid re-executing.
2088
+ // skip the agent loop entirely. The subagent is blocked on approval — running the
2089
+ // master LLM would just see an empty response and re-delegate, creating duplicate
2090
+ // approvals. Return the last AI message from the repaired messages as the response.
1980
2091
  if (resumeExecMeta?._pendingApproval) {
1981
- this._trace('v2-resume', `_pendingApproval detected — will stop master loop`);
1982
- this.shouldStopAfterTools = true;
2092
+ const approval = resumeExecMeta._pendingApproval;
2093
+ this._trace('v2-resume', `_pendingApproval detected — skipping agent loop`, {
2094
+ action: approval.action,
2095
+ targetFlowName: approval.targetFlowName,
2096
+ });
2097
+ // Use the subagent's last AI text (captured in _pendingApproval)
2098
+ // as the response. Do NOT use the master's original AI text — that
2099
+ // would cause the same stale message to be posted to Slack on every resume.
2100
+ const lastAIText = resumeExecMeta._pendingApproval.lastAIText;
2101
+ const action = approval.action ?? 'proceed';
2102
+ const flowName = approval.targetFlowName;
2103
+ const resumeResponse = lastAIText
2104
+ ? lastAIText
2105
+ : flowName
2106
+ ? `Requesting approval to **${action}** "${flowName}".`
2107
+ : `Requesting approval to **${action}**.`;
2108
+ const formattedResult = formatFinalResponse(resumeResponse, modelConfig.model, jsonMode);
2109
+ return {
2110
+ response: formattedResult.response,
2111
+ toolCalls: [],
2112
+ iterations: 0,
2113
+ error: '',
2114
+ success: true,
2115
+ };
1983
2116
  }
1984
2117
  initialMessages.push(...repairedMessages);
1985
2118
  }
1986
2119
  else if (resumeState &&
1987
2120
  Array.isArray(resumeState) &&
1988
2121
  resumeState.length > 0) {
1989
- this._trace('v1-resume', `restoring ${resumeState.length} messages (single-cap/subagent path)`);
1990
2122
  const { mapStoredMessagesToChatMessages } = await import('@langchain/core/messages');
1991
2123
  const restored = mapStoredMessagesToChatMessages(resumeState);
2124
+ this._trace('v1-resume', `START`, {
2125
+ savedMessageCount: resumeState.length,
2126
+ restoredMessageCount: restored.length,
2127
+ restoredMessages: restored.map((m) => {
2128
+ const role = m._getType();
2129
+ const content = typeof m.content === 'string'
2130
+ ? m.content
2131
+ : JSON.stringify(m.content);
2132
+ const entry = { role, content };
2133
+ if ('tool_calls' in m &&
2134
+ Array.isArray(m.tool_calls) &&
2135
+ m.tool_calls.length > 0) {
2136
+ entry.toolCalls = m.tool_calls.map((tc) => ({
2137
+ name: tc.name,
2138
+ id: tc.id,
2139
+ args: tc.args,
2140
+ }));
2141
+ }
2142
+ if ('tool_call_id' in m) {
2143
+ entry.toolCallId = m.tool_call_id;
2144
+ }
2145
+ return entry;
2146
+ }),
2147
+ });
1992
2148
  // Collect existing tool_call_ids that already have ToolMessage responses
1993
2149
  const existingToolResultIds = new Set();
1994
2150
  for (const msg of restored) {
@@ -2034,6 +2190,13 @@ export class AIAgentBubble extends ServiceBubble {
2034
2190
  if (i === approvalAiMsgIndex && toolsByName.has(tc.name)) {
2035
2191
  // This is the approval-triggering AIMessage — execute the tool directly
2036
2192
  // This bypasses beforeToolCall (no re-approval check) and gives real results
2193
+ const resumeStartTime = Date.now();
2194
+ this._trace('tool', `start:${tc.name}`, {
2195
+ toolName: tc.name,
2196
+ toolCallId: tc.id ?? '',
2197
+ input: tc.args,
2198
+ resumeDirect: true,
2199
+ });
2037
2200
  try {
2038
2201
  console.log(`[AIAgent] Resume: executing approved tool "${tc.name}" directly`);
2039
2202
  const tool = toolsByName.get(tc.name);
@@ -2044,10 +2207,26 @@ export class AIAgentBubble extends ServiceBubble {
2044
2207
  content.slice(0, AIAgentBubble.MAX_TOOL_RESULT_CHARS) +
2045
2208
  `\n\n[... truncated — result was ${content.length} chars, limit is ${AIAgentBubble.MAX_TOOL_RESULT_CHARS}]`;
2046
2209
  }
2210
+ this._trace('tool', `complete:${tc.name}`, {
2211
+ toolName: tc.name,
2212
+ toolCallId: tc.id ?? '',
2213
+ input: tc.args,
2214
+ output: result,
2215
+ durationMs: Date.now() - resumeStartTime,
2216
+ resumeDirect: true,
2217
+ });
2047
2218
  repairedMessages.push(new ToolMessage({ content, tool_call_id: tc.id }));
2048
2219
  }
2049
2220
  catch (err) {
2050
2221
  console.warn(`[AIAgent] Resume: direct tool execution failed for "${tc.name}":`, err);
2222
+ this._trace('tool', `error:${tc.name}`, {
2223
+ toolName: tc.name,
2224
+ toolCallId: tc.id ?? '',
2225
+ input: tc.args,
2226
+ error: err instanceof Error ? err.message : String(err),
2227
+ durationMs: Date.now() - resumeStartTime,
2228
+ resumeDirect: true,
2229
+ });
2051
2230
  repairedMessages.push(new ToolMessage({
2052
2231
  content: `Tool execution failed: ${err instanceof Error ? err.message : String(err)}`,
2053
2232
  tool_call_id: tc.id,
@@ -2070,6 +2249,10 @@ export class AIAgentBubble extends ServiceBubble {
2070
2249
  if (approvalAiMsgIndex >= 0 && resumeExecMeta?._approvedAction) {
2071
2250
  delete resumeExecMeta._approvedAction;
2072
2251
  }
2252
+ this._trace('v1-resume', `DONE`, {
2253
+ repairedMessageCount: repairedMessages.length,
2254
+ types: repairedMessages.map((m) => m._getType()).join(','),
2255
+ });
2073
2256
  initialMessages.push(...repairedMessages);
2074
2257
  }
2075
2258
  else if (conversationHistory && conversationHistory.length > 0) {
@@ -2164,15 +2347,15 @@ export class AIAgentBubble extends ServiceBubble {
2164
2347
  initialMessages.push(humanMessage);
2165
2348
  }
2166
2349
  this._trace('agent-loop', `STARTING graph.invoke`, {
2167
- initialMsgCount: initialMessages.length,
2168
- initialMsgTypes: initialMessages.map((m) => m._getType()).join(','),
2169
- shouldStopAfterTools: this.shouldStopAfterTools,
2350
+ initialMessageCount: initialMessages.length,
2170
2351
  maxIterations,
2352
+ model: this.params.model.model,
2171
2353
  });
2172
2354
  const result = await graph.invoke({ messages: initialMessages }, { recursionLimit: maxIterations });
2173
2355
  this._trace('agent-loop', `graph.invoke COMPLETED`, {
2174
2356
  totalMessages: result.messages.length,
2175
2357
  pendingApproval: !!this.context?.executionMeta?._pendingApproval,
2358
+ model: this.params.model.model,
2176
2359
  });
2177
2360
  console.log('[AIAgent] Graph execution completed');
2178
2361
  console.log('[AIAgent] Total messages:', result.messages.length);