Skip to content

Add Chat API Support to AWS LSP CodeWhisperer Transform Handler#2635

Open
pranav-firake wants to merge 1 commit intomainfrom
pranavfi-transform-chat-apis
Open

Add Chat API Support to AWS LSP CodeWhisperer Transform Handler#2635
pranav-firake wants to merge 1 commit intomainfrom
pranavfi-transform-chat-apis

Conversation

@pranav-firake
Copy link
Contributor

Add Chat API Support to AWS LSP CodeWhisperer Transform Handler

Summary

Extends AWS LSP CodeWhisperer with chat capabilities to enable IDE → LSP → Gumby Front End Service (FES) communication for AWS Transform operations.

Changes

Core Implementation

atxTransformHandler.ts

  • Added sendMessage(): Sends chat messages with automatic polling for responses (8 attempts × 2s intervals)
  • Added listMessages(): Lists message IDs with pagination and timestamp filtering
  • Added batchGetMessages(): Retrieves full message content by IDs
  • Uses existing bearer token authentication pattern
  • Returns interactions array for IDE action button rendering

atxNetTransformServer.ts

  • Registered 3 new LSP commands:
    • aws/atxTransform/sendMessage
    • aws/atxTransform/listMessages
    • aws/atxTransform/batchGetMessages
  • Routes commands to handler methods with parameter mapping

Testing

tests/atxTransformHandler.test.ts (new)

  • 12 unit tests covering all chat methods
  • Tests polling logic, pagination, error handling, and job context
  • All tests passing

Test Scripts

test-chat-axios.js (new)

  • Working implementation using Axios with Coral protocol (X-Amz-Target headers)

chat-interactive.js (new)

  • Interactive chat loop for manual testing

Technical Details

Authentication

Uses existing bearer token pattern via addAuthToCommand() middleware

API Protocol

  • AWS Coral protocol via ElasticGumbyFrontendClient SDK
  • Requires X-Amz-Target header for operation routing
  • UUID format required for idempotencyToken

Response Format

typescript
{
success: true,
data: {
sentMessage: { messageId: string },
response: {
messageId: string,
text: string,
messageType: 'FINAL_RESPONSE',
interactions: Array<{ actionType, data }>,
createdAt: string
}
}
}

Testing

bash
npm run compile # No TypeScript errors
npx ts-mocha "src/language-server/netTransform/tests/atxTransformHandler.test.ts" # 12 passing

Files Modified

  • src/language-server/netTransform/atxTransformHandler.ts (~100 lines added)
  • src/language-server/netTransform/atxNetTransformServer.ts (~20 lines added)
  • src/language-server/netTransform/tests/atxTransformHandler.test.ts (new, 242 lines)
  • src/language-server/netTransform/test-chat-axios.js (new)
  • src/language-server/netTransform/chat-interactive.js (new)

Next Steps

IDE integration can now invoke LSP chat commands to communicate with AWS Transform service.

@pranav-firake pranav-firake requested a review from a team as a code owner February 26, 2026 17:40
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 29.89691% with 136 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.66%. Comparing base (77b6e7d) to head (357700c).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...anguage-server/netTransform/atxTransformHandler.ts 35.80% 104 Missing ⚠️
...guage-server/netTransform/atxNetTransformServer.ts 0.00% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2635      +/-   ##
==========================================
- Coverage   60.27%   59.66%   -0.62%     
==========================================
  Files         279      279              
  Lines       65885    66079     +194     
  Branches     4164     4085      -79     
==========================================
- Hits        39713    39426     -287     
- Misses      26090    26571     +481     
  Partials       82       82              
Flag Coverage Δ
unittests 59.66% <29.89%> (-0.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants