@yeaft/webchat-agent 1.0.512 → 1.0.513

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": "1.0.512",
3
+ "version": "1.0.513",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -411,6 +411,8 @@ function serializeMessage(msg) {
411
411
 
412
412
  if (msg.mode) fm.push(`mode: ${msg.mode}`);
413
413
  if (msg.model) fm.push(`model: ${msg.model}`);
414
+ if (msg.effort) fm.push(`effort: ${msg.effort}`);
415
+ if (Number.isInteger(msg.llmCallCount) && msg.llmCallCount > 0) fm.push(`llmCallCount: ${msg.llmCallCount}`);
414
416
  if (msg.turnNumber != null) fm.push(`turnNumber: ${msg.turnNumber}`);
415
417
  if (msg.toolCallId) fm.push(`toolCallId: ${msg.toolCallId}`);
416
418
  if (msg.eventType) fm.push(`eventType: ${msg.eventType}`);
@@ -560,6 +562,8 @@ export function parseMessage(raw) {
560
562
  case 'time': msg.time = value; break;
561
563
  case 'mode': msg.mode = value; break;
562
564
  case 'model': msg.model = value; break;
565
+ case 'effort': msg.effort = value; break;
566
+ case 'llmCallCount': msg.llmCallCount = parseInt(value, 10); break;
563
567
  case 'turnNumber': msg.turnNumber = parseInt(value, 10); break;
564
568
  case 'toolCallId': msg.toolCallId = value; break;
565
569
  case 'eventType': msg.eventType = value; break;
package/yeaft/engine.js CHANGED
@@ -2577,6 +2577,8 @@ export class Engine {
2577
2577
  let displayImageAnchorMessage = null;
2578
2578
  let lastPersistedAssistantMessage = null;
2579
2579
  let lastPersistedAssistantTextMessage = null;
2580
+ let lastSuccessfulModel = null;
2581
+ let lastSuccessfulEffort = null;
2580
2582
  // `refreshConfig()` may publish a new Session model while a stream or a
2581
2583
  // tool is running. Apply it only before the next provider request; the
2582
2584
  // current request keeps the snapshot captured below.
@@ -3282,6 +3284,11 @@ export class Engine {
3282
3284
  contextTokens: peakContextTokens,
3283
3285
  contextWindow: peakContextWindow,
3284
3286
  };
3287
+ // This request completed normally. Preserve the actual model and the
3288
+ // adapter-resolved effort so the visible response can identify the last
3289
+ // successful provider call (including fallback-model switches).
3290
+ lastSuccessfulModel = currentModel;
3291
+ lastSuccessfulEffort = requestEffortDecision.effective || resolvedEffort || null;
3285
3292
  // Stream completed without throwing — reset the retry counter so
3286
3293
  // the next turn starts with a clean budget. In-band adapter errors
3287
3294
  // are converted to throws above so they share the real error path.
@@ -4974,13 +4981,15 @@ export class Engine {
4974
4981
  // Loop back to call adapter again with tool results
4975
4982
  }
4976
4983
 
4977
- // Store the final provider-call count on the response row itself. Debug
4978
- // events are transient; the response card must retain the count after a
4979
- // reload without inventing a second counter.
4984
+ // Store final provider metadata on the response row itself. Debug events
4985
+ // are transient; the response card must retain the last successful model,
4986
+ // effort, and call count after a reload.
4980
4987
  const llmCountMessage = lastPersistedAssistantTextMessage || lastPersistedAssistantMessage;
4981
4988
  if (llmCountMessage && typeof this.#conversationStore?.update === 'function') {
4982
4989
  const updated = this.#conversationStore.update(llmCountMessage, {
4983
4990
  llmCallCount: turnNumber,
4991
+ ...(lastSuccessfulModel ? { model: lastSuccessfulModel } : {}),
4992
+ ...(lastSuccessfulEffort ? { effort: lastSuccessfulEffort } : {}),
4984
4993
  });
4985
4994
  if (updated?.id === lastPersistedAssistantTextMessage?.id) lastPersistedAssistantTextMessage = updated;
4986
4995
  if (updated?.id === lastPersistedAssistantMessage?.id) lastPersistedAssistantMessage = updated;
@@ -4997,6 +5006,8 @@ export class Engine {
4997
5006
  totalMs: Date.now() - queryStartedAt,
4998
5007
  totalTokens: cumulativeInputTokens + cumulativeOutputTokens,
4999
5008
  loopCount: turnNumber,
5009
+ ...(lastSuccessfulModel ? { model: lastSuccessfulModel } : {}),
5010
+ ...(lastSuccessfulEffort ? { effort: lastSuccessfulEffort } : {}),
5000
5011
  };
5001
5012
 
5002
5013
  // The visible response is complete at the yield above. Only when the
@@ -1426,6 +1426,8 @@ function projectPersistedToHistoryEntry(m, { includeReflections = false } = {})
1426
1426
  if (m.imageAssetAnchor) entry.imageAssetAnchor = true;
1427
1427
  if (m.responseKind === 'progress' || m.responseKind === 'result') entry.responseKind = m.responseKind;
1428
1428
  if (Number.isInteger(m.llmCallCount) && m.llmCallCount > 0) entry.llmCallCount = m.llmCallCount;
1429
+ if (typeof m.model === 'string' && m.model) entry.model = m.model;
1430
+ if (typeof m.effort === 'string' && m.effort) entry.effort = m.effort;
1429
1431
  if (m.incomplete === true) entry.incomplete = true;
1430
1432
  if (typeof m.stopReason === 'string' && m.stopReason) entry.stopReason = m.stopReason;
1431
1433
  if (m.sessionId) entry.sessionId = m.sessionId;
@@ -1567,6 +1569,8 @@ function projectVisibleHistoryChunkMessages(messages = []) {
1567
1569
  ...(m.speakerVpId ? { speakerVpId: m.speakerVpId } : {}),
1568
1570
  ...(m.responseKind === 'progress' || m.responseKind === 'result' ? { responseKind: m.responseKind } : {}),
1569
1571
  ...(Number.isInteger(m.llmCallCount) && m.llmCallCount > 0 ? { llmCallCount: m.llmCallCount } : {}),
1572
+ ...(typeof m.model === 'string' && m.model ? { model: m.model } : {}),
1573
+ ...(typeof m.effort === 'string' && m.effort ? { effort: m.effort } : {}),
1570
1574
  ...(m.incomplete === true ? { incomplete: true } : {}),
1571
1575
  ...(typeof m.stopReason === 'string' && m.stopReason ? { stopReason: m.stopReason } : {}),
1572
1576
  ...(Array.isArray(m.todos) ? { todos: m.todos } : {}),
@@ -4562,6 +4566,8 @@ function handleEngineEvent(event, hctx) {
4562
4566
  totalMs: event.totalMs,
4563
4567
  totalTokens: event.totalTokens,
4564
4568
  loopCount: event.loopCount,
4569
+ ...(typeof event.model === 'string' && event.model ? { model: event.model } : {}),
4570
+ ...(typeof event.effort === 'string' && event.effort ? { effort: event.effort } : {}),
4565
4571
  ts: Date.now(),
4566
4572
  }, envelope);
4567
4573
  break;