chore: prepare GoodBuddy 0.8.2
Cross-platform packages / Validate source (push) Waiting to run
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, windows, windows-2025) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, macos, macos-15-intel) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
Cross-platform packages / Publish GitHub Release (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
Cross-platform packages / Validate source (push) Waiting to run
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, windows, windows-2025) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, macos, macos-15-intel) (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
Cross-platform packages / Publish GitHub Release (push) Blocked by required conditions
Cross-platform packages / ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
This commit is contained in:
@@ -73,22 +73,38 @@ export class AgentRuntimeController implements AgentRuntime {
|
||||
}
|
||||
|
||||
async getStatus(): Promise<AgentRuntimeStatus> {
|
||||
const slot = this.current
|
||||
const status = await slot.runtime.getStatus()
|
||||
return {
|
||||
...status,
|
||||
supportsToolExecution: slot.runtime.supportsToolExecution
|
||||
}
|
||||
return this.probe((runtime) => runtime.getStatus())
|
||||
}
|
||||
|
||||
async testConnection(): Promise<AgentRuntimeStatus> {
|
||||
const slot = this.current
|
||||
const status = await (
|
||||
slot.runtime.testConnection?.() ?? slot.runtime.getStatus()
|
||||
return this.probe(
|
||||
(runtime) =>
|
||||
runtime.testConnection?.() ?? runtime.getStatus()
|
||||
)
|
||||
return {
|
||||
...status,
|
||||
supportsToolExecution: slot.runtime.supportsToolExecution
|
||||
}
|
||||
|
||||
private async probe(
|
||||
operation: (runtime: AgentRuntime) => Promise<AgentRuntimeStatus>
|
||||
): Promise<AgentRuntimeStatus> {
|
||||
if (this.closing) {
|
||||
throw new Error('Agent Runtime 正在关闭')
|
||||
}
|
||||
const slot = this.current
|
||||
slot.activeRequests += 1
|
||||
try {
|
||||
const status = await operation(slot.runtime)
|
||||
if (slot !== this.current) {
|
||||
throw new Error('Runtime 已切换,请重试')
|
||||
}
|
||||
return {
|
||||
...status,
|
||||
supportsToolExecution: slot.runtime.supportsToolExecution
|
||||
}
|
||||
} finally {
|
||||
slot.activeRequests -= 1
|
||||
if (slot.retiring && slot.activeRequests === 0) {
|
||||
await this.disposeSlot(slot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +113,9 @@ export class AgentRuntimeController implements AgentRuntime {
|
||||
signal: AbortSignal,
|
||||
authorize?: RuntimeAuthorizer
|
||||
): AsyncGenerator<RuntimeEvent, void, void> {
|
||||
if (this.closing) {
|
||||
throw new Error('Agent Runtime 正在关闭')
|
||||
}
|
||||
const slot = this.current
|
||||
const toolsAllowed = request.workMode === 'execute'
|
||||
const effectiveAuthorize: RuntimeAuthorizer | undefined = toolsAllowed
|
||||
|
||||
Reference in New Issue
Block a user