fix(host): derive the picker capability union from a merge-extensible map

ds-review-bot round 1: the seam documented a merge-extensible union but
shipped a closed alias, and the gateway schema rejected any kind beyond
dialog/browse — a third backend could neither implement the seam nor be
advertised. The union now derives from an augmentable DirectoryPickerCapabilities
map, host.describe.directoryPicker preserves unknown wire kinds, and the
browse fixture applies listDirectory's root special case so creating under
'/' no longer mints a '//name' identity.
This commit is contained in:
creatixchu
2026-07-28 17:09:43 +08:00
parent 716d3ca636
commit c565022c8a
11 changed files with 51 additions and 12 deletions
@@ -17,7 +17,9 @@ export const hostDescribeValueSchema = z.object({
provider: z.string().optional(),
model: z.string().optional(),
attachedSessions: z.number().int().nonnegative(),
directoryPicker: z.union([z.literal('dialog'), z.literal('browse')]),
// Open string, not a literal union: unknown kinds must survive the wire so
// a merge-added capability can advertise (the client hides the affordance).
directoryPicker: z.string(),
}) satisfies z.ZodType<Wire<ResponseValue<'host.describe'>>>
/** host.pickDirectory request payload (empty object literal). */
+4 -1
View File
@@ -11,8 +11,11 @@ import type { RpcRequest, RpcResponse } from './rpc.ts'
* the host display (`host.pickDirectory`); `browse` = in-app listing/creation
* primitives (`host.listDirectory`/`host.createDirectory`). Calling a method
* outside the advertised kind fails with `directory-picker-unavailable`.
* The wire preserves kinds beyond the two with methods here (a merge-added
* capability advertises before its RPCs exist); the client's documented
* default for a kind it does not recognize is to hide the picking affordance.
*/
export type DirectoryPickerKind = 'dialog' | 'browse'
export type DirectoryPickerKind = 'dialog' | 'browse' | (string & {})
/** One directory row of a listing: a child entry or a breadcrumb ancestor. */
export interface DirectoryEntry {