@napplet/sdk 0.30.0 → 0.31.1
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 +37 -7
- package/dist/{chunk-M5L22G22.js → chunk-GF2NV43T.js} +4 -20
- package/dist/chunk-GF2NV43T.js.map +1 -0
- package/dist/chunk-IQSY6FJF.js +23 -0
- package/dist/chunk-IQSY6FJF.js.map +1 -0
- package/dist/chunk-OMPYTH3E.js +50 -0
- package/dist/chunk-OMPYTH3E.js.map +1 -0
- package/dist/gamepad.js +2 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/llm.d.ts +14 -0
- package/dist/llm.js +28 -0
- package/dist/llm.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-M5L22G22.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> Named TypeScript exports for napplet developers using a bundler. Wraps `window.napplet` at call time.
|
|
4
4
|
|
|
5
|
+
NAP proposal status and shipped implementation maturity are separate. All capabilities can change. Inspect `NAP_IMPLEMENTATIONS` from `@napplet/core` and use `selectNapDomains` for local host opt-in policy. See [maturity and opt-in guidance](https://napplet.run/docs/naps/maturity.html).
|
|
6
|
+
|
|
5
7
|
## Getting Started
|
|
6
8
|
|
|
7
9
|
### Prerequisites
|
|
@@ -95,14 +97,14 @@ const configSub = config.subscribe((v) => {
|
|
|
95
97
|
config.openSettings({ section: 'appearance' });
|
|
96
98
|
|
|
97
99
|
// Fetch external bytes through the runtime's NAP-RESOURCE surface
|
|
98
|
-
const avatarBlob = await resource.bytes('blossom:
|
|
100
|
+
const avatarBlob = await resource.bytes('blossom:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.bin', {
|
|
99
101
|
servers: ['https://cdn.hzrd149.com'],
|
|
100
102
|
});
|
|
101
103
|
const resourceItems = await resource.bytesMany([
|
|
102
104
|
{ url: 'https://example.com/avatar.png' },
|
|
103
|
-
{ url: 'blossom:
|
|
105
|
+
{ url: 'blossom:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.bin', servers: ['https://cdn.hzrd149.com'] },
|
|
104
106
|
]);
|
|
105
|
-
const handle = resource.bytesAsObjectURL('blossom:
|
|
107
|
+
const handle = resource.bytesAsObjectURL('blossom:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.bin');
|
|
106
108
|
imgEl.src = handle.url;
|
|
107
109
|
// handle.revoke() when done
|
|
108
110
|
|
|
@@ -295,7 +297,7 @@ Sandboxed byte fetching (NAP-RESOURCE). Mirrors `window.napplet.resource`; loadi
|
|
|
295
297
|
| `bytesMany(requests, opts?)` | `Promise<ResourceBytesItem[]>` | Fetch many per-resource requests through one envelope. Each request may carry advisory Blossom `servers`; items preserve input order and length. |
|
|
296
298
|
| `bytesAsObjectURL(url)` | `{ url: string; revoke: () => void }` | Synchronous handle whose `url` resolves to a blob URL once the fetch completes. |
|
|
297
299
|
|
|
298
|
-
Canonical schemes: `data:` (in-shim), `https:` (shell-side under policy), `blossom
|
|
300
|
+
Canonical schemes: `data:` (in-shim), `https:` (shell-side under policy), `blossom:<sha256>.<ext>` ([BUD-10](https://github.com/hzrd149/blossom/blob/master/buds/10.md), hash-verified), `htree:` (Hashtree-verified), `nostr:<bech32>` (single-hop NIP-19).
|
|
299
301
|
|
|
300
302
|
Bare helper aliases are also re-exported for consumers that prefer functional imports:
|
|
301
303
|
|
|
@@ -305,7 +307,7 @@ import { resourceInfo, resourceBytes, resourceBytesMany, resourceBytesAsObjectUR
|
|
|
305
307
|
const info = await resourceInfo();
|
|
306
308
|
const blob = await resourceBytes('https://example.com/avatar.png');
|
|
307
309
|
const items = await resourceBytesMany(['https://example.com/a.png']);
|
|
308
|
-
const handle = resourceBytesAsObjectURL('blossom
|
|
310
|
+
const handle = resourceBytesAsObjectURL('blossom:<sha256>.png');
|
|
309
311
|
```
|
|
310
312
|
|
|
311
313
|
### `keys`
|
|
@@ -419,6 +421,7 @@ These are discriminated union types covering all messages in each NAP domain. Us
|
|
|
419
421
|
| `ListsNapMessage` | `@napplet/nap/lists` | Discriminated union of all lists domain messages |
|
|
420
422
|
| `CommonNapMessage` | `@napplet/nap/common` | Discriminated union of all common domain messages |
|
|
421
423
|
| `GamepadNapMessage` | `@napplet/nap/gamepad` | Subscribe, unsubscribe, and state envelopes without correlation ids |
|
|
424
|
+
| `LlmNapMessage` | `@napplet/nap/llm` | Four request/result pairs plus the unsolicited `llm.delta`; results carry exactly one of their success field or `error` |
|
|
422
425
|
| `SerialNapMessage` | `@napplet/nap/serial` | Discriminated union of all serial domain messages |
|
|
423
426
|
|
|
424
427
|
Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMessage`) are also re-exported from `@napplet/sdk` for fine-grained typing.
|
|
@@ -428,8 +431,8 @@ Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMe
|
|
|
428
431
|
Each NAP domain has a string constant re-exported from its package:
|
|
429
432
|
|
|
430
433
|
```ts
|
|
431
|
-
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, BLE_DOMAIN, WEBRTC_DOMAIN, LINK_DOMAIN, COUNT_DOMAIN, LISTS_DOMAIN, COMMON_DOMAIN, SERIAL_DOMAIN, DM_DOMAIN } from '@napplet/sdk';
|
|
432
|
-
// Values: 'relay', 'identity', 'storage', 'inc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'cvm', 'outbox', 'upload', 'intent', 'ble', 'webrtc', 'link', 'count', 'lists', 'common', 'serial', 'fs', 'dm', 'shell', 'gamepad'
|
|
434
|
+
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, BLE_DOMAIN, WEBRTC_DOMAIN, LINK_DOMAIN, COUNT_DOMAIN, LISTS_DOMAIN, COMMON_DOMAIN, SERIAL_DOMAIN, DM_DOMAIN, LLM_DOMAIN } from '@napplet/sdk';
|
|
435
|
+
// Values: 'relay', 'identity', 'storage', 'inc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'cvm', 'outbox', 'upload', 'intent', 'ble', 'webrtc', 'link', 'count', 'lists', 'common', 'serial', 'fs', 'dm', 'shell', 'gamepad', 'llm'
|
|
433
436
|
```
|
|
434
437
|
|
|
435
438
|
These constants are re-exported from the individual domain packages. Use property presence for type-safe conditional logic:
|
|
@@ -527,3 +530,30 @@ if (window.napplet?.gamepad) {
|
|
|
527
530
|
```
|
|
528
531
|
|
|
529
532
|
Declare `gamepad` as optional (`O`) when other controls fulfill the core task. Use a hard requirement (`R`) only when the core task needs controller input. The runtime owns controller access and focus isolation; app code does not call native `navigator.getGamepads()` or open raw HID devices. Haptics and remapping are outside this proposal.
|
|
533
|
+
|
|
534
|
+
### Language model inference
|
|
535
|
+
|
|
536
|
+
This non-normative guide follows the living [NAP-LLM proposal](https://github.com/napplet/naps/pull/134). Import `llm` from `@napplet/sdk` or `@napplet/sdk/llm`; root exports include prefixed helpers such as `llmSelect` and `llmGenerate`. The dedicated subpath also provides bare aliases such as `select` and `generate`.
|
|
537
|
+
|
|
538
|
+
The API exposes `select`, `describe`, `generate`, and `cancel`. `generate` returns a pending promise that exposes `requestId`; pass `onDelta` for ordered provisional text and `signal` to map an abort to `llm.cancel`, and replace provisional text with the terminal `text`. Each method resolves with the proposal's result record; a runtime `Error` record rejects with an `Error` carrying the specification `code`, recognizable with `isLlmFailure(error)`, while the binding's own transport timeout rejects without a `code`.
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
import { llm, isLlmFailure } from '@napplet/sdk/llm';
|
|
542
|
+
|
|
543
|
+
if (window.napplet?.llm) {
|
|
544
|
+
try {
|
|
545
|
+
const model = await llm.select({ json: true });
|
|
546
|
+
const generation = await llm.generate({
|
|
547
|
+
handle: model.handle,
|
|
548
|
+
messages: [{ role: 'user', content: [{ type: 'text', text: 'Return a JSON object with a greeting.' }] }],
|
|
549
|
+
format: 'json',
|
|
550
|
+
});
|
|
551
|
+
if (generation.finish === 'stop') render(JSON.parse(generation.text));
|
|
552
|
+
} catch (error) {
|
|
553
|
+
if (isLlmFailure(error)) console.warn(error.code, error.message);
|
|
554
|
+
else throw error;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
Selection does not authorize disclosure: the runtime obtains consent before each generation and may answer `user-cancelled`. Only `finish: "stop"` is complete output. Handles are endpoint-scoped and expire when the connection, account, or endpoint changes. The runtime owns connections, credentials, consent, and provider access; model output is untrusted text.
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (!w.napplet) {
|
|
5
|
-
throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");
|
|
6
|
-
}
|
|
7
|
-
return w.napplet;
|
|
8
|
-
}
|
|
9
|
-
function requireDomain(domain) {
|
|
10
|
-
const napplet = requireNapplet();
|
|
11
|
-
const value = napplet[domain];
|
|
12
|
-
if (!value) {
|
|
13
|
-
throw new Error(
|
|
14
|
-
`window.napplet.${String(domain)} is unavailable -- runtime did not inject this domain`
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
requireDomain
|
|
3
|
+
} from "./chunk-IQSY6FJF.js";
|
|
19
4
|
|
|
20
5
|
// src/gamepad.ts
|
|
21
6
|
import { gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from "@napplet/nap/gamepad/sdk";
|
|
@@ -46,11 +31,10 @@ var gamepad = {
|
|
|
46
31
|
};
|
|
47
32
|
|
|
48
33
|
export {
|
|
49
|
-
requireDomain,
|
|
50
34
|
gamepad,
|
|
51
35
|
gamepadGetGamepads,
|
|
52
36
|
gamepadAvailable,
|
|
53
37
|
gamepadFocused,
|
|
54
38
|
gamepadOnChange
|
|
55
39
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-GF2NV43T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gamepad.ts"],"sourcesContent":["/** Application-side cached controller input. Guard optional domain presence before use. */\nimport type { GamepadApi, GamepadSlot, GamepadState, Subscription } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\n/**\n * Controller snapshots delivered by the runtime to this napplet.\n * @example\n * import { gamepad } from '@napplet/sdk/gamepad';\n * const pads = gamepad.getGamepads();\n */\nexport const gamepad: GamepadApi = {\n get available(): boolean { return requireDomain('gamepad').available; },\n get focused(): boolean { return requireDomain('gamepad').focused; },\n /**\n * Read the complete cached slot list synchronously.\n * @returns Latest controller slots.\n * @example const pads = gamepad.getGamepads();\n */\n getGamepads(): GamepadSlot[] { return requireDomain('gamepad').getGamepads(); },\n /**\n * Observe complete snapshots, including neutral focus-loss states.\n * @param handler Receives each state update.\n * @returns Local subscription handle.\n * @example const sub = gamepad.onChange((state) => render(state));\n */\n onChange(handler: (state: GamepadState) => void): Subscription { return requireDomain('gamepad').onChange(handler); },\n};\n\nexport type { Gamepad, GamepadApi, GamepadButton, GamepadSlot, GamepadState, GamepadUnavailableReason } from '@napplet/core';\nexport { gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from '@napplet/nap/gamepad/sdk';\n"],"mappings":";;;;;AA6BA,SAAS,oBAAoB,kBAAkB,gBAAgB,uBAAuB;AAnB/E,IAAM,UAAsB;AAAA,EACjC,IAAI,YAAqB;AAAE,WAAO,cAAc,SAAS,EAAE;AAAA,EAAW;AAAA,EACtE,IAAI,UAAmB;AAAE,WAAO,cAAc,SAAS,EAAE;AAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlE,cAA6B;AAAE,WAAO,cAAc,SAAS,EAAE,YAAY;AAAA,EAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9E,SAAS,SAAsD;AAAE,WAAO,cAAc,SAAS,EAAE,SAAS,OAAO;AAAA,EAAG;AACtH;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/require-napplet.ts
|
|
2
|
+
function requireNapplet() {
|
|
3
|
+
const w = window;
|
|
4
|
+
if (!w.napplet) {
|
|
5
|
+
throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");
|
|
6
|
+
}
|
|
7
|
+
return w.napplet;
|
|
8
|
+
}
|
|
9
|
+
function requireDomain(domain) {
|
|
10
|
+
const napplet = requireNapplet();
|
|
11
|
+
const value = napplet[domain];
|
|
12
|
+
if (!value) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`window.napplet.${String(domain)} is unavailable -- runtime did not inject this domain`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
requireDomain
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-IQSY6FJF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/require-napplet.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 */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet is unavailable -- runtime did not inject the napplet namespace');\n }\n return w.napplet;\n}\n\n/**\n * Retrieve a runtime-injected domain from `window.napplet`.\n *\n * Shells inject only the NAP domains available to the current napplet, so SDK\n * wrappers check domain presence at method invocation instead of treating every\n * property as installed.\n */\nexport function requireDomain<K extends keyof NappletGlobal>(\n domain: K,\n): NonNullable<NappletGlobal[K]> {\n const napplet = requireNapplet();\n const value = napplet[domain];\n if (!value) {\n throw new Error(\n `window.napplet.${String(domain)} is unavailable -- runtime did not inject this domain`,\n );\n }\n return value as NonNullable<NappletGlobal[K]>;\n}\n"],"mappings":";AAcA,SAAS,iBAAgC;AACvC,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,SAAS;AACd,UAAM,IAAI,MAAM,+EAA+E;AAAA,EACjG;AACA,SAAO,EAAE;AACX;AASO,SAAS,cACd,QAC+B;AAC/B,QAAM,UAAU,eAAe;AAC/B,QAAM,QAAQ,QAAQ,MAAM;AAC5B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,kBAAkB,OAAO,MAAM,CAAC;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requireDomain
|
|
3
|
+
} from "./chunk-IQSY6FJF.js";
|
|
4
|
+
|
|
5
|
+
// src/llm.ts
|
|
6
|
+
import { LLM_ERROR_CODES } from "@napplet/nap/llm/types";
|
|
7
|
+
import {
|
|
8
|
+
isLlmFailure,
|
|
9
|
+
llmSelect,
|
|
10
|
+
llmSelect as llmSelect2,
|
|
11
|
+
llmDescribe,
|
|
12
|
+
llmDescribe as llmDescribe2,
|
|
13
|
+
llmGenerate,
|
|
14
|
+
llmGenerate as llmGenerate2,
|
|
15
|
+
llmCancel,
|
|
16
|
+
llmCancel as llmCancel2
|
|
17
|
+
} from "@napplet/nap/llm/sdk";
|
|
18
|
+
var llm = {
|
|
19
|
+
/** Delegate `select`. @param args Operation arguments. @returns Runtime result. */
|
|
20
|
+
select(...args) {
|
|
21
|
+
return requireDomain("llm").select(...args);
|
|
22
|
+
},
|
|
23
|
+
/** Delegate `describe`. @param args Operation arguments. @returns Runtime result. */
|
|
24
|
+
describe(...args) {
|
|
25
|
+
return requireDomain("llm").describe(...args);
|
|
26
|
+
},
|
|
27
|
+
/** Delegate `generate`. @param args Operation arguments. @returns Pending generation exposing `requestId`. */
|
|
28
|
+
generate(...args) {
|
|
29
|
+
return requireDomain("llm").generate(...args);
|
|
30
|
+
},
|
|
31
|
+
/** Delegate `cancel`. @param args Operation arguments. @returns Runtime result. */
|
|
32
|
+
cancel(...args) {
|
|
33
|
+
return requireDomain("llm").cancel(...args);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
llm,
|
|
39
|
+
LLM_ERROR_CODES,
|
|
40
|
+
isLlmFailure,
|
|
41
|
+
llmSelect,
|
|
42
|
+
llmSelect2,
|
|
43
|
+
llmDescribe,
|
|
44
|
+
llmDescribe2,
|
|
45
|
+
llmGenerate,
|
|
46
|
+
llmGenerate2,
|
|
47
|
+
llmCancel,
|
|
48
|
+
llmCancel2
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=chunk-OMPYTH3E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/llm.ts"],"sourcesContent":["/** User-selected, runtime-mediated language model inference. The runtime owns connections, credentials, and consent. @module */\nimport type { LlmApi } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\n/**\n * Delegate llm operations to the current injected runtime.\n * @example const model = await llm.select({ json: true });\n */\nexport const llm: LlmApi = {\n /** Delegate `select`. @param args Operation arguments. @returns Runtime result. */\n select(...args: Parameters<LlmApi['select']>): ReturnType<LlmApi['select']> {\n return requireDomain('llm').select(...args);\n },\n /** Delegate `describe`. @param args Operation arguments. @returns Runtime result. */\n describe(...args: Parameters<LlmApi['describe']>): ReturnType<LlmApi['describe']> {\n return requireDomain('llm').describe(...args);\n },\n /** Delegate `generate`. @param args Operation arguments. @returns Pending generation exposing `requestId`. */\n generate(...args: Parameters<LlmApi['generate']>): ReturnType<LlmApi['generate']> {\n return requireDomain('llm').generate(...args);\n },\n /** Delegate `cancel`. @param args Operation arguments. @returns Runtime result. */\n cancel(...args: Parameters<LlmApi['cancel']>): ReturnType<LlmApi['cancel']> {\n return requireDomain('llm').cancel(...args);\n },\n};\n\nexport type * from '@napplet/nap/llm/types';\nexport { LLM_ERROR_CODES } from '@napplet/nap/llm/types';\nexport {\n isLlmFailure,\n llmSelect,\n llmSelect as select,\n llmDescribe,\n llmDescribe as describe,\n llmGenerate,\n llmGenerate as generate,\n llmCancel,\n llmCancel as cancel,\n} from '@napplet/nap/llm/sdk';\n"],"mappings":";;;;;AA4BA,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACa,aAAbA;AAAA,EACA;AAAA,EACe,eAAfC;AAAA,EACA;AAAA,EACe,eAAfC;AAAA,EACA;AAAA,EACa,aAAbC;AAAA,OACK;AA/BA,IAAM,MAAc;AAAA;AAAA,EAEzB,UAAU,MAAkE;AAC1E,WAAO,cAAc,KAAK,EAAE,OAAO,GAAG,IAAI;AAAA,EAC5C;AAAA;AAAA,EAEA,YAAY,MAAsE;AAChF,WAAO,cAAc,KAAK,EAAE,SAAS,GAAG,IAAI;AAAA,EAC9C;AAAA;AAAA,EAEA,YAAY,MAAsE;AAChF,WAAO,cAAc,KAAK,EAAE,SAAS,GAAG,IAAI;AAAA,EAC9C;AAAA;AAAA,EAEA,UAAU,MAAkE;AAC1E,WAAO,cAAc,KAAK,EAAE,OAAO,GAAG,IAAI;AAAA,EAC5C;AACF;","names":["llmSelect","llmDescribe","llmGenerate","llmCancel"]}
|
package/dist/gamepad.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -25,10 +25,14 @@ export { DOMAIN as SERIAL_DOMAIN, SerialCloseMessage, SerialCloseResultMessage,
|
|
|
25
25
|
export { DOMAIN as FS_DOMAIN, FsAcceptRule, FsChange, FsChangeKind, FsChangedMessage, FsDirectoryEntry, FsEntryKind, FsError, FsInboundMessage, FsInfo, FsInfoMessage, FsInfoResultMessage, FsLimits, FsListMessage, FsListResultMessage, FsMessage, FsMetadata, FsMkdirMessage, FsMkdirOptions, FsMkdirResultMessage, FsMoveMessage, FsMoveResultMessage, FsNapMessage, FsOutboundMessage, FsPermission, FsPickDirectoryMessage, FsPickDirectoryResultMessage, FsPickFileMessage, FsPickFileResultMessage, FsPickFilesMessage, FsPickFilesResultMessage, FsPickOptions, FsPickResult, FsPickSaveFileMessage, FsPickSaveFileResultMessage, FsPickedEntry, FsReadMessage, FsReadOptions, FsReadResult, FsReadResultMessage, FsRemoveMessage, FsRemoveResultMessage, FsRoot, FsStatMessage, FsStatResultMessage, FsUnwatchMessage, FsUnwatchResultMessage, FsWatchMessage, FsWatchOptions, FsWatchResultMessage, FsWriteMessage, FsWriteMode, FsWriteOptions, FsWriteResult, FsWriteResultMessage, fsInfo, fsList, fsMkdir, fsMove, fsOnChanged, fsPickDirectory, fsPickFile, fsPickFiles, fsPickSaveFile, fsRead, fsRemove, fsStat, fsUnwatch, fsWatch, fsWrite, installFsShim } from '@napplet/nap/fs';
|
|
26
26
|
export { DOMAIN as DM_DOMAIN, DmConversation, DmConversationPage, DmConversationQuery, DmConversationsMessage, DmConversationsResultMessage, DmError, DmHexPubkey, DmInboundMessage, DmMessage, DmMessageEnvelope, DmMessageEventMessage, DmMessagePage, DmMessageQuery, DmMessageStatus, DmMessagesMessage, DmMessagesResultMessage, DmNapMessage, DmOk, DmOutboundMessage, DmPeer, DmSendMessage, DmSendRequest, DmSendResult, DmSendResultMessage, DmStatus, DmStatusMessage, DmStatusResultMessage, DmSubscribeMessage, DmSubscribeRequest, DmSubscribeResultMessage, DmSubscription, DmTimestamp, DmUnsubscribeMessage, DmUnsubscribeResultMessage, dmConversations, dmMessages, dmOnMessage, dmSend, dmStatus, dmSubscribe, dmUnsubscribe, installDmShim } from '@napplet/nap/dm';
|
|
27
27
|
export * from '@napplet/nap/gamepad/types';
|
|
28
|
+
export { LlmApi, LlmCancelMessage, LlmCancelResultMessage, LlmDelta, LlmDeltaMessage, LlmDescribeMessage, LlmDescribeResultMessage, LlmErrorCode, LlmFailure, LlmFinish, LlmFormat, LlmGenerateMessage, LlmGenerateOptions, LlmGenerateResultMessage, LlmGeneration, LlmGenerationRequest, LlmImageMimeType, LlmImagePart, LlmInboundMessage, LlmMessage, LlmModel, LlmNapMessage, LlmOutboundMessage, LlmPart, LlmPendingGeneration, LlmRequirements, LlmRole, LlmSelectMessage, LlmSelectResultMessage, LlmTextPart, LlmUsage } from '@napplet/nap/llm/types';
|
|
28
29
|
export { DOMAIN as SHELL_DOMAIN, installShellShim, shellOnReady, shellReady, shellSupports } from '@napplet/nap/shell';
|
|
29
30
|
export { DOMAIN as GAMEPAD_DOMAIN, gamepadAvailable, gamepadFocused, gamepadGetGamepads, gamepadOnChange, installGamepadShim } from '@napplet/nap/gamepad';
|
|
31
|
+
export { DOMAIN as LLM_DOMAIN, LLM_ERROR_CODES, installLlmShim, isLlmFailure, llmCancel, llmDescribe, llmGenerate, llmSelect } from '@napplet/nap/llm';
|
|
30
32
|
export { gamepad } from './gamepad.js';
|
|
33
|
+
export { llm } from './llm.js';
|
|
31
34
|
import '@napplet/nap/gamepad/sdk';
|
|
35
|
+
import '@napplet/nap/llm/sdk';
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* @napplet/sdk -- Relay, inter-napplet pubsub, and storage wrapper objects.
|
|
@@ -215,18 +219,20 @@ declare const config: SdkDomain$1<'config'>;
|
|
|
215
219
|
* shell fetches and returns a Blob. URL space is scheme-pluggable
|
|
216
220
|
* (`data:`, `https:`, `blossom:`, `htree:`, `nostr:`).
|
|
217
221
|
*
|
|
222
|
+
* @see https://github.com/hzrd149/blossom/blob/master/buds/10.md BUD-10 Blossom URI schema for `blossom:` URLs
|
|
223
|
+
*
|
|
218
224
|
* @example
|
|
219
225
|
* ```ts
|
|
220
226
|
* import { resource } from '@napplet/sdk';
|
|
221
227
|
*
|
|
222
|
-
* const blob = await resource.bytes('blossom
|
|
228
|
+
* const blob = await resource.bytes('blossom:<sha256>.png', {
|
|
223
229
|
* servers: ['https://cdn.hzrd149.com'],
|
|
224
230
|
* });
|
|
225
231
|
* const items = await resource.bytesMany([
|
|
226
232
|
* { url: 'https://example.com/a.png' },
|
|
227
233
|
* { url: 'htree://example-root/path' },
|
|
228
234
|
* ]);
|
|
229
|
-
* const handle = resource.bytesAsObjectURL('blossom
|
|
235
|
+
* const handle = resource.bytesAsObjectURL('blossom:<sha256>.png');
|
|
230
236
|
* imgEl.src = handle.url;
|
|
231
237
|
* imgEl.onload = () => handle.revoke();
|
|
232
238
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
gamepad
|
|
2
|
+
gamepad
|
|
3
|
+
} from "./chunk-GF2NV43T.js";
|
|
4
|
+
import {
|
|
5
|
+
llm
|
|
6
|
+
} from "./chunk-OMPYTH3E.js";
|
|
7
|
+
import {
|
|
3
8
|
requireDomain
|
|
4
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IQSY6FJF.js";
|
|
5
10
|
|
|
6
11
|
// src/relay.ts
|
|
7
12
|
var relay = {
|
|
@@ -1424,6 +1429,16 @@ import {
|
|
|
1424
1429
|
} from "@napplet/nap/dm";
|
|
1425
1430
|
import { shellReady, shellSupports, shellOnReady, installShellShim, DOMAIN as DOMAIN25 } from "@napplet/nap/shell";
|
|
1426
1431
|
import { DOMAIN as DOMAIN26, installGamepadShim, gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from "@napplet/nap/gamepad";
|
|
1432
|
+
import {
|
|
1433
|
+
DOMAIN as DOMAIN27,
|
|
1434
|
+
LLM_ERROR_CODES,
|
|
1435
|
+
installLlmShim,
|
|
1436
|
+
isLlmFailure,
|
|
1437
|
+
llmSelect,
|
|
1438
|
+
llmDescribe,
|
|
1439
|
+
llmGenerate,
|
|
1440
|
+
llmCancel
|
|
1441
|
+
} from "@napplet/nap/llm";
|
|
1427
1442
|
|
|
1428
1443
|
// src/shell.ts
|
|
1429
1444
|
var shell = {
|
|
@@ -1450,6 +1465,8 @@ export {
|
|
|
1450
1465
|
DOMAIN7 as KEYS_DOMAIN,
|
|
1451
1466
|
DOMAIN18 as LINK_DOMAIN,
|
|
1452
1467
|
DOMAIN20 as LISTS_DOMAIN,
|
|
1468
|
+
DOMAIN27 as LLM_DOMAIN,
|
|
1469
|
+
LLM_ERROR_CODES,
|
|
1453
1470
|
DOMAIN8 as MEDIA_DOMAIN,
|
|
1454
1471
|
NAP_DOMAINS,
|
|
1455
1472
|
DOMAIN9 as NOTIFY_DOMAIN,
|
|
@@ -1557,6 +1574,7 @@ export {
|
|
|
1557
1574
|
installKeysShim,
|
|
1558
1575
|
installLinkShim,
|
|
1559
1576
|
installListsShim,
|
|
1577
|
+
installLlmShim,
|
|
1560
1578
|
installMediaShim,
|
|
1561
1579
|
installNotifyShim,
|
|
1562
1580
|
installOutboxShim,
|
|
@@ -1575,6 +1593,7 @@ export {
|
|
|
1575
1593
|
intentOnChanged,
|
|
1576
1594
|
intentOnDelivery,
|
|
1577
1595
|
intentOpen,
|
|
1596
|
+
isLlmFailure,
|
|
1578
1597
|
keys,
|
|
1579
1598
|
keysOnAction,
|
|
1580
1599
|
keysRegister,
|
|
@@ -1586,6 +1605,11 @@ export {
|
|
|
1586
1605
|
listsAdd,
|
|
1587
1606
|
listsRemove,
|
|
1588
1607
|
listsSupported,
|
|
1608
|
+
llm,
|
|
1609
|
+
llmCancel,
|
|
1610
|
+
llmDescribe,
|
|
1611
|
+
llmGenerate,
|
|
1612
|
+
llmSelect,
|
|
1589
1613
|
media,
|
|
1590
1614
|
mediaCreateSession,
|
|
1591
1615
|
mediaDestroySession,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/relay.ts","../src/media.ts","../src/keys.ts","../src/config.ts","../src/cvm-bridge.ts","../src/outbox.ts","../src/upload.ts","../src/intent.ts","../src/webrtc.ts","../src/link.ts","../src/count.ts","../src/lists.ts","../src/common.ts","../src/ble.ts","../src/serial.ts","../src/fs.ts","../src/dm.ts","../src/nap-runtime.ts","../src/shell.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Relay, inter-napplet pubsub, and storage wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrEvent,\n NostrFilter,\n NappletGlobal,\n IncEvent,\n RelayEventResult,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 result\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: (result: RelayEventResult) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireDomain('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 requireDomain('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 requireDomain('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 event results\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<RelayEventResult[]> {\n return requireDomain('relay').query(filters);\n },\n};\n\n/**\n * Inter-napplet pubsub: broadcast and receive INC events through the shell.\n *\n * @example\n * ```ts\n * import { inc } from '@napplet/sdk';\n *\n * inc.emit('napplet:profile/open', { pubkey: '...' });\n *\n * const sub = inc.on('napplet:profile/open', (event) => {\n * console.log('Profile requested:', event.payload);\n * });\n * ```\n */\nexport const inc: SdkDomain<'inc'> = {\n /**\n * Broadcast an INC message to other napplets via the shell.\n * @param topic An opaque stable topic or convention URI\n * @param payload Optional opaque payload for a queryless topic\n */\n emit(topic: string, payload?: unknown): void {\n requireDomain('inc').emit(topic, payload);\n },\n\n /**\n * Subscribe to INC events on a specific topic.\n * @param topic Exact topic value to listen for\n * @param callback Called with one runtime-attested INC event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (event: IncEvent) => void,\n ): Subscription {\n return requireDomain('inc').on(topic, callback);\n },\n\n channel: {\n open(target) {\n return requireDomain('inc').channel.open(target);\n },\n onOpened(callback) {\n return requireDomain('inc').channel.onOpened(callback);\n },\n list() {\n return requireDomain('inc').channel.list();\n },\n broadcast(payload) {\n requireDomain('inc').channel.broadcast(payload);\n },\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: SdkDomain<'inc'> = 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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('storage').instance.keys();\n },\n },\n};\n","/**\n * @napplet/sdk -- Media session and notification wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal, Subscription } from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\nexport type {\n MediaContextLink,\n MediaNostrRef,\n MediaSessionContext,\n} from '@napplet/nap/media';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('notify').onControls(callback);\n },\n};\n","/**\n * @napplet/sdk -- Keyboard action and read-only identity wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal, Subscription } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\n\ninterface KeysSdk extends SdkDomain<'keys'> {\n register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }>;\n}\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: KeysSdk = {\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 requireDomain('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 requireDomain('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 requireDomain('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 = requireDomain('keys');\n const result = await n.registerAction(action);\n const sub = n.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('identity').getBadges();\n },\n};\n","/**\n * @napplet/sdk -- Declarative config and resource byte-fetch wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n ResourceBytesItem,\n ResourceBytesRequest,\n ResourceInfo,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('config').openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema with the shell at runtime.\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 requireDomain('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 requireDomain('config').onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Updated after successful\n * registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireDomain('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:`, `htree:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('blossom:sha256:abc123...', {\n * servers: ['https://cdn.hzrd149.com'],\n * });\n * const items = await resource.bytesMany([\n * { url: 'https://example.com/a.png' },\n * { url: 'htree://example-root/path' },\n * ]);\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource: SdkDomain<'resource'> = {\n /**\n * Inspect resource schemes and coarse runtime policy limits.\n * @returns Promise resolving to advisory resource info.\n */\n info(): Promise<ResourceInfo> {\n return requireDomain('resource').info();\n },\n\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, opts?: { servers?: string[]; signal?: AbortSignal }): Promise<Blob> {\n return requireDomain('resource').bytes(url, opts);\n },\n\n /**\n * Fetch bytes for many per-resource requests through one shell envelope.\n * @param requests Non-empty resource request list with optional per-resource Blossom servers.\n * @param opts Optional AbortController signal.\n * @returns Promise resolving to ordered per-URL result items.\n */\n bytesMany(\n requests: ResourceBytesRequest[],\n opts?: { signal?: AbortSignal },\n ): Promise<ResourceBytesItem[]> {\n return requireDomain('resource').bytesMany(requests, opts);\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 requireDomain('resource').bytesAsObjectURL(url);\n },\n};\n","import type {\n CvmDiscoverQuery,\n CvmRegistryCallOptions,\n CvmRegistryEntry,\n CvmRegistryOptions,\n CvmRegistryQuery,\n CvmRequestOptions,\n CvmServer,\n CvmServerRef,\n JsonObject,\n McpMessage,\n McpResource,\n McpResourceContent,\n McpTool,\n McpToolResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('cvm').onEvent(callback);\n },\n\n /** Shell-curated ContextVM registry families. */\n registry: {\n /**\n * List registry families known to the shell.\n * @param query Optional family/search/schema filter\n */\n list(query?: CvmRegistryQuery): Promise<CvmRegistryEntry[]> {\n return requireDomain('cvm').registry.list(query);\n },\n\n /**\n * Test whether the shell can call a registry family.\n * @param family Registry family name\n * @param options Optional schema/provider constraints\n */\n has(family: string, options?: CvmRegistryOptions): Promise<boolean> {\n return requireDomain('cvm').registry.has(family, options);\n },\n\n /**\n * Describe the shell-selected registry family entry.\n * @param family Registry family name\n * @param options Optional schema/provider constraints\n */\n describe(\n family: string,\n options?: CvmRegistryOptions,\n ): Promise<CvmRegistryEntry> {\n return requireDomain('cvm').registry.describe(family, options);\n },\n\n /**\n * Call a tool on the shell-selected provider for a registry family.\n * @param family Registry family name\n * @param tool Tool name inside the family\n * @param args Tool arguments\n * @param options Optional schema/provider/cache/payment constraints\n */\n call(\n family: string,\n tool: string,\n args?: JsonObject,\n options?: CvmRegistryCallOptions,\n ): Promise<McpToolResult> {\n return requireDomain('cvm').registry.call(family, tool, args, options);\n },\n },\n};\n","import type {\n EventTemplate,\n NostrFilter,\n OutboxEventOptions,\n OutboxEventResult,\n OutboxPublishOptions,\n OutboxPublishResult,\n OutboxQueryOptions,\n OutboxRelayPlan,\n OutboxResult,\n OutboxSubscribeOptions,\n OutboxSubscription,\n OutboxTarget,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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] }], {\n * authors: ['ab12...'],\n * });\n * const sub = outbox.subscribe([{ kinds: [1] }], { timeoutMs: 3000 });\n * sub.on('event', (result) => render(result.event, result.sidecar?.relayHints));\n * ```\n */\nexport const outbox: SdkDomain<'outbox'> = {\n /**\n * Fetch one event by ID through shell-owned outbox routing.\n * @param eventId Event id to fetch\n * @param options Optional author/relay hints and timeout\n * @returns Promise resolving to the outbox event result\n */\n getEvent(\n eventId: string,\n options?: OutboxEventOptions,\n ): Promise<OutboxEventResult> {\n return requireDomain('outbox').getEvent(eventId, options);\n },\n\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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('outbox').resolveRelays(target);\n },\n};\n","import type {\n Subscription,\n UploadInfo,\n UploadRequest,\n UploadResult,\n UploadStatus,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'upload'> = {\n /**\n * Inspect upload rails and coarse runtime policy limits.\n * @returns Promise resolving to advisory upload info.\n */\n info(): Promise<UploadInfo> {\n return requireDomain('upload').info();\n },\n\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 requireDomain('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 requireDomain('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 requireDomain('upload').onStatus(handler);\n },\n};\n","import type {\n IntentAvailability,\n IntentInvokeOptions,\n IntentDelivery,\n IntentResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Archetype intent dispatch (NAP-INTENT): invoke an installed handler by role\n * without directly addressing a target instance.\n *\n * @example\n * ```ts\n * import { intent } from '@napplet/sdk';\n *\n * if ((await intent.available('note')).available) {\n * await intent.open('napplet:note/open', { payload: { event: id } });\n * }\n * ```\n */\nexport const intent: SdkDomain<'intent'> = {\n /**\n * Invoke an archetype request.\n * @param uri Authoritative convention URI\n * @param options Structured payload and runtime selection hints\n * @returns Promise resolving to the dispatch result\n */\n invoke(uri: string, options?: IntentInvokeOptions): Promise<IntentResult> {\n return requireDomain('intent').invoke(uri, options);\n },\n\n /**\n * Open a napplet by archetype.\n * @param uri Convention URI whose action is open\n * @param options Structured payload and runtime selection hints\n * @returns Promise resolving to the dispatch result\n */\n open(\n uri: string,\n options?: IntentInvokeOptions,\n ): Promise<IntentResult> {\n return requireDomain('intent').open(uri, options);\n },\n\n /**\n * Check whether the runtime can currently satisfy an archetype and expose the\n * manifest-derived conventions 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 requireDomain('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 requireDomain('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 requireDomain('intent').onChanged(handler);\n },\n\n /**\n * Receive runtime-attested deliveries, including those retained before registration.\n * @param handler Called with each delivery\n * @returns A Subscription with close() to stop listening\n * @example\n * intent.onDelivery(({ payload }) => render(payload));\n */\n onDelivery(handler: (delivery: IntentDelivery) => void): Subscription {\n return requireDomain('intent').onDelivery(handler);\n },\n};\n","import type {\n Subscription,\n WebrtcEvent,\n WebrtcOpenRequest,\n WebrtcOpenResult,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('webrtc').onEvent(handler);\n },\n};\n","import type { LinkOpenOptions, LinkOpenResult } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.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: SdkDomain<'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 requireDomain('link').open(url, options);\n },\n};\n","import type { CountFilter, CountOptions, CountResult } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated event counts (NAP-COUNT): ask the runtime to count NIP-01\n * filter matches without returning matching event payloads. The runtime owns\n * relay selection, NIP-45 COUNT support, indexing, aggregation, approximation,\n * and refusal policy.\n *\n * @example\n * ```ts\n * import { count } from '@napplet/sdk';\n *\n * const result = await count.query({ kinds: [7], '#e': [eventId] });\n * ```\n */\nexport const count: SdkDomain<'count'> = {\n /**\n * Count events matching one or more NIP-01 filters.\n * @param filters One NIP-01 filter or a non-empty array of filters\n * @param options Optional approximation and HyperLogLog hints\n * @returns Promise resolving to the runtime count result\n */\n query(filters: CountFilter | CountFilter[], options?: CountOptions): Promise<CountResult> {\n return requireDomain('count').query(filters, options);\n },\n};\n","import type {\n ListItem,\n ListMutationResult,\n ListOptions,\n ListRef,\n ListSupport,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('lists').remove(list, items, options);\n },\n};\n","import type {\n CommonActionResult,\n CommonFollowsResult,\n CommonNip19DecodeResult,\n CommonNip19EncodeInput,\n CommonNip19EncodeResult,\n CommonProfileResult,\n CommonProfileTarget,\n CommonReaction,\n CommonReportReason,\n CommonReportTarget,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('common').report(target, reason, text);\n },\n};\n","import type {\n BleAttribute,\n BleEvent,\n BleOpenRequest,\n BleOpenResult,\n BleService,\n BleWriteOptions,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated Bluetooth LE/GATT sessions (NAP-BLE): ask the shell to\n * select a user-approved BLE device, expose opaque sessions and GATT\n * attributes, and receive shell-pushed state/notification/close events. The\n * shell owns chooser UI, permissions, device handles, lifecycle, and policy.\n *\n * @example\n * ```ts\n * import { ble } from '@napplet/sdk';\n *\n * const { session } = await ble.open({ acceptAllDevices: true });\n * const services = await ble.services(session.id);\n * ```\n */\nexport const ble: SdkDomain<'ble'> = {\n /**\n * Ask the runtime to select and open a BLE session.\n * @param request Device selection and optional service request\n * @returns Promise resolving to the runtime-assigned BLE open result\n */\n open(request: BleOpenRequest): Promise<BleOpenResult> {\n return requireDomain('ble').open(request);\n },\n\n /**\n * List exposed GATT services for a session.\n * @param sessionId Runtime-assigned BLE session id\n * @returns Promise resolving to exposed services\n */\n services(sessionId: string): Promise<BleService[]> {\n return requireDomain('ble').services(sessionId);\n },\n\n /**\n * Read a characteristic or descriptor value.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT attribute target\n * @returns Promise resolving to bytes\n */\n read(sessionId: string, target: BleAttribute): Promise<number[]> {\n return requireDomain('ble').read(sessionId, target);\n },\n\n /**\n * Write bytes to a characteristic or descriptor.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT attribute target\n * @param data Byte values to write\n * @param options Optional write mode preference\n * @returns Promise resolving after the runtime acknowledges the write\n */\n write(\n sessionId: string,\n target: BleAttribute,\n data: number[],\n options?: BleWriteOptions,\n ): Promise<void> {\n return requireDomain('ble').write(sessionId, target, data, options);\n },\n\n /**\n * Start notifications or indications for a characteristic.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT characteristic target\n */\n subscribe(sessionId: string, target: BleAttribute): Promise<void> {\n return requireDomain('ble').subscribe(sessionId, target);\n },\n\n /**\n * Stop notifications or indications for a characteristic.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT characteristic target\n */\n unsubscribe(sessionId: string, target: BleAttribute): Promise<void> {\n return requireDomain('ble').unsubscribe(sessionId, target);\n },\n\n /**\n * Close an open BLE session.\n * @param sessionId Runtime-assigned BLE session id\n * @param reason Optional reason for the close request\n */\n close(sessionId: string, reason?: string): Promise<void> {\n return requireDomain('ble').close(sessionId, reason);\n },\n\n /**\n * Register for shell-pushed BLE events.\n * @param handler Called with each BLE event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(handler: (event: BleEvent) => void): Subscription {\n return requireDomain('ble').onEvent(handler);\n },\n};\n","import type {\n SerialEvent,\n SerialOpenRequest,\n SerialOpenResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('serial').onEvent(handler);\n },\n};\n","import type {\n FsChange,\n FsDirectoryEntry,\n FsInfo,\n FsMetadata,\n FsMkdirOptions,\n FsPickOptions,\n FsPickResult,\n FsReadOptions,\n FsReadResult,\n FsWatchOptions,\n FsWriteOptions,\n FsWriteResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Shell-mediated virtual filesystem access (NAP-FS): discover visible roots,\n * ask the runtime to mediate file and directory selection, inspect and list\n * entries, read and write base64-encoded file bytes, create, remove and move\n * them, and subscribe to advisory change events. The runtime owns host paths,\n * mounts, backing store, normalization, policy, and authorization -- the\n * napplet sees only virtual paths.\n *\n * `info()` is advisory discovery, not an authorization token: handle failures\n * even when it advertised a matching permission.\n *\n * @example\n * ```ts\n * import { fs } from '@napplet/sdk';\n *\n * const picked = await fs.pickFile({ accept: [{ extension: '.md' }] });\n * const bytes = await fs.read(picked.entries[0].path);\n * await fs.write('/shared/copy.txt', bytes.data, { mode: 'replace' });\n * const entries = await fs.list('/shared');\n * const watchId = await fs.watch('/shared', { recursive: true });\n * fs.onChanged((change) => refresh(change.path));\n * ```\n */\nexport const fs: SdkDomain<'fs'> = {\n /**\n * Discover visible roots, coarse root permissions, and runtime limits.\n * @returns Promise resolving to advisory filesystem discovery data\n */\n info(): Promise<FsInfo> {\n return requireDomain('fs').info();\n },\n\n /**\n * Ask the runtime to let the user select one file.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickFile(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickFile(options);\n },\n\n /**\n * Ask the runtime to let the user select one or more files.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickFiles(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickFiles(options);\n },\n\n /**\n * Ask the runtime to let the user select one directory.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickDirectory(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickDirectory(options);\n },\n\n /**\n * Ask the runtime to let the user select or name one file destination.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickSaveFile(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickSaveFile(options);\n },\n\n /**\n * Read coarse metadata for a visible file or directory.\n * @param path Virtual absolute path of the entry\n * @returns Promise resolving to the entry metadata\n */\n stat(path: string): Promise<FsMetadata> {\n return requireDomain('fs').stat(path);\n },\n\n /**\n * List the direct children of a visible directory. Ordering is unspecified.\n * @param path Virtual absolute path of the directory\n * @returns Promise resolving to the directory entries\n */\n list(path: string): Promise<FsDirectoryEntry[]> {\n return requireDomain('fs').list(path);\n },\n\n /**\n * Read bytes from a visible file.\n * @param path Virtual absolute path of the file\n * @param options Optional range read controls\n * @returns Promise resolving to the read result\n */\n read(path: string, options?: FsReadOptions): Promise<FsReadResult> {\n return requireDomain('fs').read(path, options);\n },\n\n /**\n * Write bytes to a visible file. `data` is RFC 4648 standard padded base64 text.\n * @param path Virtual absolute path of the file\n * @param data Decoded bytes encoded as standard padded base64 text\n * @param options Optional write mode and preconditions\n * @returns Promise resolving to the write result\n */\n write(path: string, data: string, options?: FsWriteOptions): Promise<FsWriteResult> {\n return requireDomain('fs').write(path, data, options);\n },\n\n /**\n * Create a directory.\n * @param path Virtual absolute path of the directory to create\n * @param options Optional recursive parent creation\n * @returns Promise resolving once the runtime acknowledges the creation\n */\n mkdir(path: string, options?: FsMkdirOptions): Promise<void> {\n return requireDomain('fs').mkdir(path, options);\n },\n\n /**\n * Remove a file or directory.\n * @param path Virtual absolute path of the entry to remove\n * @param recursive Remove a non-empty directory and its authorized descendants\n * @returns Promise resolving once the runtime acknowledges the removal\n */\n remove(path: string, recursive?: boolean): Promise<void> {\n return requireDomain('fs').remove(path, recursive);\n },\n\n /**\n * Move or rename a file or directory.\n * @param fromPath Virtual absolute source path\n * @param toPath Virtual absolute destination path\n * @returns Promise resolving once the runtime acknowledges the move\n */\n move(fromPath: string, toPath: string): Promise<void> {\n return requireDomain('fs').move(fromPath, toPath);\n },\n\n /**\n * Start an advisory watch on a visible path.\n * @param path Virtual absolute path to watch\n * @param options Optional recursive descendant coverage\n * @returns Promise resolving to the runtime-generated watch id\n */\n watch(path: string, options?: FsWatchOptions): Promise<string> {\n return requireDomain('fs').watch(path, options);\n },\n\n /**\n * Stop a watch. Unknown ids may be treated as successful no-ops.\n * @param watchId Runtime-generated watch id\n * @returns Promise resolving once the runtime acknowledges the request\n */\n unwatch(watchId: string): Promise<void> {\n return requireDomain('fs').unwatch(watchId);\n },\n\n /**\n * Register for runtime-pushed filesystem change events.\n * @param handler Called with each advisory change\n * @returns A Subscription with `close()` to stop listening\n */\n onChanged(handler: (change: FsChange) => void): Subscription {\n return requireDomain('fs').onChanged(handler);\n },\n};\n","import type {\n DmConversationPage,\n DmConversationQuery,\n DmMessage,\n DmMessagePage,\n DmMessageQuery,\n DmOk,\n DmSendRequest,\n DmSendResult,\n DmStatus,\n DmSubscribeRequest,\n DmSubscription,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated direct messages (NAP-DM): present DM UI while the runtime\n * owns signing, encryption, relay routing, storage, key/session state, and\n * policy.\n *\n * @example\n * ```ts\n * import { dm } from '@napplet/sdk';\n *\n * const { conversations } = await dm.conversations({ limit: 20 });\n * dm.onMessage((message) => render(message));\n * ```\n */\nexport const dm: SdkDomain<'dm'> = {\n /**\n * Get current DM availability and advisory runtime labels.\n * @returns Promise resolving to the runtime DM status\n */\n status(): Promise<DmStatus> {\n return requireDomain('dm').status();\n },\n\n /**\n * Fetch normalized conversations visible to this napplet.\n * @param query Optional cursor and limit\n * @returns Promise resolving to a page of conversations\n */\n conversations(query?: DmConversationQuery): Promise<DmConversationPage> {\n return requireDomain('dm').conversations(query);\n },\n\n /**\n * Fetch normalized message history for one conversation.\n * @param query Conversation id plus optional cursor and limit\n * @returns Promise resolving to a page of messages\n */\n messages(query: DmMessageQuery): Promise<DmMessagePage> {\n return requireDomain('dm').messages(query);\n },\n\n /**\n * Ask the runtime to send a direct message.\n * @param request Recipients, content, and optional conversation/client ids\n * @returns Promise resolving to the normalized send result\n */\n send(request: DmSendRequest): Promise<DmSendResult> {\n return requireDomain('dm').send(request);\n },\n\n /**\n * Start live delivery for one conversation or all visible conversations.\n * @param request Optional conversation scope\n * @returns Promise resolving to the runtime subscription id\n */\n subscribe(request?: DmSubscribeRequest): Promise<DmSubscription> {\n return requireDomain('dm').subscribe(request);\n },\n\n /**\n * Stop a live DM subscription.\n * @param subscriptionId Runtime subscription id from subscribe()\n * @returns Promise resolving to the runtime acknowledgement\n */\n unsubscribe(subscriptionId: string): Promise<DmOk> {\n return requireDomain('dm').unsubscribe(subscriptionId);\n },\n\n /**\n * Register for shell-pushed `dm.message` deliveries.\n * @param handler Called with each message and its runtime subscription id\n * @returns A Subscription with `close()` to stop listening\n */\n onMessage(\n handler: (message: DmMessage, subscriptionId: string) => void,\n ): Subscription {\n return requireDomain('dm').onMessage(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 BLE_DOMAIN } from '@napplet/nap/ble';\nexport { DOMAIN as WEBRTC_DOMAIN } from '@napplet/nap/webrtc';\nexport { DOMAIN as LINK_DOMAIN } from '@napplet/nap/link';\nexport { DOMAIN as COUNT_DOMAIN } from '@napplet/nap/count';\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';\nexport { DOMAIN as FS_DOMAIN } from '@napplet/nap/fs';\nexport { DOMAIN as DM_DOMAIN } from '@napplet/nap/dm';\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 { installBleShim } from '@napplet/nap/ble';\nexport { installWebrtcShim } from '@napplet/nap/webrtc';\nexport { installLinkShim } from '@napplet/nap/link';\nexport { installCountShim } from '@napplet/nap/count';\nexport { installListsShim } from '@napplet/nap/lists';\nexport { installCommonShim } from '@napplet/nap/common';\nexport { installSerialShim } from '@napplet/nap/serial';\nexport { installFsShim } from '@napplet/nap/fs';\nexport { installDmShim } from '@napplet/nap/dm';\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 {\n resourceInfo,\n resourceBytes,\n resourceBytesMany,\n resourceBytesAsObjectURL,\n} from '@napplet/nap/resource';\nexport {\n cvmDiscover,\n cvmRequest,\n cvmListTools,\n cvmCallTool,\n cvmListResources,\n cvmReadResource,\n cvmClose,\n cvmOnEvent,\n cvmRegistryList,\n cvmRegistryHas,\n cvmRegistryDescribe,\n cvmRegistryCall,\n} from '@napplet/nap/cvm';\nexport {\n outboxGetEvent,\n outboxQuery,\n outboxSubscribe,\n outboxPublish,\n outboxResolveRelays,\n} from '@napplet/nap/outbox';\nexport {\n uploadInfo,\n uploadFile,\n uploadStatus,\n uploadOnStatus,\n} from '@napplet/nap/upload';\nexport {\n intentInvoke,\n intentOpen,\n intentAvailable,\n intentHandlers,\n intentOnChanged,\n intentOnDelivery,\n} from '@napplet/nap/intent';\nexport {\n bleOpen,\n bleServices,\n bleRead,\n bleWrite,\n bleSubscribe,\n bleUnsubscribe,\n bleClose,\n bleOnEvent,\n} from '@napplet/nap/ble';\nexport { linkOpen } from '@napplet/nap/link';\nexport { countQuery } from '@napplet/nap/count';\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\nexport {\n fsInfo,\n fsPickFile,\n fsPickFiles,\n fsPickDirectory,\n fsPickSaveFile,\n fsStat,\n fsList,\n fsRead,\n fsWrite,\n fsMkdir,\n fsRemove,\n fsMove,\n fsWatch,\n fsUnwatch,\n fsOnChanged,\n} from '@napplet/nap/fs';\nexport {\n dmStatus,\n dmConversations,\n dmMessages,\n dmSend,\n dmSubscribe,\n dmUnsubscribe,\n dmOnMessage,\n} from '@napplet/nap/dm';\n\nexport { shellReady, shellSupports, shellOnReady, installShellShim, DOMAIN as SHELL_DOMAIN } from '@napplet/nap/shell';\n\nexport { DOMAIN as GAMEPAD_DOMAIN, installGamepadShim, gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from '@napplet/nap/gamepad';\n","/** NAP-SHELL wrapper; other SDK domains remain independent of readiness. */\nimport type { ShellApi } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\n/** Optional runtime environment, queried only when the shell domain is exposed. */\nexport const shell: ShellApi = {\n supports: (domain) => requireDomain('shell').supports(domain),\n ready: () => requireDomain('shell').ready(),\n onReady: (handler) => requireDomain('shell').onReady(handler),\n get services() { return requireDomain('shell').services; },\n};\n"],"mappings":";;;;;;AAoCO,IAAM,QAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvC,UACE,SACA,SACA,QACA,SACc;AACd,WAAO,cAAc,OAAO,EAAE,UAAU,SAAS,SAAS,QAAQ,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QACE,UACA,SACqB;AACrB,WAAO,cAAc,OAAO,EAAE,QAAQ,UAAU,OAAO;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA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Aa,uBAAuB,yBAAyB,gBAAgB,iBAAiB,mBAAmB,wBAAwB;AAC7K;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B;AAAA,EACE;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;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,YAAY,eAAe,cAAc,kBAA4B,UAAVA,gBAA8B;AAElG,SAAmB,UAAVA,UAA0B,oBAAoB,oBAAoB,kBAAkB,gBAAgB,uBAAuB;;;AC3M7H,IAAM,QAAkB;AAAA,EAC7B,UAAU,CAAC,WAAW,cAAc,OAAO,EAAE,SAAS,MAAM;AAAA,EAC5D,OAAO,MAAM,cAAc,OAAO,EAAE,MAAM;AAAA,EAC1C,SAAS,CAAC,YAAY,cAAc,OAAO,EAAE,QAAQ,OAAO;AAAA,EAC5D,IAAI,WAAW;AAAE,WAAO,cAAc,OAAO,EAAE;AAAA,EAAU;AAC3D;","names":["count","DOMAIN"]}
|
|
1
|
+
{"version":3,"sources":["../src/relay.ts","../src/media.ts","../src/keys.ts","../src/config.ts","../src/cvm-bridge.ts","../src/outbox.ts","../src/upload.ts","../src/intent.ts","../src/webrtc.ts","../src/link.ts","../src/count.ts","../src/lists.ts","../src/common.ts","../src/ble.ts","../src/serial.ts","../src/fs.ts","../src/dm.ts","../src/nap-runtime.ts","../src/shell.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Relay, inter-napplet pubsub, and storage wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NostrEvent,\n NostrFilter,\n NappletGlobal,\n IncEvent,\n RelayEventResult,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 result\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: (result: RelayEventResult) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireDomain('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 requireDomain('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 requireDomain('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 event results\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<RelayEventResult[]> {\n return requireDomain('relay').query(filters);\n },\n};\n\n/**\n * Inter-napplet pubsub: broadcast and receive INC events through the shell.\n *\n * @example\n * ```ts\n * import { inc } from '@napplet/sdk';\n *\n * inc.emit('napplet:profile/open', { pubkey: '...' });\n *\n * const sub = inc.on('napplet:profile/open', (event) => {\n * console.log('Profile requested:', event.payload);\n * });\n * ```\n */\nexport const inc: SdkDomain<'inc'> = {\n /**\n * Broadcast an INC message to other napplets via the shell.\n * @param topic An opaque stable topic or convention URI\n * @param payload Optional opaque payload for a queryless topic\n */\n emit(topic: string, payload?: unknown): void {\n requireDomain('inc').emit(topic, payload);\n },\n\n /**\n * Subscribe to INC events on a specific topic.\n * @param topic Exact topic value to listen for\n * @param callback Called with one runtime-attested INC event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (event: IncEvent) => void,\n ): Subscription {\n return requireDomain('inc').on(topic, callback);\n },\n\n channel: {\n open(target) {\n return requireDomain('inc').channel.open(target);\n },\n onOpened(callback) {\n return requireDomain('inc').channel.onOpened(callback);\n },\n list() {\n return requireDomain('inc').channel.list();\n },\n broadcast(payload) {\n requireDomain('inc').channel.broadcast(payload);\n },\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: SdkDomain<'inc'> = 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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('storage').instance.keys();\n },\n },\n};\n","/**\n * @napplet/sdk -- Media session and notification wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal, Subscription } from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\nexport type {\n MediaContextLink,\n MediaNostrRef,\n MediaSessionContext,\n} from '@napplet/nap/media';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('notify').onControls(callback);\n },\n};\n","/**\n * @napplet/sdk -- Keyboard action and read-only identity wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type { NappletGlobal, Subscription } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\n\ninterface KeysSdk extends SdkDomain<'keys'> {\n register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }>;\n}\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: KeysSdk = {\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 requireDomain('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 requireDomain('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 requireDomain('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 = requireDomain('keys');\n const result = await n.registerAction(action);\n const sub = n.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('identity').getBadges();\n },\n};\n","/**\n * @napplet/sdk -- Declarative config and resource byte-fetch wrapper objects.\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n ResourceBytesItem,\n ResourceBytesRequest,\n ResourceInfo,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\ntype SdkDomain<K extends keyof NappletGlobal> = NonNullable<NappletGlobal[K]>;\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('config').openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema with the shell at runtime.\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 requireDomain('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 requireDomain('config').onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Updated after successful\n * registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireDomain('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:`, `htree:`, `nostr:`).\n *\n * @see https://github.com/hzrd149/blossom/blob/master/buds/10.md BUD-10 Blossom URI schema for `blossom:` URLs\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('blossom:<sha256>.png', {\n * servers: ['https://cdn.hzrd149.com'],\n * });\n * const items = await resource.bytesMany([\n * { url: 'https://example.com/a.png' },\n * { url: 'htree://example-root/path' },\n * ]);\n * const handle = resource.bytesAsObjectURL('blossom:<sha256>.png');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource: SdkDomain<'resource'> = {\n /**\n * Inspect resource schemes and coarse runtime policy limits.\n * @returns Promise resolving to advisory resource info.\n */\n info(): Promise<ResourceInfo> {\n return requireDomain('resource').info();\n },\n\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, opts?: { servers?: string[]; signal?: AbortSignal }): Promise<Blob> {\n return requireDomain('resource').bytes(url, opts);\n },\n\n /**\n * Fetch bytes for many per-resource requests through one shell envelope.\n * @param requests Non-empty resource request list with optional per-resource Blossom servers.\n * @param opts Optional AbortController signal.\n * @returns Promise resolving to ordered per-URL result items.\n */\n bytesMany(\n requests: ResourceBytesRequest[],\n opts?: { signal?: AbortSignal },\n ): Promise<ResourceBytesItem[]> {\n return requireDomain('resource').bytesMany(requests, opts);\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 requireDomain('resource').bytesAsObjectURL(url);\n },\n};\n","import type {\n CvmDiscoverQuery,\n CvmRegistryCallOptions,\n CvmRegistryEntry,\n CvmRegistryOptions,\n CvmRegistryQuery,\n CvmRequestOptions,\n CvmServer,\n CvmServerRef,\n JsonObject,\n McpMessage,\n McpResource,\n McpResourceContent,\n McpTool,\n McpToolResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('cvm').onEvent(callback);\n },\n\n /** Shell-curated ContextVM registry families. */\n registry: {\n /**\n * List registry families known to the shell.\n * @param query Optional family/search/schema filter\n */\n list(query?: CvmRegistryQuery): Promise<CvmRegistryEntry[]> {\n return requireDomain('cvm').registry.list(query);\n },\n\n /**\n * Test whether the shell can call a registry family.\n * @param family Registry family name\n * @param options Optional schema/provider constraints\n */\n has(family: string, options?: CvmRegistryOptions): Promise<boolean> {\n return requireDomain('cvm').registry.has(family, options);\n },\n\n /**\n * Describe the shell-selected registry family entry.\n * @param family Registry family name\n * @param options Optional schema/provider constraints\n */\n describe(\n family: string,\n options?: CvmRegistryOptions,\n ): Promise<CvmRegistryEntry> {\n return requireDomain('cvm').registry.describe(family, options);\n },\n\n /**\n * Call a tool on the shell-selected provider for a registry family.\n * @param family Registry family name\n * @param tool Tool name inside the family\n * @param args Tool arguments\n * @param options Optional schema/provider/cache/payment constraints\n */\n call(\n family: string,\n tool: string,\n args?: JsonObject,\n options?: CvmRegistryCallOptions,\n ): Promise<McpToolResult> {\n return requireDomain('cvm').registry.call(family, tool, args, options);\n },\n },\n};\n","import type {\n EventTemplate,\n NostrFilter,\n OutboxEventOptions,\n OutboxEventResult,\n OutboxPublishOptions,\n OutboxPublishResult,\n OutboxQueryOptions,\n OutboxRelayPlan,\n OutboxResult,\n OutboxSubscribeOptions,\n OutboxSubscription,\n OutboxTarget,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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] }], {\n * authors: ['ab12...'],\n * });\n * const sub = outbox.subscribe([{ kinds: [1] }], { timeoutMs: 3000 });\n * sub.on('event', (result) => render(result.event, result.sidecar?.relayHints));\n * ```\n */\nexport const outbox: SdkDomain<'outbox'> = {\n /**\n * Fetch one event by ID through shell-owned outbox routing.\n * @param eventId Event id to fetch\n * @param options Optional author/relay hints and timeout\n * @returns Promise resolving to the outbox event result\n */\n getEvent(\n eventId: string,\n options?: OutboxEventOptions,\n ): Promise<OutboxEventResult> {\n return requireDomain('outbox').getEvent(eventId, options);\n },\n\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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('outbox').resolveRelays(target);\n },\n};\n","import type {\n Subscription,\n UploadInfo,\n UploadRequest,\n UploadResult,\n UploadStatus,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'upload'> = {\n /**\n * Inspect upload rails and coarse runtime policy limits.\n * @returns Promise resolving to advisory upload info.\n */\n info(): Promise<UploadInfo> {\n return requireDomain('upload').info();\n },\n\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 requireDomain('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 requireDomain('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 requireDomain('upload').onStatus(handler);\n },\n};\n","import type {\n IntentAvailability,\n IntentInvokeOptions,\n IntentDelivery,\n IntentResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Archetype intent dispatch (NAP-INTENT): invoke an installed handler by role\n * without directly addressing a target instance.\n *\n * @example\n * ```ts\n * import { intent } from '@napplet/sdk';\n *\n * if ((await intent.available('note')).available) {\n * await intent.open('napplet:note/open', { payload: { event: id } });\n * }\n * ```\n */\nexport const intent: SdkDomain<'intent'> = {\n /**\n * Invoke an archetype request.\n * @param uri Authoritative convention URI\n * @param options Structured payload and runtime selection hints\n * @returns Promise resolving to the dispatch result\n */\n invoke(uri: string, options?: IntentInvokeOptions): Promise<IntentResult> {\n return requireDomain('intent').invoke(uri, options);\n },\n\n /**\n * Open a napplet by archetype.\n * @param uri Convention URI whose action is open\n * @param options Structured payload and runtime selection hints\n * @returns Promise resolving to the dispatch result\n */\n open(\n uri: string,\n options?: IntentInvokeOptions,\n ): Promise<IntentResult> {\n return requireDomain('intent').open(uri, options);\n },\n\n /**\n * Check whether the runtime can currently satisfy an archetype and expose the\n * manifest-derived conventions 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 requireDomain('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 requireDomain('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 requireDomain('intent').onChanged(handler);\n },\n\n /**\n * Receive runtime-attested deliveries, including those retained before registration.\n * @param handler Called with each delivery\n * @returns A Subscription with close() to stop listening\n * @example\n * intent.onDelivery(({ payload }) => render(payload));\n */\n onDelivery(handler: (delivery: IntentDelivery) => void): Subscription {\n return requireDomain('intent').onDelivery(handler);\n },\n};\n","import type {\n Subscription,\n WebrtcEvent,\n WebrtcOpenRequest,\n WebrtcOpenResult,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('webrtc').onEvent(handler);\n },\n};\n","import type { LinkOpenOptions, LinkOpenResult } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.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: SdkDomain<'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 requireDomain('link').open(url, options);\n },\n};\n","import type { CountFilter, CountOptions, CountResult } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated event counts (NAP-COUNT): ask the runtime to count NIP-01\n * filter matches without returning matching event payloads. The runtime owns\n * relay selection, NIP-45 COUNT support, indexing, aggregation, approximation,\n * and refusal policy.\n *\n * @example\n * ```ts\n * import { count } from '@napplet/sdk';\n *\n * const result = await count.query({ kinds: [7], '#e': [eventId] });\n * ```\n */\nexport const count: SdkDomain<'count'> = {\n /**\n * Count events matching one or more NIP-01 filters.\n * @param filters One NIP-01 filter or a non-empty array of filters\n * @param options Optional approximation and HyperLogLog hints\n * @returns Promise resolving to the runtime count result\n */\n query(filters: CountFilter | CountFilter[], options?: CountOptions): Promise<CountResult> {\n return requireDomain('count').query(filters, options);\n },\n};\n","import type {\n ListItem,\n ListMutationResult,\n ListOptions,\n ListRef,\n ListSupport,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('lists').remove(list, items, options);\n },\n};\n","import type {\n CommonActionResult,\n CommonFollowsResult,\n CommonNip19DecodeResult,\n CommonNip19EncodeInput,\n CommonNip19EncodeResult,\n CommonProfileResult,\n CommonProfileTarget,\n CommonReaction,\n CommonReportReason,\n CommonReportTarget,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('common').report(target, reason, text);\n },\n};\n","import type {\n BleAttribute,\n BleEvent,\n BleOpenRequest,\n BleOpenResult,\n BleService,\n BleWriteOptions,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated Bluetooth LE/GATT sessions (NAP-BLE): ask the shell to\n * select a user-approved BLE device, expose opaque sessions and GATT\n * attributes, and receive shell-pushed state/notification/close events. The\n * shell owns chooser UI, permissions, device handles, lifecycle, and policy.\n *\n * @example\n * ```ts\n * import { ble } from '@napplet/sdk';\n *\n * const { session } = await ble.open({ acceptAllDevices: true });\n * const services = await ble.services(session.id);\n * ```\n */\nexport const ble: SdkDomain<'ble'> = {\n /**\n * Ask the runtime to select and open a BLE session.\n * @param request Device selection and optional service request\n * @returns Promise resolving to the runtime-assigned BLE open result\n */\n open(request: BleOpenRequest): Promise<BleOpenResult> {\n return requireDomain('ble').open(request);\n },\n\n /**\n * List exposed GATT services for a session.\n * @param sessionId Runtime-assigned BLE session id\n * @returns Promise resolving to exposed services\n */\n services(sessionId: string): Promise<BleService[]> {\n return requireDomain('ble').services(sessionId);\n },\n\n /**\n * Read a characteristic or descriptor value.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT attribute target\n * @returns Promise resolving to bytes\n */\n read(sessionId: string, target: BleAttribute): Promise<number[]> {\n return requireDomain('ble').read(sessionId, target);\n },\n\n /**\n * Write bytes to a characteristic or descriptor.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT attribute target\n * @param data Byte values to write\n * @param options Optional write mode preference\n * @returns Promise resolving after the runtime acknowledges the write\n */\n write(\n sessionId: string,\n target: BleAttribute,\n data: number[],\n options?: BleWriteOptions,\n ): Promise<void> {\n return requireDomain('ble').write(sessionId, target, data, options);\n },\n\n /**\n * Start notifications or indications for a characteristic.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT characteristic target\n */\n subscribe(sessionId: string, target: BleAttribute): Promise<void> {\n return requireDomain('ble').subscribe(sessionId, target);\n },\n\n /**\n * Stop notifications or indications for a characteristic.\n * @param sessionId Runtime-assigned BLE session id\n * @param target GATT characteristic target\n */\n unsubscribe(sessionId: string, target: BleAttribute): Promise<void> {\n return requireDomain('ble').unsubscribe(sessionId, target);\n },\n\n /**\n * Close an open BLE session.\n * @param sessionId Runtime-assigned BLE session id\n * @param reason Optional reason for the close request\n */\n close(sessionId: string, reason?: string): Promise<void> {\n return requireDomain('ble').close(sessionId, reason);\n },\n\n /**\n * Register for shell-pushed BLE events.\n * @param handler Called with each BLE event\n * @returns A Subscription with `close()` to stop listening\n */\n onEvent(handler: (event: BleEvent) => void): Subscription {\n return requireDomain('ble').onEvent(handler);\n },\n};\n","import type {\n SerialEvent,\n SerialOpenRequest,\n SerialOpenResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\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: SdkDomain<'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 requireDomain('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 requireDomain('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 requireDomain('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 requireDomain('serial').onEvent(handler);\n },\n};\n","import type {\n FsChange,\n FsDirectoryEntry,\n FsInfo,\n FsMetadata,\n FsMkdirOptions,\n FsPickOptions,\n FsPickResult,\n FsReadOptions,\n FsReadResult,\n FsWatchOptions,\n FsWriteOptions,\n FsWriteResult,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Shell-mediated virtual filesystem access (NAP-FS): discover visible roots,\n * ask the runtime to mediate file and directory selection, inspect and list\n * entries, read and write base64-encoded file bytes, create, remove and move\n * them, and subscribe to advisory change events. The runtime owns host paths,\n * mounts, backing store, normalization, policy, and authorization -- the\n * napplet sees only virtual paths.\n *\n * `info()` is advisory discovery, not an authorization token: handle failures\n * even when it advertised a matching permission.\n *\n * @example\n * ```ts\n * import { fs } from '@napplet/sdk';\n *\n * const picked = await fs.pickFile({ accept: [{ extension: '.md' }] });\n * const bytes = await fs.read(picked.entries[0].path);\n * await fs.write('/shared/copy.txt', bytes.data, { mode: 'replace' });\n * const entries = await fs.list('/shared');\n * const watchId = await fs.watch('/shared', { recursive: true });\n * fs.onChanged((change) => refresh(change.path));\n * ```\n */\nexport const fs: SdkDomain<'fs'> = {\n /**\n * Discover visible roots, coarse root permissions, and runtime limits.\n * @returns Promise resolving to advisory filesystem discovery data\n */\n info(): Promise<FsInfo> {\n return requireDomain('fs').info();\n },\n\n /**\n * Ask the runtime to let the user select one file.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickFile(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickFile(options);\n },\n\n /**\n * Ask the runtime to let the user select one or more files.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickFiles(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickFiles(options);\n },\n\n /**\n * Ask the runtime to let the user select one directory.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickDirectory(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickDirectory(options);\n },\n\n /**\n * Ask the runtime to let the user select or name one file destination.\n * @param options Optional picker hints\n * @returns Promise resolving to picked virtual filesystem paths\n */\n pickSaveFile(options?: FsPickOptions): Promise<FsPickResult> {\n return requireDomain('fs').pickSaveFile(options);\n },\n\n /**\n * Read coarse metadata for a visible file or directory.\n * @param path Virtual absolute path of the entry\n * @returns Promise resolving to the entry metadata\n */\n stat(path: string): Promise<FsMetadata> {\n return requireDomain('fs').stat(path);\n },\n\n /**\n * List the direct children of a visible directory. Ordering is unspecified.\n * @param path Virtual absolute path of the directory\n * @returns Promise resolving to the directory entries\n */\n list(path: string): Promise<FsDirectoryEntry[]> {\n return requireDomain('fs').list(path);\n },\n\n /**\n * Read bytes from a visible file.\n * @param path Virtual absolute path of the file\n * @param options Optional range read controls\n * @returns Promise resolving to the read result\n */\n read(path: string, options?: FsReadOptions): Promise<FsReadResult> {\n return requireDomain('fs').read(path, options);\n },\n\n /**\n * Write bytes to a visible file. `data` is RFC 4648 standard padded base64 text.\n * @param path Virtual absolute path of the file\n * @param data Decoded bytes encoded as standard padded base64 text\n * @param options Optional write mode and preconditions\n * @returns Promise resolving to the write result\n */\n write(path: string, data: string, options?: FsWriteOptions): Promise<FsWriteResult> {\n return requireDomain('fs').write(path, data, options);\n },\n\n /**\n * Create a directory.\n * @param path Virtual absolute path of the directory to create\n * @param options Optional recursive parent creation\n * @returns Promise resolving once the runtime acknowledges the creation\n */\n mkdir(path: string, options?: FsMkdirOptions): Promise<void> {\n return requireDomain('fs').mkdir(path, options);\n },\n\n /**\n * Remove a file or directory.\n * @param path Virtual absolute path of the entry to remove\n * @param recursive Remove a non-empty directory and its authorized descendants\n * @returns Promise resolving once the runtime acknowledges the removal\n */\n remove(path: string, recursive?: boolean): Promise<void> {\n return requireDomain('fs').remove(path, recursive);\n },\n\n /**\n * Move or rename a file or directory.\n * @param fromPath Virtual absolute source path\n * @param toPath Virtual absolute destination path\n * @returns Promise resolving once the runtime acknowledges the move\n */\n move(fromPath: string, toPath: string): Promise<void> {\n return requireDomain('fs').move(fromPath, toPath);\n },\n\n /**\n * Start an advisory watch on a visible path.\n * @param path Virtual absolute path to watch\n * @param options Optional recursive descendant coverage\n * @returns Promise resolving to the runtime-generated watch id\n */\n watch(path: string, options?: FsWatchOptions): Promise<string> {\n return requireDomain('fs').watch(path, options);\n },\n\n /**\n * Stop a watch. Unknown ids may be treated as successful no-ops.\n * @param watchId Runtime-generated watch id\n * @returns Promise resolving once the runtime acknowledges the request\n */\n unwatch(watchId: string): Promise<void> {\n return requireDomain('fs').unwatch(watchId);\n },\n\n /**\n * Register for runtime-pushed filesystem change events.\n * @param handler Called with each advisory change\n * @returns A Subscription with `close()` to stop listening\n */\n onChanged(handler: (change: FsChange) => void): Subscription {\n return requireDomain('fs').onChanged(handler);\n },\n};\n","import type {\n DmConversationPage,\n DmConversationQuery,\n DmMessage,\n DmMessagePage,\n DmMessageQuery,\n DmOk,\n DmSendRequest,\n DmSendResult,\n DmStatus,\n DmSubscribeRequest,\n DmSubscription,\n Subscription,\n} from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\nimport type { SdkDomain } from './sdk-domain.js';\n\n/**\n * Runtime-mediated direct messages (NAP-DM): present DM UI while the runtime\n * owns signing, encryption, relay routing, storage, key/session state, and\n * policy.\n *\n * @example\n * ```ts\n * import { dm } from '@napplet/sdk';\n *\n * const { conversations } = await dm.conversations({ limit: 20 });\n * dm.onMessage((message) => render(message));\n * ```\n */\nexport const dm: SdkDomain<'dm'> = {\n /**\n * Get current DM availability and advisory runtime labels.\n * @returns Promise resolving to the runtime DM status\n */\n status(): Promise<DmStatus> {\n return requireDomain('dm').status();\n },\n\n /**\n * Fetch normalized conversations visible to this napplet.\n * @param query Optional cursor and limit\n * @returns Promise resolving to a page of conversations\n */\n conversations(query?: DmConversationQuery): Promise<DmConversationPage> {\n return requireDomain('dm').conversations(query);\n },\n\n /**\n * Fetch normalized message history for one conversation.\n * @param query Conversation id plus optional cursor and limit\n * @returns Promise resolving to a page of messages\n */\n messages(query: DmMessageQuery): Promise<DmMessagePage> {\n return requireDomain('dm').messages(query);\n },\n\n /**\n * Ask the runtime to send a direct message.\n * @param request Recipients, content, and optional conversation/client ids\n * @returns Promise resolving to the normalized send result\n */\n send(request: DmSendRequest): Promise<DmSendResult> {\n return requireDomain('dm').send(request);\n },\n\n /**\n * Start live delivery for one conversation or all visible conversations.\n * @param request Optional conversation scope\n * @returns Promise resolving to the runtime subscription id\n */\n subscribe(request?: DmSubscribeRequest): Promise<DmSubscription> {\n return requireDomain('dm').subscribe(request);\n },\n\n /**\n * Stop a live DM subscription.\n * @param subscriptionId Runtime subscription id from subscribe()\n * @returns Promise resolving to the runtime acknowledgement\n */\n unsubscribe(subscriptionId: string): Promise<DmOk> {\n return requireDomain('dm').unsubscribe(subscriptionId);\n },\n\n /**\n * Register for shell-pushed `dm.message` deliveries.\n * @param handler Called with each message and its runtime subscription id\n * @returns A Subscription with `close()` to stop listening\n */\n onMessage(\n handler: (message: DmMessage, subscriptionId: string) => void,\n ): Subscription {\n return requireDomain('dm').onMessage(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 BLE_DOMAIN } from '@napplet/nap/ble';\nexport { DOMAIN as WEBRTC_DOMAIN } from '@napplet/nap/webrtc';\nexport { DOMAIN as LINK_DOMAIN } from '@napplet/nap/link';\nexport { DOMAIN as COUNT_DOMAIN } from '@napplet/nap/count';\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';\nexport { DOMAIN as FS_DOMAIN } from '@napplet/nap/fs';\nexport { DOMAIN as DM_DOMAIN } from '@napplet/nap/dm';\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 { installBleShim } from '@napplet/nap/ble';\nexport { installWebrtcShim } from '@napplet/nap/webrtc';\nexport { installLinkShim } from '@napplet/nap/link';\nexport { installCountShim } from '@napplet/nap/count';\nexport { installListsShim } from '@napplet/nap/lists';\nexport { installCommonShim } from '@napplet/nap/common';\nexport { installSerialShim } from '@napplet/nap/serial';\nexport { installFsShim } from '@napplet/nap/fs';\nexport { installDmShim } from '@napplet/nap/dm';\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 {\n resourceInfo,\n resourceBytes,\n resourceBytesMany,\n resourceBytesAsObjectURL,\n} from '@napplet/nap/resource';\nexport {\n cvmDiscover,\n cvmRequest,\n cvmListTools,\n cvmCallTool,\n cvmListResources,\n cvmReadResource,\n cvmClose,\n cvmOnEvent,\n cvmRegistryList,\n cvmRegistryHas,\n cvmRegistryDescribe,\n cvmRegistryCall,\n} from '@napplet/nap/cvm';\nexport {\n outboxGetEvent,\n outboxQuery,\n outboxSubscribe,\n outboxPublish,\n outboxResolveRelays,\n} from '@napplet/nap/outbox';\nexport {\n uploadInfo,\n uploadFile,\n uploadStatus,\n uploadOnStatus,\n} from '@napplet/nap/upload';\nexport {\n intentInvoke,\n intentOpen,\n intentAvailable,\n intentHandlers,\n intentOnChanged,\n intentOnDelivery,\n} from '@napplet/nap/intent';\nexport {\n bleOpen,\n bleServices,\n bleRead,\n bleWrite,\n bleSubscribe,\n bleUnsubscribe,\n bleClose,\n bleOnEvent,\n} from '@napplet/nap/ble';\nexport { linkOpen } from '@napplet/nap/link';\nexport { countQuery } from '@napplet/nap/count';\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\nexport {\n fsInfo,\n fsPickFile,\n fsPickFiles,\n fsPickDirectory,\n fsPickSaveFile,\n fsStat,\n fsList,\n fsRead,\n fsWrite,\n fsMkdir,\n fsRemove,\n fsMove,\n fsWatch,\n fsUnwatch,\n fsOnChanged,\n} from '@napplet/nap/fs';\nexport {\n dmStatus,\n dmConversations,\n dmMessages,\n dmSend,\n dmSubscribe,\n dmUnsubscribe,\n dmOnMessage,\n} from '@napplet/nap/dm';\n\nexport { shellReady, shellSupports, shellOnReady, installShellShim, DOMAIN as SHELL_DOMAIN } from '@napplet/nap/shell';\n\nexport { DOMAIN as GAMEPAD_DOMAIN, installGamepadShim, gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from '@napplet/nap/gamepad';\n\nexport {\n DOMAIN as LLM_DOMAIN,\n LLM_ERROR_CODES,\n installLlmShim,\n isLlmFailure,\n llmSelect,\n llmDescribe,\n llmGenerate,\n llmCancel,\n} from '@napplet/nap/llm';\n","/** NAP-SHELL wrapper; other SDK domains remain independent of readiness. */\nimport type { ShellApi } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\n/** Optional runtime environment, queried only when the shell domain is exposed. */\nexport const shell: ShellApi = {\n supports: (domain) => requireDomain('shell').supports(domain),\n ready: () => requireDomain('shell').ready(),\n onReady: (handler) => requireDomain('shell').onReady(handler),\n get services() { return requireDomain('shell').services; },\n};\n"],"mappings":";;;;;;;;;;;AAoCO,IAAM,QAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvC,UACE,SACA,SACA,QACA,SACc;AACd,WAAO,cAAc,OAAO,EAAE,UAAU,SAAS,SAAS,QAAQ,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QACE,UACA,SACqB;AACrB,WAAO,cAAc,OAAO,EAAE,QAAQ,UAAU,OAAO;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,iBACE,UACA,WACA,aAAgC,SACX;AACrB,WAAO,cAAc,OAAO,EAAE,iBAAiB,UAAU,WAAW,UAAU;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAmE;AACvE,WAAO,cAAc,OAAO,EAAE,MAAM,OAAO;AAAA,EAC7C;AACF;AAgBO,IAAM,MAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,KAAK,OAAe,SAAyB;AAC3C,kBAAc,KAAK,EAAE,KAAK,OAAO,OAAO;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GACE,OACA,UACc;AACd,WAAO,cAAc,KAAK,EAAE,GAAG,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEA,SAAS;AAAA,IACP,KAAK,QAAQ;AACX,aAAO,cAAc,KAAK,EAAE,QAAQ,KAAK,MAAM;AAAA,IACjD;AAAA,IACA,SAAS,UAAU;AACjB,aAAO,cAAc,KAAK,EAAE,QAAQ,SAAS,QAAQ;AAAA,IACvD;AAAA,IACA,OAAO;AACL,aAAO,cAAc,KAAK,EAAE,QAAQ,KAAK;AAAA,IAC3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;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,YAAY,eAAe,cAAc,kBAA4B,UAAVA,gBAA8B;AAElG,SAAmB,UAAVA,UAA0B,oBAAoB,oBAAoB,kBAAkB,gBAAgB,uBAAuB;AAEpI;AAAA,EACY,UAAVA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACtNA,IAAM,QAAkB;AAAA,EAC7B,UAAU,CAAC,WAAW,cAAc,OAAO,EAAE,SAAS,MAAM;AAAA,EAC5D,OAAO,MAAM,cAAc,OAAO,EAAE,MAAM;AAAA,EAC1C,SAAS,CAAC,YAAY,cAAc,OAAO,EAAE,QAAQ,OAAO;AAAA,EAC5D,IAAI,WAAW;AAAE,WAAO,cAAc,OAAO,EAAE;AAAA,EAAU;AAC3D;","names":["count","DOMAIN"]}
|
package/dist/llm.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LlmApi } from '@napplet/core';
|
|
2
|
+
export * from '@napplet/nap/llm/types';
|
|
3
|
+
export { LLM_ERROR_CODES } from '@napplet/nap/llm/types';
|
|
4
|
+
export { llmCancel as cancel, llmDescribe as describe, llmGenerate as generate, isLlmFailure, llmCancel, llmDescribe, llmGenerate, llmSelect, llmSelect as select } from '@napplet/nap/llm/sdk';
|
|
5
|
+
|
|
6
|
+
/** User-selected, runtime-mediated language model inference. The runtime owns connections, credentials, and consent. @module */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Delegate llm operations to the current injected runtime.
|
|
10
|
+
* @example const model = await llm.select({ json: true });
|
|
11
|
+
*/
|
|
12
|
+
declare const llm: LlmApi;
|
|
13
|
+
|
|
14
|
+
export { llm };
|
package/dist/llm.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LLM_ERROR_CODES,
|
|
3
|
+
isLlmFailure,
|
|
4
|
+
llm,
|
|
5
|
+
llmCancel,
|
|
6
|
+
llmCancel2,
|
|
7
|
+
llmDescribe,
|
|
8
|
+
llmDescribe2,
|
|
9
|
+
llmGenerate,
|
|
10
|
+
llmGenerate2,
|
|
11
|
+
llmSelect,
|
|
12
|
+
llmSelect2
|
|
13
|
+
} from "./chunk-OMPYTH3E.js";
|
|
14
|
+
import "./chunk-IQSY6FJF.js";
|
|
15
|
+
export {
|
|
16
|
+
LLM_ERROR_CODES,
|
|
17
|
+
llmCancel2 as cancel,
|
|
18
|
+
llmDescribe2 as describe,
|
|
19
|
+
llmGenerate2 as generate,
|
|
20
|
+
isLlmFailure,
|
|
21
|
+
llm,
|
|
22
|
+
llmCancel,
|
|
23
|
+
llmDescribe,
|
|
24
|
+
llmGenerate,
|
|
25
|
+
llmSelect,
|
|
26
|
+
llmSelect2 as select
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=llm.js.map
|
package/dist/llm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napplet/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Typed named exports wrapping window.napplet for bundler-consuming napplet developers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"./gamepad": {
|
|
15
15
|
"types": "./dist/gamepad.d.ts",
|
|
16
16
|
"import": "./dist/gamepad.js"
|
|
17
|
+
},
|
|
18
|
+
"./llm": {
|
|
19
|
+
"types": "./dist/llm.d.ts",
|
|
20
|
+
"import": "./dist/llm.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
@@ -24,8 +28,8 @@
|
|
|
24
28
|
"access": "public"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@napplet/
|
|
28
|
-
"@napplet/
|
|
31
|
+
"@napplet/nap": "0.35.1",
|
|
32
|
+
"@napplet/core": "0.36.0"
|
|
29
33
|
},
|
|
30
34
|
"devDependencies": {
|
|
31
35
|
"tsup": "^8.5.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/require-napplet.ts","../src/gamepad.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 is unavailable -- runtime did not inject the napplet namespace');\n }\n return w.napplet;\n}\n\n/**\n * Retrieve a runtime-injected domain from `window.napplet`.\n *\n * Shells inject only the NAP domains available to the current napplet, so SDK\n * wrappers check domain presence at method invocation instead of treating every\n * property as installed.\n */\nexport function requireDomain<K extends keyof NappletGlobal>(\n domain: K,\n): NonNullable<NappletGlobal[K]> {\n const napplet = requireNapplet();\n const value = napplet[domain];\n if (!value) {\n throw new Error(\n `window.napplet.${String(domain)} is unavailable -- runtime did not inject this domain`,\n );\n }\n return value as NonNullable<NappletGlobal[K]>;\n}\n","/** Application-side cached controller input. Guard optional domain presence before use. */\nimport type { GamepadApi, GamepadSlot, GamepadState, Subscription } from '@napplet/core';\nimport { requireDomain } from './require-napplet.js';\n\n/**\n * Controller snapshots delivered by the runtime to this napplet.\n * @example\n * import { gamepad } from '@napplet/sdk/gamepad';\n * const pads = gamepad.getGamepads();\n */\nexport const gamepad: GamepadApi = {\n get available(): boolean { return requireDomain('gamepad').available; },\n get focused(): boolean { return requireDomain('gamepad').focused; },\n /**\n * Read the complete cached slot list synchronously.\n * @returns Latest controller slots.\n * @example const pads = gamepad.getGamepads();\n */\n getGamepads(): GamepadSlot[] { return requireDomain('gamepad').getGamepads(); },\n /**\n * Observe complete snapshots, including neutral focus-loss states.\n * @param handler Receives each state update.\n * @returns Local subscription handle.\n * @example const sub = gamepad.onChange((state) => render(state));\n */\n onChange(handler: (state: GamepadState) => void): Subscription { return requireDomain('gamepad').onChange(handler); },\n};\n\nexport type { Gamepad, GamepadApi, GamepadButton, GamepadSlot, GamepadState, GamepadUnavailableReason } from '@napplet/core';\nexport { gamepadGetGamepads, gamepadAvailable, gamepadFocused, gamepadOnChange } from '@napplet/nap/gamepad/sdk';\n"],"mappings":";AAcO,SAAS,iBAAgC;AAC9C,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,SAAS;AACd,UAAM,IAAI,MAAM,+EAA+E;AAAA,EACjG;AACA,SAAO,EAAE;AACX;AASO,SAAS,cACd,QAC+B;AAC/B,QAAM,UAAU,eAAe;AAC/B,QAAM,QAAQ,QAAQ,MAAM;AAC5B,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,kBAAkB,OAAO,MAAM,CAAC;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;;;ACXA,SAAS,oBAAoB,kBAAkB,gBAAgB,uBAAuB;AAnB/E,IAAM,UAAsB;AAAA,EACjC,IAAI,YAAqB;AAAE,WAAO,cAAc,SAAS,EAAE;AAAA,EAAW;AAAA,EACtE,IAAI,UAAmB;AAAE,WAAO,cAAc,SAAS,EAAE;AAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlE,cAA6B;AAAE,WAAO,cAAc,SAAS,EAAE,YAAY;AAAA,EAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9E,SAAS,SAAsD;AAAE,WAAO,cAAc,SAAS,EAAE,SAAS,OAAO;AAAA,EAAG;AACtH;","names":[]}
|