@botpress/runtime 1.7.3 → 1.7.5
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 +8 -4
- package/dist/definition.js.map +3 -3
- package/dist/internal.js +6 -2
- package/dist/internal.js.map +3 -3
- package/dist/library.d.ts +2 -0
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +8 -2
- package/dist/library.js.map +3 -3
- package/dist/runtime/autonomous.d.ts +3 -1
- package/dist/runtime/autonomous.d.ts.map +1 -1
- package/dist/runtime/chat/chat.d.ts +43 -163
- package/dist/runtime/chat/chat.d.ts.map +1 -1
- package/dist/runtime.js +93 -18
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExecutionProps as LlmzExecutionProps } from 'llmz/dist/llmz';
|
|
2
2
|
import { type Chat as LlmzChat, type ValueOrGetter, type Context as LlmzContext } from 'llmz';
|
|
3
|
-
import { Iteration as LlmzIteration, Tool as LlmzTool, Traces as _Traces, ThinkSignal as _ThinkSignal, SnapshotSignal as _SnapshotSignal, Citation as _Citation, CitationsManager as _CitationsManager } from 'llmz';
|
|
3
|
+
import { Iteration as LlmzIteration, Tool as LlmzTool, Traces as _Traces, ThinkSignal as _ThinkSignal, SnapshotSignal as _SnapshotSignal, Citation as _Citation, CitationsManager as _CitationsManager, Component as LlmzComponent } from 'llmz';
|
|
4
4
|
import { Exit as LlmzExit, type ExitResult as LlmzExitResult } from 'llmz';
|
|
5
5
|
import { ObjectInstance as LlmzObject } from 'llmz';
|
|
6
6
|
import { CognitiveBeta } from '@botpress/cognitive';
|
|
@@ -19,6 +19,8 @@ export declare namespace Autonomous {
|
|
|
19
19
|
type IterationController = Parameters<NonNullable<LlmzExecutionProps['onIterationEnd']>>[1];
|
|
20
20
|
const Tool: typeof LlmzTool;
|
|
21
21
|
type Tool = InstanceType<typeof Tool>;
|
|
22
|
+
const Component: typeof LlmzComponent;
|
|
23
|
+
type Component = InstanceType<typeof Component>;
|
|
22
24
|
const Exit: typeof LlmzExit;
|
|
23
25
|
const Object: typeof LlmzObject;
|
|
24
26
|
type Citation = _Citation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autonomous.d.ts","sourceRoot":"","sources":["../../src/runtime/autonomous.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAE1E,OAAO,EAAY,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAA;AACvG,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,OAAO,EACjB,WAAW,IAAI,YAAY,EAC3B,cAAc,IAAI,eAAe,EACjC,QAAQ,IAAI,SAAS,EACrB,gBAAgB,IAAI,iBAAiB,
|
|
1
|
+
{"version":3,"file":"autonomous.d.ts","sourceRoot":"","sources":["../../src/runtime/autonomous.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAE1E,OAAO,EAAY,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAA;AACvG,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,OAAO,EACjB,WAAW,IAAI,YAAY,EAC3B,cAAc,IAAI,eAAe,EACjC,QAAQ,IAAI,SAAS,EACrB,gBAAgB,IAAI,iBAAiB,EAIrC,SAAS,IAAI,aAAa,EAC3B,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,UAAU,IAAI,cAAc,EAAE,MAAM,MAAM,CAAA;AAC1E,OAAO,EAAE,cA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1,18 @@
|
|
|
1
|
-
import { Chat, RenderedComponent } from 'llmz';
|
|
1
|
+
import { Chat, DefaultComponents, RenderedComponent } from 'llmz';
|
|
2
2
|
import { TranscriptItem } from './transcript';
|
|
3
3
|
import { AnyIncomingEvent, AnyIncomingMessage } from '@botpress/sdk/dist/bot';
|
|
4
4
|
import { BotContext } from '../context/context';
|
|
5
|
-
type Msg = {
|
|
5
|
+
export type Msg = {
|
|
6
6
|
type: string;
|
|
7
7
|
payload: Record<string, any>;
|
|
8
8
|
tags?: Record<string, any>;
|
|
9
9
|
};
|
|
10
|
+
export type Component = (typeof DefaultComponents)[keyof typeof DefaultComponents];
|
|
11
|
+
export type ComponentHandler = (message: RenderedComponent) => Promise<void> | void;
|
|
12
|
+
export type ComponentRegistration = {
|
|
13
|
+
component: Component;
|
|
14
|
+
handler?: ComponentHandler;
|
|
15
|
+
};
|
|
10
16
|
export declare class BotpressChat extends Chat {
|
|
11
17
|
private _transcript;
|
|
12
18
|
private client;
|
|
@@ -14,169 +20,44 @@ export declare class BotpressChat extends Chat {
|
|
|
14
20
|
private botId;
|
|
15
21
|
private logger;
|
|
16
22
|
private citations;
|
|
23
|
+
private componentRegistry;
|
|
17
24
|
constructor(context: BotContext);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type: "leaf";
|
|
34
|
-
name: string;
|
|
35
|
-
description: string;
|
|
36
|
-
aliases: never[];
|
|
37
|
-
examples: {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
code: string;
|
|
41
|
-
}[];
|
|
42
|
-
leaf: {
|
|
43
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
44
|
-
url: import("@bpinternal/zui").ZodString;
|
|
45
|
-
alt: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
46
|
-
}, "strip", {
|
|
47
|
-
url: string;
|
|
48
|
-
alt?: string | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
url: string;
|
|
51
|
-
alt?: string | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
};
|
|
54
|
-
}> | import("llmz").Component<{
|
|
55
|
-
type: "leaf";
|
|
56
|
-
name: string;
|
|
57
|
-
description: string;
|
|
58
|
-
aliases: never[];
|
|
59
|
-
examples: {
|
|
60
|
-
name: string;
|
|
61
|
-
description: string;
|
|
62
|
-
code: string;
|
|
63
|
-
}[];
|
|
64
|
-
leaf: {
|
|
65
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
66
|
-
url: import("@bpinternal/zui").ZodString;
|
|
67
|
-
name: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
68
|
-
}, "strip", {
|
|
69
|
-
url: string;
|
|
70
|
-
name?: string | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
url: string;
|
|
73
|
-
name?: string | undefined;
|
|
74
|
-
}>;
|
|
75
|
-
};
|
|
76
|
-
}> | import("llmz").Component<{
|
|
77
|
-
type: "leaf";
|
|
78
|
-
name: string;
|
|
79
|
-
description: string;
|
|
80
|
-
aliases: never[];
|
|
81
|
-
examples: {
|
|
82
|
-
name: string;
|
|
83
|
-
description: string;
|
|
84
|
-
code: string;
|
|
85
|
-
}[];
|
|
86
|
-
leaf: {
|
|
87
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
88
|
-
url: import("@bpinternal/zui").ZodString;
|
|
89
|
-
title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
90
|
-
}, "strip", {
|
|
91
|
-
url: string;
|
|
92
|
-
title?: string | undefined;
|
|
93
|
-
}, {
|
|
94
|
-
url: string;
|
|
95
|
-
title?: string | undefined;
|
|
96
|
-
}>;
|
|
97
|
-
};
|
|
98
|
-
}> | import("llmz").Component<{
|
|
99
|
-
type: "container";
|
|
100
|
-
name: string;
|
|
101
|
-
description: string;
|
|
102
|
-
aliases: never[];
|
|
103
|
-
examples: {
|
|
104
|
-
name: string;
|
|
105
|
-
description: string;
|
|
106
|
-
code: string;
|
|
107
|
-
}[];
|
|
108
|
-
container: {
|
|
109
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
110
|
-
title: import("@bpinternal/zui").ZodString;
|
|
111
|
-
subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
112
|
-
}, "strip", {
|
|
113
|
-
title: string;
|
|
114
|
-
subtitle?: string | undefined;
|
|
115
|
-
}, {
|
|
116
|
-
title: string;
|
|
117
|
-
subtitle?: string | undefined;
|
|
118
|
-
}>;
|
|
119
|
-
children: ({
|
|
120
|
-
description: string;
|
|
121
|
-
component: {
|
|
122
|
-
type: "leaf";
|
|
123
|
-
name: string;
|
|
124
|
-
description: string;
|
|
125
|
-
aliases: never[];
|
|
126
|
-
examples: {
|
|
127
|
-
name: string;
|
|
128
|
-
description: string;
|
|
129
|
-
code: string;
|
|
130
|
-
}[];
|
|
131
|
-
leaf: {
|
|
132
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
133
|
-
url: import("@bpinternal/zui").ZodString;
|
|
134
|
-
alt: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
135
|
-
}, "strip", {
|
|
136
|
-
url: string;
|
|
137
|
-
alt?: string | undefined;
|
|
138
|
-
}, {
|
|
139
|
-
url: string;
|
|
140
|
-
alt?: string | undefined;
|
|
141
|
-
}>;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
} | {
|
|
145
|
-
description: string;
|
|
146
|
-
component: {
|
|
147
|
-
type: "leaf";
|
|
148
|
-
description: string;
|
|
149
|
-
name: string;
|
|
150
|
-
aliases: string[];
|
|
151
|
-
examples: {
|
|
152
|
-
name: string;
|
|
153
|
-
description: string;
|
|
154
|
-
code: string;
|
|
155
|
-
}[];
|
|
156
|
-
leaf: {
|
|
157
|
-
props: import("@bpinternal/zui").ZodObject<{
|
|
158
|
-
action: import("@bpinternal/zui").ZodDefault<import("@bpinternal/zui").ZodEnum<["say", "url", "postback"]>>;
|
|
159
|
-
label: import("@bpinternal/zui").ZodString;
|
|
160
|
-
value: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
161
|
-
url: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
162
|
-
}, "strip", {
|
|
163
|
-
label: string;
|
|
164
|
-
action: "say" | "url" | "postback";
|
|
165
|
-
value?: string | undefined;
|
|
166
|
-
url?: string | undefined;
|
|
167
|
-
}, {
|
|
168
|
-
label: string;
|
|
169
|
-
value?: string | undefined;
|
|
170
|
-
action?: "say" | "url" | "postback" | undefined;
|
|
171
|
-
url?: string | undefined;
|
|
172
|
-
}>;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
})[];
|
|
176
|
-
};
|
|
177
|
-
}>)[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Register a component with an optional handler
|
|
27
|
+
*/
|
|
28
|
+
registerComponent(registration: ComponentRegistration): this;
|
|
29
|
+
/**
|
|
30
|
+
* Remove a component by name
|
|
31
|
+
*/
|
|
32
|
+
removeComponent(name: string): this;
|
|
33
|
+
/**
|
|
34
|
+
* Get all registered components
|
|
35
|
+
*/
|
|
36
|
+
getComponents(): Promise<Component[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Clear the entire transcript
|
|
39
|
+
*/
|
|
178
40
|
clearTranscript(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Prepend items to the transcript
|
|
43
|
+
*/
|
|
179
44
|
prependToTranscript(items: TranscriptItem[]): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Remove a message from the transcript by ID
|
|
47
|
+
*/
|
|
48
|
+
removeMessage(messageId: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Remove messages from the transcript by predicate
|
|
51
|
+
*/
|
|
52
|
+
removeMessages(predicate: (item: TranscriptItem) => boolean): Promise<number>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a copy of the current transcript
|
|
55
|
+
*/
|
|
56
|
+
getTranscript(): Promise<TranscriptItem[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Replace the entire transcript
|
|
59
|
+
*/
|
|
60
|
+
setTranscript(items: TranscriptItem[]): Promise<void>;
|
|
180
61
|
fetchTranscript(): Promise<TranscriptItem[]>;
|
|
181
62
|
compactTranscript(): Promise<void>;
|
|
182
63
|
saveTranscript(): Promise<void>;
|
|
@@ -196,5 +77,4 @@ export declare class BotpressChat extends Chat {
|
|
|
196
77
|
}): Promise<void>;
|
|
197
78
|
addMessage(message: AnyIncomingMessage<any>): Promise<void>;
|
|
198
79
|
}
|
|
199
|
-
export {};
|
|
200
80
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/runtime/chat/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/runtime/chat/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAkB,iBAAiB,EAAc,MAAM,MAAM,CAAA;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAS7E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,MAAM,MAAM,GAAG,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC3B,CAAA;AAED,M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,EAAE,GAAG;IAsCxB,MAAM,CAAC,OAAO,EAAE,iBAAiB;IAmEvC;;;;OAIG;IACG,6BAA6B,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IA6BjG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAgBrG,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC;CAuClD"}
|
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.7.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.7.5", adk: "1.7.2", sdk: "4.18.1", llmz: "0.0.27", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -39542,7 +39542,8 @@ import {
|
|
|
39542
39542
|
CitationsManager as _CitationsManager,
|
|
39543
39543
|
ListenExit as _ListenExit,
|
|
39544
39544
|
ThinkExit as _ThinkExit,
|
|
39545
|
-
DefaultExit as _DefaultExit
|
|
39545
|
+
DefaultExit as _DefaultExit,
|
|
39546
|
+
Component as LlmzComponent
|
|
39546
39547
|
} from "llmz";
|
|
39547
39548
|
import { Exit as LlmzExit } from "llmz";
|
|
39548
39549
|
import { ObjectInstance as LlmzObject } from "llmz";
|
|
@@ -39650,6 +39651,7 @@ import { AsyncResource } from "node:async_hooks";
|
|
|
39650
39651
|
var Autonomous;
|
|
39651
39652
|
((Autonomous2) => {
|
|
39652
39653
|
Autonomous2.Tool = LlmzTool;
|
|
39654
|
+
Autonomous2.Component = LlmzComponent;
|
|
39653
39655
|
Autonomous2.Exit = LlmzExit;
|
|
39654
39656
|
Autonomous2.Object = LlmzObject;
|
|
39655
39657
|
Autonomous2.ThinkSignal = _ThinkSignal;
|
|
@@ -40349,6 +40351,8 @@ ${issues.join("\n")}`;
|
|
|
40349
40351
|
init_define_BUILD();
|
|
40350
40352
|
init_define_PACKAGE_VERSIONS();
|
|
40351
40353
|
import { z as z14 } from "@botpress/sdk";
|
|
40354
|
+
import { Cognitive as Cognitive2 } from "@botpress/cognitive";
|
|
40355
|
+
import { Zai } from "@botpress/zai";
|
|
40352
40356
|
|
|
40353
40357
|
// src/primitives/index.ts
|
|
40354
40358
|
init_define_BUILD();
|
|
@@ -44484,7 +44488,7 @@ var BuiltInWorkflows = {
|
|
|
44484
44488
|
};
|
|
44485
44489
|
|
|
44486
44490
|
// src/runtime/adk.ts
|
|
44487
|
-
import { Zai } from "@botpress/zai";
|
|
44491
|
+
import { Zai as Zai2 } from "@botpress/zai";
|
|
44488
44492
|
|
|
44489
44493
|
// src/runtime/actions/index.ts
|
|
44490
44494
|
init_define_BUILD();
|
|
@@ -44671,7 +44675,7 @@ var adk = {
|
|
|
44671
44675
|
return Environment;
|
|
44672
44676
|
},
|
|
44673
44677
|
get zai() {
|
|
44674
|
-
return new
|
|
44678
|
+
return new Zai2({
|
|
44675
44679
|
client: context2.get("cognitive"),
|
|
44676
44680
|
modelId: Array.isArray(adk.project.config.defaultModels.zai) ? adk.project.config.defaultModels.zai[0] ?? "auto" : adk.project.config.defaultModels.zai
|
|
44677
44681
|
});
|
|
@@ -45899,6 +45903,7 @@ var BotpressChat = class extends Chat {
|
|
|
45899
45903
|
botId;
|
|
45900
45904
|
logger;
|
|
45901
45905
|
citations;
|
|
45906
|
+
componentRegistry = /* @__PURE__ */ new Map();
|
|
45902
45907
|
constructor(context3) {
|
|
45903
45908
|
super({
|
|
45904
45909
|
components: async () => this.getComponents(),
|
|
@@ -45910,26 +45915,86 @@ var BotpressChat = class extends Chat {
|
|
|
45910
45915
|
this.botId = context3.botId;
|
|
45911
45916
|
this.logger = context3.logger;
|
|
45912
45917
|
this.citations = context3.citations;
|
|
45918
|
+
this.registerComponent({ component: DefaultComponents.Text });
|
|
45919
|
+
this.registerComponent({ component: DefaultComponents.Image });
|
|
45920
|
+
this.registerComponent({ component: DefaultComponents.File });
|
|
45921
|
+
this.registerComponent({ component: DefaultComponents.Audio });
|
|
45922
|
+
this.registerComponent({ component: DefaultComponents.Video });
|
|
45923
|
+
this.registerComponent({ component: DefaultComponents.Card });
|
|
45924
|
+
}
|
|
45925
|
+
/**
|
|
45926
|
+
* Register a component with an optional handler
|
|
45927
|
+
*/
|
|
45928
|
+
registerComponent(registration) {
|
|
45929
|
+
const componentName = registration.component.definition.name.toLowerCase();
|
|
45930
|
+
this.componentRegistry.set(componentName, registration);
|
|
45931
|
+
return this;
|
|
45913
45932
|
}
|
|
45933
|
+
/**
|
|
45934
|
+
* Remove a component by name
|
|
45935
|
+
*/
|
|
45936
|
+
removeComponent(name) {
|
|
45937
|
+
this.componentRegistry.delete(name.toLowerCase());
|
|
45938
|
+
return this;
|
|
45939
|
+
}
|
|
45940
|
+
/**
|
|
45941
|
+
* Get all registered components
|
|
45942
|
+
*/
|
|
45914
45943
|
async getComponents() {
|
|
45915
|
-
return
|
|
45916
|
-
DefaultComponents.Text,
|
|
45917
|
-
DefaultComponents.Image,
|
|
45918
|
-
DefaultComponents.File,
|
|
45919
|
-
DefaultComponents.Audio,
|
|
45920
|
-
DefaultComponents.Video,
|
|
45921
|
-
DefaultComponents.Card
|
|
45922
|
-
];
|
|
45944
|
+
return Array.from(this.componentRegistry.values()).map((reg) => reg.component);
|
|
45923
45945
|
}
|
|
45946
|
+
/**
|
|
45947
|
+
* Clear the entire transcript
|
|
45948
|
+
*/
|
|
45924
45949
|
async clearTranscript() {
|
|
45925
45950
|
this._transcript = [];
|
|
45926
45951
|
}
|
|
45952
|
+
/**
|
|
45953
|
+
* Prepend items to the transcript
|
|
45954
|
+
*/
|
|
45927
45955
|
async prependToTranscript(items) {
|
|
45928
45956
|
if (!this._transcript) {
|
|
45929
45957
|
await this.fetchTranscript();
|
|
45930
45958
|
}
|
|
45931
45959
|
this._transcript = [...items, ...this._transcript];
|
|
45932
45960
|
}
|
|
45961
|
+
/**
|
|
45962
|
+
* Remove a message from the transcript by ID
|
|
45963
|
+
*/
|
|
45964
|
+
async removeMessage(messageId) {
|
|
45965
|
+
if (!this._transcript) {
|
|
45966
|
+
await this.fetchTranscript();
|
|
45967
|
+
}
|
|
45968
|
+
const initialLength = this._transcript.length;
|
|
45969
|
+
this._transcript = this._transcript.filter((item) => item.id !== messageId);
|
|
45970
|
+
return this._transcript.length < initialLength;
|
|
45971
|
+
}
|
|
45972
|
+
/**
|
|
45973
|
+
* Remove messages from the transcript by predicate
|
|
45974
|
+
*/
|
|
45975
|
+
async removeMessages(predicate) {
|
|
45976
|
+
if (!this._transcript) {
|
|
45977
|
+
await this.fetchTranscript();
|
|
45978
|
+
}
|
|
45979
|
+
const initialLength = this._transcript.length;
|
|
45980
|
+
this._transcript = this._transcript.filter((item) => !predicate(item));
|
|
45981
|
+
return initialLength - this._transcript.length;
|
|
45982
|
+
}
|
|
45983
|
+
/**
|
|
45984
|
+
* Get a copy of the current transcript
|
|
45985
|
+
*/
|
|
45986
|
+
async getTranscript() {
|
|
45987
|
+
if (!this._transcript) {
|
|
45988
|
+
await this.fetchTranscript();
|
|
45989
|
+
}
|
|
45990
|
+
return [...this._transcript];
|
|
45991
|
+
}
|
|
45992
|
+
/**
|
|
45993
|
+
* Replace the entire transcript
|
|
45994
|
+
*/
|
|
45995
|
+
async setTranscript(items) {
|
|
45996
|
+
this._transcript = [...items];
|
|
45997
|
+
}
|
|
45933
45998
|
async fetchTranscript() {
|
|
45934
45999
|
if (this._transcript) return this._transcript;
|
|
45935
46000
|
return await span(
|
|
@@ -46083,15 +46148,25 @@ var BotpressChat = class extends Chat {
|
|
|
46083
46148
|
}
|
|
46084
46149
|
return;
|
|
46085
46150
|
}
|
|
46086
|
-
const
|
|
46087
|
-
|
|
46088
|
-
|
|
46089
|
-
|
|
46090
|
-
|
|
46151
|
+
const registration = this.componentRegistry.get(message.type.toLowerCase());
|
|
46152
|
+
let componentRegistration = registration;
|
|
46153
|
+
if (!componentRegistration) {
|
|
46154
|
+
for (const [_2, reg] of this.componentRegistry) {
|
|
46155
|
+
if (reg.component.definition.aliases?.map((x) => x.toLowerCase()).includes(message.type.toLowerCase())) {
|
|
46156
|
+
componentRegistration = reg;
|
|
46157
|
+
break;
|
|
46158
|
+
}
|
|
46159
|
+
}
|
|
46160
|
+
}
|
|
46161
|
+
if (!componentRegistration) {
|
|
46091
46162
|
throw new Error(`Could not find component for message type "${message.type}"`);
|
|
46092
46163
|
}
|
|
46164
|
+
if (componentRegistration.handler) {
|
|
46165
|
+
await componentRegistration.handler(message);
|
|
46166
|
+
return;
|
|
46167
|
+
}
|
|
46093
46168
|
await this.sendMessage({
|
|
46094
|
-
type: component.definition.name,
|
|
46169
|
+
type: componentRegistration.component.definition.name,
|
|
46095
46170
|
payload: message.props
|
|
46096
46171
|
});
|
|
46097
46172
|
}
|