@stina/extension-api 0.57.0 → 1.0.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.
@@ -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 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 ConversationPresentation,\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 ModelCapabilities,\n ChatMessage,\n ChatImage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolCall,\n\n // Duplex voice\n VoiceSessionOptions,\n VoiceSessionDescriptor,\n VoiceTransportRequest,\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 // Purpose-built display components\n WeatherCondition,\n WeatherWind,\n WeatherNowProps,\n WeatherForecastStep,\n WeatherForecastProps,\n ChartKind,\n ChartSeries,\n ChartProps,\n StatTrend,\n StatTileProps,\n KeyValueRow,\n KeyValueListProps,\n TimelineVariant,\n TimelineEntry,\n TimelineProps,\n NoteVariant,\n NoteProps,\n CalendarEventStatus,\n CalendarEventProps,\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 VoiceSessionOptions,\n VoiceSessionDescriptor,\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 | ProviderVoiceSessionRequestMessage\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 ProviderVoiceSessionRequestMessage {\n type: 'provider-voice-session-request'\n id: string\n payload: {\n providerId: string\n /**\n * `signal` is dropped on the way across: an AbortSignal cannot be\n * structured-cloned into a worker. Cancellation is handled by the host\n * rejecting the pending request instead.\n */\n options: Omit<VoiceSessionOptions, 'signal'>\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 | ProviderVoiceSessionResponseMessage\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 ProviderVoiceSessionResponseMessage {\n type: 'provider-voice-session-response'\n payload: {\n requestId: string\n /** Absent when `error` is set. */\n descriptor?: VoiceSessionDescriptor\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' | 'completed' | '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;;;AC6WO,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 StatusCardDefinition,\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 ConversationPresentation,\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 ModelCapabilities,\n ChatMessage,\n ChatImage,\n ChatOptions,\n GetModelsOptions,\n StreamEvent,\n ToolCall,\n\n // Duplex voice\n VoiceSessionOptions,\n VoiceSessionDescriptor,\n VoiceTransportRequest,\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 // Purpose-built display components\n WeatherCondition,\n WeatherWind,\n WeatherNowProps,\n WeatherForecastStep,\n WeatherForecastProps,\n ChartKind,\n ChartSeries,\n ChartProps,\n StatTrend,\n StatTileProps,\n ProgressShape,\n ProgressColor,\n ProgressBarProps,\n KeyValueRow,\n KeyValueListProps,\n TimelineVariant,\n TimelineEntry,\n TimelineProps,\n NoteVariant,\n NoteProps,\n CalendarEventStatus,\n CalendarEventProps,\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 VoiceSessionOptions,\n VoiceSessionDescriptor,\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 | ProviderVoiceSessionRequestMessage\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 ProviderVoiceSessionRequestMessage {\n type: 'provider-voice-session-request'\n id: string\n payload: {\n providerId: string\n /**\n * `signal` is dropped on the way across: an AbortSignal cannot be\n * structured-cloned into a worker. Cancellation is handled by the host\n * rejecting the pending request instead.\n */\n options: Omit<VoiceSessionOptions, 'signal'>\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 | ProviderVoiceSessionResponseMessage\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 ProviderVoiceSessionResponseMessage {\n type: 'provider-voice-session-response'\n payload: {\n requestId: string\n /** Absent when `error` is set. */\n descriptor?: VoiceSessionDescriptor\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' | 'completed' | '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;;;AC6WO,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 { H as HugeIconName, E as ExtensionContributions, S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, V as VoiceSessionOptions, b as StreamEvent, M as ModelInfo, c as VoiceSessionDescriptor, T as ToolResult, A as ActionResult } from './types.tools-BL9WPsi_.cjs';
2
- export { a7 as AIProvider, ad as Action, z as ActionsAPI, af as AllowedCSSProperty, a0 as BackgroundRestartPolicy, Z as BackgroundTaskCallback, Y as BackgroundTaskConfig, _ as BackgroundTaskContext, $ as BackgroundTaskHealth, X as BackgroundWorkersAPI, ar as ButtonProps, ba as CalendarEventProps, b9 as CalendarEventStatus, aZ as ChartKind, a$ as ChartProps, a_ as ChartSeries, O as ChatAPI, a9 as ChatImage, Q as ChatInstructionMessage, aP as CheckboxProps, aJ as CollapsibleProps, u as CommandDefinition, aT as ConditionalGroupProps, R as ConversationPresentation, aw as DateTimeInputProps, D as Disposable, aC as DividerProps, B as EventsAPI, ak as ExtensionActionCall, al as ExtensionActionRef, aj as ExtensionComponentChildren, ah as ExtensionComponentData, ai as ExtensionComponentIterator, ag as ExtensionComponentStyle, v as ExtensionContext, am as ExtensionDataSource, ae as ExtensionModule, an as ExtensionPanelDefinition, aL as FrameProps, aK as FrameVariant, aB as GridProps, ao as HeaderProps, aA as HorizontalStackProps, aF as IconButtonProps, aE as IconButtonType, ay as IconPickerProps, aD as IconProps, b3 as KeyValueListProps, b2 as KeyValueRow, ap as LabelProps, aM as ListProps, L as LocalizedString, W as LogAPI, aQ as MarkdownProps, aS as ModalProps, a8 as ModelCapabilities, N as NetworkAPI, b8 as NoteProps, b7 as NoteVariant, au as NumberInputProps, aG as PanelAction, l as PanelActionDataSource, k as PanelComponentView, P as PanelDefinition, aH as PanelProps, m as PanelUnknownView, j as PanelView, aq as ParagraphProps, at as PasswordInputProps, aO as PillProps, aN as PillVariant, p as PromptContribution, q as PromptSection, o as ProviderConfigView, n as ProviderDefinition, x as ProvidersAPI, a1 as Query, a2 as QueryOptions, F as SchedulerAPI, I as SchedulerJobRequest, J as SchedulerSchedule, a4 as SecretsAPI, ax as SelectProps, w as SettingsAPI, b1 as StatTileProps, b0 as StatTrend, a3 as StorageAPI, a5 as StorageCollectionConfig, a6 as StorageContributions, av as TextAreaProps, as as TextInputProps, aR as TextPreviewProps, b5 as TimelineEntry, b6 as TimelineProps, b4 as TimelineVariant, aI as ToggleProps, ac as Tool, aa as ToolCall, t as ToolConfirmationConfig, s as ToolDefinition, i as ToolSettingsActionDataSource, h as ToolSettingsComponentView, g as ToolSettingsListMapping, f as ToolSettingsListView, e as ToolSettingsView, d as ToolSettingsViewDefinition, y as ToolsAPI, U as UserAPI, K as UserProfile, az as VerticalStackProps, ab as VoiceTransportRequest, aU as WeatherCondition, aY as WeatherForecastProps, aX as WeatherForecastStep, aW as WeatherNowProps, aV as WeatherWind, r as resolveLocalizedString } from './types.tools-BL9WPsi_.cjs';
1
+ import { H as HugeIconName, E as ExtensionContributions, S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, V as VoiceSessionOptions, b as StreamEvent, M as ModelInfo, c as VoiceSessionDescriptor, T as ToolResult, A as ActionResult } from './types.tools-CQrbET-n.cjs';
2
+ export { a8 as AIProvider, ae as Action, B as ActionsAPI, ag as AllowedCSSProperty, a1 as BackgroundRestartPolicy, _ as BackgroundTaskCallback, Z as BackgroundTaskConfig, $ as BackgroundTaskContext, a0 as BackgroundTaskHealth, Y as BackgroundWorkersAPI, as as ButtonProps, be as CalendarEventProps, bd as CalendarEventStatus, a_ as ChartKind, b0 as ChartProps, a$ as ChartSeries, Q as ChatAPI, aa as ChatImage, R as ChatInstructionMessage, aQ as CheckboxProps, aK as CollapsibleProps, v as CommandDefinition, aU as ConditionalGroupProps, W as ConversationPresentation, ax as DateTimeInputProps, D as Disposable, aD as DividerProps, F as EventsAPI, al as ExtensionActionCall, am as ExtensionActionRef, ak as ExtensionComponentChildren, ai as ExtensionComponentData, aj as ExtensionComponentIterator, ah as ExtensionComponentStyle, w as ExtensionContext, an as ExtensionDataSource, af as ExtensionModule, ao as ExtensionPanelDefinition, aM as FrameProps, aL as FrameVariant, aC as GridProps, ap as HeaderProps, aB as HorizontalStackProps, aG as IconButtonProps, aF as IconButtonType, az as IconPickerProps, aE as IconProps, b7 as KeyValueListProps, b6 as KeyValueRow, aq as LabelProps, aN as ListProps, L as LocalizedString, X as LogAPI, aR as MarkdownProps, aT as ModalProps, a9 as ModelCapabilities, N as NetworkAPI, bc as NoteProps, bb as NoteVariant, av as NumberInputProps, aH as PanelAction, m as PanelActionDataSource, l as PanelComponentView, P as PanelDefinition, aI as PanelProps, n as PanelUnknownView, k as PanelView, ar as ParagraphProps, au as PasswordInputProps, aP as PillProps, aO as PillVariant, b5 as ProgressBarProps, b4 as ProgressColor, b3 as ProgressShape, q as PromptContribution, s as PromptSection, p as ProviderConfigView, o as ProviderDefinition, y as ProvidersAPI, a2 as Query, a3 as QueryOptions, I as SchedulerAPI, J as SchedulerJobRequest, K as SchedulerSchedule, a5 as SecretsAPI, ay as SelectProps, x as SettingsAPI, b2 as StatTileProps, b1 as StatTrend, j as StatusCardDefinition, a4 as StorageAPI, a6 as StorageCollectionConfig, a7 as StorageContributions, aw as TextAreaProps, at as TextInputProps, aS as TextPreviewProps, b9 as TimelineEntry, ba as TimelineProps, b8 as TimelineVariant, aJ as ToggleProps, ad as Tool, ab as ToolCall, u as ToolConfirmationConfig, t as ToolDefinition, i as ToolSettingsActionDataSource, h as ToolSettingsComponentView, g as ToolSettingsListMapping, f as ToolSettingsListView, e as ToolSettingsView, d as ToolSettingsViewDefinition, z as ToolsAPI, U as UserAPI, O as UserProfile, aA as VerticalStackProps, ac as VoiceTransportRequest, aV as WeatherCondition, aZ as WeatherForecastProps, aY as WeatherForecastStep, aX as WeatherNowProps, aW as WeatherWind, r as resolveLocalizedString } from './types.tools-CQrbET-n.cjs';
3
3
 
