Files
wangdefa f782b612ec build: 内置 norma 模块,构建不再依赖上游仓库
把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到
third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或
改写 tag 都不再影响本仓库构建。

- 已验证 GOPROXY=off 下可完整编译并打出发行包
- go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希)
- 升级方法与授权注意事项见 third_party/README.md
2026-10-20 21:10:41 -07:00

65 lines
2.8 KiB
Go

package noa
// CompressToolDescription is what the model reads next to the tool's schema.
//
// The brake in the second half is load-bearing. Tool schemas ship with every
// request whether or not a nudge fired, so the model can always see that
// Compress exists. Without an explicit instruction to wait, it may call the
// tool on its own initiative — and a summary written without the rules is an
// irreversible loss, because the range it replaced is gone from the view.
const CompressToolDescription = `Replace older conversation ranges with summaries you write. The originals are ` +
`archived to disk first. Do NOT call this on your own initiative — wait until the context manager asks you to, ` +
`and follow the rules it provides. A summary written without those rules permanently loses information.`
// CompressToolSchema is the tool's JSON Schema.
//
// Note what is NOT here: "content" carries no "type": "array".
//
// Providers without strict tool support (vLLM, some Qwen deployments) stringify
// nested array arguments. A schema that insists on an array rejects that shape
// before ParseCompressArgs ever sees it — and a turn's only compression attempt
// is lost to a validation error rather than being repaired. Omitting the type
// lets anything through to the lenient parser, which knows how to recover an
// array from a string.
func CompressToolSchema() map[string]any {
return map[string]any{
"type": "object",
"properties": map[string]any{
"topic": map[string]any{
"type": "string",
"description": "Optional short title applied to ranges that don't carry their own.",
},
"content": map[string]any{
"description": "One or more ranges to compress into separate summary blocks. Ranges must be disjoint.",
"items": map[string]any{
"type": "object",
"properties": map[string]any{
"topic": map[string]any{
"type": "string",
"description": "Short 3-5 word label for THIS range.",
},
"startId": map[string]any{
"type": "string",
"description": "mNNNNN message ref, or bN block id, at the start of the range.",
},
"endId": map[string]any{
"type": "string",
"description": "mNNNNN message ref, or bN block id, at the end of the range. Inclusive.",
},
"summary": map[string]any{
"type": "string",
"description": "Self-contained summary that replaces the range in context.",
},
},
"required": []any{"startId", "endId", "summary"},
},
},
"summaryMaxChars": map[string]any{
"type": "number",
"description": "Raise the per-summary limit above the 20000-char default. Use it when the content genuinely needs more detail — do not truncate critical information just to fit.",
},
},
"required": []any{"content"},
}
}