@napplet/sdk 0.2.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.
@@ -0,0 +1,562 @@
1
+ import { NappletGlobal, Subscription, NostrEvent, NostrFilter, EventTemplate } from '@napplet/core';
2
+ export { EventTemplate, NUB_DOMAINS, NamespacedCapability, NappletMessage, NostrEvent, NostrFilter, NubDomain, ShellSupports, Subscription } from '@napplet/core';
3
+ export { DOMAIN as RELAY_DOMAIN, RelayCloseMessage, RelayClosedMessage, RelayEoseMessage, RelayEventMessage, RelayInboundMessage, RelayMessage, RelayNubMessage, RelayOutboundMessage, RelayPublishEncryptedMessage, RelayPublishEncryptedResultMessage, RelayPublishMessage, RelayPublishResultMessage, RelayQueryMessage, RelayQueryResultMessage, RelaySubscribeMessage, installRelayShim, relayPublish, relayPublishEncrypted, relayQuery, relaySubscribe } from '@napplet/nub-relay';
4
+ export { Badge, DOMAIN as IDENTITY_DOMAIN, IdentityGetBadgesMessage, IdentityGetBadgesResultMessage, IdentityGetBlockedMessage, IdentityGetBlockedResultMessage, IdentityGetFollowsMessage, IdentityGetFollowsResultMessage, IdentityGetListMessage, IdentityGetListResultMessage, IdentityGetMutesMessage, IdentityGetMutesResultMessage, IdentityGetProfileMessage, IdentityGetProfileResultMessage, IdentityGetPublicKeyMessage, IdentityGetPublicKeyResultMessage, IdentityGetRelaysMessage, IdentityGetRelaysResultMessage, IdentityGetZapsMessage, IdentityGetZapsResultMessage, IdentityMessage, IdentityNubMessage, RelayPermission as IdentityRelayPermission, IdentityRequestMessage, IdentityResultMessage, ProfileData, ZapReceipt, identityGetBadges, identityGetBlocked, identityGetFollows, identityGetList, identityGetMutes, identityGetProfile, identityGetPublicKey, identityGetRelays, identityGetZaps, installIdentityShim } from '@napplet/nub-identity';
5
+ export { DOMAIN as STORAGE_DOMAIN, StorageGetMessage, StorageGetResultMessage, StorageKeysMessage, StorageKeysResultMessage, StorageMessage, StorageNubMessage, StorageRemoveMessage, StorageRemoveResultMessage, StorageRequestMessage, StorageResultMessage, StorageSetMessage, StorageSetResultMessage, installStorageShim, storageGetItem, storageKeys, storageRemoveItem, storageSetItem } from '@napplet/nub-storage';
6
+ export { DOMAIN as IFC_DOMAIN, IfcChannelBroadcastMessage, IfcChannelCloseMessage, IfcChannelClosedMessage, IfcChannelEmitMessage, IfcChannelEventMessage, IfcChannelListMessage, IfcChannelListResultMessage, IfcChannelMessage, IfcChannelOpenMessage, IfcChannelOpenResultMessage, IfcEmitMessage, IfcEventMessage, IfcInboundMessage, IfcMessage, IfcNubMessage, IfcOutboundMessage, IfcSubscribeMessage, IfcSubscribeResultMessage, IfcTopicMessage, IfcUnsubscribeMessage, ifcEmit, ifcOn, installIfcShim } from '@napplet/nub-ifc';
7
+ export { DOMAIN as THEME_DOMAIN, Theme, ThemeBackground, ThemeChangedMessage, ThemeColors, ThemeFont, ThemeGetMessage, ThemeGetResultMessage, ThemeMessage, ThemeNubMessage, ThemeRequestMessage, ThemeResultMessage } from '@napplet/nub-theme';
8
+ export { Action, DOMAIN as KEYS_DOMAIN, KeyBinding, KeysActionMessage, KeysBindingsMessage, KeysForwardMessage, KeysMessage, KeysNubMessage, KeysRegisterActionMessage, KeysRegisterActionResultMessage, KeysRequestMessage, KeysResultMessage, KeysUnregisterActionMessage, RegisterResult, installKeysShim, keysOnAction, keysRegister, keysRegisterAction, keysUnregisterAction } from '@napplet/nub-keys';
9
+ export { DOMAIN as MEDIA_DOMAIN, MediaAction, MediaArtwork, MediaCapabilitiesMessage, MediaCommandMessage, MediaControlsMessage, MediaMessage, MediaMetadata, MediaNubMessage, MediaRequestMessage, MediaResultMessage, MediaSessionCreateMessage, MediaSessionCreateResultMessage, MediaSessionDestroyMessage, MediaSessionUpdateMessage, MediaState, MediaStateMessage, installMediaShim, mediaCreateSession, mediaDestroySession, mediaOnCommand, mediaOnControls, mediaReportCapabilities, mediaReportState, mediaUpdateSession } from '@napplet/nub-media';
10
+ export { DOMAIN as NOTIFY_DOMAIN, NotificationAction, NotificationChannel, NotificationPriority, NotifyActionMessage, NotifyBadgeMessage, NotifyChannelRegisterMessage, NotifyClickedMessage, NotifyControl, NotifyControlsMessage, NotifyDismissMessage, NotifyDismissedMessage, NotifyMessage, NotifyNubMessage, NotifyPermissionRequestMessage, NotifyPermissionResultMessage, NotifyRequestMessage, NotifyResultMessage, NotifySendMessage, NotifySendResultMessage, installNotifyShim, notifyBadge, notifyDismiss, notifyOnAction, notifyOnClicked, notifyOnControls, notifyOnDismissed, notifyRegisterChannel, notifyRequestPermission, notifySend } from '@napplet/nub-notify';
11
+ export { DOMAIN as CONFIG_DOMAIN, ConfigGetMessage, ConfigMessage, ConfigNubMessage, ConfigOpenSettingsMessage, ConfigRegisterSchemaMessage, ConfigRegisterSchemaResultMessage, ConfigRequestMessage, ConfigResultMessage, ConfigSchema, ConfigSchemaErrorCode, ConfigSchemaErrorMessage, ConfigSubscribeMessage, ConfigUnsubscribeMessage, ConfigValues, ConfigValuesMessage, NappletConfigSchema, NappletConfigSchemaExtensions, installConfigShim } from '@napplet/nub-config';
12
+
13
+ /**
14
+ * @napplet/sdk -- Typed named exports wrapping window.napplet.
15
+ *
16
+ * Provides `relay`, `ipc`, `storage`, and `keys` objects that delegate
17
+ * to `window.napplet.*` at call time. Developers using a bundler can import
18
+ * individual namespaces without depending on the shim's side-effect install:
19
+ *
20
+ * ```ts
21
+ * import { relay, ipc } from '@napplet/sdk';
22
+ * ```
23
+ *
24
+ * The shim must still be imported somewhere in the application to install
25
+ * the `window.napplet` global. The SDK only wraps it -- it does not install it.
26
+ *
27
+ * Domain-specific SDK helpers are also available directly from NUB packages:
28
+ * ```ts
29
+ * import { relaySubscribe } from '@napplet/nub-relay';
30
+ * import { storageGetItem } from '@napplet/nub-storage';
31
+ * ```
32
+ *
33
+ * @packageDocumentation
34
+ */
35
+
36
+ declare global {
37
+ interface Window {
38
+ napplet: NappletGlobal;
39
+ }
40
+ }
41
+ /**
42
+ * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.
43
+ *
44
+ * Each method delegates to `window.napplet.relay.*` at call time, which in turn
45
+ * routes through the shell's relay pool via postMessage.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * import { relay } from '@napplet/sdk';
50
+ *
51
+ * const sub = relay.subscribe(
52
+ * { kinds: [1], limit: 10 },
53
+ * (event) => console.log(event),
54
+ * () => console.log('EOSE'),
55
+ * );
56
+ * ```
57
+ */
58
+ declare const relay: {
59
+ /**
60
+ * Open a live NIP-01 subscription through the shell's relay pool.
61
+ * @param filters One or more NIP-01 subscription filters
62
+ * @param onEvent Called for each matching event
63
+ * @param onEose Called when the shell signals end of stored events (EOSE)
64
+ * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions
65
+ * @returns A Subscription handle with a `close()` method
66
+ */
67
+ subscribe(filters: NostrFilter | NostrFilter[], onEvent: (event: NostrEvent) => void, onEose: () => void, options?: {
68
+ relay?: string;
69
+ group?: string;
70
+ }): Subscription;
71
+ /**
72
+ * Sign and publish a Nostr event through the shell.
73
+ * @param template Unsigned event template
74
+ * @param options Optional: `{ relay: true }` to publish via scoped relay
75
+ * @returns The signed NostrEvent after successful publication
76
+ */
77
+ publish(template: EventTemplate, options?: {
78
+ relay?: boolean;
79
+ }): Promise<NostrEvent>;
80
+ /**
81
+ * Publish an encrypted Nostr event through the shell.
82
+ * @param template Unsigned event template
83
+ * @param recipient Hex-encoded recipient public key
84
+ * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'
85
+ * @returns The signed encrypted NostrEvent after successful publication
86
+ */
87
+ publishEncrypted(template: EventTemplate, recipient: string, encryption?: "nip44" | "nip04"): Promise<NostrEvent>;
88
+ /**
89
+ * One-shot query: subscribe, collect events until EOSE, then resolve.
90
+ * @param filters NIP-01 subscription filters
91
+ * @returns Promise resolving to array of matching NostrEvent objects
92
+ */
93
+ query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]>;
94
+ };
95
+ /**
96
+ * Inter-napplet pubsub: broadcast and receive IPC-PEER events through the shell.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * import { ipc } from '@napplet/sdk';
101
+ *
102
+ * ipc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));
103
+ *
104
+ * const sub = ipc.on('profile:open', (payload) => {
105
+ * console.log('Profile requested:', payload);
106
+ * });
107
+ * ```
108
+ */
109
+ declare const ipc: {
110
+ /**
111
+ * Broadcast an IPC-PEER event to other napplets via the shell.
112
+ * @param topic The 't' tag value (e.g., 'profile:open')
113
+ * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])
114
+ * @param content Event content (default: empty string)
115
+ */
116
+ emit(topic: string, extraTags?: string[][], content?: string): void;
117
+ /**
118
+ * Subscribe to IPC-PEER events on a specific topic.
119
+ * @param topic The 't' tag value to listen for
120
+ * @param callback Called with `(payload, event)` for each matching event
121
+ * @returns A Subscription handle with a `close()` method
122
+ */
123
+ on(topic: string, callback: (payload: unknown, event: NostrEvent) => void): Subscription;
124
+ };
125
+ /**
126
+ * Napplet-scoped storage: async localStorage-like API proxied through the shell.
127
+ * Each napplet's storage is isolated by identity.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * import { storage } from '@napplet/sdk';
132
+ *
133
+ * await storage.setItem('theme', 'dark');
134
+ * const theme = await storage.getItem('theme'); // 'dark'
135
+ * ```
136
+ */
137
+ declare const storage: {
138
+ /**
139
+ * Retrieve a stored value by key. Returns null if the key does not exist.
140
+ * @param key The storage key
141
+ * @returns The stored string value, or null if not found
142
+ */
143
+ getItem(key: string): Promise<string | null>;
144
+ /**
145
+ * Store a key-value pair.
146
+ * @param key The storage key
147
+ * @param value The string value to store
148
+ */
149
+ setItem(key: string, value: string): Promise<void>;
150
+ /**
151
+ * Remove a stored key.
152
+ * @param key The storage key to remove
153
+ */
154
+ removeItem(key: string): Promise<void>;
155
+ /**
156
+ * List all keys stored by this napplet.
157
+ * @returns Array of storage key strings
158
+ */
159
+ keys(): Promise<string[]>;
160
+ };
161
+ /**
162
+ * Media session control: create sessions, report state and metadata,
163
+ * declare capabilities, receive commands from the shell.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * import { media } from '@napplet/sdk';
168
+ *
169
+ * const { sessionId } = await media.createSession({
170
+ * title: 'My Song', artist: 'The Artist',
171
+ * });
172
+ *
173
+ * media.reportState(sessionId, { status: 'playing', position: 42.5 });
174
+ * ```
175
+ */
176
+ declare const media: {
177
+ /**
178
+ * Create a new media session with the shell.
179
+ * @param metadata Optional initial metadata
180
+ * @returns The confirmed session result with sessionId
181
+ */
182
+ createSession(metadata?: {
183
+ title?: string;
184
+ artist?: string;
185
+ album?: string;
186
+ artwork?: {
187
+ url?: string;
188
+ hash?: string;
189
+ };
190
+ duration?: number;
191
+ mediaType?: "audio" | "video";
192
+ }): Promise<{
193
+ sessionId: string;
194
+ }>;
195
+ /**
196
+ * Update metadata for an existing session.
197
+ * @param sessionId The session to update
198
+ * @param metadata Partial metadata fields to update
199
+ */
200
+ updateSession(sessionId: string, metadata: {
201
+ title?: string;
202
+ artist?: string;
203
+ album?: string;
204
+ artwork?: {
205
+ url?: string;
206
+ hash?: string;
207
+ };
208
+ duration?: number;
209
+ mediaType?: "audio" | "video";
210
+ }): void;
211
+ /**
212
+ * Destroy a media session.
213
+ * @param sessionId The session to destroy
214
+ */
215
+ destroySession(sessionId: string): void;
216
+ /**
217
+ * Report current playback state for a session.
218
+ * @param sessionId The session to report state for
219
+ * @param state Current playback state
220
+ */
221
+ reportState(sessionId: string, state: {
222
+ status: "playing" | "paused" | "stopped" | "buffering";
223
+ position?: number;
224
+ duration?: number;
225
+ volume?: number;
226
+ }): void;
227
+ /**
228
+ * Declare which media actions the session currently supports.
229
+ * @param sessionId The session to update capabilities for
230
+ * @param actions Currently supported actions
231
+ */
232
+ reportCapabilities(sessionId: string, actions: ("play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume")[]): void;
233
+ /**
234
+ * Listen for media commands from the shell.
235
+ * @param sessionId The session to listen for commands on
236
+ * @param callback Called with (action, value?) when a command is received
237
+ * @returns A Subscription with `close()` to stop listening
238
+ */
239
+ onCommand(sessionId: string, callback: (action: "play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume", value?: number) => void): Subscription;
240
+ /**
241
+ * Listen for the shell's media control list.
242
+ * @param sessionId The session to associate controls with
243
+ * @param callback Called with the shell's supported controls
244
+ * @returns A Subscription with `close()` to stop listening
245
+ */
246
+ onControls(sessionId: string, callback: (controls: ("play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume")[]) => void): Subscription;
247
+ };
248
+ /**
249
+ * Shell-rendered notifications: send notifications, set badge counts,
250
+ * register channels, request permission, listen for user interaction.
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * import { notify } from '@napplet/sdk';
255
+ *
256
+ * const { notificationId } = await notify.send({
257
+ * title: 'New message', body: 'Alice: hey!',
258
+ * });
259
+ *
260
+ * notify.badge(3);
261
+ * ```
262
+ */
263
+ declare const notify: {
264
+ /**
265
+ * Send a notification to the shell.
266
+ * @param notification Notification payload (title required)
267
+ * @returns The shell-assigned notificationId
268
+ */
269
+ send(notification: {
270
+ title: string;
271
+ body?: string;
272
+ icon?: string;
273
+ actions?: {
274
+ id: string;
275
+ label: string;
276
+ }[];
277
+ channel?: string;
278
+ priority?: "low" | "normal" | "high" | "urgent";
279
+ }): Promise<{
280
+ notificationId: string;
281
+ }>;
282
+ /**
283
+ * Dismiss a notification by ID.
284
+ * @param notificationId The notification to dismiss
285
+ */
286
+ dismiss(notificationId: string): void;
287
+ /**
288
+ * Set the badge count for this napplet. Pass 0 to clear.
289
+ * @param count Badge count
290
+ */
291
+ badge(count: number): void;
292
+ /**
293
+ * Register a notification channel.
294
+ * @param channel Channel definition
295
+ */
296
+ registerChannel(channel: {
297
+ channelId: string;
298
+ label: string;
299
+ description?: string;
300
+ defaultPriority?: "low" | "normal" | "high" | "urgent";
301
+ }): void;
302
+ /**
303
+ * Request permission to send notifications.
304
+ * @param channel Optional channel to request permission for
305
+ * @returns Whether permission was granted
306
+ */
307
+ requestPermission(channel?: string): Promise<{
308
+ granted: boolean;
309
+ }>;
310
+ /**
311
+ * Listen for action button clicks on notifications.
312
+ * @param callback Called with (notificationId, actionId)
313
+ * @returns A Subscription with `close()` to stop listening
314
+ */
315
+ onAction(callback: (notificationId: string, actionId: string) => void): Subscription;
316
+ /**
317
+ * Listen for notification body clicks.
318
+ * @param callback Called with (notificationId)
319
+ * @returns A Subscription with `close()` to stop listening
320
+ */
321
+ onClicked(callback: (notificationId: string) => void): Subscription;
322
+ /**
323
+ * Listen for notification dismissals.
324
+ * @param callback Called with (notificationId, reason?)
325
+ * @returns A Subscription with `close()` to stop listening
326
+ */
327
+ onDismissed(callback: (notificationId: string, reason?: string) => void): Subscription;
328
+ /**
329
+ * Listen for the shell's notification capability list.
330
+ * @param callback Called with supported controls
331
+ * @returns A Subscription with `close()` to stop listening
332
+ */
333
+ onControls(callback: (controls: ("toasts" | "badges" | "actions" | "channels" | "system")[]) => void): Subscription;
334
+ };
335
+ /**
336
+ * Keyboard forwarding and action keybindings: register named actions the shell
337
+ * can bind to keys, listen for shell-triggered actions locally.
338
+ *
339
+ * @example
340
+ * ```ts
341
+ * import { keys } from '@napplet/sdk';
342
+ *
343
+ * const result = await keys.registerAction({
344
+ * id: 'editor.save',
345
+ * label: 'Save',
346
+ * defaultKey: 'Ctrl+S',
347
+ * });
348
+ *
349
+ * const sub = keys.onAction('editor.save', () => {
350
+ * console.log('Save triggered!');
351
+ * });
352
+ * ```
353
+ */
354
+ declare const keys: {
355
+ /**
356
+ * Declare a named action that the shell can bind to a key.
357
+ * @param action The action to register (id, label, optional defaultKey)
358
+ * @returns The assigned binding, if any
359
+ */
360
+ registerAction(action: {
361
+ id: string;
362
+ label: string;
363
+ defaultKey?: string;
364
+ }): Promise<{
365
+ actionId: string;
366
+ binding?: string;
367
+ }>;
368
+ /**
369
+ * Remove a previously registered action.
370
+ * @param actionId The action to unregister
371
+ */
372
+ unregisterAction(actionId: string): void;
373
+ /**
374
+ * Register a local handler for when a bound key is pressed.
375
+ * @param actionId The action to listen for
376
+ * @param callback Called when the action is triggered
377
+ * @returns A Subscription with `close()` to stop listening
378
+ */
379
+ onAction(actionId: string, callback: () => void): Subscription;
380
+ /**
381
+ * Convenience: register a named action AND wire a local handler in one call.
382
+ * Returns a handle whose `close()` both unregisters the action and removes
383
+ * the onAction listener.
384
+ *
385
+ * @param action The action to register (id, label, optional defaultKey)
386
+ * @param handler Called when the shell triggers this action
387
+ * @returns The assigned binding plus a `close()` teardown function
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * import { keys } from '@napplet/sdk';
392
+ *
393
+ * const handle = await keys.register(
394
+ * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },
395
+ * () => saveDocument(),
396
+ * );
397
+ *
398
+ * // Later, tear down both registration and listener:
399
+ * handle.close();
400
+ * ```
401
+ */
402
+ register(action: {
403
+ id: string;
404
+ label: string;
405
+ defaultKey?: string;
406
+ }, handler: () => void): Promise<{
407
+ actionId: string;
408
+ binding?: string;
409
+ close: () => void;
410
+ }>;
411
+ };
412
+ /**
413
+ * Read-only user identity queries: public key, profile, follows, relays,
414
+ * lists, zaps, mutes, blocked, badges.
415
+ *
416
+ * @example
417
+ * ```ts
418
+ * import { identity } from '@napplet/sdk';
419
+ *
420
+ * const pubkey = await identity.getPublicKey();
421
+ * const profile = await identity.getProfile();
422
+ * const follows = await identity.getFollows();
423
+ * ```
424
+ */
425
+ declare const identity: {
426
+ /**
427
+ * Get the user's hex-encoded public key. Always succeeds.
428
+ * @returns Hex-encoded public key string
429
+ */
430
+ getPublicKey(): Promise<string>;
431
+ /**
432
+ * Get the user's relay list (NIP-65).
433
+ * @returns Record mapping relay URLs to read/write permissions
434
+ */
435
+ getRelays(): Promise<Record<string, {
436
+ read: boolean;
437
+ write: boolean;
438
+ }>>;
439
+ /**
440
+ * Get the user's profile metadata (kind 0).
441
+ * @returns Profile data, or null if not found
442
+ */
443
+ getProfile(): Promise<{
444
+ name?: string;
445
+ displayName?: string;
446
+ about?: string;
447
+ picture?: string;
448
+ banner?: string;
449
+ nip05?: string;
450
+ lud16?: string;
451
+ website?: string;
452
+ } | null>;
453
+ /**
454
+ * Get the user's follow list (kind 3 contact list).
455
+ * @returns Array of hex-encoded public keys
456
+ */
457
+ getFollows(): Promise<string[]>;
458
+ /**
459
+ * Get entries from a user's categorized list.
460
+ * @param listType List category (e.g., "bookmarks", "interests", "pins")
461
+ * @returns Array of list entry values
462
+ */
463
+ getList(listType: string): Promise<string[]>;
464
+ /**
465
+ * Get zap receipts sent to the user.
466
+ * @returns Array of zap receipt objects
467
+ */
468
+ getZaps(): Promise<{
469
+ eventId: string;
470
+ sender: string;
471
+ amount: number;
472
+ content?: string;
473
+ }[]>;
474
+ /**
475
+ * Get the user's mute list (kind 10000).
476
+ * @returns Array of hex-encoded muted public keys
477
+ */
478
+ getMutes(): Promise<string[]>;
479
+ /**
480
+ * Get the user's block list.
481
+ * @returns Array of hex-encoded blocked public keys
482
+ */
483
+ getBlocked(): Promise<string[]>;
484
+ /**
485
+ * Get badges awarded to the user (NIP-58).
486
+ * @returns Array of badge objects
487
+ */
488
+ getBadges(): Promise<{
489
+ id: string;
490
+ name?: string;
491
+ description?: string;
492
+ image?: string;
493
+ thumbs?: string[];
494
+ awardedBy: string;
495
+ }[]>;
496
+ };
497
+ /**
498
+ * Per-napplet declarative configuration (NUB-CONFIG): register a schema,
499
+ * read current values, subscribe to live updates, deep-link into the
500
+ * shell-owned settings UI, and listen for schema errors.
501
+ *
502
+ * @example
503
+ * ```ts
504
+ * import { config } from '@napplet/sdk';
505
+ *
506
+ * await config.registerSchema({
507
+ * type: 'object',
508
+ * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },
509
+ * });
510
+ *
511
+ * const sub = config.subscribe((values) => { applyTheme(values.theme); });
512
+ *
513
+ * config.openSettings({ section: 'appearance' });
514
+ * ```
515
+ */
516
+ declare const config: {
517
+ /**
518
+ * Snapshot current validated + defaulted config values.
519
+ * @returns A one-shot ConfigValues object.
520
+ */
521
+ get(): Promise<Record<string, unknown>>;
522
+ /**
523
+ * Subscribe to live configuration updates.
524
+ * First delivery is an immediate snapshot; subsequent deliveries fire on change.
525
+ * @param callback Invoked with the full ConfigValues on every change.
526
+ * @returns A Subscription with close() to stop listening.
527
+ */
528
+ subscribe(callback: (values: Record<string, unknown>) => void): Subscription;
529
+ /**
530
+ * Request the shell open its settings UI for this napplet.
531
+ * @param options Optional { section } to deep-link by x-napplet-section name.
532
+ */
533
+ openSettings(options?: {
534
+ section?: string;
535
+ }): void;
536
+ /**
537
+ * Register a napplet configuration schema at runtime (escape hatch;
538
+ * prefer manifest-declared via @napplet/vite-plugin's configSchema option).
539
+ * @param schema JSON Schema (draft-07+) describing the config surface.
540
+ * @param version Optional `$version` migration hint.
541
+ */
542
+ registerSchema(schema: Record<string, unknown>, version?: number): Promise<void>;
543
+ /**
544
+ * Listen for schema-registration errors pushed by the shell
545
+ * (manifest parse failure, no-schema on subscribe-before-schema, etc.).
546
+ * @param callback Invoked with { code, error } on every push.
547
+ * @returns A plain teardown function that detaches the listener.
548
+ */
549
+ onSchemaError(callback: (err: {
550
+ code: string;
551
+ error: string;
552
+ }) => void): () => void;
553
+ /**
554
+ * Current schema snapshot (readonly). Populated from the
555
+ * `<meta name="napplet-config-schema">` manifest tag at shim install,
556
+ * updated on successful registerSchema responses.
557
+ * @returns The registered schema, or null if none.
558
+ */
559
+ readonly schema: Record<string, unknown> | null;
560
+ };
561
+
562
+ export { config, identity, ipc, keys, media, notify, relay, storage };