@yeaft/webchat-agent 0.1.826 → 0.1.828

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": "@yeaft/webchat-agent",
3
- "version": "0.1.826",
3
+ "version": "0.1.828",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -562,6 +562,8 @@ function projectPersistedToHistoryEntry(m) {
562
562
  if (isPersistedInternalMessage(m)) return null;
563
563
  const entry = { role: m.role, content: m.role === 'tool' ? m.content : __testNormalizePersistedVisibleContent(m.content) };
564
564
  if (m.id) entry.id = m.id;
565
+ entry.threadId = m.threadId || m.turnId || 'main';
566
+ entry.turnId = m.turnId || entry.threadId;
565
567
  if (m.groupId) entry.groupId = m.groupId;
566
568
  if (m.speakerVpId) entry.speakerVpId = m.speakerVpId;
567
569
  if (m.toolCallId) entry.toolCallId = m.toolCallId;
@@ -574,6 +576,7 @@ function projectPersistedToHistoryEntry(m) {
574
576
  }
575
577
  if (m.isError) entry.isError = true;
576
578
  if (m.ts) entry.ts = m.ts;
579
+ else if (m.time) entry.ts = m.time;
577
580
  if (Array.isArray(m.attachments) && m.attachments.length > 0) entry.attachments = m.attachments;
578
581
  if ((entry.role === 'user' || entry.role === 'assistant') && !entry.content && !entry.attachments) return null;
579
582
  return entry;
@@ -2268,6 +2271,7 @@ export async function handleUnifyGroupChat(msg) {
2268
2271
  let report;
2269
2272
  try {
2270
2273
  report = coord.ingest({
2274
+ id: typeof msg.id === 'string' && msg.id ? msg.id : undefined,
2271
2275
  from: 'user',
2272
2276
  role: 'user',
2273
2277
  text,
@@ -3585,7 +3589,7 @@ export async function handleUnifyLoadHistory(msg) {
3585
3589
  ...(Array.isArray(entry.attachments) && entry.attachments.length > 0 ? { attachments: hydrateHistoryAttachmentPreviews(entry.attachments) } : {}),
3586
3590
  },
3587
3591
  ts: entry.ts || null,
3588
- }, { groupId: entry.groupId || null });
3592
+ }, { groupId: entry.groupId || null, threadId: entry.threadId || 'main', turnId: entry.turnId || entry.threadId || 'main' });
3589
3593
  } else if (entry.role === 'assistant') {
3590
3594
  // speakerVpId rides on the envelope so the frontend can route this
3591
3595
  // replayed assistant text to the correct VP track. Without it, the
@@ -3593,6 +3597,8 @@ export async function handleUnifyLoadHistory(msg) {
3593
3597
  // anonymous assistant turn.
3594
3598
  const envelopeOpts = {
3595
3599
  groupId: entry.groupId || null,
3600
+ threadId: entry.threadId || 'main',
3601
+ turnId: entry.turnId || entry.threadId || 'main',
3596
3602
  };
3597
3603
  if (entry.speakerVpId) envelopeOpts.vpId = entry.speakerVpId;
3598
3604
  sendUnifyOutput({
@@ -3675,7 +3681,10 @@ export async function handleUnifyLoadMoreHistory(msg) {
3675
3681
  ...(m.id ? { id: m.id } : {}),
3676
3682
  role: m.role,
3677
3683
  content: m.content,
3684
+ ts: m.ts || m.time || null,
3678
3685
  groupId: m.groupId || null,
3686
+ threadId: m.threadId || m.turnId || 'main',
3687
+ turnId: m.turnId || m.threadId || 'main',
3679
3688
  ...(Array.isArray(m.attachments) && m.attachments.length > 0 ? { attachments: hydrateHistoryAttachmentPreviews(m.attachments) } : {}),
3680
3689
  ...(m.speakerVpId ? { speakerVpId: m.speakerVpId } : {}),
3681
3690
  }));