Add the context assembly observation to the run-completed payload
Details (original message): Add the context assembly observation to the run-completed payload (items, truncations, estimated size).
This commit is contained in:
@@ -177,3 +177,11 @@ func contains(s, sub string) bool {
|
||||
return false
|
||||
})()
|
||||
}
|
||||
|
||||
func TestGoldenContextObservation(t *testing.T) {
|
||||
golden(t, "context_observation", ContextObservation{
|
||||
Items: []string{"system(画像)", "history(12)", "attachments(1)", "knowledge(3)"},
|
||||
Truncations: []string{"历史 47 条超窗口 40,仅保留最近部分", "工具结果超长,转工件引用"},
|
||||
EstChars: 18234,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -110,6 +110,15 @@ type ArtifactPayload struct {
|
||||
|
||||
type RunCompletedPayload struct {
|
||||
Usage Usage `json:"usage"`
|
||||
// Context 为该次运行的上下文组装观测(4.10/4.17:构成 + 裁剪记录;可解释性)。
|
||||
Context *ContextObservation `json:"context,omitempty"`
|
||||
}
|
||||
|
||||
// ContextObservation 记录一次模型输入的实际构成与预算裁剪(ctxasm 产出)。
|
||||
type ContextObservation struct {
|
||||
Items []string `json:"items"` // 如 system(画像) / history(12) / attachments(1) / knowledge(3)
|
||||
Truncations []string `json:"truncations,omitempty"` // 裁剪记录(历史超窗/工具结果超限/附件截断)
|
||||
EstChars int `json:"estChars"` // 估算输入字符量
|
||||
}
|
||||
|
||||
type RunFailedPayload struct {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"items": [
|
||||
"system(画像)",
|
||||
"history(12)",
|
||||
"attachments(1)",
|
||||
"knowledge(3)"
|
||||
],
|
||||
"truncations": [
|
||||
"历史 47 条超窗口 40,仅保留最近部分",
|
||||
"工具结果超长,转工件引用"
|
||||
],
|
||||
"estChars": 18234
|
||||
}
|
||||
+10
-1
@@ -93,7 +93,16 @@ export interface AgentSpawnPayload { agentRun: ID; name: string; task: string }
|
||||
export interface AgentProgressPayload { agentRun: ID; note?: string; phase?: RunPhase }
|
||||
export interface AgentResultPayload { agentRun: ID; status: RunStatus; summary?: string }
|
||||
export interface HITLResolvedPayload { cardId: ID; answer?: string; kind: 'choice' | 'free' | 'timeout' | 'cancelled' }
|
||||
export interface RunCompletedPayload { usage: Usage }
|
||||
export interface RunCompletedPayload {
|
||||
usage: Usage
|
||||
context?: ContextObservation
|
||||
}
|
||||
|
||||
export interface ContextObservation {
|
||||
items: string[]
|
||||
truncations?: string[]
|
||||
estChars: number
|
||||
}
|
||||
export interface RunFailedPayload { code: string; message: string }
|
||||
|
||||
// ---- HITL ----
|
||||
|
||||
Reference in New Issue
Block a user