@yeaft/webchat-agent 1.0.555 → 1.0.557

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.555",
3
+ "version": "1.0.557",
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",
@@ -4290,12 +4290,14 @@ function handleEngineEvent(event, hctx) {
4290
4290
  case 'tool_end': {
4291
4291
  const images = Array.isArray(event.displayImages) ? event.displayImages : [];
4292
4292
  const displayOutput = typeof event.output === 'string' ? event.output : JSON.stringify(event.output ?? '');
4293
- for (const image of images) {
4293
+ for (const [sourceImageIndex, image] of images.entries()) {
4294
4294
  const persistedImage = imageMetadataForPersistence(image);
4295
4295
  try {
4296
4296
  if (!ctx.assetOutbox) throw new Error('asset outbox is unavailable');
4297
4297
  const deliveryId = ctx.assetOutbox.enqueue({
4298
4298
  conversationId: yeaftConversationId,
4299
+ sourceToolCallId: event.id,
4300
+ sourceImageIndex,
4299
4301
  metadata: persistedImage,
4300
4302
  sessionId: hctx.sessionId,
4301
4303
  vpId: hctx.vpId,
@@ -592,6 +592,33 @@ function projectAssignmentPolicy(policy) {
592
592
  };
593
593
  }
594
594
 
595
+ // Only current-identity Run execution counts; queue/retry gaps are not runtime.
596
+ // Keep the active start separate so the browser can tick without polling the Agent.
597
+ function actionTiming(action, runs, matchingRuns) {
598
+ if (!Array.isArray(runs)) {
599
+ return {
600
+ executionDurationMs: Number.isFinite(action.executionDurationMs) && action.executionDurationMs >= 0
601
+ ? action.executionDurationMs : null,
602
+ executionStartedAt: Number.isFinite(action.executionStartedAt) && action.executionStartedAt > 0
603
+ ? action.executionStartedAt : null,
604
+ };
605
+ }
606
+ let executionDurationMs = null;
607
+ let executionStartedAt = null;
608
+ for (const run of matchingRuns) {
609
+ const start = run.startedAt;
610
+ if (!Number.isFinite(start) || start <= 0) continue;
611
+ const end = run.endedAt || run.terminalAt;
612
+ if (Number.isFinite(end) && end >= start) {
613
+ executionDurationMs = (executionDurationMs || 0) + end - start;
614
+ } else if (!end && !run.terminalStatus && run.status === 'running' && action.status === 'running') {
615
+ executionDurationMs ??= 0;
616
+ executionStartedAt = Math.max(executionStartedAt || 0, start);
617
+ }
618
+ }
619
+ return { executionDurationMs, executionStartedAt };
620
+ }
621
+
595
622
  function projectAction(action, runs, events, includeBody = true) {
596
623
  if (!action) return null;
597
624
  const execution = actionExecution(action, runs, events, includeBody);
@@ -622,6 +649,7 @@ function projectAction(action, runs, events, includeBody = true) {
622
649
  sequence: action.sequence,
623
650
  createdAt: count(action.createdAt),
624
651
  updatedAt: count(action.updatedAt),
652
+ ...actionTiming(action, runs, matchingRuns),
625
653
  type: action.type,
626
654
  stageId: action.stageId || action.type,
627
655
  assignmentPolicy: alreadyProjected
@@ -707,6 +735,8 @@ function projectActionStats(detail, liveActionId = bodyActionId(detail)) {
707
735
  sequence: projected.sequence,
708
736
  createdAt: projected.createdAt,
709
737
  updatedAt: projected.updatedAt,
738
+ executionDurationMs: projected.executionDurationMs,
739
+ executionStartedAt: projected.executionStartedAt,
710
740
  assignedVp: projected.assignedVp,
711
741
  contentSummary: projected.contentSummary,
712
742
  executionStats: projected.executionStats,