@stina/extension-api 0.32.0 → 0.33.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/schemas/index.cjs +48 -110
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2587 -3083
- package/dist/schemas/index.d.ts +2587 -3083
- package/dist/schemas/index.js +47 -101
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-XIdePk7Z.d.cts → types.tools-CLp-Zw8L.d.cts} +67 -141
- package/dist/{types.tools-XIdePk7Z.d.ts → types.tools-CLp-Zw8L.d.ts} +67 -141
- package/package.json +1 -1
- package/schema/extension-manifest.schema.json +118 -341
- package/src/index.ts +4 -10
- package/src/schemas/components.schema.ts +52 -6
- package/src/schemas/contributions.schema.ts +12 -178
- package/src/schemas/index.ts +2 -18
- package/src/types.components.ts +46 -6
- package/src/types.contributions.ts +23 -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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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-CLp-Zw8L.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,
|
|
@@ -296,6 +288,9 @@ var ParagraphPropsSchema = import_zod2.z.object({
|
|
|
296
288
|
var ButtonPropsSchema = import_zod2.z.object({
|
|
297
289
|
component: import_zod2.z.literal("Button"),
|
|
298
290
|
text: import_zod2.z.string().describe("Button text"),
|
|
291
|
+
type: import_zod2.z.enum(["normal", "primary", "danger", "accent"]).optional().describe("Visual style"),
|
|
292
|
+
title: import_zod2.z.string().optional().describe("Tooltip shown on hover"),
|
|
293
|
+
disabled: import_zod2.z.boolean().optional().describe("Disable the button"),
|
|
299
294
|
onClickAction: ExtensionActionRefSchema.describe("Action to call on click"),
|
|
300
295
|
style: ExtensionComponentStyleSchema.optional()
|
|
301
296
|
}).passthrough().describe("Button component");
|
|
@@ -304,14 +299,42 @@ var TextInputPropsSchema = import_zod2.z.object({
|
|
|
304
299
|
label: import_zod2.z.string().describe("Input label"),
|
|
305
300
|
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
306
301
|
value: import_zod2.z.string().optional().describe("Current value"),
|
|
307
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
302
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
308
303
|
style: ExtensionComponentStyleSchema.optional()
|
|
309
304
|
}).passthrough().describe("TextInput component");
|
|
305
|
+
var PasswordInputPropsSchema = import_zod2.z.object({
|
|
306
|
+
component: import_zod2.z.literal("PasswordInput"),
|
|
307
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
308
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
309
|
+
value: import_zod2.z.string().optional().describe("Current value"),
|
|
310
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
311
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
312
|
+
}).passthrough().describe("Password input component (text is masked)");
|
|
313
|
+
var NumberInputPropsSchema = import_zod2.z.object({
|
|
314
|
+
component: import_zod2.z.literal("NumberInput"),
|
|
315
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
316
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
317
|
+
value: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]).optional().describe("Current value"),
|
|
318
|
+
min: import_zod2.z.number().optional().describe("Minimum value"),
|
|
319
|
+
max: import_zod2.z.number().optional().describe("Maximum value"),
|
|
320
|
+
step: import_zod2.z.number().optional().describe("Step"),
|
|
321
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
322
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
323
|
+
}).passthrough().describe("Numeric input component");
|
|
324
|
+
var TextAreaPropsSchema = import_zod2.z.object({
|
|
325
|
+
component: import_zod2.z.literal("TextArea"),
|
|
326
|
+
label: import_zod2.z.string().describe("Input label"),
|
|
327
|
+
placeholder: import_zod2.z.string().optional().describe("Placeholder text"),
|
|
328
|
+
value: import_zod2.z.string().optional().describe("Current value"),
|
|
329
|
+
rows: import_zod2.z.number().int().positive().optional().describe("Number of visible text rows"),
|
|
330
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
331
|
+
style: ExtensionComponentStyleSchema.optional()
|
|
332
|
+
}).passthrough().describe("TextArea component for multi-line text input");
|
|
310
333
|
var DateTimeInputPropsSchema = import_zod2.z.object({
|
|
311
334
|
component: import_zod2.z.literal("DateTimeInput"),
|
|
312
335
|
label: import_zod2.z.string().describe("Input label"),
|
|
313
336
|
value: import_zod2.z.string().optional().describe("Current value"),
|
|
314
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
337
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
315
338
|
style: ExtensionComponentStyleSchema.optional()
|
|
316
339
|
}).passthrough().describe("DateTimeInput component");
|
|
317
340
|
var SelectPropsSchema = import_zod2.z.object({
|
|
@@ -319,14 +342,14 @@ var SelectPropsSchema = import_zod2.z.object({
|
|
|
319
342
|
label: import_zod2.z.string().describe("Select label"),
|
|
320
343
|
options: import_zod2.z.array(import_zod2.z.object({ label: import_zod2.z.string(), value: import_zod2.z.string() })).describe("Available options"),
|
|
321
344
|
selectedValue: import_zod2.z.string().optional().describe("Currently selected value"),
|
|
322
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
345
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
323
346
|
style: ExtensionComponentStyleSchema.optional()
|
|
324
347
|
}).passthrough().describe("Select component");
|
|
325
348
|
var IconPickerPropsSchema = import_zod2.z.object({
|
|
326
349
|
component: import_zod2.z.literal("IconPicker"),
|
|
327
350
|
label: import_zod2.z.string().optional().describe("Picker label"),
|
|
328
351
|
value: import_zod2.z.string().optional().describe("Currently selected icon name"),
|
|
329
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
352
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
330
353
|
style: ExtensionComponentStyleSchema.optional()
|
|
331
354
|
}).passthrough().describe("IconPicker component");
|
|
332
355
|
var VerticalStackPropsSchema = import_zod2.z.object({
|
|
@@ -390,7 +413,7 @@ var TogglePropsSchema = import_zod2.z.object({
|
|
|
390
413
|
description: import_zod2.z.string().optional().describe("Description text"),
|
|
391
414
|
checked: import_zod2.z.boolean().optional().describe("Whether the toggle is checked"),
|
|
392
415
|
disabled: import_zod2.z.boolean().optional().describe("Whether the toggle is disabled"),
|
|
393
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
416
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
394
417
|
style: ExtensionComponentStyleSchema.optional()
|
|
395
418
|
}).passthrough().describe("Toggle component");
|
|
396
419
|
var CollapsiblePropsSchema = import_zod2.z.object({
|
|
@@ -416,7 +439,7 @@ var CheckboxPropsSchema = import_zod2.z.object({
|
|
|
416
439
|
checked: import_zod2.z.boolean().optional().describe("Whether the checkbox is checked"),
|
|
417
440
|
disabled: import_zod2.z.boolean().optional().describe("Whether the checkbox is disabled"),
|
|
418
441
|
strikethrough: import_zod2.z.boolean().optional().describe("Strike through label when checked"),
|
|
419
|
-
onChangeAction: ExtensionActionRefSchema.describe("Action to call on change"),
|
|
442
|
+
onChangeAction: ExtensionActionRefSchema.optional().describe("Action to call on change"),
|
|
420
443
|
style: ExtensionComponentStyleSchema.optional()
|
|
421
444
|
}).passthrough().describe("Checkbox component");
|
|
422
445
|
var MarkdownPropsSchema = import_zod2.z.object({
|
|
@@ -465,61 +488,6 @@ var ListPropsSchema = import_zod2.z.object({
|
|
|
465
488
|
|
|
466
489
|
// src/schemas/contributions.schema.ts
|
|
467
490
|
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
491
|
var ToolSettingsListMappingSchema = import_zod3.z.object({
|
|
524
492
|
itemsKey: import_zod3.z.string().describe("Key for items array in tool result data"),
|
|
525
493
|
countKey: import_zod3.z.string().optional().describe("Key for total count"),
|
|
@@ -543,7 +511,10 @@ var ToolSettingsListViewSchema = import_zod3.z.object({
|
|
|
543
511
|
searchParam: import_zod3.z.string().optional().describe("Param name for search query"),
|
|
544
512
|
limitParam: import_zod3.z.string().optional().describe("Param name for limit"),
|
|
545
513
|
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")
|
|
514
|
+
listParams: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Static params for list tool"),
|
|
515
|
+
editView: import_zod3.z.object({
|
|
516
|
+
content: ExtensionComponentDataSchema.describe("Root component for the create/edit modal")
|
|
517
|
+
}).optional().describe("Component-tree create/edit form bound to $item.<key>")
|
|
547
518
|
}).describe("List view backed by tools");
|
|
548
519
|
var ToolSettingsComponentViewSchema = import_zod3.z.object({
|
|
549
520
|
kind: import_zod3.z.literal("component").describe("View kind"),
|
|
@@ -555,8 +526,7 @@ var ToolSettingsViewDefinitionSchema = import_zod3.z.object({
|
|
|
555
526
|
id: import_zod3.z.string().describe("Unique view ID within the extension"),
|
|
556
527
|
title: import_zod3.z.string().describe("Display title"),
|
|
557
528
|
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")
|
|
529
|
+
view: ToolSettingsViewSchema.describe("View configuration")
|
|
560
530
|
}).describe("Tool settings view definition");
|
|
561
531
|
var PanelActionDataSourceSchema = import_zod3.z.object({
|
|
562
532
|
action: import_zod3.z.string().describe("Action ID to call for fetching data"),
|
|
@@ -578,39 +548,16 @@ var PanelDefinitionSchema = import_zod3.z.object({
|
|
|
578
548
|
icon: import_zod3.z.string().optional().describe("Icon name (from huge-icons)"),
|
|
579
549
|
view: PanelViewSchema.describe("Panel view schema")
|
|
580
550
|
}).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");
|
|
551
|
+
var ProviderConfigViewSchema = import_zod3.z.object({
|
|
552
|
+
content: ExtensionComponentDataSchema.describe("Root component to render")
|
|
553
|
+
}).describe("Provider configuration view (component tree)");
|
|
607
554
|
var ProviderDefinitionSchema = import_zod3.z.object({
|
|
608
555
|
id: import_zod3.z.string().describe("Provider ID"),
|
|
609
556
|
name: import_zod3.z.string().describe("Display name"),
|
|
610
557
|
description: import_zod3.z.string().optional().describe("Description"),
|
|
611
558
|
suggestedDefaultModel: import_zod3.z.string().optional().describe("Suggested default model"),
|
|
612
559
|
defaultSettings: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Default settings"),
|
|
613
|
-
|
|
560
|
+
configView: ProviderConfigViewSchema.optional().describe("Component-tree configuration view")
|
|
614
561
|
}).describe("Provider definition");
|
|
615
562
|
var ToolDefinitionSchema = import_zod3.z.object({
|
|
616
563
|
id: import_zod3.z.string().describe("Tool ID"),
|
|
@@ -641,7 +588,6 @@ var StorageContributionsSchema = import_zod3.z.object({
|
|
|
641
588
|
collections: import_zod3.z.record(StorageCollectionConfigSchema).describe("Collection definitions")
|
|
642
589
|
}).describe("Storage contributions");
|
|
643
590
|
var ExtensionContributionsSchema = import_zod3.z.object({
|
|
644
|
-
settings: import_zod3.z.array(SettingDefinitionSchema).optional().describe("User-configurable settings"),
|
|
645
591
|
toolSettings: import_zod3.z.array(ToolSettingsViewDefinitionSchema).optional().describe("Tool settings views"),
|
|
646
592
|
panels: import_zod3.z.array(PanelDefinitionSchema).optional().describe("Right panel contributions"),
|
|
647
593
|
providers: import_zod3.z.array(ProviderDefinitionSchema).optional().describe("AI providers"),
|
|
@@ -726,17 +672,9 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
726
672
|
PlatformSchema,
|
|
727
673
|
PromptContributionSchema,
|
|
728
674
|
PromptSectionSchema,
|
|
729
|
-
|
|
730
|
-
ProviderConfigPropertyTypeSchema,
|
|
731
|
-
ProviderConfigSchemaSchema,
|
|
732
|
-
ProviderConfigSelectOptionSchema,
|
|
733
|
-
ProviderConfigValidationSchema,
|
|
675
|
+
ProviderConfigViewSchema,
|
|
734
676
|
ProviderDefinitionSchema,
|
|
735
677
|
SelectPropsSchema,
|
|
736
|
-
SettingCreateMappingSchema,
|
|
737
|
-
SettingDefinitionSchema,
|
|
738
|
-
SettingOptionsMappingSchema,
|
|
739
|
-
SettingValidationSchema,
|
|
740
678
|
StoragePermissionSchema,
|
|
741
679
|
SystemPermissionSchema,
|
|
742
680
|
TextInputPropsSchema,
|