@sqlrooms/room-store 0.28.0 → 0.28.1-rc.0

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.
@@ -28,6 +28,7 @@ export type RoomCommandInputComponentProps = {
28
28
  };
29
29
  export type RoomCommandInputComponent = ComponentType<RoomCommandInputComponentProps>;
30
30
  export type RoomCommandRiskLevel = 'low' | 'medium' | 'high';
31
+ export type RoomCommandKeystrokes = string | string[];
31
32
  export type RoomCommandPolicyMetadata = {
32
33
  readOnly?: boolean;
33
34
  idempotent?: boolean;
@@ -36,6 +37,7 @@ export type RoomCommandPolicyMetadata = {
36
37
  };
37
38
  export type RoomCommandUiMetadata = {
38
39
  shortcut?: string;
40
+ keystrokes?: RoomCommandKeystrokes;
39
41
  inputComponent?: RoomCommandInputComponent;
40
42
  hidden?: boolean;
41
43
  };
@@ -48,6 +50,32 @@ export type RoomCommandResult<TData = unknown> = {
48
50
  error?: string;
49
51
  };
50
52
  export type RoomCommandExecuteOutput<TData = unknown> = RoomCommandResult<TData> | TData | void;
53
+ export type RoomCommandMiddlewareNext = () => Promise<RoomCommandExecuteOutput>;
54
+ export type RoomCommandMiddleware<RS extends BaseRoomStoreState = BaseRoomStoreState> = (command: RegisteredRoomCommand<RS>, input: unknown, context: RoomCommandExecutionContext<RS>, next: RoomCommandMiddlewareNext) => RoomCommandExecuteOutput | Promise<RoomCommandExecuteOutput>;
55
+ export type RoomCommandInvokeStartEvent<RS extends BaseRoomStoreState = BaseRoomStoreState> = {
56
+ command: RegisteredRoomCommand<RS>;
57
+ input: unknown;
58
+ context: RoomCommandExecutionContext<RS>;
59
+ };
60
+ export type RoomCommandInvokeSuccessEvent<RS extends BaseRoomStoreState = BaseRoomStoreState> = RoomCommandInvokeStartEvent<RS> & {
61
+ result: RoomCommandResult;
62
+ durationMs: number;
63
+ };
64
+ export type RoomCommandInvokeFailureEvent<RS extends BaseRoomStoreState = BaseRoomStoreState> = RoomCommandInvokeStartEvent<RS> & {
65
+ result: RoomCommandResult;
66
+ durationMs: number;
67
+ };
68
+ export type RoomCommandInvokeErrorEvent<RS extends BaseRoomStoreState = BaseRoomStoreState> = RoomCommandInvokeStartEvent<RS> & {
69
+ error: unknown;
70
+ durationMs: number;
71
+ };
72
+ export type CreateCommandSliceProps<RS extends BaseRoomStoreState = BaseRoomStoreState> = {
73
+ middleware?: RoomCommandMiddleware<RS>[];
74
+ onCommandInvokeStart?: (event: RoomCommandInvokeStartEvent<RS>) => void;
75
+ onCommandInvokeSuccess?: (event: RoomCommandInvokeSuccessEvent<RS>) => void;
76
+ onCommandInvokeFailure?: (event: RoomCommandInvokeFailureEvent<RS>) => void;
77
+ onCommandInvokeError?: (event: RoomCommandInvokeErrorEvent<RS>) => void;
78
+ };
51
79
  export type RoomCommand<RS extends BaseRoomStoreState = BaseRoomStoreState> = {
52
80
  id: string;
53
81
  name: string;
@@ -62,6 +90,8 @@ export type RoomCommand<RS extends BaseRoomStoreState = BaseRoomStoreState> = {
62
90
  isEnabled?: RoomCommandPredicate<RS>;
63
91
  metadata?: RoomCommandPolicyMetadata;
64
92
  ui?: RoomCommandUiMetadata;
93
+ /** @deprecated Use ui?.keystrokes */
94
+ keystrokes?: RoomCommandKeystrokes;
65
95
  /** @deprecated Use ui?.shortcut */
66
96
  shortcut?: string;
67
97
  /** @deprecated Use ui?.inputComponent */
@@ -90,6 +120,7 @@ export type RoomCommandDescriptor = {
90
120
  requiresInput: boolean;
91
121
  inputDescription?: string;
92
122
  inputSchema?: RoomCommandPortableSchema;
123
+ keystrokes: string[];
93
124
  shortcut?: string;
94
125
  readOnly: boolean;
95
126
  idempotent: boolean;
@@ -115,7 +146,7 @@ export type CommandSliceState<RS extends BaseRoomStoreState = BaseRoomStoreState
115
146
  executeCommand: (commandId: string, input?: unknown, invocation?: RoomCommandInvocationOptions) => Promise<void>;
116
147
  };
117
148
  };
118
- export declare function createCommandSlice<RS extends BaseRoomStoreState = BaseRoomStoreState>(): StateCreator<CommandSliceState<RS>>;
149
+ export declare function createCommandSlice<RS extends BaseRoomStoreState = BaseRoomStoreState>(props?: CreateCommandSliceProps<RS>): StateCreator<CommandSliceState<RS>>;
119
150
  export declare function createRoomCommandExecutionContext<RS extends BaseRoomStoreState>(store: StoreApi<RS>, invocation?: RoomCommandInvocationOptions): RoomCommandExecutionContext<RS>;
120
151
  export declare function hasCommandSliceState(state: unknown): state is BaseRoomStoreState & CommandSliceState;
121
152
  export declare function registerCommandsForOwner<RS extends BaseRoomStoreState>(store: StoreApi<RS>, owner: string, commands: RoomCommand<RS>[]): void;
@@ -124,7 +155,8 @@ export declare function listCommandsFromStore<RS extends BaseRoomStoreState>(sto
124
155
  export declare function invokeCommandFromStore<RS extends BaseRoomStoreState>(store: StoreApi<RS>, commandId: string, input?: unknown, invocation?: RoomCommandInvocationOptions): Promise<RoomCommandResult>;
125
156
  export declare function validateCommandInput<RS extends BaseRoomStoreState>(command: RoomCommand<RS>, input: unknown, context: RoomCommandExecutionContext<RS>): Promise<unknown>;
126
157
  export declare function doesCommandRequireInput(command: Pick<RoomCommand, 'inputSchema'>): boolean;
127
- export declare function getCommandShortcut(command: Pick<RoomCommand, 'ui' | 'shortcut'>): string | undefined;
158
+ export declare function getCommandShortcut(command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>): string | undefined;
159
+ export declare function getCommandKeystrokes(command: Pick<RoomCommand, 'ui' | 'shortcut' | 'keystrokes'>): string[];
128
160
  export declare function getCommandInputComponent(command: Pick<RoomCommand, 'ui' | 'inputComponent'>): RoomCommandInputComponent | undefined;
129
161
  export declare function resolveCommandPolicyMetadata(command: Pick<RoomCommand, 'metadata' | 'readOnly' | 'idempotent' | 'riskLevel' | 'requiresConfirmation'>): Required<RoomCommandPolicyMetadata>;
130
162
  export declare function exportCommandInputSchema(schema: ZodType<unknown> | undefined): RoomCommandPortableSchema | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandSlice.d.ts","sourceRoot":"","sources":["../src/CommandSl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,EAAE,IAAI,GAAG,UAAU,GAAG,YAAY,CAAC,GAC3D,MAAM,EAAE,CAoBV;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,gBAAgB,CAAC,GAClD,yBAAyB,GAAG,SAAS,CAEvC;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CACX,WAAW,EACT,UAAU,GACV,UAAU,GACV,YAAY,GACZ,WAAW,GACX,sBAAsB,CACzB,GACA,QAAQ,CAAC,yBAAyB,CAAC,CAUrC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GACnC,yBAAyB,GAAG,SAAS,CAKvC"}
@@ -3,7 +3,8 @@ import { createSlice } from './BaseRoomStore';
3
3
  import { toPortableSchema } from './toPortableSchema';
4
4
  const DEFAULT_COMMAND_OWNER = 'global';
5
5
  const DEFAULT_COMMAND_SURFACE = 'unknown';
6
- export function createCommandSlice() {
6
+ export function createCommandSlice(props) {
7
+ const middleware = props?.middleware ?? [];
7
8
  return createSlice((set, get, store) => ({
8
9
  commands: {
9
10
  registry: {},
@@ -101,13 +102,39 @@ export function createCommandSlice() {
101
102
  error: `Command "${command.name}" is currently disabled.`,
102
103
  };
103
104
  }
105
+ const invocationStartEvent = {
106
+ command,
107
+ input,
108
+ context: executionContext,
109
+ };
110
+ const invocationStartedAt = Date.now();
111
+ invokeCommandSliceCallback(props?.onCommandInvokeStart, invocationStartEvent, get().room.captureException);
104
112
  try {
105
113
  const validatedInput = await validateCommandInput(command, input, executionContext);
106
- const rawResult = await command.execute(executionContext, validatedInput);
107
- return normalizeCommandExecuteResult(command.id, rawResult);
114
+ const rawResult = await runCommandExecutionMiddleware(middleware, command, validatedInput, executionContext);
115
+ const normalizedResult = normalizeCommandExecuteResult(command.id, rawResult);
116
+ const invocationResultEvent = {
117
+ command,
118
+ input: validatedInput,
119
+ context: executionContext,
120
+ result: normalizedResult,
121
+ durationMs: Date.now() - invocationStartedAt,
122
+ };
123
+ if (normalizedResult.success) {
124
+ invokeCommandSliceCallback(props?.onCommandInvokeSuccess, invocationResultEvent, get().room.captureException);
125
+ }
126
+ else {
127
+ invokeCommandSliceCallback(props?.onCommandInvokeFailure, invocationResultEvent, get().room.captureException);
128
+ }
129
+ return normalizedResult;
108
130
  }
109
131
  catch (error) {
110
132
  get().room.captureException(error);
133
+ invokeCommandSliceCallback(props?.onCommandInvokeError, {
134
+ ...invocationStartEvent,
135
+ error,
136
+ durationMs: Date.now() - invocationStartedAt,
137
+ }, get().room.captureException);
111
138
  return {
112
139
  success: false,
113
140
  commandId: command.id,
@@ -202,7 +229,27 @@ export function doesCommandRequireInput(command) {
202
229
  return !command.inputSchema.safeParse(undefined).success;
203
230
  }
204
231
  export function getCommandShortcut(command) {
205
- return command.ui?.shortcut ?? command.shortcut;
232
+ return getCommandKeystrokes(command)[0];
233
+ }
234
+ export function getCommandKeystrokes(command) {
235
+ const keystrokes = [
236
+ ...toCommandKeystrokeArray(command.ui?.keystrokes),
237
+ ...toCommandKeystrokeArray(command.keystrokes),
238
+ ...toCommandKeystrokeArray(command.ui?.shortcut),
239
+ ...toCommandKeystrokeArray(command.shortcut),
240
+ ];
241
+ const deduplicated = new Set();
242
+ for (const keystroke of keystrokes) {
243
+ if (typeof keystroke !== 'string') {
244
+ continue;
245
+ }
246
+ const trimmed = keystroke.trim();
247
+ if (!trimmed) {
248
+ continue;
249
+ }
250
+ deduplicated.add(trimmed);
251
+ }
252
+ return Array.from(deduplicated);
206
253
  }
207
254
  export function getCommandInputComponent(command) {
208
255
  return command.ui?.inputComponent ?? command.inputComponent;
@@ -225,6 +272,7 @@ export function exportCommandInputSchema(schema) {
225
272
  }
226
273
  function createCommandDescriptor(command, context, includeInputSchema) {
227
274
  const metadata = resolveCommandPolicyMetadata(command);
275
+ const keystrokes = getCommandKeystrokes(command);
228
276
  return {
229
277
  id: command.id,
230
278
  owner: command.owner,
@@ -239,7 +287,8 @@ function createCommandDescriptor(command, context, includeInputSchema) {
239
287
  inputSchema: includeInputSchema
240
288
  ? exportCommandInputSchema(command.inputSchema)
241
289
  : undefined,
242
- shortcut: getCommandShortcut(command),
290
+ keystrokes,
291
+ shortcut: keystrokes[0],
243
292
  ...metadata,
244
293
  };
245
294
  }
@@ -263,6 +312,40 @@ function isRoomCommandResult(value) {
263
312
  typeof value.success === 'boolean' &&
264
313
  'commandId' in value);
265
314
  }
315
+ async function runCommandExecutionMiddleware(middleware, command, input, context) {
316
+ const invokeMiddleware = async (index) => {
317
+ const currentMiddleware = middleware[index];
318
+ if (!currentMiddleware) {
319
+ return await command.execute(context, input);
320
+ }
321
+ let called = false;
322
+ return await currentMiddleware(command, input, context, async () => {
323
+ if (called) {
324
+ throw new Error('Command middleware next() called multiple times.');
325
+ }
326
+ called = true;
327
+ return await invokeMiddleware(index + 1);
328
+ });
329
+ };
330
+ return await invokeMiddleware(0);
331
+ }
332
+ function invokeCommandSliceCallback(callback, event, captureException) {
333
+ if (!callback) {
334
+ return;
335
+ }
336
+ try {
337
+ callback(event);
338
+ }
339
+ catch (error) {
340
+ captureException(error);
341
+ }
342
+ }
343
+ function toCommandKeystrokeArray(keystrokes) {
344
+ if (!keystrokes) {
345
+ return [];
346
+ }
347
+ return Array.isArray(keystrokes) ? keystrokes : [keystrokes];
348
+ }
266
349
  function removeCommandIdFromOwner(ownerToCommandIds, owner, commandId) {
267
350
  const ownerCommandIds = ownerToCommandIds[owner];
268
351
  if (!ownerCommandIds) {
@@ -1 +1 @@
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;AAC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D,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';\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 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 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?.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 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>(): StateCreator<CommandSliceState<RS>> {\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 try {\n const validatedInput = await validateCommandInput(\n command,\n input,\n executionContext,\n );\n const rawResult = await command.execute(\n executionContext,\n validatedInput,\n );\n return normalizeCommandExecuteResult(command.id, rawResult);\n } catch (error) {\n get().room.captureException(error);\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'>,\n): string | undefined {\n return command.ui?.shortcut ?? command.shortcut;\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 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 shortcut: getCommandShortcut(command),\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\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;AA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AAC,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"]}
package/dist/index.d.ts CHANGED
@@ -8,8 +8,8 @@ export { createBaseRoomSlice, createBaseSlice, createSlice, createRoomSlice, cre
8
8
  export type { BaseRoomStoreState, CreateBaseRoomSliceProps, BaseRoomStore, UseRoomStore, } from './BaseRoomStore';
9
9
  export { createPersistHelpers, persistSliceConfigs, } from './createPersistHelpers';
10
10
  export type { StateCreator, StoreApi } from 'zustand';
11
- export { createCommandSlice, createRoomCommandExecutionContext, doesCommandRequireInput, exportCommandInputSchema, getCommandInputComponent, getCommandShortcut, hasCommandSliceState, invokeCommandFromStore, listCommandsFromStore, registerCommandsForOwner, resolveCommandPolicyMetadata, unregisterCommandsForOwner, validateCommandInput, } from './CommandSlice';
12
- export type { CommandSliceState, RoomCommandDescriptor, RoomCommandExecuteOutput, RoomCommandInvocation, RoomCommandInvocationOptions, RegisteredRoomCommand, RoomCommand, RoomCommandInputComponent, RoomCommandInputComponentProps, RoomCommandListOptions, RoomCommandPolicyMetadata, RoomCommandPortableSchema, RoomCommandResult, RoomCommandRiskLevel, RoomCommandSurface, RoomCommandUiMetadata, RoomCommandExecutionContext, RoomCommandPredicate, } from './CommandSlice';
11
+ export { createCommandSlice, createRoomCommandExecutionContext, doesCommandRequireInput, exportCommandInputSchema, getCommandKeystrokes, getCommandInputComponent, getCommandShortcut, hasCommandSliceState, invokeCommandFromStore, listCommandsFromStore, registerCommandsForOwner, resolveCommandPolicyMetadata, unregisterCommandsForOwner, validateCommandInput, } from './CommandSlice';
12
+ export type { CommandSliceState, CreateCommandSliceProps, RoomCommandDescriptor, RoomCommandExecuteOutput, RoomCommandKeystrokes, RoomCommandInvocation, RoomCommandInvokeFailureEvent, RoomCommandInvokeErrorEvent, RoomCommandInvocationOptions, RoomCommandInvokeStartEvent, RoomCommandInvokeSuccessEvent, RoomCommandMiddleware, RoomCommandMiddlewareNext, RegisteredRoomCommand, RoomCommand, RoomCommandInputComponent, RoomCommandInputComponentProps, RoomCommandListOptions, RoomCommandPolicyMetadata, RoomCommandPortableSchema, RoomCommandResult, RoomCommandRiskLevel, RoomCommandSurface, RoomCommandUiMetadata, RoomCommandExecutionContext, RoomCommandPredicate, } from './CommandSlice';
13
13
  export { createCommandCliAdapter, createCommandMcpAdapter, } from './CommandAdapters';
14
14
  export type { CommandCliAdapter, CommandCliAdapterOptions, CommandMcpAdapter, CommandMcpAdapterOptions, CommandMcpToolDescriptor, } from './CommandAdapters';
15
15
  export { BaseRoomConfig, DEFAULT_ROOM_TITLE, createDefaultBaseRoomConfig, DataSourceTypes, BaseDataSource, FileDataSource, UrlDataSource, SqlQueryDataSource, DataSource, isFileDataSource, isUrlDataSource, isSqlQueryDataSource, LoadFile, StandardLoadOptions, SpatialLoadOptions, SpatialLoadFileOptions, isSpatialLoadFileOptions, StandardLoadFileOptions, LoadFileOptions, MAIN_VIEW, LayoutTypes, DEFAULT_MOSAIC_LAYOUT, createDefaultMosaicLayout, MosaicLayoutDirection, MosaicLayoutParent, isMosaicLayoutParent, MosaicLayoutNodeKey, MosaicLayoutNode, MosaicLayoutConfig, LayoutConfig, } from '@sqlrooms/room-config';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEpD,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,8BAA8B,EAC9B,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,YAAY,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AuB,EACvB,eAAe,EACf,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  export { RoomStateContext, RoomStateProvider, useBaseRoomStore, useRoomStoreApi, } from './RoomStateProvider';
6
6
  export { createBaseRoomSlice, createBaseSlice, createSlice, createRoomSlice, createRoomStore, createRoomStoreCreator, isRoomSliceWithDestroy, isRoomSliceWithInitialize, } from './BaseRoomStore';
7
7
  export { createPersistHelpers, persistSliceConfigs, } from './createPersistHelpers';
8
- export { createCommandSlice, createRoomCommandExecutionContext, doesCommandRequireInput, exportCommandInputSchema, getCommandInputComponent, getCommandShortcut, hasCommandSliceState, invokeCommandFromStore, listCommandsFromStore, registerCommandsForOwner, resolveCommandPolicyMetadata, unregisterCommandsForOwner, validateCommandInput, } from './CommandSlice';
8
+ export { createCommandSlice, createRoomCommandExecutionContext, doesCommandRequireInput, exportCommandInputSchema, getCommandKeystrokes, getCommandInputComponent, getCommandShortcut, hasCommandSliceState, invokeCommandFromStore, listCommandsFromStore, registerCommandsForOwner, resolveCommandPolicyMetadata, unregisterCommandsForOwner, validateCommandInput, } from './CommandSlice';
9
9
  export { createCommandCliAdapter, createCommandMcpAdapter, } from './CommandAdapters';
10
10
  // Re-export from @sqlrooms/room-config
11
11
  // Values also export their corresponding types automatically (Zod pattern)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAqBxB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAS3B,uCAAuC;AACvC,2EAA2E;AAC3E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,uBAAuB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n RoomStateContext,\n RoomStateProvider,\n useBaseRoomStore,\n useRoomStoreApi,\n} from './RoomStateProvider';\nexport type {RoomStateProviderProps} from './RoomStateProvider';\n\nexport {\n createBaseRoomSlice,\n createBaseSlice,\n createSlice,\n createRoomSlice,\n createRoomStore,\n createRoomStoreCreator,\n isRoomSliceWithDestroy,\n isRoomSliceWithInitialize,\n} from './BaseRoomStore';\nexport type {\n BaseRoomStoreState,\n CreateBaseRoomSliceProps,\n BaseRoomStore,\n UseRoomStore,\n} from './BaseRoomStore';\n\nexport {\n createPersistHelpers,\n persistSliceConfigs,\n} from './createPersistHelpers';\nexport type {StateCreator, StoreApi} from 'zustand';\n\nexport {\n createCommandSlice,\n createRoomCommandExecutionContext,\n doesCommandRequireInput,\n exportCommandInputSchema,\n getCommandInputComponent,\n getCommandShortcut,\n hasCommandSliceState,\n invokeCommandFromStore,\n listCommandsFromStore,\n registerCommandsForOwner,\n resolveCommandPolicyMetadata,\n unregisterCommandsForOwner,\n validateCommandInput,\n} from './CommandSlice';\nexport type {\n CommandSliceState,\n RoomCommandDescriptor,\n RoomCommandExecuteOutput,\n RoomCommandInvocation,\n RoomCommandInvocationOptions,\n RegisteredRoomCommand,\n RoomCommand,\n RoomCommandInputComponent,\n RoomCommandInputComponentProps,\n RoomCommandListOptions,\n RoomCommandPolicyMetadata,\n RoomCommandPortableSchema,\n RoomCommandResult,\n RoomCommandRiskLevel,\n RoomCommandSurface,\n RoomCommandUiMetadata,\n RoomCommandExecutionContext,\n RoomCommandPredicate,\n} from './CommandSlice';\nexport {\n createCommandCliAdapter,\n createCommandMcpAdapter,\n} from './CommandAdapters';\nexport type {\n CommandCliAdapter,\n CommandCliAdapterOptions,\n CommandMcpAdapter,\n CommandMcpAdapterOptions,\n CommandMcpToolDescriptor,\n} from './CommandAdapters';\n\n// Re-export from @sqlrooms/room-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n BaseRoomConfig,\n DEFAULT_ROOM_TITLE,\n createDefaultBaseRoomConfig,\n DataSourceTypes,\n BaseDataSource,\n FileDataSource,\n UrlDataSource,\n SqlQueryDataSource,\n DataSource,\n isFileDataSource,\n isUrlDataSource,\n isSqlQueryDataSource,\n LoadFile,\n StandardLoadOptions,\n SpatialLoadOptions,\n SpatialLoadFileOptions,\n isSpatialLoadFileOptions,\n StandardLoadFileOptions,\n LoadFileOptions,\n MAIN_VIEW,\n LayoutTypes,\n DEFAULT_MOSAIC_LAYOUT,\n createDefaultMosaicLayout,\n MosaicLayoutDirection,\n MosaicLayoutParent,\n isMosaicLayoutParent,\n MosaicLayoutNodeKey,\n MosaicLayoutNode,\n MosaicLayoutConfig,\n LayoutConfig,\n} from '@sqlrooms/room-config';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AA6BxB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAS3B,uCAAuC;AACvC,2EAA2E;AAC3E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,uBAAuB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n RoomStateContext,\n RoomStateProvider,\n useBaseRoomStore,\n useRoomStoreApi,\n} from './RoomStateProvider';\nexport type {RoomStateProviderProps} from './RoomStateProvider';\n\nexport {\n createBaseRoomSlice,\n createBaseSlice,\n createSlice,\n createRoomSlice,\n createRoomStore,\n createRoomStoreCreator,\n isRoomSliceWithDestroy,\n isRoomSliceWithInitialize,\n} from './BaseRoomStore';\nexport type {\n BaseRoomStoreState,\n CreateBaseRoomSliceProps,\n BaseRoomStore,\n UseRoomStore,\n} from './BaseRoomStore';\n\nexport {\n createPersistHelpers,\n persistSliceConfigs,\n} from './createPersistHelpers';\nexport type {StateCreator, StoreApi} from 'zustand';\n\nexport {\n createCommandSlice,\n createRoomCommandExecutionContext,\n doesCommandRequireInput,\n exportCommandInputSchema,\n getCommandKeystrokes,\n getCommandInputComponent,\n getCommandShortcut,\n hasCommandSliceState,\n invokeCommandFromStore,\n listCommandsFromStore,\n registerCommandsForOwner,\n resolveCommandPolicyMetadata,\n unregisterCommandsForOwner,\n validateCommandInput,\n} from './CommandSlice';\nexport type {\n CommandSliceState,\n CreateCommandSliceProps,\n RoomCommandDescriptor,\n RoomCommandExecuteOutput,\n RoomCommandKeystrokes,\n RoomCommandInvocation,\n RoomCommandInvokeFailureEvent,\n RoomCommandInvokeErrorEvent,\n RoomCommandInvocationOptions,\n RoomCommandInvokeStartEvent,\n RoomCommandInvokeSuccessEvent,\n RoomCommandMiddleware,\n RoomCommandMiddlewareNext,\n RegisteredRoomCommand,\n RoomCommand,\n RoomCommandInputComponent,\n RoomCommandInputComponentProps,\n RoomCommandListOptions,\n RoomCommandPolicyMetadata,\n RoomCommandPortableSchema,\n RoomCommandResult,\n RoomCommandRiskLevel,\n RoomCommandSurface,\n RoomCommandUiMetadata,\n RoomCommandExecutionContext,\n RoomCommandPredicate,\n} from './CommandSlice';\nexport {\n createCommandCliAdapter,\n createCommandMcpAdapter,\n} from './CommandAdapters';\nexport type {\n CommandCliAdapter,\n CommandCliAdapterOptions,\n CommandMcpAdapter,\n CommandMcpAdapterOptions,\n CommandMcpToolDescriptor,\n} from './CommandAdapters';\n\n// Re-export from @sqlrooms/room-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n BaseRoomConfig,\n DEFAULT_ROOM_TITLE,\n createDefaultBaseRoomConfig,\n DataSourceTypes,\n BaseDataSource,\n FileDataSource,\n UrlDataSource,\n SqlQueryDataSource,\n DataSource,\n isFileDataSource,\n isUrlDataSource,\n isSqlQueryDataSource,\n LoadFile,\n StandardLoadOptions,\n SpatialLoadOptions,\n SpatialLoadFileOptions,\n isSpatialLoadFileOptions,\n StandardLoadFileOptions,\n LoadFileOptions,\n MAIN_VIEW,\n LayoutTypes,\n DEFAULT_MOSAIC_LAYOUT,\n createDefaultMosaicLayout,\n MosaicLayoutDirection,\n MosaicLayoutParent,\n isMosaicLayoutParent,\n MosaicLayoutNodeKey,\n MosaicLayoutNode,\n MosaicLayoutConfig,\n LayoutConfig,\n} from '@sqlrooms/room-config';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/room-store",
3
- "version": "0.28.0",
3
+ "version": "0.28.1-rc.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@sqlrooms/room-config": "0.28.0",
22
+ "@sqlrooms/room-config": "0.28.1-rc.0",
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.28.0",
40
+ "@sqlrooms/preset-jest": "0.28.1-rc.0",
41
41
  "ts-jest": "^29.4.4"
42
42
  },
43
- "gitHead": "dcac54f8adf77240e293c93d224a0ce9fd8142a9"
43
+ "gitHead": "1e0dcae95d1ccdbcd1b32df1d647d0f794b94e5e"
44
44
  }