@botpress/runtime 1.11.9 → 1.12.1
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/definition.js +178 -78
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +209 -83
- package/dist/internal.js.map +4 -4
- package/dist/library.d.ts +1 -0
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +211 -84
- package/dist/library.js.map +4 -4
- package/dist/primitives/definition.d.ts +2 -0
- package/dist/primitives/definition.d.ts.map +1 -1
- package/dist/primitives/table.d.ts +5 -0
- package/dist/primitives/table.d.ts.map +1 -1
- package/dist/runtime/adk.d.ts +7 -0
- package/dist/runtime/adk.d.ts.map +1 -1
- package/dist/runtime/client.d.ts +29 -0
- package/dist/runtime/client.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime.js +192 -91
- package/dist/runtime.js.map +4 -4
- package/package.json +2 -2
package/dist/runtime.js
CHANGED
|
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
|
|
|
48
48
|
var define_PACKAGE_VERSIONS_default;
|
|
49
49
|
var init_define_PACKAGE_VERSIONS = __esm({
|
|
50
50
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
51
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.12.1", adk: "1.12.1", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -33379,6 +33379,51 @@ ${issues.join("\n")}`;
|
|
|
33379
33379
|
}
|
|
33380
33380
|
});
|
|
33381
33381
|
|
|
33382
|
+
// src/runtime/client.ts
|
|
33383
|
+
import { Client } from "@botpress/client";
|
|
33384
|
+
function getStandaloneClient() {
|
|
33385
|
+
return getSingleton("__ADK_GLOBAL_STANDALONE_CLIENT", () => {
|
|
33386
|
+
const token = process.env.BP_TOKEN || process.env.ADK_TOKEN;
|
|
33387
|
+
if (!token) {
|
|
33388
|
+
throw new Error(
|
|
33389
|
+
'No token found. Set BP_TOKEN or ADK_TOKEN environment variable, or run this script using "adk run".'
|
|
33390
|
+
);
|
|
33391
|
+
}
|
|
33392
|
+
const botId = process.env.ADK_BOT_ID;
|
|
33393
|
+
if (!botId) {
|
|
33394
|
+
throw new Error(
|
|
33395
|
+
'No bot ID found. Set ADK_BOT_ID environment variable, or run this script using "adk run".'
|
|
33396
|
+
);
|
|
33397
|
+
}
|
|
33398
|
+
const apiUrl = process.env.ADK_API_URL || "https://api.botpress.cloud";
|
|
33399
|
+
return new Client({
|
|
33400
|
+
token,
|
|
33401
|
+
apiUrl,
|
|
33402
|
+
botId
|
|
33403
|
+
});
|
|
33404
|
+
});
|
|
33405
|
+
}
|
|
33406
|
+
var client;
|
|
33407
|
+
var init_client = __esm({
|
|
33408
|
+
"src/runtime/client.ts"() {
|
|
33409
|
+
"use strict";
|
|
33410
|
+
init_define_BUILD();
|
|
33411
|
+
init_define_PACKAGE_VERSIONS();
|
|
33412
|
+
init_context3();
|
|
33413
|
+
init_singletons();
|
|
33414
|
+
client = new Proxy({}, {
|
|
33415
|
+
get(_target, prop) {
|
|
33416
|
+
const contextClient = context2.get("client", { optional: true });
|
|
33417
|
+
if (contextClient) {
|
|
33418
|
+
return contextClient[prop];
|
|
33419
|
+
}
|
|
33420
|
+
const standaloneClient = getStandaloneClient();
|
|
33421
|
+
return standaloneClient[prop];
|
|
33422
|
+
}
|
|
33423
|
+
});
|
|
33424
|
+
}
|
|
33425
|
+
});
|
|
33426
|
+
|
|
33382
33427
|
// src/primitives/asset.ts
|
|
33383
33428
|
var init_asset = __esm({
|
|
33384
33429
|
"src/primitives/asset.ts"() {
|
|
@@ -33448,12 +33493,12 @@ var init_conversation_instance = __esm({
|
|
|
33448
33493
|
TrackedState;
|
|
33449
33494
|
// @internal
|
|
33450
33495
|
TrackedTags;
|
|
33451
|
-
constructor(conversation,
|
|
33496
|
+
constructor(conversation, client2) {
|
|
33452
33497
|
this.id = conversation.id;
|
|
33453
33498
|
this.channel = `${conversation.integration}.${conversation.channel}`;
|
|
33454
33499
|
this.integration = conversation.integration;
|
|
33455
33500
|
this.conversation = conversation;
|
|
33456
|
-
this.client =
|
|
33501
|
+
this.client = client2;
|
|
33457
33502
|
const states = context2.get("states", { optional: true });
|
|
33458
33503
|
const existingState = states?.find(
|
|
33459
33504
|
(s) => s.type === "conversation" && s.id === conversation.id && s.name === BUILT_IN_STATES.conversation
|
|
@@ -33467,7 +33512,7 @@ var init_conversation_instance = __esm({
|
|
|
33467
33512
|
const tags = TrackedTags.create({
|
|
33468
33513
|
type: "conversation",
|
|
33469
33514
|
id: conversation.id,
|
|
33470
|
-
client:
|
|
33515
|
+
client: client2._inner,
|
|
33471
33516
|
initialTags: conversation.tags
|
|
33472
33517
|
});
|
|
33473
33518
|
this.TrackedTags = tags;
|
|
@@ -33862,12 +33907,12 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
33862
33907
|
input: z4.string().describe("The query to search for.").min(1).max(1024),
|
|
33863
33908
|
output: z4.string().describe("The search results."),
|
|
33864
33909
|
handler: async (query) => {
|
|
33865
|
-
const
|
|
33910
|
+
const client2 = context2.get("client");
|
|
33866
33911
|
const citations = context2.get("citations");
|
|
33867
|
-
if (!
|
|
33912
|
+
if (!client2) {
|
|
33868
33913
|
throw new Error("Client is not available in this context. Make sure to run in a context with a client.");
|
|
33869
33914
|
}
|
|
33870
|
-
const { passages } = await
|
|
33915
|
+
const { passages } = await client2.searchFiles({
|
|
33871
33916
|
query,
|
|
33872
33917
|
withContext: true,
|
|
33873
33918
|
includeBreadcrumb: true,
|
|
@@ -34304,7 +34349,7 @@ var init_workflow = __esm({
|
|
|
34304
34349
|
* @returns The workflow instance
|
|
34305
34350
|
*/
|
|
34306
34351
|
async getOrCreate(props) {
|
|
34307
|
-
const
|
|
34352
|
+
const client2 = context2.get("client");
|
|
34308
34353
|
const statuses = props.statuses || ["pending", "in_progress", "listening", "paused"];
|
|
34309
34354
|
const validatedInput = this._inputSchema.parse(props.input);
|
|
34310
34355
|
const tags = {};
|
|
@@ -34322,10 +34367,10 @@ var init_workflow = __esm({
|
|
|
34322
34367
|
timeoutAt: new Date(Date.now() + (this.timeout ?? (0, import_ms.default)("5m"))).toISOString(),
|
|
34323
34368
|
...discriminator && { discriminateBy: { tags: discriminator } }
|
|
34324
34369
|
};
|
|
34325
|
-
let { workflow } = await
|
|
34370
|
+
let { workflow } = await client2._inner.getOrCreateWorkflow(createArgs);
|
|
34326
34371
|
if (props.key && !statuses.includes(workflow.status)) {
|
|
34327
|
-
await
|
|
34328
|
-
({ workflow } = await
|
|
34372
|
+
await client2._inner.deleteWorkflow({ id: workflow.id });
|
|
34373
|
+
({ workflow } = await client2._inner.getOrCreateWorkflow(createArgs));
|
|
34329
34374
|
}
|
|
34330
34375
|
return await BaseWorkflowInstance.load({
|
|
34331
34376
|
id: workflow.id,
|
|
@@ -34343,9 +34388,9 @@ var init_workflow = __esm({
|
|
|
34343
34388
|
* }
|
|
34344
34389
|
*/
|
|
34345
34390
|
async provide(event, data) {
|
|
34346
|
-
const
|
|
34391
|
+
const client2 = context2.get("client");
|
|
34347
34392
|
const { workflowId, stepName } = event.payload;
|
|
34348
|
-
const state = createWorkflowExecutionState(
|
|
34393
|
+
const state = createWorkflowExecutionState(client2._inner, workflowId);
|
|
34349
34394
|
await state.load();
|
|
34350
34395
|
if (!state.value) {
|
|
34351
34396
|
throw new Error(`Workflow execution state not found for workflow ${workflowId}`);
|
|
@@ -34364,7 +34409,7 @@ var init_workflow = __esm({
|
|
|
34364
34409
|
}
|
|
34365
34410
|
state.value.revision++;
|
|
34366
34411
|
await state.save();
|
|
34367
|
-
await
|
|
34412
|
+
await client2.createEvent({
|
|
34368
34413
|
type: WorkflowContinueEvent.name,
|
|
34369
34414
|
workflowId,
|
|
34370
34415
|
payload: {}
|
|
@@ -34372,10 +34417,10 @@ var init_workflow = __esm({
|
|
|
34372
34417
|
}
|
|
34373
34418
|
async start(input) {
|
|
34374
34419
|
const validatedInput = this._inputSchema.parse(input);
|
|
34375
|
-
const
|
|
34420
|
+
const client2 = context2.get("client");
|
|
34376
34421
|
const event = context2.get("event", { optional: true });
|
|
34377
34422
|
const workflow = context2.get("workflow", { optional: true });
|
|
34378
|
-
const res = await
|
|
34423
|
+
const res = await client2._inner.createWorkflow({
|
|
34379
34424
|
name: this.name,
|
|
34380
34425
|
status: event ? "in_progress" : "pending",
|
|
34381
34426
|
eventId: event?.id,
|
|
@@ -36565,7 +36610,7 @@ var init_source_website = __esm({
|
|
|
36565
36610
|
return createSyncWorkflow({
|
|
36566
36611
|
type: "website",
|
|
36567
36612
|
state: State,
|
|
36568
|
-
async handler({ input, step: step2, state, client }) {
|
|
36613
|
+
async handler({ input, step: step2, state, client: client2 }) {
|
|
36569
36614
|
const crypto3 = await import("crypto");
|
|
36570
36615
|
console.log(
|
|
36571
36616
|
`Starting sync for WebsiteSource [${this.id}] in mode [${this.mode}, maxPages=${this.maxPages}, maxDepth=${this.maxDepth}, baseUrl=${this.baseUrl}, sitemapUrl=${this.sitemapUrl}]`
|
|
@@ -36586,7 +36631,7 @@ var init_source_website = __esm({
|
|
|
36586
36631
|
console.log(`Will process up to ${this.maxPages} pages`);
|
|
36587
36632
|
const existingFiles = await step2(
|
|
36588
36633
|
"list existing files",
|
|
36589
|
-
() =>
|
|
36634
|
+
() => client2._inner.list.files({
|
|
36590
36635
|
tags
|
|
36591
36636
|
}).collect()
|
|
36592
36637
|
);
|
|
@@ -36597,7 +36642,7 @@ var init_source_website = __esm({
|
|
|
36597
36642
|
await step2.map(
|
|
36598
36643
|
"deleting all existing files for recrawl",
|
|
36599
36644
|
existingFiles,
|
|
36600
|
-
(f) =>
|
|
36645
|
+
(f) => client2.deleteFile({ id: f.id }).catch(() => null),
|
|
36601
36646
|
{ concurrency: 5 }
|
|
36602
36647
|
);
|
|
36603
36648
|
console.log(`\u2705 Deleted ${existingFiles.length} files, starting fresh crawl`);
|
|
@@ -36629,7 +36674,7 @@ var init_source_website = __esm({
|
|
|
36629
36674
|
const deleted = await step2.map(
|
|
36630
36675
|
"deleting removed urls",
|
|
36631
36676
|
toRemove,
|
|
36632
|
-
(f) =>
|
|
36677
|
+
(f) => client2.deleteFile({ id: f.id }).catch(() => null).then(
|
|
36633
36678
|
() => ({
|
|
36634
36679
|
file: f.id,
|
|
36635
36680
|
name: f.key,
|
|
@@ -36654,7 +36699,7 @@ var init_source_website = __esm({
|
|
|
36654
36699
|
contentType = content.includes("<html") ? "text/html" : "text/markdown";
|
|
36655
36700
|
}
|
|
36656
36701
|
const key = `data_source://${this.type}/${this.id}/${encodeURIComponent(url2)}`;
|
|
36657
|
-
const uploaded = await
|
|
36702
|
+
const uploaded = await client2.uploadFile({
|
|
36658
36703
|
key,
|
|
36659
36704
|
content,
|
|
36660
36705
|
contentType,
|
|
@@ -36714,7 +36759,7 @@ var init_source_website = __esm({
|
|
|
36714
36759
|
await step2("register web page source", async () => {
|
|
36715
36760
|
try {
|
|
36716
36761
|
const botId = context2.get("botId");
|
|
36717
|
-
const getStateResult = await
|
|
36762
|
+
const getStateResult = await client2._inner.getState({ id: botId, type: "bot", name: "dsData" }).catch(() => ({ state: null }));
|
|
36718
36763
|
const freshState = getStateResult.state;
|
|
36719
36764
|
const existingPayload = freshState?.payload || {};
|
|
36720
36765
|
const kbPayload = existingPayload[input.kbId] || {};
|
|
@@ -36736,7 +36781,7 @@ var init_source_website = __esm({
|
|
|
36736
36781
|
data: { websiteUrl, pages: [], indexingJobs: [] }
|
|
36737
36782
|
};
|
|
36738
36783
|
existingPayload[input.kbId] = kbPayload;
|
|
36739
|
-
await
|
|
36784
|
+
await client2._inner.setState({
|
|
36740
36785
|
id: botId,
|
|
36741
36786
|
type: "bot",
|
|
36742
36787
|
name: "dsData",
|
|
@@ -43614,7 +43659,7 @@ var init_source_directory = __esm({
|
|
|
43614
43659
|
return createSyncWorkflow({
|
|
43615
43660
|
type: "directory",
|
|
43616
43661
|
state: z9.object({}),
|
|
43617
|
-
handler: async ({ input, step: step2, client }) => {
|
|
43662
|
+
handler: async ({ input, step: step2, client: client2 }) => {
|
|
43618
43663
|
if (!adk.environment.isDevelopment()) {
|
|
43619
43664
|
console.log("Directory ingestion is only supported in development environment");
|
|
43620
43665
|
return {
|
|
@@ -43666,7 +43711,7 @@ var init_source_directory = __esm({
|
|
|
43666
43711
|
);
|
|
43667
43712
|
const existingFiles = await step2(
|
|
43668
43713
|
"list existing files",
|
|
43669
|
-
() =>
|
|
43714
|
+
() => client2._inner.list.files({
|
|
43670
43715
|
tags
|
|
43671
43716
|
}).collect()
|
|
43672
43717
|
);
|
|
@@ -43680,7 +43725,7 @@ var init_source_directory = __esm({
|
|
|
43680
43725
|
const deleted = await step2.map(
|
|
43681
43726
|
"deleting removed files",
|
|
43682
43727
|
toRemove,
|
|
43683
|
-
(f) =>
|
|
43728
|
+
(f) => client2.deleteFile({ id: f.id }).catch(() => null).then(
|
|
43684
43729
|
() => ({
|
|
43685
43730
|
file: f.id,
|
|
43686
43731
|
name: f.key,
|
|
@@ -43694,7 +43739,7 @@ var init_source_directory = __esm({
|
|
|
43694
43739
|
const key = `data_source://${this.type}/${this.id}/${local.rel}`;
|
|
43695
43740
|
const content = await fs3.readFile(local.abs);
|
|
43696
43741
|
const hash = crypto3.createHash("sha256").update(content).digest("hex");
|
|
43697
|
-
const { file } = await
|
|
43742
|
+
const { file } = await client2.getFile({ id: key }).catch(() => ({ file: null }));
|
|
43698
43743
|
if (!input.force && file?.metadata?.hash === hash) {
|
|
43699
43744
|
console.log(`Skipping unchanged file: ${local.rel}`);
|
|
43700
43745
|
return null;
|
|
@@ -43703,7 +43748,7 @@ var init_source_directory = __esm({
|
|
|
43703
43748
|
console.log(`Force re-indexing file (unchanged): ${local.rel}`);
|
|
43704
43749
|
}
|
|
43705
43750
|
const title = path4.basename(local.name, path4.extname(local.name));
|
|
43706
|
-
const uploaded = await
|
|
43751
|
+
const uploaded = await client2.uploadFile({
|
|
43707
43752
|
key,
|
|
43708
43753
|
content,
|
|
43709
43754
|
accessPolicies: [],
|
|
@@ -43866,9 +43911,9 @@ var init_conversation = __esm({
|
|
|
43866
43911
|
const message = context2.get("message", { optional: true });
|
|
43867
43912
|
const event = context2.get("event", { optional: true });
|
|
43868
43913
|
const chat = context2.get("chat");
|
|
43869
|
-
const
|
|
43914
|
+
const client2 = context2.get("client");
|
|
43870
43915
|
const botpressConversation = context2.get("conversation");
|
|
43871
|
-
const conversationInstance = new BaseConversationInstance(botpressConversation,
|
|
43916
|
+
const conversationInstance = new BaseConversationInstance(botpressConversation, client2);
|
|
43872
43917
|
const startTypingPromise = conversationInstance.startTyping().catch(() => {
|
|
43873
43918
|
});
|
|
43874
43919
|
let type;
|
|
@@ -43905,7 +43950,7 @@ var init_conversation = __esm({
|
|
|
43905
43950
|
if (controller.signal.aborted) {
|
|
43906
43951
|
return;
|
|
43907
43952
|
}
|
|
43908
|
-
const { events } = await
|
|
43953
|
+
const { events } = await client2.listEvents({
|
|
43909
43954
|
conversationId: conversationInstance.id,
|
|
43910
43955
|
status: "pending"
|
|
43911
43956
|
});
|
|
@@ -43978,7 +44023,7 @@ var init_conversation = __esm({
|
|
|
43978
44023
|
request: requestObject,
|
|
43979
44024
|
conversation: conversationInstance,
|
|
43980
44025
|
state: stateProxy,
|
|
43981
|
-
client,
|
|
44026
|
+
client: client2,
|
|
43982
44027
|
execute
|
|
43983
44028
|
});
|
|
43984
44029
|
controller.abort();
|
|
@@ -44019,9 +44064,9 @@ var init_actions = __esm({
|
|
|
44019
44064
|
return handler;
|
|
44020
44065
|
}
|
|
44021
44066
|
let integrations;
|
|
44022
|
-
let
|
|
44067
|
+
let client2;
|
|
44023
44068
|
integrations ??= context2.get("integrations", { optional: true });
|
|
44024
|
-
|
|
44069
|
+
client2 ??= context2.get("client", { optional: true });
|
|
44025
44070
|
const integrationName = propertyName.replace("__", "/");
|
|
44026
44071
|
return new Proxy(
|
|
44027
44072
|
{},
|
|
@@ -44031,19 +44076,19 @@ var init_actions = __esm({
|
|
|
44031
44076
|
return void 0;
|
|
44032
44077
|
}
|
|
44033
44078
|
integrations ??= context2.get("integrations", { optional: true });
|
|
44034
|
-
|
|
44079
|
+
client2 ??= context2.get("client", { optional: true });
|
|
44035
44080
|
const integration = integrations.find((i) => i.alias === integrationName);
|
|
44036
44081
|
const actionDef = integration?.definition.actions?.[actionName];
|
|
44037
44082
|
const handler = async (params) => {
|
|
44038
44083
|
integrations ??= context2.get("integrations", { optional: true });
|
|
44039
|
-
|
|
44084
|
+
client2 ??= context2.get("client", { optional: true });
|
|
44040
44085
|
if (!integration || !actionDef) {
|
|
44041
44086
|
throw new Error(`Could not find integration "${integrationName}" and action "${actionName}"`);
|
|
44042
44087
|
}
|
|
44043
44088
|
if (!integration.definition.actions?.[actionName]) {
|
|
44044
44089
|
throw new Error(`Action "${actionName}" not found in integration "${integrationName}"`);
|
|
44045
44090
|
}
|
|
44046
|
-
return
|
|
44091
|
+
return client2.callAction({
|
|
44047
44092
|
type: `${integration.alias}:${actionName}`,
|
|
44048
44093
|
input: params
|
|
44049
44094
|
}).then((res) => res.output);
|
|
@@ -44221,8 +44266,8 @@ var init_action = __esm({
|
|
|
44221
44266
|
/**
|
|
44222
44267
|
* Execute the action with input validation and output validation
|
|
44223
44268
|
*/
|
|
44224
|
-
async execute({ input, client }) {
|
|
44225
|
-
return await this.handler({ input, client });
|
|
44269
|
+
async execute({ input, client: client2 }) {
|
|
44270
|
+
return await this.handler({ input, client: client2 });
|
|
44226
44271
|
}
|
|
44227
44272
|
};
|
|
44228
44273
|
}
|
|
@@ -44288,9 +44333,9 @@ var init_computed_columns = __esm({
|
|
|
44288
44333
|
isFinished: z12.boolean(),
|
|
44289
44334
|
rows: z12.array(z12.any())
|
|
44290
44335
|
}),
|
|
44291
|
-
handler: async ({ input, client }) => {
|
|
44336
|
+
handler: async ({ input, client: client2 }) => {
|
|
44292
44337
|
const { tableId, requests } = input;
|
|
44293
|
-
const { table: remoteTable } = await
|
|
44338
|
+
const { table: remoteTable } = await client2._inner.getTable({ table: tableId });
|
|
44294
44339
|
const table = adk.project.tables.find((x) => x.name === remoteTable.name);
|
|
44295
44340
|
async function computeRow(row, columnsToRecompute) {
|
|
44296
44341
|
const newRow = { id: row.id };
|
|
@@ -44363,7 +44408,35 @@ __export(adk_exports, {
|
|
|
44363
44408
|
register: () => register,
|
|
44364
44409
|
registerIntegration: () => registerIntegration
|
|
44365
44410
|
});
|
|
44411
|
+
import { BotSpecificClient } from "@botpress/sdk";
|
|
44366
44412
|
import { Zai } from "@botpress/zai";
|
|
44413
|
+
import { Cognitive as Cognitive2 } from "@botpress/cognitive";
|
|
44414
|
+
import { Client as Client2 } from "@botpress/client";
|
|
44415
|
+
function getStandaloneCognitive() {
|
|
44416
|
+
return getSingleton("__ADK_GLOBAL_STANDALONE_COGNITIVE", () => {
|
|
44417
|
+
const token = process.env.BP_TOKEN || process.env.ADK_TOKEN;
|
|
44418
|
+
if (!token) {
|
|
44419
|
+
throw new Error(
|
|
44420
|
+
'No token found. Set BP_TOKEN or ADK_TOKEN environment variable, or run this script using "adk run".'
|
|
44421
|
+
);
|
|
44422
|
+
}
|
|
44423
|
+
const botId = process.env.ADK_BOT_ID;
|
|
44424
|
+
if (!botId) {
|
|
44425
|
+
throw new Error('No bot ID found. Set ADK_BOT_ID environment variable, or run this script using "adk run".');
|
|
44426
|
+
}
|
|
44427
|
+
const apiUrl = process.env.ADK_API_URL || "https://api.botpress.cloud";
|
|
44428
|
+
const vanillaClient = new Client2({
|
|
44429
|
+
token,
|
|
44430
|
+
apiUrl,
|
|
44431
|
+
botId
|
|
44432
|
+
});
|
|
44433
|
+
const botClient = new BotSpecificClient(vanillaClient);
|
|
44434
|
+
return new Cognitive2({
|
|
44435
|
+
client: botClient,
|
|
44436
|
+
__experimental_beta: true
|
|
44437
|
+
});
|
|
44438
|
+
});
|
|
44439
|
+
}
|
|
44367
44440
|
function initialize(options) {
|
|
44368
44441
|
const state = getState();
|
|
44369
44442
|
if (state.initialized) {
|
|
@@ -44451,8 +44524,10 @@ var init_adk = __esm({
|
|
|
44451
44524
|
return Environment;
|
|
44452
44525
|
},
|
|
44453
44526
|
get zai() {
|
|
44527
|
+
const contextCognitive = context2.get("cognitive", { optional: true });
|
|
44528
|
+
const cognitive = contextCognitive ?? getStandaloneCognitive();
|
|
44454
44529
|
return new Zai({
|
|
44455
|
-
client:
|
|
44530
|
+
client: cognitive,
|
|
44456
44531
|
modelId: Array.isArray(adk.project.config.defaultModels.zai) ? adk.project.config.defaultModels.zai[0] ?? "auto" : adk.project.config.defaultModels.zai
|
|
44457
44532
|
});
|
|
44458
44533
|
},
|
|
@@ -44477,6 +44552,29 @@ var init_adk = __esm({
|
|
|
44477
44552
|
conversations: state.primitives.conversations,
|
|
44478
44553
|
triggers: state.primitives.triggers
|
|
44479
44554
|
};
|
|
44555
|
+
},
|
|
44556
|
+
async execute(props) {
|
|
44557
|
+
const contextCognitive = context2.get("cognitive", { optional: true });
|
|
44558
|
+
const cognitive = contextCognitive ?? getStandaloneCognitive();
|
|
44559
|
+
const defaultModel = adk.project.config.defaultModels.autonomous;
|
|
44560
|
+
const { execute: llmz_execute, getValue: getValue2 } = await import("llmz");
|
|
44561
|
+
return llmz_execute({
|
|
44562
|
+
client: cognitive,
|
|
44563
|
+
instructions: props.instructions,
|
|
44564
|
+
...props.tools && { tools: props.tools },
|
|
44565
|
+
...props.objects && { objects: props.objects },
|
|
44566
|
+
...props.exits && { exits: props.exits },
|
|
44567
|
+
...props.signal && { signal: props.signal },
|
|
44568
|
+
temperature: async (ctx) => props.temperature ? await getValue2(props.temperature, ctx) : 0.7,
|
|
44569
|
+
model: async (ctx) => props.model ? await getValue2(props.model, ctx) : defaultModel,
|
|
44570
|
+
options: { loop: props.iterations ?? 10 },
|
|
44571
|
+
...props.hooks?.onTrace && { onTrace: props.hooks.onTrace },
|
|
44572
|
+
...props.hooks?.onIterationEnd && { onIterationEnd: props.hooks.onIterationEnd },
|
|
44573
|
+
...props.hooks?.onBeforeTool && { onBeforeTool: props.hooks.onBeforeTool },
|
|
44574
|
+
...props.hooks?.onAfterTool && { onAfterTool: props.hooks.onAfterTool },
|
|
44575
|
+
...props.hooks?.onBeforeExecution && { onBeforeExecution: props.hooks.onBeforeExecution },
|
|
44576
|
+
...props.hooks?.onExit && { onExit: props.hooks.onExit }
|
|
44577
|
+
});
|
|
44480
44578
|
}
|
|
44481
44579
|
};
|
|
44482
44580
|
}
|
|
@@ -44650,7 +44748,7 @@ var init_workflow_utils = __esm({
|
|
|
44650
44748
|
init_runtime2();
|
|
44651
44749
|
init_events();
|
|
44652
44750
|
updateWorkflow = async (props) => {
|
|
44653
|
-
const
|
|
44751
|
+
const client2 = context2.get("client");
|
|
44654
44752
|
const workflowId = props.id;
|
|
44655
44753
|
const workflowsToUpdate = [];
|
|
44656
44754
|
const ctxWorkflow = context2.get("workflow", { optional: true });
|
|
@@ -44669,7 +44767,7 @@ var init_workflow_utils = __esm({
|
|
|
44669
44767
|
if (workflowAlreadyDone) {
|
|
44670
44768
|
return { workflow: workflowAlreadyDone };
|
|
44671
44769
|
}
|
|
44672
|
-
const response = await
|
|
44770
|
+
const response = await client2.updateWorkflow(props);
|
|
44673
44771
|
for (const wf of workflowsToUpdate) {
|
|
44674
44772
|
Object.assign(wf, response.workflow);
|
|
44675
44773
|
}
|
|
@@ -44973,7 +45071,7 @@ var init_define_config = __esm({
|
|
|
44973
45071
|
|
|
44974
45072
|
// src/library.ts
|
|
44975
45073
|
import { z as z18 } from "@botpress/sdk";
|
|
44976
|
-
import { Cognitive as
|
|
45074
|
+
import { Cognitive as Cognitive3 } from "@botpress/cognitive";
|
|
44977
45075
|
import { Zai as Zai2 } from "@botpress/zai";
|
|
44978
45076
|
var init_library = __esm({
|
|
44979
45077
|
"src/library.ts"() {
|
|
@@ -44981,6 +45079,7 @@ var init_library = __esm({
|
|
|
44981
45079
|
init_define_BUILD();
|
|
44982
45080
|
init_define_PACKAGE_VERSIONS();
|
|
44983
45081
|
init_runtime();
|
|
45082
|
+
init_client();
|
|
44984
45083
|
init_primitives();
|
|
44985
45084
|
init_workflow_utils();
|
|
44986
45085
|
init_events();
|
|
@@ -45224,9 +45323,9 @@ var init_workflow_step = __esm({
|
|
|
45224
45323
|
async () => {
|
|
45225
45324
|
const remainingTime = context2.get("runtime").getRemainingExecutionTimeInMs();
|
|
45226
45325
|
if (remainingTime - MIN_STEP_REMAINING_TIME_MS <= ms3 || ms3 >= 1e4) {
|
|
45227
|
-
const
|
|
45326
|
+
const client2 = context2.get("client");
|
|
45228
45327
|
const workflowControlContext = context2.get("workflowControlContext");
|
|
45229
|
-
await
|
|
45328
|
+
await client2.createEvent({
|
|
45230
45329
|
type: WorkflowContinueEvent.name,
|
|
45231
45330
|
payload: {},
|
|
45232
45331
|
workflowId: workflowControlContext.workflow.id,
|
|
@@ -45262,13 +45361,13 @@ var init_workflow_step = __esm({
|
|
|
45262
45361
|
return await _step(
|
|
45263
45362
|
name,
|
|
45264
45363
|
async () => {
|
|
45265
|
-
const
|
|
45364
|
+
const client2 = context2.get("client");
|
|
45266
45365
|
const state = createWorkflowExecutionState(
|
|
45267
45366
|
context2.get("client")._inner,
|
|
45268
45367
|
workflowControlContext.workflow.id
|
|
45269
45368
|
);
|
|
45270
45369
|
assert(state.value, "State is not loaded");
|
|
45271
|
-
const { workflow } = await
|
|
45370
|
+
const { workflow } = await client2.getWorkflow({ id: workflowId });
|
|
45272
45371
|
if (isWorkflowFinished(workflow.status)) {
|
|
45273
45372
|
return workflow;
|
|
45274
45373
|
}
|
|
@@ -45356,7 +45455,7 @@ var init_workflow_step = __esm({
|
|
|
45356
45455
|
actualStepName,
|
|
45357
45456
|
async () => {
|
|
45358
45457
|
const workflowControlContext = context2.get("workflowControlContext");
|
|
45359
|
-
const
|
|
45458
|
+
const client2 = context2.get("client");
|
|
45360
45459
|
if (!workflowControlContext.workflow.conversationId) {
|
|
45361
45460
|
throw new Error(`Cannot request data: workflow ${workflowControlContext.workflow.id} has no conversationId`);
|
|
45362
45461
|
}
|
|
@@ -45370,14 +45469,14 @@ var init_workflow_step = __esm({
|
|
|
45370
45469
|
`Request "${request}" not found in workflow "${workflowDef.name}". Available requests: ${Object.keys(workflowDef._requestsSchemas || {}).join(", ") || "none"}`
|
|
45371
45470
|
);
|
|
45372
45471
|
}
|
|
45373
|
-
const state = createWorkflowExecutionState(
|
|
45472
|
+
const state = createWorkflowExecutionState(client2._inner, workflowControlContext.workflow.id);
|
|
45374
45473
|
if (!state.value) {
|
|
45375
45474
|
throw new Error("Workflow execution state not loaded");
|
|
45376
45475
|
}
|
|
45377
45476
|
if (state.value.steps?.[actualStepName]?.output !== void 0) {
|
|
45378
45477
|
return requestSchema.parse(state.value.steps[actualStepName].output);
|
|
45379
45478
|
}
|
|
45380
|
-
await
|
|
45479
|
+
await client2.createEvent({
|
|
45381
45480
|
type: WorkflowDataRequestEvent2.name,
|
|
45382
45481
|
conversationId: workflowControlContext.workflow.conversationId,
|
|
45383
45482
|
payload: {
|
|
@@ -45407,7 +45506,7 @@ var init_workflow_step = __esm({
|
|
|
45407
45506
|
|
|
45408
45507
|
// src/primitives/workflow-cancellation-monitor.ts
|
|
45409
45508
|
function startWorkflowCancellationMonitor(props) {
|
|
45410
|
-
const { client, workflowId, workflowControlContext, abortSignal, pollIntervalMs = 1e3 } = props;
|
|
45509
|
+
const { client: client2, workflowId, workflowControlContext, abortSignal, pollIntervalMs = 1e3 } = props;
|
|
45411
45510
|
if (abortSignal.aborted) {
|
|
45412
45511
|
return () => {
|
|
45413
45512
|
};
|
|
@@ -45418,7 +45517,7 @@ function startWorkflowCancellationMonitor(props) {
|
|
|
45418
45517
|
return;
|
|
45419
45518
|
}
|
|
45420
45519
|
try {
|
|
45421
|
-
const { workflow } = await
|
|
45520
|
+
const { workflow } = await client2.getWorkflow({ id: workflowId });
|
|
45422
45521
|
const isTerminated = workflow.status === "cancelled" || workflow.status === "failed" || workflow.status === "timedout";
|
|
45423
45522
|
if (isTerminated) {
|
|
45424
45523
|
workflowControlContext.aborted = true;
|
|
@@ -45462,10 +45561,10 @@ function createStepSignal() {
|
|
|
45462
45561
|
[StepSymbol]: true
|
|
45463
45562
|
};
|
|
45464
45563
|
}
|
|
45465
|
-
function createWorkflowExecutionState(
|
|
45564
|
+
function createWorkflowExecutionState(client2, workflowId) {
|
|
45466
45565
|
return TrackedState2.create({
|
|
45467
45566
|
type: "workflow",
|
|
45468
|
-
client,
|
|
45567
|
+
client: client2,
|
|
45469
45568
|
id: workflowId,
|
|
45470
45569
|
schema: workflowExecutionContextSchema,
|
|
45471
45570
|
name: BUILT_IN_STATES.workflowSteps
|
|
@@ -45523,18 +45622,18 @@ var init_workflow_instance = __esm({
|
|
|
45523
45622
|
TrackedState;
|
|
45524
45623
|
// @internal
|
|
45525
45624
|
TrackedTags;
|
|
45526
|
-
constructor(workflow,
|
|
45625
|
+
constructor(workflow, client2) {
|
|
45527
45626
|
const definition = adk.project.workflows.find((w) => w.name === workflow.name);
|
|
45528
45627
|
this.TrackedState = TrackedState2.create({
|
|
45529
45628
|
type: "workflow",
|
|
45530
|
-
client:
|
|
45629
|
+
client: client2._inner,
|
|
45531
45630
|
id: workflow.id,
|
|
45532
45631
|
schema: definition?.stateSchema,
|
|
45533
45632
|
name: BUILT_IN_STATES.workflowState
|
|
45534
45633
|
});
|
|
45535
45634
|
this.TrackedTags = TrackedTags.create({
|
|
45536
45635
|
type: "workflow",
|
|
45537
|
-
client:
|
|
45636
|
+
client: client2._inner,
|
|
45538
45637
|
id: workflow.id,
|
|
45539
45638
|
initialTags: workflow.tags
|
|
45540
45639
|
});
|
|
@@ -45544,7 +45643,7 @@ var init_workflow_instance = __esm({
|
|
|
45544
45643
|
this.input = workflow.input;
|
|
45545
45644
|
this.createdAt = new Date(workflow.createdAt);
|
|
45546
45645
|
this.updatedAt = new Date(workflow.updatedAt);
|
|
45547
|
-
this.client =
|
|
45646
|
+
this.client = client2;
|
|
45548
45647
|
this.workflow = workflow;
|
|
45549
45648
|
}
|
|
45550
45649
|
get tags() {
|
|
@@ -45565,19 +45664,19 @@ var init_workflow_instance = __esm({
|
|
|
45565
45664
|
}
|
|
45566
45665
|
static Primitive = "workflow_instance";
|
|
45567
45666
|
static async load(props) {
|
|
45568
|
-
const
|
|
45569
|
-
const workflow = props.workflow ? props.workflow : await
|
|
45667
|
+
const client2 = context2.get("client");
|
|
45668
|
+
const workflow = props.workflow ? props.workflow : await client2.getWorkflow({ id: props.id }).then((x) => x.workflow);
|
|
45570
45669
|
if (!adk.project.workflows.find((w) => w.name === workflow.name)) {
|
|
45571
45670
|
throw new Error(`No ADK Workflow definition found for "${workflow.name}"`);
|
|
45572
45671
|
}
|
|
45573
45672
|
TrackedTags.create({
|
|
45574
45673
|
type: "workflow",
|
|
45575
|
-
client:
|
|
45674
|
+
client: client2._inner,
|
|
45576
45675
|
id: workflow.id,
|
|
45577
45676
|
initialTags: workflow.tags
|
|
45578
45677
|
});
|
|
45579
45678
|
await TrackedTags.loadAll();
|
|
45580
|
-
return new _BaseWorkflowInstance(workflow,
|
|
45679
|
+
return new _BaseWorkflowInstance(workflow, client2);
|
|
45581
45680
|
}
|
|
45582
45681
|
/**
|
|
45583
45682
|
* Executes the workflow with the provided autonomous engine configuration.
|
|
@@ -45614,8 +45713,8 @@ var init_workflow_instance = __esm({
|
|
|
45614
45713
|
* }
|
|
45615
45714
|
*/
|
|
45616
45715
|
async provide(request, data) {
|
|
45617
|
-
const
|
|
45618
|
-
const state = createWorkflowExecutionState(
|
|
45716
|
+
const client2 = context2.get("client");
|
|
45717
|
+
const state = createWorkflowExecutionState(client2._inner, this.id);
|
|
45619
45718
|
await state.load();
|
|
45620
45719
|
if (!state.value) {
|
|
45621
45720
|
throw new Error(`Workflow execution state not found for workflow ${this.id}`);
|
|
@@ -45634,7 +45733,7 @@ var init_workflow_instance = __esm({
|
|
|
45634
45733
|
}
|
|
45635
45734
|
state.value.revision++;
|
|
45636
45735
|
await state.save();
|
|
45637
|
-
await
|
|
45736
|
+
await client2.createEvent({
|
|
45638
45737
|
type: WorkflowContinueEvent.name,
|
|
45639
45738
|
workflowId: this.id,
|
|
45640
45739
|
payload: {}
|
|
@@ -45685,8 +45784,8 @@ var init_workflow_instance = __esm({
|
|
|
45685
45784
|
}
|
|
45686
45785
|
};
|
|
45687
45786
|
try {
|
|
45688
|
-
const
|
|
45689
|
-
const workflowExecutionState = createWorkflowExecutionState(
|
|
45787
|
+
const client2 = context2.get("client");
|
|
45788
|
+
const workflowExecutionState = createWorkflowExecutionState(client2._inner, this.id);
|
|
45690
45789
|
await workflowExecutionState.load();
|
|
45691
45790
|
await this.TrackedState.load();
|
|
45692
45791
|
abortSignal.throwIfAborted();
|
|
@@ -45708,7 +45807,7 @@ var init_workflow_instance = __esm({
|
|
|
45708
45807
|
}
|
|
45709
45808
|
context2.set("workflowControlContext", workflowControlContext);
|
|
45710
45809
|
const stopCancellationMonitor = startWorkflowCancellationMonitor({
|
|
45711
|
-
client:
|
|
45810
|
+
client: client2._inner,
|
|
45712
45811
|
workflowId: this.id,
|
|
45713
45812
|
workflowControlContext,
|
|
45714
45813
|
abortSignal
|
|
@@ -46073,14 +46172,14 @@ var init_tracked_state = __esm({
|
|
|
46073
46172
|
}
|
|
46074
46173
|
static async loadAll() {
|
|
46075
46174
|
await span("state.loadAll", {}, async () => {
|
|
46076
|
-
const
|
|
46175
|
+
const client2 = context2.get("client")._inner;
|
|
46077
46176
|
const botId = context2.get("botId", { optional: true });
|
|
46078
46177
|
const user2 = context2.get("user", { optional: true });
|
|
46079
46178
|
const conversation = context2.get("conversation", { optional: true });
|
|
46080
46179
|
const { adk: adk2 } = await Promise.resolve().then(() => (init_adk(), adk_exports));
|
|
46081
46180
|
if (botId) {
|
|
46082
46181
|
_TrackedState.create({
|
|
46083
|
-
client,
|
|
46182
|
+
client: client2,
|
|
46084
46183
|
name: BUILT_IN_STATES.bot,
|
|
46085
46184
|
type: "bot",
|
|
46086
46185
|
id: botId,
|
|
@@ -46089,7 +46188,7 @@ var init_tracked_state = __esm({
|
|
|
46089
46188
|
}
|
|
46090
46189
|
if (user2) {
|
|
46091
46190
|
_TrackedState.create({
|
|
46092
|
-
client,
|
|
46191
|
+
client: client2,
|
|
46093
46192
|
name: BUILT_IN_STATES.user,
|
|
46094
46193
|
type: "user",
|
|
46095
46194
|
id: user2.id,
|
|
@@ -46106,7 +46205,7 @@ var init_tracked_state = __esm({
|
|
|
46106
46205
|
}
|
|
46107
46206
|
});
|
|
46108
46207
|
_TrackedState.create({
|
|
46109
|
-
client,
|
|
46208
|
+
client: client2,
|
|
46110
46209
|
name: BUILT_IN_STATES.conversation,
|
|
46111
46210
|
type: "conversation",
|
|
46112
46211
|
id: conversation.id,
|
|
@@ -46473,7 +46572,7 @@ var init_events2 = __esm({
|
|
|
46473
46572
|
// src/runtime/context/handlers.ts
|
|
46474
46573
|
import * as sdk from "@botpress/sdk";
|
|
46475
46574
|
import { CitationsManager } from "llmz";
|
|
46476
|
-
import { Client } from "@botpress/client";
|
|
46575
|
+
import { Client as Client3 } from "@botpress/client";
|
|
46477
46576
|
import { ulid as ulid2 } from "ulid";
|
|
46478
46577
|
var requestHooks, registerRequestHook, patchHandlers;
|
|
46479
46578
|
var init_handlers = __esm({
|
|
@@ -46537,15 +46636,15 @@ var init_handlers = __esm({
|
|
|
46537
46636
|
return expiryTime - Date.now();
|
|
46538
46637
|
}
|
|
46539
46638
|
};
|
|
46540
|
-
const vanillaClient = new
|
|
46639
|
+
const vanillaClient = new Client3({
|
|
46541
46640
|
botId: parsed.bot.id,
|
|
46542
46641
|
headers: {
|
|
46543
46642
|
"x-multiple-integrations": "true"
|
|
46544
46643
|
}
|
|
46545
46644
|
});
|
|
46546
|
-
const
|
|
46645
|
+
const client2 = new sdk.BotSpecificClient(vanillaClient);
|
|
46547
46646
|
const cognitive = new InstrumentedCognitive({
|
|
46548
|
-
client,
|
|
46647
|
+
client: client2,
|
|
46549
46648
|
__experimental_beta: true
|
|
46550
46649
|
});
|
|
46551
46650
|
const result = await context2.run(
|
|
@@ -46553,7 +46652,7 @@ var init_handlers = __esm({
|
|
|
46553
46652
|
executionId: ulid2(),
|
|
46554
46653
|
executionFinished: false,
|
|
46555
46654
|
logger: new sdk.BotLogger({}),
|
|
46556
|
-
client,
|
|
46655
|
+
client: client2,
|
|
46557
46656
|
cognitive,
|
|
46558
46657
|
botId: parsed.bot.id,
|
|
46559
46658
|
bot: parsed.bot,
|
|
@@ -48113,7 +48212,7 @@ var init_workflow2 = __esm({
|
|
|
48113
48212
|
init_workflow_utils();
|
|
48114
48213
|
import_ms2 = __toESM(require_ms(), 1);
|
|
48115
48214
|
setup3 = (bot2) => {
|
|
48116
|
-
const handler = async function({ workflow, event, client, ctx, conversation }) {
|
|
48215
|
+
const handler = async function({ workflow, event, client: client2, ctx, conversation }) {
|
|
48117
48216
|
await span(
|
|
48118
48217
|
"handler.workflow",
|
|
48119
48218
|
{
|
|
@@ -48198,7 +48297,7 @@ var init_workflow2 = __esm({
|
|
|
48198
48297
|
output: result.result
|
|
48199
48298
|
});
|
|
48200
48299
|
if (workflow.conversationId && !workflow.parentWorkflowId) {
|
|
48201
|
-
await
|
|
48300
|
+
await client2.createEvent({
|
|
48202
48301
|
type: WorkflowCallbackEvent.name,
|
|
48203
48302
|
conversationId: workflow.conversationId,
|
|
48204
48303
|
payload: {
|
|
@@ -48218,7 +48317,7 @@ var init_workflow2 = __esm({
|
|
|
48218
48317
|
failureReason: result.error
|
|
48219
48318
|
});
|
|
48220
48319
|
if (workflow.conversationId && !workflow.parentWorkflowId) {
|
|
48221
|
-
await
|
|
48320
|
+
await client2.createEvent({
|
|
48222
48321
|
type: WorkflowCallbackEvent.name,
|
|
48223
48322
|
conversationId: workflow.conversationId,
|
|
48224
48323
|
payload: {
|
|
@@ -48239,7 +48338,7 @@ var init_workflow2 = __esm({
|
|
|
48239
48338
|
failureReason: error instanceof Error ? error.message : String(error)
|
|
48240
48339
|
});
|
|
48241
48340
|
if (workflow.conversationId) {
|
|
48242
|
-
await
|
|
48341
|
+
await client2.createEvent({
|
|
48243
48342
|
type: WorkflowCallbackEvent.name,
|
|
48244
48343
|
conversationId: workflow.conversationId,
|
|
48245
48344
|
payload: {
|
|
@@ -48307,7 +48406,7 @@ var init_event = __esm({
|
|
|
48307
48406
|
}
|
|
48308
48407
|
const conversationEventTypes = [WorkflowCallbackEvent.name, WorkflowDataRequestEvent2.name, ...registeredEvents];
|
|
48309
48408
|
for (const eventType of conversationEventTypes) {
|
|
48310
|
-
bot2.on.event(eventType, async ({ event, client, logger, ctx }) => {
|
|
48409
|
+
bot2.on.event(eventType, async ({ event, client: client2, logger, ctx }) => {
|
|
48311
48410
|
const payload = event.payload;
|
|
48312
48411
|
const workflowId = payload.workflowId || payload.workflow_id;
|
|
48313
48412
|
const conversation = context2.get("conversation");
|
|
@@ -48350,7 +48449,7 @@ var init_event = __esm({
|
|
|
48350
48449
|
);
|
|
48351
48450
|
});
|
|
48352
48451
|
}
|
|
48353
|
-
bot2.on.event(WorkflowScheduleEvent.name, async ({ event, client, logger }) => {
|
|
48452
|
+
bot2.on.event(WorkflowScheduleEvent.name, async ({ event, client: client2, logger }) => {
|
|
48354
48453
|
const payload = event.payload;
|
|
48355
48454
|
const workflowName = payload.workflow;
|
|
48356
48455
|
logger.info(`Executing scheduled workflow: ${workflowName} at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
@@ -48360,7 +48459,7 @@ var init_event = __esm({
|
|
|
48360
48459
|
logger.error(`Workflow definition not found for: ${workflowName}`);
|
|
48361
48460
|
return;
|
|
48362
48461
|
}
|
|
48363
|
-
await
|
|
48462
|
+
await client2._inner.createWorkflow({
|
|
48364
48463
|
name: workflowName,
|
|
48365
48464
|
status: "pending",
|
|
48366
48465
|
input: {},
|
|
@@ -48515,7 +48614,7 @@ var init_tracked_tags = __esm({
|
|
|
48515
48614
|
}
|
|
48516
48615
|
static async loadAll() {
|
|
48517
48616
|
await span("tags.loadAll", {}, async () => {
|
|
48518
|
-
const
|
|
48617
|
+
const client2 = context2.get("client")._inner;
|
|
48519
48618
|
const bot2 = context2.get("bot", { optional: true });
|
|
48520
48619
|
const user2 = context2.get("user", { optional: true });
|
|
48521
48620
|
const conversation = context2.get("conversation", { optional: true });
|
|
@@ -48523,7 +48622,7 @@ var init_tracked_tags = __esm({
|
|
|
48523
48622
|
if (bot2) {
|
|
48524
48623
|
const botTags = bot2.tags;
|
|
48525
48624
|
_TrackedTags.create({
|
|
48526
|
-
client,
|
|
48625
|
+
client: client2,
|
|
48527
48626
|
type: "bot",
|
|
48528
48627
|
id: bot2.id,
|
|
48529
48628
|
...botTags && { initialTags: botTags }
|
|
@@ -48532,7 +48631,7 @@ var init_tracked_tags = __esm({
|
|
|
48532
48631
|
if (user2) {
|
|
48533
48632
|
const userTags = user2.tags;
|
|
48534
48633
|
_TrackedTags.create({
|
|
48535
|
-
client,
|
|
48634
|
+
client: client2,
|
|
48536
48635
|
type: "user",
|
|
48537
48636
|
id: user2.id,
|
|
48538
48637
|
...userTags && { initialTags: userTags }
|
|
@@ -48541,7 +48640,7 @@ var init_tracked_tags = __esm({
|
|
|
48541
48640
|
if (conversation) {
|
|
48542
48641
|
const conversationTags = conversation.tags;
|
|
48543
48642
|
_TrackedTags.create({
|
|
48544
|
-
client,
|
|
48643
|
+
client: client2,
|
|
48545
48644
|
type: "conversation",
|
|
48546
48645
|
id: conversation.id,
|
|
48547
48646
|
...conversationTags && { initialTags: conversationTags }
|
|
@@ -48550,7 +48649,7 @@ var init_tracked_tags = __esm({
|
|
|
48550
48649
|
if (workflow) {
|
|
48551
48650
|
const workflowTags = workflow.tags;
|
|
48552
48651
|
_TrackedTags.create({
|
|
48553
|
-
client,
|
|
48652
|
+
client: client2,
|
|
48554
48653
|
type: "workflow",
|
|
48555
48654
|
id: workflow.id,
|
|
48556
48655
|
...workflowTags && { initialTags: workflowTags }
|
|
@@ -48708,6 +48807,7 @@ var init_runtime = __esm({
|
|
|
48708
48807
|
init_tracked_tags();
|
|
48709
48808
|
init_actions();
|
|
48710
48809
|
init_events2();
|
|
48810
|
+
init_client();
|
|
48711
48811
|
}
|
|
48712
48812
|
});
|
|
48713
48813
|
|
|
@@ -49737,6 +49837,7 @@ export {
|
|
|
49737
49837
|
agentRegistry,
|
|
49738
49838
|
assets,
|
|
49739
49839
|
bot,
|
|
49840
|
+
client,
|
|
49740
49841
|
configuration,
|
|
49741
49842
|
context2 as context,
|
|
49742
49843
|
defineConfig,
|