Extend messages and context observation for variants #21
@@ -164,11 +164,20 @@ type RunCompletedPayload struct {
|
||||
Context *ContextObservation `json:"context,omitempty"`
|
||||
}
|
||||
|
||||
// ContextSection 是组装结果里一段的估算。EstTokens 用 UTF-8 字节数 / 3.35,
|
||||
// 再按上一请求的真实用量校准。
|
||||
type ContextSection struct {
|
||||
Name string `json:"name"`
|
||||
EstTokens int `json:"estTokens"`
|
||||
}
|
||||
|
||||
// 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"` // 估算输入字符量
|
||||
Items []string `json:"items"` // 如 system(画像) / history(12) / attachments(1) / knowledge(3)
|
||||
Truncations []string `json:"truncations,omitempty"` // 裁剪记录(历史超窗/工具结果超限/附件截断)
|
||||
EstChars int `json:"estChars"` // 估算输入量(token;字段名保持兼容)
|
||||
Sections []ContextSection `json:"sections,omitempty"`
|
||||
PrefixHash string `json:"prefixHash,omitempty"` // 系统前缀哈希,前缀不变时保持稳定
|
||||
}
|
||||
|
||||
type RunFailedPayload struct {
|
||||
|
||||
@@ -36,9 +36,11 @@ type Conversation struct {
|
||||
AllowCrossRead bool `json:"allowCrossRead,omitempty"` // 跨会话出站:本会话读取同项目其他会话记录(需项目开关 crossSession.read)
|
||||
CrossPrivate bool `json:"crossPrivate,omitempty"` // 跨会话入站:私有会话,不被他读、不出现在他方列表
|
||||
// PermissionMode 是会话权限:空或 default 沿用画像;plan 只读加计划工具;auto_edit 放行工作区写文件。
|
||||
PermissionMode string `json:"permissionMode,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
PermissionMode string `json:"permissionMode,omitempty"`
|
||||
// SessionNote 是本会话要求,组装时附在上下文末尾,不进入系统前缀。
|
||||
SessionNote string `json:"sessionNote,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// ---- 消息与部件 ----
|
||||
@@ -74,6 +76,11 @@ type Message struct {
|
||||
Role Role `json:"role"`
|
||||
Parts []Part `json:"parts"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
// Excluded 为真时界面仍显示,但组装上下文时整条(及同一 run 的成组消息)不送入模型。
|
||||
Excluded bool `json:"excluded,omitempty"`
|
||||
// VariantGroup 把同一轮的候选回复绑在一起。只把未排除的那条送入模型。
|
||||
VariantGroup string `json:"variantGroup,omitempty"`
|
||||
VariantIndex int `json:"variantIndex,omitempty"`
|
||||
}
|
||||
|
||||
// Part 是判别联合:Type 决定哪些字段有意义;未用字段为零值。
|
||||
|
||||
+11
@@ -16,6 +16,7 @@ export interface Conversation {
|
||||
pinned?: boolean; archived?: boolean;
|
||||
allowCrossRead?: boolean; crossPrivate?: boolean;
|
||||
permissionMode?: 'default' | 'plan' | 'auto_edit' | '';
|
||||
sessionNote?: string;
|
||||
createdAt: string; updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -43,6 +44,9 @@ export interface Part {
|
||||
export interface Message {
|
||||
id: ID; conversationId: ID; runId?: ID; role: Role;
|
||||
parts: Part[]; createdAt: string;
|
||||
excluded?: boolean;
|
||||
variantGroup?: string;
|
||||
variantIndex?: number;
|
||||
}
|
||||
|
||||
export type RunKind = 'conversation' | 'subagent' | 'tool';
|
||||
@@ -109,10 +113,17 @@ export interface RunCompletedPayload {
|
||||
context?: ContextObservation
|
||||
}
|
||||
|
||||
export interface ContextSection {
|
||||
name: string
|
||||
estTokens: number
|
||||
}
|
||||
|
||||
export interface ContextObservation {
|
||||
items: string[]
|
||||
truncations?: string[]
|
||||
estChars: number
|
||||
sections?: ContextSection[]
|
||||
prefixHash?: string
|
||||
}
|
||||
export interface RunCheckPayload { passed: boolean; reason?: string }
|
||||
export interface RunFailedPayload { code: string; message: string }
|
||||
|
||||
Reference in New Issue
Block a user