botinabox 2.9.2 → 2.9.3
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/bin/botinabox.mjs +1 -1
- package/dist/core/chat/chat-pipeline-v2.d.ts +1 -1
- package/dist/index.js +5 -5
- package/package.json +2 -2
- package/dist/channel-CVm1AWUF.d.ts +0 -82
- package/dist/channel-DziSPayj.d.ts +0 -73
- package/dist/chat-pipeline-BGgmH_ap.d.ts +0 -655
- package/dist/chat-pipeline-BWrtVqEP.d.ts +0 -652
- package/dist/chat-pipeline-aBSj7a4E.d.ts +0 -655
- package/dist/provider-BHkqkSdq.d.ts +0 -89
package/bin/botinabox.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
import('../dist/cli.js').then(m => m.main(process.argv.slice(2)));
|
|
@@ -122,7 +122,7 @@ export declare class ChatPipelineV2 {
|
|
|
122
122
|
*/
|
|
123
123
|
private think;
|
|
124
124
|
/**
|
|
125
|
-
* Build conversation history from
|
|
125
|
+
* Build conversation history from thread messages.
|
|
126
126
|
* Includes BOTH user and assistant messages (unlike v1 which excluded bot messages).
|
|
127
127
|
*/
|
|
128
128
|
private buildHistory;
|
package/dist/index.js
CHANGED
|
@@ -2178,7 +2178,7 @@ var ChatPipelineV2 = class {
|
|
|
2178
2178
|
if (this.messageFilter && !this.messageFilter(msg)) return;
|
|
2179
2179
|
if (await this.isDuplicate(msg)) return;
|
|
2180
2180
|
const channelId = msg.account ?? "";
|
|
2181
|
-
const threadTs =
|
|
2181
|
+
const threadTs = msg.threadId || channelId || msg.id;
|
|
2182
2182
|
if (threadTs && channelId) {
|
|
2183
2183
|
this.threadChannelMap.set(threadTs, channelId);
|
|
2184
2184
|
}
|
|
@@ -2186,7 +2186,7 @@ var ChatPipelineV2 = class {
|
|
|
2186
2186
|
const { messageId } = await this.messageStore.storeInbound(msgWithThread);
|
|
2187
2187
|
await this.hooks.emit("typing.start", { channel: this.channel, threadId: threadTs });
|
|
2188
2188
|
try {
|
|
2189
|
-
const history = await this.buildHistory(
|
|
2189
|
+
const history = await this.buildHistory(threadTs);
|
|
2190
2190
|
let systemPrompt = this.config.systemPrompt;
|
|
2191
2191
|
if (this.config.includeSystemContext !== false) {
|
|
2192
2192
|
const ctx2 = await buildSystemContext(this.db, this.config.systemContextOptions);
|
|
@@ -2333,10 +2333,10 @@ ${ctx2}`;
|
|
|
2333
2333
|
return { text: finalText, tasksDispatched };
|
|
2334
2334
|
}
|
|
2335
2335
|
/**
|
|
2336
|
-
* Build conversation history from
|
|
2336
|
+
* Build conversation history from thread messages.
|
|
2337
2337
|
* Includes BOTH user and assistant messages (unlike v1 which excluded bot messages).
|
|
2338
2338
|
*/
|
|
2339
|
-
async buildHistory(
|
|
2339
|
+
async buildHistory(threadTs) {
|
|
2340
2340
|
const maxMessages = this.config.history?.maxMessages ?? DEFAULT_MAX_MESSAGES;
|
|
2341
2341
|
const maxAgeDays = this.config.history?.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS;
|
|
2342
2342
|
const includeAssistant = this.config.history?.includeAssistant !== false;
|
|
@@ -2344,7 +2344,7 @@ ${ctx2}`;
|
|
|
2344
2344
|
let rows;
|
|
2345
2345
|
try {
|
|
2346
2346
|
rows = await this.db.query("messages", {
|
|
2347
|
-
where: {
|
|
2347
|
+
where: { thread_id: threadTs },
|
|
2348
2348
|
orderBy: "created_at",
|
|
2349
2349
|
orderDir: "desc",
|
|
2350
2350
|
limit: maxMessages
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botinabox",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.3",
|
|
4
4
|
"description": "Bot in a Box — framework for building multi-agent bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@types/uuid": "^10.0.0",
|
|
61
61
|
"ajv": "^8.17.1",
|
|
62
62
|
"cron-parser": "^4.9.0",
|
|
63
|
-
"latticesql": "^1.6.
|
|
63
|
+
"latticesql": "^1.6.10",
|
|
64
64
|
"uuid": "^13.0.0",
|
|
65
65
|
"yaml": "^2.7.0"
|
|
66
66
|
},
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { c as ContentBlock } from './provider-BHkqkSdq.js';
|
|
2
|
-
|
|
3
|
-
/** Channel adapter types — Story 1.5 / 4.1 */
|
|
4
|
-
|
|
5
|
-
type ChatType = "direct" | "group" | "channel";
|
|
6
|
-
type FormattingMode = "markdown" | "mrkdwn" | "html" | "plain";
|
|
7
|
-
interface ChannelCapabilities {
|
|
8
|
-
chatTypes: ChatType[];
|
|
9
|
-
threads: boolean;
|
|
10
|
-
reactions: boolean;
|
|
11
|
-
editing: boolean;
|
|
12
|
-
media: boolean;
|
|
13
|
-
polls: boolean;
|
|
14
|
-
maxTextLength: number;
|
|
15
|
-
formattingMode: FormattingMode;
|
|
16
|
-
}
|
|
17
|
-
interface ChannelMeta {
|
|
18
|
-
displayName: string;
|
|
19
|
-
icon?: string;
|
|
20
|
-
homepage?: string;
|
|
21
|
-
}
|
|
22
|
-
interface InboundMessage {
|
|
23
|
-
id: string;
|
|
24
|
-
channel: string;
|
|
25
|
-
account?: string;
|
|
26
|
-
from: string;
|
|
27
|
-
userId?: string;
|
|
28
|
-
body: string;
|
|
29
|
-
threadId?: string;
|
|
30
|
-
replyToId?: string;
|
|
31
|
-
attachments?: Attachment[];
|
|
32
|
-
/**
|
|
33
|
-
* Multimodal content blocks produced by attachment enrichers.
|
|
34
|
-
* When set, ChatPipeline builds a multimodal user message that passes
|
|
35
|
-
* these blocks through to the LLM provider alongside `body`.
|
|
36
|
-
*/
|
|
37
|
-
attachmentBlocks?: ContentBlock[];
|
|
38
|
-
receivedAt: string;
|
|
39
|
-
raw?: unknown;
|
|
40
|
-
}
|
|
41
|
-
type AttachmentMediaType = "image" | "video" | "audio" | "pdf" | "doc" | "excel" | "presentation" | "html" | "link" | "misc";
|
|
42
|
-
interface Attachment {
|
|
43
|
-
type: AttachmentMediaType;
|
|
44
|
-
url?: string;
|
|
45
|
-
mimeType?: string;
|
|
46
|
-
filename?: string;
|
|
47
|
-
size?: number;
|
|
48
|
-
}
|
|
49
|
-
interface OutboundPayload {
|
|
50
|
-
text: string;
|
|
51
|
-
threadId?: string;
|
|
52
|
-
replyToId?: string;
|
|
53
|
-
attachments?: Attachment[];
|
|
54
|
-
}
|
|
55
|
-
interface SendResult {
|
|
56
|
-
success: boolean;
|
|
57
|
-
messageId?: string;
|
|
58
|
-
error?: string;
|
|
59
|
-
}
|
|
60
|
-
interface HealthStatus {
|
|
61
|
-
ok: boolean;
|
|
62
|
-
latencyMs?: number;
|
|
63
|
-
error?: string;
|
|
64
|
-
}
|
|
65
|
-
type ChannelConfig = Record<string, unknown>;
|
|
66
|
-
interface ChannelAdapter {
|
|
67
|
-
/** Unique identifier for this adapter instance */
|
|
68
|
-
id: string;
|
|
69
|
-
meta: ChannelMeta;
|
|
70
|
-
capabilities: ChannelCapabilities;
|
|
71
|
-
connect(config: ChannelConfig): Promise<void>;
|
|
72
|
-
disconnect(): Promise<void>;
|
|
73
|
-
healthCheck(): Promise<HealthStatus>;
|
|
74
|
-
send(target: {
|
|
75
|
-
peerId: string;
|
|
76
|
-
threadId?: string;
|
|
77
|
-
}, payload: OutboundPayload): Promise<SendResult>;
|
|
78
|
-
/** Called when a message arrives — set by the framework */
|
|
79
|
-
onMessage?: (message: InboundMessage) => Promise<void>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type { Attachment as A, ChannelAdapter as C, FormattingMode as F, HealthStatus as H, InboundMessage as I, OutboundPayload as O, SendResult as S, AttachmentMediaType as a, ChannelCapabilities as b, ChannelConfig as c, ChannelMeta as d, ChatType as e };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/** Channel adapter types — Story 1.5 / 4.1 */
|
|
2
|
-
type ChatType = "direct" | "group" | "channel";
|
|
3
|
-
type FormattingMode = "markdown" | "mrkdwn" | "html" | "plain";
|
|
4
|
-
interface ChannelCapabilities {
|
|
5
|
-
chatTypes: ChatType[];
|
|
6
|
-
threads: boolean;
|
|
7
|
-
reactions: boolean;
|
|
8
|
-
editing: boolean;
|
|
9
|
-
media: boolean;
|
|
10
|
-
polls: boolean;
|
|
11
|
-
maxTextLength: number;
|
|
12
|
-
formattingMode: FormattingMode;
|
|
13
|
-
}
|
|
14
|
-
interface ChannelMeta {
|
|
15
|
-
displayName: string;
|
|
16
|
-
icon?: string;
|
|
17
|
-
homepage?: string;
|
|
18
|
-
}
|
|
19
|
-
interface InboundMessage {
|
|
20
|
-
id: string;
|
|
21
|
-
channel: string;
|
|
22
|
-
account?: string;
|
|
23
|
-
from: string;
|
|
24
|
-
userId?: string;
|
|
25
|
-
body: string;
|
|
26
|
-
threadId?: string;
|
|
27
|
-
replyToId?: string;
|
|
28
|
-
attachments?: Attachment[];
|
|
29
|
-
receivedAt: string;
|
|
30
|
-
raw?: unknown;
|
|
31
|
-
}
|
|
32
|
-
type AttachmentMediaType = "image" | "video" | "audio" | "pdf" | "doc" | "excel" | "presentation" | "html" | "link" | "misc";
|
|
33
|
-
interface Attachment {
|
|
34
|
-
type: AttachmentMediaType;
|
|
35
|
-
url?: string;
|
|
36
|
-
mimeType?: string;
|
|
37
|
-
filename?: string;
|
|
38
|
-
size?: number;
|
|
39
|
-
}
|
|
40
|
-
interface OutboundPayload {
|
|
41
|
-
text: string;
|
|
42
|
-
threadId?: string;
|
|
43
|
-
replyToId?: string;
|
|
44
|
-
attachments?: Attachment[];
|
|
45
|
-
}
|
|
46
|
-
interface SendResult {
|
|
47
|
-
success: boolean;
|
|
48
|
-
messageId?: string;
|
|
49
|
-
error?: string;
|
|
50
|
-
}
|
|
51
|
-
interface HealthStatus {
|
|
52
|
-
ok: boolean;
|
|
53
|
-
latencyMs?: number;
|
|
54
|
-
error?: string;
|
|
55
|
-
}
|
|
56
|
-
type ChannelConfig = Record<string, unknown>;
|
|
57
|
-
interface ChannelAdapter {
|
|
58
|
-
/** Unique identifier for this adapter instance */
|
|
59
|
-
id: string;
|
|
60
|
-
meta: ChannelMeta;
|
|
61
|
-
capabilities: ChannelCapabilities;
|
|
62
|
-
connect(config: ChannelConfig): Promise<void>;
|
|
63
|
-
disconnect(): Promise<void>;
|
|
64
|
-
healthCheck(): Promise<HealthStatus>;
|
|
65
|
-
send(target: {
|
|
66
|
-
peerId: string;
|
|
67
|
-
threadId?: string;
|
|
68
|
-
}, payload: OutboundPayload): Promise<SendResult>;
|
|
69
|
-
/** Called when a message arrives — set by the framework */
|
|
70
|
-
onMessage?: (message: InboundMessage) => Promise<void>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type { Attachment as A, ChannelAdapter as C, FormattingMode as F, HealthStatus as H, InboundMessage as I, OutboundPayload as O, SendResult as S, AttachmentMediaType as a, ChannelCapabilities as b, ChannelConfig as c, ChannelMeta as d, ChatType as e };
|