section 9: Phase 9: Settings agents and commands read managed v2 config

This commit is contained in:
Chris Scott committed 2026-11-02 10:47:37 -05:00
1 parent 6578e11eeb
commit 81725fb345
13 files changed
+534 -373

No files matched your search

+16
View File
@@ -14,6 +14,8 @@ import type {
InstallSkillResponse,
OpenCodeDirectoryFileInfo,
OpenCodeRestartResponse,
ManagedOpenCodeConfig,
UpdateOpenCodeConfigPatchRequest,
} from './types/settings'
import { API_BASE_URL } from '@/config'
import { fetchWrapper } from './fetchWrapper'
@@ -73,6 +75,20 @@ export const settingsApi = {
})
},
getManagedOpenCodeConfig: async (): Promise<ManagedOpenCodeConfig> => {
return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-config/managed`)
},
patchOpenCodeConfig: async (
request: UpdateOpenCodeConfigPatchRequest
): Promise<OpenCodeConfigSaveResponse> => {
return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-config`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
})
},
discoverOpenCodeModels: async (
baseUrl: string,
apiKey?: string,
+32
View File
@@ -26,6 +26,11 @@ import {
type InstallSkillResponse,
type SettingsResponse as SharedSettingsResponse,
} from '@opencode-manager/shared'
import type { OpenCodeConfigInfo } from '@opencode-manager/shared/opencode'
import type {
OpenCodeAgentConfig,
OpenCodeCommandConfig,
} from '@opencode-manager/shared/opencode'
import type { NotificationPreferences } from '@opencode-manager/shared/types'
import { saveFile } from '@/lib/download'
@@ -90,3 +95,30 @@ export interface OpenCodeDirectoryFileInfo {
name: string
relativePath: string
}
export interface ManagedOpenCodeConfig {
revision: string | null
info: OpenCodeConfigInfo
}
/**
* Merge-patch value for one agent: an explicit null clears the stored field,
* while an omitted field stays untouched.
*/
export type OpenCodeAgentPatch = {
[K in keyof OpenCodeAgentConfig]?: OpenCodeAgentConfig[K] | null
}
/**
* Merge-patch value for one command: an explicit null clears the stored field,
* while an omitted field stays untouched.
*/
export type OpenCodeCommandPatch = {
[K in keyof OpenCodeCommandConfig]?: OpenCodeCommandConfig[K] | null
}
export interface UpdateOpenCodeConfigPatchRequest {
patch: Record<string, unknown>
source?: OpenCodeConfigSourceName
expectedRevision?: string
}