@stina/extension-api 0.8.1 → 0.10.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-Cw9zIBl8.d.cts} +106 -1
- package/dist/{types-Cr8eCJ0G.d.ts → types-Cw9zIBl8.d.ts} +106 -1
- package/package.json +1 -1
- package/src/index.ts +10 -0
- package/src/types.components.ts +192 -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 DateTimeInputProps,\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-Cw9zIBl8.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, aB as CheckboxProps, ay as CollapsibleProps, t as CommandDefinition, a0 as DatabaseAPI, am as DateTimeInputProps, I as Disposable, ar 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, aq as GridProps, ah as HeaderProps, ap as HorizontalStackProps, au as IconButtonProps, at as IconButtonType, as as IconProps, ai as LabelProps, a2 as LogAPI, aC as MarkdownProps, aD as ModalProps, J as NetworkAPI, N as NetworkPermission, av as PanelAction, n as PanelActionDataSource, m as PanelComponentView, k as PanelDefinition, aw as PanelProps, o as PanelUnknownView, l as PanelView, aj as ParagraphProps, z as Permission, aA as PillProps, az 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, an 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, ax 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, ao as VerticalStackProps } from './types-Cw9zIBl8.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-Cw9zIBl8.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, aB as CheckboxProps, ay as CollapsibleProps, t as CommandDefinition, a0 as DatabaseAPI, am as DateTimeInputProps, I as Disposable, ar 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, aq as GridProps, ah as HeaderProps, ap as HorizontalStackProps, au as IconButtonProps, at as IconButtonType, as as IconProps, ai as LabelProps, a2 as LogAPI, aC as MarkdownProps, aD as ModalProps, J as NetworkAPI, N as NetworkPermission, av as PanelAction, n as PanelActionDataSource, m as PanelComponentView, k as PanelDefinition, aw as PanelProps, o as PanelUnknownView, l as PanelView, aj as ParagraphProps, z as Permission, aA as PillProps, az 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, an 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, ax 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, ao as VerticalStackProps } from './types-Cw9zIBl8.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-Cw9zIBl8.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-Cw9zIBl8.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-Cw9zIBl8.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-Cw9zIBl8.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
|
/**
|
|
@@ -124,6 +160,13 @@ interface TextInputProps extends ExtensionComponentData {
|
|
|
124
160
|
value?: string;
|
|
125
161
|
onChangeAction: ExtensionActionRef;
|
|
126
162
|
}
|
|
163
|
+
/** The extension API properties for the DateTimeInput component. */
|
|
164
|
+
interface DateTimeInputProps extends ExtensionComponentData {
|
|
165
|
+
component: 'DateTimeInput';
|
|
166
|
+
label: string;
|
|
167
|
+
value?: string;
|
|
168
|
+
onChangeAction: ExtensionActionRef;
|
|
169
|
+
}
|
|
127
170
|
/** The extension API properties for the Select component. */
|
|
128
171
|
interface SelectProps extends ExtensionComponentData {
|
|
129
172
|
component: 'Select';
|
|
@@ -201,6 +244,68 @@ interface ToggleProps extends ExtensionComponentData {
|
|
|
201
244
|
disabled?: boolean;
|
|
202
245
|
onChangeAction: ExtensionActionRef;
|
|
203
246
|
}
|
|
247
|
+
/** The extension API properties for the Collapsible component. */
|
|
248
|
+
interface CollapsibleProps extends ExtensionComponentData {
|
|
249
|
+
component: 'Collapsible';
|
|
250
|
+
/** Title displayed in the header. */
|
|
251
|
+
title: string;
|
|
252
|
+
/** Optional description rendered under the title. */
|
|
253
|
+
description?: string | string[];
|
|
254
|
+
/** Optional icon shown to the left of the title. */
|
|
255
|
+
icon?: string;
|
|
256
|
+
/** Whether the section is expanded by default. */
|
|
257
|
+
defaultExpanded?: boolean;
|
|
258
|
+
/** Child component to render when expanded. */
|
|
259
|
+
content?: ExtensionComponentData;
|
|
260
|
+
}
|
|
261
|
+
/** Pill variant type for predefined color schemes. */
|
|
262
|
+
type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent';
|
|
263
|
+
/** The extension API properties for the Pill component. */
|
|
264
|
+
interface PillProps extends ExtensionComponentData {
|
|
265
|
+
component: 'Pill';
|
|
266
|
+
/** Text to display in the pill. */
|
|
267
|
+
text: string;
|
|
268
|
+
/** Optional icon shown to the left of the text. */
|
|
269
|
+
icon?: string;
|
|
270
|
+
/** Color variant. Defaults to 'default'. */
|
|
271
|
+
variant?: PillVariant;
|
|
272
|
+
}
|
|
273
|
+
/** The extension API properties for the Checkbox component. */
|
|
274
|
+
interface CheckboxProps extends ExtensionComponentData {
|
|
275
|
+
component: 'Checkbox';
|
|
276
|
+
/** Label text displayed next to the checkbox. */
|
|
277
|
+
label: string;
|
|
278
|
+
/** Whether the checkbox is checked. */
|
|
279
|
+
checked?: boolean;
|
|
280
|
+
/** Whether the checkbox is disabled. */
|
|
281
|
+
disabled?: boolean;
|
|
282
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
283
|
+
strikethrough?: boolean;
|
|
284
|
+
/** Action to call when the checkbox state changes. */
|
|
285
|
+
onChangeAction: ExtensionActionRef;
|
|
286
|
+
}
|
|
287
|
+
/** The extension API properties for the Markdown component. */
|
|
288
|
+
interface MarkdownProps extends ExtensionComponentData {
|
|
289
|
+
component: 'Markdown';
|
|
290
|
+
/** Markdown content to render. */
|
|
291
|
+
content: string;
|
|
292
|
+
}
|
|
293
|
+
/** The extension API properties for the Modal component. */
|
|
294
|
+
interface ModalProps extends ExtensionComponentData {
|
|
295
|
+
component: 'Modal';
|
|
296
|
+
/** Title displayed in the modal header. */
|
|
297
|
+
title: string;
|
|
298
|
+
/** Whether the modal is open. */
|
|
299
|
+
open?: boolean;
|
|
300
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
301
|
+
maxWidth?: string;
|
|
302
|
+
/** Content to render in the modal body. */
|
|
303
|
+
body?: ExtensionComponentData;
|
|
304
|
+
/** Optional content to render in the modal footer. */
|
|
305
|
+
footer?: ExtensionComponentData;
|
|
306
|
+
/** Action to call when the modal is closed. */
|
|
307
|
+
onCloseAction?: ExtensionActionRef;
|
|
308
|
+
}
|
|
204
309
|
|
|
205
310
|
/**
|
|
206
311
|
* Extension manifest format (manifest.json)
|
|
@@ -948,4 +1053,4 @@ interface ExtensionModule {
|
|
|
948
1053
|
deactivate?(): void | Promise<void>;
|
|
949
1054
|
}
|
|
950
1055
|
|
|
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,
|
|
1056
|
+
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, PillProps as aA, CheckboxProps as aB, MarkdownProps as aC, ModalProps as aD, 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, DateTimeInputProps as am, SelectProps as an, VerticalStackProps as ao, HorizontalStackProps as ap, GridProps as aq, DividerProps as ar, IconProps as as, IconButtonType as at, IconButtonProps as au, PanelAction as av, PanelProps as aw, ToggleProps as ax, CollapsibleProps as ay, PillVariant 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
|
/**
|
|
@@ -124,6 +160,13 @@ interface TextInputProps extends ExtensionComponentData {
|
|
|
124
160
|
value?: string;
|
|
125
161
|
onChangeAction: ExtensionActionRef;
|
|
126
162
|
}
|
|
163
|
+
/** The extension API properties for the DateTimeInput component. */
|
|
164
|
+
interface DateTimeInputProps extends ExtensionComponentData {
|
|
165
|
+
component: 'DateTimeInput';
|
|
166
|
+
label: string;
|
|
167
|
+
value?: string;
|
|
168
|
+
onChangeAction: ExtensionActionRef;
|
|
169
|
+
}
|
|
127
170
|
/** The extension API properties for the Select component. */
|
|
128
171
|
interface SelectProps extends ExtensionComponentData {
|
|
129
172
|
component: 'Select';
|
|
@@ -201,6 +244,68 @@ interface ToggleProps extends ExtensionComponentData {
|
|
|
201
244
|
disabled?: boolean;
|
|
202
245
|
onChangeAction: ExtensionActionRef;
|
|
203
246
|
}
|
|
247
|
+
/** The extension API properties for the Collapsible component. */
|
|
248
|
+
interface CollapsibleProps extends ExtensionComponentData {
|
|
249
|
+
component: 'Collapsible';
|
|
250
|
+
/** Title displayed in the header. */
|
|
251
|
+
title: string;
|
|
252
|
+
/** Optional description rendered under the title. */
|
|
253
|
+
description?: string | string[];
|
|
254
|
+
/** Optional icon shown to the left of the title. */
|
|
255
|
+
icon?: string;
|
|
256
|
+
/** Whether the section is expanded by default. */
|
|
257
|
+
defaultExpanded?: boolean;
|
|
258
|
+
/** Child component to render when expanded. */
|
|
259
|
+
content?: ExtensionComponentData;
|
|
260
|
+
}
|
|
261
|
+
/** Pill variant type for predefined color schemes. */
|
|
262
|
+
type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent';
|
|
263
|
+
/** The extension API properties for the Pill component. */
|
|
264
|
+
interface PillProps extends ExtensionComponentData {
|
|
265
|
+
component: 'Pill';
|
|
266
|
+
/** Text to display in the pill. */
|
|
267
|
+
text: string;
|
|
268
|
+
/** Optional icon shown to the left of the text. */
|
|
269
|
+
icon?: string;
|
|
270
|
+
/** Color variant. Defaults to 'default'. */
|
|
271
|
+
variant?: PillVariant;
|
|
272
|
+
}
|
|
273
|
+
/** The extension API properties for the Checkbox component. */
|
|
274
|
+
interface CheckboxProps extends ExtensionComponentData {
|
|
275
|
+
component: 'Checkbox';
|
|
276
|
+
/** Label text displayed next to the checkbox. */
|
|
277
|
+
label: string;
|
|
278
|
+
/** Whether the checkbox is checked. */
|
|
279
|
+
checked?: boolean;
|
|
280
|
+
/** Whether the checkbox is disabled. */
|
|
281
|
+
disabled?: boolean;
|
|
282
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
283
|
+
strikethrough?: boolean;
|
|
284
|
+
/** Action to call when the checkbox state changes. */
|
|
285
|
+
onChangeAction: ExtensionActionRef;
|
|
286
|
+
}
|
|
287
|
+
/** The extension API properties for the Markdown component. */
|
|
288
|
+
interface MarkdownProps extends ExtensionComponentData {
|
|
289
|
+
component: 'Markdown';
|
|
290
|
+
/** Markdown content to render. */
|
|
291
|
+
content: string;
|
|
292
|
+
}
|
|
293
|
+
/** The extension API properties for the Modal component. */
|
|
294
|
+
interface ModalProps extends ExtensionComponentData {
|
|
295
|
+
component: 'Modal';
|
|
296
|
+
/** Title displayed in the modal header. */
|
|
297
|
+
title: string;
|
|
298
|
+
/** Whether the modal is open. */
|
|
299
|
+
open?: boolean;
|
|
300
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
301
|
+
maxWidth?: string;
|
|
302
|
+
/** Content to render in the modal body. */
|
|
303
|
+
body?: ExtensionComponentData;
|
|
304
|
+
/** Optional content to render in the modal footer. */
|
|
305
|
+
footer?: ExtensionComponentData;
|
|
306
|
+
/** Action to call when the modal is closed. */
|
|
307
|
+
onCloseAction?: ExtensionActionRef;
|
|
308
|
+
}
|
|
204
309
|
|
|
205
310
|
/**
|
|
206
311
|
* Extension manifest format (manifest.json)
|
|
@@ -948,4 +1053,4 @@ interface ExtensionModule {
|
|
|
948
1053
|
deactivate?(): void | Promise<void>;
|
|
949
1054
|
}
|
|
950
1055
|
|
|
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,
|
|
1056
|
+
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, PillProps as aA, CheckboxProps as aB, MarkdownProps as aC, ModalProps as aD, 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, DateTimeInputProps as am, SelectProps as an, VerticalStackProps as ao, HorizontalStackProps as ap, GridProps as aq, DividerProps as ar, IconProps as as, IconButtonType as at, IconButtonProps as au, PanelAction as av, PanelProps as aw, ToggleProps as ax, CollapsibleProps as ay, PillVariant 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
|
|
@@ -134,6 +137,7 @@ export type {
|
|
|
134
137
|
ParagraphProps,
|
|
135
138
|
ButtonProps,
|
|
136
139
|
TextInputProps,
|
|
140
|
+
DateTimeInputProps,
|
|
137
141
|
SelectProps,
|
|
138
142
|
VerticalStackProps,
|
|
139
143
|
HorizontalStackProps,
|
|
@@ -145,4 +149,10 @@ export type {
|
|
|
145
149
|
PanelAction,
|
|
146
150
|
PanelProps,
|
|
147
151
|
ToggleProps,
|
|
152
|
+
CollapsibleProps,
|
|
153
|
+
PillVariant,
|
|
154
|
+
PillProps,
|
|
155
|
+
CheckboxProps,
|
|
156
|
+
MarkdownProps,
|
|
157
|
+
ModalProps,
|
|
148
158
|
} 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
|
|
|
@@ -150,6 +266,14 @@ export interface TextInputProps extends ExtensionComponentData {
|
|
|
150
266
|
onChangeAction: ExtensionActionRef
|
|
151
267
|
}
|
|
152
268
|
|
|
269
|
+
/** The extension API properties for the DateTimeInput component. */
|
|
270
|
+
export interface DateTimeInputProps extends ExtensionComponentData {
|
|
271
|
+
component: 'DateTimeInput'
|
|
272
|
+
label: string
|
|
273
|
+
value?: string
|
|
274
|
+
onChangeAction: ExtensionActionRef
|
|
275
|
+
}
|
|
276
|
+
|
|
153
277
|
/** The extension API properties for the Select component. */
|
|
154
278
|
export interface SelectProps extends ExtensionComponentData {
|
|
155
279
|
component: 'Select'
|
|
@@ -234,3 +358,71 @@ export interface ToggleProps extends ExtensionComponentData {
|
|
|
234
358
|
disabled?: boolean
|
|
235
359
|
onChangeAction: ExtensionActionRef
|
|
236
360
|
}
|
|
361
|
+
|
|
362
|
+
/** The extension API properties for the Collapsible component. */
|
|
363
|
+
export interface CollapsibleProps extends ExtensionComponentData {
|
|
364
|
+
component: 'Collapsible'
|
|
365
|
+
/** Title displayed in the header. */
|
|
366
|
+
title: string
|
|
367
|
+
/** Optional description rendered under the title. */
|
|
368
|
+
description?: string | string[]
|
|
369
|
+
/** Optional icon shown to the left of the title. */
|
|
370
|
+
icon?: string
|
|
371
|
+
/** Whether the section is expanded by default. */
|
|
372
|
+
defaultExpanded?: boolean
|
|
373
|
+
/** Child component to render when expanded. */
|
|
374
|
+
content?: ExtensionComponentData
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Pill variant type for predefined color schemes. */
|
|
378
|
+
export type PillVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'accent'
|
|
379
|
+
|
|
380
|
+
/** The extension API properties for the Pill component. */
|
|
381
|
+
export interface PillProps extends ExtensionComponentData {
|
|
382
|
+
component: 'Pill'
|
|
383
|
+
/** Text to display in the pill. */
|
|
384
|
+
text: string
|
|
385
|
+
/** Optional icon shown to the left of the text. */
|
|
386
|
+
icon?: string
|
|
387
|
+
/** Color variant. Defaults to 'default'. */
|
|
388
|
+
variant?: PillVariant
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** The extension API properties for the Checkbox component. */
|
|
392
|
+
export interface CheckboxProps extends ExtensionComponentData {
|
|
393
|
+
component: 'Checkbox'
|
|
394
|
+
/** Label text displayed next to the checkbox. */
|
|
395
|
+
label: string
|
|
396
|
+
/** Whether the checkbox is checked. */
|
|
397
|
+
checked?: boolean
|
|
398
|
+
/** Whether the checkbox is disabled. */
|
|
399
|
+
disabled?: boolean
|
|
400
|
+
/** Whether to strike through the label when checked. Defaults to true. */
|
|
401
|
+
strikethrough?: boolean
|
|
402
|
+
/** Action to call when the checkbox state changes. */
|
|
403
|
+
onChangeAction: ExtensionActionRef
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** The extension API properties for the Markdown component. */
|
|
407
|
+
export interface MarkdownProps extends ExtensionComponentData {
|
|
408
|
+
component: 'Markdown'
|
|
409
|
+
/** Markdown content to render. */
|
|
410
|
+
content: string
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** The extension API properties for the Modal component. */
|
|
414
|
+
export interface ModalProps extends ExtensionComponentData {
|
|
415
|
+
component: 'Modal'
|
|
416
|
+
/** Title displayed in the modal header. */
|
|
417
|
+
title: string
|
|
418
|
+
/** Whether the modal is open. */
|
|
419
|
+
open?: boolean
|
|
420
|
+
/** Optional max width for the modal (e.g., '600px', '80%'). Defaults to '600px'. */
|
|
421
|
+
maxWidth?: string
|
|
422
|
+
/** Content to render in the modal body. */
|
|
423
|
+
body?: ExtensionComponentData
|
|
424
|
+
/** Optional content to render in the modal footer. */
|
|
425
|
+
footer?: ExtensionComponentData
|
|
426
|
+
/** Action to call when the modal is closed. */
|
|
427
|
+
onCloseAction?: ExtensionActionRef
|
|
428
|
+
}
|