mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-06 02:34:09 +08:00
- Move all source files to internal/{app,backend,config,executor,logger,parser,utils}
- Integrate third-party libraries: zerolog, goccy/go-json, gopsutil, cobra/viper
- Add comprehensive unit tests for utils package (94.3% coverage)
- Add performance benchmarks for string operations
- Fix error display: cleanup warnings no longer pollute Recent Errors
- Add GitHub Actions CI workflow
- Add Makefile for build automation
- Add README documentation
Generated with SWE-Agent.ai
Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package wrapper
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
|
|
parser "codeagent-wrapper/internal/parser"
|
|
|
|
"github.com/goccy/go-json"
|
|
)
|
|
|
|
func parseJSONStream(r io.Reader) (message, threadID string) {
|
|
return parseJSONStreamWithLog(r, logWarn, logInfo)
|
|
}
|
|
|
|
func parseJSONStreamWithWarn(r io.Reader, warnFn func(string)) (message, threadID string) {
|
|
return parseJSONStreamWithLog(r, warnFn, logInfo)
|
|
}
|
|
|
|
func parseJSONStreamWithLog(r io.Reader, warnFn func(string), infoFn func(string)) (message, threadID string) {
|
|
return parseJSONStreamInternal(r, warnFn, infoFn, nil, nil)
|
|
}
|
|
|
|
func parseJSONStreamInternal(r io.Reader, warnFn func(string), infoFn func(string), onMessage func(), onComplete func()) (message, threadID string) {
|
|
return parser.ParseJSONStreamInternal(r, warnFn, infoFn, onMessage, onComplete)
|
|
}
|
|
|
|
func hasKey(m map[string]json.RawMessage, key string) bool { return parser.HasKey(m, key) }
|
|
|
|
func discardInvalidJSON(decoder *json.Decoder, reader *bufio.Reader) (*bufio.Reader, error) {
|
|
return parser.DiscardInvalidJSON(decoder, reader)
|
|
}
|
|
|
|
func normalizeText(text interface{}) string { return parser.NormalizeText(text) }
|