feat: add native runtime customization
OpenCode and Continue customization was previously planned but unavailable, and Runtime-native capabilities were not represented consistently across providers. GoodBuddy now provides secure Main-owned customization settings, truthful native inventories, OpenCode Agents and Commands, Continue Rules and Prompts, DSH Web Search/Fetch, MCP Prompt and Resource metadata, and manual compaction where supported. Native capabilities are presented in eleven accessible tabs with Tools separated from Commands, LSP, and Formatters. Tool source and Ask/Execute availability are explicit, external OpenCode remains connection-only, Continue reports unsupported static tool discovery instead of advertising unreachable Skills, and disposable inventory probes avoid retaining background runtimes. Ask remains read-only at the Runtime boundary, Execute keeps the existing authorization controls, and credentials remain confined to Main. Release note: 新增 OpenCode、Continue 与 DeepSeek Harness 的 Runtime 原生定制与真实能力清单;工具来源、Ask/Execute 可用性、上下文压缩和 MCP 元数据现在可清晰查看,同时继续保持 Main 进程凭据保护与现有权限边界。
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import type {
|
||||
AgentQuestionAnswer,
|
||||
AgentRuntimeStatus
|
||||
AgentRuntimeStatus,
|
||||
RuntimeConversationCompactInput,
|
||||
RuntimeNativeSnapshot
|
||||
} from '../../shared/contracts'
|
||||
import type {
|
||||
AgentExecutionRequest,
|
||||
AgentRuntime,
|
||||
RuntimeAuthorizer,
|
||||
RuntimeConversationCompactOutcome,
|
||||
RuntimeEvent
|
||||
} from './runtime'
|
||||
|
||||
@@ -81,19 +84,50 @@ export class AgentRuntimeController implements AgentRuntime {
|
||||
}
|
||||
|
||||
async getStatus(): Promise<AgentRuntimeStatus> {
|
||||
return this.probe((runtime) => runtime.getStatus())
|
||||
return this.probeStatus((runtime) => runtime.getStatus())
|
||||
}
|
||||
|
||||
async testConnection(): Promise<AgentRuntimeStatus> {
|
||||
return this.probe(
|
||||
return this.probeStatus(
|
||||
(runtime) =>
|
||||
runtime.testConnection?.() ?? runtime.getStatus()
|
||||
)
|
||||
}
|
||||
|
||||
private async probe(
|
||||
async getNativeSnapshot(): Promise<RuntimeNativeSnapshot> {
|
||||
return this.invoke((runtime) => {
|
||||
if (!runtime.getNativeSnapshot) {
|
||||
throw new Error('当前 Runtime 不支持原生能力清单')
|
||||
}
|
||||
return runtime.getNativeSnapshot()
|
||||
})
|
||||
}
|
||||
|
||||
async compactConversation(
|
||||
request: RuntimeConversationCompactInput,
|
||||
signal: AbortSignal
|
||||
): Promise<RuntimeConversationCompactOutcome> {
|
||||
return this.invoke((runtime) => {
|
||||
if (!runtime.compactConversation) {
|
||||
throw new Error('当前 Runtime 不支持手动压缩')
|
||||
}
|
||||
return runtime.compactConversation(request, signal)
|
||||
})
|
||||
}
|
||||
|
||||
private async probeStatus(
|
||||
operation: (runtime: AgentRuntime) => Promise<AgentRuntimeStatus>
|
||||
): Promise<AgentRuntimeStatus> {
|
||||
const status = await this.invoke(operation)
|
||||
return {
|
||||
...status,
|
||||
supportsToolExecution: this.current.runtime.supportsToolExecution
|
||||
}
|
||||
}
|
||||
|
||||
private async invoke<T>(
|
||||
operation: (runtime: AgentRuntime) => Promise<T>
|
||||
): Promise<T> {
|
||||
if (this.closing) {
|
||||
throw new Error('Agent Runtime 正在关闭')
|
||||
}
|
||||
@@ -104,10 +138,7 @@ export class AgentRuntimeController implements AgentRuntime {
|
||||
if (slot !== this.current) {
|
||||
throw new Error('Runtime 已切换,请重试')
|
||||
}
|
||||
return {
|
||||
...status,
|
||||
supportsToolExecution: slot.runtime.supportsToolExecution
|
||||
}
|
||||
return status
|
||||
} finally {
|
||||
slot.activeRequests -= 1
|
||||
if (slot.retiring && slot.activeRequests === 0) {
|
||||
|
||||
Reference in New Issue
Block a user