refactor(agent): replace OMP with Claude Code kernel

This commit is contained in:
xiaohan.yuan committed 2026-10-20 14:47:56 +08:00
1 parent 0fb2226f8c
commit 9a1f182397
232 files changed
+2561 -25564

No files matched your search

+13 -17
View File
@@ -2,7 +2,7 @@
* 主进程 / 渲染进程共享的类型与 IPC 契约。
*
* 已存 API Key 不返回渲染进程;用户可在模型表单编辑地址和新密钥。
* 模型网络请求经由主进程网关或 OMP 子进程完成。
* 对话由主进程 Claude Code 内核完成;模型配置与连接测试仍在主进程。
*/
/** 会话内的一条消息(对外视图) */
@@ -23,9 +23,6 @@ export interface ChatMessage {
/** 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
expertId?: string
assistantDisplay?: import('./capabilities').ExpertBinding
/** The model selected when this assistant turn started; kept with history. */
modelId?: string
@@ -34,13 +31,11 @@ export interface ChatMessage {
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
/** Last top-level Claude chain entry for this assistant turn, used only as a fork point. */
claudeEntryId?: string
planId?: string
nativeEntryId?: string
nativeSessionPath?: string
feedback?: 'like' | 'dislike'
interrupted?: boolean
createdAt: number
@@ -82,7 +77,6 @@ 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 {
@@ -227,9 +221,8 @@ export type ChatEvent = { sessionId?: string; turnDurationMs?: number; sequence?
| { 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; contextWindow?: number; sampledAt?: number; modelId?: string; source?: ContextUsageSnapshot['source']; nativeEntryId?: string }
| { runId: string; type: 'usage'; usage: TokenUsage; contextWindow?: number; sampledAt?: number; modelId?: string; source?: ContextUsageSnapshot['source'] }
| { 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 }
@@ -250,11 +243,10 @@ export interface ContextUsageSnapshot {
usage: TokenUsage
/** Missing when the selected profile never declared a real context window. */
contextWindow?: number
source?: 'upstream' | 'native-history' | 'native-state'
source?: 'upstream'
sampledAt?: number
requestId?: string
modelId?: string
nativeEntryId?: string
}
export type ContextUsageCategory = 'system' | 'tools' | 'conversation' | 'mcp' | 'skills' | 'other'
@@ -311,6 +303,10 @@ export interface SessionMeta {
expertId?: string | null
agentMode?: import('./conversation').AgentMode
thinkingLevel?: import('./workspaces').ThinkingLevel
/** Claude Code session used for this YCode conversation. */
claudeSessionId?: string
/** Pending Claude fork point for edit/regenerate. */
claudeForkAt?: string
/** 置顶时间(毫秒)。有值即视为已置顶,用于侧栏任务排序,不改变 createdAt/updatedAt 语义。 */
pinnedAt?: number
/** 归档时间(毫秒)。归档任务从默认任务列表移出,但不删除消息与工作目录。 */
@@ -336,11 +332,11 @@ export interface AppInfo {
chrome: string
node: string
configDir: string
/** OMP 内核状态(未探测到时 available 为 false) */
omp: {
/** Claude Code 内核状态(未探测到时 available 为 false) */
claude: {
available: boolean
exePath: string | null
profile: string
model: string | null
sessionDir: string
version?: string
}
}