Add chat history API for OpenAI#157
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds chat history APIs for the OpenAI Agents SDK integration, enabling developers to send conversation history to the MCP platform for real-time threat protection without manual type conversion.
Changes:
- Implements two new public methods:
sendChatHistoryAsync(session-based) andsendChatHistoryMessagesAsync(message array-based) in McpToolRegistrationService - Adds automatic conversion from OpenAI
AgentInputItemtypes to platform-nativeChatHistoryMessageformat with role pass-through, content extraction, UUID generation for missing IDs, and timestamp generation - Updates OpenAI Agents SDK packages from version 0.1.5 to 0.4.0 and adds uuid package dependency
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts | Core implementation of chat history APIs with conversion logic |
| packages/agents-a365-tooling-extensions-openai/src/index.ts | Re-exports OpenAIConversationsSession for convenience |
| packages/agents-a365-tooling-extensions-openai/package.json | Adds uuid and @types/uuid dependencies |
| packages/agents-a365-tooling-extensions-openai/docs/design.md | Documents the new chat history APIs with usage examples |
| tests/tooling-extensions-openai/sendChatHistoryAsync.test.ts | Comprehensive tests for session-based API (241 lines) |
| tests/tooling-extensions-openai/sendChatHistoryMessagesAsync.test.ts | Comprehensive tests for message array-based API (286 lines) |
| tests/tooling-extensions-openai/messageConversion.test.ts | Tests for message conversion logic (459 lines) |
| tests/tooling-extensions-openai/fixtures/mockOpenAITypes.ts | Mock types and helper functions for testing (231 lines) |
| tests/package.json | Updates test script paths for better reliability |
| pnpm-workspace.yaml | Updates OpenAI Agents SDK packages to v0.4.0 |
| pnpm-lock.yaml | Lockfile updates for dependency changes |
| docs/prd/prd-openai-chat-history-api.md | Product requirements document (741 lines) |
| docs/tasks/prd-openai-chat-history-api.tasks.md | Implementation task breakdown (361 lines) |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
…ion in McpToolRegistrationService
|
@pontemonti I've opened a new pull request, #158, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@pontemonti I've opened a new pull request, #159, to work on those changes. Once the pull request is ready, I'll request review from you. |
#158) * Initial plan * fix: ensure MCP call is made even when messages array is empty Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
* Initial plan * Remove fragile 'is required' check from sendChatHistory methods Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
|
@copilot - after the last couple of updates, the tests are now failing. Please run all the checks just like what the PR workflow does, and then address the failures. |
|
@pontemonti I've opened a new pull request, #160, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tations (#160) * Initial plan * Fix test failures: wrap session.getItems() in try-catch and update test expectations for empty arrays Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> Co-authored-by: Johan Broberg <johan@pontemonti.net>
|
@pontemonti I've opened a new pull request, #163, to work on those changes. Once the pull request is ready, I'll request review from you. |
…sync (#163) * Initial plan * Add error handling for convertToChatHistoryMessages and test Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> * Address code review feedback: safer error handling and remove extra blank line Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
ffd7354
No description provided.