迁移至新觅源码库 — 替换社区链接,保留AI功能

This commit is contained in:
新觅源码库
2026-06-02 03:44:33 +00:00
parent 7aa483f003
commit f10cd4cd9a
51 changed files with 328 additions and 1338 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ describe('agent bridge manager command resolution', () => {
const { buildAgentBridgeProcessEnv } = await import('../../packages/server/src/services/hermes/agent-bridge/manager')
const env = buildAgentBridgeProcessEnv('ipc:///tmp/test.sock', '/tmp/hermes-home', '/tmp/hermes-agent')
expect(env.HERMES_OPENROUTER_APP_REFERER).toBe('https://ekkolearnai.com')
expect(env.HERMES_OPENROUTER_APP_REFERER).toBe('https://www.xinmi.cloud')
expect(env.HERMES_OPENROUTER_APP_TITLE).toBe('Hermes Web UI')
expect(env.HERMES_OPENROUTER_APP_CATEGORIES).toBe('cli-agent,personal-agent')
})
+5 -5
View File
@@ -22,19 +22,19 @@ describe('startDeviceFlow', () => {
const fetchSpy = vi.fn().mockResolvedValue(mockJsonResponse({
device_code: 'DC-1',
user_code: 'USER-1234',
verification_uri: 'https://github.com/login/device',
verification_uri: 'https://www.xinmi.cloud/login/device',
expires_in: 900,
interval: 5,
}))
const data = await startDeviceFlow(fetchSpy as any)
expect(data.device_code).toBe('DC-1')
expect(data.user_code).toBe('USER-1234')
expect(data.verification_uri).toBe('https://github.com/login/device')
expect(data.verification_uri).toBe('https://www.xinmi.cloud/login/device')
expect(data.expires_in).toBe(900)
expect(data.interval).toBe(5)
const [url, init] = fetchSpy.mock.calls[0]
expect(url).toBe('https://github.com/login/device/code')
expect(url).toBe('https://www.xinmi.cloud/login/device/code')
expect(init.method).toBe('POST')
const body = String(init.body)
expect(body).toContain(`client_id=${encodeURIComponent(COPILOT_OAUTH_CLIENT_ID)}`)
@@ -57,7 +57,7 @@ describe('startDeviceFlow', () => {
const fetchSpy = vi.fn().mockResolvedValue(mockJsonResponse({
device_code: 'DC-2',
user_code: 'AAAA',
verification_uri: 'https://github.com/login/device',
verification_uri: 'https://www.xinmi.cloud/login/device',
}))
const data = await startDeviceFlow(fetchSpy as any)
expect(data.expires_in).toBe(900)
@@ -130,7 +130,7 @@ describe('pollDeviceFlow', () => {
const fetchSpy = vi.fn().mockResolvedValue(mockJsonResponse({ access_token: 'gho_x' }))
await pollDeviceFlow('DEVICE-CODE-XYZ', fetchSpy as any)
const [url, init] = fetchSpy.mock.calls[0]
expect(url).toBe('https://github.com/login/oauth/access_token')
expect(url).toBe('https://www.xinmi.cloud/login/oauth/access_token')
const body = String(init.body)
expect(body).toContain(`client_id=${encodeURIComponent(COPILOT_OAUTH_CLIENT_ID)}`)
expect(body).toContain('device_code=DEVICE-CODE-XYZ')
+2 -2
View File
@@ -82,7 +82,7 @@ describe('resolveCopilotOAuthToken', () => {
mockReadFile.mockImplementation(async (p: string) => {
if (p.includes('apps.json')) {
return JSON.stringify({
'github.com:abc': { oauth_token: 'gho_from_apps_json', user: 'me' },
'www.xinmi.cloud:abc': { oauth_token: 'gho_from_apps_json', user: 'me' },
})
}
throw new Error('ENOENT')
@@ -93,7 +93,7 @@ describe('resolveCopilotOAuthToken', () => {
it('apps.json 中的 ghp_ token 也应跳过', async () => {
mockReadFile.mockImplementation(async (p: string) => {
if (p.includes('apps.json')) {
return JSON.stringify({ 'github.com:a': { oauth_token: 'ghp_pat_in_apps' } })
return JSON.stringify({ 'www.xinmi.cloud:a': { oauth_token: 'ghp_pat_in_apps' } })
}
throw new Error('ENOENT')
})
+5 -5
View File
@@ -20,7 +20,7 @@ async function loadUpdateController(overrides: Partial<UpdateControllerMocks> =
const readFileSync = overrides.readFileSync ?? vi.fn(() => JSON.stringify({
name: 'hermes-web-ui',
version: '0.0.0',
repository: { url: 'https://github.com/EKKOLearnAI/hermes-web-ui.git' },
repository: { url: 'https://www.xinmi.cloud/root/Hermes-ui.git' },
}))
const appendFileSync = overrides.appendFileSync ?? vi.fn()
@@ -210,7 +210,7 @@ describe('update controller', () => {
})
it('loads preview tags through async git with a short timeout', async () => {
process.env.HERMES_WEB_UI_PREVIEW_REPO = 'https://github.com/EKKOLearnAI/hermes-web-ui'
process.env.HERMES_WEB_UI_PREVIEW_REPO = 'https://www.xinmi.cloud/root/Hermes-ui'
const execFile = vi.fn((_command: string, _args: string[], _options: any, callback: any) => {
callback(null, [
'abc123\trefs/tags/v0.6.6',
@@ -233,14 +233,14 @@ describe('update controller', () => {
})
expect(mocks.execFile).toHaveBeenCalledWith(
'git',
['ls-remote', '--tags', '--refs', 'https://github.com/EKKOLearnAI/hermes-web-ui.git'],
['ls-remote', '--tags', '--refs', 'https://www.xinmi.cloud/root/Hermes-ui.git'],
expect.objectContaining({ timeout: 8000 }),
expect.any(Function),
)
})
it('falls back to GitHub API when async git tag loading fails', async () => {
process.env.HERMES_WEB_UI_PREVIEW_REPO = 'https://github.com/EKKOLearnAI/hermes-web-ui'
process.env.HERMES_WEB_UI_PREVIEW_REPO = 'https://www.xinmi.cloud/root/Hermes-ui'
const execFile = vi.fn((_command: string, _args: string[], _options: any, callback: any) => {
callback(new Error('git timeout'), '', '')
})
@@ -267,7 +267,7 @@ describe('update controller', () => {
],
})
expect(fetchMock).toHaveBeenCalledWith(
'https://api.github.com/repos/EKKOLearnAI/hermes-web-ui/tags?per_page=100',
'https://api.www.xinmi.cloud/repos/EKKOLearnAI/hermes-web-ui/tags?per_page=100',
expect.objectContaining({
headers: { 'User-Agent': 'hermes-web-ui-preview' },
signal: expect.any(AbortSignal),