Skip to content

T8#1708

Merged
nmaguiar merged 15 commits intomasterfrom
t8
Feb 23, 2026
Merged

T8#1708
nmaguiar merged 15 commits intomasterfrom
t8

Conversation

@nmaguiar
Copy link
Collaborator

This pull request introduces significant improvements to the handling of Anthropic LLM tool calls and streaming, as well as adding Kubernetes DNS-based peer discovery utilities for channel servers. The changes enhance compatibility with Anthropic's message formats, improve tool result normalization, refine streaming delta handling, and provide a utility for Kubernetes-native service discovery in distributed OpenAF deployments.

Anthropic LLM Integration and Tool Call Handling

  • Improved normalization of tool call results for Anthropic models by introducing the _normalizeToolResultForAnthropic function, ensuring consistent output formatting for various result types. [1] [2] [3]
  • Enhanced message and content formatting for Anthropic API calls, including proper handling of content arrays and types, and improved JSON output control by appending instructions to the system prompt instead of user messages. [1] [2] [3] [4]
  • Refined streaming delta emission logic to defer or suppress deltas during tool-use turns and when JSON output is requested, preventing premature or unwanted UI updates. [1] [2]
  • Improved tracking and reconstruction of tool_use blocks and their arguments during streaming, ensuring accurate mapping of tool calls by content index and correct assembly of input arguments from streamed deltas.
  • Adjusted final tool execution response handling to avoid prepending intermediary tool-turn text to the final result, ensuring cleaner output.

Channel Server and Kubernetes Integration

  • Added getK8sRemoteURLArrayFunc utility to ow.ch.utils, enabling dynamic discovery of peer channel URLs via Kubernetes DNS (headless service), with options for protocol, port, path, and exclusion of the current pod IP. This facilitates robust peer-to-peer networking in Kubernetes environments.
  • Updated ow.ch.server.peer to support aRemoteURLArray as a function, allowing dynamic peer URL resolution (such as via the new Kubernetes utility). [1] [2]

Configuration

  • Added a new MCPSERVER config section in openaf.js with an answerInTOON flag, likely for future or external use.

…malization and streamline tool result processing
  - Updated the jsch library from version 2.27.7 to 2.27.8.
  - Adjusted the corresponding JAR file in the lib directory.
… peer

- Introduced `getK8sRemoteURLArrayFunc` to resolve DNS names to channel URLs.
- Updated `server.peer` to accept a function for `aRemoteURLArray`.
- Minor refactor of `getElasticQuery` formatting.
- Add MCPSERVER flag  to control output format
- Update  and  to use  when flag is true
- Remove legacy  usage
- Updated the MCPSERVER flag name for consistency.
- Adjusted all references in openaf.js and owrap.server.js.
- Ensures future code uses the correct flag name.
…totoom-conditionally

Add TOOM output option for MCP text responses
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances OpenAF's Anthropic LLM integration, adds Kubernetes-based peer discovery for distributed channel servers, and introduces MCP server output formatting options. The changes improve tool call handling, streaming behavior, and service discovery in cloud-native deployments.

Changes:

  • Enhanced Anthropic LLM integration with improved tool result normalization, refined streaming delta control, and better message content handling
  • Added Kubernetes DNS-based peer discovery utility (getK8sRemoteURLArrayFunc) enabling dynamic service discovery in containerized environments
  • Introduced configurable MCP server response formatting with TOON output option

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pom.xml Minor dependency update: jsch library bumped from 2.27.7 to 2.27.8
js/openaf.js Added MCPSERVER configuration section with answerInTOON flag
js/owrap.server.js Implemented configurable result formatting for MCP server responses using TOON or JSON
js/owrap.ch.js Added Kubernetes DNS-based peer discovery utility and reformatted getElasticQuery (with indentation issues)
js/owrap.ai.js Extensive Anthropic improvements: tool result normalization, content array handling, JSON instruction placement, streaming delta control, and better tool argument reconstruction

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Feb 23, 2026

@nmaguiar I've opened a new pull request, #1710, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 23, 2026

@nmaguiar I've opened a new pull request, #1711, to work on those changes. Once the pull request is ready, I'll request review from you.

nmaguiar and others added 2 commits February 23, 2026 14:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 23, 2026

@nmaguiar I've opened a new pull request, #1712, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 5 commits February 23, 2026 14:05
…RLArrayFunc

Co-authored-by: nmaguiar <11761746+nmaguiar@users.noreply.github.com>
…eURLArrayFunc

Co-authored-by: nmaguiar <11761746+nmaguiar@users.noreply.github.com>
fix(owrap.ch): correct indentation of getElasticQuery and getK8sRemoteURLArrayFunc in ow.ch.utils
Add error handling for DNS resolution in getK8sRemoteURLArrayFunc
@nmaguiar nmaguiar merged commit 8f8f067 into master Feb 23, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Continuous Enhancement Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug dependencies Pull requests that update a dependency file enhancement

Projects

Development

Successfully merging this pull request may close these issues.

3 participants