feat(web): open the local settings file

This commit is contained in:
Yichen Jiang
2026-08-04 16:33:35 +08:00
parent 828cb2ae20
commit e31b7221e7
61 changed files with 939 additions and 98 deletions
@@ -57,6 +57,7 @@ export interface RpcMethodMap {
'goal.complete': GoalsApi['complete']
'goal.clear': GoalsApi['clear']
'settings.describe': SettingsApi['describe']
'settings.openDocument': SettingsApi['openDocument']
'settings.update': SettingsApi['update']
'settings.replace': SettingsApi['replace']
'settings.mutate': SettingsApi['mutate']
@@ -32,9 +32,18 @@ export const settingsDescribeRequestSchema = z.object({}) satisfies z.ZodType<Wi
/** settings.describe response value. */
export const settingsDescribeValueSchema = z.object({
writable: z.boolean(),
documentPath: z.string().min(1).optional(),
namespaces: z.array(settingsNamespaceViewSchema),
}) satisfies z.ZodType<Wire<ResponseValue<'settings.describe'>>>
/** settings.openDocument request payload. */
export const settingsOpenDocumentRequestSchema = z.object({}) satisfies z.ZodType<Wire<RequestPayload<'settings.openDocument'>>>
/** settings.openDocument response value. */
export const settingsOpenDocumentValueSchema = z.object({
opened: z.literal(true),
}) satisfies z.ZodType<Wire<ResponseValue<'settings.openDocument'>>>
/** settings.update request payload. */
export const settingsUpdateRequestSchema = z.object({
ns: z.string().min(1),
+20 -3
View File
@@ -53,10 +53,27 @@ export type SettingsPathOpView =
export interface SettingsApi {
/**
* Describe every registered namespace: redacted layered values plus the
* serialized schema a client renders its form from. `writable: false`
* (read-only provider) tells the client to disable every write control.
* serialized schema a client renders its form from. `documentPath` is the
* absolute Host path only for a file-backed provider; this method is
* loopback-only, and clients use it only to decide whether to offer the
* pathless `openDocument` action instead of attempting browser filesystem
* access. `writable: false` (read-only provider) tells the client to disable
* every write control.
*/
describe(request: RpcRequest<{}>): Promise<RpcResponse<{ writable: boolean; namespaces: SettingsNamespaceView[] }>>
describe(request: RpcRequest<{}>): Promise<RpcResponse<{
writable: boolean
documentPath?: string
namespaces: SettingsNamespaceView[]
}>>
/**
* Materialize the configured local document when absent and ask the Host to
* open it with the platform default application. The request carries no
* path, so the browser cannot choose an arbitrary Host filesystem target.
*/
openDocument(
request: RpcRequest<{}>, signal: AbortSignal,
): Promise<RpcResponse<{ opened: true }>>
/**
* Merge a patch into one namespace's user layer (validate → persist →