feat: add managed SSH execution spaces

Add managed SSH Hosts and projects with signed side-by-side GoodBuddy Agent and OpenCode Runtime installation, Ask and Execute workspace access, a Main-owned model bridge, detached Agent lifecycle, durable ACP output recovery, and project activation UI.

Use protocol v2 with bounded FIFO frames over SSH instead of custom credit, priority, batching, or model-message chunking. Mismatched Host Agents now upgrade automatically, an exactly verified Node runtime is reused on-host, and local Portable builds can embed strictly verified Agent artifacts.

Release note: 新增托管 SSH 远程项目,可自动安装或升级签名 Agent/OpenCode Runtime,并在 SSH 断线后继续 Agent 工作和同步未确认输出。
This commit is contained in:
mesalogo
2026-08-24 23:02:18 +08:00
parent 3829a871f5
commit 607bb33249
258 changed files with 99449 additions and 2427 deletions
+33 -3
View File
@@ -30,6 +30,14 @@ import type { ModelToolProviderLike } from './model-tool-provider'
import type { KnowledgeMcpGateway } from './knowledge-mcp-gateway'
import { ModelToolProvider } from './model-tool-provider'
import type { ControlledHarnessExtensionPackage } from './deepseek-harness-extension-loader'
import {
LocalWorkspaceAccess,
type WorkspaceAccess
} from '../workspace'
import {
REMOTE_EXECUTION_SPACE_UNAVAILABLE,
type ExecutionSpaceDescriptor
} from '../execution-space'
const noSubagentTools: ModelToolProviderLike = {
listTools: async () => [],
@@ -55,6 +63,8 @@ export type AgentCapabilityContext = {
browserService?: BrowserToolService
knowledgeGateway?: KnowledgeMcpGateway
webSearchEnabled?: boolean
executionSpace?: ExecutionSpaceDescriptor
workspaceAccess?: WorkspaceAccess
}
function resolveContextCompression(
@@ -145,15 +155,34 @@ export function createAgentRuntime(
settings?: ResolvedRuntimeSettings,
capabilities: AgentCapabilityContext = {}
): AgentRuntime {
const executionSpace = capabilities.executionSpace
const remote = executionSpace?.kind === 'ssh'
const baseUrl = (
settings?.opencodeBaseUrl ||
process.env.GOODBUDDY_OPENCODE_URL ||
''
).trim()
const embedded = !baseUrl
const workspace = settings?.workspacePath || defaultWorkspace
const workspace =
executionSpace?.kind === 'local'
? executionSpace.rootPath
: settings?.workspacePath || defaultWorkspace
const getWorkspaceAccess = (): WorkspaceAccess =>
capabilities.workspaceAccess ??
executionSpace?.workspaceAccess ??
new LocalWorkspaceAccess(workspace)
const provider = settings?.provider ?? defaultRuntimeSettings.provider
if (
remote &&
(provider === 'continue' ||
provider === 'opencode' ||
provider === 'deepseek-harness' ||
provider === 'auto')
) {
throw new Error(REMOTE_EXECUTION_SPACE_UNAVAILABLE)
}
if (provider === 'deepseek-harness') {
const profile = settings?.deepseekHarnessModelProfile
if (!profile || !isDeepSeekHarnessModelProfile(profile)) {
@@ -179,7 +208,7 @@ export function createAgentRuntime(
skillPackages: capabilities.skillPackages,
extensionPackages: capabilities.deepseekHarnessExtensions,
toolProvider: new ModelToolProvider(
workspace,
getWorkspaceAccess(),
capabilities.mcpServers,
undefined,
capabilities.knowledgeGateway,
@@ -311,7 +340,8 @@ export function createAgentRuntime(
webSearchEnabled: capabilities.webSearchEnabled,
contextCompression: settings
? resolveContextCompression(settings, defaultModelProfile)
: undefined
: undefined,
workspaceAccess: getWorkspaceAccess()
})
}