@sqlrooms/room-store 0.29.0-rc.0 → 0.29.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"CommandSlice.d.ts","sourceRoot":"","sources":["../src/CommandSlice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EAAI,OAAO,EAAC,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAC,kBAAkB,EAAe,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAG3E,YAAY,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAK3E,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,SAAS,CAAC;AAEd,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE1E,MAAM,MAAM,2BAA2B,CACrC,EAAE,SAAS,kBAAkB,GAAG,kBAAkB,IAChD;IACF,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,EAAE,SAAS,kBAAkB,GAAG,kBAAkB,IAChD,CAAC,OAAO,EAAE,2BA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pC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,KAAc;IACjE,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,IAAI,CAAC;IAC3B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,iCAAiC,CAAC,KAAiB;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACpE,OAAO,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;QACvB,CAAC,CAAC,0BAA0B,OAAO,EAAE;QACrC,CAAC,CAAC,wBAAwB,CAAC;AAC/B,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import {produce} from 'immer';\nimport type {ComponentType} from 'react';\nimport {z, ZodType} from 'zod';\nimport {StoreApi} from 'zustand';\nimport {BaseRoomStoreState, createSlice, StateCreator} from './BaseRoomStore';\nimport type {RoomCommandPortableSchema} from './RoomCommandPortableSchema';\nimport {toPortableSchema} from './toPortableSchema';\n\nexport type {RoomCommandPortableSchema} from './RoomCommandPortableSchema';\n\nconst DEFAULT_COMMAND_OWNER = 'global';\nconst DEFAULT_COMMAND_SURFACE: RoomCommandSurface = 'unknown';\n\nexport type RoomCommandSurface =\n | 'palette'\n | 'ai'\n | 'cli'\n | 'mcp'\n | 'api'\n | 'unknown';\n\nexport type RoomCommandInvocation = {\n surface: RoomCommandSurface;\n actor?: string;\n traceId?: string;\n metadata?: Record<string, unknown>;\n};\n\nexport type RoomCommandInvocationOptions = Partial<RoomCommandInvocation>;\n\nexport type RoomCommandExecutionContext<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n store: StoreApi<RS>;\n getState: () => RS;\n invocation: RoomCommandInvocation;\n};\n\nexport type RoomCommandPredicate<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = (context: RoomCommandExecutionContext<RS>) => boolean;\n\nexport type RoomCommandInputComponentProps = {\n commandId: string;\n commandName: string;\n isSubmitting: boolean;\n error?: string;\n onSubmit: (input: unknown) => void | Promise<void>;\n onCancel: () => void;\n};\n\nexport type RoomCommandInputComponent =\n ComponentType<RoomCommandInputComponentProps>;\n\nexport type RoomCommandRiskLevel = 'low' | 'medium' | 'high';\nexport type RoomCommandKeystrokes = string | string[];\n\nexport type RoomCommandPolicyMetadata = {\n readOnly?: boolean;\n idempotent?: boolean;\n riskLevel?: RoomCommandRiskLevel;\n requiresConfirmation?: boolean;\n};\n\nexport type RoomCommandUiMetadata = {\n shortcut?: string;\n keystrokes?: RoomCommandKeystrokes;\n inputComponent?: RoomCommandInputComponent;\n hidden?: boolean;\n};\n\nexport type RoomCommandResult<TData = unknown> = {\n success: boolean;\n commandId: string;\n message?: string;\n code?: string;\n data?: TData;\n error?: string;\n};\n\nexport type RoomCommandExecuteOutput<TData = unknown> =\n | RoomCommandResult<TData>\n | TData\n | void;\n\nexport type RoomCommandMiddlewareNext = () => Promise<RoomCommandExecuteOutput>;\nexport type RoomCommandMiddleware<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = (\n command: RegisteredRoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n next: RoomCommandMiddlewareNext,\n) => RoomCommandExecuteOutput | Promise<RoomCommandExecuteOutput>;\n\nexport type RoomCommandInvokeStartEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n command: RegisteredRoomCommand<RS>;\n input: unknown;\n context: RoomCommandExecutionContext<RS>;\n};\n\nexport type RoomCommandInvokeSuccessEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n result: RoomCommandResult;\n durationMs: number;\n};\n\nexport type RoomCommandInvokeFailureEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n result: RoomCommandResult;\n durationMs: number;\n};\n\nexport type RoomCommandInvokeErrorEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n error: unknown;\n durationMs: number;\n};\n\nexport type CreateCommandSliceProps<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n middleware?: RoomCommandMiddleware<RS>[];\n onCommandInvokeStart?: (event: RoomCommandInvokeStartEvent<RS>) => void;\n onCommandInvokeSuccess?: (event: RoomCommandInvokeSuccessEvent<RS>) => void;\n onCommandInvokeFailure?: (event: RoomCommandInvokeFailureEvent<RS>) => void;\n onCommandInvokeError?: (event: RoomCommandInvokeErrorEvent<RS>) => void;\n};\n\nexport type RoomCommand<RS extends BaseRoomStoreState = BaseRoomStoreState> = {\n id: string;\n name: string;\n description?: string;\n group?: string;\n keywords?: string[];\n inputSchema?: ZodType<unknown>;\n inputDescription?: string;\n validateInput?: (\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n ) => void | Promise<void>;\n execute: (\n context: RoomCommandExecutionContext<RS>,\n input?: unknown,\n ) => RoomCommandExecuteOutput | Promise<RoomCommandExecuteOutput>;\n isVisible?: RoomCommandPredicate<RS>;\n isEnabled?: RoomCommandPredicate<RS>;\n metadata?: RoomCommandPolicyMetadata;\n ui?: RoomCommandUiMetadata;\n /** @deprecated Use ui?.keystrokes */\n keystrokes?: RoomCommandKeystrokes;\n /** @deprecated Use ui?.shortcut */\n shortcut?: string;\n /** @deprecated Use ui?.inputComponent */\n inputComponent?: RoomCommandInputComponent;\n /** @deprecated Use metadata?.readOnly */\n readOnly?: boolean;\n /** @deprecated Use metadata?.idempotent */\n idempotent?: boolean;\n /** @deprecated Use metadata?.riskLevel */\n riskLevel?: RoomCommandRiskLevel;\n /** @deprecated Use metadata?.requiresConfirmation */\n requiresConfirmation?: boolean;\n};\n\nexport type RegisteredRoomCommand<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommand<RS> & {\n owner: string;\n};\n\nexport type RoomCommandDescriptor = {\n id: string;\n owner: string;\n name: string;\n description?: string;\n group?: string;\n keywords?: string[];\n enabled: boolean;\n visible: boolean;\n requiresInput: boolean;\n inputDescription?: string;\n inputSchema?: RoomCommandPortableSchema;\n keystrokes: string[];\n shortcut?: string;\n readOnly: boolean;\n idempotent: boolean;\n riskLevel: RoomCommandRiskLevel;\n requiresConfirmation: boolean;\n};\n\nexport type RoomCommandListOptions = RoomCommandInvocationOptions & {\n includeInvisible?: boolean;\n includeDisabled?: boolean;\n includeInputSchema?: boolean;\n};\n\nexport type CommandSliceState<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n commands: {\n registry: Record<string, RegisteredRoomCommand<RS>>;\n ownerToCommandIds: Record<string, string[]>;\n registerCommand: (owner: string, command: RoomCommand<RS>) => void;\n registerCommands: (owner: string, commands: RoomCommand<RS>[]) => void;\n unregisterCommand: (commandId: string) => void;\n unregisterCommands: (owner: string) => void;\n getCommand: (commandId: string) => RegisteredRoomCommand<RS> | undefined;\n listCommands: (options?: RoomCommandListOptions) => RoomCommandDescriptor[];\n invokeCommand: (\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n ) => Promise<RoomCommandResult>;\n executeCommand: (\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n ) => Promise<void>;\n };\n};\n\nexport function createCommandSlice<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n>(\n props?: CreateCommandSliceProps<RS>,\n): StateCreator<CommandSliceState<RS>> {\n const middleware = props?.middleware ?? [];\n return createSlice<CommandSliceState<RS>, RS & CommandSliceState<RS>>(\n (set, get, store) => ({\n commands: {\n registry: {},\n ownerToCommandIds: {},\n registerCommand: (owner, command) =>\n get().commands.registerCommands(owner, [command]),\n registerCommands: (owner, commands) => {\n const normalizedOwner = normalizeOwner(owner);\n set((state) =>\n produce(state, (draft) => {\n const previousIds =\n draft.commands.ownerToCommandIds[normalizedOwner] ?? [];\n for (const previousId of previousIds) {\n delete draft.commands.registry[previousId];\n }\n\n const nextIds = new Set<string>();\n for (const command of commands) {\n if (!command.id) {\n continue;\n }\n\n const existingCommand = draft.commands.registry[command.id];\n if (\n existingCommand &&\n existingCommand.owner !== normalizedOwner\n ) {\n removeCommandIdFromOwner(\n draft.commands.ownerToCommandIds,\n existingCommand.owner,\n command.id,\n );\n }\n\n draft.commands.registry[command.id] = {\n ...command,\n owner: normalizedOwner,\n };\n nextIds.add(command.id);\n }\n\n if (nextIds.size === 0) {\n delete draft.commands.ownerToCommandIds[normalizedOwner];\n return;\n }\n\n draft.commands.ownerToCommandIds[normalizedOwner] =\n Array.from(nextIds);\n }),\n );\n },\n unregisterCommand: (commandId) => {\n const existingCommand = get().commands.registry[commandId];\n if (!existingCommand) {\n return;\n }\n set((state) =>\n produce(state, (draft) => {\n delete draft.commands.registry[commandId];\n removeCommandIdFromOwner(\n draft.commands.ownerToCommandIds,\n existingCommand.owner,\n commandId,\n );\n }),\n );\n },\n unregisterCommands: (owner) => {\n const normalizedOwner = normalizeOwner(owner);\n set((state) =>\n produce(state, (draft) => {\n const commandIds =\n draft.commands.ownerToCommandIds[normalizedOwner] ?? [];\n for (const commandId of commandIds) {\n delete draft.commands.registry[commandId];\n }\n delete draft.commands.ownerToCommandIds[normalizedOwner];\n }),\n );\n },\n getCommand: (commandId) => get().commands.registry[commandId],\n listCommands: (options) => {\n const invocation = normalizeInvocation(options);\n const context = createRoomCommandExecutionContext(\n store as StoreApi<RS>,\n invocation,\n );\n const includeInvisible = options?.includeInvisible ?? false;\n const includeDisabled = options?.includeDisabled ?? true;\n const includeInputSchema = options?.includeInputSchema ?? true;\n\n const descriptors = Object.values(get().commands.registry)\n .map((command) =>\n createCommandDescriptor(command, context, includeInputSchema),\n )\n .filter((descriptor) =>\n includeInvisible ? true : descriptor.visible,\n )\n .filter((descriptor) =>\n includeDisabled ? true : descriptor.enabled,\n );\n\n descriptors.sort((first, second) => {\n const firstGroup = first.group ?? '';\n const secondGroup = second.group ?? '';\n if (firstGroup !== secondGroup) {\n return firstGroup.localeCompare(secondGroup);\n }\n return first.name.localeCompare(second.name);\n });\n return descriptors;\n },\n invokeCommand: async (commandId, input, invocationOptions) => {\n const command = get().commands.registry[commandId];\n if (!command) {\n return {\n success: false,\n commandId,\n code: 'command-not-found',\n error: `Unknown command \"${commandId}\".`,\n };\n }\n\n const invocation = normalizeInvocation(invocationOptions);\n const executionContext = createRoomCommandExecutionContext(\n store as StoreApi<RS>,\n invocation,\n );\n\n if (!resolveCommandEnabled(command, executionContext)) {\n return {\n success: false,\n commandId: command.id,\n code: 'command-disabled',\n error: `Command \"${command.name}\" is currently disabled.`,\n };\n }\n\n const invocationStartEvent: RoomCommandInvokeStartEvent<RS> = {\n command,\n input,\n context: executionContext,\n };\n const invocationStartedAt = Date.now();\n invokeCommandSliceCallback(\n props?.onCommandInvokeStart,\n invocationStartEvent,\n get().room.captureException,\n );\n\n try {\n const validatedInput = await validateCommandInput(\n command,\n input,\n executionContext,\n );\n const rawResult = await runCommandExecutionMiddleware(\n middleware,\n command,\n validatedInput,\n executionContext,\n );\n const normalizedResult = normalizeCommandExecuteResult(\n command.id,\n rawResult,\n );\n const invocationResultEvent = {\n command,\n input: validatedInput,\n context: executionContext,\n result: normalizedResult,\n durationMs: Date.now() - invocationStartedAt,\n };\n if (normalizedResult.success) {\n invokeCommandSliceCallback(\n props?.onCommandInvokeSuccess,\n invocationResultEvent,\n get().room.captureException,\n );\n } else {\n invokeCommandSliceCallback(\n props?.onCommandInvokeFailure,\n invocationResultEvent,\n get().room.captureException,\n );\n }\n return normalizedResult;\n } catch (error) {\n get().room.captureException(error);\n invokeCommandSliceCallback(\n props?.onCommandInvokeError,\n {\n ...invocationStartEvent,\n error,\n durationMs: Date.now() - invocationStartedAt,\n },\n get().room.captureException,\n );\n return {\n success: false,\n commandId: command.id,\n code: 'command-execution-error',\n error: toErrorMessage(error),\n };\n }\n },\n executeCommand: async (commandId, input, invocation) => {\n const result = await get().commands.invokeCommand(\n commandId,\n input,\n invocation,\n );\n if (!result.success) {\n throw new Error(\n result.error ??\n result.message ??\n `Failed to execute ${commandId}`,\n );\n }\n },\n },\n }),\n );\n}\n\nexport function createRoomCommandExecutionContext<\n RS extends BaseRoomStoreState,\n>(\n store: StoreApi<RS>,\n invocation?: RoomCommandInvocationOptions,\n): RoomCommandExecutionContext<RS> {\n return {\n store,\n getState: () => store.getState(),\n invocation: normalizeInvocation(invocation),\n };\n}\n\nexport function hasCommandSliceState(\n state: unknown,\n): state is BaseRoomStoreState & CommandSliceState {\n if (typeof state !== 'object' || state === null || !('commands' in state)) {\n return false;\n }\n\n const commands = state.commands;\n if (typeof commands !== 'object' || commands === null) {\n return false;\n }\n\n return (\n 'registerCommands' in commands &&\n typeof commands.registerCommands === 'function' &&\n 'unregisterCommands' in commands &&\n typeof commands.unregisterCommands === 'function' &&\n 'listCommands' in commands &&\n typeof commands.listCommands === 'function' &&\n 'invokeCommand' in commands &&\n typeof commands.invokeCommand === 'function' &&\n 'executeCommand' in commands &&\n typeof commands.executeCommand === 'function'\n );\n}\n\nexport function registerCommandsForOwner<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n owner: string,\n commands: RoomCommand<RS>[],\n): void {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return;\n }\n state.commands.registerCommands(\n owner,\n commands as unknown as RoomCommand<BaseRoomStoreState>[],\n );\n}\n\nexport function unregisterCommandsForOwner<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n owner: string,\n): void {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return;\n }\n state.commands.unregisterCommands(owner);\n}\n\nexport function listCommandsFromStore<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n options?: RoomCommandListOptions,\n): RoomCommandDescriptor[] {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return [];\n }\n return state.commands.listCommands(options);\n}\n\nexport async function invokeCommandFromStore<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n): Promise<RoomCommandResult> {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return {\n success: false,\n commandId,\n code: 'command-registry-unavailable',\n error: 'Command registry is not available.',\n };\n }\n return await state.commands.invokeCommand(commandId, input, invocation);\n}\n\nexport async function validateCommandInput<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n): Promise<unknown> {\n const parsedInput = command.inputSchema\n ? parseCommandInput(command.inputSchema, input)\n : input;\n\n if (command.validateInput) {\n await command.validateInput(parsedInput, context);\n }\n return parsedInput;\n}\n\nexport function doesCommandRequireInput(\n command: Pick<RoomCommand, 'inputSchema'>,\n): boolean {\n if (!command.inputSchema) {\n return false;\n }\n return !command.inputSchema.safeParse(undefined).success;\n}\n\nexport function getCommandShortcut(\n command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>,\n): string | undefined {\n return getCommandKeystrokes(command)[0];\n}\n\nexport function getCommandKeystrokes(\n command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>,\n): string[] {\n const keystrokes = [\n ...toCommandKeystrokeArray(command.ui?.keystrokes),\n ...toCommandKeystrokeArray(command.keystrokes),\n ...toCommandKeystrokeArray(command.ui?.shortcut),\n ...toCommandKeystrokeArray(command.shortcut),\n ];\n\n const deduplicated = new Set<string>();\n for (const keystroke of keystrokes) {\n if (typeof keystroke !== 'string') {\n continue;\n }\n const trimmed = keystroke.trim();\n if (!trimmed) {\n continue;\n }\n deduplicated.add(trimmed);\n }\n return Array.from(deduplicated);\n}\n\nexport function getCommandInputComponent(\n command: Pick<RoomCommand, 'ui' | 'inputComponent'>,\n): RoomCommandInputComponent | undefined {\n return command.ui?.inputComponent ?? command.inputComponent;\n}\n\nexport function resolveCommandPolicyMetadata(\n command: Pick<\n RoomCommand,\n | 'metadata'\n | 'readOnly'\n | 'idempotent'\n | 'riskLevel'\n | 'requiresConfirmation'\n >,\n): Required<RoomCommandPolicyMetadata> {\n return {\n readOnly: command.metadata?.readOnly ?? command.readOnly ?? false,\n idempotent: command.metadata?.idempotent ?? command.idempotent ?? false,\n riskLevel: command.metadata?.riskLevel ?? command.riskLevel ?? 'medium',\n requiresConfirmation:\n command.metadata?.requiresConfirmation ??\n command.requiresConfirmation ??\n false,\n };\n}\n\nexport function exportCommandInputSchema(\n schema: ZodType<unknown> | undefined,\n): RoomCommandPortableSchema | undefined {\n if (!schema) {\n return undefined;\n }\n return toPortableSchema(schema);\n}\n\nfunction createCommandDescriptor<RS extends BaseRoomStoreState>(\n command: RegisteredRoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n includeInputSchema: boolean,\n): RoomCommandDescriptor {\n const metadata = resolveCommandPolicyMetadata(command);\n const keystrokes = getCommandKeystrokes(command);\n return {\n id: command.id,\n owner: command.owner,\n name: command.name,\n description: command.description,\n group: command.group,\n keywords: command.keywords,\n visible: resolveCommandVisibility(command, context),\n enabled: resolveCommandEnabled(command, context),\n requiresInput: doesCommandRequireInput(command),\n inputDescription: command.inputDescription,\n inputSchema: includeInputSchema\n ? exportCommandInputSchema(command.inputSchema)\n : undefined,\n keystrokes,\n shortcut: keystrokes[0],\n ...metadata,\n };\n}\n\nfunction normalizeCommandExecuteResult(\n commandId: string,\n rawResult: RoomCommandExecuteOutput,\n): RoomCommandResult {\n if (isRoomCommandResult(rawResult)) {\n return {\n ...rawResult,\n commandId: rawResult.commandId || commandId,\n };\n }\n\n return {\n success: true,\n commandId,\n ...(rawResult !== undefined ? {data: rawResult} : {}),\n };\n}\n\nfunction isRoomCommandResult(value: unknown): value is RoomCommandResult {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'success' in value &&\n typeof value.success === 'boolean' &&\n 'commandId' in value\n );\n}\n\nasync function runCommandExecutionMiddleware<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n>(\n middleware: RoomCommandMiddleware<RS>[],\n command: RegisteredRoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n): Promise<RoomCommandExecuteOutput> {\n const invokeMiddleware = async (\n index: number,\n ): Promise<RoomCommandExecuteOutput> => {\n const currentMiddleware = middleware[index];\n if (!currentMiddleware) {\n return await command.execute(context, input);\n }\n let called = false;\n return await currentMiddleware(command, input, context, async () => {\n if (called) {\n throw new Error('Command middleware next() called multiple times.');\n }\n called = true;\n return await invokeMiddleware(index + 1);\n });\n };\n\n return await invokeMiddleware(0);\n}\n\nfunction invokeCommandSliceCallback<TEvent>(\n callback: ((event: TEvent) => void) | undefined,\n event: TEvent,\n captureException: BaseRoomStoreState['room']['captureException'],\n): void {\n if (!callback) {\n return;\n }\n try {\n callback(event);\n } catch (error) {\n captureException(error);\n }\n}\n\nfunction toCommandKeystrokeArray(\n keystrokes?: RoomCommandKeystrokes,\n): string[] {\n if (!keystrokes) {\n return [];\n }\n return Array.isArray(keystrokes) ? keystrokes : [keystrokes];\n}\n\nfunction removeCommandIdFromOwner(\n ownerToCommandIds: Record<string, string[]>,\n owner: string,\n commandId: string,\n): void {\n const ownerCommandIds = ownerToCommandIds[owner];\n if (!ownerCommandIds) {\n return;\n }\n\n const filteredIds = ownerCommandIds.filter((id) => id !== commandId);\n if (filteredIds.length === 0) {\n delete ownerToCommandIds[owner];\n return;\n }\n ownerToCommandIds[owner] = filteredIds;\n}\n\nfunction normalizeOwner(owner: string): string {\n const trimmed = owner.trim();\n if (trimmed.length > 0) {\n return trimmed;\n }\n return DEFAULT_COMMAND_OWNER;\n}\n\nfunction normalizeInvocation(\n invocation?: RoomCommandInvocationOptions,\n): RoomCommandInvocation {\n return {\n surface: invocation?.surface ?? DEFAULT_COMMAND_SURFACE,\n actor: invocation?.actor,\n traceId: invocation?.traceId,\n metadata: invocation?.metadata,\n };\n}\n\nfunction resolveCommandVisibility<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n): boolean {\n if (command.ui?.hidden) {\n return false;\n }\n if (!command.isVisible) {\n return true;\n }\n try {\n return command.isVisible(context);\n } catch (error) {\n context.getState().room.captureException(error);\n return false;\n }\n}\n\nfunction resolveCommandEnabled<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n): boolean {\n if (!command.isEnabled) {\n return true;\n }\n try {\n return command.isEnabled(context);\n } catch (error) {\n context.getState().room.captureException(error);\n return false;\n }\n}\n\nfunction parseCommandInput(schema: ZodType<unknown>, input: unknown): unknown {\n const parsedResult = schema.safeParse(input);\n if (parsedResult.success) {\n return parsedResult.data;\n }\n throw new Error(formatCommandInputValidationError(parsedResult.error));\n}\n\nfunction formatCommandInputValidationError(error: z.ZodError): string {\n const message = error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? issue.path.join('.') : 'input';\n return `${path}: ${issue.message}`;\n })\n .join('; ');\n return message.length > 0\n ? `Invalid command input: ${message}`\n : 'Invalid command input.';\n}\n\nfunction toErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n return String(error);\n}\n"]}
1
+ {"version":3,"file":"CommandSlice.js","sourceRoot":"","sources":["../src/CommandSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAI9B,OAAO,EAAqB,WAAW,EAAe,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAIpD,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AACvC,MAAM,uBAAuB,GAAuB,SAAS,CAAC;AAwN9D,MAAM,UAAU,kBAAkB,CAEhC,KAAmC;IACnC,MAAM,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,EAAE,CAAC;IAC3C,OAAO,WAAW,CAChB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAClC,GAAG,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;YACnD,gBAAgB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACpC,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC9C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACZ,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;oBACvB,MAAM,WAAW,GACf,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;oBAC1D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;wBACrC,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;oBAC7C,CAAC;oBAED,MAAM,OAAO,GAAG,IAA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,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,KAAc;IACjE,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,IAAI,CAAC;IAC3B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,iCAAiC,CAAC,KAAiB;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACpE,OAAO,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;QACvB,CAAC,CAAC,0BAA0B,OAAO,EAAE;QACrC,CAAC,CAAC,wBAAwB,CAAC;AAC/B,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import {produce} from 'immer';\nimport type {ComponentType} from 'react';\nimport {z, ZodType} from 'zod';\nimport {StoreApi} from 'zustand';\nimport {BaseRoomStoreState, createSlice, StateCreator} from './BaseRoomStore';\nimport type {RoomCommandPortableSchema} from './RoomCommandPortableSchema';\nimport {toPortableSchema} from './toPortableSchema';\n\nexport type {RoomCommandPortableSchema} from './RoomCommandPortableSchema';\n\nconst DEFAULT_COMMAND_OWNER = 'global';\nconst DEFAULT_COMMAND_SURFACE: RoomCommandSurface = 'unknown';\n\nexport type RoomCommandSurface =\n | 'palette'\n | 'ai'\n | 'cli'\n | 'mcp'\n | 'api'\n | 'unknown';\n\nexport type RoomCommandInvocation = {\n surface: RoomCommandSurface;\n actor?: string;\n traceId?: string;\n metadata?: Record<string, unknown>;\n};\n\nexport type RoomCommandInvocationOptions = Partial<RoomCommandInvocation>;\n\nexport type RoomCommandExecutionContext<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n store: StoreApi<RS>;\n getState: () => RS;\n invocation: RoomCommandInvocation;\n};\n\nexport type RoomCommandPredicate<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = (context: RoomCommandExecutionContext<RS>) => boolean;\n\nexport type RoomCommandInputComponentProps = {\n commandId: string;\n commandName: string;\n isSubmitting: boolean;\n error?: string;\n onSubmit: (input: unknown) => void | Promise<void>;\n onCancel: () => void;\n};\n\nexport type RoomCommandInputComponent =\n ComponentType<RoomCommandInputComponentProps>;\n\nexport type RoomCommandRiskLevel = 'low' | 'medium' | 'high';\nexport type RoomCommandKeystrokes = string | string[];\n\nexport type RoomCommandPolicyMetadata = {\n readOnly?: boolean;\n idempotent?: boolean;\n riskLevel?: RoomCommandRiskLevel;\n requiresConfirmation?: boolean;\n};\n\nexport type RoomCommandUiMetadata = {\n shortcut?: string;\n keystrokes?: RoomCommandKeystrokes;\n inputComponent?: RoomCommandInputComponent;\n hidden?: boolean;\n};\n\nexport type RoomCommandResult<TData = unknown> = {\n success: boolean;\n commandId: string;\n message?: string;\n code?: string;\n data?: TData;\n error?: string;\n};\n\nexport type RoomCommandExecuteOutput<TData = unknown> =\n | RoomCommandResult<TData>\n | TData\n | void;\n\nexport type RoomCommandMiddlewareNext = () => Promise<RoomCommandExecuteOutput>;\nexport type RoomCommandMiddleware<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = (\n command: RegisteredRoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n next: RoomCommandMiddlewareNext,\n) => RoomCommandExecuteOutput | Promise<RoomCommandExecuteOutput>;\n\nexport type RoomCommandInvokeStartEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n command: RegisteredRoomCommand<RS>;\n input: unknown;\n context: RoomCommandExecutionContext<RS>;\n};\n\nexport type RoomCommandInvokeSuccessEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n result: RoomCommandResult;\n durationMs: number;\n};\n\nexport type RoomCommandInvokeFailureEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n result: RoomCommandResult;\n durationMs: number;\n};\n\nexport type RoomCommandInvokeErrorEvent<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommandInvokeStartEvent<RS> & {\n error: unknown;\n durationMs: number;\n};\n\nexport type CreateCommandSliceProps<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n middleware?: RoomCommandMiddleware<RS>[];\n onCommandInvokeStart?: (event: RoomCommandInvokeStartEvent<RS>) => void;\n onCommandInvokeSuccess?: (event: RoomCommandInvokeSuccessEvent<RS>) => void;\n onCommandInvokeFailure?: (event: RoomCommandInvokeFailureEvent<RS>) => void;\n onCommandInvokeError?: (event: RoomCommandInvokeErrorEvent<RS>) => void;\n};\n\nexport type RoomCommand<RS extends BaseRoomStoreState = BaseRoomStoreState> = {\n id: string;\n name: string;\n description?: string;\n group?: string;\n keywords?: string[];\n inputSchema?: ZodType<unknown>;\n inputDescription?: string;\n validateInput?: (\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n ) => void | Promise<void>;\n execute: (\n context: RoomCommandExecutionContext<RS>,\n input?: unknown,\n ) => RoomCommandExecuteOutput | Promise<RoomCommandExecuteOutput>;\n isVisible?: RoomCommandPredicate<RS>;\n isEnabled?: RoomCommandPredicate<RS>;\n metadata?: RoomCommandPolicyMetadata;\n ui?: RoomCommandUiMetadata;\n /** @deprecated Use ui?.keystrokes */\n keystrokes?: RoomCommandKeystrokes;\n /** @deprecated Use ui?.shortcut */\n shortcut?: string;\n /** @deprecated Use ui?.inputComponent */\n inputComponent?: RoomCommandInputComponent;\n /** @deprecated Use metadata?.readOnly */\n readOnly?: boolean;\n /** @deprecated Use metadata?.idempotent */\n idempotent?: boolean;\n /** @deprecated Use metadata?.riskLevel */\n riskLevel?: RoomCommandRiskLevel;\n /** @deprecated Use metadata?.requiresConfirmation */\n requiresConfirmation?: boolean;\n};\n\nexport type RegisteredRoomCommand<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = RoomCommand<RS> & {\n owner: string;\n};\n\nexport type RoomCommandDescriptor = {\n id: string;\n owner: string;\n name: string;\n description?: string;\n group?: string;\n keywords?: string[];\n enabled: boolean;\n visible: boolean;\n requiresInput: boolean;\n inputDescription?: string;\n inputSchema?: RoomCommandPortableSchema;\n keystrokes: string[];\n shortcut?: string;\n readOnly: boolean;\n idempotent: boolean;\n riskLevel: RoomCommandRiskLevel;\n requiresConfirmation: boolean;\n};\n\nexport type RoomCommandListOptions = RoomCommandInvocationOptions & {\n includeInvisible?: boolean;\n includeDisabled?: boolean;\n includeInputSchema?: boolean;\n};\n\nexport type CommandSliceState<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n> = {\n commands: {\n registry: Record<string, RegisteredRoomCommand<RS>>;\n ownerToCommandIds: Record<string, string[]>;\n registerCommand: (owner: string, command: RoomCommand<RS>) => void;\n registerCommands: (owner: string, commands: RoomCommand<RS>[]) => void;\n unregisterCommand: (commandId: string) => void;\n unregisterCommands: (owner: string) => void;\n getCommand: (commandId: string) => RegisteredRoomCommand<RS> | undefined;\n listCommands: (options?: RoomCommandListOptions) => RoomCommandDescriptor[];\n invokeCommand: (\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n ) => Promise<RoomCommandResult>;\n executeCommand: (\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n ) => Promise<void>;\n };\n};\n\nexport function createCommandSlice<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n>(props?: CreateCommandSliceProps<RS>): StateCreator<CommandSliceState<RS>> {\n const middleware = props?.middleware ?? [];\n return createSlice<CommandSliceState<RS>, RS & CommandSliceState<RS>>(\n (set, get, store) => ({\n commands: {\n registry: {},\n ownerToCommandIds: {},\n registerCommand: (owner, command) =>\n get().commands.registerCommands(owner, [command]),\n registerCommands: (owner, commands) => {\n const normalizedOwner = normalizeOwner(owner);\n set((state) =>\n produce(state, (draft) => {\n const previousIds =\n draft.commands.ownerToCommandIds[normalizedOwner] ?? [];\n for (const previousId of previousIds) {\n delete draft.commands.registry[previousId];\n }\n\n const nextIds = new Set<string>();\n for (const command of commands) {\n if (!command.id) {\n continue;\n }\n\n const existingCommand = draft.commands.registry[command.id];\n if (\n existingCommand &&\n existingCommand.owner !== normalizedOwner\n ) {\n removeCommandIdFromOwner(\n draft.commands.ownerToCommandIds,\n existingCommand.owner,\n command.id,\n );\n }\n\n draft.commands.registry[command.id] = {\n ...command,\n owner: normalizedOwner,\n };\n nextIds.add(command.id);\n }\n\n if (nextIds.size === 0) {\n delete draft.commands.ownerToCommandIds[normalizedOwner];\n return;\n }\n\n draft.commands.ownerToCommandIds[normalizedOwner] =\n Array.from(nextIds);\n }),\n );\n },\n unregisterCommand: (commandId) => {\n const existingCommand = get().commands.registry[commandId];\n if (!existingCommand) {\n return;\n }\n set((state) =>\n produce(state, (draft) => {\n delete draft.commands.registry[commandId];\n removeCommandIdFromOwner(\n draft.commands.ownerToCommandIds,\n existingCommand.owner,\n commandId,\n );\n }),\n );\n },\n unregisterCommands: (owner) => {\n const normalizedOwner = normalizeOwner(owner);\n set((state) =>\n produce(state, (draft) => {\n const commandIds =\n draft.commands.ownerToCommandIds[normalizedOwner] ?? [];\n for (const commandId of commandIds) {\n delete draft.commands.registry[commandId];\n }\n delete draft.commands.ownerToCommandIds[normalizedOwner];\n }),\n );\n },\n getCommand: (commandId) => get().commands.registry[commandId],\n listCommands: (options) => {\n const invocation = normalizeInvocation(options);\n const context = createRoomCommandExecutionContext(\n store as StoreApi<RS>,\n invocation,\n );\n const includeInvisible = options?.includeInvisible ?? false;\n const includeDisabled = options?.includeDisabled ?? true;\n const includeInputSchema = options?.includeInputSchema ?? true;\n\n const descriptors = Object.values(get().commands.registry)\n .map((command) =>\n createCommandDescriptor(command, context, includeInputSchema),\n )\n .filter((descriptor) =>\n includeInvisible ? true : descriptor.visible,\n )\n .filter((descriptor) =>\n includeDisabled ? true : descriptor.enabled,\n );\n\n descriptors.sort((first, second) => {\n const firstGroup = first.group ?? '';\n const secondGroup = second.group ?? '';\n if (firstGroup !== secondGroup) {\n return firstGroup.localeCompare(secondGroup);\n }\n return first.name.localeCompare(second.name);\n });\n return descriptors;\n },\n invokeCommand: async (commandId, input, invocationOptions) => {\n const command = get().commands.registry[commandId];\n if (!command) {\n return {\n success: false,\n commandId,\n code: 'command-not-found',\n error: `Unknown command \"${commandId}\".`,\n };\n }\n\n const invocation = normalizeInvocation(invocationOptions);\n const executionContext = createRoomCommandExecutionContext(\n store as StoreApi<RS>,\n invocation,\n );\n\n if (!resolveCommandEnabled(command, executionContext)) {\n return {\n success: false,\n commandId: command.id,\n code: 'command-disabled',\n error: `Command \"${command.name}\" is currently disabled.`,\n };\n }\n\n const invocationStartEvent: RoomCommandInvokeStartEvent<RS> = {\n command,\n input,\n context: executionContext,\n };\n const invocationStartedAt = Date.now();\n invokeCommandSliceCallback(\n props?.onCommandInvokeStart,\n invocationStartEvent,\n get().room.captureException,\n );\n\n try {\n const validatedInput = await validateCommandInput(\n command,\n input,\n executionContext,\n );\n const rawResult = await runCommandExecutionMiddleware(\n middleware,\n command,\n validatedInput,\n executionContext,\n );\n const normalizedResult = normalizeCommandExecuteResult(\n command.id,\n rawResult,\n );\n const invocationResultEvent = {\n command,\n input: validatedInput,\n context: executionContext,\n result: normalizedResult,\n durationMs: Date.now() - invocationStartedAt,\n };\n if (normalizedResult.success) {\n invokeCommandSliceCallback(\n props?.onCommandInvokeSuccess,\n invocationResultEvent,\n get().room.captureException,\n );\n } else {\n invokeCommandSliceCallback(\n props?.onCommandInvokeFailure,\n invocationResultEvent,\n get().room.captureException,\n );\n }\n return normalizedResult;\n } catch (error) {\n get().room.captureException(error);\n invokeCommandSliceCallback(\n props?.onCommandInvokeError,\n {\n ...invocationStartEvent,\n error,\n durationMs: Date.now() - invocationStartedAt,\n },\n get().room.captureException,\n );\n return {\n success: false,\n commandId: command.id,\n code: 'command-execution-error',\n error: toErrorMessage(error),\n };\n }\n },\n executeCommand: async (commandId, input, invocation) => {\n const result = await get().commands.invokeCommand(\n commandId,\n input,\n invocation,\n );\n if (!result.success) {\n throw new Error(\n result.error ??\n result.message ??\n `Failed to execute ${commandId}`,\n );\n }\n },\n },\n }),\n );\n}\n\nexport function createRoomCommandExecutionContext<\n RS extends BaseRoomStoreState,\n>(\n store: StoreApi<RS>,\n invocation?: RoomCommandInvocationOptions,\n): RoomCommandExecutionContext<RS> {\n return {\n store,\n getState: () => store.getState(),\n invocation: normalizeInvocation(invocation),\n };\n}\n\nexport function hasCommandSliceState(\n state: unknown,\n): state is BaseRoomStoreState & CommandSliceState {\n if (typeof state !== 'object' || state === null || !('commands' in state)) {\n return false;\n }\n\n const commands = state.commands;\n if (typeof commands !== 'object' || commands === null) {\n return false;\n }\n\n return (\n 'registerCommands' in commands &&\n typeof commands.registerCommands === 'function' &&\n 'unregisterCommands' in commands &&\n typeof commands.unregisterCommands === 'function' &&\n 'listCommands' in commands &&\n typeof commands.listCommands === 'function' &&\n 'invokeCommand' in commands &&\n typeof commands.invokeCommand === 'function' &&\n 'executeCommand' in commands &&\n typeof commands.executeCommand === 'function'\n );\n}\n\nexport function registerCommandsForOwner<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n owner: string,\n commands: RoomCommand<RS>[],\n): void {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return;\n }\n state.commands.registerCommands(\n owner,\n commands as unknown as RoomCommand<BaseRoomStoreState>[],\n );\n}\n\nexport function unregisterCommandsForOwner<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n owner: string,\n): void {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return;\n }\n state.commands.unregisterCommands(owner);\n}\n\nexport function listCommandsFromStore<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n options?: RoomCommandListOptions,\n): RoomCommandDescriptor[] {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return [];\n }\n return state.commands.listCommands(options);\n}\n\nexport async function invokeCommandFromStore<RS extends BaseRoomStoreState>(\n store: StoreApi<RS>,\n commandId: string,\n input?: unknown,\n invocation?: RoomCommandInvocationOptions,\n): Promise<RoomCommandResult> {\n const state = store.getState();\n if (!hasCommandSliceState(state)) {\n return {\n success: false,\n commandId,\n code: 'command-registry-unavailable',\n error: 'Command registry is not available.',\n };\n }\n return await state.commands.invokeCommand(commandId, input, invocation);\n}\n\nexport async function validateCommandInput<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n): Promise<unknown> {\n const parsedInput = command.inputSchema\n ? parseCommandInput(command.inputSchema, input)\n : input;\n\n if (command.validateInput) {\n await command.validateInput(parsedInput, context);\n }\n return parsedInput;\n}\n\nexport function doesCommandRequireInput(\n command: Pick<RoomCommand, 'inputSchema'>,\n): boolean {\n if (!command.inputSchema) {\n return false;\n }\n return !command.inputSchema.safeParse(undefined).success;\n}\n\nexport function getCommandShortcut(\n command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>,\n): string | undefined {\n return getCommandKeystrokes(command)[0];\n}\n\nexport function getCommandKeystrokes(\n command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>,\n): string[] {\n const keystrokes = [\n ...toCommandKeystrokeArray(command.ui?.keystrokes),\n ...toCommandKeystrokeArray(command.keystrokes),\n ...toCommandKeystrokeArray(command.ui?.shortcut),\n ...toCommandKeystrokeArray(command.shortcut),\n ];\n\n const deduplicated = new Set<string>();\n for (const keystroke of keystrokes) {\n if (typeof keystroke !== 'string') {\n continue;\n }\n const trimmed = keystroke.trim();\n if (!trimmed) {\n continue;\n }\n deduplicated.add(trimmed);\n }\n return Array.from(deduplicated);\n}\n\nexport function getCommandInputComponent(\n command: Pick<RoomCommand, 'ui' | 'inputComponent'>,\n): RoomCommandInputComponent | undefined {\n return command.ui?.inputComponent ?? command.inputComponent;\n}\n\nexport function resolveCommandPolicyMetadata(\n command: Pick<\n RoomCommand,\n | 'metadata'\n | 'readOnly'\n | 'idempotent'\n | 'riskLevel'\n | 'requiresConfirmation'\n >,\n): Required<RoomCommandPolicyMetadata> {\n return {\n readOnly: command.metadata?.readOnly ?? command.readOnly ?? false,\n idempotent: command.metadata?.idempotent ?? command.idempotent ?? false,\n riskLevel: command.metadata?.riskLevel ?? command.riskLevel ?? 'medium',\n requiresConfirmation:\n command.metadata?.requiresConfirmation ??\n command.requiresConfirmation ??\n false,\n };\n}\n\nexport function exportCommandInputSchema(\n schema: ZodType<unknown> | undefined,\n): RoomCommandPortableSchema | undefined {\n if (!schema) {\n return undefined;\n }\n return toPortableSchema(schema);\n}\n\nfunction createCommandDescriptor<RS extends BaseRoomStoreState>(\n command: RegisteredRoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n includeInputSchema: boolean,\n): RoomCommandDescriptor {\n const metadata = resolveCommandPolicyMetadata(command);\n const keystrokes = getCommandKeystrokes(command);\n return {\n id: command.id,\n owner: command.owner,\n name: command.name,\n description: command.description,\n group: command.group,\n keywords: command.keywords,\n visible: resolveCommandVisibility(command, context),\n enabled: resolveCommandEnabled(command, context),\n requiresInput: doesCommandRequireInput(command),\n inputDescription: command.inputDescription,\n inputSchema: includeInputSchema\n ? exportCommandInputSchema(command.inputSchema)\n : undefined,\n keystrokes,\n shortcut: keystrokes[0],\n ...metadata,\n };\n}\n\nfunction normalizeCommandExecuteResult(\n commandId: string,\n rawResult: RoomCommandExecuteOutput,\n): RoomCommandResult {\n if (isRoomCommandResult(rawResult)) {\n return {\n ...rawResult,\n commandId: rawResult.commandId || commandId,\n };\n }\n\n return {\n success: true,\n commandId,\n ...(rawResult !== undefined ? {data: rawResult} : {}),\n };\n}\n\nfunction isRoomCommandResult(value: unknown): value is RoomCommandResult {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'success' in value &&\n typeof value.success === 'boolean' &&\n 'commandId' in value\n );\n}\n\nasync function runCommandExecutionMiddleware<\n RS extends BaseRoomStoreState = BaseRoomStoreState,\n>(\n middleware: RoomCommandMiddleware<RS>[],\n command: RegisteredRoomCommand<RS>,\n input: unknown,\n context: RoomCommandExecutionContext<RS>,\n): Promise<RoomCommandExecuteOutput> {\n const invokeMiddleware = async (\n index: number,\n ): Promise<RoomCommandExecuteOutput> => {\n const currentMiddleware = middleware[index];\n if (!currentMiddleware) {\n return await command.execute(context, input);\n }\n let called = false;\n return await currentMiddleware(command, input, context, async () => {\n if (called) {\n throw new Error('Command middleware next() called multiple times.');\n }\n called = true;\n return await invokeMiddleware(index + 1);\n });\n };\n\n return await invokeMiddleware(0);\n}\n\nfunction invokeCommandSliceCallback<TEvent>(\n callback: ((event: TEvent) => void) | undefined,\n event: TEvent,\n captureException: BaseRoomStoreState['room']['captureException'],\n): void {\n if (!callback) {\n return;\n }\n try {\n callback(event);\n } catch (error) {\n captureException(error);\n }\n}\n\nfunction toCommandKeystrokeArray(keystrokes?: RoomCommandKeystrokes): string[] {\n if (!keystrokes) {\n return [];\n }\n return Array.isArray(keystrokes) ? keystrokes : [keystrokes];\n}\n\nfunction removeCommandIdFromOwner(\n ownerToCommandIds: Record<string, string[]>,\n owner: string,\n commandId: string,\n): void {\n const ownerCommandIds = ownerToCommandIds[owner];\n if (!ownerCommandIds) {\n return;\n }\n\n const filteredIds = ownerCommandIds.filter((id) => id !== commandId);\n if (filteredIds.length === 0) {\n delete ownerToCommandIds[owner];\n return;\n }\n ownerToCommandIds[owner] = filteredIds;\n}\n\nfunction normalizeOwner(owner: string): string {\n const trimmed = owner.trim();\n if (trimmed.length > 0) {\n return trimmed;\n }\n return DEFAULT_COMMAND_OWNER;\n}\n\nfunction normalizeInvocation(\n invocation?: RoomCommandInvocationOptions,\n): RoomCommandInvocation {\n return {\n surface: invocation?.surface ?? DEFAULT_COMMAND_SURFACE,\n actor: invocation?.actor,\n traceId: invocation?.traceId,\n metadata: invocation?.metadata,\n };\n}\n\nfunction resolveCommandVisibility<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n): boolean {\n if (command.ui?.hidden) {\n return false;\n }\n if (!command.isVisible) {\n return true;\n }\n try {\n return command.isVisible(context);\n } catch (error) {\n context.getState().room.captureException(error);\n return false;\n }\n}\n\nfunction resolveCommandEnabled<RS extends BaseRoomStoreState>(\n command: RoomCommand<RS>,\n context: RoomCommandExecutionContext<RS>,\n): boolean {\n if (!command.isEnabled) {\n return true;\n }\n try {\n return command.isEnabled(context);\n } catch (error) {\n context.getState().room.captureException(error);\n return false;\n }\n}\n\nfunction parseCommandInput(schema: ZodType<unknown>, input: unknown): unknown {\n const parsedResult = schema.safeParse(input);\n if (parsedResult.success) {\n return parsedResult.data;\n }\n throw new Error(formatCommandInputValidationError(parsedResult.error));\n}\n\nfunction formatCommandInputValidationError(error: z.ZodError): string {\n const message = error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? issue.path.join('.') : 'input';\n return `${path}: ${issue.message}`;\n })\n .join('; ');\n return message.length > 0\n ? `Invalid command input: ${message}`\n : 'Invalid command input.';\n}\n\nfunction toErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n return String(error);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createPersistHelpers.d.ts","sourceRoot":"","sources":["../src/createPersistHelpers.ts"],"names":[],"mappings":"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AAC,OAAO,CAAC,EACtE,YAAY,EAAE,CAAC;wBAGO,GAAG;4BAcC,GAAG,gBAAgB,GAAG;EAiBjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,OAAO,EAAE;IACP,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC;CACzD,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,EACnD,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAC5B,YAAY,CAAC,CAAC,CAAC,CAajB"}
@@ -1,4 +1,28 @@
1
1
  import { persist } from 'zustand/middleware';
2
+ /**
3
+ * Wraps a Zustand persist storage so that `setItem` silently drops writes
4
+ * whose serialised payload exceeds the engine's string-length limit (or any
5
+ * other serialisation error). This prevents `RangeError: Invalid string
6
+ * length` from crashing the app when the state grows unexpectedly large.
7
+ */
8
+ function createSafeStorage(base) {
9
+ if (!base)
10
+ return base;
11
+ const originalSetItem = base.setItem?.bind(base);
12
+ if (!originalSetItem)
13
+ return base;
14
+ return {
15
+ ...base,
16
+ setItem: (...args) => {
17
+ try {
18
+ return originalSetItem(...args);
19
+ }
20
+ catch (error) {
21
+ console.warn('Persist storage setItem failed (payload too large?):', error instanceof Error ? error.message : error);
22
+ }
23
+ },
24
+ };
25
+ }
2
26
  /**
3
27
  * Creates partialize and merge functions for Zustand persist middleware.
4
28
  * Automatically handles extracting and merging slice configs.
@@ -129,10 +153,12 @@ export function createPersistHelpers(sliceConfigs) {
129
153
  * ```
130
154
  */
131
155
  export function persistSliceConfigs(options, stateCreator) {
132
- const { sliceConfigSchemas, partialize, merge, ...persistOptions } = options;
156
+ const { sliceConfigSchemas, partialize, merge, storage, ...persistOptions } = options;
133
157
  const helpers = createPersistHelpers(sliceConfigSchemas);
158
+ const safeStorage = createSafeStorage(storage);
134
159
  return persist(stateCreator, {
135
160
  ...persistOptions,
161
+ ...(safeStorage ? { storage: safeStorage } : {}),
136
162
  partialize: partialize || helpers.partialize,
137
163
  merge: merge || helpers.merge,
138
164
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createPersistHelpers.js","sourceRoot":"","sources":["../src/createPersistHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAI3D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB,CAClC,YAAe;IAEf,OAAO;QACL,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YACvC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzD,IAAI,CAAC;oBACH,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;gBACjD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,EAAE;wBACnD,KAAK,EAAE,KAAK;qBACb,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,KAAK,EAAE,CAAC,cAAmB,EAAE,YAAiB,EAAE,EAAE;YAChD,MAAM,MAAM,GAAG,EAAC,GAAG,YAAY,EAAC,CAAC;YACjC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzD,IAAI,CAAC;oBACH,MAAM,CAAC,GAAG,CAAC,GAAG;wBACZ,GAAG,YAAY,CAAC,GAAG,CAAC;wBACpB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;qBAC1C,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,EAAE;wBACnD,KAAK,EAAE,KAAK;qBACb,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAImD,EACnD,YAA6B;IAE7B,MAAM,EAAC,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,cAAc,EAAC,GAAG,OAAO,CAAC;IAC3E,MAAM,OAAO,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;IAEzD,OAAO,OAAO,CAAI,YAAY,EAAE;QAC9B,GAAG,cAAc;QACjB,UAAU,EAAE,UAAU,IAAI,OAAO,CAAC,UAAU;QAC5C,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK;KACT,CAAoB,CAAC;AAC7C,CAAC","sourcesContent":["import {persist, PersistOptions} from 'zustand/middleware';\nimport z from 'zod';\nimport {StateCreator} from './BaseRoomStore';\n\n/**\n * Creates partialize and merge functions for Zustand persist middleware.\n * Automatically handles extracting and merging slice configs.\n *\n * @param sliceConfigs - Map of slice names to their Zod config schemas\n * @returns Object with partialize and merge functions\n *\n * @example\n * ```ts\n * const {partialize, merge} = createPersistHelpers({\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * sqlEditor: SqlEditorSliceConfig,\n * });\n *\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persist(\n * (set, get, store) => ({...}),\n * {\n * name: 'my-app-state-storage',\n * partialize,\n * merge,\n * },\n * ) as StateCreator<RoomState>,\n * );\n * ```\n */\nexport function createPersistHelpers<T extends Record<string, z.ZodType>>(\n sliceConfigs: T,\n) {\n return {\n partialize: (state: any) => {\n const result: Record<string, any> = {};\n for (const [key, schema] of Object.entries(sliceConfigs)) {\n try {\n result[key] = schema.parse(state[key]?.config);\n } catch (error) {\n throw new Error(`Error parsing config key \"${key}\"`, {\n cause: error,\n });\n }\n }\n return result;\n },\n\n merge: (persistedState: any, currentState: any) => {\n const merged = {...currentState};\n for (const [key, schema] of Object.entries(sliceConfigs)) {\n try {\n merged[key] = {\n ...currentState[key],\n config: schema.parse(persistedState[key]),\n };\n } catch (error) {\n throw new Error(`Error parsing config key \"${key}\"`, {\n cause: error,\n });\n }\n }\n return merged;\n },\n };\n}\n\n/**\n * Wraps a state creator with Zustand's persist middleware and automatically\n * handles slice config serialization/deserialization using Zod schemas.\n *\n * This helper combines persist functionality with automatic `partialize` and `merge`\n * functions generated from your slice config schemas, eliminating manual type casting.\n *\n * @param options - Persist configuration object\n * @param options.name - Unique storage key (required)\n * @param options.sliceConfigSchemas - Map of slice names to Zod schemas for their configs\n * @param options.partialize - Optional custom partialize function (overrides auto-generated one)\n * @param options.merge - Optional custom merge function (overrides auto-generated one)\n * @param options.storage - Custom storage implementation (optional, defaults to localStorage)\n * @param options.version - Schema version for migrations (optional)\n * @param options.migrate - Migration function for version changes (optional)\n * @param options.skipHydration - Skip auto-hydration for SSR (optional)\n * @param stateCreator - Zustand state creator function\n * @returns Properly typed StateCreator with persist middleware applied\n *\n * @see {@link https://zustand.docs.pmnd.rs/middlewares/persist | Zustand persist middleware docs}\n *\n * @example\n * Basic usage:\n * ```ts\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persistSliceConfigs(\n * {\n * name: 'my-app-state-storage',\n * sliceConfigSchemas: {\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * sqlEditor: SqlEditorSliceConfig,\n * },\n * },\n * (set, get, store) => ({\n * ...createRoomSlice()(set, get, store),\n * ...createLayoutSlice({...})(set, get, store),\n * })\n * )\n * );\n * ```\n *\n * @example\n * With custom partialize/merge for additional state:\n * ```ts\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persistSliceConfigs(\n * {\n * name: 'my-app-state-storage',\n * sliceConfigSchemas: {\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * },\n * partialize: (state) => ({\n * apiKey: state.apiKey, // Persist additional field\n * ...createPersistHelpers({room: BaseRoomConfig, layout: LayoutConfig}).partialize(state),\n * }),\n * merge: (persisted, current) => ({\n * ...createPersistHelpers({room: BaseRoomConfig, layout: LayoutConfig}).merge(persisted, current),\n * apiKey: persisted.apiKey, // Restore additional field\n * }),\n * },\n * (set, get, store) => ({...})\n * )\n * );\n * ```\n */\nexport function persistSliceConfigs<S>(\n options: {\n sliceConfigSchemas: Record<string, z.ZodType>;\n partialize?: (state: S) => Partial<S>;\n merge?: (persistedState: unknown, currentState: S) => S;\n } & Omit<PersistOptions<S>, 'partialize' | 'merge'>,\n stateCreator: StateCreator<S>,\n): StateCreator<S> {\n const {sliceConfigSchemas, partialize, merge, ...persistOptions} = options;\n const helpers = createPersistHelpers(sliceConfigSchemas);\n\n return persist<S>(stateCreator, {\n ...persistOptions,\n partialize: partialize || helpers.partialize,\n merge: merge || helpers.merge,\n } as PersistOptions<S>) as StateCreator<S>;\n}\n"]}
1
+ {"version":3,"file":"createPersistHelpers.js","sourceRoot":"","sources":["../src/createPersistHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAI3D;;;;;GAKG;AACH,SAAS,iBAAiB,CACxB,IAAkC;IAElC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,eAAe,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,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBACzD,IAAI,CAAC;oBACH,MAAM,CAAC,GAAG,CAAC,GAAG;wBACZ,GAAG,YAAY,CAAC,GAAG,CAAC;wBACpB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;qBAC1C,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,EAAE;wBACnD,KAAK,EAAE,KAAK;qBACb,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAImD,EACnD,YAA6B;IAE7B,MAAM,EAAC,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,EAAC,GACvE,OAAO,CAAC;IACV,MAAM,OAAO,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;IAEzD,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE/C,OAAO,OAAO,CAAI,YAAY,EAAE;QAC9B,GAAG,cAAc;QACjB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,UAAU,EAAE,UAAU,IAAI,OAAO,CAAC,UAAU;QAC5C,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK;KACT,CAAoB,CAAC;AAC7C,CAAC","sourcesContent":["import {persist, PersistOptions} from 'zustand/middleware';\nimport z from 'zod';\nimport {StateCreator} from './BaseRoomStore';\n\n/**\n * Wraps a Zustand persist storage so that `setItem` silently drops writes\n * whose serialised payload exceeds the engine's string-length limit (or any\n * other serialisation error). This prevents `RangeError: Invalid string\n * length` from crashing the app when the state grows unexpectedly large.\n */\nfunction createSafeStorage<S>(\n base: PersistOptions<S>['storage'],\n): PersistOptions<S>['storage'] {\n if (!base) return base;\n const originalSetItem = base.setItem?.bind(base);\n if (!originalSetItem) return base;\n return {\n ...base,\n setItem: (...args: Parameters<typeof originalSetItem>) => {\n try {\n return originalSetItem(...args);\n } catch (error) {\n console.warn(\n 'Persist storage setItem failed (payload too large?):',\n error instanceof Error ? error.message : error,\n );\n }\n },\n };\n}\n\n/**\n * Creates partialize and merge functions for Zustand persist middleware.\n * Automatically handles extracting and merging slice configs.\n *\n * @param sliceConfigs - Map of slice names to their Zod config schemas\n * @returns Object with partialize and merge functions\n *\n * @example\n * ```ts\n * const {partialize, merge} = createPersistHelpers({\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * sqlEditor: SqlEditorSliceConfig,\n * });\n *\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persist(\n * (set, get, store) => ({...}),\n * {\n * name: 'my-app-state-storage',\n * partialize,\n * merge,\n * },\n * ) as StateCreator<RoomState>,\n * );\n * ```\n */\nexport function createPersistHelpers<T extends Record<string, z.ZodType>>(\n sliceConfigs: T,\n) {\n return {\n partialize: (state: any) => {\n const result: Record<string, any> = {};\n for (const [key, schema] of Object.entries(sliceConfigs)) {\n try {\n result[key] = schema.parse(state[key]?.config);\n } catch (error) {\n throw new Error(`Error parsing config key \"${key}\"`, {\n cause: error,\n });\n }\n }\n return result;\n },\n\n merge: (persistedState: any, currentState: any) => {\n const merged = {...currentState};\n for (const [key, schema] of Object.entries(sliceConfigs)) {\n try {\n merged[key] = {\n ...currentState[key],\n config: schema.parse(persistedState[key]),\n };\n } catch (error) {\n throw new Error(`Error parsing config key \"${key}\"`, {\n cause: error,\n });\n }\n }\n return merged;\n },\n };\n}\n\n/**\n * Wraps a state creator with Zustand's persist middleware and automatically\n * handles slice config serialization/deserialization using Zod schemas.\n *\n * This helper combines persist functionality with automatic `partialize` and `merge`\n * functions generated from your slice config schemas, eliminating manual type casting.\n *\n * @param options - Persist configuration object\n * @param options.name - Unique storage key (required)\n * @param options.sliceConfigSchemas - Map of slice names to Zod schemas for their configs\n * @param options.partialize - Optional custom partialize function (overrides auto-generated one)\n * @param options.merge - Optional custom merge function (overrides auto-generated one)\n * @param options.storage - Custom storage implementation (optional, defaults to localStorage)\n * @param options.version - Schema version for migrations (optional)\n * @param options.migrate - Migration function for version changes (optional)\n * @param options.skipHydration - Skip auto-hydration for SSR (optional)\n * @param stateCreator - Zustand state creator function\n * @returns Properly typed StateCreator with persist middleware applied\n *\n * @see {@link https://zustand.docs.pmnd.rs/middlewares/persist | Zustand persist middleware docs}\n *\n * @example\n * Basic usage:\n * ```ts\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persistSliceConfigs(\n * {\n * name: 'my-app-state-storage',\n * sliceConfigSchemas: {\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * sqlEditor: SqlEditorSliceConfig,\n * },\n * },\n * (set, get, store) => ({\n * ...createRoomSlice()(set, get, store),\n * ...createLayoutSlice({...})(set, get, store),\n * })\n * )\n * );\n * ```\n *\n * @example\n * With custom partialize/merge for additional state:\n * ```ts\n * export const {roomStore, useRoomStore} = createRoomStore<RoomState>(\n * persistSliceConfigs(\n * {\n * name: 'my-app-state-storage',\n * sliceConfigSchemas: {\n * room: BaseRoomConfig,\n * layout: LayoutConfig,\n * },\n * partialize: (state) => ({\n * apiKey: state.apiKey, // Persist additional field\n * ...createPersistHelpers({room: BaseRoomConfig, layout: LayoutConfig}).partialize(state),\n * }),\n * merge: (persisted, current) => ({\n * ...createPersistHelpers({room: BaseRoomConfig, layout: LayoutConfig}).merge(persisted, current),\n * apiKey: persisted.apiKey, // Restore additional field\n * }),\n * },\n * (set, get, store) => ({...})\n * )\n * );\n * ```\n */\nexport function persistSliceConfigs<S>(\n options: {\n sliceConfigSchemas: Record<string, z.ZodType>;\n partialize?: (state: S) => Partial<S>;\n merge?: (persistedState: unknown, currentState: S) => S;\n } & Omit<PersistOptions<S>, 'partialize' | 'merge'>,\n stateCreator: StateCreator<S>,\n): StateCreator<S> {\n const {sliceConfigSchemas, partialize, merge, storage, ...persistOptions} =\n options;\n const helpers = createPersistHelpers(sliceConfigSchemas);\n\n const safeStorage = createSafeStorage(storage);\n\n return persist<S>(stateCreator, {\n ...persistOptions,\n ...(safeStorage ? {storage: safeStorage} : {}),\n partialize: partialize || helpers.partialize,\n merge: merge || helpers.merge,\n } as PersistOptions<S>) as StateCreator<S>;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/room-store",
3
- "version": "0.29.0-rc.0",
3
+ "version": "0.29.0-rc.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/sqlrooms/sqlrooms.git"
13
+ "url": "git+https://github.com/sqlrooms/sqlrooms.git"
14
14
  },
15
15
  "files": [
16
16
  "dist"
@@ -19,7 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@sqlrooms/room-config": "0.29.0-rc.0",
22
+ "@sqlrooms/room-config": "0.29.0-rc.2",
23
23
  "immer": "^11.0.1",
24
24
  "zod": "^4.1.8",
25
25
  "zustand": "^5.0.8"
@@ -37,8 +37,8 @@
37
37
  "typedoc": "typedoc"
38
38
  },
39
39
  "devDependencies": {
40
- "@sqlrooms/preset-jest": "0.29.0-rc.0",
40
+ "@sqlrooms/preset-jest": "0.29.0-rc.2",
41
41
  "ts-jest": "^29.4.4"
42
42
  },
43
- "gitHead": "afdb949c9601b4cdeaae966157a25a54aea2ae54"
43
+ "gitHead": "5d511631992c1af8852ea79ced488867aad4a555"
44
44
  }