@stina/extension-api 0.8.1 → 0.9.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.
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/{types-Cr8eCJ0G.d.cts → types-DiSR4tCQ.d.cts} +99 -1
- package/dist/{types-Cr8eCJ0G.d.ts → types-DiSR4tCQ.d.ts} +99 -1
- package/package.json +1 -1
- package/src/index.ts +9 -0
- package/src/types.components.ts +184 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/messages.ts"],"sourcesContent":["/**\n * @stina/extension-api\n *\n * Types and utilities for building Stina extensions.\n *\n * Extensions should import from this package for type definitions.\n * The runtime (worker-side code) should import from '@stina/extension-api/runtime'.\n */\n\n// Types\nexport type {\n // Manifest\n ExtensionManifest,\n Platform,\n ExtensionContributions,\n SettingDefinition,\n SettingOptionsMapping,\n SettingCreateMapping,\n ToolSettingsViewDefinition,\n ToolSettingsView,\n ToolSettingsListView,\n ToolSettingsListMapping,\n PanelDefinition,\n PanelView,\n PanelComponentView,\n PanelActionDataSource,\n PanelUnknownView,\n ProviderDefinition,\n PromptContribution,\n PromptSection,\n ToolDefinition,\n CommandDefinition,\n\n // Provider Configuration Schema\n ProviderConfigSchema,\n ProviderConfigProperty,\n ProviderConfigPropertyType,\n ProviderConfigSelectOption,\n ProviderConfigValidation,\n\n // Permissions\n Permission,\n NetworkPermission,\n StoragePermission,\n UserDataPermission,\n CapabilityPermission,\n SystemPermission,\n\n // Context\n ExtensionContext,\n Disposable,\n NetworkAPI,\n SettingsAPI,\n ProvidersAPI,\n ToolsAPI,\n ActionsAPI,\n EventsAPI,\n SchedulerAPI,\n SchedulerJobRequest,\n SchedulerSchedule,\n SchedulerFirePayload,\n UserAPI,\n UserProfile,\n ChatAPI,\n ChatInstructionMessage,\n DatabaseAPI,\n StorageAPI,\n LogAPI,\n\n // AI Provider\n AIProvider,\n ModelInfo,\n ChatMessage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolCall,\n\n // Tools\n Tool,\n ToolResult,\n\n // Actions\n Action,\n ActionResult,\n\n // Entry point\n ExtensionModule,\n} from './types.js'\n\n// Messages (for host implementation)\nexport type {\n HostToWorkerMessage,\n WorkerToHostMessage,\n ActivateMessage,\n DeactivateMessage,\n SettingsChangedMessage,\n ProviderChatRequestMessage,\n ProviderModelsRequestMessage,\n ToolExecuteRequestMessage,\n ToolExecuteResponseMessage,\n ActionExecuteRequestMessage,\n ActionExecuteResponseMessage,\n ResponseMessage,\n ReadyMessage,\n RequestMessage,\n RequestMethod,\n ProviderRegisteredMessage,\n ToolRegisteredMessage,\n ActionRegisteredMessage,\n StreamEventMessage,\n LogMessage,\n PendingRequest,\n} from './messages.js'\n\nexport { generateMessageId } from './messages.js'\n\n// Component types (for extension UI components)\nexport type {\n // Base types\n ExtensionComponentData,\n // Iteration & Children\n ExtensionComponentIterator,\n ExtensionComponentChildren,\n // Actions\n ExtensionActionCall,\n ExtensionActionRef,\n // Data Sources & Panel Definition\n ExtensionDataSource,\n ExtensionPanelDefinition,\n // Component Props\n HeaderProps,\n LabelProps,\n ParagraphProps,\n ButtonProps,\n TextInputProps,\n SelectProps,\n VerticalStackProps,\n HorizontalStackProps,\n GridProps,\n DividerProps,\n IconProps,\n IconButtonType,\n IconButtonProps,\n PanelAction,\n PanelProps,\n ToggleProps,\n} from './types.components.js'\n","/**\n * Message protocol between Extension Host and Extension Workers\n */\n\nimport type {\n ChatMessage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolResult,\n ActionResult,\n ModelInfo,\n SchedulerFirePayload,\n} from './types.js'\n\n// ============================================================================\n// Host → Worker Messages\n// ============================================================================\n\nexport type HostToWorkerMessage =\n | ActivateMessage\n | DeactivateMessage\n | SettingsChangedMessage\n | SchedulerFireMessage\n | ProviderChatRequestMessage\n | ProviderModelsRequestMessage\n | ToolExecuteRequestMessage\n | ActionExecuteRequestMessage\n | ResponseMessage\n\nexport interface ActivateMessage {\n type: 'activate'\n id: string\n payload: {\n extensionId: string\n extensionVersion: string\n storagePath: string\n permissions: string[]\n settings: Record<string, unknown>\n }\n}\n\nexport interface DeactivateMessage {\n type: 'deactivate'\n id: string\n}\n\nexport interface SettingsChangedMessage {\n type: 'settings-changed'\n id: string\n payload: {\n key: string\n value: unknown\n }\n}\n\nexport interface SchedulerFireMessage {\n type: 'scheduler-fire'\n id: string\n payload: SchedulerFirePayload\n}\n\nexport interface ProviderChatRequestMessage {\n type: 'provider-chat-request'\n id: string\n payload: {\n providerId: string\n messages: ChatMessage[]\n options: ChatOptions\n }\n}\n\nexport interface ProviderModelsRequestMessage {\n type: 'provider-models-request'\n id: string\n payload: {\n providerId: string\n options?: GetModelsOptions\n }\n}\n\nexport interface ToolExecuteRequestMessage {\n type: 'tool-execute-request'\n id: string\n payload: {\n toolId: string\n params: Record<string, unknown>\n }\n}\n\nexport interface ActionExecuteRequestMessage {\n type: 'action-execute-request'\n id: string\n payload: {\n actionId: string\n params: Record<string, unknown>\n }\n}\n\nexport interface ResponseMessage {\n type: 'response'\n id: string\n payload: {\n requestId: string\n success: boolean\n data?: unknown\n error?: string\n }\n}\n\n// ============================================================================\n// Worker → Host Messages\n// ============================================================================\n\nexport type WorkerToHostMessage =\n | ReadyMessage\n | RequestMessage\n | ProviderRegisteredMessage\n | ToolRegisteredMessage\n | ActionRegisteredMessage\n | StreamEventMessage\n | LogMessage\n | ProviderModelsResponseMessage\n | ToolExecuteResponseMessage\n | ActionExecuteResponseMessage\n\nexport interface ReadyMessage {\n type: 'ready'\n}\n\nexport interface RequestMessage {\n type: 'request'\n id: string\n method: RequestMethod\n payload: unknown\n}\n\nexport type RequestMethod =\n | 'network.fetch'\n | 'settings.getAll'\n | 'settings.get'\n | 'settings.set'\n | 'user.getProfile'\n | 'events.emit'\n | 'scheduler.schedule'\n | 'scheduler.cancel'\n | 'chat.appendInstruction'\n | 'database.execute'\n | 'storage.get'\n | 'storage.set'\n | 'storage.delete'\n | 'storage.keys'\n\nexport interface ProviderRegisteredMessage {\n type: 'provider-registered'\n payload: {\n id: string\n name: string\n }\n}\n\nexport interface ToolRegisteredMessage {\n type: 'tool-registered'\n payload: {\n id: string\n name: string\n description: string\n parameters?: Record<string, unknown>\n }\n}\n\nexport interface ActionRegisteredMessage {\n type: 'action-registered'\n payload: {\n id: string\n }\n}\n\nexport interface StreamEventMessage {\n type: 'stream-event'\n payload: {\n requestId: string\n event: StreamEvent\n }\n}\n\nexport interface ProviderModelsResponseMessage {\n type: 'provider-models-response'\n payload: {\n requestId: string\n models: ModelInfo[]\n error?: string\n }\n}\n\nexport interface ToolExecuteResponseMessage {\n type: 'tool-execute-response'\n payload: {\n requestId: string\n result: ToolResult\n error?: string\n }\n}\n\nexport interface ActionExecuteResponseMessage {\n type: 'action-execute-response'\n payload: {\n requestId: string\n result: ActionResult\n error?: string\n }\n}\n\nexport interface LogMessage {\n type: 'log'\n payload: {\n level: 'debug' | 'info' | 'warn' | 'error'\n message: string\n data?: Record<string, unknown>\n }\n}\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\nexport interface PendingRequest<T = unknown> {\n resolve: (value: T) => void\n reject: (error: Error) => void\n timeout: ReturnType<typeof setTimeout>\n}\n\n/**\n * Generate a unique message ID\n */\nexport function generateMessageId(): string {\n return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC2OO,SAAS,oBAA4B;AAC1C,SAAO,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AACjE;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/messages.ts"],"sourcesContent":["/**\n * @stina/extension-api\n *\n * Types and utilities for building Stina extensions.\n *\n * Extensions should import from this package for type definitions.\n * The runtime (worker-side code) should import from '@stina/extension-api/runtime'.\n */\n\n// Types\nexport type {\n // Manifest\n ExtensionManifest,\n Platform,\n ExtensionContributions,\n SettingDefinition,\n SettingOptionsMapping,\n SettingCreateMapping,\n ToolSettingsViewDefinition,\n ToolSettingsView,\n ToolSettingsListView,\n ToolSettingsListMapping,\n PanelDefinition,\n PanelView,\n PanelComponentView,\n PanelActionDataSource,\n PanelUnknownView,\n ProviderDefinition,\n PromptContribution,\n PromptSection,\n ToolDefinition,\n CommandDefinition,\n\n // Provider Configuration Schema\n ProviderConfigSchema,\n ProviderConfigProperty,\n ProviderConfigPropertyType,\n ProviderConfigSelectOption,\n ProviderConfigValidation,\n\n // Permissions\n Permission,\n NetworkPermission,\n StoragePermission,\n UserDataPermission,\n CapabilityPermission,\n SystemPermission,\n\n // Context\n ExtensionContext,\n Disposable,\n NetworkAPI,\n SettingsAPI,\n ProvidersAPI,\n ToolsAPI,\n ActionsAPI,\n EventsAPI,\n SchedulerAPI,\n SchedulerJobRequest,\n SchedulerSchedule,\n SchedulerFirePayload,\n UserAPI,\n UserProfile,\n ChatAPI,\n ChatInstructionMessage,\n DatabaseAPI,\n StorageAPI,\n LogAPI,\n\n // AI Provider\n AIProvider,\n ModelInfo,\n ChatMessage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolCall,\n\n // Tools\n Tool,\n ToolResult,\n\n // Actions\n Action,\n ActionResult,\n\n // Entry point\n ExtensionModule,\n} from './types.js'\n\n// Messages (for host implementation)\nexport type {\n HostToWorkerMessage,\n WorkerToHostMessage,\n ActivateMessage,\n DeactivateMessage,\n SettingsChangedMessage,\n ProviderChatRequestMessage,\n ProviderModelsRequestMessage,\n ToolExecuteRequestMessage,\n ToolExecuteResponseMessage,\n ActionExecuteRequestMessage,\n ActionExecuteResponseMessage,\n ResponseMessage,\n ReadyMessage,\n RequestMessage,\n RequestMethod,\n ProviderRegisteredMessage,\n ToolRegisteredMessage,\n ActionRegisteredMessage,\n StreamEventMessage,\n LogMessage,\n PendingRequest,\n} from './messages.js'\n\nexport { generateMessageId } from './messages.js'\n\n// Component types (for extension UI components)\nexport type {\n // Styling\n AllowedCSSProperty,\n ExtensionComponentStyle,\n // Base types\n ExtensionComponentData,\n // Iteration & Children\n ExtensionComponentIterator,\n ExtensionComponentChildren,\n // Actions\n ExtensionActionCall,\n ExtensionActionRef,\n // Data Sources & Panel Definition\n ExtensionDataSource,\n ExtensionPanelDefinition,\n // Component Props\n HeaderProps,\n LabelProps,\n ParagraphProps,\n ButtonProps,\n TextInputProps,\n SelectProps,\n VerticalStackProps,\n HorizontalStackProps,\n GridProps,\n DividerProps,\n IconProps,\n IconButtonType,\n IconButtonProps,\n PanelAction,\n PanelProps,\n ToggleProps,\n CollapsibleProps,\n PillVariant,\n PillProps,\n CheckboxProps,\n MarkdownProps,\n ModalProps,\n} from './types.components.js'\n","/**\n * Message protocol between Extension Host and Extension Workers\n */\n\nimport type {\n ChatMessage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolResult,\n ActionResult,\n ModelInfo,\n SchedulerFirePayload,\n} from './types.js'\n\n// ============================================================================\n// Host → Worker Messages\n// ============================================================================\n\nexport type HostToWorkerMessage =\n | ActivateMessage\n | DeactivateMessage\n | SettingsChangedMessage\n | SchedulerFireMessage\n | ProviderChatRequestMessage\n | ProviderModelsRequestMessage\n | ToolExecuteRequestMessage\n | ActionExecuteRequestMessage\n | ResponseMessage\n\nexport interface ActivateMessage {\n type: 'activate'\n id: string\n payload: {\n extensionId: string\n extensionVersion: string\n storagePath: string\n permissions: string[]\n settings: Record<string, unknown>\n }\n}\n\nexport interface DeactivateMessage {\n type: 'deactivate'\n id: string\n}\n\nexport interface SettingsChangedMessage {\n type: 'settings-changed'\n id: string\n payload: {\n key: string\n value: unknown\n }\n}\n\nexport interface SchedulerFireMessage {\n type: 'scheduler-fire'\n id: string\n payload: SchedulerFirePayload\n}\n\nexport interface ProviderChatRequestMessage {\n type: 'provider-chat-request'\n id: string\n payload: {\n providerId: string\n messages: ChatMessage[]\n options: ChatOptions\n }\n}\n\nexport interface ProviderModelsRequestMessage {\n type: 'provider-models-request'\n id: string\n payload: {\n providerId: string\n options?: GetModelsOptions\n }\n}\n\nexport interface ToolExecuteRequestMessage {\n type: 'tool-execute-request'\n id: string\n payload: {\n toolId: string\n params: Record<string, unknown>\n }\n}\n\nexport interface ActionExecuteRequestMessage {\n type: 'action-execute-request'\n id: string\n payload: {\n actionId: string\n params: Record<string, unknown>\n }\n}\n\nexport interface ResponseMessage {\n type: 'response'\n id: string\n payload: {\n requestId: string\n success: boolean\n data?: unknown\n error?: string\n }\n}\n\n// ============================================================================\n// Worker → Host Messages\n// ============================================================================\n\nexport type WorkerToHostMessage =\n | ReadyMessage\n | RequestMessage\n | ProviderRegisteredMessage\n | ToolRegisteredMessage\n | ActionRegisteredMessage\n | StreamEventMessage\n | LogMessage\n | ProviderModelsResponseMessage\n | ToolExecuteResponseMessage\n | ActionExecuteResponseMessage\n\nexport interface ReadyMessage {\n type: 'ready'\n}\n\nexport interface RequestMessage {\n type: 'request'\n id: string\n method: RequestMethod\n payload: unknown\n}\n\nexport type RequestMethod =\n | 'network.fetch'\n | 'settings.getAll'\n | 'settings.get'\n | 'settings.set'\n | 'user.getProfile'\n | 'events.emit'\n | 'scheduler.schedule'\n | 'scheduler.cancel'\n | 'chat.appendInstruction'\n | 'database.execute'\n | 'storage.get'\n | 'storage.set'\n | 'storage.delete'\n | 'storage.keys'\n\nexport interface ProviderRegisteredMessage {\n type: 'provider-registered'\n payload: {\n id: string\n name: string\n }\n}\n\nexport interface ToolRegisteredMessage {\n type: 'tool-registered'\n payload: {\n id: string\n name: string\n description: string\n parameters?: Record<string, unknown>\n }\n}\n\nexport interface ActionRegisteredMessage {\n type: 'action-registered'\n payload: {\n id: string\n }\n}\n\nexport interface StreamEventMessage {\n type: 'stream-event'\n payload: {\n requestId: string\n event: StreamEvent\n }\n}\n\nexport interface ProviderModelsResponseMessage {\n type: 'provider-models-response'\n payload: {\n requestId: string\n models: ModelInfo[]\n error?: string\n }\n}\n\nexport interface ToolExecuteResponseMessage {\n type: 'tool-execute-response'\n payload: {\n requestId: string\n result: ToolResult\n error?: string\n }\n}\n\nexport interface ActionExecuteResponseMessage {\n type: 'action-execute-response'\n payload: {\n requestId: string\n result: ActionResult\n error?: string\n }\n}\n\nexport interface LogMessage {\n type: 'log'\n payload: {\n level: 'debug' | 'info' | 'warn' | 'error'\n message: string\n data?: Record<string, unknown>\n }\n}\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\nexport interface PendingRequest<T = unknown> {\n resolve: (value: T) => void\n reject: (error: Error) => void\n timeout: ReturnType<typeof setTimeout>\n}\n\n/**\n * Generate a unique message ID\n */\nexport function generateMessageId(): string {\n return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC2OO,SAAS,oBAA4B;AAC1C,SAAO,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AACjE;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, b as StreamEvent, M as ModelInfo, T as ToolResult, A as ActionResult } from './types-
|
|
2
|
-
export { a3 as AIProvider, a6 as Action, Q as ActionsAPI,
|
|
1
|
+
import { S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, b as StreamEvent, M as ModelInfo, T as ToolResult, A as ActionResult } from './types-DiSR4tCQ.cjs';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, Q as ActionsAPI, a8 as AllowedCSSProperty, ak as ButtonProps, D as CapabilityPermission, _ as ChatAPI, $ as ChatInstructionMessage, aA as CheckboxProps, ax as CollapsibleProps, t as CommandDefinition, a0 as DatabaseAPI, I as Disposable, aq as DividerProps, R as EventsAPI, ad as ExtensionActionCall, ae as ExtensionActionRef, ac as ExtensionComponentChildren, aa as ExtensionComponentData, ab as ExtensionComponentIterator, a9 as ExtensionComponentStyle, H as ExtensionContext, c as ExtensionContributions, af as ExtensionDataSource, E as ExtensionManifest, a7 as ExtensionModule, ag as ExtensionPanelDefinition, ap as GridProps, ah as HeaderProps, ao as HorizontalStackProps, at as IconButtonProps, as as IconButtonType, ar as IconProps, ai as LabelProps, a2 as LogAPI, aB as MarkdownProps, aC as ModalProps, J as NetworkAPI, N as NetworkPermission, au as PanelAction, n as PanelActionDataSource, m as PanelComponentView, k as PanelDefinition, av as PanelProps, o as PanelUnknownView, l as PanelView, aj as ParagraphProps, z as Permission, az as PillProps, ay as PillVariant, P as Platform, q as PromptContribution, r as PromptSection, v as ProviderConfigProperty, w as ProviderConfigPropertyType, u as ProviderConfigSchema, x as ProviderConfigSelectOption, y as ProviderConfigValidation, p as ProviderDefinition, L as ProvidersAPI, V as SchedulerAPI, W as SchedulerJobRequest, X as SchedulerSchedule, am as SelectProps, f as SettingCreateMapping, d as SettingDefinition, e as SettingOptionsMapping, K as SettingsAPI, a1 as StorageAPI, B as StoragePermission, F as SystemPermission, al as TextInputProps, aw as ToggleProps, a5 as Tool, a4 as ToolCall, s as ToolDefinition, j as ToolSettingsListMapping, i as ToolSettingsListView, h as ToolSettingsView, g as ToolSettingsViewDefinition, O as ToolsAPI, Y as UserAPI, U as UserDataPermission, Z as UserProfile, an as VerticalStackProps } from './types-DiSR4tCQ.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Message protocol between Extension Host and Extension Workers
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, b as StreamEvent, M as ModelInfo, T as ToolResult, A as ActionResult } from './types-
|
|
2
|
-
export { a3 as AIProvider, a6 as Action, Q as ActionsAPI,
|
|
1
|
+
import { S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, b as StreamEvent, M as ModelInfo, T as ToolResult, A as ActionResult } from './types-DiSR4tCQ.js';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, Q as ActionsAPI, a8 as AllowedCSSProperty, ak as ButtonProps, D as CapabilityPermission, _ as ChatAPI, $ as ChatInstructionMessage, aA as CheckboxProps, ax as CollapsibleProps, t as CommandDefinition, a0 as DatabaseAPI, I as Disposable, aq as DividerProps, R as EventsAPI, ad as ExtensionActionCall, ae as ExtensionActionRef, ac as ExtensionComponentChildren, aa as ExtensionComponentData, ab as ExtensionComponentIterator, a9 as ExtensionComponentStyle, H as ExtensionContext, c as ExtensionContributions, af as ExtensionDataSource, E as ExtensionManifest, a7 as ExtensionModule, ag as ExtensionPanelDefinition, ap as GridProps, ah as HeaderProps, ao as HorizontalStackProps, at as IconButtonProps, as as IconButtonType, ar as IconProps, ai as LabelProps, a2 as LogAPI, aB as MarkdownProps, aC as ModalProps, J as NetworkAPI, N as NetworkPermission, au as PanelAction, n as PanelActionDataSource, m as PanelComponentView, k as PanelDefinition, av as PanelProps, o as PanelUnknownView, l as PanelView, aj as ParagraphProps, z as Permission, az as PillProps, ay as PillVariant, P as Platform, q as PromptContribution, r as PromptSection, v as ProviderConfigProperty, w as ProviderConfigPropertyType, u as ProviderConfigSchema, x as ProviderConfigSelectOption, y as ProviderConfigValidation, p as ProviderDefinition, L as ProvidersAPI, V as SchedulerAPI, W as SchedulerJobRequest, X as SchedulerSchedule, am as SelectProps, f as SettingCreateMapping, d as SettingDefinition, e as SettingOptionsMapping, K as SettingsAPI, a1 as StorageAPI, B as StoragePermission, F as SystemPermission, al as TextInputProps, aw as ToggleProps, a5 as Tool, a4 as ToolCall, s as ToolDefinition, j as ToolSettingsListMapping, i as ToolSettingsListView, h as ToolSettingsView, g as ToolSettingsViewDefinition, O as ToolsAPI, Y as UserAPI, U as UserDataPermission, Z as UserProfile, an as VerticalStackProps } from './types-DiSR4tCQ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Message protocol between Extension Host and Extension Workers
|
package/dist/runtime.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a7 as ExtensionModule } from './types-
|
|
2
|
-
export { a3 as AIProvider, a6 as Action, A as ActionResult, C as ChatMessage, a as ChatOptions, I as Disposable, H as ExtensionContext, G as GetModelsOptions, M as ModelInfo, b as StreamEvent, a5 as Tool, a4 as ToolCall, s as ToolDefinition, T as ToolResult } from './types-
|
|
1
|
+
import { a7 as ExtensionModule } from './types-DiSR4tCQ.cjs';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, A as ActionResult, C as ChatMessage, a as ChatOptions, I as Disposable, H as ExtensionContext, G as GetModelsOptions, M as ModelInfo, b as StreamEvent, a5 as Tool, a4 as ToolCall, s as ToolDefinition, T as ToolResult } from './types-DiSR4tCQ.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extension Runtime - Runs inside the worker
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a7 as ExtensionModule } from './types-
|
|
2
|
-
export { a3 as AIProvider, a6 as Action, A as ActionResult, C as ChatMessage, a as ChatOptions, I as Disposable, H as ExtensionContext, G as GetModelsOptions, M as ModelInfo, b as StreamEvent, a5 as Tool, a4 as ToolCall, s as ToolDefinition, T as ToolResult } from './types-
|
|
1
|
+
import { a7 as ExtensionModule } from './types-DiSR4tCQ.js';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, A as ActionResult, C as ChatMessage, a as ChatOptions, I as Disposable, H as ExtensionContext, G as GetModelsOptions, M as ModelInfo, b as StreamEvent, a5 as Tool, a4 as ToolCall, s as ToolDefinition, T as ToolResult } from './types-DiSR4tCQ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extension Runtime - Runs inside the worker
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed CSS property names for extension component styling.
|
|
3
|
+
* Only safe properties that cannot be used for UI spoofing,
|
|
4
|
+
* clickjacking, or data exfiltration are permitted.
|
|
5
|
+
*
|
|
6
|
+
* Blocked properties include: position, z-index, top/left/right/bottom,
|
|
7
|
+
* pointer-events, transform, content, clip-path, mask, filter.
|
|
8
|
+
*
|
|
9
|
+
* Blocked value patterns include: url(), expression(), javascript:,
|
|
10
|
+
* -moz-binding, behavior:, @import.
|
|
11
|
+
*/
|
|
12
|
+
type AllowedCSSProperty = 'color' | 'background-color' | 'background' | 'border-color' | 'border' | 'border-width' | 'border-style' | 'border-radius' | 'border-top' | 'border-right' | 'border-bottom' | 'border-left' | 'border-top-left-radius' | 'border-top-right-radius' | 'border-bottom-left-radius' | 'border-bottom-right-radius' | 'padding' | 'padding-top' | 'padding-right' | 'padding-bottom' | 'padding-left' | 'margin' | 'margin-top' | 'margin-right' | 'margin-bottom' | 'margin-left' | 'gap' | 'row-gap' | 'column-gap' | 'font-size' | 'font-weight' | 'font-style' | 'text-align' | 'text-decoration' | 'line-height' | 'letter-spacing' | 'white-space' | 'word-break' | 'overflow-wrap' | 'width' | 'height' | 'min-width' | 'min-height' | 'max-width' | 'max-height' | 'flex' | 'flex-grow' | 'flex-shrink' | 'flex-basis' | 'flex-wrap' | 'align-self' | 'justify-self' | 'align-items' | 'justify-content' | 'opacity' | 'visibility' | 'overflow' | 'overflow-x' | 'overflow-y' | 'box-shadow' | 'outline' | 'cursor' | 'border-collapse' | 'border-spacing';
|
|
13
|
+
/**
|
|
14
|
+
* Style object for extension components.
|
|
15
|
+
* Values can be static strings or $-prefixed references to scope variables.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```json
|
|
19
|
+
* {
|
|
20
|
+
* "component": "HorizontalStack",
|
|
21
|
+
* "style": {
|
|
22
|
+
* "background-color": "#f5f5f5",
|
|
23
|
+
* "border-radius": "8px",
|
|
24
|
+
* "padding": "1rem"
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
type ExtensionComponentStyle = Partial<Record<AllowedCSSProperty, string>>;
|
|
1
30
|
/** Base interface for dynamically rendered extension components. */
|
|
2
31
|
interface ExtensionComponentData {
|
|
3
32
|
component: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional inline styles for the component.
|
|
35
|
+
* Only safe CSS properties are allowed; dangerous properties and values
|
|
36
|
+
* (e.g., position, z-index, url()) are blocked for security.
|
|
37
|
+
* Values can use $-prefixed references to scope variables.
|
|
38
|
+
*/
|
|
39
|
+
style?: ExtensionComponentStyle;
|
|
4
40
|
[key: string]: unknown;
|
|
5
41
|
}
|
|
6
42
|
/**
|
|
@@ -201,6 +237,68 @@ interface ToggleProps extends ExtensionComponentData {
|
|
|
201
237
|
disabled?: boolean;
|
|
202
238
|
onChangeAction: ExtensionActionRef;
|
|
203
239
|
}
|
|
240
|
+
/** The extension API properties for the Collapsible component. */
|
|
241
|
+
interface CollapsibleProps extends ExtensionComponentData {
|
|
242
|
+
component: 'Collapsible';
|
|
243
|
+
/** Title displayed in the header. */
|
|
244
|
+
title: string;
|
|
245
|
+
/** Optional description rendered under the title. */
|
|
246
|
+
description?: string | string[];
|
|
247
|
+
/** Optional icon shown to the left of the title. */
|
|
248
|
+
icon?: string;
|
|
249
|
+
/** Whether the section is expanded by default. */
|
|
250
|
+
defaultExpanded?: boolean;
|
|
251
|
+
/** Child component to render when expanded. */
|
|
252
|
+
content?: ExtensionComponentData;
|
|
253
|
+
}
|
|
254
|
+
/** Pill variant type for predefined color schemes. */
|
|
255
|
+
type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent';
|
|
256
|
+
/** The extension API properties for the Pill component. */
|
|
257
|
+
interface PillProps extends ExtensionComponentData {
|
|
258
|
+
component: 'Pill';
|
|
259
|
+
/** Text to display in the pill. */
|
|
260
|
+
text: string;
|
|
261
|
+
/** Optional icon shown to the left of the text. */
|
|
262
|
+
icon?: string;
|
|
263
|
+
/** Color variant. Defaults to 'default'. */
|
|
264
|
+
variant?: PillVariant;
|
|
265
|
+
}
|
|
266
|
+
/** The extension API properties for the Checkbox component. */
|
|
267
|
+
interface CheckboxProps extends ExtensionComponentData {
|
|
268
|
+
component: 'Checkbox';
|
|
269
|
+
/** Label text displayed next to the checkbox. */
|
|
270
|
+
label: string;
|
|
271
|
+
/** Whether the checkbox is checked. */
|
|
272
|
+
checked?: boolean;
|
|
273
|
+
/** Whether the checkbox is disabled. */
|
|
274
|
+
disabled?: boolean;
|
|
275
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
276
|
+
strikethrough?: boolean;
|
|
277
|
+
/** Action to call when the checkbox state changes. */
|
|
278
|
+
onChangeAction: ExtensionActionRef;
|
|
279
|
+
}
|
|
280
|
+
/** The extension API properties for the Markdown component. */
|
|
281
|
+
interface MarkdownProps extends ExtensionComponentData {
|
|
282
|
+
component: 'Markdown';
|
|
283
|
+
/** Markdown content to render. */
|
|
284
|
+
content: string;
|
|
285
|
+
}
|
|
286
|
+
/** The extension API properties for the Modal component. */
|
|
287
|
+
interface ModalProps extends ExtensionComponentData {
|
|
288
|
+
component: 'Modal';
|
|
289
|
+
/** Title displayed in the modal header. */
|
|
290
|
+
title: string;
|
|
291
|
+
/** Whether the modal is open. */
|
|
292
|
+
open?: boolean;
|
|
293
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
294
|
+
maxWidth?: string;
|
|
295
|
+
/** Content to render in the modal body. */
|
|
296
|
+
body?: ExtensionComponentData;
|
|
297
|
+
/** Optional content to render in the modal footer. */
|
|
298
|
+
footer?: ExtensionComponentData;
|
|
299
|
+
/** Action to call when the modal is closed. */
|
|
300
|
+
onCloseAction?: ExtensionActionRef;
|
|
301
|
+
}
|
|
204
302
|
|
|
205
303
|
/**
|
|
206
304
|
* Extension manifest format (manifest.json)
|
|
@@ -948,4 +1046,4 @@ interface ExtensionModule {
|
|
|
948
1046
|
deactivate?(): void | Promise<void>;
|
|
949
1047
|
}
|
|
950
1048
|
|
|
951
|
-
export type { ChatInstructionMessage as $, ActionResult as A, StoragePermission as B, ChatMessage as C, CapabilityPermission as D, ExtensionManifest as E, SystemPermission as F, GetModelsOptions as G, ExtensionContext as H, Disposable as I, NetworkAPI as J, SettingsAPI as K, ProvidersAPI as L, ModelInfo as M, NetworkPermission as N, ToolsAPI as O, Platform as P, ActionsAPI as Q, EventsAPI as R, SchedulerFirePayload as S, ToolResult as T, UserDataPermission as U, SchedulerAPI as V, SchedulerJobRequest as W, SchedulerSchedule as X, UserAPI as Y, UserProfile as Z, ChatAPI as _, ChatOptions as a, DatabaseAPI as a0, StorageAPI as a1, LogAPI as a2, AIProvider as a3, ToolCall as a4, Tool as a5, Action as a6, ExtensionModule as a7,
|
|
1049
|
+
export type { ChatInstructionMessage as $, ActionResult as A, StoragePermission as B, ChatMessage as C, CapabilityPermission as D, ExtensionManifest as E, SystemPermission as F, GetModelsOptions as G, ExtensionContext as H, Disposable as I, NetworkAPI as J, SettingsAPI as K, ProvidersAPI as L, ModelInfo as M, NetworkPermission as N, ToolsAPI as O, Platform as P, ActionsAPI as Q, EventsAPI as R, SchedulerFirePayload as S, ToolResult as T, UserDataPermission as U, SchedulerAPI as V, SchedulerJobRequest as W, SchedulerSchedule as X, UserAPI as Y, UserProfile as Z, ChatAPI as _, ChatOptions as a, DatabaseAPI as a0, StorageAPI as a1, LogAPI as a2, AIProvider as a3, ToolCall as a4, Tool as a5, Action as a6, ExtensionModule as a7, AllowedCSSProperty as a8, ExtensionComponentStyle as a9, CheckboxProps as aA, MarkdownProps as aB, ModalProps as aC, ExtensionComponentData as aa, ExtensionComponentIterator as ab, ExtensionComponentChildren as ac, ExtensionActionCall as ad, ExtensionActionRef as ae, ExtensionDataSource as af, ExtensionPanelDefinition as ag, HeaderProps as ah, LabelProps as ai, ParagraphProps as aj, ButtonProps as ak, TextInputProps as al, SelectProps as am, VerticalStackProps as an, HorizontalStackProps as ao, GridProps as ap, DividerProps as aq, IconProps as ar, IconButtonType as as, IconButtonProps as at, PanelAction as au, PanelProps as av, ToggleProps as aw, CollapsibleProps as ax, PillVariant as ay, PillProps as az, StreamEvent as b, ExtensionContributions as c, SettingDefinition as d, SettingOptionsMapping as e, SettingCreateMapping as f, ToolSettingsViewDefinition as g, ToolSettingsView as h, ToolSettingsListView as i, ToolSettingsListMapping as j, PanelDefinition as k, PanelView as l, PanelComponentView as m, PanelActionDataSource as n, PanelUnknownView as o, ProviderDefinition as p, PromptContribution as q, PromptSection as r, ToolDefinition as s, CommandDefinition as t, ProviderConfigSchema as u, ProviderConfigProperty as v, ProviderConfigPropertyType as w, ProviderConfigSelectOption as x, ProviderConfigValidation as y, Permission as z };
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed CSS property names for extension component styling.
|
|
3
|
+
* Only safe properties that cannot be used for UI spoofing,
|
|
4
|
+
* clickjacking, or data exfiltration are permitted.
|
|
5
|
+
*
|
|
6
|
+
* Blocked properties include: position, z-index, top/left/right/bottom,
|
|
7
|
+
* pointer-events, transform, content, clip-path, mask, filter.
|
|
8
|
+
*
|
|
9
|
+
* Blocked value patterns include: url(), expression(), javascript:,
|
|
10
|
+
* -moz-binding, behavior:, @import.
|
|
11
|
+
*/
|
|
12
|
+
type AllowedCSSProperty = 'color' | 'background-color' | 'background' | 'border-color' | 'border' | 'border-width' | 'border-style' | 'border-radius' | 'border-top' | 'border-right' | 'border-bottom' | 'border-left' | 'border-top-left-radius' | 'border-top-right-radius' | 'border-bottom-left-radius' | 'border-bottom-right-radius' | 'padding' | 'padding-top' | 'padding-right' | 'padding-bottom' | 'padding-left' | 'margin' | 'margin-top' | 'margin-right' | 'margin-bottom' | 'margin-left' | 'gap' | 'row-gap' | 'column-gap' | 'font-size' | 'font-weight' | 'font-style' | 'text-align' | 'text-decoration' | 'line-height' | 'letter-spacing' | 'white-space' | 'word-break' | 'overflow-wrap' | 'width' | 'height' | 'min-width' | 'min-height' | 'max-width' | 'max-height' | 'flex' | 'flex-grow' | 'flex-shrink' | 'flex-basis' | 'flex-wrap' | 'align-self' | 'justify-self' | 'align-items' | 'justify-content' | 'opacity' | 'visibility' | 'overflow' | 'overflow-x' | 'overflow-y' | 'box-shadow' | 'outline' | 'cursor' | 'border-collapse' | 'border-spacing';
|
|
13
|
+
/**
|
|
14
|
+
* Style object for extension components.
|
|
15
|
+
* Values can be static strings or $-prefixed references to scope variables.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```json
|
|
19
|
+
* {
|
|
20
|
+
* "component": "HorizontalStack",
|
|
21
|
+
* "style": {
|
|
22
|
+
* "background-color": "#f5f5f5",
|
|
23
|
+
* "border-radius": "8px",
|
|
24
|
+
* "padding": "1rem"
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
type ExtensionComponentStyle = Partial<Record<AllowedCSSProperty, string>>;
|
|
1
30
|
/** Base interface for dynamically rendered extension components. */
|
|
2
31
|
interface ExtensionComponentData {
|
|
3
32
|
component: string;
|
|
33
|
+
/**
|
|
34
|
+
* Optional inline styles for the component.
|
|
35
|
+
* Only safe CSS properties are allowed; dangerous properties and values
|
|
36
|
+
* (e.g., position, z-index, url()) are blocked for security.
|
|
37
|
+
* Values can use $-prefixed references to scope variables.
|
|
38
|
+
*/
|
|
39
|
+
style?: ExtensionComponentStyle;
|
|
4
40
|
[key: string]: unknown;
|
|
5
41
|
}
|
|
6
42
|
/**
|
|
@@ -201,6 +237,68 @@ interface ToggleProps extends ExtensionComponentData {
|
|
|
201
237
|
disabled?: boolean;
|
|
202
238
|
onChangeAction: ExtensionActionRef;
|
|
203
239
|
}
|
|
240
|
+
/** The extension API properties for the Collapsible component. */
|
|
241
|
+
interface CollapsibleProps extends ExtensionComponentData {
|
|
242
|
+
component: 'Collapsible';
|
|
243
|
+
/** Title displayed in the header. */
|
|
244
|
+
title: string;
|
|
245
|
+
/** Optional description rendered under the title. */
|
|
246
|
+
description?: string | string[];
|
|
247
|
+
/** Optional icon shown to the left of the title. */
|
|
248
|
+
icon?: string;
|
|
249
|
+
/** Whether the section is expanded by default. */
|
|
250
|
+
defaultExpanded?: boolean;
|
|
251
|
+
/** Child component to render when expanded. */
|
|
252
|
+
content?: ExtensionComponentData;
|
|
253
|
+
}
|
|
254
|
+
/** Pill variant type for predefined color schemes. */
|
|
255
|
+
type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent';
|
|
256
|
+
/** The extension API properties for the Pill component. */
|
|
257
|
+
interface PillProps extends ExtensionComponentData {
|
|
258
|
+
component: 'Pill';
|
|
259
|
+
/** Text to display in the pill. */
|
|
260
|
+
text: string;
|
|
261
|
+
/** Optional icon shown to the left of the text. */
|
|
262
|
+
icon?: string;
|
|
263
|
+
/** Color variant. Defaults to 'default'. */
|
|
264
|
+
variant?: PillVariant;
|
|
265
|
+
}
|
|
266
|
+
/** The extension API properties for the Checkbox component. */
|
|
267
|
+
interface CheckboxProps extends ExtensionComponentData {
|
|
268
|
+
component: 'Checkbox';
|
|
269
|
+
/** Label text displayed next to the checkbox. */
|
|
270
|
+
label: string;
|
|
271
|
+
/** Whether the checkbox is checked. */
|
|
272
|
+
checked?: boolean;
|
|
273
|
+
/** Whether the checkbox is disabled. */
|
|
274
|
+
disabled?: boolean;
|
|
275
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
276
|
+
strikethrough?: boolean;
|
|
277
|
+
/** Action to call when the checkbox state changes. */
|
|
278
|
+
onChangeAction: ExtensionActionRef;
|
|
279
|
+
}
|
|
280
|
+
/** The extension API properties for the Markdown component. */
|
|
281
|
+
interface MarkdownProps extends ExtensionComponentData {
|
|
282
|
+
component: 'Markdown';
|
|
283
|
+
/** Markdown content to render. */
|
|
284
|
+
content: string;
|
|
285
|
+
}
|
|
286
|
+
/** The extension API properties for the Modal component. */
|
|
287
|
+
interface ModalProps extends ExtensionComponentData {
|
|
288
|
+
component: 'Modal';
|
|
289
|
+
/** Title displayed in the modal header. */
|
|
290
|
+
title: string;
|
|
291
|
+
/** Whether the modal is open. */
|
|
292
|
+
open?: boolean;
|
|
293
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
294
|
+
maxWidth?: string;
|
|
295
|
+
/** Content to render in the modal body. */
|
|
296
|
+
body?: ExtensionComponentData;
|
|
297
|
+
/** Optional content to render in the modal footer. */
|
|
298
|
+
footer?: ExtensionComponentData;
|
|
299
|
+
/** Action to call when the modal is closed. */
|
|
300
|
+
onCloseAction?: ExtensionActionRef;
|
|
301
|
+
}
|
|
204
302
|
|
|
205
303
|
/**
|
|
206
304
|
* Extension manifest format (manifest.json)
|
|
@@ -948,4 +1046,4 @@ interface ExtensionModule {
|
|
|
948
1046
|
deactivate?(): void | Promise<void>;
|
|
949
1047
|
}
|
|
950
1048
|
|
|
951
|
-
export type { ChatInstructionMessage as $, ActionResult as A, StoragePermission as B, ChatMessage as C, CapabilityPermission as D, ExtensionManifest as E, SystemPermission as F, GetModelsOptions as G, ExtensionContext as H, Disposable as I, NetworkAPI as J, SettingsAPI as K, ProvidersAPI as L, ModelInfo as M, NetworkPermission as N, ToolsAPI as O, Platform as P, ActionsAPI as Q, EventsAPI as R, SchedulerFirePayload as S, ToolResult as T, UserDataPermission as U, SchedulerAPI as V, SchedulerJobRequest as W, SchedulerSchedule as X, UserAPI as Y, UserProfile as Z, ChatAPI as _, ChatOptions as a, DatabaseAPI as a0, StorageAPI as a1, LogAPI as a2, AIProvider as a3, ToolCall as a4, Tool as a5, Action as a6, ExtensionModule as a7,
|
|
1049
|
+
export type { ChatInstructionMessage as $, ActionResult as A, StoragePermission as B, ChatMessage as C, CapabilityPermission as D, ExtensionManifest as E, SystemPermission as F, GetModelsOptions as G, ExtensionContext as H, Disposable as I, NetworkAPI as J, SettingsAPI as K, ProvidersAPI as L, ModelInfo as M, NetworkPermission as N, ToolsAPI as O, Platform as P, ActionsAPI as Q, EventsAPI as R, SchedulerFirePayload as S, ToolResult as T, UserDataPermission as U, SchedulerAPI as V, SchedulerJobRequest as W, SchedulerSchedule as X, UserAPI as Y, UserProfile as Z, ChatAPI as _, ChatOptions as a, DatabaseAPI as a0, StorageAPI as a1, LogAPI as a2, AIProvider as a3, ToolCall as a4, Tool as a5, Action as a6, ExtensionModule as a7, AllowedCSSProperty as a8, ExtensionComponentStyle as a9, CheckboxProps as aA, MarkdownProps as aB, ModalProps as aC, ExtensionComponentData as aa, ExtensionComponentIterator as ab, ExtensionComponentChildren as ac, ExtensionActionCall as ad, ExtensionActionRef as ae, ExtensionDataSource as af, ExtensionPanelDefinition as ag, HeaderProps as ah, LabelProps as ai, ParagraphProps as aj, ButtonProps as ak, TextInputProps as al, SelectProps as am, VerticalStackProps as an, HorizontalStackProps as ao, GridProps as ap, DividerProps as aq, IconProps as ar, IconButtonType as as, IconButtonProps as at, PanelAction as au, PanelProps as av, ToggleProps as aw, CollapsibleProps as ax, PillVariant as ay, PillProps as az, StreamEvent as b, ExtensionContributions as c, SettingDefinition as d, SettingOptionsMapping as e, SettingCreateMapping as f, ToolSettingsViewDefinition as g, ToolSettingsView as h, ToolSettingsListView as i, ToolSettingsListMapping as j, PanelDefinition as k, PanelView as l, PanelComponentView as m, PanelActionDataSource as n, PanelUnknownView as o, ProviderDefinition as p, PromptContribution as q, PromptSection as r, ToolDefinition as s, CommandDefinition as t, ProviderConfigSchema as u, ProviderConfigProperty as v, ProviderConfigPropertyType as w, ProviderConfigSelectOption as x, ProviderConfigValidation as y, Permission as z };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -117,6 +117,9 @@ export { generateMessageId } from './messages.js'
|
|
|
117
117
|
|
|
118
118
|
// Component types (for extension UI components)
|
|
119
119
|
export type {
|
|
120
|
+
// Styling
|
|
121
|
+
AllowedCSSProperty,
|
|
122
|
+
ExtensionComponentStyle,
|
|
120
123
|
// Base types
|
|
121
124
|
ExtensionComponentData,
|
|
122
125
|
// Iteration & Children
|
|
@@ -145,4 +148,10 @@ export type {
|
|
|
145
148
|
PanelAction,
|
|
146
149
|
PanelProps,
|
|
147
150
|
ToggleProps,
|
|
151
|
+
CollapsibleProps,
|
|
152
|
+
PillVariant,
|
|
153
|
+
PillProps,
|
|
154
|
+
CheckboxProps,
|
|
155
|
+
MarkdownProps,
|
|
156
|
+
ModalProps,
|
|
148
157
|
} from './types.components.js'
|
package/src/types.components.ts
CHANGED
|
@@ -1,6 +1,122 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Styling
|
|
3
|
+
// =============================================================================
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Allowed CSS property names for extension component styling.
|
|
7
|
+
* Only safe properties that cannot be used for UI spoofing,
|
|
8
|
+
* clickjacking, or data exfiltration are permitted.
|
|
9
|
+
*
|
|
10
|
+
* Blocked properties include: position, z-index, top/left/right/bottom,
|
|
11
|
+
* pointer-events, transform, content, clip-path, mask, filter.
|
|
12
|
+
*
|
|
13
|
+
* Blocked value patterns include: url(), expression(), javascript:,
|
|
14
|
+
* -moz-binding, behavior:, @import.
|
|
15
|
+
*/
|
|
16
|
+
export type AllowedCSSProperty =
|
|
17
|
+
// Colors
|
|
18
|
+
| 'color'
|
|
19
|
+
| 'background-color'
|
|
20
|
+
| 'background'
|
|
21
|
+
| 'border-color'
|
|
22
|
+
// Borders
|
|
23
|
+
| 'border'
|
|
24
|
+
| 'border-width'
|
|
25
|
+
| 'border-style'
|
|
26
|
+
| 'border-radius'
|
|
27
|
+
| 'border-top'
|
|
28
|
+
| 'border-right'
|
|
29
|
+
| 'border-bottom'
|
|
30
|
+
| 'border-left'
|
|
31
|
+
| 'border-top-left-radius'
|
|
32
|
+
| 'border-top-right-radius'
|
|
33
|
+
| 'border-bottom-left-radius'
|
|
34
|
+
| 'border-bottom-right-radius'
|
|
35
|
+
// Spacing
|
|
36
|
+
| 'padding'
|
|
37
|
+
| 'padding-top'
|
|
38
|
+
| 'padding-right'
|
|
39
|
+
| 'padding-bottom'
|
|
40
|
+
| 'padding-left'
|
|
41
|
+
| 'margin'
|
|
42
|
+
| 'margin-top'
|
|
43
|
+
| 'margin-right'
|
|
44
|
+
| 'margin-bottom'
|
|
45
|
+
| 'margin-left'
|
|
46
|
+
| 'gap'
|
|
47
|
+
| 'row-gap'
|
|
48
|
+
| 'column-gap'
|
|
49
|
+
// Typography
|
|
50
|
+
| 'font-size'
|
|
51
|
+
| 'font-weight'
|
|
52
|
+
| 'font-style'
|
|
53
|
+
| 'text-align'
|
|
54
|
+
| 'text-decoration'
|
|
55
|
+
| 'line-height'
|
|
56
|
+
| 'letter-spacing'
|
|
57
|
+
| 'white-space'
|
|
58
|
+
| 'word-break'
|
|
59
|
+
| 'overflow-wrap'
|
|
60
|
+
// Layout (safe properties)
|
|
61
|
+
| 'width'
|
|
62
|
+
| 'height'
|
|
63
|
+
| 'min-width'
|
|
64
|
+
| 'min-height'
|
|
65
|
+
| 'max-width'
|
|
66
|
+
| 'max-height'
|
|
67
|
+
| 'flex'
|
|
68
|
+
| 'flex-grow'
|
|
69
|
+
| 'flex-shrink'
|
|
70
|
+
| 'flex-basis'
|
|
71
|
+
| 'flex-wrap'
|
|
72
|
+
| 'align-self'
|
|
73
|
+
| 'justify-self'
|
|
74
|
+
| 'align-items'
|
|
75
|
+
| 'justify-content'
|
|
76
|
+
// Visual
|
|
77
|
+
| 'opacity'
|
|
78
|
+
| 'visibility'
|
|
79
|
+
| 'overflow'
|
|
80
|
+
| 'overflow-x'
|
|
81
|
+
| 'overflow-y'
|
|
82
|
+
| 'box-shadow'
|
|
83
|
+
| 'outline'
|
|
84
|
+
| 'cursor'
|
|
85
|
+
| 'border-collapse'
|
|
86
|
+
| 'border-spacing'
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Style object for extension components.
|
|
90
|
+
* Values can be static strings or $-prefixed references to scope variables.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```json
|
|
94
|
+
* {
|
|
95
|
+
* "component": "HorizontalStack",
|
|
96
|
+
* "style": {
|
|
97
|
+
* "background-color": "#f5f5f5",
|
|
98
|
+
* "border-radius": "8px",
|
|
99
|
+
* "padding": "1rem"
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export type ExtensionComponentStyle = Partial<Record<AllowedCSSProperty, string>>
|
|
105
|
+
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// Base Component
|
|
108
|
+
// =============================================================================
|
|
109
|
+
|
|
1
110
|
/** Base interface for dynamically rendered extension components. */
|
|
2
111
|
export interface ExtensionComponentData {
|
|
3
112
|
component: string
|
|
113
|
+
/**
|
|
114
|
+
* Optional inline styles for the component.
|
|
115
|
+
* Only safe CSS properties are allowed; dangerous properties and values
|
|
116
|
+
* (e.g., position, z-index, url()) are blocked for security.
|
|
117
|
+
* Values can use $-prefixed references to scope variables.
|
|
118
|
+
*/
|
|
119
|
+
style?: ExtensionComponentStyle
|
|
4
120
|
[key: string]: unknown
|
|
5
121
|
}
|
|
6
122
|
|
|
@@ -234,3 +350,71 @@ export interface ToggleProps extends ExtensionComponentData {
|
|
|
234
350
|
disabled?: boolean
|
|
235
351
|
onChangeAction: ExtensionActionRef
|
|
236
352
|
}
|
|
353
|
+
|
|
354
|
+
/** The extension API properties for the Collapsible component. */
|
|
355
|
+
export interface CollapsibleProps extends ExtensionComponentData {
|
|
356
|
+
component: 'Collapsible'
|
|
357
|
+
/** Title displayed in the header. */
|
|
358
|
+
title: string
|
|
359
|
+
/** Optional description rendered under the title. */
|
|
360
|
+
description?: string | string[]
|
|
361
|
+
/** Optional icon shown to the left of the title. */
|
|
362
|
+
icon?: string
|
|
363
|
+
/** Whether the section is expanded by default. */
|
|
364
|
+
defaultExpanded?: boolean
|
|
365
|
+
/** Child component to render when expanded. */
|
|
366
|
+
content?: ExtensionComponentData
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Pill variant type for predefined color schemes. */
|
|
370
|
+
export type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent'
|
|
371
|
+
|
|
372
|
+
/** The extension API properties for the Pill component. */
|
|
373
|
+
export interface PillProps extends ExtensionComponentData {
|
|
374
|
+
component: 'Pill'
|
|
375
|
+
/** Text to display in the pill. */
|
|
376
|
+
text: string
|
|
377
|
+
/** Optional icon shown to the left of the text. */
|
|
378
|
+
icon?: string
|
|
379
|
+
/** Color variant. Defaults to 'default'. */
|
|
380
|
+
variant?: PillVariant
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** The extension API properties for the Checkbox component. */
|
|
384
|
+
export interface CheckboxProps extends ExtensionComponentData {
|
|
385
|
+
component: 'Checkbox'
|
|
386
|
+
/** Label text displayed next to the checkbox. */
|
|
387
|
+
label: string
|
|
388
|
+
/** Whether the checkbox is checked. */
|
|
389
|
+
checked?: boolean
|
|
390
|
+
/** Whether the checkbox is disabled. */
|
|
391
|
+
disabled?: boolean
|
|
392
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
393
|
+
strikethrough?: boolean
|
|
394
|
+
/** Action to call when the checkbox state changes. */
|
|
395
|
+
onChangeAction: ExtensionActionRef
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** The extension API properties for the Markdown component. */
|
|
399
|
+
export interface MarkdownProps extends ExtensionComponentData {
|
|
400
|
+
component: 'Markdown'
|
|
401
|
+
/** Markdown content to render. */
|
|
402
|
+
content: string
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** The extension API properties for the Modal component. */
|
|
406
|
+
export interface ModalProps extends ExtensionComponentData {
|
|
407
|
+
component: 'Modal'
|
|
408
|
+
/** Title displayed in the modal header. */
|
|
409
|
+
title: string
|
|
410
|
+
/** Whether the modal is open. */
|
|
411
|
+
open?: boolean
|
|
412
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
413
|
+
maxWidth?: string
|
|
414
|
+
/** Content to render in the modal body. */
|
|
415
|
+
body?: ExtensionComponentData
|
|
416
|
+
/** Optional content to render in the modal footer. */
|
|
417
|
+
footer?: ExtensionComponentData
|
|
418
|
+
/** Action to call when the modal is closed. */
|
|
419
|
+
onCloseAction?: ExtensionActionRef
|
|
420
|
+
}
|