@bubblelab/bubble-core 0.1.176 → 0.1.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble-bundle.d.ts +161 -160
- package/dist/bubble-factory.d.ts.map +1 -1
- package/dist/bubble-factory.js +12 -2
- package/dist/bubble-factory.js.map +1 -1
- package/dist/bubbles/service-bubble/agi-inc.d.ts +80 -80
- package/dist/bubbles/service-bubble/ai-agent.d.ts +28 -16
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.js +75 -8
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
- package/dist/bubbles/service-bubble/airtable.d.ts +74 -74
- package/dist/bubbles/service-bubble/apify/apify.d.ts +8 -8
- package/dist/bubbles/service-bubble/ashby/ashby.d.ts +94 -94
- package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +86 -86
- package/dist/bubbles/service-bubble/attio/attio.d.ts +28 -28
- package/dist/bubbles/service-bubble/attio/attio.schema.d.ts +30 -30
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +28 -28
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +31 -31
- package/dist/bubbles/service-bubble/capability-pipeline.js +1 -1
- package/dist/bubbles/service-bubble/capability-pipeline.js.map +1 -1
- package/dist/bubbles/service-bubble/confluence/confluence.d.ts +24 -24
- package/dist/bubbles/service-bubble/confluence/confluence.schema.d.ts +24 -24
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +52 -52
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +166 -166
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +28 -28
- package/dist/bubbles/service-bubble/firecrawl.d.ts +1015 -1015
- package/dist/bubbles/service-bubble/followupboss.d.ts +140 -140
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +68 -68
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.schema.d.ts +108 -108
- package/dist/bubbles/service-bubble/github.d.ts +148 -148
- package/dist/bubbles/service-bubble/gmail.d.ts +140 -140
- package/dist/bubbles/service-bubble/google-calendar.d.ts +218 -218
- package/dist/bubbles/service-bubble/google-drive.d.ts +92 -92
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +44 -44
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +48 -48
- package/dist/bubbles/service-bubble/hello-world.d.ts +8 -8
- package/dist/bubbles/service-bubble/http.d.ts +12 -12
- package/dist/bubbles/service-bubble/hubspot/hubspot.d.ts +8 -8
- package/dist/bubbles/service-bubble/hubspot/hubspot.schema.d.ts +8 -8
- package/dist/bubbles/service-bubble/insforge-db.d.ts +8 -8
- package/dist/bubbles/service-bubble/jira/jira.d.ts +56 -56
- package/dist/bubbles/service-bubble/jira/jira.schema.d.ts +58 -58
- package/dist/bubbles/service-bubble/linear/linear.d.ts +32 -32
- package/dist/bubbles/service-bubble/linear/linear.schema.d.ts +32 -32
- package/dist/bubbles/service-bubble/notion/notion.d.ts +1627 -1627
- package/dist/bubbles/service-bubble/postgresql.d.ts +8 -8
- package/dist/bubbles/service-bubble/posthog/posthog.d.ts +20 -20
- package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts +30 -30
- package/dist/bubbles/service-bubble/resend.d.ts +28 -28
- package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts +6 -6
- package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.d.ts +12 -12
- package/dist/bubbles/service-bubble/slack/slack.d.ts +340 -340
- package/dist/bubbles/service-bubble/storage.d.ts +20 -20
- package/dist/bubbles/service-bubble/stripe/stripe.d.ts +115 -115
- package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +171 -171
- package/dist/bubbles/service-bubble/telegram.d.ts +1537 -1537
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +13 -13
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +15 -15
- package/dist/bubbles/tool-bubble/browser-tools/_shared/ai/ai-fallback-step.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/browser-tools/_shared/ai/ai-fallback-step.js +28 -9
- package/dist/bubbles/tool-bubble/browser-tools/_shared/ai/ai-fallback-step.js.map +1 -1
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +20 -20
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +26 -26
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +52 -52
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.js +1 -0
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +186 -186
- package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-capabilities-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/people-search-tool.d.ts +48 -48
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +28 -28
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +28 -28
- package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +54 -54
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +18 -18
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +18 -18
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +18 -18
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +28 -28
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +8 -8
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +104 -104
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +16 -16
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +34 -34
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +94 -94
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +8 -8
- package/dist/bubbles.json +19 -8
- package/dist/capabilities/define-capability.d.ts +2 -0
- package/dist/capabilities/define-capability.d.ts.map +1 -1
- package/dist/capabilities/define-capability.js +1 -0
- package/dist/capabilities/define-capability.js.map +1 -1
- package/package.json +2 -2
|
@@ -13,6 +13,7 @@ export type ToolHookContext = {
|
|
|
13
13
|
toolInput: unknown;
|
|
14
14
|
toolOutput?: BubbleResult<unknown>;
|
|
15
15
|
messages: BaseMessage[];
|
|
16
|
+
bubbleContext?: BubbleContext;
|
|
16
17
|
};
|
|
17
18
|
export type ToolHookAfter = (context: ToolHookContext) => Promise<{
|
|
18
19
|
messages: BaseMessage[];
|
|
@@ -21,6 +22,8 @@ export type ToolHookAfter = (context: ToolHookContext) => Promise<{
|
|
|
21
22
|
export type ToolHookBefore = (context: ToolHookContext) => Promise<{
|
|
22
23
|
messages: BaseMessage[];
|
|
23
24
|
toolInput: Record<string, any>;
|
|
25
|
+
shouldSkip?: boolean;
|
|
26
|
+
skipMessage?: string;
|
|
24
27
|
}>;
|
|
25
28
|
export type AfterLLMCallContext = {
|
|
26
29
|
messages: BaseMessage[];
|
|
@@ -49,8 +52,8 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
49
52
|
}, {
|
|
50
53
|
data: string;
|
|
51
54
|
type?: "base64" | undefined;
|
|
52
|
-
description?: string | undefined;
|
|
53
55
|
mimeType?: string | undefined;
|
|
56
|
+
description?: string | undefined;
|
|
54
57
|
}>, z.ZodObject<{
|
|
55
58
|
type: z.ZodLiteral<"url">;
|
|
56
59
|
url: z.ZodString;
|
|
@@ -187,6 +190,7 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
187
190
|
}>, "many">>>;
|
|
188
191
|
expectedOutputSchema: z.ZodOptional<z.ZodUnion<[z.ZodType<z.ZodTypeAny, z.ZodTypeDef, z.ZodTypeAny>, z.ZodString]>>;
|
|
189
192
|
memoryEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
193
|
+
enableSlackHistory: z.ZodDefault<z.ZodBoolean>;
|
|
190
194
|
}, "strip", z.ZodTypeAny, {
|
|
191
195
|
message: string;
|
|
192
196
|
images: ({
|
|
@@ -224,14 +228,15 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
224
228
|
maxIterations: number;
|
|
225
229
|
streaming: boolean;
|
|
226
230
|
memoryEnabled: boolean;
|
|
231
|
+
enableSlackHistory: boolean;
|
|
227
232
|
name?: string | undefined;
|
|
228
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
229
233
|
conversationHistory?: {
|
|
230
234
|
role: "user" | "assistant" | "tool";
|
|
231
235
|
content: string;
|
|
232
236
|
toolCallId?: string | undefined;
|
|
233
237
|
name?: string | undefined;
|
|
234
238
|
}[] | undefined;
|
|
239
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
235
240
|
customTools?: {
|
|
236
241
|
description: string;
|
|
237
242
|
name: string;
|
|
@@ -247,12 +252,11 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
247
252
|
}, {
|
|
248
253
|
message: string;
|
|
249
254
|
name?: string | undefined;
|
|
250
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
251
255
|
images?: ({
|
|
252
256
|
data: string;
|
|
253
257
|
type?: "base64" | undefined;
|
|
254
|
-
description?: string | undefined;
|
|
255
258
|
mimeType?: string | undefined;
|
|
259
|
+
description?: string | undefined;
|
|
256
260
|
} | {
|
|
257
261
|
type: "url";
|
|
258
262
|
url: string;
|
|
@@ -281,6 +285,7 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
281
285
|
maxRetries?: number | undefined;
|
|
282
286
|
} | undefined;
|
|
283
287
|
} | undefined;
|
|
288
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
284
289
|
tools?: {
|
|
285
290
|
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";
|
|
286
291
|
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
@@ -301,6 +306,7 @@ declare const AIAgentParamsSchema: z.ZodObject<{
|
|
|
301
306
|
}[] | undefined;
|
|
302
307
|
expectedOutputSchema?: string | z.ZodTypeAny | undefined;
|
|
303
308
|
memoryEnabled?: boolean | undefined;
|
|
309
|
+
enableSlackHistory?: boolean | undefined;
|
|
304
310
|
}>;
|
|
305
311
|
declare const AIAgentResultSchema: z.ZodObject<{
|
|
306
312
|
response: z.ZodString;
|
|
@@ -323,8 +329,6 @@ declare const AIAgentResultSchema: z.ZodObject<{
|
|
|
323
329
|
error: z.ZodString;
|
|
324
330
|
success: z.ZodBoolean;
|
|
325
331
|
}, "strip", z.ZodTypeAny, {
|
|
326
|
-
success: boolean;
|
|
327
|
-
error: string;
|
|
328
332
|
response: string;
|
|
329
333
|
toolCalls: {
|
|
330
334
|
tool: string;
|
|
@@ -332,11 +336,11 @@ declare const AIAgentResultSchema: z.ZodObject<{
|
|
|
332
336
|
output?: unknown;
|
|
333
337
|
}[];
|
|
334
338
|
iterations: number;
|
|
339
|
+
error: string;
|
|
340
|
+
success: boolean;
|
|
335
341
|
reasoning?: string | null | undefined;
|
|
336
342
|
totalCost?: number | undefined;
|
|
337
343
|
}, {
|
|
338
|
-
success: boolean;
|
|
339
|
-
error: string;
|
|
340
344
|
response: string;
|
|
341
345
|
toolCalls: {
|
|
342
346
|
tool: string;
|
|
@@ -344,6 +348,8 @@ declare const AIAgentResultSchema: z.ZodObject<{
|
|
|
344
348
|
output?: unknown;
|
|
345
349
|
}[];
|
|
346
350
|
iterations: number;
|
|
351
|
+
error: string;
|
|
352
|
+
success: boolean;
|
|
347
353
|
reasoning?: string | null | undefined;
|
|
348
354
|
totalCost?: number | undefined;
|
|
349
355
|
}>;
|
|
@@ -380,8 +386,8 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
380
386
|
}, {
|
|
381
387
|
data: string;
|
|
382
388
|
type?: "base64" | undefined;
|
|
383
|
-
description?: string | undefined;
|
|
384
389
|
mimeType?: string | undefined;
|
|
390
|
+
description?: string | undefined;
|
|
385
391
|
}>, z.ZodObject<{
|
|
386
392
|
type: z.ZodLiteral<"url">;
|
|
387
393
|
url: z.ZodString;
|
|
@@ -518,6 +524,7 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
518
524
|
}>, "many">>>;
|
|
519
525
|
expectedOutputSchema: z.ZodOptional<z.ZodUnion<[z.ZodType<z.ZodTypeAny, z.ZodTypeDef, z.ZodTypeAny>, z.ZodString]>>;
|
|
520
526
|
memoryEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
527
|
+
enableSlackHistory: z.ZodDefault<z.ZodBoolean>;
|
|
521
528
|
}, "strip", z.ZodTypeAny, {
|
|
522
529
|
message: string;
|
|
523
530
|
images: ({
|
|
@@ -555,14 +562,15 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
555
562
|
maxIterations: number;
|
|
556
563
|
streaming: boolean;
|
|
557
564
|
memoryEnabled: boolean;
|
|
565
|
+
enableSlackHistory: boolean;
|
|
558
566
|
name?: string | undefined;
|
|
559
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
560
567
|
conversationHistory?: {
|
|
561
568
|
role: "user" | "assistant" | "tool";
|
|
562
569
|
content: string;
|
|
563
570
|
toolCallId?: string | undefined;
|
|
564
571
|
name?: string | undefined;
|
|
565
572
|
}[] | undefined;
|
|
573
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
566
574
|
customTools?: {
|
|
567
575
|
description: string;
|
|
568
576
|
name: string;
|
|
@@ -578,12 +586,11 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
578
586
|
}, {
|
|
579
587
|
message: string;
|
|
580
588
|
name?: string | undefined;
|
|
581
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
582
589
|
images?: ({
|
|
583
590
|
data: string;
|
|
584
591
|
type?: "base64" | undefined;
|
|
585
|
-
description?: string | undefined;
|
|
586
592
|
mimeType?: string | undefined;
|
|
593
|
+
description?: string | undefined;
|
|
587
594
|
} | {
|
|
588
595
|
type: "url";
|
|
589
596
|
url: string;
|
|
@@ -612,6 +619,7 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
612
619
|
maxRetries?: number | undefined;
|
|
613
620
|
} | undefined;
|
|
614
621
|
} | undefined;
|
|
622
|
+
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
615
623
|
tools?: {
|
|
616
624
|
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";
|
|
617
625
|
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
@@ -632,6 +640,7 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
632
640
|
}[] | undefined;
|
|
633
641
|
expectedOutputSchema?: string | z.ZodTypeAny | undefined;
|
|
634
642
|
memoryEnabled?: boolean | undefined;
|
|
643
|
+
enableSlackHistory?: boolean | undefined;
|
|
635
644
|
}>;
|
|
636
645
|
static readonly resultSchema: z.ZodObject<{
|
|
637
646
|
response: z.ZodString;
|
|
@@ -654,8 +663,6 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
654
663
|
error: z.ZodString;
|
|
655
664
|
success: z.ZodBoolean;
|
|
656
665
|
}, "strip", z.ZodTypeAny, {
|
|
657
|
-
success: boolean;
|
|
658
|
-
error: string;
|
|
659
666
|
response: string;
|
|
660
667
|
toolCalls: {
|
|
661
668
|
tool: string;
|
|
@@ -663,11 +670,11 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
663
670
|
output?: unknown;
|
|
664
671
|
}[];
|
|
665
672
|
iterations: number;
|
|
673
|
+
error: string;
|
|
674
|
+
success: boolean;
|
|
666
675
|
reasoning?: string | null | undefined;
|
|
667
676
|
totalCost?: number | undefined;
|
|
668
677
|
}, {
|
|
669
|
-
success: boolean;
|
|
670
|
-
error: string;
|
|
671
678
|
response: string;
|
|
672
679
|
toolCalls: {
|
|
673
680
|
tool: string;
|
|
@@ -675,6 +682,8 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
675
682
|
output?: unknown;
|
|
676
683
|
}[];
|
|
677
684
|
iterations: number;
|
|
685
|
+
error: string;
|
|
686
|
+
success: boolean;
|
|
678
687
|
reasoning?: string | null | undefined;
|
|
679
688
|
totalCost?: number | undefined;
|
|
680
689
|
}>;
|
|
@@ -684,6 +693,9 @@ export declare class AIAgentBubble extends ServiceBubble<AIAgentParamsParsed, AI
|
|
|
684
693
|
private factory;
|
|
685
694
|
private beforeToolCallHook;
|
|
686
695
|
private afterToolCallHook;
|
|
696
|
+
/** Capability-scoped hooks: only fire for the capability's own tool names */
|
|
697
|
+
private capabilityBeforeHooks;
|
|
698
|
+
private capabilityAfterHooks;
|
|
687
699
|
private afterLLMCallHook;
|
|
688
700
|
private streamingCallback;
|
|
689
701
|
private shouldStopAfterTools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent.d.ts","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/ai-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAmB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACp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AC,OAAO,CAAC;IAW/C;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;YACW,gBAAgB;IAiC9B;;OAEG;YACW,YAAY;cAqIV,aAAa,CAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,aAAa,CAAC;IAkDzB;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IA+CnC,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;IAmS7B;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAgCpC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAgDjC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuDvB;;OAEG;YACW,qBAAqB;YA0LrB,gBAAgB;YAqUhB,YAAY;CA4X3B"}
|
|
@@ -229,6 +229,10 @@ const AIAgentParamsSchema = z.object({
|
|
|
229
229
|
.boolean()
|
|
230
230
|
.default(true)
|
|
231
231
|
.describe('Enable persistent memory across conversations. When true, the agent can recall and save information about people, topics, and events between conversations.'),
|
|
232
|
+
enableSlackHistory: z
|
|
233
|
+
.boolean()
|
|
234
|
+
.default(false)
|
|
235
|
+
.describe('Enable Slack thread history injection. When true, the agent receives full conversation history from Slack threads including user names, timezones, and images.'),
|
|
232
236
|
// Note: beforeToolCall and afterToolCall are function hooks added via TypeScript interface
|
|
233
237
|
// They cannot be part of the Zod schema but are available in the params
|
|
234
238
|
});
|
|
@@ -282,6 +286,9 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
282
286
|
factory;
|
|
283
287
|
beforeToolCallHook;
|
|
284
288
|
afterToolCallHook;
|
|
289
|
+
/** Capability-scoped hooks: only fire for the capability's own tool names */
|
|
290
|
+
capabilityBeforeHooks = new Map();
|
|
291
|
+
capabilityAfterHooks = new Map();
|
|
285
292
|
afterLLMCallHook;
|
|
286
293
|
streamingCallback;
|
|
287
294
|
shouldStopAfterTools = false;
|
|
@@ -377,7 +384,7 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
377
384
|
timeZone: 'UTC',
|
|
378
385
|
timeZoneName: 'short',
|
|
379
386
|
});
|
|
380
|
-
this.params.systemPrompt = `${this.params.systemPrompt}\n\n**System time:** ${now}
|
|
387
|
+
this.params.systemPrompt = `${this.params.systemPrompt}\n\n**System time (UTC):** ${now}\nIMPORTANT: The system time above is in UTC. Always interpret and present times from the user's perspective and timezone. If the user's timezone is known (from conversation history, user profile, or context), convert all times accordingly. If unknown, ask the user for their timezone before making time-sensitive decisions.`;
|
|
381
388
|
// Apply capability model overrides and system prompt injections
|
|
382
389
|
await applyCapabilityPreprocessing(this.params, this.context, this.resolveCapabilityCredentials.bind(this));
|
|
383
390
|
// Extract execution metadata (used for conversation history + agent memory)
|
|
@@ -1007,6 +1014,18 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1007
1014
|
tools.push(dynamicTool);
|
|
1008
1015
|
console.log(`🔧 [AIAgent] Registered capability tool: ${toolMeta.name} (from ${capConfig.id}, variableId: ${capToolVariableId})`);
|
|
1009
1016
|
}
|
|
1017
|
+
// Wire capability-level hooks scoped to this capability's tool names
|
|
1018
|
+
const capToolNames = capDef.metadata.tools.map((t) => t.name);
|
|
1019
|
+
if (capDef.hooks?.beforeToolCall) {
|
|
1020
|
+
for (const name of capToolNames) {
|
|
1021
|
+
this.capabilityBeforeHooks.set(name, capDef.hooks.beforeToolCall);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
if (capDef.hooks?.afterToolCall) {
|
|
1025
|
+
for (const name of capToolNames) {
|
|
1026
|
+
this.capabilityAfterHooks.set(name, capDef.hooks.afterToolCall);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1010
1029
|
}
|
|
1011
1030
|
catch (error) {
|
|
1012
1031
|
console.error(`Error initializing capability '${capConfig.id}':`, error);
|
|
@@ -1172,11 +1191,14 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1172
1191
|
}
|
|
1173
1192
|
const startTime = Date.now();
|
|
1174
1193
|
try {
|
|
1175
|
-
// Call beforeToolCall hook
|
|
1176
|
-
const
|
|
1194
|
+
// Call beforeToolCall hook — capability-scoped hook takes priority, then global
|
|
1195
|
+
const beforeHook = this.capabilityBeforeHooks.get(toolCall.name) ??
|
|
1196
|
+
this.beforeToolCallHook;
|
|
1197
|
+
const hookResult_before = await beforeHook?.({
|
|
1177
1198
|
toolName: toolCall.name,
|
|
1178
1199
|
toolInput: toolCall.args,
|
|
1179
1200
|
messages: currentMessages,
|
|
1201
|
+
bubbleContext: this.context,
|
|
1180
1202
|
});
|
|
1181
1203
|
this.streamingCallback?.({
|
|
1182
1204
|
type: 'tool_call_start',
|
|
@@ -1194,6 +1216,18 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1194
1216
|
hooksModifiedMessages = true;
|
|
1195
1217
|
}
|
|
1196
1218
|
toolCall.args = hookResult_before.toolInput;
|
|
1219
|
+
// If hook requests skipping, create synthetic ToolMessage and stop agent loop
|
|
1220
|
+
if (hookResult_before.shouldSkip) {
|
|
1221
|
+
const skipMsg = new ToolMessage({
|
|
1222
|
+
content: hookResult_before.skipMessage ||
|
|
1223
|
+
'Tool execution was skipped.',
|
|
1224
|
+
tool_call_id: toolCall.id,
|
|
1225
|
+
});
|
|
1226
|
+
toolMessages.push(skipMsg);
|
|
1227
|
+
currentMessages = [...currentMessages, skipMsg];
|
|
1228
|
+
this.shouldStopAfterTools = true;
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1197
1231
|
}
|
|
1198
1232
|
// Execute the tool
|
|
1199
1233
|
const toolOutput = await tool.invoke(toolCall.args);
|
|
@@ -1206,12 +1240,15 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1206
1240
|
});
|
|
1207
1241
|
toolMessages.push(toolMessage);
|
|
1208
1242
|
currentMessages = [...currentMessages, toolMessage];
|
|
1209
|
-
// Call afterToolCall hook
|
|
1210
|
-
const
|
|
1243
|
+
// Call afterToolCall hook — capability-scoped hook takes priority, then global
|
|
1244
|
+
const afterHook = this.capabilityAfterHooks.get(toolCall.name) ??
|
|
1245
|
+
this.afterToolCallHook;
|
|
1246
|
+
const hookResult_after = await afterHook?.({
|
|
1211
1247
|
toolName: toolCall.name,
|
|
1212
1248
|
toolInput: toolCall.args,
|
|
1213
1249
|
toolOutput,
|
|
1214
1250
|
messages: currentMessages,
|
|
1251
|
+
bubbleContext: this.context,
|
|
1215
1252
|
});
|
|
1216
1253
|
// If hook returns modified messages, update current messages
|
|
1217
1254
|
if (hookResult_after) {
|
|
@@ -1481,6 +1518,14 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1481
1518
|
if (this.shouldStopAfterTools) {
|
|
1482
1519
|
return '__end__';
|
|
1483
1520
|
}
|
|
1521
|
+
// Check for pending approval signal from sub-agent (shared via executionMeta).
|
|
1522
|
+
// In multi-capability mode the master and sub-agent share the same BubbleContext,
|
|
1523
|
+
// so a sub-agent setting _pendingApproval is visible here.
|
|
1524
|
+
const execMeta = this.context?.executionMeta;
|
|
1525
|
+
if (execMeta?._pendingApproval) {
|
|
1526
|
+
this.shouldStopAfterTools = true;
|
|
1527
|
+
return '__end__';
|
|
1528
|
+
}
|
|
1484
1529
|
// Otherwise continue back to agent
|
|
1485
1530
|
return 'agent';
|
|
1486
1531
|
};
|
|
@@ -1516,9 +1561,31 @@ export class AIAgentBubble extends ServiceBubble {
|
|
|
1516
1561
|
try {
|
|
1517
1562
|
// Build messages array starting with conversation history (for KV cache optimization)
|
|
1518
1563
|
const initialMessages = [];
|
|
1519
|
-
//
|
|
1520
|
-
|
|
1521
|
-
|
|
1564
|
+
// Resume from saved agent state (lossless — preserves tool_calls, etc.)
|
|
1565
|
+
const resumeExecMeta = this.context?.executionMeta;
|
|
1566
|
+
const resumeState = resumeExecMeta?._resumeAgentState;
|
|
1567
|
+
if (resumeState && Array.isArray(resumeState) && resumeState.length > 0) {
|
|
1568
|
+
const { mapStoredMessagesToChatMessages } = await import('@langchain/core/messages');
|
|
1569
|
+
const restored = mapStoredMessagesToChatMessages(resumeState);
|
|
1570
|
+
initialMessages.push(...restored);
|
|
1571
|
+
// If last restored message is AIMessage with pending tool_calls,
|
|
1572
|
+
// add synthetic ToolMessages so the message sequence is valid
|
|
1573
|
+
const lastMsg = restored[restored.length - 1];
|
|
1574
|
+
if (lastMsg && 'tool_calls' in lastMsg) {
|
|
1575
|
+
const toolCalls = lastMsg.tool_calls;
|
|
1576
|
+
if (toolCalls?.length) {
|
|
1577
|
+
for (const tc of toolCalls) {
|
|
1578
|
+
initialMessages.push(new ToolMessage({
|
|
1579
|
+
content: 'This action has been approved by the user. You may now execute this tool.',
|
|
1580
|
+
tool_call_id: tc.id,
|
|
1581
|
+
}));
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
else if (conversationHistory && conversationHistory.length > 0) {
|
|
1587
|
+
// Normal path: lossy ConversationMessage[] → BaseMessage[]
|
|
1588
|
+
// This enables KV cache optimization by keeping previous turns as separate messages
|
|
1522
1589
|
for (const historyMsg of conversationHistory) {
|
|
1523
1590
|
switch (historyMsg.role) {
|
|
1524
1591
|
case 'user':
|