GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build Linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build Linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Managed SSH project selection repeatedly activated the remote Host and could leave idle ACP bindings rejected as stale-controller after a controller generation change. Host environment updates also coupled project state to component installation evidence and presented a crowded control surface. Project selection is now local-only, one Host connection serves compatible project and conversation callers, idle bindings are safely replaced only after proven controller takeover, and active prompts keep exact resume/replay. Remote environment setup now uses explicit signed compound package preparation with bounded transfer, rollback, recovery, and clearer settings. Managed Hosts must be updated to separately distributed Agent 0.11.6 before the daemon-side controller recovery fix takes effect. Desktop packages do not embed the Agent or remote Runtime, and existing project data is preserved. Release note: 托管 SSH 项目切换不再重复连接,同一 Host 可顺畅承载多个项目和对话;同时修复重连后的 stale-controller,并优化远程环境安装、更新与状态布局。
130 lines
4.0 KiB
TypeScript
130 lines
4.0 KiB
TypeScript
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import type { AgentReleaseKeyRegistry } from '../../shared/agent-installation-contracts'
|
|
import type { RemoteRuntimeLock } from '../../shared/remote-runtime-launch-contracts'
|
|
import type { BundledRemoteRuntimeResourcePaths } from './bundled-remote-runtime-resources'
|
|
import { loadRemoteRuntimeVerificationMetadata } from './remote-runtime-resource-loader'
|
|
|
|
const temporaryDirectories: string[] = []
|
|
const registry: AgentReleaseKeyRegistry = {
|
|
formatVersion: 1,
|
|
keys: [],
|
|
revocations: []
|
|
}
|
|
const runtimeLock: RemoteRuntimeLock = {
|
|
formatVersion: 1,
|
|
runtimes: {
|
|
opencode: {
|
|
version: '1.18.9',
|
|
provider: 'opencode',
|
|
entrypoint: 'bin/opencode',
|
|
entrypointIdentity: 'opencode-acp',
|
|
argvPrefix: ['acp'],
|
|
allowedEnvironmentNames: [
|
|
'HOME', 'LANG', 'LC_ALL', 'PATH', 'TMPDIR',
|
|
'XDG_CACHE_HOME', 'XDG_CONFIG_HOME', 'XDG_DATA_HOME',
|
|
'XDG_STATE_HOME'
|
|
],
|
|
protocol: { major: 1, minor: 0 },
|
|
targets: {
|
|
x64: {
|
|
package: 'opencode-linux-x64-baseline',
|
|
integrity: `sha512-${'A'.repeat(86)}==`
|
|
},
|
|
arm64: {
|
|
package: 'opencode-linux-arm64',
|
|
integrity: `sha512-${'B'.repeat(86)}==`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function canonical(value: unknown): Buffer {
|
|
return Buffer.from(`${JSON.stringify(value, null, 2)}\n`, 'utf8')
|
|
}
|
|
|
|
afterEach(async () => {
|
|
await Promise.all(temporaryDirectories.splice(0).map((directory) =>
|
|
rm(directory, { recursive: true, force: true })
|
|
))
|
|
})
|
|
|
|
async function createFixture(): Promise<{
|
|
root: string
|
|
paths: BundledRemoteRuntimeResourcePaths
|
|
}> {
|
|
const root = await mkdtemp(join(tmpdir(), 'runtime-metadata-loader-'))
|
|
temporaryDirectories.push(root)
|
|
const paths: BundledRemoteRuntimeResourcePaths = {
|
|
keyRegistryPath: join(root, 'agent-release-keys.json'),
|
|
runtimeLockPath: join(root, 'remote-runtime-lock.json'),
|
|
runtimeRoots: {
|
|
x64: join(root, 'unused-x64'),
|
|
arm64: join(root, 'unused-arm64')
|
|
}
|
|
}
|
|
await Promise.all([
|
|
writeFile(paths.keyRegistryPath, canonical(registry)),
|
|
writeFile(paths.runtimeLockPath, canonical(runtimeLock))
|
|
])
|
|
return { root, paths }
|
|
}
|
|
|
|
describe('remote Runtime verification metadata loader', () => {
|
|
it('loads canonical verification metadata without Runtime payloads', async () => {
|
|
const fixture = await createFixture()
|
|
|
|
await expect(
|
|
loadRemoteRuntimeVerificationMetadata(fixture.paths)
|
|
).resolves.toEqual({
|
|
releaseKeyRegistry: registry,
|
|
runtimeLock,
|
|
canonicalReleaseKeyRegistryBytes: canonical(registry),
|
|
canonicalRemoteRuntimeLockBytes: canonical(runtimeLock)
|
|
})
|
|
})
|
|
|
|
it('canonicalizes equivalent release-key registry formatting', async () => {
|
|
const fixture = await createFixture()
|
|
await writeFile(
|
|
fixture.paths.keyRegistryPath,
|
|
canonical(registry).toString('utf8').replace(/\n/gu, '\r\n')
|
|
)
|
|
|
|
await expect(
|
|
loadRemoteRuntimeVerificationMetadata(fixture.paths)
|
|
).resolves.toMatchObject({
|
|
releaseKeyRegistry: registry,
|
|
canonicalReleaseKeyRegistryBytes: canonical(registry)
|
|
})
|
|
})
|
|
|
|
it.each([
|
|
{ bytes: Buffer.from('not json\n'), error: 'invalid JSON' },
|
|
{
|
|
bytes: Buffer.alloc(1024 * 1024 + 1, 0x20),
|
|
error: 'exceeds its safety limit'
|
|
}
|
|
])('rejects invalid bounded metadata', async ({ bytes, error }) => {
|
|
const fixture = await createFixture()
|
|
await writeFile(fixture.paths.runtimeLockPath, bytes)
|
|
|
|
await expect(
|
|
loadRemoteRuntimeVerificationMetadata(fixture.paths)
|
|
).rejects.toThrow(error)
|
|
})
|
|
|
|
it('rejects metadata paths that are not regular files', async () => {
|
|
const fixture = await createFixture()
|
|
await rm(fixture.paths.keyRegistryPath)
|
|
await mkdir(fixture.paths.keyRegistryPath)
|
|
|
|
await expect(
|
|
loadRemoteRuntimeVerificationMetadata(fixture.paths)
|
|
).rejects.toThrow('not a regular file')
|
|
})
|
|
})
|