@botpress/runtime 1.6.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/definition.js +117 -14
- package/dist/definition.js.map +4 -4
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +331 -217
- package/dist/internal.js.map +4 -4
- package/dist/library.js +296 -191
- package/dist/library.js.map +4 -4
- package/dist/primitives/action.d.ts +7 -3
- package/dist/primitives/action.d.ts.map +1 -1
- package/dist/primitives/conversation-instance.d.ts.map +1 -1
- package/dist/primitives/conversation.d.ts +30 -9
- package/dist/primitives/conversation.d.ts.map +1 -1
- package/dist/primitives/table.d.ts +11 -7
- package/dist/primitives/table.d.ts.map +1 -1
- package/dist/primitives/workflow.d.ts +18 -0
- package/dist/primitives/workflow.d.ts.map +1 -1
- package/dist/runtime/actions/computed-columns.d.ts +42 -0
- package/dist/runtime/actions/computed-columns.d.ts.map +1 -0
- package/dist/runtime/actions/index.d.ts +47 -0
- package/dist/runtime/actions/index.d.ts.map +1 -0
- package/dist/runtime/adk.d.ts.map +1 -1
- package/dist/runtime/context/http.d.ts +1 -1
- package/dist/runtime/context/http.d.ts.map +1 -1
- package/dist/runtime/handlers/actions.d.ts +3 -0
- package/dist/runtime/handlers/actions.d.ts.map +1 -0
- package/dist/runtime/handlers/event.d.ts.map +1 -1
- package/dist/runtime/handlers/index.d.ts +2 -0
- package/dist/runtime/handlers/index.d.ts.map +1 -1
- package/dist/runtime.js +207 -70
- package/dist/runtime.js.map +4 -4
- package/dist/telemetry/spans/index.d.ts +0 -52
- package/dist/telemetry/spans/index.d.ts.map +1 -1
- package/dist/ui.js +1 -2
- package/dist/ui.js.map +2 -2
- package/dist/workers/dev_worker.d.ts.map +1 -1
- package/dist/workers/parent_worker.d.ts.map +1 -1
- package/dist/workers/worker_pool.d.ts.map +1 -1
- package/package.json +1 -1
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.7.0", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -24288,7 +24288,7 @@ var require_common = __commonJS({
|
|
|
24288
24288
|
"../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js"(exports2, module) {
|
|
24289
24289
|
init_define_BUILD();
|
|
24290
24290
|
init_define_PACKAGE_VERSIONS();
|
|
24291
|
-
function
|
|
24291
|
+
function setup6(env2) {
|
|
24292
24292
|
createDebug.debug = createDebug;
|
|
24293
24293
|
createDebug.default = createDebug;
|
|
24294
24294
|
createDebug.coerce = coerce;
|
|
@@ -24458,7 +24458,7 @@ var require_common = __commonJS({
|
|
|
24458
24458
|
createDebug.enable(createDebug.load());
|
|
24459
24459
|
return createDebug;
|
|
24460
24460
|
}
|
|
24461
|
-
module.exports =
|
|
24461
|
+
module.exports = setup6;
|
|
24462
24462
|
}
|
|
24463
24463
|
});
|
|
24464
24464
|
|
|
@@ -27678,11 +27678,11 @@ function expand_(str, isTop) {
|
|
|
27678
27678
|
if (pad) {
|
|
27679
27679
|
const need = width - c.length;
|
|
27680
27680
|
if (need > 0) {
|
|
27681
|
-
const
|
|
27681
|
+
const z26 = new Array(need + 1).join("0");
|
|
27682
27682
|
if (i < 0) {
|
|
27683
|
-
c = "-" +
|
|
27683
|
+
c = "-" + z26 + c.slice(1);
|
|
27684
27684
|
} else {
|
|
27685
|
-
c =
|
|
27685
|
+
c = z26 + c;
|
|
27686
27686
|
}
|
|
27687
27687
|
}
|
|
27688
27688
|
}
|
|
@@ -35741,7 +35741,7 @@ var agentRegistry = getSingleton("__ADK_GLOBAL_AGENT_REGISTRY", () => new AgentR
|
|
|
35741
35741
|
// src/runtime/tracked-state.ts
|
|
35742
35742
|
init_define_BUILD();
|
|
35743
35743
|
init_define_PACKAGE_VERSIONS();
|
|
35744
|
-
import { z as
|
|
35744
|
+
import { z as z21 } from "@botpress/sdk";
|
|
35745
35745
|
|
|
35746
35746
|
// ../../node_modules/.bun/axios@1.12.2/node_modules/axios/index.js
|
|
35747
35747
|
init_define_BUILD();
|
|
@@ -40027,7 +40027,7 @@ var actions = new Proxy({}, {
|
|
|
40027
40027
|
const botAction = adk.project.actions.find((a) => a.name === propertyName);
|
|
40028
40028
|
if (botAction) {
|
|
40029
40029
|
const handler = async (input) => {
|
|
40030
|
-
return botAction.handler(input);
|
|
40030
|
+
return await botAction.handler(input);
|
|
40031
40031
|
};
|
|
40032
40032
|
handler.asTool = () => new Autonomous.Tool({
|
|
40033
40033
|
name: botAction.name,
|
|
@@ -40373,7 +40373,7 @@ var BaseConversationInstance = class {
|
|
|
40373
40373
|
TrackedState;
|
|
40374
40374
|
constructor(conversation, client) {
|
|
40375
40375
|
this.id = conversation.id;
|
|
40376
|
-
this.channel = conversation.channel
|
|
40376
|
+
this.channel = `${conversation.integration}.${conversation.channel}`;
|
|
40377
40377
|
this.integration = conversation.integration;
|
|
40378
40378
|
this.tags = conversation.tags;
|
|
40379
40379
|
this.conversation = conversation;
|
|
@@ -43037,6 +43037,7 @@ var BaseConversation = class {
|
|
|
43037
43037
|
await this.#handler({
|
|
43038
43038
|
type,
|
|
43039
43039
|
message,
|
|
43040
|
+
channel: conversationInstance.channel,
|
|
43040
43041
|
event,
|
|
43041
43042
|
request: requestObject,
|
|
43042
43043
|
conversation: conversationInstance,
|
|
@@ -43176,8 +43177,8 @@ var BaseAction = class {
|
|
|
43176
43177
|
/**
|
|
43177
43178
|
* Execute the action with input validation and output validation
|
|
43178
43179
|
*/
|
|
43179
|
-
async execute({ input }) {
|
|
43180
|
-
return this.handler(input);
|
|
43180
|
+
async execute({ input, client }) {
|
|
43181
|
+
return await this.handler({ input, client });
|
|
43181
43182
|
}
|
|
43182
43183
|
};
|
|
43183
43184
|
|
|
@@ -43202,6 +43203,14 @@ var BaseTable = class {
|
|
|
43202
43203
|
return context2.get("client");
|
|
43203
43204
|
}
|
|
43204
43205
|
constructor(props) {
|
|
43206
|
+
const tableNameSchema = z10.string().min(1).refine((name) => !z10.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
|
|
43207
|
+
(name) => /^[a-zA-Z_$][a-zA-Z0-9_]{0,29}Table$/.test(name),
|
|
43208
|
+
"Table name must start with a letter/underscore, be 35 chars or less, contain only letters/numbers/underscores, and end with 'Table'"
|
|
43209
|
+
);
|
|
43210
|
+
const validation = tableNameSchema.safeParse(props.name);
|
|
43211
|
+
if (!validation.success) {
|
|
43212
|
+
throw new Errors.InvalidPrimitiveError(`Invalid table name '${props.name}'`, validation.error);
|
|
43213
|
+
}
|
|
43205
43214
|
this.name = props.name;
|
|
43206
43215
|
if (props.description !== void 0) {
|
|
43207
43216
|
this.description = props.description;
|
|
@@ -44386,6 +44395,40 @@ var BaseWorkflow = class {
|
|
|
44386
44395
|
workflow: res.workflow
|
|
44387
44396
|
});
|
|
44388
44397
|
}
|
|
44398
|
+
/**
|
|
44399
|
+
* Convert this workflow into an Autonomous.Tool that can be used with execute().
|
|
44400
|
+
* Starts the workflow and returns basic information about the workflow instance.
|
|
44401
|
+
*
|
|
44402
|
+
* @param options.description - Optional description override for the tool
|
|
44403
|
+
* @returns An Autonomous.Tool instance
|
|
44404
|
+
*
|
|
44405
|
+
* @example
|
|
44406
|
+
* const tool = MyWorkflow.asTool()
|
|
44407
|
+
*
|
|
44408
|
+
* await execute({
|
|
44409
|
+
* tools: [tool],
|
|
44410
|
+
* instructions: 'Use the workflow when needed'
|
|
44411
|
+
* })
|
|
44412
|
+
*/
|
|
44413
|
+
asTool(options) {
|
|
44414
|
+
const description = options?.description || this.description || `Starts the ${this.name} workflow`;
|
|
44415
|
+
return new Autonomous.Tool({
|
|
44416
|
+
name: this.name,
|
|
44417
|
+
description,
|
|
44418
|
+
input: this._inputSchema,
|
|
44419
|
+
output: z17.object({
|
|
44420
|
+
workflowId: z17.string().describe("The ID of the started workflow"),
|
|
44421
|
+
status: z17.string().describe("The initial status of the workflow")
|
|
44422
|
+
}),
|
|
44423
|
+
handler: async (input) => {
|
|
44424
|
+
const instance = await this.start(input);
|
|
44425
|
+
return {
|
|
44426
|
+
workflowId: instance.id,
|
|
44427
|
+
status: instance.status
|
|
44428
|
+
};
|
|
44429
|
+
}
|
|
44430
|
+
});
|
|
44431
|
+
}
|
|
44389
44432
|
};
|
|
44390
44433
|
|
|
44391
44434
|
// src/runtime/workflows/knowledge-indexing.ts
|
|
@@ -44442,6 +44485,68 @@ var BuiltInWorkflows = {
|
|
|
44442
44485
|
|
|
44443
44486
|
// src/runtime/adk.ts
|
|
44444
44487
|
import { Zai } from "@botpress/zai";
|
|
44488
|
+
|
|
44489
|
+
// src/runtime/actions/index.ts
|
|
44490
|
+
init_define_BUILD();
|
|
44491
|
+
init_define_PACKAGE_VERSIONS();
|
|
44492
|
+
|
|
44493
|
+
// src/runtime/actions/computed-columns.ts
|
|
44494
|
+
init_define_BUILD();
|
|
44495
|
+
init_define_PACKAGE_VERSIONS();
|
|
44496
|
+
import { z as z19 } from "@botpress/sdk";
|
|
44497
|
+
var tablesRecomputeRows = new BaseAction({
|
|
44498
|
+
name: "tablesRecomputeRows",
|
|
44499
|
+
// skynet/packages/tables-api/src/services/computed/compute-stale-rows.ts
|
|
44500
|
+
input: z19.object({
|
|
44501
|
+
tableId: z19.string(),
|
|
44502
|
+
botId: z19.string(),
|
|
44503
|
+
schema: z19.any(),
|
|
44504
|
+
requests: z19.array(
|
|
44505
|
+
z19.object({
|
|
44506
|
+
row: z19.record(z19.any()),
|
|
44507
|
+
columnsToRecompute: z19.array(z19.string())
|
|
44508
|
+
})
|
|
44509
|
+
)
|
|
44510
|
+
}),
|
|
44511
|
+
output: z19.object({
|
|
44512
|
+
isFinished: z19.boolean(),
|
|
44513
|
+
rows: z19.array(z19.any())
|
|
44514
|
+
}),
|
|
44515
|
+
handler: async ({ input, client }) => {
|
|
44516
|
+
const { tableId, requests } = input;
|
|
44517
|
+
const { table: remoteTable } = await client._inner.getTable({ table: tableId });
|
|
44518
|
+
const table = adk.project.tables.find((x) => x.name === remoteTable.name);
|
|
44519
|
+
async function computeRow(row, columnsToRecompute) {
|
|
44520
|
+
const newRow = { id: row.id };
|
|
44521
|
+
for (const colName of columnsToRecompute) {
|
|
44522
|
+
const col = table?.columns[colName];
|
|
44523
|
+
if (!col || !col.computed) {
|
|
44524
|
+
newRow[colName] = { status: "error", error: "Column not found or not computed" };
|
|
44525
|
+
continue;
|
|
44526
|
+
}
|
|
44527
|
+
newRow[colName] = {
|
|
44528
|
+
status: "computed",
|
|
44529
|
+
value: await col.value(row)
|
|
44530
|
+
};
|
|
44531
|
+
}
|
|
44532
|
+
return newRow;
|
|
44533
|
+
}
|
|
44534
|
+
const computedRows = await Promise.all(
|
|
44535
|
+
requests.map(async (r) => {
|
|
44536
|
+
const computedRow = await computeRow(r.row, r.columnsToRecompute);
|
|
44537
|
+
return computedRow;
|
|
44538
|
+
})
|
|
44539
|
+
);
|
|
44540
|
+
return { isFinished: true, rows: computedRows };
|
|
44541
|
+
}
|
|
44542
|
+
});
|
|
44543
|
+
|
|
44544
|
+
// src/runtime/actions/index.ts
|
|
44545
|
+
var BuiltInActions = {
|
|
44546
|
+
tablesRecomputeRows
|
|
44547
|
+
};
|
|
44548
|
+
|
|
44549
|
+
// src/runtime/adk.ts
|
|
44445
44550
|
var getState = () => getSingleton("__ADK_GLOBAL_PROJECT", () => {
|
|
44446
44551
|
const state = {
|
|
44447
44552
|
initialized: false,
|
|
@@ -44465,6 +44570,7 @@ function initialize(options) {
|
|
|
44465
44570
|
state.projectConfig = options.config;
|
|
44466
44571
|
state.initialized = true;
|
|
44467
44572
|
state.primitives.workflows.push(...Object.values(BuiltInWorkflows));
|
|
44573
|
+
state.primitives.actions.push(...Object.values(BuiltInActions));
|
|
44468
44574
|
}
|
|
44469
44575
|
function register(...primitives) {
|
|
44470
44576
|
const state = getState();
|
|
@@ -44577,12 +44683,12 @@ var importScheduledHeavyImports = async () => {
|
|
|
44577
44683
|
// src/runtime/tracked-state-schema.ts
|
|
44578
44684
|
init_define_BUILD();
|
|
44579
44685
|
init_define_PACKAGE_VERSIONS();
|
|
44580
|
-
import { z as
|
|
44581
|
-
var TrackedStateSchema =
|
|
44582
|
-
value:
|
|
44583
|
-
location:
|
|
44584
|
-
|
|
44585
|
-
|
|
44686
|
+
import { z as z20 } from "@botpress/sdk";
|
|
44687
|
+
var TrackedStateSchema = z20.object({
|
|
44688
|
+
value: z20.any(),
|
|
44689
|
+
location: z20.discriminatedUnion("type", [
|
|
44690
|
+
z20.object({ type: z20.literal("state") }),
|
|
44691
|
+
z20.object({ type: z20.literal("file"), key: z20.string() })
|
|
44586
44692
|
])
|
|
44587
44693
|
});
|
|
44588
44694
|
|
|
@@ -44679,7 +44785,7 @@ var TrackedState2 = class _TrackedState {
|
|
|
44679
44785
|
name: BUILT_IN_STATES.bot,
|
|
44680
44786
|
type: "bot",
|
|
44681
44787
|
id: botId,
|
|
44682
|
-
schema: adk.project.config.bot?.state ||
|
|
44788
|
+
schema: adk.project.config.bot?.state || z21.object({})
|
|
44683
44789
|
});
|
|
44684
44790
|
}
|
|
44685
44791
|
if (user2) {
|
|
@@ -44688,7 +44794,7 @@ var TrackedState2 = class _TrackedState {
|
|
|
44688
44794
|
name: BUILT_IN_STATES.user,
|
|
44689
44795
|
type: "user",
|
|
44690
44796
|
id: user2.id,
|
|
44691
|
-
schema: adk.project.config.user?.state ||
|
|
44797
|
+
schema: adk.project.config.user?.state || z21.object({})
|
|
44692
44798
|
});
|
|
44693
44799
|
}
|
|
44694
44800
|
if (conversation) {
|
|
@@ -44705,7 +44811,7 @@ var TrackedState2 = class _TrackedState {
|
|
|
44705
44811
|
name: BUILT_IN_STATES.conversation,
|
|
44706
44812
|
type: "conversation",
|
|
44707
44813
|
id: conversation.id,
|
|
44708
|
-
schema: definition?.schema ||
|
|
44814
|
+
schema: definition?.schema || z21.object({})
|
|
44709
44815
|
});
|
|
44710
44816
|
}
|
|
44711
44817
|
const states = context2.get("states", { optional: true });
|
|
@@ -44997,48 +45103,48 @@ async function handleInspectorChrome() {
|
|
|
44997
45103
|
// src/runtime/events.ts
|
|
44998
45104
|
init_define_BUILD();
|
|
44999
45105
|
init_define_PACKAGE_VERSIONS();
|
|
45000
|
-
import { z as
|
|
45106
|
+
import { z as z22 } from "@botpress/sdk";
|
|
45001
45107
|
var WorkflowCallbackEvent = {
|
|
45002
45108
|
name: "workflowCallback",
|
|
45003
|
-
schema:
|
|
45004
|
-
workflow:
|
|
45005
|
-
workflowId:
|
|
45006
|
-
target:
|
|
45007
|
-
|
|
45008
|
-
conversationId:
|
|
45109
|
+
schema: z22.object({
|
|
45110
|
+
workflow: z22.string(),
|
|
45111
|
+
workflowId: z22.string(),
|
|
45112
|
+
target: z22.union([
|
|
45113
|
+
z22.object({
|
|
45114
|
+
conversationId: z22.string()
|
|
45009
45115
|
}),
|
|
45010
|
-
|
|
45011
|
-
workflowId:
|
|
45116
|
+
z22.object({
|
|
45117
|
+
workflowId: z22.string()
|
|
45012
45118
|
})
|
|
45013
45119
|
]),
|
|
45014
|
-
status:
|
|
45015
|
-
output:
|
|
45016
|
-
error:
|
|
45120
|
+
status: z22.enum(["completed", "failed", "canceled", "timed_out"]),
|
|
45121
|
+
output: z22.any().optional(),
|
|
45122
|
+
error: z22.string().optional()
|
|
45017
45123
|
})
|
|
45018
45124
|
};
|
|
45019
45125
|
var WorkflowScheduleEvent = {
|
|
45020
45126
|
name: "workflowSchedule",
|
|
45021
|
-
schema:
|
|
45022
|
-
workflow:
|
|
45127
|
+
schema: z22.object({
|
|
45128
|
+
workflow: z22.string()
|
|
45023
45129
|
})
|
|
45024
45130
|
};
|
|
45025
45131
|
var WorkflowContinueEvent = {
|
|
45026
45132
|
name: "workflowContinue",
|
|
45027
|
-
schema:
|
|
45133
|
+
schema: z22.object({})
|
|
45028
45134
|
};
|
|
45029
45135
|
var SubworkflowFinished = {
|
|
45030
45136
|
name: "subworkflowFinished",
|
|
45031
|
-
schema:
|
|
45137
|
+
schema: z22.object({})
|
|
45032
45138
|
};
|
|
45033
45139
|
var WorkflowDataRequestEvent = {
|
|
45034
45140
|
name: "workflowDataRequest",
|
|
45035
|
-
schema:
|
|
45036
|
-
workflowId:
|
|
45037
|
-
workflowName:
|
|
45038
|
-
stepName:
|
|
45039
|
-
request:
|
|
45040
|
-
message:
|
|
45041
|
-
schema:
|
|
45141
|
+
schema: z22.object({
|
|
45142
|
+
workflowId: z22.string(),
|
|
45143
|
+
workflowName: z22.string(),
|
|
45144
|
+
stepName: z22.string(),
|
|
45145
|
+
request: z22.string(),
|
|
45146
|
+
message: z22.string(),
|
|
45147
|
+
schema: z22.any()
|
|
45042
45148
|
// JSON Schema
|
|
45043
45149
|
})
|
|
45044
45150
|
};
|
|
@@ -45419,7 +45525,7 @@ function getItemSize(item) {
|
|
|
45419
45525
|
// src/runtime/chat/messages.ts
|
|
45420
45526
|
init_define_BUILD();
|
|
45421
45527
|
init_define_PACKAGE_VERSIONS();
|
|
45422
|
-
import { z as
|
|
45528
|
+
import { z as z23 } from "@bpinternal/zui";
|
|
45423
45529
|
import { isAnyComponent } from "llmz";
|
|
45424
45530
|
|
|
45425
45531
|
// src/runtime/chat/html.ts
|
|
@@ -45557,13 +45663,13 @@ function joinMarkdownChildren(children, stringify3 = (el) => JSON.stringify(el,
|
|
|
45557
45663
|
return [...acc, prev, str];
|
|
45558
45664
|
}, []).join("").trim();
|
|
45559
45665
|
}
|
|
45560
|
-
var Message =
|
|
45561
|
-
__jsx:
|
|
45562
|
-
type:
|
|
45563
|
-
props:
|
|
45564
|
-
type:
|
|
45666
|
+
var Message = z23.object({
|
|
45667
|
+
__jsx: z23.literal(true),
|
|
45668
|
+
type: z23.literal("MESSAGE"),
|
|
45669
|
+
props: z23.object({
|
|
45670
|
+
type: z23.enum(["error", "info", "success", "prompt"]).default("info").catch(() => "info")
|
|
45565
45671
|
}).passthrough(),
|
|
45566
|
-
children:
|
|
45672
|
+
children: z23.array(z23.any()).default([]).transform((children) => {
|
|
45567
45673
|
children = children.map((child) => Array.isArray(child) ? child : [child]).flat();
|
|
45568
45674
|
const text = joinMarkdownChildren(
|
|
45569
45675
|
children.filter((x) => !isAnyComponent(x)).map((x) => rebuildTSXCode(x, false))
|
|
@@ -46050,21 +46156,21 @@ ${footer}`.trim();
|
|
|
46050
46156
|
// src/runtime/chat/transcript.ts
|
|
46051
46157
|
init_define_BUILD();
|
|
46052
46158
|
init_define_PACKAGE_VERSIONS();
|
|
46053
|
-
import { z as
|
|
46054
|
-
var AttachmentSchema =
|
|
46055
|
-
type:
|
|
46056
|
-
url:
|
|
46057
|
-
});
|
|
46058
|
-
var TranscriptItemSchema =
|
|
46059
|
-
id:
|
|
46060
|
-
role:
|
|
46061
|
-
name:
|
|
46062
|
-
createdAt:
|
|
46063
|
-
content:
|
|
46064
|
-
attachments:
|
|
46065
|
-
payload:
|
|
46066
|
-
});
|
|
46067
|
-
var TranscriptSchema =
|
|
46159
|
+
import { z as z24 } from "@botpress/sdk";
|
|
46160
|
+
var AttachmentSchema = z24.object({
|
|
46161
|
+
type: z24.literal("image"),
|
|
46162
|
+
url: z24.string()
|
|
46163
|
+
});
|
|
46164
|
+
var TranscriptItemSchema = z24.object({
|
|
46165
|
+
id: z24.string(),
|
|
46166
|
+
role: z24.union([z24.literal("assistant"), z24.literal("user"), z24.literal("event"), z24.literal("summary")]),
|
|
46167
|
+
name: z24.string().optional(),
|
|
46168
|
+
createdAt: z24.string().optional(),
|
|
46169
|
+
content: z24.string().optional(),
|
|
46170
|
+
attachments: z24.array(AttachmentSchema).optional(),
|
|
46171
|
+
payload: z24.unknown().optional()
|
|
46172
|
+
});
|
|
46173
|
+
var TranscriptSchema = z24.array(TranscriptItemSchema);
|
|
46068
46174
|
|
|
46069
46175
|
// src/runtime/handlers/index.ts
|
|
46070
46176
|
init_define_BUILD();
|
|
@@ -46444,12 +46550,44 @@ var setup4 = (bot2) => {
|
|
|
46444
46550
|
});
|
|
46445
46551
|
};
|
|
46446
46552
|
|
|
46553
|
+
// src/runtime/handlers/actions.ts
|
|
46554
|
+
var actions_exports = {};
|
|
46555
|
+
__export(actions_exports, {
|
|
46556
|
+
setup: () => setup5
|
|
46557
|
+
});
|
|
46558
|
+
init_define_BUILD();
|
|
46559
|
+
init_define_PACKAGE_VERSIONS();
|
|
46560
|
+
var setup5 = (bot2) => {
|
|
46561
|
+
const handlers2 = bot2._actionHandlers;
|
|
46562
|
+
for (const action of adk.project.actions) {
|
|
46563
|
+
handlers2[action.name] = async (props) => {
|
|
46564
|
+
return await span(
|
|
46565
|
+
"handler.action",
|
|
46566
|
+
{
|
|
46567
|
+
"action.input": props.input,
|
|
46568
|
+
"action.name": action.name,
|
|
46569
|
+
botId: props.ctx.botId
|
|
46570
|
+
},
|
|
46571
|
+
async () => {
|
|
46572
|
+
await TrackedState2.loadAll();
|
|
46573
|
+
try {
|
|
46574
|
+
return await action.execute(props);
|
|
46575
|
+
} finally {
|
|
46576
|
+
await TrackedState2.saveAllDirty();
|
|
46577
|
+
}
|
|
46578
|
+
}
|
|
46579
|
+
);
|
|
46580
|
+
};
|
|
46581
|
+
}
|
|
46582
|
+
};
|
|
46583
|
+
|
|
46447
46584
|
// src/runtime/handlers/index.ts
|
|
46448
46585
|
var handlers = {
|
|
46449
46586
|
conversation: conversation_exports,
|
|
46450
46587
|
trigger: trigger_exports,
|
|
46451
46588
|
workflow: workflow_exports,
|
|
46452
|
-
event: event_exports
|
|
46589
|
+
event: event_exports,
|
|
46590
|
+
actions: actions_exports
|
|
46453
46591
|
};
|
|
46454
46592
|
|
|
46455
46593
|
// src/telemetry/spans/index.ts
|
|
@@ -46817,8 +46955,7 @@ var ActionHandlerSpan = {
|
|
|
46817
46955
|
name: "handler.action",
|
|
46818
46956
|
importance: "high",
|
|
46819
46957
|
attributes: {
|
|
46820
|
-
...required("botId"
|
|
46821
|
-
...optional("messageId", "userId", "integration", "channel", "conversationId", "parentWorkflowId"),
|
|
46958
|
+
...required("botId"),
|
|
46822
46959
|
"action.name": { type: "string", required: true },
|
|
46823
46960
|
"action.input": { type: "json", required: true }
|
|
46824
46961
|
}
|
|
@@ -47380,7 +47517,7 @@ function installStructuredLogging() {
|
|
|
47380
47517
|
|
|
47381
47518
|
// src/runtime.ts
|
|
47382
47519
|
init_trigger_tags();
|
|
47383
|
-
import { z as
|
|
47520
|
+
import { z as z25 } from "@botpress/sdk";
|
|
47384
47521
|
if (Environment.isDevelopment()) {
|
|
47385
47522
|
installStructuredLogging();
|
|
47386
47523
|
}
|
|
@@ -47422,7 +47559,7 @@ export {
|
|
|
47422
47559
|
shutdownPromiseTracker,
|
|
47423
47560
|
trackPromise,
|
|
47424
47561
|
user,
|
|
47425
|
-
|
|
47562
|
+
z25 as z
|
|
47426
47563
|
};
|
|
47427
47564
|
/*! Bundled license information:
|
|
47428
47565
|
|