Sync features: Lex streaming, transcript updates, and agent metrics#309
Sync features: Lex streaming, transcript updates, and agent metrics#309saipreetham16 merged 7 commits intomasterfrom
Conversation
- Add PartialMessageUtil for handling bot partial messages - Integrate partial message stitching in chatController - Add rehydration support in getTranscript - Add comprehensive test coverage Internal commit: 93a3ea4
- Add InternalTranscriptUtils for transcript management - Add TRANSCRIPT_UPDATED event and MESSAGE_STATUS constants - Integrate transcript tracking in sendMessage, getTranscript, and incoming messages - Add auto-fetch transcript on connection when transcriptUpdateEnabled - Add onTranscriptUpdated callback to chatSession - Add TypeScript definitions for transcript events - Add comprehensive test coverage Internal commit: e871068
- Add workflowCanceled content type constant - Enables handling of workflow cancellation events from Connect Internal commit: a73ec52
- Move transcript update to track stitched messages correctly - Add MessageCompleted and ChunkNumber to MessageMetadata TypeScript types - Fixes transcript tracking for partial/streaming messages from Lex Internal commit: 86ca9f6
Commit 5 (f2c5177): Agent getConnectionToken and createParticipantConnection metrics - Add AGENT_CREATE_PARTICIPANT_ERROR_RATE metric constant - Add AGENT_GET_CONNECTION_TOKEN_ERROR_RATE metric constant - Track agent session errors in connectionDetailsProvider - Add _isAgentSession() helper method Commit 6 (80b9daa): TypeScript type for MessageProcessingStatus - Add MessageProcessingStatus interface (PROCESSING, FAILED, REJECTED) - Add MessageProcessingStatus to MessageMetadata type definition Internal commits: f2c5177, 80b9daa
Commit 7 (5b94790): Update default max results for onTranscriptUpdated - Already applied in commit 2 (maxResults: 100) Commit 8 (91e963f): Exclude 4xx errors from AGENT_CREATE_PARTICIPANT_ERROR_RATE - Only track 5xx and network errors as failures - 4xx errors are client errors, not service failures Internal commits: 5b94790, 91e963f
| } | ||
| }) | ||
| .catch( error => { | ||
| if (this._isAgentSession() && !error?.statusCode?.toString().startsWith("4")) { |
There was a problem hiding this comment.
can you check if this metric is suppose to only be for default CCP agents or it should include custom CCP as well?
There was a problem hiding this comment.
The AGENT_CREATE_PARTICIPANT_ERROR_RATE metric is to monitor agent sessions (both default CCP and custom CCP). logic:
- this._isAgentSession() - Filters for agent sessions (vs customer)
- !error?.statusCode?.toString().startsWith("4") - Excludes 4xx client errors
- Tracks server-side connectivity issues affecting agents
This is will monitoring agent connection health across all CCP implementations.
| this.controller.subscribe(CHAT_EVENTS.CHAT_REHYDRATED, callback); | ||
| } | ||
|
|
||
| onTranscriptUpdated(callback) { |
There was a problem hiding this comment.
can you add this event to the readme
|
Changes LGTM, the only thing I noticed in the video is that the chat window doesn't scroll automatically to the bottom when the partial messages continue to come from lex, is that the desired behavior ? (for both internal package and this repo). |
This is expected for longer responses now, will create a backlog for this. |
Sync features: Lex streaming, transcript updates, and agent metrics
Overview
Adding support for Lex streaming responses, real-time transcript tracking, and agent-specific metrics.
Changes Summary
Customer-Facing Features
onTranscriptUpdatedevent provides real-time transcript state with message statusesDeveloper Features
MessageProcessingStatustype definitionMessageCompleted,ChunkNumber, andMessageProcessingStatusfieldsCommits Included
Add partial message stitching (93a3ea4)
Add transcriptUpdated event (e871068)
chatSession.onTranscriptUpdated()callbackAdd workflow cancelled event (a73ec52)
workflowCanceledcontent type constantSupport Lex streaming for transcriptUpdated (86ca9f6)
MessageCompletedandChunkNumberto TypeScript typesAdd agent metrics (f2c5177)
AGENT_CREATE_PARTICIPANT_ERROR_RATEmetricAGENT_GET_CONNECTION_TOKEN_ERROR_RATEmetricAdd MessageProcessingStatus TypeScript type (80b9daa)
Update default max results for transcript (5b94790)
Exclude 4xx errors from agent error metric (91e963f)
Testing
Automated Tests
Manual Testing
Test Coverage
PartialMessageUtil.spec.jschatController.transcript.spec.js,internalTranscriptUtils.spec.jsconnectionDetailsProvider.spec.jsBreaking Changes
None. All changes are backward compatible.
API Changes
New APIs
New TypeScript Types
New Constants
Screen.Recording.2026-01-30.at.10.32.46.PM.mov