4
4
  /**
5
5
  * Permission Types
@@ -14,7 +14,7 @@ type StoragePermission = 'storage.collections' | 'secrets.manage';
14
14
  /** User data permissions */
15
15
  type UserDataPermission = 'user.profile.read' | 'user.list' | 'user.location.read' | 'chat.history.read' | 'chat.current.read';
16
16
  /** Capability permissions */
17
- type CapabilityPermission = 'provider.register' | 'tools.register' | 'tools.list' | 'tools.execute' | 'actions.register' | 'settings.register' | 'commands.register' | 'panels.register' | 'events.emit' | 'scheduler.register' | 'chat.message.write' | 'background.workers';
17
+ type CapabilityPermission = 'provider.register' | 'tools.register' | 'tools.list' | 'tools.execute' | 'actions.register' | 'settings.register' | 'commands.register' | 'panels.register' | 'statusCards.register' | 'events.emit' | 'scheduler.register' | 'chat.message.write' | 'background.workers';
18
18
  /** System permissions */
19
19
  type SystemPermission = 'files.read' | 'files.write' | 'clipboard.read' | 'clipboard.write';
20
20
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HugeIconName, E as ExtensionContributions, S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, V as VoiceSessionOptions, b as StreamEvent, M as ModelInfo, c as VoiceSessionDescriptor, T as ToolResult, A as ActionResult } from './types.tools-BL9WPsi_.js';
2
- export { a7 as AIProvider, ad as Action, z as ActionsAPI, af as AllowedCSSProperty, a0 as BackgroundRestartPolicy, Z as BackgroundTaskCallback, Y as BackgroundTaskConfig, _ as BackgroundTaskContext, $ as BackgroundTaskHealth, X as BackgroundWorkersAPI, ar as ButtonProps, ba as CalendarEventProps, b9 as CalendarEventStatus, aZ as ChartKind, a$ as ChartProps, a_ as ChartSeries, O as ChatAPI, a9 as ChatImage, Q as ChatInstructionMessage, aP as CheckboxProps, aJ as CollapsibleProps, u as CommandDefinition, aT as ConditionalGroupProps, R as ConversationPresentation, aw as DateTimeInputProps, D as Disposable, aC as DividerProps, B as EventsAPI, ak as ExtensionActionCall, al as ExtensionActionRef, aj as ExtensionComponentChildren, ah as ExtensionComponentData, ai as ExtensionComponentIterator, ag as ExtensionComponentStyle, v as ExtensionContext, am as ExtensionDataSource, ae as ExtensionModule, an as ExtensionPanelDefinition, aL as FrameProps, aK as FrameVariant, aB as GridProps, ao as HeaderProps, aA as HorizontalStackProps, aF as IconButtonProps, aE as IconButtonType, ay as IconPickerProps, aD as IconProps, b3 as KeyValueListProps, b2 as KeyValueRow, ap as LabelProps, aM as ListProps, L as LocalizedString, W as LogAPI, aQ as MarkdownProps, aS as ModalProps, a8 as ModelCapabilities, N as NetworkAPI, b8 as NoteProps, b7 as NoteVariant, au as NumberInputProps, aG as PanelAction, l as PanelActionDataSource, k as PanelComponentView, P as PanelDefinition, aH as PanelProps, m as PanelUnknownView, j as PanelView, aq as ParagraphProps, at as PasswordInputProps, aO as PillProps, aN as PillVariant, p as PromptContribution, q as PromptSection, o as ProviderConfigView, n as ProviderDefinition, x as ProvidersAPI, a1 as Query, a2 as QueryOptions, F as SchedulerAPI, I as SchedulerJobRequest, J as SchedulerSchedule, a4 as SecretsAPI, ax as SelectProps, w as SettingsAPI, b1 as StatTileProps, b0 as StatTrend, a3 as StorageAPI, a5 as StorageCollectionConfig, a6 as StorageContributions, av as TextAreaProps, as as TextInputProps, aR as TextPreviewProps, b5 as TimelineEntry, b6 as TimelineProps, b4 as TimelineVariant, aI as ToggleProps, ac as Tool, aa as ToolCall, t as ToolConfirmationConfig, s as ToolDefinition, i as ToolSettingsActionDataSource, h as ToolSettingsComponentView, g as ToolSettingsListMapping, f as ToolSettingsListView, e as ToolSettingsView, d as ToolSettingsViewDefinition, y as ToolsAPI, U as UserAPI, K as UserProfile, az as VerticalStackProps, ab as VoiceTransportRequest, aU as WeatherCondition, aY as WeatherForecastProps, aX as WeatherForecastStep, aW as WeatherNowProps, aV as WeatherWind, r as resolveLocalizedString } from './types.tools-BL9WPsi_.js';
1
+ import { H as HugeIconName, E as ExtensionContributions, S as SchedulerFirePayload, C as ChatMessage, a as ChatOptions, G as GetModelsOptions, V as VoiceSessionOptions, b as StreamEvent, M as ModelInfo, c as VoiceSessionDescriptor, T as ToolResult, A as ActionResult } from './types.tools-CQrbET-n.js';
2
+ export { a8 as AIProvider, ae as Action, B as ActionsAPI, ag as AllowedCSSProperty, a1 as BackgroundRestartPolicy, _ as BackgroundTaskCallback, Z as BackgroundTaskConfig, $ as BackgroundTaskContext, a0 as BackgroundTaskHealth, Y as BackgroundWorkersAPI, as as ButtonProps, be as CalendarEventProps, bd as CalendarEventStatus, a_ as ChartKind, b0 as ChartProps, a$ as ChartSeries, Q as ChatAPI, aa as ChatImage, R as ChatInstructionMessage, aQ as CheckboxProps, aK as CollapsibleProps, v as CommandDefinition, aU as ConditionalGroupProps, W as ConversationPresentation, ax as DateTimeInputProps, D as Disposable, aD as DividerProps, F as EventsAPI, al as ExtensionActionCall, am as ExtensionActionRef, ak as ExtensionComponentChildren, ai as ExtensionComponentData, aj as ExtensionComponentIterator, ah as ExtensionComponentStyle, w as ExtensionContext, an as ExtensionDataSource, af as ExtensionModule, ao as ExtensionPanelDefinition, aM as FrameProps, aL as FrameVariant, aC as GridProps, ap as HeaderProps, aB as HorizontalStackProps, aG as IconButtonProps, aF as IconButtonType, az as IconPickerProps, aE as IconProps, b7 as KeyValueListProps, b6 as KeyValueRow, aq as LabelProps, aN as ListProps, L as LocalizedString, X as LogAPI, aR as MarkdownProps, aT as ModalProps, a9 as ModelCapabilities, N as NetworkAPI, bc as NoteProps, bb as NoteVariant, av as NumberInputProps, aH as PanelAction, m as PanelActionDataSource, l as PanelComponentView, P as PanelDefinition, aI as PanelProps, n as PanelUnknownView, k as PanelView, ar as ParagraphProps, au as PasswordInputProps, aP as PillProps, aO as PillVariant, b5 as ProgressBarProps, b4 as ProgressColor, b3 as ProgressShape, q as PromptContribution, s as PromptSection, p as ProviderConfigView, o as ProviderDefinition, y as ProvidersAPI, a2 as Query, a3 as QueryOptions, I as SchedulerAPI, J as SchedulerJobRequest, K as SchedulerSchedule, a5 as SecretsAPI, ay as SelectProps, x as SettingsAPI, b2 as StatTileProps, b1 as StatTrend, j as StatusCardDefinition, a4 as StorageAPI, a6 as StorageCollectionConfig, a7 as StorageContributions, aw as TextAreaProps, at as TextInputProps, aS as TextPreviewProps, b9 as TimelineEntry, ba as TimelineProps, b8 as TimelineVariant, aJ as ToggleProps, ad as Tool, ab as ToolCall, u as ToolConfirmationConfig, t as ToolDefinition, i as ToolSettingsActionDataSource, h as ToolSettingsComponentView, g as ToolSettingsListMapping, f as ToolSettingsListView, e as ToolSettingsView, d as ToolSettingsViewDefinition, z as ToolsAPI, U as UserAPI, O as UserProfile, aA as VerticalStackProps, ac as VoiceTransportRequest, aV as WeatherCondition, aZ as WeatherForecastProps, aY as WeatherForecastStep, aX as WeatherNowProps, aW as WeatherWind, r as resolveLocalizedString } from './types.tools-CQrbET-n.js';
3
3
 
