[PR #1632] [CLOSED] feat: Add OpenAI Harmony template format support #10008

Closed
opened 2026-02-16 18:14:32 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1632
Author: @gtrias
Created: 8/5/2025
Status: Closed

Base: devHead: feat/harmony-template-format


📝 Commits (1)

  • 838764d feat: Add OpenAI Harmony template format support

📊 Changes

15 files changed (+1171 additions, -18 deletions)

View changed files

CLAUDE.md (+85 -0)
HARMONY_IMPLEMENTATION.md (+384 -0)
📝 packages/opencode/src/provider/models.ts (+1 -0)
📝 packages/opencode/src/provider/provider.ts (+14 -1)
📝 packages/opencode/src/provider/transform.ts (+37 -0)
packages/opencode/src/session/harmony.ts (+162 -0)
📝 packages/opencode/src/session/index.ts (+77 -4)
📝 packages/opencode/src/session/message-v2.ts (+10 -1)
📝 packages/opencode/src/session/message.ts (+12 -1)
packages/opencode/test/harmony/harmony.test.ts (+175 -0)
📝 packages/sdk/go/session.go (+76 -8)
📝 packages/tui/internal/components/chat/message.go (+42 -0)
📝 packages/tui/internal/components/chat/messages.go (+34 -3)
tasks/tasks.json (+1 -0)
test_harmony.md (+61 -0)

📄 Description

Implements parsing and rendering for OpenAI's Harmony template format used by gpt-oss models.

Features:

  • Parse <|channel|>name<|message|>content<|end|> format
  • Render channels with distinct styling (analysis, commentary, final)
  • Clean title generation without template tokens
  • Streaming support for real-time parsing
  • Comprehensive error handling and fallbacks
  • Full test coverage (16 tests)

Technical Details:

  • New HarmonyChannelPart message type
  • Harmony namespace with parsing utilities
  • Auto-detection for gpt-oss/harmony models
  • TUI rendering with channel-specific colors
  • Backwards compatible with existing models

Fixes broken display of raw Harmony tokens in chat interface.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1632 **Author:** [@gtrias](https://github.com/gtrias) **Created:** 8/5/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/harmony-template-format` --- ### 📝 Commits (1) - [`838764d`](https://github.com/anomalyco/opencode/commit/838764df2191205e6213f1756b9d93f68c8b9c0c) feat: Add OpenAI Harmony template format support ### 📊 Changes **15 files changed** (+1171 additions, -18 deletions) <details> <summary>View changed files</summary> ➕ `CLAUDE.md` (+85 -0) ➕ `HARMONY_IMPLEMENTATION.md` (+384 -0) 📝 `packages/opencode/src/provider/models.ts` (+1 -0) 📝 `packages/opencode/src/provider/provider.ts` (+14 -1) 📝 `packages/opencode/src/provider/transform.ts` (+37 -0) ➕ `packages/opencode/src/session/harmony.ts` (+162 -0) 📝 `packages/opencode/src/session/index.ts` (+77 -4) 📝 `packages/opencode/src/session/message-v2.ts` (+10 -1) 📝 `packages/opencode/src/session/message.ts` (+12 -1) ➕ `packages/opencode/test/harmony/harmony.test.ts` (+175 -0) 📝 `packages/sdk/go/session.go` (+76 -8) 📝 `packages/tui/internal/components/chat/message.go` (+42 -0) 📝 `packages/tui/internal/components/chat/messages.go` (+34 -3) ➕ `tasks/tasks.json` (+1 -0) ➕ `test_harmony.md` (+61 -0) </details> ### 📄 Description Implements parsing and rendering for OpenAI's Harmony template format used by gpt-oss models. Features: - Parse <|channel|>name<|message|>content<|end|> format - Render channels with distinct styling (analysis, commentary, final) - Clean title generation without template tokens - Streaming support for real-time parsing - Comprehensive error handling and fallbacks - Full test coverage (16 tests) Technical Details: - New HarmonyChannelPart message type - Harmony namespace with parsing utilities - Auto-detection for gpt-oss/harmony models - TUI rendering with channel-specific colors - Backwards compatible with existing models Fixes broken display of raw Harmony tokens in chat interface. 🤖 Generated with [Claude Code](https://claude.ai/code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:32 -05:00
yindo closed this issue 2026-02-16 18:14:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10008