fix: reuse runtime processes across project sessions

Multiple projects could spawn duplicate heavyweight runtimes, while settings
changes and remote reconnection could cancel or strand native conversations.
Share compatible local OpenCode and DeepSeek Harness process owners and
Agent-owned ACP connections, retaining workspace routing, per-session modes,
model attribution, question ownership, targeted cancellation and idle cleanup.

Restore remote pending questions and terminal task projections across reconnect
and desktop restart, and preserve accepted ordinary requests during settings
replacement while cancelling expert-team parents with their replaced scheduler.
Extend regression coverage and Agent type checks. Record measured resource and
real-model validation results, including failures and limitations.

Also include the conversation media-generation design drafts (not an implemented
feature), documentation entry links and dedicated Linux test-directory guidance.
Desktop and Agent changes must be delivered together for shared process results.

Validation: typecheck and lint passed; staged content and documentation links
checked. Prior full regression and live-model evidence are recorded in progress
notes; no new full test suite or model calls were run for this commit.

Release note: 多项目会话现在复用兼容的 OpenCode 和 DeepSeek Harness 进程,减少重复启动并保持工作区、工具和取消隔离。修复远端问答在断线、重启及配置更新后的恢复与状态同步问题,Desktop 与 Agent 需配套更新。
This commit is contained in:
mesalogo
2026-09-15 08:14:42 +08:00
parent b755951ecd
commit e5aa9ed688
65 changed files with 4116 additions and 365 deletions
+6 -1
View File
@@ -86,6 +86,9 @@ export type RuntimeConversationCompactOutcome = {
}
export interface AgentRuntime {
/** A workspace facade whose sessions are owned by a shared local Runtime. */
readonly sharedProcess?: boolean
readonly hasRetainedSessions?: boolean
readonly runtimeId?: AgentRuntimeStatus['id']
readonly requiresToolApproval: boolean
readonly supportsToolExecution: boolean
@@ -94,7 +97,7 @@ export interface AgentRuntime {
readonly capability?: 'chat' | 'image-generation'
getStatus(): Promise<AgentRuntimeStatus>
testConnection?(): Promise<AgentRuntimeStatus>
getNativeSnapshot?(): Promise<RuntimeNativeSnapshot>
getNativeSnapshot?(workspace?: string): Promise<RuntimeNativeSnapshot>
compactConversation?(
request: RuntimeConversationCompactInput,
signal: AbortSignal
@@ -132,6 +135,8 @@ export type RemoteRecoveredSubagent =
ConversationSubagentActivity
export type AgentExecutionRequest = Omit<AgentRequest, 'workMode'> & {
/** Resolved Main-side workspace, never taken from the current UI selection. */
executionWorkspace?: string
workMode?: WorkMode
images?: AgentImage[]
imageContextNotice?: ConversationMessage['imageContextNotice']