4
4
  /**
5
5
  * Permission Types
@@ -14,7 +14,7 @@ type StoragePermission = 'storage.collections' | 'secrets.manage';
14
14
  /** User data permissions */
15
15
  type UserDataPermission = 'user.profile.read' | 'user.list' | 'user.location.read' | 'chat.history.read' | 'chat.current.read';
16
16
  /** Capability permissions */
17
- type CapabilityPermission = 'provider.register' | 'tools.register' | 'tools.list' | 'tools.execute' | 'actions.register' | 'settings.register' | 'commands.register' | 'panels.register' | 'events.emit' | 'scheduler.register' | 'chat.message.write' | 'background.workers';
17
+ type CapabilityPermission = 'provider.register' | 'tools.register' | 'tools.list' | 'tools.execute' | 'actions.register' | 'settings.register' | 'commands.register' | 'panels.register' | 'statusCards.register' | 'events.emit' | 'scheduler.register' | 'chat.message.write' | 'background.workers';
18
18
  /** System permissions */
19
19
  type SystemPermission = 'files.read' | 'files.write' | 'clipboard.read' | 'clipboard.write';
20
20
 
@@ -1,5 +1,5 @@
1
- import { ae as ExtensionModule } from './types.tools-BL9WPsi_.cjs';
2
- export { a7 as AIProvider, ad as Action, A as ActionResult, a0 as BackgroundRestartPolicy, Z as BackgroundTaskCallback, Y as BackgroundTaskConfig, _ as BackgroundTaskContext, $ as BackgroundTaskHealth, X as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, bb as ExecutionContext, v as ExtensionContext, G as GetModelsOptions, a8 as ModelCapabilities, M as ModelInfo, a1 as Query, a2 as QueryOptions, a4 as SecretsAPI, a3 as StorageAPI, b as StreamEvent, ac as Tool, aa as ToolCall, s as ToolDefinition, T as ToolResult, c as VoiceSessionDescriptor, V as VoiceSessionOptions, ab as VoiceTransportRequest } from './types.tools-BL9WPsi_.cjs';
1
+ import { af as ExtensionModule } from './types.tools-CQrbET-n.cjs';
2
+ export { a8 as AIProvider, ae as Action, A as ActionResult, a1 as BackgroundRestartPolicy, _ as BackgroundTaskCallback, Z as BackgroundTaskConfig, $ as BackgroundTaskContext, a0 as BackgroundTaskHealth, Y as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, bf as ExecutionContext, w as ExtensionContext, G as GetModelsOptions, a9 as ModelCapabilities, M as ModelInfo, a2 as Query, a3 as QueryOptions, a5 as SecretsAPI, a4 as StorageAPI, b as StreamEvent, ad as Tool, ab as ToolCall, t as ToolDefinition, T as ToolResult, c as VoiceSessionDescriptor, V as VoiceSessionOptions, ac as VoiceTransportRequest } from './types.tools-CQrbET-n.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 { ae as ExtensionModule } from './types.tools-BL9WPsi_.js';
2
- export { a7 as AIProvider, ad as Action, A as ActionResult, a0 as BackgroundRestartPolicy, Z as BackgroundTaskCallback, Y as BackgroundTaskConfig, _ as BackgroundTaskContext, $ as BackgroundTaskHealth, X as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, bb as ExecutionContext, v as ExtensionContext, G as GetModelsOptions, a8 as ModelCapabilities, M as ModelInfo, a1 as Query, a2 as QueryOptions, a4 as SecretsAPI, a3 as StorageAPI, b as StreamEvent, ac as Tool, aa as ToolCall, s as ToolDefinition, T as ToolResult, c as VoiceSessionDescriptor, V as VoiceSessionOptions, ab as VoiceTransportRequest } from './types.tools-BL9WPsi_.js';
1
+ import { af as ExtensionModule } from './types.tools-CQrbET-n.js';
2
+ export { a8 as AIProvider, ae as Action, A as ActionResult, a1 as BackgroundRestartPolicy, _ as BackgroundTaskCallback, Z as BackgroundTaskConfig, $ as BackgroundTaskContext, a0 as BackgroundTaskHealth, Y as BackgroundWorkersAPI, C as ChatMessage, a as ChatOptions, D as Disposable, bf as ExecutionContext, w as ExtensionContext, G as GetModelsOptions, a9 as ModelCapabilities, M as ModelInfo, a2 as Query, a3 as QueryOptions, a5 as SecretsAPI, a4 as StorageAPI, b as StreamEvent, ad as Tool, ab as ToolCall, t as ToolDefinition, T as ToolResult, c as VoiceSessionDescriptor, V as VoiceSessionOptions, ac as VoiceTransportRequest } from './types.tools-CQrbET-n.js';
3
3
 
