@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.
Files changed (73) hide show
  1. package/dist/index.js +1 -9
  2. package/index.ts +1 -9
  3. package/package.json +1 -1
  4. package/scripts/check-pack.mjs +0 -6
  5. package/scripts/selfcheck.mjs +0 -7
  6. package/src/channel.ts +79 -43
  7. package/src/core/accounts.ts +1 -6
  8. package/src/core/connection-reachability.ts +1 -5
  9. package/src/core/dead-letter-diagnostics.ts +4 -10
  10. package/src/core/outbox-entry-builders.ts +34 -18
  11. package/src/core/outbox-file-transfer-failure.ts +5 -0
  12. package/src/core/outbox-file-transfer-guards.ts +6 -0
  13. package/src/core/outbox-file-transfer-prep.ts +8 -5
  14. package/src/core/outbox-file-transfer-success.ts +5 -0
  15. package/src/core/outbox-queue.ts +1 -7
  16. package/src/core/outbox-summary.ts +15 -27
  17. package/src/core/outbox-text-push-prep.ts +1 -36
  18. package/src/core/permissions.ts +1 -9
  19. package/src/core/persisted-outbox-entry.ts +54 -11
  20. package/src/core/policy.ts +1 -11
  21. package/src/core/register-trace.ts +2 -5
  22. package/src/core/status-meta.ts +1 -9
  23. package/src/core/status.ts +1 -21
  24. package/src/core/targets.ts +52 -70
  25. package/src/core/types.ts +1 -17
  26. package/src/core/value-sanitize.ts +38 -1
  27. package/src/messaging/inbound/commands.ts +2 -24
  28. package/src/messaging/inbound/dispatch-prep.ts +1 -1
  29. package/src/messaging/inbound/gate.ts +2 -31
  30. package/src/messaging/inbound/group-history.ts +0 -75
  31. package/src/messaging/inbound/parse.ts +1 -31
  32. package/src/messaging/inbound/scene-admin.ts +8 -8
  33. package/src/messaging/outbound/diagnostics.ts +1 -6
  34. package/src/messaging/outbound/durable-queue-adapter.ts +17 -11
  35. package/src/messaging/outbound/marker-parser.ts +62 -28
  36. package/src/messaging/outbound/media-dedupe.ts +2 -6
  37. package/src/messaging/outbound/media.ts +1 -6
  38. package/src/messaging/outbound/normalize-outbound-send.ts +327 -0
  39. package/src/messaging/outbound/queue-selectors.ts +1 -5
  40. package/src/messaging/outbound/reply-enqueue.ts +121 -70
  41. package/src/messaging/outbound/session-route.ts +6 -11
  42. package/src/messaging/outbound/target-resolver.ts +1 -6
  43. package/src/openclaw/routing-runtime.ts +0 -11
  44. package/src/openclaw/sdk-helpers.ts +0 -2
  45. package/src/plugin/bridge-file-transfer-push-facade.ts +6 -6
  46. package/src/plugin/bridge-media-facade.ts +0 -1
  47. package/src/plugin/channel-components.ts +0 -13
  48. package/src/plugin/channel-plugin-surface-group.ts +52 -65
  49. package/src/plugin/channel-runtime-builders-delivery.ts +1 -0
  50. package/src/plugin/channel-runtime-types.ts +2 -24
  51. package/src/plugin/channel-send.ts +205 -221
  52. package/src/plugin/channel-utils.ts +8 -29
  53. package/src/plugin/connection-handlers-helpers.ts +0 -15
  54. package/src/plugin/connection-handlers.ts +6 -5
  55. package/src/plugin/file-inbound-abort.ts +5 -0
  56. package/src/plugin/file-inbound-chunk.ts +5 -0
  57. package/src/plugin/file-inbound-complete.ts +5 -0
  58. package/src/plugin/media-dedupe-runtime.ts +1 -6
  59. package/src/plugin/message-send.ts +7 -8
  60. package/src/plugin/outbound.ts +6 -26
  61. package/src/plugin/outbox-drain-loop.ts +2 -2
  62. package/src/plugin/outbox-file-push-flow.ts +7 -7
  63. package/src/plugin/outbox-text-push-flow.ts +1 -1
  64. package/src/plugin/target-runtime.ts +1 -6
  65. package/src/runtime/outbound-ack-timeout.ts +1 -8
  66. package/src/runtime/outbox-transitions.ts +1 -4
  67. package/src/runtime/status-worker.ts +1 -9
  68. package/src/messaging/outbound/build-send-action.ts +0 -130
  69. package/src/messaging/outbound/durable-message-adapter.ts +0 -121
  70. package/src/messaging/outbound/send-params.ts +0 -114
  71. package/src/messaging/outbound/send.ts +0 -127
  72. package/src/openclaw/ingress-runtime.ts +0 -25
  73. 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
- }