fix: allow concurrent and unrestricted Runtime sessions
Local embedded OpenCode serialized otherwise independent conversations, and GoodBuddy could stop long Runtime tasks after fixed tool, activity, model-call, or accumulated display-output limits. Different conversations can now run concurrently while requests in the same conversation stay ordered. Dynamic MCP tools remain isolated to the current request. OpenCode, Continue, managed ACP, and the Agent model gateway no longer stop native execution at GoodBuddy-defined call counts or prompt-wide output totals; display copies truncate and transport queues apply backpressure instead. Prompt-wide quota fields are removed from the current contracts. Per-call model settings, provider request timeouts, cancellation, and same-conversation ordering remain unchanged. Release note: 修复本机 OpenCode 不同会话互相等待的问题,并移除 GoodBuddy 对单次 Runtime 工具、活动和模型调用次数的人为上限;长输出现在只截断展示或施加传输背压,不再取消原生任务。
This commit is contained in:
@@ -64,7 +64,6 @@ export type ContinueRuntimeOptions = {
|
||||
// The prompt reaches the Continue host through a local HTTP POST body, so no
|
||||
// platform command-line limit applies to it.
|
||||
const MAX_CONTINUE_PROMPT_CHARACTERS = 128_000
|
||||
const MAX_QUEUED_STREAM_EVENTS = 1_000
|
||||
const scopedReadToolNameSet = new Set<string>(scopedReadToolNames)
|
||||
|
||||
function continueToolFailureMessage(tool: ContinueHostTool): string {
|
||||
@@ -548,6 +547,7 @@ export class ContinueAgentRuntime implements AgentRuntime {
|
||||
}
|
||||
let result: ContinueHostRunResult
|
||||
const emittedTools = new Map<string, ContinueHostTool>()
|
||||
let emittedText = ''
|
||||
const requestQuestionIds = new Set<string>()
|
||||
try {
|
||||
const host = this.getHostAdapter(
|
||||
@@ -574,9 +574,6 @@ export class ContinueAgentRuntime implements AgentRuntime {
|
||||
const hostController = new AbortController()
|
||||
const hostSignal = AbortSignal.any([signal, hostController.signal])
|
||||
const onEvent = (event: ContinueHostStreamEvent): void => {
|
||||
if (queuedEvents.length >= MAX_QUEUED_STREAM_EVENTS) {
|
||||
throw new Error('Continue 流式事件积压超过安全限制')
|
||||
}
|
||||
queuedEvents.push(event)
|
||||
wakeStream?.()
|
||||
wakeStream = undefined
|
||||
@@ -623,6 +620,7 @@ export class ContinueAgentRuntime implements AgentRuntime {
|
||||
emittedTools.set(event.tool.callId, event.tool)
|
||||
}
|
||||
if (event.type === 'text') {
|
||||
emittedText += event.delta
|
||||
yield {
|
||||
requestId: request.requestId,
|
||||
type: 'text',
|
||||
@@ -742,11 +740,25 @@ export class ContinueAgentRuntime implements AgentRuntime {
|
||||
yield finalEvent
|
||||
}
|
||||
}
|
||||
if (!result.streamedText) {
|
||||
if (result.streamTruncated) {
|
||||
yield {
|
||||
requestId: request.requestId,
|
||||
type: 'text',
|
||||
delta: result.text
|
||||
type: 'status',
|
||||
message:
|
||||
'Continue 输出较长,已截断部分流式展示;任务已继续完成'
|
||||
}
|
||||
}
|
||||
if (!result.streamedText || result.streamTruncated) {
|
||||
const remainingText =
|
||||
result.streamTruncated && result.text.startsWith(emittedText)
|
||||
? result.text.slice(emittedText.length)
|
||||
: result.text
|
||||
if (remainingText) {
|
||||
yield {
|
||||
requestId: request.requestId,
|
||||
type: 'text',
|
||||
delta: remainingText
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.usage) {
|
||||
|
||||
Reference in New Issue
Block a user