diff --git a/packages/types/npm/package.json b/packages/types/npm/package.json index b18d064821..37549f9e59 100644 --- a/packages/types/npm/package.json +++ b/packages/types/npm/package.json @@ -1,6 +1,6 @@ { "name": "@roo-code/types", - "version": "1.24.0", + "version": "1.25.0", "description": "TypeScript type definitions for Roo Code.", "publishConfig": { "access": "public", diff --git a/packages/types/src/cloud.ts b/packages/types/src/cloud.ts index 22cb6c21a6..f425e8c0d4 100644 --- a/packages/types/src/cloud.ts +++ b/packages/types/src/cloud.ts @@ -1,5 +1,11 @@ import { z } from "zod" +import { globalSettingsSchema } from "./global-settings.js" + +/** + * CloudUserInfo + */ + export interface CloudUserInfo { name?: string email?: string @@ -7,7 +13,7 @@ export interface CloudUserInfo { } /** - * Organization Allow List + * OrganizationAllowList */ export const organizationAllowListSchema = z.object({ @@ -22,10 +28,50 @@ export const organizationAllowListSchema = z.object({ export type OrganizationAllowList = z.infer -export const ORGANIZATION_ALLOW_ALL: OrganizationAllowList = { - allowAll: true, - providers: {}, -} as const +/** + * OrganizationDefaultSettings + */ + +export const organizationDefaultSettingsSchema = globalSettingsSchema + .pick({ + enableCheckpoints: true, + fuzzyMatchThreshold: true, + maxOpenTabsContext: true, + maxReadFileLine: true, + maxWorkspaceFiles: true, + showRooIgnoredFiles: true, + terminalCommandDelay: true, + terminalCompressProgressBar: true, + terminalOutputLineLimit: true, + terminalShellIntegrationDisabled: true, + terminalShellIntegrationTimeout: true, + terminalZshClearEolMark: true, + }) + // Add stronger validations for some fields. + .merge( + z.object({ + maxOpenTabsContext: z.number().int().nonnegative().optional(), + maxReadFileLine: z.number().int().gte(-1).optional(), + maxWorkspaceFiles: z.number().int().nonnegative().optional(), + terminalCommandDelay: z.number().int().nonnegative().optional(), + terminalOutputLineLimit: z.number().int().nonnegative().optional(), + terminalShellIntegrationTimeout: z.number().int().nonnegative().optional(), + }), + ) + +export type OrganizationDefaultSettings = z.infer + +/** + * OrganizationCloudSettings + */ + +export const organizationCloudSettingsSchema = z.object({ + recordTaskMessages: z.boolean().optional(), + enableTaskSharing: z.boolean().optional(), + taskShareExpirationDays: z.number().int().positive().optional(), +}) + +export type OrganizationCloudSettings = z.infer /** * Organization Settings @@ -33,22 +79,28 @@ export const ORGANIZATION_ALLOW_ALL: OrganizationAllowList = { export const organizationSettingsSchema = z.object({ version: z.number(), - defaultSettings: z - .object({ - enableCheckpoints: z.boolean().optional(), - maxOpenTabsContext: z.number().optional(), - maxWorkspaceFiles: z.number().optional(), - showRooIgnoredFiles: z.boolean().optional(), - maxReadFileLine: z.number().optional(), - fuzzyMatchThreshold: z.number().optional(), - }) - .optional(), - cloudSettings: z - .object({ - recordTaskMessages: z.boolean().optional(), - }) - .optional(), + cloudSettings: organizationCloudSettingsSchema.optional(), + defaultSettings: organizationDefaultSettingsSchema, allowList: organizationAllowListSchema, }) export type OrganizationSettings = z.infer + +/** + * Constants + */ + +export const ORGANIZATION_ALLOW_ALL: OrganizationAllowList = { + allowAll: true, + providers: {}, +} as const + +export const ORGANIZATION_DEFAULT: OrganizationSettings = { + version: 0, + cloudSettings: { + enableTaskSharing: true, + taskShareExpirationDays: 30, + }, + defaultSettings: {}, + allowList: ORGANIZATION_ALLOW_ALL, +} as const