Merge remote-tracking branch 'origin/main' into refactor/ocm-native-opencode

This commit is contained in:
Chris Scott committed 2026-11-28 20:38:46 -05:00
commit 1278915e78
23 files changed
+296 -175

No files matched your search

+2 -1
View File
@@ -8,7 +8,7 @@ import { readJson } from '../../test/helpers/read-json'
import { createOAuthRoutes } from './oauth'
import { createStubOpenCodeClient } from '../../test/helpers/stub-opencode-client'
import { FetchOpenCodeClient } from '../services/opencode/client'
import { resolveOpenCode2Binary, startOpenCodeServe } from '../../test/helpers/opencode-binary'
import { resolveOpenCode2Binary, startOpenCodeServe, waitForOpenCodePluginsLoaded } from '../../test/helpers/opencode-binary'
import { buildOpenCodeBasicAuth, ClientError } from '@opencode-manager/shared/opencode'
import type { IntegrationInfo, IntegrationMethod } from '@opencode-manager/shared/opencode'
import type { OpenCodeClient } from '../services/opencode/client'
@@ -370,6 +370,7 @@ describe.skipIf(!openCodeBinary)('oauth routes against a real OpenCode 2 server'
})
const app = new Hono()
app.route('/oauth', createOAuthRoutes(client))
await waitForOpenCodePluginsLoaded(client)
const methodsResponse = await app.request('/oauth/auth-methods')
expect(methodsResponse.status).toBe(200)
+3 -3
View File
@@ -9,7 +9,7 @@ import type { JsonObject, JsonValue } from '@opencode-manager/shared/utils'
import { createProvidersRoutes } from './providers'
import { createStubOpenCodeClient } from '../../test/helpers/stub-opencode-client'
import { FetchOpenCodeClient } from '../services/opencode/client'
import { resolveOpenCode2Binary, startOpenCodeServe } from '../../test/helpers/opencode-binary'
import { resolveOpenCode2Binary, startOpenCodeServe, waitForOpenCodePluginsLoaded } from '../../test/helpers/opencode-binary'
import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode'
import { ClientError } from '@opencode-manager/shared/opencode'
import type { IntegrationInfo } from '@opencode-manager/shared/opencode'
@@ -502,7 +502,7 @@ describe.skipIf(!openCodeBinary)('providers routes against a real OpenCode 2 ser
const app = new Hono()
app.route('/providers', createProvidersRoutes(client))
await client.api.integration.list()
await waitForOpenCodePluginsLoaded(client)
const connectResponse = await app.request('/providers/anthropic/credentials', {
method: 'POST',
@@ -534,7 +534,7 @@ describe.skipIf(!openCodeBinary)('providers routes against a real OpenCode 2 ser
const app = new Hono()
app.route('/providers', createProvidersRoutes(client))
await client.api.integration.list()
await waitForOpenCodePluginsLoaded(client)
const rejected = await app.request('/providers/azure/credentials', {
method: 'POST',
@@ -390,7 +390,7 @@ describe('OpenCodeServerRegistry', () => {
describe('test', () => {
it('reports a supported version', async () => {
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.3.0' }))
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.4.2' }))
const result = await registry.test({
baseUrl: 'https://studio.example.com/',
@@ -398,7 +398,7 @@ describe('OpenCodeServerRegistry', () => {
password: 'super-secret',
})
expect(result).toEqual({ ok: true, version: '2.3.0', versionSupported: true, error: null })
expect(result).toEqual({ ok: true, version: '2.4.2', versionSupported: true, error: null })
expect(fetchFn.mock.calls[0]?.[0]).toBe('https://studio.example.com/api/info')
const headers = new Headers(fetchFn.mock.calls[0]?.[1]?.headers)
expect(headers.get('authorization')).toBe(`Basic ${btoa('alice:super-secret')}`)
@@ -419,7 +419,7 @@ describe('OpenCodeServerRegistry', () => {
username: 'alice',
password: 'super-secret',
})
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.3.0' }))
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.4.2' }))
const result = await registry.test({ serverId: server.id })
@@ -434,7 +434,7 @@ describe('OpenCodeServerRegistry', () => {
baseUrl: 'https://studio.example.com',
password: 'super-secret',
})
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.3.0' }))
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.4.2' }))
const result = await registry.test({
baseUrl: 'https://studio.example.com/opencode',
@@ -454,7 +454,7 @@ describe('OpenCodeServerRegistry', () => {
baseUrl: 'https://studio.example.com',
password: 'super-secret',
})
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.3.0' }))
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.4.2' }))
const result = await registry.test({
baseUrl: 'https://relocated.example.com',
@@ -474,7 +474,7 @@ describe('OpenCodeServerRegistry', () => {
baseUrl: 'https://studio.example.com',
password: 'super-secret',
})
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.3.0' }))
fetchFn.mockResolvedValueOnce(jsonResponse({ version: '2.4.2' }))
await registry.test({
baseUrl: 'https://studio.example.com',