@xmoxmo/bncr 0.6.1 → 0.6.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/README.md +65 -1
- package/package.json +1 -1
- package/scripts/check-pack.mjs +4 -1
- package/scripts/selfcheck.mjs +4 -1
- package/src/channel.ts +144 -5
- package/src/messaging/inbound/commands.ts +62 -26
- package/src/messaging/inbound/context-facts.ts +88 -58
- package/src/messaging/inbound/conversation-history-serial.ts +258 -0
- package/src/messaging/inbound/conversation-history.ts +450 -0
- package/src/messaging/inbound/dispatch.ts +568 -123
- package/src/messaging/inbound/history-shard-worker.ts +180 -0
- package/src/messaging/inbound/native-command.ts +89 -33
- package/src/messaging/inbound/outbound-replay-cache.ts +202 -17
- package/src/messaging/inbound/reply-dispatch.ts +7 -6
- package/src/messaging/inbound/scene-admin.ts +40 -20
- package/src/messaging/inbound/turn-context.ts +101 -37
- package/src/plugin/bridge-lifecycle.ts +8 -0
- package/src/plugin/bridge-outbox-facade.ts +15 -1
- package/src/plugin/channel-components.ts +5 -5
- package/src/plugin/channel-runtime-builders-delivery.ts +2 -2
- package/src/plugin/channel-runtime-constants.ts +2 -0
- package/src/plugin/channel-runtime-types.ts +9 -7
- package/src/plugin/inbound-acceptance.ts +9 -24
- package/src/plugin/inbound-handlers.ts +4 -4
- package/src/plugin/inbound-surface-handlers-group.ts +4 -2
- package/src/plugin/outbox-drain-post-push.ts +3 -0
- package/src/plugin/scene-registry.ts +4 -4
- package/src/plugin/sqlite-state.ts +2109 -0
- package/src/plugin/state-store.ts +731 -69
- package/src/plugin/state-transient-runtime-group.ts +17 -3
- package/src/messaging/inbound/group-history.ts +0 -264
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GatewayRequestHandlerOptions } from 'openclaw/plugin-sdk/core';
|
|
2
2
|
import { buildCanonicalBncrSessionKey } from '../core/targets.ts';
|
|
3
3
|
import type { BncrConnection, BncrRoute } from '../core/types.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { BncrConversationHistoryMap } from '../messaging/inbound/conversation-history.ts';
|
|
5
5
|
import type { BncrOutboundReplayCache } from '../messaging/inbound/outbound-replay-cache.ts';
|
|
6
6
|
import type { parseBncrInboundParams } from '../messaging/inbound/parse.ts';
|
|
7
7
|
import type { ReplyPayloadInput } from '../messaging/outbound/reply-enqueue.ts';
|
|
@@ -134,7 +134,7 @@ export type BncrInboundHandlersRuntime = {
|
|
|
134
134
|
}) => string;
|
|
135
135
|
defaultPublicAgentId: () => string;
|
|
136
136
|
sceneRegistry: Map<string, BncrSceneRecord>;
|
|
137
|
-
|
|
137
|
+
conversationHistories: BncrConversationHistoryMap;
|
|
138
138
|
outboundReplayCache: BncrOutboundReplayCache;
|
|
139
139
|
prepareInboundAcceptance: (args: {
|
|
140
140
|
parsed: ParsedInboundParams;
|
|
@@ -165,7 +165,7 @@ export type BncrInboundHandlersRuntime = {
|
|
|
165
165
|
shouldDispatch: boolean;
|
|
166
166
|
shouldAccumulate: boolean;
|
|
167
167
|
sceneRegistry: Map<string, BncrSceneRecord>;
|
|
168
|
-
|
|
168
|
+
conversationHistories: BncrConversationHistoryMap;
|
|
169
169
|
outboundReplayCache: BncrOutboundReplayCache;
|
|
170
170
|
defaultAdminAgentId: string;
|
|
171
171
|
defaultPublicAgentId: string;
|
|
@@ -335,7 +335,7 @@ export function createBncrInboundHandlers(runtime: Omit<BncrInboundHandlersRunti
|
|
|
335
335
|
shouldDispatch,
|
|
336
336
|
shouldAccumulate,
|
|
337
337
|
sceneRegistry: runtime.sceneRegistry,
|
|
338
|
-
|
|
338
|
+
conversationHistories: runtime.conversationHistories,
|
|
339
339
|
outboundReplayCache: runtime.outboundReplayCache,
|
|
340
340
|
defaultAdminAgentId,
|
|
341
341
|
defaultPublicAgentId: runtime.defaultPublicAgentId(),
|
|
@@ -86,7 +86,9 @@ export function createBncrInboundSurfaceHandlersGroup(runtime: {
|
|
|
86
86
|
typeof createBncrInboundHandlersComponent
|
|
87
87
|
>[0]['defaultPublicAgentId'];
|
|
88
88
|
sceneRegistry: Parameters<typeof createBncrInboundHandlersComponent>[0]['sceneRegistry'];
|
|
89
|
-
|
|
89
|
+
conversationHistories: Parameters<
|
|
90
|
+
typeof createBncrInboundHandlersComponent
|
|
91
|
+
>[0]['conversationHistories'];
|
|
90
92
|
outboundReplayCache: BncrOutboundReplayCache;
|
|
91
93
|
prepareInboundAcceptance: Parameters<
|
|
92
94
|
typeof createBncrInboundHandlersComponent
|
|
@@ -153,7 +155,7 @@ export function createBncrInboundSurfaceHandlersGroup(runtime: {
|
|
|
153
155
|
defaultAdminAgentId: runtime.defaultAdminAgentId,
|
|
154
156
|
defaultPublicAgentId: runtime.defaultPublicAgentId,
|
|
155
157
|
sceneRegistry: runtime.sceneRegistry,
|
|
156
|
-
|
|
158
|
+
conversationHistories: runtime.conversationHistories,
|
|
157
159
|
outboundReplayCache: runtime.outboundReplayCache,
|
|
158
160
|
prepareInboundAcceptance: runtime.prepareInboundAcceptance,
|
|
159
161
|
logInboundSummary: runtime.logInboundSummary,
|
|
@@ -95,6 +95,9 @@ export function createBncrOutboxDrainPostPush(runtime: BncrOutboxDrainPostPushRu
|
|
|
95
95
|
ackTimeoutMs,
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
+
if (!requireAck && onlineNow) {
|
|
99
|
+
runtime.outbox.delete(entry.messageId);
|
|
100
|
+
}
|
|
98
101
|
if (!runtime.outbox.has(entry.messageId)) {
|
|
99
102
|
await runtime.sleepMs(runtime.pushDrainIntervalMs);
|
|
100
103
|
return { action: 'continue', localNextDelay };
|
|
@@ -56,8 +56,8 @@ function buildSceneRecord(args: {
|
|
|
56
56
|
...(kind === 'group' && parsed.groupName ? { groupName: parsed.groupName } : {}),
|
|
57
57
|
...(agentId ? { agentId } : {}),
|
|
58
58
|
...(kind === 'group' ? { groupReplyMode: defaultGroupReplyMode(kind) } : {}),
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
historyLimit: 50,
|
|
60
|
+
historyForce: true,
|
|
61
61
|
lastSeenAt,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -90,8 +90,8 @@ export function decideSceneAdmission(args: {
|
|
|
90
90
|
...(kind === 'group' && !existing.groupReplyMode
|
|
91
91
|
? { groupReplyMode: defaultGroupReplyMode(kind) }
|
|
92
92
|
: {}),
|
|
93
|
-
...(
|
|
94
|
-
...(
|
|
93
|
+
...(existing.historyLimit === undefined ? { historyLimit: 50 } : {}),
|
|
94
|
+
...(existing.historyForce === undefined ? { historyForce: true } : {}),
|
|
95
95
|
lastSeenAt: now,
|
|
96
96
|
} satisfies BncrSceneRecord;
|
|
97
97
|
|