mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
section 9: Phase 9: Settings agents and commands read managed v2 config
This commit is contained in:
1 parent
6578e11eeb
commit
81725fb345
13 files changed
+534
-373
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user