@napplet/sdk 0.15.0 → 0.17.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/README.md +12 -6
- package/dist/index.d.ts +154 -4
- package/dist/index.js +188 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
### How It Works
|
|
13
13
|
|
|
14
14
|
1. Import `@napplet/shim` in your entry point to install the `window.napplet` global
|
|
15
|
-
2. Import named exports from `@napplet/sdk` -- `relay`, `inc`, `storage`, `keys`
|
|
15
|
+
2. Import named exports from `@napplet/sdk` -- `relay`, `inc`, `storage`, `keys`, `lists`
|
|
16
16
|
3. Each SDK method delegates to its `window.napplet.*` counterpart at call time
|
|
17
17
|
4. If `window.napplet` is not installed when a method is called, a descriptive error is thrown
|
|
18
18
|
|
|
@@ -26,7 +26,7 @@ npm install @napplet/sdk @napplet/shim
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
import '@napplet/shim';
|
|
29
|
-
import { relay, inc, storage, keys, media, notify, config, resource, link, type NostrEvent } from '@napplet/sdk';
|
|
29
|
+
import { relay, inc, storage, keys, media, notify, config, resource, webrtc, link, lists, type NostrEvent } from '@napplet/sdk';
|
|
30
30
|
|
|
31
31
|
// Subscribe to kind 1 notes
|
|
32
32
|
const sub = relay.subscribe(
|
|
@@ -94,8 +94,13 @@ const handle = resource.bytesAsObjectURL('blossom:sha256:e3b0c44298fc1c149afbf4c
|
|
|
94
94
|
imgEl.src = handle.url;
|
|
95
95
|
// handle.revoke() when done
|
|
96
96
|
|
|
97
|
+
// Open a shell-mediated WebRTC data session
|
|
98
|
+
const { session } = await webrtc.open({ scope: { type: 'direct', pubkey: 'abc123...' } });
|
|
99
|
+
await webrtc.send(session.id, { body: 'hello' });
|
|
97
100
|
// Open an external URL through the shell
|
|
98
101
|
await link.open('https://example.com/post/123', { label: 'Read post' });
|
|
102
|
+
// Add an item to a supported NIP-51 list through the runtime
|
|
103
|
+
await lists.add({ type: 'mute-list' }, [{ itemType: 'pubkey', value: 'abc123...' }]);
|
|
99
104
|
|
|
100
105
|
// Clean up
|
|
101
106
|
sub.close();
|
|
@@ -330,10 +335,8 @@ import type {
|
|
|
330
335
|
EventTemplate,
|
|
331
336
|
NappletMessage,
|
|
332
337
|
NapDomain,
|
|
333
|
-
NapDomain,
|
|
334
338
|
NamespacedCapability,
|
|
335
339
|
NapProtocolId,
|
|
336
|
-
NapProtocolId,
|
|
337
340
|
ShellSupports,
|
|
338
341
|
// NAP message types (re-exported from NAP packages)
|
|
339
342
|
RelayNapMessage,
|
|
@@ -341,6 +344,7 @@ import type {
|
|
|
341
344
|
StorageNapMessage,
|
|
342
345
|
IncNapMessage,
|
|
343
346
|
KeysNapMessage,
|
|
347
|
+
ListsNapMessage,
|
|
344
348
|
Action,
|
|
345
349
|
} from '@napplet/sdk';
|
|
346
350
|
```
|
|
@@ -375,6 +379,8 @@ handlers in shell implementations or protocol-aware code.
|
|
|
375
379
|
| `NotifyNapMessage` | `@napplet/nap/notify` | Discriminated union of all notify domain messages |
|
|
376
380
|
| `ConfigNapMessage` | `@napplet/nap/config` | Discriminated union of all config domain messages |
|
|
377
381
|
| `ResourceNapMessage` | `@napplet/nap/resource` | Discriminated union of all resource domain messages |
|
|
382
|
+
| `ListsNapMessage` | `@napplet/nap/lists` | Discriminated union of all lists domain messages |
|
|
383
|
+
| `CommonNapMessage` | `@napplet/nap/common` | Discriminated union of all common domain messages |
|
|
378
384
|
| `SerialNapMessage` | `@napplet/nap/serial` | Discriminated union of all serial domain messages |
|
|
379
385
|
|
|
380
386
|
Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMessage`) are also re-exported from
|
|
@@ -385,8 +391,8 @@ Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMe
|
|
|
385
391
|
Each NAP domain has a string constant re-exported from its package:
|
|
386
392
|
|
|
387
393
|
```ts
|
|
388
|
-
import { RELAY_DOMAIN, IDENTITY_DOMAIN, STORAGE_DOMAIN, INC_DOMAIN, THEME_DOMAIN, KEYS_DOMAIN, MEDIA_DOMAIN, NOTIFY_DOMAIN, CONFIG_DOMAIN, RESOURCE_DOMAIN, CVM_DOMAIN, OUTBOX_DOMAIN, UPLOAD_DOMAIN, INTENT_DOMAIN, SERIAL_DOMAIN } from '@napplet/sdk';
|
|
389
|
-
// Values: 'relay', 'identity', 'storage', 'inc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'cvm', 'outbox', 'upload', 'intent', 'serial'
|
|
394
|
+
import { RELAY_DOMAIN, IDENTITY_DOMAIN, STORAGE_DOMAIN, INC_DOMAIN, THEME_DOMAIN, KEYS_DOMAIN, MEDIA_DOMAIN, NOTIFY_DOMAIN, CONFIG_DOMAIN, RESOURCE_DOMAIN, CVM_DOMAIN, OUTBOX_DOMAIN, UPLOAD_DOMAIN, INTENT_DOMAIN, WEBRTC_DOMAIN, LINK_DOMAIN, LISTS_DOMAIN, COMMON_DOMAIN, SERIAL_DOMAIN } from '@napplet/sdk';
|
|
395
|
+
// Values: 'relay', 'identity', 'storage', 'inc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'cvm', 'outbox', 'upload', 'intent', 'webrtc', 'link', 'lists', 'common', 'serial'
|
|
390
396
|
```
|
|
391
397
|
|
|
392
398
|
These constants are re-exported from the individual domain packages. Use them with the shell capability query
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NostrEvent, Subscription, NostrFilter, EventTemplate, CvmDiscoverQuery, CvmServer, CvmServerRef, McpMessage, CvmRequestOptions, McpTool, McpToolResult, McpResource, McpResourceContent, IntentRequest, IntentResult, IntentAvailability,
|
|
1
|
+
import { NostrEvent, Subscription, NostrFilter, EventTemplate, CvmDiscoverQuery, CvmServer, CvmServerRef, McpMessage, CvmRequestOptions, McpTool, McpToolResult, McpResource, McpResourceContent, IntentRequest, IntentResult, IntentAvailability, OutboxQueryOptions, OutboxResult, OutboxSubscribeOptions, OutboxSubscription, OutboxPublishOptions, OutboxPublishResult, OutboxTarget, OutboxRelayPlan, UploadRequest, UploadResult, UploadStatus, WebrtcOpenRequest, WebrtcOpenResult, WebrtcEvent, CommonNip19EncodeInput, CommonNip19EncodeResult, CommonNip19DecodeResult, CommonProfileTarget, CommonProfileResult, CommonFollowsResult, CommonActionResult, CommonReaction, CommonReportTarget, CommonReportReason, LinkOpenOptions, LinkOpenResult, ListSupport, ListRef, ListItem, ListOptions, ListMutationResult, SerialOpenRequest, SerialOpenResult, SerialEvent } from '@napplet/core';
|
|
2
2
|
export { EventTemplate, NAP_DOMAINS, NamespacedCapability, NapDomain, NapProtocolId, NappletMessage, NostrEvent, NostrFilter, ProtocolId, ShellSupports, Subscription } from '@napplet/core';
|
|
3
3
|
import { MediaSessionCreate, MediaSessionResult, MediaMetadata, MediaState, MediaAction } from '@napplet/nap/media';
|
|
4
4
|
export { DOMAIN as MEDIA_DOMAIN, MediaAction, MediaArtwork, MediaCapabilitiesMessage, MediaCommandMessage, MediaControlsMessage, MediaMessage, MediaMetadata, MediaNapMessage, MediaPlaybackOwner, MediaRequestMessage, MediaResultMessage, MediaSessionCreate, MediaSessionCreateMessage, MediaSessionCreateResultMessage, MediaSessionDestroyMessage, MediaSessionResult, MediaSessionUpdateMessage, MediaSourceRef, MediaState, MediaStateMessage, installMediaShim, mediaCreateSession, mediaDestroySession, mediaOnCapabilities, mediaOnCommand, mediaOnControls, mediaOnState, mediaReportCapabilities, mediaReportState, mediaSendCommand, mediaUpdateSession } from '@napplet/nap/media';
|
|
@@ -16,7 +16,10 @@ export { DOMAIN as CVM_DOMAIN, CvmCloseMessage, CvmCloseResultMessage, CvmDiscov
|
|
|
16
16
|
export { DOMAIN as OUTBOX_DOMAIN, OutboxCloseMessage, OutboxClosedMessage, OutboxEoseMessage, OutboxEventMessage, OutboxInboundMessage, OutboxMessage, OutboxNapMessage, OutboxOutboundMessage, OutboxPublishMessage, OutboxPublishOptions, OutboxPublishResult, OutboxPublishResultMessage, OutboxQueryMessage, OutboxQueryOptions, OutboxQueryResultMessage, OutboxRelayPlan, OutboxResolveRelaysMessage, OutboxResolveRelaysResultMessage, OutboxResult, OutboxStrategy, OutboxSubscribeMessage, OutboxSubscribeOptions, OutboxSubscription, OutboxTarget, installOutboxShim, outboxPublish, outboxQuery, outboxResolveRelays, outboxSubscribe } from '@napplet/nap/outbox';
|
|
17
17
|
export { NostrTag, DOMAIN as UPLOAD_DOMAIN, UploadDimensions, UploadInboundMessage, UploadMessage, UploadNapMessage, UploadOutboundMessage, UploadRail, UploadRequest, UploadResult, UploadState, UploadStatus, UploadStatusChangedMessage, UploadStatusMessage, UploadStatusResultMessage, UploadUploadMessage, UploadUploadResultMessage, installUploadShim, uploadFile, uploadOnStatus, uploadStatus } from '@napplet/nap/upload';
|
|
18
18
|
export { DOMAIN as INTENT_DOMAIN, IntentAvailability, IntentAvailableMessage, IntentAvailableResultMessage, IntentBehavior, IntentCandidate, IntentChangedMessage, IntentContract, IntentHandlerPreference, IntentHandlersMessage, IntentHandlersResultMessage, IntentInboundMessage, IntentInvokeMessage, IntentInvokeResultMessage, IntentMessage, IntentNapMessage, IntentOutboundMessage, IntentRequest, IntentResult, installIntentShim, intentAvailable, intentHandlers, intentInvoke, intentOnChanged, intentOpen } from '@napplet/nap/intent';
|
|
19
|
+
export { DOMAIN as WEBRTC_DOMAIN, WebrtcApi, WebrtcCloseMessage, WebrtcCloseResultMessage, WebrtcClosedEvent, WebrtcDirectScope, WebrtcEvent, WebrtcEventMessage, WebrtcInboundMessage, WebrtcMessage, WebrtcMessageEvent, WebrtcNapMessage, WebrtcOpenMessage, WebrtcOpenRequest, WebrtcOpenResult, WebrtcOpenResultMessage, WebrtcOutboundMessage, WebrtcPeerEvent, WebrtcRoomScope, WebrtcScope, WebrtcSendMessage, WebrtcSendResultMessage, WebrtcSession, WebrtcState, WebrtcStateEvent, installWebrtcShim, webrtcClose, webrtcOnEvent, webrtcOpen, webrtcSend } from '@napplet/nap/webrtc';
|
|
19
20
|
export { DOMAIN as LINK_DOMAIN, LinkInboundMessage, LinkMessage, LinkNapMessage, LinkOpenErrorCode, LinkOpenMessage, LinkOpenOptions, LinkOpenResult, LinkOpenResultMessage, LinkOpenStatus, LinkOutboundMessage, installLinkShim, linkOpen } from '@napplet/nap/link';
|
|
21
|
+
export { DOMAIN as LISTS_DOMAIN, ListErrorCode, ListItem, ListItemType, ListItemVisibility, ListMutationResult, ListOptions, ListRef, ListSupport, ListsAddMessage, ListsAddResultMessage, ListsInboundMessage, ListsMessage, ListsNapMessage, ListsOutboundMessage, ListsRemoveMessage, ListsRemoveResultMessage, ListsSupportedMessage, ListsSupportedResultMessage, installListsShim, listsAdd, listsRemove, listsSupported } from '@napplet/nap/lists';
|
|
22
|
+
export { DOMAIN as COMMON_DOMAIN, CommonActionResult, CommonDecodeNip19Message, CommonDecodeNip19ResultMessage, CommonEncodeNip19Message, CommonEncodeNip19ResultMessage, CommonEventReportTarget, CommonFollowMessage, CommonFollowResultMessage, CommonFollowsMessage, CommonFollowsResult, CommonFollowsResultMessage, CommonGetProfileMessage, CommonGetProfileResultMessage, CommonInboundMessage, CommonMessage, CommonNapMessage, CommonNip19DecodeResult, CommonNip19EncodeInput, CommonNip19EncodeResult, CommonNip19Type, CommonOutboundMessage, CommonProfileData, CommonProfileResult, CommonProfileTarget, CommonPubkeyReportTarget, CommonReactMessage, CommonReactResultMessage, CommonReaction, CommonReportMessage, CommonReportReason, CommonReportResultMessage, CommonReportTarget, CommonUnfollowMessage, CommonUnfollowResultMessage, commonDecodeNip19, commonEncodeNip19, commonFollow, commonFollows, commonGetProfile, commonReact, commonReport, commonUnfollow, installCommonShim } from '@napplet/nap/common';
|
|
20
23
|
export { DOMAIN as SERIAL_DOMAIN, SerialCloseMessage, SerialCloseResultMessage, SerialEvent, SerialEventMessage, SerialInboundMessage, SerialMessage, SerialNapMessage, SerialOpenMessage, SerialOpenOptions, SerialOpenRequest, SerialOpenResult, SerialOpenResultMessage, SerialOutboundMessage, SerialPortFilter, SerialPortInfo, SerialSession, SerialState, SerialWriteMessage, SerialWriteResultMessage, installSerialShim, serialClose, serialOnEvent, serialOpen, serialWrite } from '@napplet/nap/serial';
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -650,8 +653,7 @@ declare const resource: {
|
|
|
650
653
|
};
|
|
651
654
|
|
|
652
655
|
/**
|
|
653
|
-
* @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and
|
|
654
|
-
* @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and serial
|
|
656
|
+
* @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and WebRTC
|
|
655
657
|
* wrapper objects.
|
|
656
658
|
*
|
|
657
659
|
* @packageDocumentation
|
|
@@ -855,6 +857,52 @@ declare const intent: {
|
|
|
855
857
|
*/
|
|
856
858
|
onChanged(handler: (availability: IntentAvailability) => void): Subscription;
|
|
857
859
|
};
|
|
860
|
+
/**
|
|
861
|
+
* Runtime-mediated WebRTC sessions (NAP-WEBRTC). The shell owns signaling,
|
|
862
|
+
* signing/encryption, SDP, ICE, and peer-connection lifecycle; napplets exchange
|
|
863
|
+
* only opaque application payloads over shell-scoped sessions.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```ts
|
|
867
|
+
* import { webrtc } from '@napplet/sdk';
|
|
868
|
+
*
|
|
869
|
+
* const { session } = await webrtc.open({ scope: { type: 'direct', pubkey } });
|
|
870
|
+
* await webrtc.send(session.id, { body: 'hello' });
|
|
871
|
+
* ```
|
|
872
|
+
*/
|
|
873
|
+
declare const webrtc: {
|
|
874
|
+
/**
|
|
875
|
+
* Open a runtime-owned WebRTC session.
|
|
876
|
+
* @param request Session scope and channel/protocol labels
|
|
877
|
+
* @returns Promise resolving to the opened session result
|
|
878
|
+
*/
|
|
879
|
+
open(request: WebrtcOpenRequest): Promise<WebrtcOpenResult>;
|
|
880
|
+
/**
|
|
881
|
+
* Send an opaque application payload over a session.
|
|
882
|
+
* @param sessionId WebRTC session id
|
|
883
|
+
* @param payload Application payload
|
|
884
|
+
*/
|
|
885
|
+
send(sessionId: string, payload: unknown): Promise<void>;
|
|
886
|
+
/**
|
|
887
|
+
* Close a WebRTC session.
|
|
888
|
+
* @param sessionId WebRTC session id
|
|
889
|
+
* @param reason Optional close reason
|
|
890
|
+
*/
|
|
891
|
+
close(sessionId: string, reason?: string): Promise<void>;
|
|
892
|
+
/**
|
|
893
|
+
* Subscribe to runtime-pushed WebRTC events.
|
|
894
|
+
* @param handler Event handler
|
|
895
|
+
* @returns Subscription handle
|
|
896
|
+
*/
|
|
897
|
+
onEvent(handler: (event: WebrtcEvent) => void): Subscription;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* @napplet/sdk -- Link, lists, common, and serial wrapper objects.
|
|
902
|
+
*
|
|
903
|
+
* @packageDocumentation
|
|
904
|
+
*/
|
|
905
|
+
|
|
858
906
|
/**
|
|
859
907
|
* Shell-mediated link opening (NAP-LINK): ask the shell to open an external URL
|
|
860
908
|
* for user-visible navigation. The shell owns prompting, policy, opener
|
|
@@ -876,6 +924,108 @@ declare const link: {
|
|
|
876
924
|
*/
|
|
877
925
|
open(url: string, options?: LinkOpenOptions): Promise<LinkOpenResult>;
|
|
878
926
|
};
|
|
927
|
+
/**
|
|
928
|
+
* Runtime-mediated NIP-51 list mutations (NAP-LISTS): add or remove semantic
|
|
929
|
+
* items from supported NIP-51 lists while the runtime owns lookup, merge,
|
|
930
|
+
* encryption, signing, and publishing.
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```ts
|
|
934
|
+
* import { lists } from '@napplet/sdk';
|
|
935
|
+
*
|
|
936
|
+
* await lists.add({ type: 'mute-list' }, [
|
|
937
|
+
* { itemType: 'pubkey', value: 'abc123...' },
|
|
938
|
+
* ]);
|
|
939
|
+
* ```
|
|
940
|
+
*/
|
|
941
|
+
declare const lists: {
|
|
942
|
+
/**
|
|
943
|
+
* Return the NIP-51 list kinds/types this runtime supports.
|
|
944
|
+
* @returns Promise resolving to supported list descriptions
|
|
945
|
+
*/
|
|
946
|
+
supported(): Promise<ListSupport[]>;
|
|
947
|
+
/**
|
|
948
|
+
* Add items to a runtime-supported NIP-51 list.
|
|
949
|
+
* @param list List reference by kind or derived type
|
|
950
|
+
* @param items Items to add
|
|
951
|
+
* @param options Optional create/metadata hints
|
|
952
|
+
*/
|
|
953
|
+
add(list: ListRef, items: ListItem[], options?: ListOptions): Promise<ListMutationResult>;
|
|
954
|
+
/**
|
|
955
|
+
* Remove items from a runtime-supported NIP-51 list.
|
|
956
|
+
* @param list List reference by kind or derived type
|
|
957
|
+
* @param items Items to remove
|
|
958
|
+
* @param options Optional runtime hints
|
|
959
|
+
*/
|
|
960
|
+
remove(list: ListRef, items: ListItem[], options?: ListOptions): Promise<ListMutationResult>;
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* Common social actions (NAP-COMMON): shell-mediated public NIP-19 helpers,
|
|
964
|
+
* profile lookup, follows, follow/unfollow, reactions, and reports. The shell
|
|
965
|
+
* owns identity, consent, event construction, signing, publishing, relay access,
|
|
966
|
+
* and NIP-19 handling.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```ts
|
|
970
|
+
* import { common } from '@napplet/sdk';
|
|
971
|
+
*
|
|
972
|
+
* const { pubkeys } = await common.follows();
|
|
973
|
+
* await common.react(noteId, '+');
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
declare const common: {
|
|
977
|
+
/**
|
|
978
|
+
* Encode a supported public NIP-19 value.
|
|
979
|
+
* @param input Structured NIP-19 encode input
|
|
980
|
+
* @returns Promise resolving to the shell encode result
|
|
981
|
+
*/
|
|
982
|
+
encodeNip19(input: CommonNip19EncodeInput): Promise<CommonNip19EncodeResult>;
|
|
983
|
+
/**
|
|
984
|
+
* Decode a supported public NIP-19 value.
|
|
985
|
+
* @param value NIP-19 value to decode
|
|
986
|
+
* @returns Promise resolving to normalized decoded fields
|
|
987
|
+
*/
|
|
988
|
+
decodeNip19(value: string): Promise<CommonNip19DecodeResult>;
|
|
989
|
+
/**
|
|
990
|
+
* Resolve a profile by hex pubkey, npub, or nprofile.
|
|
991
|
+
* @param target Profile target
|
|
992
|
+
* @returns Promise resolving to latest profile data when available
|
|
993
|
+
*/
|
|
994
|
+
getProfile(target: CommonProfileTarget): Promise<CommonProfileResult>;
|
|
995
|
+
/**
|
|
996
|
+
* Return the shell user's followed pubkeys as hex.
|
|
997
|
+
* @returns Promise resolving to followed pubkeys
|
|
998
|
+
*/
|
|
999
|
+
follows(): Promise<CommonFollowsResult>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Ask the shell to follow one or more npub targets.
|
|
1002
|
+
* @param pubkeys Npub targets to follow
|
|
1003
|
+
* @returns Promise resolving to the action result
|
|
1004
|
+
*/
|
|
1005
|
+
follow(...pubkeys: string[]): Promise<CommonActionResult>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Ask the shell to unfollow one or more npub targets.
|
|
1008
|
+
* @param pubkeys Npub targets to unfollow
|
|
1009
|
+
* @returns Promise resolving to the action result
|
|
1010
|
+
*/
|
|
1011
|
+
unfollow(...pubkeys: string[]): Promise<CommonActionResult>;
|
|
1012
|
+
/**
|
|
1013
|
+
* React to a native Nostr event.
|
|
1014
|
+
* @param targetEventId Event id to react to
|
|
1015
|
+
* @param reaction Reaction content
|
|
1016
|
+
* @param customEmojiHref Optional custom emoji URL
|
|
1017
|
+
* @returns Promise resolving to the action result
|
|
1018
|
+
*/
|
|
1019
|
+
react(targetEventId: string, reaction: CommonReaction, customEmojiHref?: string): Promise<CommonActionResult>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Report an event or pubkey with a NIP-56 reason.
|
|
1022
|
+
* @param target Structured report target
|
|
1023
|
+
* @param reason NIP-56 report reason
|
|
1024
|
+
* @param text Report text
|
|
1025
|
+
* @returns Promise resolving to the action result
|
|
1026
|
+
*/
|
|
1027
|
+
report(target: CommonReportTarget, reason: CommonReportReason, text: string): Promise<CommonActionResult>;
|
|
1028
|
+
};
|
|
879
1029
|
/**
|
|
880
1030
|
* Runtime-mediated serial device access (NAP-SERIAL): ask the shell to select
|
|
881
1031
|
* and open a user-approved serial session, write byte arrays to that session,
|
|
@@ -919,4 +1069,4 @@ declare const serial: {
|
|
|
919
1069
|
onEvent(handler: (event: SerialEvent) => void): Subscription;
|
|
920
1070
|
};
|
|
921
1071
|
|
|
922
|
-
export { config, cvm, identity, ifc, inc, intent, keys, link, media, notify, outbox, relay, resource, serial, storage, upload };
|
|
1072
|
+
export { common, config, cvm, identity, ifc, inc, intent, keys, link, lists, media, notify, outbox, relay, resource, serial, storage, upload, webrtc };
|
package/dist/index.js
CHANGED
|
@@ -684,6 +684,42 @@ var intent = {
|
|
|
684
684
|
return requireNapplet().intent.onChanged(handler);
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
+
var webrtc = {
|
|
688
|
+
/**
|
|
689
|
+
* Open a runtime-owned WebRTC session.
|
|
690
|
+
* @param request Session scope and channel/protocol labels
|
|
691
|
+
* @returns Promise resolving to the opened session result
|
|
692
|
+
*/
|
|
693
|
+
open(request) {
|
|
694
|
+
return requireNapplet().webrtc.open(request);
|
|
695
|
+
},
|
|
696
|
+
/**
|
|
697
|
+
* Send an opaque application payload over a session.
|
|
698
|
+
* @param sessionId WebRTC session id
|
|
699
|
+
* @param payload Application payload
|
|
700
|
+
*/
|
|
701
|
+
send(sessionId, payload) {
|
|
702
|
+
return requireNapplet().webrtc.send(sessionId, payload);
|
|
703
|
+
},
|
|
704
|
+
/**
|
|
705
|
+
* Close a WebRTC session.
|
|
706
|
+
* @param sessionId WebRTC session id
|
|
707
|
+
* @param reason Optional close reason
|
|
708
|
+
*/
|
|
709
|
+
close(sessionId, reason) {
|
|
710
|
+
return requireNapplet().webrtc.close(sessionId, reason);
|
|
711
|
+
},
|
|
712
|
+
/**
|
|
713
|
+
* Subscribe to runtime-pushed WebRTC events.
|
|
714
|
+
* @param handler Event handler
|
|
715
|
+
* @returns Subscription handle
|
|
716
|
+
*/
|
|
717
|
+
onEvent(handler) {
|
|
718
|
+
return requireNapplet().webrtc.onEvent(handler);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
// src/services.ts
|
|
687
723
|
var link = {
|
|
688
724
|
/**
|
|
689
725
|
* Request that the shell open an external URL for the user.
|
|
@@ -695,6 +731,102 @@ var link = {
|
|
|
695
731
|
return requireNapplet().link.open(url, options);
|
|
696
732
|
}
|
|
697
733
|
};
|
|
734
|
+
var lists = {
|
|
735
|
+
/**
|
|
736
|
+
* Return the NIP-51 list kinds/types this runtime supports.
|
|
737
|
+
* @returns Promise resolving to supported list descriptions
|
|
738
|
+
*/
|
|
739
|
+
supported() {
|
|
740
|
+
return requireNapplet().lists.supported();
|
|
741
|
+
},
|
|
742
|
+
/**
|
|
743
|
+
* Add items to a runtime-supported NIP-51 list.
|
|
744
|
+
* @param list List reference by kind or derived type
|
|
745
|
+
* @param items Items to add
|
|
746
|
+
* @param options Optional create/metadata hints
|
|
747
|
+
*/
|
|
748
|
+
add(list, items, options) {
|
|
749
|
+
return requireNapplet().lists.add(list, items, options);
|
|
750
|
+
},
|
|
751
|
+
/**
|
|
752
|
+
* Remove items from a runtime-supported NIP-51 list.
|
|
753
|
+
* @param list List reference by kind or derived type
|
|
754
|
+
* @param items Items to remove
|
|
755
|
+
* @param options Optional runtime hints
|
|
756
|
+
*/
|
|
757
|
+
remove(list, items, options) {
|
|
758
|
+
return requireNapplet().lists.remove(list, items, options);
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
var common = {
|
|
762
|
+
/**
|
|
763
|
+
* Encode a supported public NIP-19 value.
|
|
764
|
+
* @param input Structured NIP-19 encode input
|
|
765
|
+
* @returns Promise resolving to the shell encode result
|
|
766
|
+
*/
|
|
767
|
+
encodeNip19(input) {
|
|
768
|
+
return requireNapplet().common.encodeNip19(input);
|
|
769
|
+
},
|
|
770
|
+
/**
|
|
771
|
+
* Decode a supported public NIP-19 value.
|
|
772
|
+
* @param value NIP-19 value to decode
|
|
773
|
+
* @returns Promise resolving to normalized decoded fields
|
|
774
|
+
*/
|
|
775
|
+
decodeNip19(value) {
|
|
776
|
+
return requireNapplet().common.decodeNip19(value);
|
|
777
|
+
},
|
|
778
|
+
/**
|
|
779
|
+
* Resolve a profile by hex pubkey, npub, or nprofile.
|
|
780
|
+
* @param target Profile target
|
|
781
|
+
* @returns Promise resolving to latest profile data when available
|
|
782
|
+
*/
|
|
783
|
+
getProfile(target) {
|
|
784
|
+
return requireNapplet().common.getProfile(target);
|
|
785
|
+
},
|
|
786
|
+
/**
|
|
787
|
+
* Return the shell user's followed pubkeys as hex.
|
|
788
|
+
* @returns Promise resolving to followed pubkeys
|
|
789
|
+
*/
|
|
790
|
+
follows() {
|
|
791
|
+
return requireNapplet().common.follows();
|
|
792
|
+
},
|
|
793
|
+
/**
|
|
794
|
+
* Ask the shell to follow one or more npub targets.
|
|
795
|
+
* @param pubkeys Npub targets to follow
|
|
796
|
+
* @returns Promise resolving to the action result
|
|
797
|
+
*/
|
|
798
|
+
follow(...pubkeys) {
|
|
799
|
+
return requireNapplet().common.follow(...pubkeys);
|
|
800
|
+
},
|
|
801
|
+
/**
|
|
802
|
+
* Ask the shell to unfollow one or more npub targets.
|
|
803
|
+
* @param pubkeys Npub targets to unfollow
|
|
804
|
+
* @returns Promise resolving to the action result
|
|
805
|
+
*/
|
|
806
|
+
unfollow(...pubkeys) {
|
|
807
|
+
return requireNapplet().common.unfollow(...pubkeys);
|
|
808
|
+
},
|
|
809
|
+
/**
|
|
810
|
+
* React to a native Nostr event.
|
|
811
|
+
* @param targetEventId Event id to react to
|
|
812
|
+
* @param reaction Reaction content
|
|
813
|
+
* @param customEmojiHref Optional custom emoji URL
|
|
814
|
+
* @returns Promise resolving to the action result
|
|
815
|
+
*/
|
|
816
|
+
react(targetEventId, reaction, customEmojiHref) {
|
|
817
|
+
return requireNapplet().common.react(targetEventId, reaction, customEmojiHref);
|
|
818
|
+
},
|
|
819
|
+
/**
|
|
820
|
+
* Report an event or pubkey with a NIP-56 reason.
|
|
821
|
+
* @param target Structured report target
|
|
822
|
+
* @param reason NIP-56 report reason
|
|
823
|
+
* @param text Report text
|
|
824
|
+
* @returns Promise resolving to the action result
|
|
825
|
+
*/
|
|
826
|
+
report(target, reason, text) {
|
|
827
|
+
return requireNapplet().common.report(target, reason, text);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
698
830
|
var serial = {
|
|
699
831
|
/**
|
|
700
832
|
* Ask the runtime to select and open a serial session.
|
|
@@ -749,8 +881,11 @@ import { DOMAIN as DOMAIN12 } from "@napplet/nap/cvm";
|
|
|
749
881
|
import { DOMAIN as DOMAIN13 } from "@napplet/nap/outbox";
|
|
750
882
|
import { DOMAIN as DOMAIN14 } from "@napplet/nap/upload";
|
|
751
883
|
import { DOMAIN as DOMAIN15 } from "@napplet/nap/intent";
|
|
752
|
-
import { DOMAIN as DOMAIN16 } from "@napplet/nap/
|
|
753
|
-
import { DOMAIN as DOMAIN17 } from "@napplet/nap/
|
|
884
|
+
import { DOMAIN as DOMAIN16 } from "@napplet/nap/webrtc";
|
|
885
|
+
import { DOMAIN as DOMAIN17 } from "@napplet/nap/link";
|
|
886
|
+
import { DOMAIN as DOMAIN18 } from "@napplet/nap/lists";
|
|
887
|
+
import { DOMAIN as DOMAIN19 } from "@napplet/nap/common";
|
|
888
|
+
import { DOMAIN as DOMAIN20 } from "@napplet/nap/serial";
|
|
754
889
|
import { installRelayShim } from "@napplet/nap/relay";
|
|
755
890
|
import { installIdentityShim } from "@napplet/nap/identity";
|
|
756
891
|
import { installThemeShim } from "@napplet/nap/theme";
|
|
@@ -766,7 +901,10 @@ import { installCvmShim } from "@napplet/nap/cvm";
|
|
|
766
901
|
import { installOutboxShim } from "@napplet/nap/outbox";
|
|
767
902
|
import { installUploadShim } from "@napplet/nap/upload";
|
|
768
903
|
import { installIntentShim } from "@napplet/nap/intent";
|
|
904
|
+
import { installWebrtcShim } from "@napplet/nap/webrtc";
|
|
769
905
|
import { installLinkShim } from "@napplet/nap/link";
|
|
906
|
+
import { installListsShim } from "@napplet/nap/lists";
|
|
907
|
+
import { installCommonShim } from "@napplet/nap/common";
|
|
770
908
|
import { installSerialShim } from "@napplet/nap/serial";
|
|
771
909
|
import { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from "@napplet/nap/relay";
|
|
772
910
|
import {
|
|
@@ -827,6 +965,27 @@ import {
|
|
|
827
965
|
intentOnChanged
|
|
828
966
|
} from "@napplet/nap/intent";
|
|
829
967
|
import { linkOpen } from "@napplet/nap/link";
|
|
968
|
+
import {
|
|
969
|
+
listsSupported,
|
|
970
|
+
listsAdd,
|
|
971
|
+
listsRemove
|
|
972
|
+
} from "@napplet/nap/lists";
|
|
973
|
+
import {
|
|
974
|
+
commonEncodeNip19,
|
|
975
|
+
commonDecodeNip19,
|
|
976
|
+
commonGetProfile,
|
|
977
|
+
commonFollows,
|
|
978
|
+
commonFollow,
|
|
979
|
+
commonUnfollow,
|
|
980
|
+
commonReact,
|
|
981
|
+
commonReport
|
|
982
|
+
} from "@napplet/nap/common";
|
|
983
|
+
import {
|
|
984
|
+
webrtcOpen,
|
|
985
|
+
webrtcSend,
|
|
986
|
+
webrtcClose,
|
|
987
|
+
webrtcOnEvent
|
|
988
|
+
} from "@napplet/nap/webrtc";
|
|
830
989
|
import {
|
|
831
990
|
serialOpen,
|
|
832
991
|
serialWrite,
|
|
@@ -834,6 +993,7 @@ import {
|
|
|
834
993
|
serialOnEvent
|
|
835
994
|
} from "@napplet/nap/serial";
|
|
836
995
|
export {
|
|
996
|
+
DOMAIN19 as COMMON_DOMAIN,
|
|
837
997
|
DOMAIN10 as CONFIG_DOMAIN,
|
|
838
998
|
DOMAIN12 as CVM_DOMAIN,
|
|
839
999
|
DOMAIN2 as IDENTITY_DOMAIN,
|
|
@@ -841,17 +1001,28 @@ export {
|
|
|
841
1001
|
DOMAIN4 as INC_DOMAIN,
|
|
842
1002
|
DOMAIN15 as INTENT_DOMAIN,
|
|
843
1003
|
DOMAIN7 as KEYS_DOMAIN,
|
|
844
|
-
|
|
1004
|
+
DOMAIN17 as LINK_DOMAIN,
|
|
1005
|
+
DOMAIN18 as LISTS_DOMAIN,
|
|
845
1006
|
DOMAIN8 as MEDIA_DOMAIN,
|
|
846
1007
|
NAP_DOMAINS,
|
|
847
1008
|
DOMAIN9 as NOTIFY_DOMAIN,
|
|
848
1009
|
DOMAIN13 as OUTBOX_DOMAIN,
|
|
849
1010
|
DOMAIN as RELAY_DOMAIN,
|
|
850
1011
|
DOMAIN11 as RESOURCE_DOMAIN,
|
|
851
|
-
|
|
1012
|
+
DOMAIN20 as SERIAL_DOMAIN,
|
|
852
1013
|
DOMAIN3 as STORAGE_DOMAIN,
|
|
853
1014
|
DOMAIN6 as THEME_DOMAIN,
|
|
854
1015
|
DOMAIN14 as UPLOAD_DOMAIN,
|
|
1016
|
+
DOMAIN16 as WEBRTC_DOMAIN,
|
|
1017
|
+
common,
|
|
1018
|
+
commonDecodeNip19,
|
|
1019
|
+
commonEncodeNip19,
|
|
1020
|
+
commonFollow,
|
|
1021
|
+
commonFollows,
|
|
1022
|
+
commonGetProfile,
|
|
1023
|
+
commonReact,
|
|
1024
|
+
commonReport,
|
|
1025
|
+
commonUnfollow,
|
|
855
1026
|
config,
|
|
856
1027
|
cvm,
|
|
857
1028
|
cvmCallTool,
|
|
@@ -879,6 +1050,7 @@ export {
|
|
|
879
1050
|
inc,
|
|
880
1051
|
incEmit,
|
|
881
1052
|
incOn,
|
|
1053
|
+
installCommonShim,
|
|
882
1054
|
installConfigShim,
|
|
883
1055
|
installCvmShim,
|
|
884
1056
|
installIdentityShim,
|
|
@@ -887,6 +1059,7 @@ export {
|
|
|
887
1059
|
installIntentShim,
|
|
888
1060
|
installKeysShim,
|
|
889
1061
|
installLinkShim,
|
|
1062
|
+
installListsShim,
|
|
890
1063
|
installMediaShim,
|
|
891
1064
|
installNotifyShim,
|
|
892
1065
|
installOutboxShim,
|
|
@@ -896,6 +1069,7 @@ export {
|
|
|
896
1069
|
installStorageShim,
|
|
897
1070
|
installThemeShim,
|
|
898
1071
|
installUploadShim,
|
|
1072
|
+
installWebrtcShim,
|
|
899
1073
|
intent,
|
|
900
1074
|
intentAvailable,
|
|
901
1075
|
intentHandlers,
|
|
@@ -909,6 +1083,10 @@ export {
|
|
|
909
1083
|
keysUnregisterAction,
|
|
910
1084
|
link,
|
|
911
1085
|
linkOpen,
|
|
1086
|
+
lists,
|
|
1087
|
+
listsAdd,
|
|
1088
|
+
listsRemove,
|
|
1089
|
+
listsSupported,
|
|
912
1090
|
media,
|
|
913
1091
|
mediaCreateSession,
|
|
914
1092
|
mediaDestroySession,
|
|
@@ -962,6 +1140,11 @@ export {
|
|
|
962
1140
|
upload,
|
|
963
1141
|
uploadFile,
|
|
964
1142
|
uploadOnStatus,
|
|
965
|
-
uploadStatus
|
|
1143
|
+
uploadStatus,
|
|
1144
|
+
webrtc,
|
|
1145
|
+
webrtcClose,
|
|
1146
|
+
webrtcOnEvent,
|
|
1147
|
+
webrtcOpen,
|
|
1148
|
+
webrtcSend
|
|
966
1149
|
};
|
|
967
1150
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/require-napplet.ts","../src/relay.ts","../src/media.ts","../src/keys.ts","../src/config.ts","../src/cvm.ts","../src/nap-runtime.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Shared `window.napplet` accessor for SDK wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal } from '@napplet/core';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nexport function requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n","/**\n * @napplet/sdk -- Relay, inter-napplet pubsub, and storage wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-napplet pubsub: broadcast and receive INC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { inc } from '@napplet/sdk';\n *\n * inc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = inc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const inc = {\n /**\n * Broadcast an INC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().inc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to INC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().inc.on(topic, callback);\n },\n};\n\n/**\n * @deprecated Use {@link inc}. NAP-IFC was renamed to NAP-INC; this package\n * alias is kept only to ease downstream migration.\n */\nexport const ifc = inc;\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n\n /**\n * Per-instance storage: same surface as the shared methods, but scoped to this\n * napplet instance (sets `scope: \"instance\"` on the wire) rather than shared\n * across instances. Defer to NAP-STORAGE (napplet/naps) for scope semantics.\n */\n instance: {\n /**\n * Retrieve a per-instance value by key. Returns null if not found.\n * @param key The storage key\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.instance.getItem(key);\n },\n\n /**\n * Store a per-instance key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.instance.setItem(key, value);\n },\n\n /**\n * Remove a per-instance key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.instance.removeItem(key);\n },\n\n /**\n * List all per-instance keys for this napplet instance.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.instance.keys();\n },\n },\n};\n","/**\n * @napplet/sdk -- Media session and notification wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * owner: 'napplet',\n * metadata: { title: 'My Song', artist: 'The Artist' },\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param options Ownership-aware session options\n * @returns The shell result with canonical sessionId and owner, or error\n */\n createSession(options: MediaSessionCreate): Promise<MediaSessionResult> {\n return requireNapplet().media.createSession(options);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: MediaState): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: MediaAction[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Send a command to the current playback owner.\n * @param sessionId The session to control\n * @param action The media action to request\n * @param value Optional value for seek/volume\n */\n sendCommand(sessionId: string, action: MediaAction, value?: number): void {\n requireNapplet().media.sendCommand(sessionId, action, value);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: MediaAction, value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported playback state for shell-owned sessions.\n * @param sessionId The session to listen for state on\n * @param callback Called with playback state\n * @returns A Subscription with `close()` to stop listening\n */\n onState(\n sessionId: string,\n callback: (state: MediaState) => void,\n ): Subscription {\n return requireNapplet().media.onState(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported capabilities for shell-owned sessions.\n * @param sessionId The session to listen for capabilities on\n * @param callback Called with available actions\n * @returns A Subscription with `close()` to stop listening\n */\n onCapabilities(\n sessionId: string,\n callback: (actions: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onCapabilities(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n","/**\n * @napplet/sdk -- Keyboard action and read-only identity wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Listen for shell-pushed user identity changes.\n * @param handler Called with a hex pubkey, or \"\" when no user/signer is connected\n * @returns Subscription with close() to detach the handler\n */\n onChanged(handler: (pubkey: string) => void): Subscription {\n return requireNapplet().identity.onChanged(handler);\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n","/**\n * @napplet/sdk -- Declarative config and resource byte-fetch wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Per-napplet declarative configuration (NAP-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n","/**\n * @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and link\n * @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and serial\n * wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrFilter,\n Subscription,\n EventTemplate,\n CvmServerRef,\n CvmServer,\n CvmDiscoverQuery,\n CvmRequestOptions,\n McpMessage,\n McpTool,\n McpToolResult,\n McpResource,\n McpResourceContent,\n OutboxQueryOptions,\n OutboxSubscribeOptions,\n OutboxPublishOptions,\n OutboxTarget,\n OutboxRelayPlan,\n OutboxResult,\n OutboxPublishResult,\n OutboxSubscription,\n UploadRequest,\n UploadResult,\n UploadStatus,\n IntentRequest,\n IntentResult,\n IntentAvailability,\n LinkOpenOptions,\n LinkOpenResult,\n SerialEvent,\n SerialOpenRequest,\n SerialOpenResult,\n} from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Native ContextVM bridge (NAP-CVM): MCP-over-Nostr access mediated by the shell.\n * The shell owns ContextVM transport, signing, encryption, correlation, policy,\n * and payment; napplets supply a server identity and the MCP operation they want.\n *\n * @example\n * ```ts\n * import { cvm } from '@napplet/sdk';\n *\n * const servers = await cvm.discover({ search: 'relay' });\n * const tools = await cvm.listTools(servers[0]);\n * const result = await cvm.callTool(servers[0], tools[0].name, {});\n * ```\n */\nexport const cvm = {\n /**\n * Discover public ContextVM servers known to the shell.\n * @param query Optional discovery filter\n * @returns Promise resolving to the discovered servers\n */\n discover(query?: CvmDiscoverQuery): Promise<CvmServer[]> {\n return requireNapplet().cvm.discover(query);\n },\n\n /**\n * Send a raw MCP JSON-RPC message to a ContextVM server.\n * @param server Target ContextVM server\n * @param message MCP JSON-RPC message\n * @param options Optional per-request options\n * @returns Promise resolving to the MCP response message\n */\n request(\n server: CvmServerRef,\n message: McpMessage,\n options?: CvmRequestOptions,\n ): Promise<McpMessage> {\n return requireNapplet().cvm.request(server, message, options);\n },\n\n /**\n * List the tools exposed by a ContextVM server (MCP `tools/list`).\n * @param server Target ContextVM server\n * @param options Optional per-request options\n */\n listTools(server: CvmServerRef, options?: CvmRequestOptions): Promise<McpTool[]> {\n return requireNapplet().cvm.listTools(server, options);\n },\n\n /**\n * Call a tool on a ContextVM server (MCP `tools/call`).\n * @param server Target ContextVM server\n * @param name Tool name\n * @param args Tool arguments\n * @param options Optional per-request options\n */\n callTool(\n server: CvmServerRef,\n name: string,\n args?: Record<string, unknown>,\n options?: CvmRequestOptions,\n ): Promise<McpToolResult> {\n return requireNapplet().cvm.callTool(server, name, args, options);\n },\n\n /**\n * List the resources exposed by a ContextVM server (MCP `resources/list`).\n * @param server Target ContextVM server\n * @param options Optional per-request options\n */\n listResources(server: CvmServerRef, options?: CvmRequestOptions): Promise<McpResource[]> {\n return requireNapplet().cvm.listResources(server, options);\n },\n\n /**\n * Read a resource from a ContextVM server (MCP `resources/read`).\n * @param server Target ContextVM server\n * @param uri Resource URI\n * @param options Optional per-request options\n */\n readResource(\n server: CvmServerRef,\n uri: string,\n options?: CvmRequestOptions,\n ): Promise<McpResourceContent> {\n return requireNapplet().cvm.readResource(server, uri, options);\n },\n\n /**\n * Close shell-maintained session state for a server.\n * @param server Server whose session should be torn down\n */\n close(server: CvmServerRef): Promise<void> {\n return requireNapplet().cvm.close(server);\n },\n\n /**\n * Listen for server-pushed MCP messages (`cvm.event`).\n * @param callback Called with `(server, message)` for each server event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(\n callback: (server: CvmServerRef, message: McpMessage) => void,\n ): Subscription {\n return requireNapplet().cvm.onEvent(callback);\n },\n};\n\n/**\n * Outbox-aware relay routing (NAP-OUTBOX): supply Nostr filters and intent and\n * let the shell discover the correct relays (NIP-65 write/read relays, fallbacks,\n * relay intelligence), query/deduplicate, validate signatures, and stream updates.\n * The shell owns relay discovery, routing, fallback, deduplication, signing, and\n * publish fanout.\n *\n * @example\n * ```ts\n * import { outbox } from '@napplet/sdk';\n *\n * const { events } = await outbox.query([{ authors: ['ab12...'], kinds: [1] }], { strategy: 'outbox' });\n * const sub = outbox.subscribe([{ kinds: [1] }], { live: true });\n * sub.on('event', (event, relay) => render(event, relay));\n * ```\n */\nexport const outbox = {\n /**\n * Perform a one-shot outbox-aware query.\n * @param filters NIP-01 filter or filters\n * @param options Optional query options\n * @returns Promise resolving to the outbox result\n */\n query(\n filters: NostrFilter | NostrFilter[],\n options?: OutboxQueryOptions,\n ): Promise<OutboxResult> {\n return requireNapplet().outbox.query(filters, options);\n },\n\n /**\n * Open a live outbox-aware subscription.\n * @param filters NIP-01 filter or filters\n * @param options Optional subscribe options\n * @returns An OutboxSubscription handle with `on(...)` and `close()`\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n options?: OutboxSubscribeOptions,\n ): OutboxSubscription {\n return requireNapplet().outbox.subscribe(filters, options);\n },\n\n /**\n * Publish a shell-signed event using outbox-aware relay fanout.\n * @param template Unsigned event template\n * @param options Optional publish options\n * @returns Promise resolving to the outbox publish result\n */\n publish(\n template: EventTemplate,\n options?: OutboxPublishOptions,\n ): Promise<OutboxPublishResult> {\n return requireNapplet().outbox.publish(template, options);\n },\n\n /**\n * Resolve the relay plan the shell would use for a read/write target.\n * @param target The read/write target\n * @returns Promise resolving to the relay plan\n */\n resolveRelays(target: OutboxTarget): Promise<OutboxRelayPlan> {\n return requireNapplet().outbox.resolveRelays(target);\n },\n};\n\n/**\n * Shell-mediated file/blob upload (NAP-UPLOAD): hand the shell raw bytes plus\n * upload intent; the shell selects a server, signs the rail authorization\n * (NIP-98 for NIP-96, kind 24242 for Blossom), performs the HTTP upload, and\n * returns a stable URL plus NIP-94 integrity metadata. The shell owns consent,\n * policy, server selection, and signing.\n *\n * @example\n * ```ts\n * import { upload } from '@napplet/sdk';\n *\n * const result = await upload.upload({ data: blob, filename: 'pic.png' });\n * if (result.status === 'complete') attach(result.url, result.nip94);\n * ```\n */\nexport const upload = {\n /**\n * Upload bytes through the shell's storage pipeline.\n * @param request The upload request (Blob/ArrayBuffer bytes + intent)\n * @returns Promise resolving to the initial upload result\n */\n upload(request: UploadRequest): Promise<UploadResult> {\n return requireNapplet().upload.upload(request);\n },\n\n /**\n * Get the latest known status for a prior upload.\n * @param uploadId The shell-generated upload id\n * @returns Promise resolving to the latest status\n */\n status(uploadId: string): Promise<UploadStatus> {\n return requireNapplet().upload.status(uploadId);\n },\n\n /**\n * Register for shell-pushed upload status updates.\n * @param handler Called with each new UploadStatus\n * @returns A Subscription with `close()` to stop listening\n */\n onStatus(handler: (status: UploadStatus) => void): Subscription {\n return requireNapplet().upload.onStatus(handler);\n },\n};\n\n/**\n * Archetype intent dispatch (NAP-INTENT): invoke another napplet by its role\n * without addressing it directly. The shell resolves the role to an installed\n * napplet (honoring the user's default), opens/focuses its window, and delivers\n * the payload using the named NAP-N protocol. The shell owns resolution, default\n * handling, window lifecycle, and the cross-napplet trust boundary.\n *\n * @example\n * ```ts\n * import { intent } from '@napplet/sdk';\n *\n * if ((await intent.available('note')).available) {\n * await intent.open('note', { target: { type: 'event', id } });\n * }\n * ```\n */\nexport const intent = {\n /**\n * Invoke a napplet by archetype.\n * @param request The intent request (archetype + action + payload + routing)\n * @returns Promise resolving to the invocation result\n */\n invoke(request: IntentRequest): Promise<IntentResult> {\n return requireNapplet().intent.invoke(request);\n },\n\n /**\n * Open a napplet by archetype (sugar for `action: \"open\"`).\n * @param archetype Role slug to open\n * @param payload Opaque payload (typed by the resolved protocol)\n * @param opts Extra request fields (protocol, handler, behavior)\n * @returns Promise resolving to the invocation result\n */\n open(\n archetype: string,\n payload?: unknown,\n opts?: Omit<IntentRequest, 'archetype' | 'action' | 'payload'>,\n ): Promise<IntentResult> {\n return requireNapplet().intent.open(archetype, payload, opts);\n },\n\n /**\n * Check whether the runtime can currently satisfy an archetype and expose the\n * manifest-derived contracts each candidate serves.\n * @param archetype Role slug to check\n * @returns Promise resolving to the archetype availability\n */\n available(archetype: string): Promise<IntentAvailability> {\n return requireNapplet().intent.available(archetype);\n },\n\n /**\n * Get availability for every archetype the runtime can satisfy.\n * @returns Promise resolving to availability for each satisfiable archetype\n */\n handlers(): Promise<IntentAvailability[]> {\n return requireNapplet().intent.handlers();\n },\n\n /**\n * Register for shell-pushed availability updates.\n * @param handler Called with each updated IntentAvailability\n * @returns A Subscription with `close()` to stop listening\n */\n onChanged(handler: (availability: IntentAvailability) => void): Subscription {\n return requireNapplet().intent.onChanged(handler);\n },\n};\n\n/**\n * Shell-mediated link opening (NAP-LINK): ask the shell to open an external URL\n * for user-visible navigation. The shell owns prompting, policy, opener\n * isolation, and browser context.\n *\n * @example\n * ```ts\n * import { link } from '@napplet/sdk';\n *\n * const result = await link.open('https://example.com/post/123', { label: 'Read post' });\n * ```\n */\nexport const link = {\n /**\n * Request that the shell open an external URL for the user.\n * @param url Absolute URL to open\n * @param options Optional prompt/display hints\n * @returns Promise resolving to the shell's open/deny status\n */\n open(url: string, options?: LinkOpenOptions): Promise<LinkOpenResult> {\n return requireNapplet().link.open(url, options);\n },\n};\n\n/**\n * Runtime-mediated serial device access (NAP-SERIAL): ask the shell to select\n * and open a user-approved serial session, write byte arrays to that session,\n * and receive shell-pushed state/data/close events. The shell owns raw port\n * handles, streams, OS paths, permissions, read loops, and lifecycle policy.\n *\n * @example\n * ```ts\n * import { serial } from '@napplet/sdk';\n *\n * const { session } = await serial.open({ options: { baudRate: 115200 } });\n * await serial.write(session.id, [112, 105, 110, 103, 10]);\n * ```\n */\nexport const serial = {\n /**\n * Ask the runtime to select and open a serial session.\n * @param request Filters, options, and optional chooser label\n * @returns Promise resolving to the runtime-assigned serial open result\n */\n open(request: SerialOpenRequest): Promise<SerialOpenResult> {\n return requireNapplet().serial.open(request);\n },\n\n /**\n * Write bytes to an open serial session.\n * @param sessionId Runtime-assigned serial session id\n * @param data Byte values to write\n * @returns Promise resolving after the runtime acknowledges the write\n */\n write(sessionId: string, data: Uint8Array | number[]): Promise<void> {\n return requireNapplet().serial.write(sessionId, data);\n },\n\n /**\n * Close an open serial session.\n * @param sessionId Runtime-assigned serial session id\n * @param reason Optional reason for the close request\n * @returns Promise resolving after the runtime acknowledges the close\n */\n close(sessionId: string, reason?: string): Promise<void> {\n return requireNapplet().serial.close(sessionId, reason);\n },\n\n /**\n * Register for shell-pushed serial events.\n * @param handler Called with each serial event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(handler: (event: SerialEvent) => void): Subscription {\n return requireNapplet().serial.onEvent(handler);\n },\n};\n","/**\n * @napplet/sdk -- Value re-exports from `@napplet/core` and `@napplet/nap/*`:\n * protocol constants, shim installers, and domain helper functions.\n *\n * @packageDocumentation\n */\n\nexport { NAP_DOMAINS } from '@napplet/core';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nap/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nap/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nap/storage';\nexport { DOMAIN as INC_DOMAIN } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link INC_DOMAIN}. This compatibility export resolves to\n * the canonical `inc` domain string.\n */\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nap/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nap/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nap/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nap/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nap/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nap/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nap/resource';\nexport { DOMAIN as CVM_DOMAIN } from '@napplet/nap/cvm';\nexport { DOMAIN as OUTBOX_DOMAIN } from '@napplet/nap/outbox';\nexport { DOMAIN as UPLOAD_DOMAIN } from '@napplet/nap/upload';\nexport { DOMAIN as INTENT_DOMAIN } from '@napplet/nap/intent';\nexport { DOMAIN as LINK_DOMAIN } from '@napplet/nap/link';\nexport { DOMAIN as SERIAL_DOMAIN } from '@napplet/nap/serial';\n\nexport { installRelayShim } from '@napplet/nap/relay';\nexport { installIdentityShim } from '@napplet/nap/identity';\nexport { installThemeShim } from '@napplet/nap/theme';\nexport { installStorageShim } from '@napplet/nap/storage';\nexport { installIncShim } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link installIncShim}.\n */\nexport { installIfcShim } from '@napplet/nap/ifc';\nexport { installKeysShim } from '@napplet/nap/keys';\nexport { installMediaShim } from '@napplet/nap/media';\nexport { installNotifyShim } from '@napplet/nap/notify';\nexport { installConfigShim } from '@napplet/nap/config';\nexport { installResourceShim } from '@napplet/nap/resource';\nexport { installCvmShim } from '@napplet/nap/cvm';\nexport { installOutboxShim } from '@napplet/nap/outbox';\nexport { installUploadShim } from '@napplet/nap/upload';\nexport { installIntentShim } from '@napplet/nap/intent';\nexport { installLinkShim } from '@napplet/nap/link';\nexport { installSerialShim } from '@napplet/nap/serial';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nap/relay';\nexport {\n identityGetPublicKey,\n identityOnChanged,\n identityGetRelays,\n identityGetProfile,\n identityGetFollows,\n identityGetList,\n identityGetZaps,\n identityGetMutes,\n identityGetBlocked,\n identityGetBadges,\n} from '@napplet/nap/identity';\nexport { themeGet, themeOnChanged } from '@napplet/nap/theme';\nexport {\n storageGetItem,\n storageSetItem,\n storageRemoveItem,\n storageKeys,\n storageInstanceGetItem,\n storageInstanceSetItem,\n storageInstanceRemoveItem,\n storageInstanceKeys,\n} from '@napplet/nap/storage';\nexport { incEmit, incOn } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link incEmit} and {@link incOn}.\n */\nexport { ifcEmit, ifcOn } from '@napplet/nap/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nap/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from '@napplet/nap/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nap/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';\nexport {\n cvmDiscover,\n cvmRequest,\n cvmListTools,\n cvmCallTool,\n cvmListResources,\n cvmReadResource,\n cvmClose,\n cvmOnEvent,\n} from '@napplet/nap/cvm';\nexport {\n outboxQuery,\n outboxSubscribe,\n outboxPublish,\n outboxResolveRelays,\n} from '@napplet/nap/outbox';\nexport {\n uploadFile,\n uploadStatus,\n uploadOnStatus,\n} from '@napplet/nap/upload';\nexport {\n intentInvoke,\n intentOpen,\n intentAvailable,\n intentHandlers,\n intentOnChanged,\n} from '@napplet/nap/intent';\nexport { linkOpen } from '@napplet/nap/link';\nexport {\n serialOpen,\n serialWrite,\n serialClose,\n serialOnEvent,\n} from '@napplet/nap/serial';\n"],"mappings":";AAcO,SAAS,iBAAgC;AAC9C,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,SAAS;AACd,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,SAAO,EAAE;AACX;;;ACWO,IAAM,QAAQ;AAAA;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AI/B,SAAS,SAAS,aAAa;AAC/B,SAAS,oBAAoB,sBAAsB,cAAc,oBAAoB;AACrF,SAAS,oBAAoB,oBAAoB,qBAAqB,kBAAkB,yBAAyB,kBAAkB,gBAAgB,cAAc,qBAAqB,uBAAuB;AAC7M,SAAS,YAAY,eAAe,aAAa,uBAAuB,yBAAyB,gBAAgB,iBAAiB,mBAAmB,wBAAwB;AAC7K,SAAS,eAAe,gCAAgC;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["DOMAIN"]}
|
|
1
|
+
{"version":3,"sources":["../src/require-napplet.ts","../src/relay.ts","../src/media.ts","../src/keys.ts","../src/config.ts","../src/cvm.ts","../src/services.ts","../src/nap-runtime.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Shared `window.napplet` accessor for SDK wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal } from '@napplet/core';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nexport function requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n","/**\n * @napplet/sdk -- Relay, inter-napplet pubsub, and storage wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-napplet pubsub: broadcast and receive INC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { inc } from '@napplet/sdk';\n *\n * inc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = inc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const inc = {\n /**\n * Broadcast an INC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().inc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to INC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().inc.on(topic, callback);\n },\n};\n\n/**\n * @deprecated Use {@link inc}. NAP-IFC was renamed to NAP-INC; this package\n * alias is kept only to ease downstream migration.\n */\nexport const ifc = inc;\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n\n /**\n * Per-instance storage: same surface as the shared methods, but scoped to this\n * napplet instance (sets `scope: \"instance\"` on the wire) rather than shared\n * across instances. Defer to NAP-STORAGE (napplet/naps) for scope semantics.\n */\n instance: {\n /**\n * Retrieve a per-instance value by key. Returns null if not found.\n * @param key The storage key\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.instance.getItem(key);\n },\n\n /**\n * Store a per-instance key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.instance.setItem(key, value);\n },\n\n /**\n * Remove a per-instance key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.instance.removeItem(key);\n },\n\n /**\n * List all per-instance keys for this napplet instance.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.instance.keys();\n },\n },\n};\n","/**\n * @napplet/sdk -- Media session and notification wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * owner: 'napplet',\n * metadata: { title: 'My Song', artist: 'The Artist' },\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param options Ownership-aware session options\n * @returns The shell result with canonical sessionId and owner, or error\n */\n createSession(options: MediaSessionCreate): Promise<MediaSessionResult> {\n return requireNapplet().media.createSession(options);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: MediaState): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: MediaAction[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Send a command to the current playback owner.\n * @param sessionId The session to control\n * @param action The media action to request\n * @param value Optional value for seek/volume\n */\n sendCommand(sessionId: string, action: MediaAction, value?: number): void {\n requireNapplet().media.sendCommand(sessionId, action, value);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: MediaAction, value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported playback state for shell-owned sessions.\n * @param sessionId The session to listen for state on\n * @param callback Called with playback state\n * @returns A Subscription with `close()` to stop listening\n */\n onState(\n sessionId: string,\n callback: (state: MediaState) => void,\n ): Subscription {\n return requireNapplet().media.onState(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported capabilities for shell-owned sessions.\n * @param sessionId The session to listen for capabilities on\n * @param callback Called with available actions\n * @returns A Subscription with `close()` to stop listening\n */\n onCapabilities(\n sessionId: string,\n callback: (actions: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onCapabilities(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n","/**\n * @napplet/sdk -- Keyboard action and read-only identity wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Listen for shell-pushed user identity changes.\n * @param handler Called with a hex pubkey, or \"\" when no user/signer is connected\n * @returns Subscription with close() to detach the handler\n */\n onChanged(handler: (pubkey: string) => void): Subscription {\n return requireNapplet().identity.onChanged(handler);\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n","/**\n * @napplet/sdk -- Declarative config and resource byte-fetch wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { Subscription } from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Per-napplet declarative configuration (NAP-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n","/**\n * @napplet/sdk -- ContextVM bridge, outbox routing, upload, intent, and WebRTC\n * wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrFilter,\n Subscription,\n EventTemplate,\n CvmServerRef,\n CvmServer,\n CvmDiscoverQuery,\n CvmRequestOptions,\n McpMessage,\n McpTool,\n McpToolResult,\n McpResource,\n McpResourceContent,\n OutboxQueryOptions,\n OutboxSubscribeOptions,\n OutboxPublishOptions,\n OutboxTarget,\n OutboxRelayPlan,\n OutboxResult,\n OutboxPublishResult,\n OutboxSubscription,\n UploadRequest,\n UploadResult,\n UploadStatus,\n IntentRequest,\n IntentResult,\n IntentAvailability,\n WebrtcOpenRequest,\n WebrtcOpenResult,\n WebrtcEvent,\n} from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Native ContextVM bridge (NAP-CVM): MCP-over-Nostr access mediated by the shell.\n * The shell owns ContextVM transport, signing, encryption, correlation, policy,\n * and payment; napplets supply a server identity and the MCP operation they want.\n *\n * @example\n * ```ts\n * import { cvm } from '@napplet/sdk';\n *\n * const servers = await cvm.discover({ search: 'relay' });\n * const tools = await cvm.listTools(servers[0]);\n * const result = await cvm.callTool(servers[0], tools[0].name, {});\n * ```\n */\nexport const cvm = {\n /**\n * Discover public ContextVM servers known to the shell.\n * @param query Optional discovery filter\n * @returns Promise resolving to the discovered servers\n */\n discover(query?: CvmDiscoverQuery): Promise<CvmServer[]> {\n return requireNapplet().cvm.discover(query);\n },\n\n /**\n * Send a raw MCP JSON-RPC message to a ContextVM server.\n * @param server Target ContextVM server\n * @param message MCP JSON-RPC message\n * @param options Optional per-request options\n * @returns Promise resolving to the MCP response message\n */\n request(\n server: CvmServerRef,\n message: McpMessage,\n options?: CvmRequestOptions,\n ): Promise<McpMessage> {\n return requireNapplet().cvm.request(server, message, options);\n },\n\n /**\n * List the tools exposed by a ContextVM server (MCP `tools/list`).\n * @param server Target ContextVM server\n * @param options Optional per-request options\n */\n listTools(server: CvmServerRef, options?: CvmRequestOptions): Promise<McpTool[]> {\n return requireNapplet().cvm.listTools(server, options);\n },\n\n /**\n * Call a tool on a ContextVM server (MCP `tools/call`).\n * @param server Target ContextVM server\n * @param name Tool name\n * @param args Tool arguments\n * @param options Optional per-request options\n */\n callTool(\n server: CvmServerRef,\n name: string,\n args?: Record<string, unknown>,\n options?: CvmRequestOptions,\n ): Promise<McpToolResult> {\n return requireNapplet().cvm.callTool(server, name, args, options);\n },\n\n /**\n * List the resources exposed by a ContextVM server (MCP `resources/list`).\n * @param server Target ContextVM server\n * @param options Optional per-request options\n */\n listResources(server: CvmServerRef, options?: CvmRequestOptions): Promise<McpResource[]> {\n return requireNapplet().cvm.listResources(server, options);\n },\n\n /**\n * Read a resource from a ContextVM server (MCP `resources/read`).\n * @param server Target ContextVM server\n * @param uri Resource URI\n * @param options Optional per-request options\n */\n readResource(\n server: CvmServerRef,\n uri: string,\n options?: CvmRequestOptions,\n ): Promise<McpResourceContent> {\n return requireNapplet().cvm.readResource(server, uri, options);\n },\n\n /**\n * Close shell-maintained session state for a server.\n * @param server Server whose session should be torn down\n */\n close(server: CvmServerRef): Promise<void> {\n return requireNapplet().cvm.close(server);\n },\n\n /**\n * Listen for server-pushed MCP messages (`cvm.event`).\n * @param callback Called with `(server, message)` for each server event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(\n callback: (server: CvmServerRef, message: McpMessage) => void,\n ): Subscription {\n return requireNapplet().cvm.onEvent(callback);\n },\n};\n\n/**\n * Outbox-aware relay routing (NAP-OUTBOX): supply Nostr filters and intent and\n * let the shell discover the correct relays (NIP-65 write/read relays, fallbacks,\n * relay intelligence), query/deduplicate, validate signatures, and stream updates.\n * The shell owns relay discovery, routing, fallback, deduplication, signing, and\n * publish fanout.\n *\n * @example\n * ```ts\n * import { outbox } from '@napplet/sdk';\n *\n * const { events } = await outbox.query([{ authors: ['ab12...'], kinds: [1] }], { strategy: 'outbox' });\n * const sub = outbox.subscribe([{ kinds: [1] }], { live: true });\n * sub.on('event', (event, relay) => render(event, relay));\n * ```\n */\nexport const outbox = {\n /**\n * Perform a one-shot outbox-aware query.\n * @param filters NIP-01 filter or filters\n * @param options Optional query options\n * @returns Promise resolving to the outbox result\n */\n query(\n filters: NostrFilter | NostrFilter[],\n options?: OutboxQueryOptions,\n ): Promise<OutboxResult> {\n return requireNapplet().outbox.query(filters, options);\n },\n\n /**\n * Open a live outbox-aware subscription.\n * @param filters NIP-01 filter or filters\n * @param options Optional subscribe options\n * @returns An OutboxSubscription handle with `on(...)` and `close()`\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n options?: OutboxSubscribeOptions,\n ): OutboxSubscription {\n return requireNapplet().outbox.subscribe(filters, options);\n },\n\n /**\n * Publish a shell-signed event using outbox-aware relay fanout.\n * @param template Unsigned event template\n * @param options Optional publish options\n * @returns Promise resolving to the outbox publish result\n */\n publish(\n template: EventTemplate,\n options?: OutboxPublishOptions,\n ): Promise<OutboxPublishResult> {\n return requireNapplet().outbox.publish(template, options);\n },\n\n /**\n * Resolve the relay plan the shell would use for a read/write target.\n * @param target The read/write target\n * @returns Promise resolving to the relay plan\n */\n resolveRelays(target: OutboxTarget): Promise<OutboxRelayPlan> {\n return requireNapplet().outbox.resolveRelays(target);\n },\n};\n\n/**\n * Shell-mediated file/blob upload (NAP-UPLOAD): hand the shell raw bytes plus\n * upload intent; the shell selects a server, signs the rail authorization\n * (NIP-98 for NIP-96, kind 24242 for Blossom), performs the HTTP upload, and\n * returns a stable URL plus NIP-94 integrity metadata. The shell owns consent,\n * policy, server selection, and signing.\n *\n * @example\n * ```ts\n * import { upload } from '@napplet/sdk';\n *\n * const result = await upload.upload({ data: blob, filename: 'pic.png' });\n * if (result.status === 'complete') attach(result.url, result.nip94);\n * ```\n */\nexport const upload = {\n /**\n * Upload bytes through the shell's storage pipeline.\n * @param request The upload request (Blob/ArrayBuffer bytes + intent)\n * @returns Promise resolving to the initial upload result\n */\n upload(request: UploadRequest): Promise<UploadResult> {\n return requireNapplet().upload.upload(request);\n },\n\n /**\n * Get the latest known status for a prior upload.\n * @param uploadId The shell-generated upload id\n * @returns Promise resolving to the latest status\n */\n status(uploadId: string): Promise<UploadStatus> {\n return requireNapplet().upload.status(uploadId);\n },\n\n /**\n * Register for shell-pushed upload status updates.\n * @param handler Called with each new UploadStatus\n * @returns A Subscription with `close()` to stop listening\n */\n onStatus(handler: (status: UploadStatus) => void): Subscription {\n return requireNapplet().upload.onStatus(handler);\n },\n};\n\n/**\n * Archetype intent dispatch (NAP-INTENT): invoke another napplet by its role\n * without addressing it directly. The shell resolves the role to an installed\n * napplet (honoring the user's default), opens/focuses its window, and delivers\n * the payload using the named NAP-N protocol. The shell owns resolution, default\n * handling, window lifecycle, and the cross-napplet trust boundary.\n *\n * @example\n * ```ts\n * import { intent } from '@napplet/sdk';\n *\n * if ((await intent.available('note')).available) {\n * await intent.open('note', { target: { type: 'event', id } });\n * }\n * ```\n */\nexport const intent = {\n /**\n * Invoke a napplet by archetype.\n * @param request The intent request (archetype + action + payload + routing)\n * @returns Promise resolving to the invocation result\n */\n invoke(request: IntentRequest): Promise<IntentResult> {\n return requireNapplet().intent.invoke(request);\n },\n\n /**\n * Open a napplet by archetype (sugar for `action: \"open\"`).\n * @param archetype Role slug to open\n * @param payload Opaque payload (typed by the resolved protocol)\n * @param opts Extra request fields (protocol, handler, behavior)\n * @returns Promise resolving to the invocation result\n */\n open(\n archetype: string,\n payload?: unknown,\n opts?: Omit<IntentRequest, 'archetype' | 'action' | 'payload'>,\n ): Promise<IntentResult> {\n return requireNapplet().intent.open(archetype, payload, opts);\n },\n\n /**\n * Check whether the runtime can currently satisfy an archetype and expose the\n * manifest-derived contracts each candidate serves.\n * @param archetype Role slug to check\n * @returns Promise resolving to the archetype availability\n */\n available(archetype: string): Promise<IntentAvailability> {\n return requireNapplet().intent.available(archetype);\n },\n\n /**\n * Get availability for every archetype the runtime can satisfy.\n * @returns Promise resolving to availability for each satisfiable archetype\n */\n handlers(): Promise<IntentAvailability[]> {\n return requireNapplet().intent.handlers();\n },\n\n /**\n * Register for shell-pushed availability updates.\n * @param handler Called with each updated IntentAvailability\n * @returns A Subscription with `close()` to stop listening\n */\n onChanged(handler: (availability: IntentAvailability) => void): Subscription {\n return requireNapplet().intent.onChanged(handler);\n },\n};\n\n/**\n * Runtime-mediated WebRTC sessions (NAP-WEBRTC). The shell owns signaling,\n * signing/encryption, SDP, ICE, and peer-connection lifecycle; napplets exchange\n * only opaque application payloads over shell-scoped sessions.\n *\n * @example\n * ```ts\n * import { webrtc } from '@napplet/sdk';\n *\n * const { session } = await webrtc.open({ scope: { type: 'direct', pubkey } });\n * await webrtc.send(session.id, { body: 'hello' });\n * ```\n */\nexport const webrtc = {\n /**\n * Open a runtime-owned WebRTC session.\n * @param request Session scope and channel/protocol labels\n * @returns Promise resolving to the opened session result\n */\n open(request: WebrtcOpenRequest): Promise<WebrtcOpenResult> {\n return requireNapplet().webrtc.open(request);\n },\n\n /**\n * Send an opaque application payload over a session.\n * @param sessionId WebRTC session id\n * @param payload Application payload\n */\n send(sessionId: string, payload: unknown): Promise<void> {\n return requireNapplet().webrtc.send(sessionId, payload);\n },\n\n /**\n * Close a WebRTC session.\n * @param sessionId WebRTC session id\n * @param reason Optional close reason\n */\n close(sessionId: string, reason?: string): Promise<void> {\n return requireNapplet().webrtc.close(sessionId, reason);\n },\n\n /**\n * Subscribe to runtime-pushed WebRTC events.\n * @param handler Event handler\n * @returns Subscription handle\n */\n onEvent(handler: (event: WebrtcEvent) => void): Subscription {\n return requireNapplet().webrtc.onEvent(handler);\n },\n};\n","/**\n * @napplet/sdk -- Link, lists, common, and serial wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n LinkOpenOptions,\n LinkOpenResult,\n ListItem,\n ListMutationResult,\n ListOptions,\n ListRef,\n ListSupport,\n CommonActionResult,\n CommonFollowsResult,\n CommonNip19DecodeResult,\n CommonNip19EncodeInput,\n CommonNip19EncodeResult,\n CommonProfileResult,\n CommonProfileTarget,\n CommonReaction,\n CommonReportReason,\n CommonReportTarget,\n SerialEvent,\n SerialOpenRequest,\n SerialOpenResult,\n Subscription,\n} from '@napplet/core';\nimport { requireNapplet } from './require-napplet.js';\n\n/**\n * Shell-mediated link opening (NAP-LINK): ask the shell to open an external URL\n * for user-visible navigation. The shell owns prompting, policy, opener\n * isolation, and browser context.\n *\n * @example\n * ```ts\n * import { link } from '@napplet/sdk';\n *\n * const result = await link.open('https://example.com/post/123', { label: 'Read post' });\n * ```\n */\nexport const link = {\n /**\n * Request that the shell open an external URL for the user.\n * @param url Absolute URL to open\n * @param options Optional prompt/display hints\n * @returns Promise resolving to the shell's open/deny status\n */\n open(url: string, options?: LinkOpenOptions): Promise<LinkOpenResult> {\n return requireNapplet().link.open(url, options);\n },\n};\n\n/**\n * Runtime-mediated NIP-51 list mutations (NAP-LISTS): add or remove semantic\n * items from supported NIP-51 lists while the runtime owns lookup, merge,\n * encryption, signing, and publishing.\n *\n * @example\n * ```ts\n * import { lists } from '@napplet/sdk';\n *\n * await lists.add({ type: 'mute-list' }, [\n * { itemType: 'pubkey', value: 'abc123...' },\n * ]);\n * ```\n */\nexport const lists = {\n /**\n * Return the NIP-51 list kinds/types this runtime supports.\n * @returns Promise resolving to supported list descriptions\n */\n supported(): Promise<ListSupport[]> {\n return requireNapplet().lists.supported();\n },\n\n /**\n * Add items to a runtime-supported NIP-51 list.\n * @param list List reference by kind or derived type\n * @param items Items to add\n * @param options Optional create/metadata hints\n */\n add(list: ListRef, items: ListItem[], options?: ListOptions): Promise<ListMutationResult> {\n return requireNapplet().lists.add(list, items, options);\n },\n\n /**\n * Remove items from a runtime-supported NIP-51 list.\n * @param list List reference by kind or derived type\n * @param items Items to remove\n * @param options Optional runtime hints\n */\n remove(list: ListRef, items: ListItem[], options?: ListOptions): Promise<ListMutationResult> {\n return requireNapplet().lists.remove(list, items, options);\n },\n};\n\n/**\n * Common social actions (NAP-COMMON): shell-mediated public NIP-19 helpers,\n * profile lookup, follows, follow/unfollow, reactions, and reports. The shell\n * owns identity, consent, event construction, signing, publishing, relay access,\n * and NIP-19 handling.\n *\n * @example\n * ```ts\n * import { common } from '@napplet/sdk';\n *\n * const { pubkeys } = await common.follows();\n * await common.react(noteId, '+');\n * ```\n */\nexport const common = {\n /**\n * Encode a supported public NIP-19 value.\n * @param input Structured NIP-19 encode input\n * @returns Promise resolving to the shell encode result\n */\n encodeNip19(input: CommonNip19EncodeInput): Promise<CommonNip19EncodeResult> {\n return requireNapplet().common.encodeNip19(input);\n },\n\n /**\n * Decode a supported public NIP-19 value.\n * @param value NIP-19 value to decode\n * @returns Promise resolving to normalized decoded fields\n */\n decodeNip19(value: string): Promise<CommonNip19DecodeResult> {\n return requireNapplet().common.decodeNip19(value);\n },\n\n /**\n * Resolve a profile by hex pubkey, npub, or nprofile.\n * @param target Profile target\n * @returns Promise resolving to latest profile data when available\n */\n getProfile(target: CommonProfileTarget): Promise<CommonProfileResult> {\n return requireNapplet().common.getProfile(target);\n },\n\n /**\n * Return the shell user's followed pubkeys as hex.\n * @returns Promise resolving to followed pubkeys\n */\n follows(): Promise<CommonFollowsResult> {\n return requireNapplet().common.follows();\n },\n\n /**\n * Ask the shell to follow one or more npub targets.\n * @param pubkeys Npub targets to follow\n * @returns Promise resolving to the action result\n */\n follow(...pubkeys: string[]): Promise<CommonActionResult> {\n return requireNapplet().common.follow(...pubkeys);\n },\n\n /**\n * Ask the shell to unfollow one or more npub targets.\n * @param pubkeys Npub targets to unfollow\n * @returns Promise resolving to the action result\n */\n unfollow(...pubkeys: string[]): Promise<CommonActionResult> {\n return requireNapplet().common.unfollow(...pubkeys);\n },\n\n /**\n * React to a native Nostr event.\n * @param targetEventId Event id to react to\n * @param reaction Reaction content\n * @param customEmojiHref Optional custom emoji URL\n * @returns Promise resolving to the action result\n */\n react(\n targetEventId: string,\n reaction: CommonReaction,\n customEmojiHref?: string,\n ): Promise<CommonActionResult> {\n return requireNapplet().common.react(targetEventId, reaction, customEmojiHref);\n },\n\n /**\n * Report an event or pubkey with a NIP-56 reason.\n * @param target Structured report target\n * @param reason NIP-56 report reason\n * @param text Report text\n * @returns Promise resolving to the action result\n */\n report(\n target: CommonReportTarget,\n reason: CommonReportReason,\n text: string,\n ): Promise<CommonActionResult> {\n return requireNapplet().common.report(target, reason, text);\n },\n};\n\n/**\n * Runtime-mediated serial device access (NAP-SERIAL): ask the shell to select\n * and open a user-approved serial session, write byte arrays to that session,\n * and receive shell-pushed state/data/close events. The shell owns raw port\n * handles, streams, OS paths, permissions, read loops, and lifecycle policy.\n *\n * @example\n * ```ts\n * import { serial } from '@napplet/sdk';\n *\n * const { session } = await serial.open({ options: { baudRate: 115200 } });\n * await serial.write(session.id, [112, 105, 110, 103, 10]);\n * ```\n */\nexport const serial = {\n /**\n * Ask the runtime to select and open a serial session.\n * @param request Filters, options, and optional chooser label\n * @returns Promise resolving to the runtime-assigned serial open result\n */\n open(request: SerialOpenRequest): Promise<SerialOpenResult> {\n return requireNapplet().serial.open(request);\n },\n\n /**\n * Write bytes to an open serial session.\n * @param sessionId Runtime-assigned serial session id\n * @param data Byte values to write\n * @returns Promise resolving after the runtime acknowledges the write\n */\n write(sessionId: string, data: Uint8Array | number[]): Promise<void> {\n return requireNapplet().serial.write(sessionId, data);\n },\n\n /**\n * Close an open serial session.\n * @param sessionId Runtime-assigned serial session id\n * @param reason Optional reason for the close request\n * @returns Promise resolving after the runtime acknowledges the close\n */\n close(sessionId: string, reason?: string): Promise<void> {\n return requireNapplet().serial.close(sessionId, reason);\n },\n\n /**\n * Register for shell-pushed serial events.\n * @param handler Called with each serial event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(handler: (event: SerialEvent) => void): Subscription {\n return requireNapplet().serial.onEvent(handler);\n },\n};\n","/**\n * @napplet/sdk -- Value re-exports from `@napplet/core` and `@napplet/nap/*`:\n * protocol constants, shim installers, and domain helper functions.\n *\n * @packageDocumentation\n */\n\nexport { NAP_DOMAINS } from '@napplet/core';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nap/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nap/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nap/storage';\nexport { DOMAIN as INC_DOMAIN } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link INC_DOMAIN}. This compatibility export resolves to\n * the canonical `inc` domain string.\n */\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nap/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nap/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nap/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nap/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nap/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nap/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nap/resource';\nexport { DOMAIN as CVM_DOMAIN } from '@napplet/nap/cvm';\nexport { DOMAIN as OUTBOX_DOMAIN } from '@napplet/nap/outbox';\nexport { DOMAIN as UPLOAD_DOMAIN } from '@napplet/nap/upload';\nexport { DOMAIN as INTENT_DOMAIN } from '@napplet/nap/intent';\nexport { DOMAIN as WEBRTC_DOMAIN } from '@napplet/nap/webrtc';\nexport { DOMAIN as LINK_DOMAIN } from '@napplet/nap/link';\nexport { DOMAIN as LISTS_DOMAIN } from '@napplet/nap/lists';\nexport { DOMAIN as COMMON_DOMAIN } from '@napplet/nap/common';\nexport { DOMAIN as SERIAL_DOMAIN } from '@napplet/nap/serial';\n\nexport { installRelayShim } from '@napplet/nap/relay';\nexport { installIdentityShim } from '@napplet/nap/identity';\nexport { installThemeShim } from '@napplet/nap/theme';\nexport { installStorageShim } from '@napplet/nap/storage';\nexport { installIncShim } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link installIncShim}.\n */\nexport { installIfcShim } from '@napplet/nap/ifc';\nexport { installKeysShim } from '@napplet/nap/keys';\nexport { installMediaShim } from '@napplet/nap/media';\nexport { installNotifyShim } from '@napplet/nap/notify';\nexport { installConfigShim } from '@napplet/nap/config';\nexport { installResourceShim } from '@napplet/nap/resource';\nexport { installCvmShim } from '@napplet/nap/cvm';\nexport { installOutboxShim } from '@napplet/nap/outbox';\nexport { installUploadShim } from '@napplet/nap/upload';\nexport { installIntentShim } from '@napplet/nap/intent';\nexport { installWebrtcShim } from '@napplet/nap/webrtc';\nexport { installLinkShim } from '@napplet/nap/link';\nexport { installListsShim } from '@napplet/nap/lists';\nexport { installCommonShim } from '@napplet/nap/common';\nexport { installSerialShim } from '@napplet/nap/serial';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nap/relay';\nexport {\n identityGetPublicKey,\n identityOnChanged,\n identityGetRelays,\n identityGetProfile,\n identityGetFollows,\n identityGetList,\n identityGetZaps,\n identityGetMutes,\n identityGetBlocked,\n identityGetBadges,\n} from '@napplet/nap/identity';\nexport { themeGet, themeOnChanged } from '@napplet/nap/theme';\nexport {\n storageGetItem,\n storageSetItem,\n storageRemoveItem,\n storageKeys,\n storageInstanceGetItem,\n storageInstanceSetItem,\n storageInstanceRemoveItem,\n storageInstanceKeys,\n} from '@napplet/nap/storage';\nexport { incEmit, incOn } from '@napplet/nap/inc';\n/**\n * @deprecated Use {@link incEmit} and {@link incOn}.\n */\nexport { ifcEmit, ifcOn } from '@napplet/nap/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nap/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from '@napplet/nap/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nap/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';\nexport {\n cvmDiscover,\n cvmRequest,\n cvmListTools,\n cvmCallTool,\n cvmListResources,\n cvmReadResource,\n cvmClose,\n cvmOnEvent,\n} from '@napplet/nap/cvm';\nexport {\n outboxQuery,\n outboxSubscribe,\n outboxPublish,\n outboxResolveRelays,\n} from '@napplet/nap/outbox';\nexport {\n uploadFile,\n uploadStatus,\n uploadOnStatus,\n} from '@napplet/nap/upload';\nexport {\n intentInvoke,\n intentOpen,\n intentAvailable,\n intentHandlers,\n intentOnChanged,\n} from '@napplet/nap/intent';\nexport { linkOpen } from '@napplet/nap/link';\nexport {\n listsSupported,\n listsAdd,\n listsRemove,\n} from '@napplet/nap/lists';\nexport {\n commonEncodeNip19,\n commonDecodeNip19,\n commonGetProfile,\n commonFollows,\n commonFollow,\n commonUnfollow,\n commonReact,\n commonReport,\n} from '@napplet/nap/common';\nexport {\n webrtcOpen,\n webrtcSend,\n webrtcClose,\n webrtcOnEvent,\n} from '@napplet/nap/webrtc';\nexport {\n serialOpen,\n serialWrite,\n serialClose,\n serialOnEvent,\n} from '@napplet/nap/serial';\n"],"mappings":";AAcO,SAAS,iBAAgC;AAC9C,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,SAAS;AACd,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,SAAO,EAAE;AACX;;;ACWO,IAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnB,UACE,SACA,SACA,QACA,SACc;AACd,WAAO,eAAe,EAAE,MAAM,UAAU,SAAS,SAAS,QAAQ,OAAO;AAAA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;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["DOMAIN"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napplet/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Typed named exports wrapping window.napplet for bundler-consuming napplet developers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@napplet/core": "0.
|
|
24
|
-
"@napplet/nap": "0.
|
|
23
|
+
"@napplet/core": "0.19.0",
|
|
24
|
+
"@napplet/nap": "0.19.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsup": "^8.5.0",
|