@stina/extension-api 0.32.0 → 0.33.0-alpha.8cab91c
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/schemas/index.cjs +58 -110
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2752 -3056
- package/dist/schemas/index.d.ts +2752 -3056
- package/dist/schemas/index.js +56 -101
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-XIdePk7Z.d.cts → types.tools-BYgcVNP4.d.cts} +82 -141
- package/dist/{types.tools-XIdePk7Z.d.ts → types.tools-BYgcVNP4.d.ts} +82 -141
- package/package.json +1 -1
- package/schema/extension-manifest.schema.json +146 -341
- package/src/index.ts +4 -10
- package/src/schemas/components.schema.ts +52 -6
- package/src/schemas/contributions.schema.ts +33 -178
- package/src/schemas/index.ts +4 -18
- package/src/types.components.ts +46 -6
- package/src/types.contributions.ts +39 -142
- package/src/types.ts +1 -9
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types.localization.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// Localization\nexport type { LocalizedString } from './types.js'\nexport { resolveLocalizedString } from './types.js'\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 ToolSettingsComponentView,\n ToolSettingsActionDataSource,\n PanelDefinition,\n PanelView,\n PanelComponentView,\n PanelActionDataSource,\n PanelUnknownView,\n ProviderDefinition,\n PromptContribution,\n PromptSection,\n ToolDefinition,\n ToolConfirmationConfig,\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 LogAPI,\n\n // Background workers\n BackgroundWorkersAPI,\n BackgroundTaskConfig,\n BackgroundTaskCallback,\n BackgroundTaskContext,\n BackgroundTaskHealth,\n BackgroundRestartPolicy,\n\n // Storage and Secrets\n Query,\n QueryOptions,\n StorageAPI,\n SecretsAPI,\n StorageCollectionConfig,\n StorageContributions,\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 // Background task messages\n BackgroundTaskStartMessage,\n BackgroundTaskStopMessage,\n BackgroundTaskRegisteredMessage,\n BackgroundTaskStatusMessage,\n BackgroundTaskHealthMessage,\n} from './messages.js'\n\nexport { generateMessageId } from './messages.js'\n\n// Component types (for extension UI components)\nexport type {\n // Icon Names\n HugeIconName,\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 IconPickerProps,\n VerticalStackProps,\n HorizontalStackProps,\n GridProps,\n DividerProps,\n IconProps,\n IconButtonType,\n IconButtonProps,\n PanelAction,\n PanelProps,\n ToggleProps,\n CollapsibleProps,\n FrameVariant,\n FrameProps,\n ListProps,\n PillVariant,\n PillProps,\n CheckboxProps,\n MarkdownProps,\n TextPreviewProps,\n ModalProps,\n ConditionalGroupProps,\n} from './types.components.js'\n","/**\n * Localization Types\n *\n * Types and utilities for localized strings in extensions.\n */\n\n/**\n * A string that can be either a simple string or a map of language codes to localized strings.\n * When a simple string is provided, it's used as the default/fallback value.\n * When a map is provided, the appropriate language is selected at runtime.\n *\n * @example\n * // Simple string (backwards compatible)\n * name: \"Get Weather\"\n *\n * @example\n * // Localized strings\n * name: { en: \"Get Weather\", sv: \"Hämta väder\", de: \"Wetter abrufen\" }\n */\nexport type LocalizedString = string | Record<string, string>\n\n/**\n * Resolves a LocalizedString to an actual string value.\n * @param value The LocalizedString to resolve\n * @param lang The preferred language code (e.g., \"sv\", \"en\")\n * @param fallbackLang The fallback language code (defaults to \"en\")\n * @returns The resolved string value\n */\nexport function resolveLocalizedString(\n value: LocalizedString,\n lang: string,\n fallbackLang = 'en'\n): string {\n if (typeof value === 'string') {\n return value\n }\n // Try preferred language first, then fallback language, then first available, then empty string\n return value[lang] ?? value[fallbackLang] ?? Object.values(value)[0] ?? ''\n}\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 | StreamingFetchChunkMessage\n | BackgroundTaskStartMessage\n | BackgroundTaskStopMessage\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 /** User ID if the tool is executed in a user context */\n userId?: string\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 /** User ID if the action is executed in a user context */\n userId?: string\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 * Message sent from host to worker with streaming fetch data chunks.\n * Used for streaming network responses (e.g., NDJSON streams from Ollama).\n */\nexport interface StreamingFetchChunkMessage {\n type: 'streaming-fetch-chunk'\n id: string\n payload: {\n requestId: string\n chunk: string\n done: boolean\n error?: string\n }\n}\n\n/**\n * Message sent from host to worker to start a registered background task.\n */\nexport interface BackgroundTaskStartMessage {\n type: 'background-task-start'\n id: string\n payload: {\n taskId: string\n }\n}\n\n/**\n * Message sent from host to worker to stop a running background task.\n */\nexport interface BackgroundTaskStopMessage {\n type: 'background-task-stop'\n id: string\n payload: {\n taskId: 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 | StreamingFetchAckMessage\n | BackgroundTaskRegisteredMessage\n | BackgroundTaskStatusMessage\n | BackgroundTaskHealthMessage\n\nexport interface ReadyMessage {\n type: 'ready'\n}\n\n/**\n * Message sent from worker to host to acknowledge receipt of a streaming fetch chunk.\n * This enables backpressure control to prevent unbounded memory growth.\n */\nexport interface StreamingFetchAckMessage {\n type: 'streaming-fetch-ack'\n payload: {\n requestId: string\n }\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 | 'network.fetch-stream'\n | 'settings.getAll'\n | 'settings.get'\n | 'settings.set'\n | 'user.getProfile'\n | 'user.listIds'\n | 'events.emit'\n | 'scheduler.schedule'\n | 'scheduler.cancel'\n | 'scheduler.reportFireResult'\n | 'chat.appendInstruction'\n | 'database.execute'\n // Simple key-value storage methods\n | 'storage.set'\n | 'storage.keys'\n | 'storage.setForUser'\n | 'storage.keysForUser'\n // Collection-based storage methods\n | 'storage.put'\n | 'storage.get'\n | 'storage.delete'\n | 'storage.find'\n | 'storage.findOne'\n | 'storage.count'\n | 'storage.putMany'\n | 'storage.deleteMany'\n | 'storage.dropCollection'\n | 'storage.listCollections'\n | 'storage.putForUser'\n | 'storage.getForUser'\n | 'storage.deleteForUser'\n | 'storage.findForUser'\n | 'storage.findOneForUser'\n | 'storage.countForUser'\n | 'storage.putManyForUser'\n | 'storage.deleteManyForUser'\n | 'storage.dropCollectionForUser'\n | 'storage.listCollectionsForUser'\n // Secrets methods\n | 'secrets.set'\n | 'secrets.get'\n | 'secrets.delete'\n | 'secrets.list'\n | 'secrets.setForUser'\n | 'secrets.getForUser'\n | 'secrets.deleteForUser'\n | 'secrets.listForUser'\n // Tools cross-extension methods\n | 'tools.list'\n | 'tools.execute'\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 * Message sent from worker to host when a background task is registered.\n */\nexport interface BackgroundTaskRegisteredMessage {\n type: 'background-task-registered'\n payload: {\n taskId: string\n name: string\n userId: string\n restartPolicy: {\n type: 'always' | 'on-failure' | 'never'\n maxRestarts?: number\n initialDelayMs?: number\n maxDelayMs?: number\n backoffMultiplier?: number\n }\n payload?: Record<string, unknown>\n }\n}\n\n/**\n * Message sent from worker to host with background task status updates.\n */\nexport interface BackgroundTaskStatusMessage {\n type: 'background-task-status'\n payload: {\n taskId: string\n status: 'running' | 'stopped' | 'failed'\n error?: string\n }\n}\n\n/**\n * Message sent from worker to host with background task health reports.\n */\nexport interface BackgroundTaskHealthMessage {\n type: 'background-task-health'\n payload: {\n taskId: string\n status: string\n timestamp: string\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;AAAA;;;AC4BO,SAAS,uBACd,OACA,MACA,eAAe,MACP;AACR,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,SAAO,MAAM,IAAI,KAAK,MAAM,YAAY,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC,KAAK;AAC1E;;;ACiVO,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/types.localization.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// Localization\nexport type { LocalizedString } from './types.js'\nexport { resolveLocalizedString } from './types.js'\n\n// Types\nexport type {\n // Manifest\n ExtensionManifest,\n Platform,\n ExtensionContributions,\n ToolSettingsViewDefinition,\n ToolSettingsView,\n ToolSettingsListView,\n ToolSettingsListMapping,\n ToolSettingsComponentView,\n ToolSettingsActionDataSource,\n PanelDefinition,\n PanelView,\n PanelComponentView,\n PanelActionDataSource,\n PanelUnknownView,\n ProviderDefinition,\n ProviderConfigView,\n PromptContribution,\n PromptSection,\n ToolDefinition,\n ToolConfirmationConfig,\n CommandDefinition,\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 LogAPI,\n\n // Background workers\n BackgroundWorkersAPI,\n BackgroundTaskConfig,\n BackgroundTaskCallback,\n BackgroundTaskContext,\n BackgroundTaskHealth,\n BackgroundRestartPolicy,\n\n // Storage and Secrets\n Query,\n QueryOptions,\n StorageAPI,\n SecretsAPI,\n StorageCollectionConfig,\n StorageContributions,\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 // Background task messages\n BackgroundTaskStartMessage,\n BackgroundTaskStopMessage,\n BackgroundTaskRegisteredMessage,\n BackgroundTaskStatusMessage,\n BackgroundTaskHealthMessage,\n} from './messages.js'\n\nexport { generateMessageId } from './messages.js'\n\n// Component types (for extension UI components)\nexport type {\n // Icon Names\n HugeIconName,\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 PasswordInputProps,\n NumberInputProps,\n TextAreaProps,\n DateTimeInputProps,\n SelectProps,\n IconPickerProps,\n VerticalStackProps,\n HorizontalStackProps,\n GridProps,\n DividerProps,\n IconProps,\n IconButtonType,\n IconButtonProps,\n PanelAction,\n PanelProps,\n ToggleProps,\n CollapsibleProps,\n FrameVariant,\n FrameProps,\n ListProps,\n PillVariant,\n PillProps,\n CheckboxProps,\n MarkdownProps,\n TextPreviewProps,\n ModalProps,\n ConditionalGroupProps,\n} from './types.components.js'\n","/**\n * Localization Types\n *\n * Types and utilities for localized strings in extensions.\n */\n\n/**\n * A string that can be either a simple string or a map of language codes to localized strings.\n * When a simple string is provided, it's used as the default/fallback value.\n * When a map is provided, the appropriate language is selected at runtime.\n *\n * @example\n * // Simple string (backwards compatible)\n * name: \"Get Weather\"\n *\n * @example\n * // Localized strings\n * name: { en: \"Get Weather\", sv: \"Hämta väder\", de: \"Wetter abrufen\" }\n */\nexport type LocalizedString = string | Record<string, string>\n\n/**\n * Resolves a LocalizedString to an actual string value.\n * @param value The LocalizedString to resolve\n * @param lang The preferred language code (e.g., \"sv\", \"en\")\n * @param fallbackLang The fallback language code (defaults to \"en\")\n * @returns The resolved string value\n */\nexport function resolveLocalizedString(\n value: LocalizedString,\n lang: string,\n fallbackLang = 'en'\n): string {\n if (typeof value === 'string') {\n return value\n }\n // Try preferred language first, then fallback language, then first available, then empty string\n return value[lang] ?? value[fallbackLang] ?? Object.values(value)[0] ?? ''\n}\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 | StreamingFetchChunkMessage\n | BackgroundTaskStartMessage\n | BackgroundTaskStopMessage\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 /** User ID if the tool is executed in a user context */\n userId?: string\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 /** User ID if the action is executed in a user context */\n userId?: string\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 * Message sent from host to worker with streaming fetch data chunks.\n * Used for streaming network responses (e.g., NDJSON streams from Ollama).\n */\nexport interface StreamingFetchChunkMessage {\n type: 'streaming-fetch-chunk'\n id: string\n payload: {\n requestId: string\n chunk: string\n done: boolean\n error?: string\n }\n}\n\n/**\n * Message sent from host to worker to start a registered background task.\n */\nexport interface BackgroundTaskStartMessage {\n type: 'background-task-start'\n id: string\n payload: {\n taskId: string\n }\n}\n\n/**\n * Message sent from host to worker to stop a running background task.\n */\nexport interface BackgroundTaskStopMessage {\n type: 'background-task-stop'\n id: string\n payload: {\n taskId: 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 | StreamingFetchAckMessage\n | BackgroundTaskRegisteredMessage\n | BackgroundTaskStatusMessage\n | BackgroundTaskHealthMessage\n\nexport interface ReadyMessage {\n type: 'ready'\n}\n\n/**\n * Message sent from worker to host to acknowledge receipt of a streaming fetch chunk.\n * This enables backpressure control to prevent unbounded memory growth.\n */\nexport interface StreamingFetchAckMessage {\n type: 'streaming-fetch-ack'\n payload: {\n requestId: string\n }\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 | 'network.fetch-stream'\n | 'settings.getAll'\n | 'settings.get'\n | 'settings.set'\n | 'user.getProfile'\n | 'user.listIds'\n | 'events.emit'\n | 'scheduler.schedule'\n | 'scheduler.cancel'\n | 'scheduler.reportFireResult'\n | 'chat.appendInstruction'\n | 'database.execute'\n // Simple key-value storage methods\n | 'storage.set'\n | 'storage.keys'\n | 'storage.setForUser'\n | 'storage.keysForUser'\n // Collection-based storage methods\n | 'storage.put'\n | 'storage.get'\n | 'storage.delete'\n | 'storage.find'\n | 'storage.findOne'\n | 'storage.count'\n | 'storage.putMany'\n | 'storage.deleteMany'\n | 'storage.dropCollection'\n | 'storage.listCollections'\n | 'storage.putForUser'\n | 'storage.getForUser'\n | 'storage.deleteForUser'\n | 'storage.findForUser'\n | 'storage.findOneForUser'\n | 'storage.countForUser'\n | 'storage.putManyForUser'\n | 'storage.deleteManyForUser'\n | 'storage.dropCollectionForUser'\n | 'storage.listCollectionsForUser'\n // Secrets methods\n | 'secrets.set'\n | 'secrets.get'\n | 'secrets.delete'\n | 'secrets.list'\n | 'secrets.setForUser'\n | 'secrets.getForUser'\n | 'secrets.deleteForUser'\n | 'secrets.listForUser'\n // Tools cross-extension methods\n | 'tools.list'\n | 'tools.execute'\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 * Message sent from worker to host when a background task is registered.\n */\nexport interface BackgroundTaskRegisteredMessage {\n type: 'background-task-registered'\n payload: {\n taskId: string\n name: string\n userId: string\n restartPolicy: {\n type: 'always' | 'on-failure' | 'never'\n maxRestarts?: number\n initialDelayMs?: number\n maxDelayMs?: number\n backoffMultiplier?: number\n }\n payload?: Record<string, unknown>\n }\n}\n\n/**\n * Message sent from worker to host with background task status updates.\n */\nexport interface BackgroundTaskStatusMessage {\n type: 'background-task-status'\n payload: {\n taskId: string\n status: 'running' | 'stopped' | 'failed'\n error?: string\n }\n}\n\n/**\n * Message sent from worker to host with background task health reports.\n */\nexport interface BackgroundTaskHealthMessage {\n type: 'background-task-health'\n payload: {\n taskId: string\n status: string\n timestamp: string\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;AAAA;;;AC4BO,SAAS,uBACd,OACA,MACA,eAAe,MACP;AACR,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,SAAO,MAAM,IAAI,KAAK,MAAM,YAAY,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC,KAAK;AAC1E;;;ACiVO,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 { E as ExtensionContributions, 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.tools-
|
|
2
|
-
export {
|
|
1
|
+
import { E as ExtensionContributions, 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.tools-BYgcVNP4.cjs';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, y as ActionsAPI, a9 as AllowedCSSProperty, Y as BackgroundRestartPolicy, V as BackgroundTaskCallback, R as BackgroundTaskConfig, W as BackgroundTaskContext, X as BackgroundTaskHealth, Q as BackgroundWorkersAPI, al as ButtonProps, J as ChatAPI, K as ChatInstructionMessage, aJ as CheckboxProps, aD as CollapsibleProps, t as CommandDefinition, aN as ConditionalGroupProps, aq as DateTimeInputProps, D as Disposable, aw as DividerProps, z as EventsAPI, ae as ExtensionActionCall, af as ExtensionActionRef, ad as ExtensionComponentChildren, ab as ExtensionComponentData, ac as ExtensionComponentIterator, aa as ExtensionComponentStyle, u as ExtensionContext, ag as ExtensionDataSource, a7 as ExtensionModule, ah as ExtensionPanelDefinition, aF as FrameProps, aE as FrameVariant, av as GridProps, ai as HeaderProps, au as HorizontalStackProps, a8 as HugeIconName, az as IconButtonProps, ay as IconButtonType, as as IconPickerProps, ax as IconProps, aj as LabelProps, aG as ListProps, L as LocalizedString, O as LogAPI, aK as MarkdownProps, aM as ModalProps, N as NetworkAPI, ao as NumberInputProps, aA as PanelAction, k as PanelActionDataSource, j as PanelComponentView, P as PanelDefinition, aB as PanelProps, l as PanelUnknownView, i as PanelView, ak as ParagraphProps, an as PasswordInputProps, aI as PillProps, aH as PillVariant, o as PromptContribution, p as PromptSection, n as ProviderConfigView, m as ProviderDefinition, w as ProvidersAPI, Z as Query, _ as QueryOptions, B as SchedulerAPI, F as SchedulerJobRequest, H as SchedulerSchedule, a0 as SecretsAPI, ar as SelectProps, v as SettingsAPI, $ as StorageAPI, a1 as StorageCollectionConfig, a2 as StorageContributions, ap as TextAreaProps, am as TextInputProps, aL as TextPreviewProps, aC as ToggleProps, a5 as Tool, a4 as ToolCall, s as ToolConfirmationConfig, q as ToolDefinition, h as ToolSettingsActionDataSource, g as ToolSettingsComponentView, f as ToolSettingsListMapping, e as ToolSettingsListView, d as ToolSettingsView, c as ToolSettingsViewDefinition, x as ToolsAPI, U as UserAPI, I as UserProfile, at as VerticalStackProps, r as resolveLocalizedString } from './types.tools-BYgcVNP4.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Permission Types
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExtensionContributions, 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.tools-
|
|
2
|
-
export {
|
|
1
|
+
import { E as ExtensionContributions, 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.tools-BYgcVNP4.js';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, y as ActionsAPI, a9 as AllowedCSSProperty, Y as BackgroundRestartPolicy, V as BackgroundTaskCallback, R as BackgroundTaskConfig, W as BackgroundTaskContext, X as BackgroundTaskHealth, Q as BackgroundWorkersAPI, al as ButtonProps, J as ChatAPI, K as ChatInstructionMessage, aJ as CheckboxProps, aD as CollapsibleProps, t as CommandDefinition, aN as ConditionalGroupProps, aq as DateTimeInputProps, D as Disposable, aw as DividerProps, z as EventsAPI, ae as ExtensionActionCall, af as ExtensionActionRef, ad as ExtensionComponentChildren, ab as ExtensionComponentData, ac as ExtensionComponentIterator, aa as ExtensionComponentStyle, u as ExtensionContext, ag as ExtensionDataSource, a7 as ExtensionModule, ah as ExtensionPanelDefinition, aF as FrameProps, aE as FrameVariant, av as GridProps, ai as HeaderProps, au as HorizontalStackProps, a8 as HugeIconName, az as IconButtonProps, ay as IconButtonType, as as IconPickerProps, ax as IconProps, aj as LabelProps, aG as ListProps, L as LocalizedString, O as LogAPI, aK as MarkdownProps, aM as ModalProps, N as NetworkAPI, ao as NumberInputProps, aA as PanelAction, k as PanelActionDataSource, j as PanelComponentView, P as PanelDefinition, aB as PanelProps, l as PanelUnknownView, i as PanelView, ak as ParagraphProps, an as PasswordInputProps, aI as PillProps, aH as PillVariant, o as PromptContribution, p as PromptSection, n as ProviderConfigView, m as ProviderDefinition, w as ProvidersAPI, Z as Query, _ as QueryOptions, B as SchedulerAPI, F as SchedulerJobRequest, H as SchedulerSchedule, a0 as SecretsAPI, ar as SelectProps, v as SettingsAPI, $ as StorageAPI, a1 as StorageCollectionConfig, a2 as StorageContributions, ap as TextAreaProps, am as TextInputProps, aL as TextPreviewProps, aC as ToggleProps, a5 as Tool, a4 as ToolCall, s as ToolConfirmationConfig, q as ToolDefinition, h as ToolSettingsActionDataSource, g as ToolSettingsComponentView, f as ToolSettingsListMapping, e as ToolSettingsListView, d as ToolSettingsView, c as ToolSettingsViewDefinition, x as ToolsAPI, U as UserAPI, I as UserProfile, at as VerticalStackProps, r as resolveLocalizedString } from './types.tools-BYgcVNP4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Permission Types
|
package/dist/runtime.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a7 as ExtensionModule } from './types.tools-BYgcVNP4.cjs';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, A as ActionResult, Y as BackgroundRestartPolicy, V as BackgroundTaskCallback, R as BackgroundTaskConfig, W as BackgroundTaskContext, X as BackgroundTaskHealth, Q as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, aO as ExecutionContext, u as ExtensionContext, G as GetModelsOptions, M as ModelInfo, Z as Query, _ as QueryOptions, a0 as SecretsAPI, $ as StorageAPI, b as StreamEvent, a5 as Tool, a4 as ToolCall, q as ToolDefinition, T as ToolResult } from './types.tools-BYgcVNP4.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 {
|
|
2
|
-
export {
|
|
1
|
+
import { a7 as ExtensionModule } from './types.tools-BYgcVNP4.js';
|
|
2
|
+
export { a3 as AIProvider, a6 as Action, A as ActionResult, Y as BackgroundRestartPolicy, V as BackgroundTaskCallback, R as BackgroundTaskConfig, W as BackgroundTaskContext, X as BackgroundTaskHealth, Q as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, aO as ExecutionContext, u as ExtensionContext, G as GetModelsOptions, M as ModelInfo, Z as Query, _ as QueryOptions, a0 as SecretsAPI, $ as StorageAPI, b as StreamEvent, a5 as Tool, a4 as ToolCall, q as ToolDefinition, T as ToolResult } from './types.tools-BYgcVNP4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extension Runtime - Runs inside the worker
|
package/dist/schemas/index.cjs
CHANGED
|
@@ -70,17 +70,9 @@ __export(schemas_exports, {
|
|
|
70
70
|
PlatformSchema: () => PlatformSchema,
|
|
71
71
|
PromptContributionSchema: () => PromptContributionSchema,
|
|
72
72
|
PromptSectionSchema: () => PromptSectionSchema,
|
|
73
|
-
|
|
74
|
-
ProviderConfigPropertyTypeSchema: () => ProviderConfigPropertyTypeSchema,
|
|
75
|
-
ProviderConfigSchemaSchema: () => ProviderConfigSchemaSchema,
|
|
76
|
-
ProviderConfigSelectOptionSchema: () => ProviderConfigSelectOptionSchema,
|
|
77
|
-
ProviderConfigValidationSchema: () => ProviderConfigValidationSchema,
|
|
73
|
+
ProviderConfigViewSchema: () => ProviderConfigViewSchema,
|
|
78
74
|
ProviderDefinitionSchema: () => ProviderDefinitionSchema,
|
|
79
75
|
SelectPropsSchema: () => SelectPropsSchema,
|
|
80
|
-
SettingCreateMappingSchema: () => SettingCreateMappingSchema,
|
|
81
|
-
SettingDefinitionSchema: () => SettingDefinitionSchema,
|
|
82
|
-
SettingOptionsMappingSchema: () => SettingOptionsMappingSchema,
|
|
83
|
-
SettingValidationSchema: () => SettingValidationSchema,
|
|
84
76
|
StoragePermissionSchema: () => StoragePermissionSchema,
|
|
85
77
|
SystemPermissionSchema: () => SystemPermissionSchema,
|
|
86
78
|
TextInputPropsSchema: () => TextInputPropsSchema,
|
|
@@ -89,6 +81,7 @@ __export(schemas_exports, {
|
|
|
89
81
|
ToolDefinitionSchema: () => ToolDefinitionSchema,
|
|
90
82
|
ToolSettingsActionDataSourceSchema: () => ToolSettingsActionDataSourceSchema,
|
|
91
83
|
ToolSettingsComponentViewSchema: () => ToolSettingsComponentViewSchema,
|
|
84
|
+
ToolSettingsListGroupBySchema: () => ToolSettingsListGroupBySchema,
|
|
92
85
|
ToolSettingsListMappingSchema: () => ToolSettingsListMappingSchema,
|
|
93
86
|
ToolSettingsListViewSchema: () => ToolSettingsListViewSchema,
|
|
94
87
|
ToolSettingsViewDefinitionSchema: () => ToolSettingsViewDefinitionSchema,
|
|
@@ -296,6 +289,9 @@ var ParagraphPropsSchema = import_zod2.z.object({
|
|
|
296
289
|
var ButtonPropsSchema = import_zod2.z.object({
|
|
297
290
|
component: import_zod2.z.literal("Button"),
|
|
298
291
|
text: import_zod2.z.string().describe("Button text"),
|
|
292
|
+
type: import_zod2.z.enum(["normal", "primary", "danger", "accent"]).optional().describe("Visual style"),
|
|
293
|
+
title: import_zod2.z.string().optional().describe("Tooltip shown on hover"),
|
|
294
|
+
disabled: import_zod2.z.boolean().optional().describe("Disable the button"),
|
|
299
295
|
onClickAction: ExtensionActionRefSchema.describe("Action to call on click"),
|
|
300
296
|
style: ExtensionComponentStyleSchema.optional()
|
|
301
297
|
}).passthrough().describe("Button component");
|
|
@@ -304,14 +300,42 @@ var TextInputPropsSchema = import_zod2.z.object({
|
|
|
304
300
|
label: import_zod2.z.string().describe("Input label"),
|
|
305
301
|
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
306
302
|
value: import_zod2.z.string().optional().describe("Current value"),
|
|
307
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
303
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
308
304
|
style: ExtensionComponentStyleSchema.optional()
|
|
309
305
|
}).passthrough().describe("TextInput component");
|
|
306
|
+
var PasswordInputPropsSchema = import_zod2.z.object({
|
|
307
|
+
component: import_zod2.z.literal("PasswordInput"),
|
|
308
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
309
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
310
|
+
value: import_zod2.z.string().optional().describe("Current value"),
|
|
311
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
312
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
313
|
+
}).passthrough().describe("Password input component (text is masked)");
|
|
314
|
+
var NumberInputPropsSchema = import_zod2.z.object({
|
|
315
|
+
component: import_zod2.z.literal("NumberInput"),
|
|
316
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
317
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
318
|
+
value: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]).optional().describe("Current value"),
|
|
319
|
+
min: import_zod2.z.number().optional().describe("Minimum value"),
|
|
320
|
+
max: import_zod2.z.number().optional().describe("Maximum value"),
|
|
321
|
+
step: import_zod2.z.number().optional().describe("Step"),
|
|
322
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
323
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
324
|
+
}).passthrough().describe("Numeric input component");
|
|
325
|
+
var TextAreaPropsSchema = import_zod2.z.object({
|
|
326
|
+
component: import_zod2.z.literal("TextArea"),
|
|
327
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
328
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
329
|
+
value: import_zod2.z.string().optional().describe("Current value"),
|
|
330
|
+
rows: import_zod2.z.number().int().positive().optional().describe("Number of visible text rows"),
|
|
331
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
332
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
333
|
+
}).passthrough().describe("TextArea component for multi-line text input");
|
|
310
334
|
var DateTimeInputPropsSchema = import_zod2.z.object({
|
|
311
335
|
component: import_zod2.z.literal("DateTimeInput"),
|
|
312
336
|
label: import_zod2.z.string().describe("Input label"),
|
|
313
337
|
value: import_zod2.z.string().optional().describe("Current value"),
|
|
314
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
338
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
315
339
|
style: ExtensionComponentStyleSchema.optional()
|
|
316
340
|
}).passthrough().describe("DateTimeInput component");
|
|
317
341
|
var SelectPropsSchema = import_zod2.z.object({
|
|
@@ -319,14 +343,14 @@ var SelectPropsSchema = import_zod2.z.object({
|
|
|
319
343
|
label: import_zod2.z.string().describe("Select label"),
|
|
320
344
|
options: import_zod2.z.array(import_zod2.z.object({ label: import_zod2.z.string(), value: import_zod2.z.string() })).describe("Available options"),
|
|
321
345
|
selectedValue: import_zod2.z.string().optional().describe("Currently selected value"),
|
|
322
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
346
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
323
347
|
style: ExtensionComponentStyleSchema.optional()
|
|
324
348
|
}).passthrough().describe("Select component");
|
|
325
349
|
var IconPickerPropsSchema = import_zod2.z.object({
|
|
326
350
|
component: import_zod2.z.literal("IconPicker"),
|
|
327
351
|
label: import_zod2.z.string().optional().describe("Picker label"),
|
|
328
352
|
value: import_zod2.z.string().optional().describe("Currently selected icon name"),
|
|
329
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
353
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
330
354
|
style: ExtensionComponentStyleSchema.optional()
|
|
331
355
|
}).passthrough().describe("IconPicker component");
|
|
332
356
|
var VerticalStackPropsSchema = import_zod2.z.object({
|
|
@@ -390,7 +414,7 @@ var TogglePropsSchema = import_zod2.z.object({
|
|
|
390
414
|
description: import_zod2.z.string().optional().describe("Description text"),
|
|
391
415
|
checked: import_zod2.z.boolean().optional().describe("Whether the toggle is checked"),
|
|
392
416
|
disabled: import_zod2.z.boolean().optional().describe("Whether the toggle is disabled"),
|
|
393
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
417
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
394
418
|
style: ExtensionComponentStyleSchema.optional()
|
|
395
419
|
}).passthrough().describe("Toggle component");
|
|
396
420
|
var CollapsiblePropsSchema = import_zod2.z.object({
|
|
@@ -416,7 +440,7 @@ var CheckboxPropsSchema = import_zod2.z.object({
|
|
|
416
440
|
checked: import_zod2.z.boolean().optional().describe("Whether the checkbox is checked"),
|
|
417
441
|
disabled: import_zod2.z.boolean().optional().describe("Whether the checkbox is disabled"),
|
|
418
442
|
strikethrough: import_zod2.z.boolean().optional().describe("Strike through label when checked"),
|
|
419
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
443
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
420
444
|
style: ExtensionComponentStyleSchema.optional()
|
|
421
445
|
}).passthrough().describe("Checkbox component");
|
|
422
446
|
var MarkdownPropsSchema = import_zod2.z.object({
|
|
@@ -465,61 +489,6 @@ var ListPropsSchema = import_zod2.z.object({
|
|
|
465
489
|
|
|
466
490
|
// src/schemas/contributions.schema.ts
|
|
467
491
|
var LocalizedStringSchema = import_zod3.z.union([import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string())]).describe("String or localized string map");
|
|
468
|
-
var SettingOptionsMappingSchema = import_zod3.z.object({
|
|
469
|
-
itemsKey: import_zod3.z.string().describe("Key for items array in tool result data"),
|
|
470
|
-
valueKey: import_zod3.z.string().describe("Key for option value"),
|
|
471
|
-
labelKey: import_zod3.z.string().describe("Key for option label"),
|
|
472
|
-
descriptionKey: import_zod3.z.string().optional().describe("Optional key for description")
|
|
473
|
-
}).describe("Mapping for select field options");
|
|
474
|
-
var SettingCreateMappingSchema = import_zod3.z.object({
|
|
475
|
-
resultKey: import_zod3.z.string().optional().describe("Key for result data object"),
|
|
476
|
-
valueKey: import_zod3.z.string().describe('Key for option value (defaults to "id")')
|
|
477
|
-
}).describe("Mapping for create tool response");
|
|
478
|
-
var SettingValidationSchema = import_zod3.z.object({
|
|
479
|
-
required: import_zod3.z.boolean().optional().describe("Whether the field is required"),
|
|
480
|
-
min: import_zod3.z.number().optional().describe("Minimum value (number) or length (string)"),
|
|
481
|
-
max: import_zod3.z.number().optional().describe("Maximum value (number) or length (string)"),
|
|
482
|
-
pattern: import_zod3.z.string().optional().describe("Regex pattern for validation")
|
|
483
|
-
}).describe("Validation rules");
|
|
484
|
-
var SettingDefinitionSchema = import_zod3.z.lazy(
|
|
485
|
-
() => import_zod3.z.object({
|
|
486
|
-
id: import_zod3.z.string().describe("Setting ID (namespaced automatically)"),
|
|
487
|
-
title: import_zod3.z.string().describe("Display title"),
|
|
488
|
-
description: import_zod3.z.string().optional().describe("Help text"),
|
|
489
|
-
type: import_zod3.z.enum(["string", "number", "boolean", "select"]).describe("Setting type"),
|
|
490
|
-
default: import_zod3.z.unknown().optional().describe("Default value"),
|
|
491
|
-
options: import_zod3.z.array(import_zod3.z.object({ value: import_zod3.z.string(), label: import_zod3.z.string() })).optional().describe("For select type: available options"),
|
|
492
|
-
optionsToolId: import_zod3.z.string().optional().describe("For select type: load options from tool"),
|
|
493
|
-
optionsParams: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Params for options tool"),
|
|
494
|
-
optionsMapping: SettingOptionsMappingSchema.optional().describe("Mapping for options tool response"),
|
|
495
|
-
createToolId: import_zod3.z.string().optional().describe("Tool ID for creating a new option"),
|
|
496
|
-
createLabel: import_zod3.z.string().optional().describe("Label for create action"),
|
|
497
|
-
createFields: import_zod3.z.array(SettingDefinitionSchema).optional().describe("Fields for create form"),
|
|
498
|
-
createParams: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Static params for create tool"),
|
|
499
|
-
createMapping: SettingCreateMappingSchema.optional().describe("Mapping for create tool response"),
|
|
500
|
-
validation: SettingValidationSchema.optional().describe("Validation rules")
|
|
501
|
-
}).superRefine((data, ctx) => {
|
|
502
|
-
const hasCreateFields = data.createToolId !== void 0 || data.createLabel !== void 0 || data.createFields !== void 0 || data.createParams !== void 0 || data.createMapping !== void 0;
|
|
503
|
-
if (hasCreateFields && data.type !== "select") {
|
|
504
|
-
ctx.addIssue({
|
|
505
|
-
code: import_zod3.z.ZodIssueCode.custom,
|
|
506
|
-
message: 'create* fields (createToolId, createLabel, createFields, createParams, createMapping) are only valid for type "select"',
|
|
507
|
-
path: ["type"]
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
if (data.type === "select") {
|
|
511
|
-
const hasOptions = data.options && data.options.length > 0;
|
|
512
|
-
const hasOptionsToolId = data.optionsToolId !== void 0;
|
|
513
|
-
if (!hasOptions && !hasOptionsToolId) {
|
|
514
|
-
ctx.addIssue({
|
|
515
|
-
code: import_zod3.z.ZodIssueCode.custom,
|
|
516
|
-
message: 'Setting of type "select" must have "options" or "optionsToolId"',
|
|
517
|
-
path: ["type"]
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}).describe("Setting definition")
|
|
522
|
-
);
|
|
523
492
|
var ToolSettingsListMappingSchema = import_zod3.z.object({
|
|
524
493
|
itemsKey: import_zod3.z.string().describe("Key for items array in tool result data"),
|
|
525
494
|
countKey: import_zod3.z.string().optional().describe("Key for total count"),
|
|
@@ -533,6 +502,11 @@ var ToolSettingsActionDataSourceSchema = import_zod3.z.object({
|
|
|
533
502
|
params: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Parameters to pass to the action"),
|
|
534
503
|
refreshOn: import_zod3.z.array(import_zod3.z.string()).optional().describe("Event names that trigger refresh")
|
|
535
504
|
}).describe("Action-based data source");
|
|
505
|
+
var ToolSettingsListGroupBySchema = import_zod3.z.object({
|
|
506
|
+
key: import_zod3.z.string().describe("Key in each item used to determine group membership"),
|
|
507
|
+
order: import_zod3.z.array(import_zod3.z.string()).optional().describe("Explicit ordering of group values; unlisted groups appear afterwards alphabetically"),
|
|
508
|
+
labels: import_zod3.z.record(import_zod3.z.string()).optional().describe("Human-friendly labels per group value (rendered as section headers)")
|
|
509
|
+
}).describe("List view grouping configuration");
|
|
536
510
|
var ToolSettingsListViewSchema = import_zod3.z.object({
|
|
537
511
|
kind: import_zod3.z.literal("list").describe("View kind"),
|
|
538
512
|
listToolId: import_zod3.z.string().describe("Tool ID for listing items"),
|
|
@@ -543,7 +517,13 @@ var ToolSettingsListViewSchema = import_zod3.z.object({
|
|
|
543
517
|
searchParam: import_zod3.z.string().optional().describe("Param name for search query"),
|
|
544
518
|
limitParam: import_zod3.z.string().optional().describe("Param name for limit"),
|
|
545
519
|
idParam: import_zod3.z.string().optional().describe("Param name for get/delete ID"),
|
|
546
|
-
listParams: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Static params for list tool")
|
|
520
|
+
listParams: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Static params for list tool"),
|
|
521
|
+
editView: import_zod3.z.object({
|
|
522
|
+
content: ExtensionComponentDataSchema.describe("Root component for the create/edit modal")
|
|
523
|
+
}).optional().describe("Component-tree create/edit form bound to $item.<key>"),
|
|
524
|
+
groupBy: ToolSettingsListGroupBySchema.optional().describe(
|
|
525
|
+
"Optional grouping configuration; when set, items are visually grouped by this field"
|
|
526
|
+
)
|
|
547
527
|
}).describe("List view backed by tools");
|
|
548
528
|
var ToolSettingsComponentViewSchema = import_zod3.z.object({
|
|
549
529
|
kind: import_zod3.z.literal("component").describe("View kind"),
|
|
@@ -555,8 +535,7 @@ var ToolSettingsViewDefinitionSchema = import_zod3.z.object({
|
|
|
555
535
|
id: import_zod3.z.string().describe("Unique view ID within the extension"),
|
|
556
536
|
title: import_zod3.z.string().describe("Display title"),
|
|
557
537
|
description: import_zod3.z.string().optional().describe("Help text"),
|
|
558
|
-
view: ToolSettingsViewSchema.describe("View configuration")
|
|
559
|
-
fields: import_zod3.z.array(SettingDefinitionSchema).optional().describe("Fields for create/edit forms")
|
|
538
|
+
view: ToolSettingsViewSchema.describe("View configuration")
|
|
560
539
|
}).describe("Tool settings view definition");
|
|
561
540
|
var PanelActionDataSourceSchema = import_zod3.z.object({
|
|
562
541
|
action: import_zod3.z.string().describe("Action ID to call for fetching data"),
|
|
@@ -578,39 +557,16 @@ var PanelDefinitionSchema = import_zod3.z.object({
|
|
|
578
557
|
icon: import_zod3.z.string().optional().describe("Icon name (from huge-icons)"),
|
|
579
558
|
view: PanelViewSchema.describe("Panel view schema")
|
|
580
559
|
}).describe("Panel definition");
|
|
581
|
-
var
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
label: import_zod3.z.string().describe("Display label")
|
|
585
|
-
}).describe("Select option");
|
|
586
|
-
var ProviderConfigValidationSchema = import_zod3.z.object({
|
|
587
|
-
pattern: import_zod3.z.string().optional().describe("Regex pattern the value must match"),
|
|
588
|
-
minLength: import_zod3.z.number().optional().describe("Minimum string length"),
|
|
589
|
-
maxLength: import_zod3.z.number().optional().describe("Maximum string length"),
|
|
590
|
-
min: import_zod3.z.number().optional().describe("Minimum number value"),
|
|
591
|
-
max: import_zod3.z.number().optional().describe("Maximum number value")
|
|
592
|
-
}).describe("Validation rules");
|
|
593
|
-
var ProviderConfigPropertySchema = import_zod3.z.object({
|
|
594
|
-
type: ProviderConfigPropertyTypeSchema.describe("Property type"),
|
|
595
|
-
title: import_zod3.z.string().describe("Display label"),
|
|
596
|
-
description: import_zod3.z.string().optional().describe("Help text"),
|
|
597
|
-
default: import_zod3.z.unknown().optional().describe("Default value"),
|
|
598
|
-
required: import_zod3.z.boolean().optional().describe("Whether the field is required"),
|
|
599
|
-
placeholder: import_zod3.z.string().optional().describe("Placeholder text"),
|
|
600
|
-
options: import_zod3.z.array(ProviderConfigSelectOptionSchema).optional().describe("For select type"),
|
|
601
|
-
validation: ProviderConfigValidationSchema.optional().describe("Validation rules")
|
|
602
|
-
}).describe("Provider config property");
|
|
603
|
-
var ProviderConfigSchemaSchema = import_zod3.z.object({
|
|
604
|
-
properties: import_zod3.z.record(ProviderConfigPropertySchema).describe("Property definitions"),
|
|
605
|
-
order: import_zod3.z.array(import_zod3.z.string()).optional().describe("Display order of properties")
|
|
606
|
-
}).describe("Provider configuration schema");
|
|
560
|
+
var ProviderConfigViewSchema = import_zod3.z.object({
|
|
561
|
+
content: ExtensionComponentDataSchema.describe("Root component to render")
|
|
562
|
+
}).describe("Provider configuration view (component tree)");
|
|
607
563
|
var ProviderDefinitionSchema = import_zod3.z.object({
|
|
608
564
|
id: import_zod3.z.string().describe("Provider ID"),
|
|
609
565
|
name: import_zod3.z.string().describe("Display name"),
|
|
610
566
|
description: import_zod3.z.string().optional().describe("Description"),
|
|
611
567
|
suggestedDefaultModel: import_zod3.z.string().optional().describe("Suggested default model"),
|
|
612
568
|
defaultSettings: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Default settings"),
|
|
613
|
-
|
|
569
|
+
configView: ProviderConfigViewSchema.optional().describe("Component-tree configuration view")
|
|
614
570
|
}).describe("Provider definition");
|
|
615
571
|
var ToolDefinitionSchema = import_zod3.z.object({
|
|
616
572
|
id: import_zod3.z.string().describe("Tool ID"),
|
|
@@ -641,7 +597,6 @@ var StorageContributionsSchema = import_zod3.z.object({
|
|
|
641
597
|
collections: import_zod3.z.record(StorageCollectionConfigSchema).describe("Collection definitions")
|
|
642
598
|
}).describe("Storage contributions");
|
|
643
599
|
var ExtensionContributionsSchema = import_zod3.z.object({
|
|
644
|
-
settings: import_zod3.z.array(SettingDefinitionSchema).optional().describe("User-configurable settings"),
|
|
645
600
|
toolSettings: import_zod3.z.array(ToolSettingsViewDefinitionSchema).optional().describe("Tool settings views"),
|
|
646
601
|
panels: import_zod3.z.array(PanelDefinitionSchema).optional().describe("Right panel contributions"),
|
|
647
602
|
providers: import_zod3.z.array(ProviderDefinitionSchema).optional().describe("AI providers"),
|
|
@@ -726,17 +681,9 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
726
681
|
PlatformSchema,
|
|
727
682
|
PromptContributionSchema,
|
|
728
683
|
PromptSectionSchema,
|
|
729
|
-
|
|
730
|
-
ProviderConfigPropertyTypeSchema,
|
|
731
|
-
ProviderConfigSchemaSchema,
|
|
732
|
-
ProviderConfigSelectOptionSchema,
|
|
733
|
-
ProviderConfigValidationSchema,
|
|
684
|
+
ProviderConfigViewSchema,
|
|
734
685
|
ProviderDefinitionSchema,
|
|
735
686
|
SelectPropsSchema,
|
|
736
|
-
SettingCreateMappingSchema,
|
|
737
|
-
SettingDefinitionSchema,
|
|
738
|
-
SettingOptionsMappingSchema,
|
|
739
|
-
SettingValidationSchema,
|
|
740
687
|
StoragePermissionSchema,
|
|
741
688
|
SystemPermissionSchema,
|
|
742
689
|
TextInputPropsSchema,
|
|
@@ -745,6 +692,7 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
745
692
|
ToolDefinitionSchema,
|
|
746
693
|
ToolSettingsActionDataSourceSchema,
|
|
747
694
|
ToolSettingsComponentViewSchema,
|
|
695
|
+
ToolSettingsListGroupBySchema,
|
|
748
696
|
ToolSettingsListMappingSchema,
|
|
749
697
|
ToolSettingsListViewSchema,
|
|
750
698
|
ToolSettingsViewDefinitionSchema,
|