feat: add execution history queries and preserve bounded JSON payloads

This commit is contained in:
2026-09-17 14:55:23 +08:00
parent da123bba69
commit 4d4b2e9f7d
32 changed files with 1461 additions and 28 deletions

View File

@@ -0,0 +1,18 @@
// Package jsonwire 统一 JSON 传输与回执编码;响应以 application/json 提供,不嵌入 HTML。
package jsonwire
import (
"bytes"
"encoding/json"
)
// Marshal 保留 RawMessage 数字文本,避免 HTML 转义把合法载荷放大到传输上限之外。
func Marshal(value any) ([]byte, error) {
var buffer bytes.Buffer
encoder := json.NewEncoder(&buffer)
encoder.SetEscapeHTML(false)
if err := encoder.Encode(value); err != nil {
return nil, err
}
return bytes.TrimSuffix(buffer.Bytes(), []byte{'\n'}), nil
}