feat: add independent managed SSH agent packages
Managed SSH previously tied remote Agent and Runtime artifacts to desktop packaging and Host activation. Settings now manages verified Linux x64 and arm64 .gbagent packages explicitly, with source-aligned download and update plus offline import and export. Each package contains the signed Agent, pinned Node, and compatible OpenCode Runtime, and project activation never downloads one automatically. Dedicated native CI and a protected release workflow publish deterministic, signed cumulative catalogs to GitHub and Beijing OSS without replacing the desktop Latest release. Desktop packaging is metadata-only, remains independent of Agent artifacts and signing credentials, and Linux desktop releases add RPM installers. The managed SSH path also keeps model credentials in Main, enforces Ask as read-only, verifies signed Agent and Runtime inputs, preserves ACP recovery, and reports Host update cancellation and failures accurately. Release note: 远程项目现可在“设置”中手动下载、更新或离线导入签名 Agent 包,桌面安装包与远程组件发布相互独立;Linux 桌面版同时新增 RPM 安装包。
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
} from './model-bridge-broker'
|
||||
|
||||
const temporaryPaths: string[] = []
|
||||
const modelBridgeRouteToken = 'A'.repeat(43)
|
||||
const validResponse: RemoteModelGatewayResponse = {
|
||||
status: 201,
|
||||
headers: {
|
||||
@@ -208,6 +209,27 @@ describe('model bridge loopback helper', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects loopback requests without the per-helper route capability', async () => {
|
||||
const exchange = vi.fn(async () => validResponse)
|
||||
const proxy = new ModelBridgeLoopbackProxy({ exchange })
|
||||
const origin = await proxy.listen()
|
||||
try {
|
||||
const response = await sendHttp(origin, {
|
||||
authenticated: false,
|
||||
path: '/v1/messages',
|
||||
headers: {
|
||||
'x-api-key': MODEL_BRIDGE_SDK_AUTH_SENTINEL
|
||||
},
|
||||
body: '{}'
|
||||
})
|
||||
|
||||
expect(response.status).toBe(404)
|
||||
expect(exchange).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
await proxy.close()
|
||||
}
|
||||
})
|
||||
|
||||
it('drops harmless SDK metadata headers but rejects chunked framing', async () => {
|
||||
const exchange = vi.fn<ModelBridgeExchange>(
|
||||
async () => validResponse
|
||||
@@ -430,17 +452,24 @@ describe('model bridge loopback helper', () => {
|
||||
protocol,
|
||||
model: 'private-model',
|
||||
name: 'Private model',
|
||||
loopbackOrigin: 'http://127.0.0.1:12345',
|
||||
loopbackOrigin:
|
||||
`http://127.0.0.1:12345/${modelBridgeRouteToken}`,
|
||||
supportsImageInput: true
|
||||
})
|
||||
|
||||
expect(config).toMatchObject({
|
||||
model: `${providerId}/private-model`,
|
||||
agent: {
|
||||
title: {
|
||||
disable: true
|
||||
}
|
||||
},
|
||||
provider: {
|
||||
[providerId]: {
|
||||
npm,
|
||||
options: {
|
||||
baseURL: 'http://127.0.0.1:12345/v1'
|
||||
baseURL:
|
||||
`http://127.0.0.1:12345/${modelBridgeRouteToken}/v1`
|
||||
},
|
||||
models: {
|
||||
'private-model': {
|
||||
@@ -525,6 +554,52 @@ describe('model bridge Unix broker', () => {
|
||||
}
|
||||
)
|
||||
|
||||
runOnUnix(
|
||||
'drains a response larger than the Unix socket receive buffer',
|
||||
async () => {
|
||||
const scratch = privateTemporaryDirectory()
|
||||
const responseBody = Buffer.alloc(256 * 1024, 0x61)
|
||||
const broker = new ModelBridgeBrokerServer({
|
||||
scratchDirectory: scratch,
|
||||
dispatch: async () => ({
|
||||
...validResponse,
|
||||
bodyBase64: responseBody.toString('base64')
|
||||
})
|
||||
})
|
||||
await broker.listen()
|
||||
try {
|
||||
const exchange = createUnixModelBridgeExchange({
|
||||
socketPath: broker.socketPath,
|
||||
requestTimeoutMs: 2_000
|
||||
})
|
||||
const exchanged = await exchange(
|
||||
{
|
||||
method: 'POST',
|
||||
path: '/v1/responses',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
bodyBase64: Buffer.from('{}').toString('base64')
|
||||
},
|
||||
{
|
||||
requestId: 'request-large-response',
|
||||
signal: new AbortController().signal
|
||||
}
|
||||
)
|
||||
expect('response' in exchanged).toBe(true)
|
||||
if ('response' in exchanged) {
|
||||
expect(
|
||||
Buffer.from(
|
||||
exchanged.response.bodyBase64,
|
||||
'base64'
|
||||
).byteLength
|
||||
).toBe(responseBody.byteLength)
|
||||
await exchanged.acknowledgeDelivery()
|
||||
}
|
||||
} finally {
|
||||
await broker.close()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
runOnUnix(
|
||||
'refuses to replace or remove a non-socket endpoint path',
|
||||
async () => {
|
||||
@@ -608,6 +683,7 @@ async function sendHttp(
|
||||
options: {
|
||||
method?: string
|
||||
path?: string
|
||||
authenticated?: boolean
|
||||
headers?: Record<string, string>
|
||||
body?: string
|
||||
}
|
||||
@@ -618,11 +694,19 @@ async function sendHttp(
|
||||
}> {
|
||||
const url = new URL(origin)
|
||||
const body = options.body ?? ''
|
||||
const requestPath = options.path ?? '/v1/messages'
|
||||
const basePath =
|
||||
url.pathname === '/'
|
||||
? ''
|
||||
: url.pathname.replace(/\/$/u, '')
|
||||
const requestOptions: RequestOptions = {
|
||||
hostname: url.hostname,
|
||||
port: url.port,
|
||||
method: options.method ?? 'POST',
|
||||
path: options.path ?? '/v1/messages',
|
||||
path:
|
||||
options.authenticated === false
|
||||
? requestPath
|
||||
: `${basePath}${requestPath}`,
|
||||
headers: {
|
||||
...(options.headers ?? {}),
|
||||
...(!hasHeader(options.headers, 'content-length') &&
|
||||
|
||||
Reference in New Issue
Block a user