mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
merge: hapi upstream main 2026-10-19 (34 commits past v0.30.7)
Bring in the post-0.30.7 upstream work while keeping local team, macaron, requirement, DSH and deployment features: - runner/hub: cross-platform orphan reap on archive and tracking loss, machine-spawn preallocated stubs, keepalive-only sessions reconcile to idle - hub: prepared-statement cache, stale/canceled permission request handling - cli: Codex compaction announcements, dynamic Kimi models, MCP bridge reap - web: session toolbar icon shedding, mark-all-read, unread/active sections, Russian locale, external-link preference, 48px search chrome - ios/android: locale and font-size updates Conflict resolution keeps local-only behavior (agent team spawns, macaron skins, collapsible sidebar, workspace markdown images) layered on the new upstream toolbar and session lifecycle plumbing. Test infrastructure: skip the Docker-only pwsh integration test quickly when Docker is unavailable, and exclude the Bun-only usageScan test from vitest. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -316,3 +316,33 @@ describe('ApiClient error mapping', () => {
|
||||
expect(init?.body).toBe(JSON.stringify({ openai: 'sk-test' }))
|
||||
})
|
||||
})
|
||||
|
||||
describe('ApiClient Kimi session model discovery', () => {
|
||||
let originalFetch: typeof globalThis.fetch
|
||||
let fetchMock: ReturnType<typeof vi.fn>
|
||||
|
||||
beforeEach(() => {
|
||||
originalFetch = globalThis.fetch
|
||||
fetchMock = vi.fn()
|
||||
globalThis.fetch = fetchMock as unknown as typeof globalThis.fetch
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
globalThis.fetch = originalFetch
|
||||
})
|
||||
|
||||
it('requests the running session instead of the machine kimi-models endpoint', async () => {
|
||||
const catalog = {
|
||||
success: true,
|
||||
availableModels: [
|
||||
{ modelId: 'GLM-5.3-flash', name: 'thehive / GLM-5.3-flash', provider: 'thehive' }
|
||||
],
|
||||
currentModelId: 'GLM-5.3-flash'
|
||||
}
|
||||
fetchMock.mockResolvedValueOnce(new Response(JSON.stringify(catalog), { status: 200 }))
|
||||
|
||||
const api = new ApiClient('test-token')
|
||||
await expect(api.getSessionKimiModels('session/1')).resolves.toEqual(catalog)
|
||||
expect(fetchMock.mock.calls[0]?.[0]).toBe('/api/sessions/session%2F1/kimi-models')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -59,6 +59,7 @@ import type {
|
||||
FileReadResponse,
|
||||
GitCommandResponse,
|
||||
GrokModelsResponse,
|
||||
KimiModelsResponse,
|
||||
CopilotModelsResponse,
|
||||
GrokReasoningEffortResponse,
|
||||
ListDirectoryResponse,
|
||||
@@ -114,6 +115,12 @@ export interface TranscriptionCredentialStatus {
|
||||
geminiLive: MaskedCredentialStatus
|
||||
qwenRealtime: MaskedCredentialStatus
|
||||
}
|
||||
/** Optional: older hub versions won't send this. */
|
||||
elevenLabsMaxDurationSeconds?: {
|
||||
value: number
|
||||
source: ProviderCredentialSource
|
||||
editable: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface TranscriptionCredentialsUpdate {
|
||||
@@ -128,6 +135,8 @@ export interface TranscriptionCredentialsUpdate {
|
||||
}
|
||||
geminiLive?: string | null
|
||||
qwenRealtime?: string | null
|
||||
/** null resets to the hub default (1800s) */
|
||||
elevenLabsMaxDurationSeconds?: number | null
|
||||
}
|
||||
|
||||
type ApiClientOptions = {
|
||||
@@ -1297,6 +1306,18 @@ export class ApiClient {
|
||||
)
|
||||
}
|
||||
|
||||
async getMachineKimiModelsForCwd(machineId: string, cwd: string): Promise<KimiModelsResponse> {
|
||||
return await this.request<KimiModelsResponse>(
|
||||
`/api/machines/${encodeURIComponent(machineId)}/kimi-models?cwd=${encodeURIComponent(cwd)}`
|
||||
)
|
||||
}
|
||||
|
||||
async getSessionKimiModels(sessionId: string): Promise<KimiModelsResponse> {
|
||||
return await this.request<KimiModelsResponse>(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/kimi-models`
|
||||
)
|
||||
}
|
||||
|
||||
async getSessionGrokModels(sessionId: string): Promise<GrokModelsResponse> {
|
||||
return await this.request<GrokModelsResponse>(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/grok-models`
|
||||
|
||||
Reference in New Issue
Block a user