feat: complete WorkBuddy parity and Windows release workflow

This commit is contained in:
xiaohan.yuan committed 2026-10-18 12:45:21 +08:00
1 parent 143516b3a8
commit d5512df549
434 files changed
+54977 -1854

No files matched your search

+80 -5
View File
@@ -6,7 +6,7 @@
*/
/** 会话内的一条消息(对外视图) */
import type { ArtifactContent, ChatAttachment, ChatInteraction, MessageQuote, PlanContent, TaskContent } from './conversation'
import type { ArtifactContent, ChatAttachment, ChatInteraction, MessageQuote, PlanContent, TaskContent, UserContentBlock } from './conversation'
export interface ChatMessage {
id: string
@@ -20,6 +20,8 @@ export interface ChatMessage {
resources?: string[]
/** 发送时引用进对话的表格等内容块快照(WorkBuddy messageQuote)。 */
quotes?: MessageQuote[]
/** Ordered inline presentation, validated against content and its actual payload collections. */
userContent?: UserContentBlock[]
skills?: Array<{ id: string; name: string; uri: string }>
/** Native-history reconstruction; never includes connector credentials. */
capabilityContext?: string
@@ -28,6 +30,12 @@ export interface ChatMessage {
/** The model selected when this assistant turn started; kept with history. */
modelId?: string
modelName?: string
/** Last actual upstream request sample, with that turn's frozen window. Never a session sum. */
contextUsage?: ContextUsageSnapshot
/** Independent local counts of one prepared provider input; never a split of billed usage. */
contextBreakdown?: ContextUsageBreakdown
/** Reported request totals, including separately measured child agents. */
runUsage?: import('./subagents').RunTokenUsage
interactions?: ChatInteraction[]
requestId?: string
planId?: string
@@ -74,6 +82,7 @@ export type MessagePart =
| { type: 'task'; task: TaskContent }
| { type: 'artifact'; artifact: ArtifactContent }
| { type: 'image'; id: string; url: string; alt?: string }
| { type: 'subagent'; agent: import('./subagents').SubagentSnapshot }
/** 面向模型暴露的工具描述(OpenAI function tool 格式) */
export interface ToolSpec {
@@ -85,8 +94,14 @@ export interface ToolSpec {
}
}
/** 网关配置:一个 OpenAI 兼容的上游 */
/** Main-process resolved upstream protocol and credentials. */
export interface GatewayConfig {
api?: import('./models').ModelApi
supportsReasoning?: boolean
temperatureSupported?: boolean
thinkingLevel?: import('./workspaces').ThinkingLevel
reasoningBudget?: number
reasoningOptions?: import('./models').ModelReasoningOption[]
speechBaseUrl?: string
speechModel?: string
/** 上游 baseUrl,例如 https://api.deepseek.com/v1 */
@@ -174,7 +189,7 @@ export type PersonalizationPatch = Partial<PersonalizationSettings>
/**
* 设置 → 智能体(TODO 15)。
* 本轮只接入「智能体团队管理」这一个偏好;经济模式与浏览器操控仅按原版布局呈现并明确标注未接入。
* 智能体团队管理为本地子智能体调度总开关;经济模式与浏览器操控已按用户要求移除。
*/
export interface AgentSettings {
/** 开启后复杂任务自动拆分多个智能体协作完成(原版默认开启)。 */
@@ -183,15 +198,38 @@ export interface AgentSettings {
export type AgentSettingsPatch = Partial<AgentSettings>
/**
* 设置 → 记忆与进化(TODO 14)。
*
* 原版把“对话记忆”保存到账户侧,“本地记忆与技能”保存在本地存储
* (REA 回收 MemorySettingsPanel-BU1K5nn4.js / local-skills-memory-Bb3Kqaxi.js)。
* YCode 将两项偏好统一写入 config.json;页面展示的数据不会补造。
*/
export interface MemoryPreferences {
/** 允许已保存的长期记忆进入后续对话上下文。 */
conversationMemory: boolean
/** 本地记忆与技能偏好;自动记录执行器尚未接入。 */
localMemorySkills: boolean
}
export interface MemorySettingsView extends MemoryPreferences {
/** 当前长期记忆正文(由个性化设置的真实长期记忆字段提供)。 */
content: string
}
export type MemoryPreferencesPatch = Partial<MemoryPreferences>
/** 主进程 → 渲染进程的流式事件 */
export type ChatEvent = { sessionId?: string; turnDurationMs?: number } & (
export type ChatEvent = { sessionId?: string; turnDurationMs?: number; sequence?: number } & (
| { runId: string; type: 'started'; messageId: string }
| { runId: string; type: 'text'; delta: string }
| { runId: string; type: 'part'; part: Exclude<MessagePart, { type: 'text' } | { type: 'tool' }> }
| { runId: string; type: 'interaction'; interaction: ChatInteraction }
| { runId: string; type: 'tool_call'; call: ToolCallRecord }
| { runId: string; type: 'tool_result'; call: ToolCallRecord }
| { runId: string; type: 'usage'; usage: TokenUsage }
| { runId: string; type: 'usage'; usage: TokenUsage; contextWindow?: number; sampledAt?: number; modelId?: string; source?: ContextUsageSnapshot['source']; nativeEntryId?: string }
| { runId: string; type: 'context_breakdown'; breakdown: ContextUsageBreakdown }
| { runId: string; type: 'run_usage'; usage: import('./subagents').RunTokenUsage }
| { runId: string; type: 'done'; content: string; tools: ToolCallRecord[] }
| { runId: string; type: 'cancelled' }
| { runId: string; type: 'error'; message: string }
@@ -208,6 +246,42 @@ export interface TokenUsage {
cachedTokens?: number
}
export interface ContextUsageSnapshot {
usage: TokenUsage
/** Missing when the selected profile never declared a real context window. */
contextWindow?: number
source?: 'upstream' | 'native-history' | 'native-state'
sampledAt?: number
requestId?: string
modelId?: string
nativeEntryId?: string
}
export type ContextUsageCategory = 'system' | 'tools' | 'conversation' | 'mcp' | 'skills' | 'other'
export interface ContextUsageBreakdown {
requestId: string
/** Monotonic within a turn, so a late older request cannot replace a newer one. */
sequence: number
sampledAt: number
modelId?: string
contextWindow?: number
method: 'model-tokenizer' | 'o200k_base' | 'utf8-estimate'
scope: 'provider-request' | 'prepared-request'
counts: Record<ContextUsageCategory, number>
inputTokens: number
/** Images or an unavailable provider layer mean these counts are partial. */
partial: boolean
}
/** A read-only query never creates or switches an agent to obtain a number. */
export interface ContextUsageInfo {
sample?: ContextUsageSnapshot
breakdown?: ContextUsageBreakdown
status: 'latest' | 'previous' | 'unavailable'
reason?: string
}
/**
* 会话工作目录的 Git 信息(用于对话框的分支标签)。
* `repo: false` 表示该目录不在 Git 仓库内;`detached: true` 时 `branch` 为空、`head` 为短 SHA。
@@ -226,6 +300,7 @@ export interface GitBranchInfo {
/** 一次会话的元信息 */
export interface SessionMeta {
projectId?: string
id: string
title: string
createdAt: number