mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
fmt(js): npm run fix on merge (#66348)
Some checks are pending
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Some checks are pending
CI / Detect affected areas (push) Waiting to run
CI / Python tests (push) Blocked by required conditions
CI / Python lints (push) Blocked by required conditions
CI / JS & TS checks (push) Blocked by required conditions
CI / Docs Site (push) Blocked by required conditions
CI / Deny unrelated histories (push) Blocked by required conditions
CI / Check contributors (push) Blocked by required conditions
CI / Check uv.lock (push) Blocked by required conditions
CI / package-lock.json diff (push) Blocked by required conditions
CI / Lint Docker scripts (push) Blocked by required conditions
CI / Build&Test Docker image (push) Blocked by required conditions
CI / Supply-chain scan (push) Blocked by required conditions
CI / OSV scan (push) Waiting to run
CI / All required checks pass (push) Blocked by required conditions
CI / CI timing report (push) Blocked by required conditions
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Waiting to run
auto-fix lint issues & formatting / Apply patch (push) Blocked by required conditions
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
e4f87557b9
commit
0bf44d557f
2 changed files with 31 additions and 19 deletions
|
|
@ -9,20 +9,29 @@ describe('completeMcpDesktopOAuth', () => {
|
|||
const status = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({
|
||||
flow_id: 'flow-1', server_name: 'reports', status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize', error: null
|
||||
flow_id: 'flow-1',
|
||||
server_name: 'reports',
|
||||
status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize',
|
||||
error: null
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
flow_id: 'flow-1', server_name: 'reports', status: 'approved',
|
||||
authorization_url: 'https://idp.example/authorize', error: null,
|
||||
flow_id: 'flow-1',
|
||||
server_name: 'reports',
|
||||
status: 'approved',
|
||||
authorization_url: 'https://idp.example/authorize',
|
||||
error: null,
|
||||
tools: [{ name: 'list_reports', description: 'List reports' }]
|
||||
})
|
||||
|
||||
const result = await completeMcpDesktopOAuth({
|
||||
serverName: 'reports',
|
||||
start: vi.fn().mockResolvedValue({
|
||||
flow_id: 'flow-1', server_name: 'reports', status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize', error: null
|
||||
flow_id: 'flow-1',
|
||||
server_name: 'reports',
|
||||
status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize',
|
||||
error: null
|
||||
}),
|
||||
status,
|
||||
openExternal,
|
||||
|
|
@ -34,19 +43,23 @@ describe('completeMcpDesktopOAuth', () => {
|
|||
})
|
||||
|
||||
it('retries a transient status failure', async () => {
|
||||
const status = vi
|
||||
.fn()
|
||||
.mockRejectedValueOnce(new Error('temporary network failure'))
|
||||
.mockResolvedValueOnce({
|
||||
flow_id: 'flow-2', server_name: 'reports', status: 'approved',
|
||||
authorization_url: 'https://idp.example/authorize', error: null, tools: []
|
||||
})
|
||||
const status = vi.fn().mockRejectedValueOnce(new Error('temporary network failure')).mockResolvedValueOnce({
|
||||
flow_id: 'flow-2',
|
||||
server_name: 'reports',
|
||||
status: 'approved',
|
||||
authorization_url: 'https://idp.example/authorize',
|
||||
error: null,
|
||||
tools: []
|
||||
})
|
||||
|
||||
const result = await completeMcpDesktopOAuth({
|
||||
serverName: 'reports',
|
||||
start: vi.fn().mockResolvedValue({
|
||||
flow_id: 'flow-2', server_name: 'reports', status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize', error: null
|
||||
flow_id: 'flow-2',
|
||||
server_name: 'reports',
|
||||
status: 'authorization_required',
|
||||
authorization_url: 'https://idp.example/authorize',
|
||||
error: null
|
||||
}),
|
||||
status,
|
||||
openExternal: vi.fn().mockResolvedValue(undefined),
|
||||
|
|
@ -56,4 +69,4 @@ describe('completeMcpDesktopOAuth', () => {
|
|||
expect(result.status).toBe('approved')
|
||||
expect(status).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ interface CompleteOptions {
|
|||
maxPollFailures?: number
|
||||
}
|
||||
|
||||
const defaultSleep = (milliseconds: number) =>
|
||||
new Promise<void>(resolve => window.setTimeout(resolve, milliseconds))
|
||||
const defaultSleep = (milliseconds: number) => new Promise<void>(resolve => window.setTimeout(resolve, milliseconds))
|
||||
|
||||
export async function completeMcpDesktopOAuth({
|
||||
serverName,
|
||||
|
|
@ -69,4 +68,4 @@ export async function completeMcpDesktopOAuth({
|
|||
|
||||
await sleep(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue