@xmoxmo/bncr 0.5.4 → 0.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmoxmo/bncr",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -272,7 +272,6 @@ export function buildBncrPromptVisibleContextFacts(
272
272
  return Object.values(payload).some((field) => field !== undefined) ? [payload] : [];
273
273
  });
274
274
  }
275
-
276
275
  if (facts.pendingMediaContext?.length) {
277
276
  result.pendingMediaContext = facts.pendingMediaContext.flatMap((entry) => {
278
277
  const media = (entry.media || []).flatMap((item) => {
@@ -359,7 +358,7 @@ export type BncrStructuredContextFactsFromInboundPartsInput = {
359
358
  bridgeSenderName?: string;
360
359
  senderIsOwner?: boolean;
361
360
  senderIsAuthorized?: boolean;
362
- pendingMediaContext?: Array<{
361
+ pendingHistoryContext?: Array<{
363
362
  messageId?: string;
364
363
  sender?: string;
365
364
  senderId?: string;
@@ -372,11 +371,13 @@ export type BncrStructuredContextFactsFromInboundPartsInput = {
372
371
  }>;
373
372
  }>;
374
373
  };
375
-
376
374
  export function buildBncrStructuredContextFactsFromInboundParts(
377
375
  input: BncrStructuredContextFactsFromInboundPartsInput,
378
376
  ) {
379
377
  const mediaItems = Array.isArray(input.prepared.mediaItems) ? input.prepared.mediaItems : [];
378
+ const pendingHistoryContext = Array.isArray(input.pendingHistoryContext)
379
+ ? input.pendingHistoryContext
380
+ : [];
380
381
  return buildBncrStructuredContextFacts({
381
382
  channelId: input.channelId,
382
383
  accountId: input.parsed.accountId,
@@ -434,6 +435,6 @@ export function buildBncrStructuredContextFactsFromInboundParts(
434
435
  kind: item.kind || inferBncrStructuredMediaKind(item.contentType),
435
436
  messageId: input.parsed.msgId,
436
437
  })),
437
- pendingMediaContext: input.pendingMediaContext,
438
+ pendingMediaContext: pendingHistoryContext,
438
439
  });
439
440
  }
@@ -226,7 +226,10 @@ export function buildBncrGroupContextFromEntries(args: {
226
226
  .map((entry) =>
227
227
  formatOpenClawAgentEnvelope(args.api, {
228
228
  channel: 'Bncr',
229
- from: args.channelLabel,
229
+ from:
230
+ (entry.senderId
231
+ ? `${entry.sender} (${entry.senderId})`
232
+ : entry.sender || args.channelLabel) + (entry.messageId ? ` #${entry.messageId}` : ''),
230
233
  timestamp: entry.timestamp || args.currentTimestamp,
231
234
  previousTimestamp: args.previousTimestamp,
232
235
  envelope: args.envelope,
@@ -1,3 +1,4 @@
1
+ import type { HistoryMediaEntry } from 'openclaw/plugin-sdk/reply-history';
1
2
  import { readBncrSessionUpdatedAt } from '../../openclaw/inbound-session-runtime.ts';
2
3
  import {
3
4
  formatOpenClawAgentEnvelope,
@@ -125,6 +126,20 @@ export function buildBncrInboundTurnContext(args: {
125
126
  const pendingHistoryMedia = shouldDispatch
126
127
  ? collectBncrHistoryMediaFromEntries({ entries: pendingHistoryEntries })
127
128
  : [];
129
+ const pendingHistoryContext = shouldDispatch
130
+ ? pendingHistoryEntries.map((entry) => ({
131
+ messageId: entry.messageId,
132
+ sender: entry.sender,
133
+ senderId: entry.senderId,
134
+ body: entry.body,
135
+ media: (entry.media || []).map((item: HistoryMediaEntry) => ({
136
+ path: item.path,
137
+ contentType: item.contentType,
138
+ kind: item.kind,
139
+ messageId: item.messageId,
140
+ })),
141
+ }))
142
+ : [];
128
143
  const structuredContextFacts = buildBncrStructuredContextFactsFromInboundParts({
129
144
  channelId,
130
145
  parsed,
@@ -140,6 +155,7 @@ export function buildBncrInboundTurnContext(args: {
140
155
  bridgeSenderName,
141
156
  senderIsOwner,
142
157
  senderIsAuthorized,
158
+ pendingHistoryContext,
143
159
  });
144
160
  const promptVisibleContextFacts = buildBncrPromptVisibleContextFacts(structuredContextFacts);
145
161
  const supplementalUntrustedContext = [