fix: stabilize Runtime workflows for 0.12.3
OpenCode status checks could cold-start throwaway servers, unrelated conversations could block each other, and model, Continue, or remote paths could replay or duplicate work under failure and backlog conditions. Settings could also lose edits or overwrite unrelated model fields. This update makes status checks passive, keeps per-conversation ordering while allowing concurrency, preserves native long-running work with bounded display capture and backpressure, narrows retries to known pre-dispatch failures, and aligns remote Ask permissions without reducing Execute. It also keeps Embedding updates narrow, improves settings and browser guidance, removes the unused legacy Main gateway state, and records the validated Desktop 0.12.3 and Agent 0.11.17 release metadata. Release note: 改善 OpenCode 切换、多会话长任务、模型重试、远程 Ask/Execute 与设置保存可靠性,并完成 Desktop 0.12.3 / Agent 0.11.17 发布准备。
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { ResolvedModelProfile } from '../runtime-settings-store'
|
||||
import { createManagedModelBridge } from './managed-model-bridge'
|
||||
import {
|
||||
createManagedModelBridge,
|
||||
createResolvedModelProfileDigest
|
||||
} from './managed-model-bridge'
|
||||
|
||||
const profile: ResolvedModelProfile = {
|
||||
id: '00000000-0000-4000-8000-000000000001',
|
||||
@@ -80,4 +83,22 @@ describe('managed Agent prompt model setup', () => {
|
||||
})
|
||||
).toThrow(/usable text model profile/iu)
|
||||
})
|
||||
|
||||
it('binds request customization but not credentials into the profile digest', () => {
|
||||
expect(
|
||||
createResolvedModelProfileDigest({
|
||||
...profile,
|
||||
apiKey: 'different-secret'
|
||||
})
|
||||
).toBe(createResolvedModelProfileDigest(profile))
|
||||
expect(
|
||||
createResolvedModelProfileDigest({
|
||||
...profile,
|
||||
requestBody: {
|
||||
...profile.requestBody,
|
||||
temperature: 0.4
|
||||
}
|
||||
})
|
||||
).not.toBe(createResolvedModelProfileDigest(profile))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { canonicalJson } from '../../shared/agent-protocol/canonical'
|
||||
import {
|
||||
agentPromptModelProfileSchema,
|
||||
modelBridgePolicySchema,
|
||||
type AgentPromptModelProfile,
|
||||
type ModelBridgePolicy
|
||||
} from '../../shared/model-bridge-contracts'
|
||||
import { createResolvedModelProfileDigest } from '../agent/remote-model-gateway'
|
||||
import type { ResolvedModelProfile } from '../runtime-settings-store'
|
||||
|
||||
const DEFAULT_MAXIMUM_OUTPUT_TOKENS = 32_000
|
||||
@@ -19,6 +20,32 @@ export type ManagedModelBridge = {
|
||||
profile: AgentPromptModelProfile
|
||||
}
|
||||
|
||||
export function createResolvedModelProfileDigest(
|
||||
profile: ResolvedModelProfile
|
||||
): string {
|
||||
const canonical = canonicalJson({
|
||||
id: profile.id,
|
||||
name: profile.name,
|
||||
baseUrl: profile.baseUrl,
|
||||
modelName: profile.modelName,
|
||||
protocol: profile.protocol,
|
||||
authentication: profile.authentication,
|
||||
supportsImageInput: profile.supportsImageInput === true,
|
||||
contextWindowTokens: profile.contextWindowTokens ?? null,
|
||||
maximumOutputTokens: profile.maximumOutputTokens ?? null,
|
||||
imageGenerationQuality: profile.imageGenerationQuality ?? null,
|
||||
requestHeaders: Object.fromEntries(
|
||||
Object.entries(profile.requestHeaders ?? {}).map(
|
||||
([name, value]) => [name.toLowerCase(), value]
|
||||
)
|
||||
),
|
||||
requestBody: profile.requestBody ?? {}
|
||||
})
|
||||
return `sha256:${createHash('sha256')
|
||||
.update(canonical)
|
||||
.digest('hex')}`
|
||||
}
|
||||
|
||||
export function createManagedModelBridge(options: {
|
||||
profile: ResolvedModelProfile
|
||||
}): ManagedModelBridge {
|
||||
|
||||
Reference in New Issue
Block a user