4
4
  /**
5
5
  * Extension Runtime - Runs inside the worker
@@ -24,6 +24,7 @@ __export(schemas_exports, {
24
24
  AuthorSchema: () => AuthorSchema,
25
25
  ButtonPropsSchema: () => ButtonPropsSchema,
26
26
  CHAT_CARD_COMPONENTS: () => CHAT_CARD_COMPONENTS,
27
+ CHAT_CARD_PROPS: () => CHAT_CARD_PROPS,
27
28
  CalendarEventPropsSchema: () => CalendarEventPropsSchema,
28
29
  CalendarEventStatusSchema: () => CalendarEventStatusSchema,
29
30
  CapabilityPermissionSchema: () => CapabilityPermissionSchema,
@@ -80,6 +81,9 @@ __export(schemas_exports, {
80
81
  PillPropsSchema: () => PillPropsSchema,
81
82
  PillVariantSchema: () => PillVariantSchema,
82
83
  PlatformSchema: () => PlatformSchema,
84
+ ProgressBarPropsSchema: () => ProgressBarPropsSchema,
85
+ ProgressColorSchema: () => ProgressColorSchema,
86
+ ProgressShapeSchema: () => ProgressShapeSchema,
83
87
  PromptContributionSchema: () => PromptContributionSchema,
84
88
  PromptSectionSchema: () => PromptSectionSchema,
85
89
  ProviderConfigViewSchema: () => ProviderConfigViewSchema,
@@ -87,6 +91,7 @@ __export(schemas_exports, {
87
91
  SelectPropsSchema: () => SelectPropsSchema,
88
92
  StatTilePropsSchema: () => StatTilePropsSchema,
89
93
  StatTrendSchema: () => StatTrendSchema,
94
+ StatusCardDefinitionSchema: () => StatusCardDefinitionSchema,
90
95
  StoragePermissionSchema: () => StoragePermissionSchema,
91
96
  SystemPermissionSchema: () => SystemPermissionSchema,
92
97
  TextInputPropsSchema: () => TextInputPropsSchema,
@@ -141,6 +146,7 @@ var VALID_PERMISSIONS = [
141
146
  "settings.register",
142
147
  "commands.register",
143
148
  "panels.register",
149
+ "statusCards.register",
144
150
  "events.emit",
145
151
  "scheduler.register",
146
152
  "background.workers",
@@ -177,6 +183,7 @@ var CapabilityPermissionSchema = import_zod.z.enum([
177
183
  "settings.register",
178
184
  "commands.register",
179
185
  "panels.register",
186
+ "statusCards.register",
180
187
  "events.emit",
181
188
  "scheduler.register",
182
189
  "chat.message.write",
@@ -594,6 +601,22 @@ var StatTilePropsSchema = import_zod2.z.object({
594
601
  trendIsGood: import_zod2.z.boolean().optional().describe("Whether up is the good direction. Defaults to true"),
595
602
  style: ExtensionComponentStyleSchema.optional()
596
603
  }).passthrough().describe("Single-number stat tile component");
604
+ var ProgressShapeSchema = import_zod2.z.enum(["bar", "circle"]).describe("Drawn as a rail or as a ring");
605
+ var ProgressColorSchema = import_zod2.z.enum(["accent", "success", "warning", "danger", "info", "neutral"]).describe("One of the theme colours");
606
+ var ProgressBarPropsSchema = import_zod2.z.object({
607
+ component: import_zod2.z.literal("ProgressBar"),
608
+ label: import_zod2.z.string().describe("What is being measured"),
609
+ value: import_zod2.z.number().describe("Where the reading sits. Clamped to the range"),
610
+ min: import_zod2.z.number().optional().describe("Bottom of the range. Defaults to 0"),
611
+ max: import_zod2.z.number().optional().describe("Top of the range. Defaults to 100"),
612
+ shape: ProgressShapeSchema.optional().describe("Defaults to bar"),
613
+ color: ProgressColorSchema.optional().describe("Defaults to accent"),
614
+ unit: import_zod2.z.string().optional().describe("Written after the value"),
615
+ valueLabel: import_zod2.z.string().optional().describe("The readout in words, replacing value and unit"),
616
+ caption: import_zod2.z.string().optional().describe("One quiet line under the reading"),
617
+ icon: import_zod2.z.string().optional().describe("Icon name"),
618
+ style: ExtensionComponentStyleSchema.optional()
619
+ }).passthrough().describe("Progress component");
597
620
  var KeyValueRowSchema = import_zod2.z.object({
598
621
  label: import_zod2.z.string(),
599
622
  value: import_zod2.z.string(),
@@ -721,6 +744,13 @@ var PanelDefinitionSchema = import_zod3.z.object({
721
744
  icon: import_zod3.z.string().optional().describe("Icon name (from huge-icons)"),
722
745
  view: PanelViewSchema.describe("Panel view schema")
723
746
  }).describe("Panel definition");
747
+ var StatusCardDefinitionSchema = import_zod3.z.object({
748
+ id: import_zod3.z.string().describe("Unique card ID within the extension"),
749
+ title: import_zod3.z.string().describe("What it is called where the user picks it"),
750
+ icon: import_zod3.z.string().optional().describe("Icon name (from huge-icons)"),
751
+ size: import_zod3.z.enum(["line", "block"]).describe("How much room it may take: one row, or up to three"),
752
+ view: PanelComponentViewSchema.describe("What it draws, and where the data comes from")
753
+ }).describe("Status card definition");
724
754
  var ProviderConfigViewSchema = import_zod3.z.object({
725
755
  content: ExtensionComponentDataSchema.describe("Root component to render")
726
756
  }).describe("Provider configuration view (component tree)");
@@ -763,6 +793,7 @@ var StorageContributionsSchema = import_zod3.z.object({
763
793
  var ExtensionContributionsSchema = import_zod3.z.object({
764
794
  toolSettings: import_zod3.z.array(ToolSettingsViewDefinitionSchema).optional().describe("Tool settings views"),
765
795
  panels: import_zod3.z.array(PanelDefinitionSchema).optional().describe("Right panel contributions"),
796
+ statusCards: import_zod3.z.array(StatusCardDefinitionSchema).optional().describe("Cards for the strip above the conversation list"),
766
797
  providers: import_zod3.z.array(ProviderDefinitionSchema).optional().describe("AI providers"),
767
798
  tools: import_zod3.z.array(ToolDefinitionSchema).optional().describe("Tools for Stina to use"),
768
799
  commands: import_zod3.z.array(CommandDefinitionSchema).optional().describe("Slash commands"),
@@ -918,6 +949,20 @@ var StatTileCardSchema = import_zod5.z.object({
918
949
  trendIsGood: import_zod5.z.boolean().optional(),
919
950
  style
920
951
  }).strict();
952
+ var ProgressBarCardSchema = import_zod5.z.object({
953
+ component: import_zod5.z.literal("ProgressBar"),
954
+ label: import_zod5.z.string(),
955
+ value: import_zod5.z.number(),
956
+ min: import_zod5.z.number().optional(),
957
+ max: import_zod5.z.number().optional(),
958
+ shape: ProgressShapeSchema.optional(),
959
+ color: ProgressColorSchema.optional(),
960
+ unit: import_zod5.z.string().optional(),
961
+ valueLabel: import_zod5.z.string().optional(),
962
+ caption: import_zod5.z.string().optional(),
963
+ icon: import_zod5.z.string().optional(),
964
+ style
965
+ }).strict();
921
966
  var KeyValueListCardSchema = import_zod5.z.object({
922
967
  component: import_zod5.z.literal("KeyValueList"),
923
968
  rows: import_zod5.z.array(
@@ -986,6 +1031,7 @@ var CHAT_CARD_COMPONENTS = [
986
1031
  "WeatherForecast",
987
1032
  "Chart",
988
1033
  "StatTile",
1034
+ "ProgressBar",
989
1035
  "KeyValueList",
990
1036
  "Timeline",
991
1037
  "Note",
@@ -1008,11 +1054,21 @@ var CARD_MEMBERS = [
1008
1054
  WeatherForecastCardSchema,
1009
1055
  ChartCardSchema,
1010
1056
  StatTileCardSchema,
1057
+ ProgressBarCardSchema,
1011
1058
  KeyValueListCardSchema,
1012
1059
  TimelineCardSchema,
1013
1060
  NoteCardSchema,
1014
1061
  CalendarEventCardSchema
1015
1062
  ];
1063
+ var CHAT_CARD_PROPS = Object.freeze(
1064
+ Object.fromEntries(
1065
+ CARD_MEMBERS.map((member) => {
1066
+ const shape = member.shape;
1067
+ const name = shape["component"]._def.value;
1068
+ return [name, Object.freeze(Object.keys(shape))];
1069
+ })
1070
+ )
1071
+ );
1016
1072
  var ChatCardComponentSchema = import_zod5.z.lazy(
1017
1073
  () => import_zod5.z.discriminatedUnion(
1018
1074
  "component",
@@ -1124,7 +1180,8 @@ function describeType(schema) {
1124
1180
  return "component[]";
1125
1181
  case "ZodArray": {
1126
1182
  const inner = describeType(def.type);
1127
- return `${inner}[]`;
1183
+ const max = def.maxLength?.value;
1184
+ return typeof max === "number" ? `${inner}[\u2264${max}]` : `${inner}[]`;
1128
1185
  }
1129
1186
  case "ZodObject": {
1130
1187
  const shape = schema.shape;
@@ -1165,6 +1222,7 @@ function describeChatCardProfile() {
1165
1222
  AuthorSchema,
1166
1223
  ButtonPropsSchema,
1167
1224
  CHAT_CARD_COMPONENTS,
1225
+ CHAT_CARD_PROPS,
1168
1226
  CalendarEventPropsSchema,
1169
1227
  CalendarEventStatusSchema,
1170
1228
  CapabilityPermissionSchema,
@@ -1221,6 +1279,9 @@ function describeChatCardProfile() {
1221
1279
  PillPropsSchema,
1222
1280
  PillVariantSchema,
1223
1281
  PlatformSchema,
1282
+ ProgressBarPropsSchema,
1283
+ ProgressColorSchema,
1284
+ ProgressShapeSchema,
1224
1285
  PromptContributionSchema,
1225
1286
  PromptSectionSchema,
1226
1287
  ProviderConfigViewSchema,
@@ -1228,6 +1289,7 @@ function describeChatCardProfile() {
1228
1289
  SelectPropsSchema,
1229
1290
  StatTilePropsSchema,
1230
1291
  StatTrendSchema,
1292
+ StatusCardDefinitionSchema,
1231
1293
  StoragePermissionSchema,
1232
1294
  SystemPermissionSchema,
1233
1295
  TextInputPropsSchema,