File size: 945 Bytes
4e23b01 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /**
* `hostFolderBrowser` — host-side folder picker for choosing a workspace
* folder. Mirrors `agent-core-v2/app/hostFolderBrowser/hostFolderBrowser.ts`;
* wire shapes mirror `protocol/src/rest/fsBrowse.ts` (snake_case fields).
*/
import { z } from 'zod';
import type { ServiceContract } from '../types.js';
export const fsBrowseEntrySchema = z.object({
name: z.string().min(1),
path: z.string().min(1),
is_dir: z.literal(true),
});
export const fsBrowseResponseSchema = z.object({
path: z.string().min(1),
parent: z.string().min(1).nullable(),
entries: z.array(fsBrowseEntrySchema),
});
export const fsHomeResponseSchema = z.object({
home: z.string().min(1),
recent_roots: z.array(z.string().min(1)),
});
export const hostFsContract = {
browse: { input: z.tuple([z.string().optional()]), output: fsBrowseResponseSchema },
home: { input: z.tuple([]), output: fsHomeResponseSchema },
} satisfies ServiceContract;
|