rawmsg

package
v0.0.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rawmsg converts the RawMessagesInfo format returned by the klaus agent's messages MCP tool into simple role/content pairs.

The agent now returns messages as json.RawMessage items with fields like type, subtype, text, tool_name, and timestamp instead of the old role/content format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message is a simplified role/content pair suitable for display.

func Convert

func Convert(data json.RawMessage) Message

Convert converts a single json.RawMessage into a role/content Message.

func Parse

func Parse(data string) (status string, total int, messages []Message, ok bool)

Parse attempts to parse a JSON string as a RawResponse and convert its messages to role/content pairs. It returns the status, total count, and converted messages. If the input does not match the raw format (e.g. it lacks the "total" field), ok is false and the caller should fall back to the legacy format.

type RawResponse

type RawResponse struct {
	Status   string            `json:"status"`
	Total    int               `json:"total"`
	Messages []json.RawMessage `json:"messages"`
}

RawResponse is the JSON payload returned by the agent's messages MCP tool in the new RawMessagesInfo format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL