@xmoxmo/bncr 0.5.6 → 0.5.7
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/index.js +1 -9
- package/index.ts +1 -9
- package/package.json +1 -1
- package/scripts/check-pack.mjs +0 -6
- package/scripts/selfcheck.mjs +0 -7
- package/src/channel.ts +79 -43
- package/src/core/accounts.ts +1 -6
- package/src/core/connection-reachability.ts +1 -5
- package/src/core/dead-letter-diagnostics.ts +4 -10
- package/src/core/outbox-entry-builders.ts +34 -18
- package/src/core/outbox-file-transfer-failure.ts +5 -0
- package/src/core/outbox-file-transfer-guards.ts +6 -0
- package/src/core/outbox-file-transfer-prep.ts +8 -5
- package/src/core/outbox-file-transfer-success.ts +5 -0
- package/src/core/outbox-queue.ts +1 -7
- package/src/core/outbox-summary.ts +15 -27
- package/src/core/outbox-text-push-prep.ts +1 -36
- package/src/core/permissions.ts +1 -9
- package/src/core/persisted-outbox-entry.ts +54 -11
- package/src/core/policy.ts +1 -11
- package/src/core/register-trace.ts +2 -5
- package/src/core/status-meta.ts +1 -9
- package/src/core/status.ts +1 -21
- package/src/core/targets.ts +52 -70
- package/src/core/types.ts +1 -17
- package/src/core/value-sanitize.ts +38 -1
- package/src/messaging/inbound/commands.ts +2 -24
- package/src/messaging/inbound/dispatch-prep.ts +1 -1
- package/src/messaging/inbound/gate.ts +2 -31
- package/src/messaging/inbound/group-history.ts +0 -75
- package/src/messaging/inbound/parse.ts +1 -31
- package/src/messaging/inbound/scene-admin.ts +8 -8
- package/src/messaging/outbound/diagnostics.ts +1 -6
- package/src/messaging/outbound/durable-queue-adapter.ts +17 -11
- package/src/messaging/outbound/marker-parser.ts +62 -28
- package/src/messaging/outbound/media-dedupe.ts +2 -6
- package/src/messaging/outbound/media.ts +1 -6
- package/src/messaging/outbound/normalize-outbound-send.ts +327 -0
- package/src/messaging/outbound/queue-selectors.ts +1 -5
- package/src/messaging/outbound/reply-enqueue.ts +121 -70
- package/src/messaging/outbound/session-route.ts +6 -11
- package/src/messaging/outbound/target-resolver.ts +1 -6
- package/src/openclaw/routing-runtime.ts +0 -11
- package/src/openclaw/sdk-helpers.ts +0 -2
- package/src/plugin/bridge-file-transfer-push-facade.ts +6 -6
- package/src/plugin/bridge-media-facade.ts +0 -1
- package/src/plugin/channel-components.ts +0 -13
- package/src/plugin/channel-plugin-surface-group.ts +52 -65
- package/src/plugin/channel-runtime-builders-delivery.ts +1 -0
- package/src/plugin/channel-runtime-types.ts +2 -24
- package/src/plugin/channel-send.ts +205 -221
- package/src/plugin/channel-utils.ts +8 -29
- package/src/plugin/connection-handlers-helpers.ts +0 -15
- package/src/plugin/connection-handlers.ts +6 -5
- package/src/plugin/file-inbound-abort.ts +5 -0
- package/src/plugin/file-inbound-chunk.ts +5 -0
- package/src/plugin/file-inbound-complete.ts +5 -0
- package/src/plugin/media-dedupe-runtime.ts +1 -6
- package/src/plugin/message-send.ts +7 -8
- package/src/plugin/outbound.ts +6 -26
- package/src/plugin/outbox-drain-loop.ts +2 -2
- package/src/plugin/outbox-file-push-flow.ts +7 -7
- package/src/plugin/outbox-text-push-flow.ts +1 -1
- package/src/plugin/target-runtime.ts +1 -6
- package/src/runtime/outbound-ack-timeout.ts +1 -8
- package/src/runtime/outbox-transitions.ts +1 -4
- package/src/runtime/status-worker.ts +1 -9
- package/src/messaging/outbound/build-send-action.ts +0 -130
- package/src/messaging/outbound/durable-message-adapter.ts +0 -121
- package/src/messaging/outbound/send-params.ts +0 -114
- package/src/messaging/outbound/send.ts +0 -127
- package/src/openclaw/ingress-runtime.ts +0 -25
- package/src/plugin/channel-send-runtime-group.ts +0 -37
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { BncrRoute } from '../../core/types.ts';
|
|
2
|
-
|
|
3
|
-
function normalizeReplyKind(value: unknown): 'tool' | 'block' | 'final' | undefined {
|
|
4
|
-
return value === 'tool' || value === 'block' || value === 'final' ? value : undefined;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export async function sendBncrText(params: {
|
|
8
|
-
channelId: string;
|
|
9
|
-
extra?: Record<string, unknown>;
|
|
10
|
-
accountId: string;
|
|
11
|
-
to: string;
|
|
12
|
-
text: string;
|
|
13
|
-
kind?: string;
|
|
14
|
-
replyToId?: string;
|
|
15
|
-
mediaLocalRoots?: readonly string[];
|
|
16
|
-
resolveVerifiedTarget: (
|
|
17
|
-
to: string,
|
|
18
|
-
accountId: string,
|
|
19
|
-
) => { sessionKey: string; route: BncrRoute; displayScope: string };
|
|
20
|
-
rememberSessionRoute: (sessionKey: string, accountId: string, route: BncrRoute) => void;
|
|
21
|
-
enqueueFromReply: (args: {
|
|
22
|
-
accountId: string;
|
|
23
|
-
sessionKey: string;
|
|
24
|
-
route: BncrRoute;
|
|
25
|
-
payload: {
|
|
26
|
-
text?: string;
|
|
27
|
-
mediaUrl?: string;
|
|
28
|
-
mediaUrls?: string[];
|
|
29
|
-
kind?: 'tool' | 'block' | 'final';
|
|
30
|
-
extra?: Record<string, unknown>;
|
|
31
|
-
replyToId?: string;
|
|
32
|
-
};
|
|
33
|
-
mediaLocalRoots?: readonly string[];
|
|
34
|
-
}) => Promise<void>;
|
|
35
|
-
createMessageId: () => string;
|
|
36
|
-
}) {
|
|
37
|
-
const verified = params.resolveVerifiedTarget(params.to, params.accountId);
|
|
38
|
-
params.rememberSessionRoute(verified.sessionKey, params.accountId, verified.route);
|
|
39
|
-
|
|
40
|
-
await params.enqueueFromReply({
|
|
41
|
-
accountId: params.accountId,
|
|
42
|
-
sessionKey: verified.sessionKey,
|
|
43
|
-
route: verified.route,
|
|
44
|
-
payload: {
|
|
45
|
-
text: params.text,
|
|
46
|
-
kind: normalizeReplyKind(params.kind),
|
|
47
|
-
replyToId: params.replyToId,
|
|
48
|
-
extra: params.extra,
|
|
49
|
-
},
|
|
50
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
channel: params.channelId,
|
|
55
|
-
messageId: params.createMessageId(),
|
|
56
|
-
chatId: verified.sessionKey,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function sendBncrMedia(params: {
|
|
61
|
-
channelId: string;
|
|
62
|
-
accountId: string;
|
|
63
|
-
to: string;
|
|
64
|
-
text?: string;
|
|
65
|
-
mediaUrl?: string;
|
|
66
|
-
mediaUrls?: string[];
|
|
67
|
-
asVoice?: boolean;
|
|
68
|
-
audioAsVoice?: boolean;
|
|
69
|
-
type?: string;
|
|
70
|
-
downloadMedia?: boolean;
|
|
71
|
-
extra?: Record<string, unknown>;
|
|
72
|
-
kind?: string;
|
|
73
|
-
replyToId?: string;
|
|
74
|
-
mediaLocalRoots?: readonly string[];
|
|
75
|
-
resolveVerifiedTarget: (
|
|
76
|
-
to: string,
|
|
77
|
-
accountId: string,
|
|
78
|
-
) => { sessionKey: string; route: BncrRoute; displayScope: string };
|
|
79
|
-
rememberSessionRoute: (sessionKey: string, accountId: string, route: BncrRoute) => void;
|
|
80
|
-
enqueueFromReply: (args: {
|
|
81
|
-
accountId: string;
|
|
82
|
-
sessionKey: string;
|
|
83
|
-
route: BncrRoute;
|
|
84
|
-
payload: {
|
|
85
|
-
text?: string;
|
|
86
|
-
mediaUrl?: string;
|
|
87
|
-
mediaUrls?: string[];
|
|
88
|
-
asVoice?: boolean;
|
|
89
|
-
audioAsVoice?: boolean;
|
|
90
|
-
type?: string;
|
|
91
|
-
downloadMedia?: boolean;
|
|
92
|
-
extra?: Record<string, unknown>;
|
|
93
|
-
kind?: 'tool' | 'block' | 'final';
|
|
94
|
-
replyToId?: string;
|
|
95
|
-
};
|
|
96
|
-
mediaLocalRoots?: readonly string[];
|
|
97
|
-
}) => Promise<void>;
|
|
98
|
-
createMessageId: () => string;
|
|
99
|
-
}) {
|
|
100
|
-
const verified = params.resolveVerifiedTarget(params.to, params.accountId);
|
|
101
|
-
params.rememberSessionRoute(verified.sessionKey, params.accountId, verified.route);
|
|
102
|
-
|
|
103
|
-
await params.enqueueFromReply({
|
|
104
|
-
accountId: params.accountId,
|
|
105
|
-
sessionKey: verified.sessionKey,
|
|
106
|
-
route: verified.route,
|
|
107
|
-
payload: {
|
|
108
|
-
text: params.text || '',
|
|
109
|
-
mediaUrl: params.mediaUrl || '',
|
|
110
|
-
mediaUrls: params.mediaUrls?.length ? params.mediaUrls : undefined,
|
|
111
|
-
asVoice: params.asVoice === true ? true : undefined,
|
|
112
|
-
audioAsVoice: params.audioAsVoice === true ? true : undefined,
|
|
113
|
-
downloadMedia: params.downloadMedia === true ? true : undefined,
|
|
114
|
-
type: params.type,
|
|
115
|
-
extra: params.extra,
|
|
116
|
-
kind: normalizeReplyKind(params.kind),
|
|
117
|
-
replyToId: params.replyToId,
|
|
118
|
-
},
|
|
119
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
channel: params.channelId,
|
|
124
|
-
messageId: params.createMessageId(),
|
|
125
|
-
chatId: verified.sessionKey,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineStableChannelIngressIdentity as sdkDefineStableChannelIngressIdentity,
|
|
3
|
-
resolveChannelMessageIngress as sdkResolveChannelMessageIngress,
|
|
4
|
-
} from 'openclaw/plugin-sdk/channel-ingress-runtime';
|
|
5
|
-
|
|
6
|
-
type StableChannelIngressIdentityParams = Parameters<
|
|
7
|
-
typeof sdkDefineStableChannelIngressIdentity
|
|
8
|
-
>[0];
|
|
9
|
-
|
|
10
|
-
type ResolveChannelMessageIngressParams = Parameters<typeof sdkResolveChannelMessageIngress>[0];
|
|
11
|
-
type ResolveChannelMessageIngressResult = Awaited<
|
|
12
|
-
ReturnType<typeof sdkResolveChannelMessageIngress>
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export function defineOpenClawStableChannelIngressIdentity(
|
|
16
|
-
params: StableChannelIngressIdentityParams,
|
|
17
|
-
) {
|
|
18
|
-
return sdkDefineStableChannelIngressIdentity(params);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function resolveOpenClawChannelMessageIngress(
|
|
22
|
-
params: ResolveChannelMessageIngressParams,
|
|
23
|
-
): Promise<ResolveChannelMessageIngressResult> {
|
|
24
|
-
return sdkResolveChannelMessageIngress(params);
|
|
25
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { BncrRoute } from '../core/types.ts';
|
|
2
|
-
import { createBncrChannelSendRuntimeComponent } from './channel-components.ts';
|
|
3
|
-
|
|
4
|
-
export function createBncrChannelSendRuntimeGroup(runtime: {
|
|
5
|
-
channelId: string;
|
|
6
|
-
asString: (value: unknown, fallback?: string) => string;
|
|
7
|
-
syncDebugFlag: () => Promise<void>;
|
|
8
|
-
logInfo: (scope: string, message: string, options?: Record<string, unknown>) => void;
|
|
9
|
-
resolveVerifiedTarget: (
|
|
10
|
-
to: string,
|
|
11
|
-
accountId: string,
|
|
12
|
-
) => {
|
|
13
|
-
sessionKey: string;
|
|
14
|
-
route: BncrRoute;
|
|
15
|
-
displayScope: string;
|
|
16
|
-
};
|
|
17
|
-
rememberSessionRoute: (sessionKey: string, accountId: string, route: BncrRoute) => void;
|
|
18
|
-
enqueueFromReply: Parameters<typeof createBncrChannelSendRuntimeComponent>[0]['enqueueFromReply'];
|
|
19
|
-
listOutboxEntries: Parameters<
|
|
20
|
-
typeof createBncrChannelSendRuntimeComponent
|
|
21
|
-
>[0]['listOutboxEntries'];
|
|
22
|
-
}) {
|
|
23
|
-
const channelSendRuntime = createBncrChannelSendRuntimeComponent({
|
|
24
|
-
channelId: runtime.channelId,
|
|
25
|
-
asString: runtime.asString,
|
|
26
|
-
syncDebugFlag: runtime.syncDebugFlag,
|
|
27
|
-
logInfo: runtime.logInfo,
|
|
28
|
-
resolveVerifiedTarget: runtime.resolveVerifiedTarget,
|
|
29
|
-
rememberSessionRoute: runtime.rememberSessionRoute,
|
|
30
|
-
enqueueFromReply: runtime.enqueueFromReply,
|
|
31
|
-
listOutboxEntries: runtime.listOutboxEntries,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
channelSendRuntime,
|
|
36
|
-
};
|
|
37
|
-
}
|