@xmoxmo/bncr 0.0.9 → 0.1.0

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 CHANGED
@@ -164,7 +164,7 @@ npm pack
164
164
  - 测试通过
165
165
  - 自检通过
166
166
  - 可以正常打包
167
- - 本地版本号与 npm / 发布目标一致
167
+ - 本地版本号与 npm / 发布目标一致(版本号修改应优先在工作仓完成,再同步到发布仓)
168
168
  - 运行态 `linked / pending / deadLetter` 正常
169
169
 
170
170
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmoxmo/bncr",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/channel.ts CHANGED
@@ -1606,7 +1606,7 @@ class BncrBridgeRuntime {
1606
1606
  accountId: string;
1607
1607
  sessionKey: string;
1608
1608
  route: BncrRoute;
1609
- payload: { text?: string; mediaUrl?: string; mediaUrls?: string[]; asVoice?: boolean; audioAsVoice?: boolean };
1609
+ payload: { text?: string; mediaUrl?: string; mediaUrls?: string[]; asVoice?: boolean; audioAsVoice?: boolean; kind?: 'block' | 'final' };
1610
1610
  mediaLocalRoots?: readonly string[];
1611
1611
  }) {
1612
1612
  const { accountId, sessionKey, route, payload, mediaLocalRoots } = params;
@@ -1643,6 +1643,7 @@ class BncrBridgeRuntime {
1643
1643
  mimeType: media.mimeType,
1644
1644
  }),
1645
1645
  hintedType: wantsVoice ? 'voice' : undefined,
1646
+ kind: payload.kind,
1646
1647
  now: now(),
1647
1648
  });
1648
1649
 
@@ -1675,6 +1676,7 @@ class BncrBridgeRuntime {
1675
1676
  groupId: route.groupId,
1676
1677
  userId: route.userId,
1677
1678
  type: 'text',
1679
+ kind: payload.kind,
1678
1680
  msg: text,
1679
1681
  path: '',
1680
1682
  base64: '',
@@ -114,7 +114,8 @@ export async function handleBncrNativeCommand(params: {
114
114
  },
115
115
  dispatcherOptions: {
116
116
  deliver: async (payload: { text?: string; mediaUrl?: string; mediaUrls?: string[]; audioAsVoice?: boolean }, info?: { kind?: 'tool' | 'block' | 'final' }) => {
117
- if (info?.kind && info.kind !== 'final') return;
117
+ const kind = info?.kind;
118
+ if (kind && kind !== 'final') return;
118
119
  const hasPayload = Boolean(payload?.text || payload?.mediaUrl || (Array.isArray(payload?.mediaUrls) && payload.mediaUrls.length > 0));
119
120
  if (!hasPayload) return;
120
121
  responded = true;
@@ -122,7 +123,10 @@ export async function handleBncrNativeCommand(params: {
122
123
  accountId,
123
124
  sessionKey,
124
125
  route,
125
- payload,
126
+ payload: {
127
+ ...payload,
128
+ kind: kind as 'block' | 'final' | undefined,
129
+ },
126
130
  });
127
131
  },
128
132
  },
@@ -154,13 +154,17 @@ export async function dispatchBncrInbound(params: {
154
154
  payload: { text?: string; mediaUrl?: string; mediaUrls?: string[]; audioAsVoice?: boolean },
155
155
  info?: { kind?: 'tool' | 'block' | 'final' },
156
156
  ) => {
157
- if (info?.kind && info.kind !== 'final') return;
157
+ const kind = info?.kind;
158
+ if (kind && kind !== 'final') return;
158
159
 
159
160
  await enqueueFromReply({
160
161
  accountId,
161
162
  sessionKey,
162
163
  route,
163
- payload,
164
+ payload: {
165
+ ...payload,
166
+ kind: kind as 'block' | 'final' | undefined,
167
+ },
164
168
  });
165
169
  },
166
170
  onError: (err: unknown) => {
@@ -36,6 +36,7 @@ export function buildBncrMediaOutboundFrame(params: {
36
36
  mediaMsg: string;
37
37
  fileName: string;
38
38
  hintedType?: string;
39
+ kind?: 'block' | 'final';
39
40
  now: number;
40
41
  }) {
41
42
  return {
@@ -53,6 +54,7 @@ export function buildBncrMediaOutboundFrame(params: {
53
54
  hasPayload: !!(params.media.path || params.media.mediaBase64),
54
55
  hintedType: params.hintedType,
55
56
  }),
57
+ kind: params.kind,
56
58
  mimeType: params.media.mimeType || '',
57
59
  msg: params.mediaMsg,
58
60
  path: params.media.path || params.mediaUrl,