@kernlize/core 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +173 -19
- package/dist/index.js +262 -66
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Observable, Subscription } from 'rxjs';
|
|
2
2
|
import { EventStore } from 'applesauce-core';
|
|
3
|
-
import { RelayPool } from 'applesauce-relay';
|
|
3
|
+
import { RelayPool, RelayPoolOptions } from 'applesauce-relay';
|
|
4
4
|
import { AccountManager, IAccount } from 'applesauce-accounts';
|
|
5
5
|
import { RelayPoolHooks, RelayPoolLike, ShellBridge, ShellEnvironment, AuthHooks, ShellAdapter, OriginRegistry, NappletMessageDecision, CapabilityHooks, NappletRevocation, UnroutedMessageInfo } from '@kehto/shell';
|
|
6
|
-
import { Capability, ConsentRequest, Signer,
|
|
6
|
+
import { Capability, RelayPlanningServiceHandler, ConsentRequest, Signer, FirewallEvent, AclStateContainer, ServiceRegistry, ServiceHandler } from '@kehto/runtime';
|
|
7
7
|
import { NappletManifest, NappletArtifactCache, ResolvedNapplet } from '@kehto/nip/5d';
|
|
8
8
|
import { NostrEvent, NostrFilter, EventTemplate, NappletMessage } from '@napplet/core';
|
|
9
9
|
import { WindowVisibility, GuardConfig, GuardProfile, GuardEvent, MitigationDescription, GuardDisposition, OpClass } from '@kernlize/guard';
|
|
@@ -13,10 +13,10 @@ import { EventCacheOpener, ConnectedEventCache } from './cache/index.js';
|
|
|
13
13
|
export { AttachEventCacheOptions, AttachedEventCache, CacheRecoveryEvent, EventCache, EventCacheAdapter, EventRecords, FilenameStorage, IndexedDbCacheOptions, LockManagerLike, OpenEventCacheOptions, SqlStatement, SqlValue, SqliteDriver, SqliteFiles, SqliteOpfsOptions, attachEventCache, connectEventCache, createEventCache, createIndexedDbCacheAdapter, createMemoryCacheAdapter, createSqliteOpfsCacheAdapter, defaultWebCacheAdapters, fromEventDatabase, isCorruptionError, openEventCache } from './cache/index.js';
|
|
14
14
|
import { ISigner } from 'applesauce-signers';
|
|
15
15
|
import { NostrEvent as NostrEvent$1, Filter } from 'applesauce-core/helpers';
|
|
16
|
-
import { IntentCatalogEntry, RelayPoolServiceOptions, DmRelayPool, IdentityServiceOptions, DmAdapter, Uploader, ThemeService, DmService, ResourceFetchInit, IntentResolver, IntentDispatchParams } from '@kehto/services';
|
|
16
|
+
import { ConfigSettingsContext, ConfigServiceOptions, IntentCatalogEntry, RelayPoolServiceOptions, DmRelayPool, IdentityServiceOptions, DmAdapter, Uploader, CommonServiceOptions, ThemeService, DmService, ResourceFetchInit, IntentResolver, IntentDispatchParams } from '@kehto/services';
|
|
17
17
|
import { AddressPointerLoader } from 'applesauce-loaders/loaders';
|
|
18
18
|
import { CacheRequest } from 'applesauce-loaders';
|
|
19
|
-
import { RateLimit } from '@kehto/
|
|
19
|
+
import { FirewallStateContainer, RateLimit } from '@kehto/rate-limit/legacy';
|
|
20
20
|
export { LayoutStrategy, Rect, WindowPlacement, WindowState } from '@kehto/wm';
|
|
21
21
|
export { LayoutChoice, LayoutEntry, LayoutOptions, LayoutRegistry, ManagedWindow, MasterStackOptions, VisibilityTarget, WindowManager, WindowManagerOptions, WindowManagerState, WindowSize, createColumnsLayout, createDefaultLayouts, createDwindleLayout, createLayoutRegistry, createMasterStackLayout, createWindowManager, floatingLayout } from './wm/index.js';
|
|
22
22
|
export { CryptoFallbackReport, CryptoScope, createFallbackSubtle, installCryptoFallback, randomUuidFallback, renderRandomUuidFallbackScript } from './crypto/index.js';
|
|
@@ -454,6 +454,23 @@ declare function createAccountMailboxes(options: AccountMailboxesOptions): Accou
|
|
|
454
454
|
|
|
455
455
|
/** The slice of applesauce's `RelayPool` kernl adapts. Narrow so tests can supply a fake. */
|
|
456
456
|
type ApplesaucePool = Pick<RelayPool, 'req' | 'request' | 'publish'>;
|
|
457
|
+
/**
|
|
458
|
+
* How the shell's own pool redials a relay that refused the connection.
|
|
459
|
+
*
|
|
460
|
+
* applesauce-relay 7.1 redials refused connections three times by default,
|
|
461
|
+
* pausing one, two and three seconds, and a publish waits for every relay it
|
|
462
|
+
* was sent to, so one dead relay in a tier held a publish for about six
|
|
463
|
+
* seconds. One redial after a second keeps the case it exists for: a busy
|
|
464
|
+
* public relay answers a websocket upgrade with 502 or 503 for a moment and
|
|
465
|
+
* accepts the next one (D-025, D-037). Subscriptions keep applesauce's
|
|
466
|
+
* default, because a live subscription should come back after a drop.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```ts
|
|
470
|
+
* const pool = new RelayPool(SHELL_RELAY_OPTIONS);
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
declare const SHELL_RELAY_OPTIONS: RelayPoolOptions;
|
|
457
474
|
/** A subscription that delivers events once each and signals the end of stored events. */
|
|
458
475
|
interface EoseSubscription {
|
|
459
476
|
unsubscribe(): void;
|
|
@@ -613,6 +630,42 @@ declare function fileServerTags(servers: readonly string[], previous?: NostrEven
|
|
|
613
630
|
*/
|
|
614
631
|
declare function createAccountFileServers(options: AccountFileServersOptions): AccountFileServers;
|
|
615
632
|
|
|
633
|
+
/** What the host shows when an applet asks for its settings. */
|
|
634
|
+
interface SettingsPrompt {
|
|
635
|
+
/** The applet's title, for the heading. */
|
|
636
|
+
readonly title: string;
|
|
637
|
+
/** The section the applet asked to open, if any. */
|
|
638
|
+
readonly section?: string;
|
|
639
|
+
/** The accepted schema, the current values and the commit that validates, saves and tells the applet. */
|
|
640
|
+
readonly context: ConfigSettingsContext;
|
|
641
|
+
}
|
|
642
|
+
/** Options for {@link createAppletConfig}. */
|
|
643
|
+
interface AppletConfigOptions {
|
|
644
|
+
readonly storage: StorageLike;
|
|
645
|
+
/** The applet a window runs, as a key that stays the same across its versions, with its title; none for an unknown window. */
|
|
646
|
+
readonly appletOf: (windowId: string) => {
|
|
647
|
+
readonly key: string;
|
|
648
|
+
readonly title: string;
|
|
649
|
+
} | undefined;
|
|
650
|
+
/** Shows the settings form. */
|
|
651
|
+
readonly present: (prompt: SettingsPrompt) => void;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* kernl's NAP-CONFIG hooks for kehto's `createConfigService`: an applet's
|
|
655
|
+
* settings, as the person set them in a form the shell draws from the
|
|
656
|
+
* applet's schema. kehto validates the schema and every value. kernl keeps
|
|
657
|
+
* the values per applet, not per version, so an update keeps them, and only
|
|
658
|
+
* the shell's form ever writes them (D-036).
|
|
659
|
+
*
|
|
660
|
+
* @param options - Storage, the window-to-applet lookup and the form.
|
|
661
|
+
* @returns Options for `createConfigService`.
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* registry.config = createConfigService(createAppletConfig({ storage, appletOf, present: host.presentSettings })).handler;
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
declare function createAppletConfig(options: AppletConfigOptions): ConfigServiceOptions;
|
|
668
|
+
|
|
616
669
|
/**
|
|
617
670
|
* How many manifests the store asks each relay for.
|
|
618
671
|
*
|
|
@@ -1134,6 +1187,8 @@ interface KernlHost {
|
|
|
1134
1187
|
readonly storage: StorageLike;
|
|
1135
1188
|
/** Ask the user. Resolve `false` on dismiss. The core never times this out. */
|
|
1136
1189
|
presentConsent(prompt: ConsentPrompt): void;
|
|
1190
|
+
/** Show an applet's settings form. Without it applets cannot have settings, and the `config` domain is not offered (D-036). */
|
|
1191
|
+
presentSettings?(prompt: SettingsPrompt): void;
|
|
1137
1192
|
/** Show something the applet or the guard wants the user to know. */
|
|
1138
1193
|
notify(notice: {
|
|
1139
1194
|
readonly title: string;
|
|
@@ -1374,6 +1429,26 @@ declare function publishAccepted(pool: ApplesaucePool, relays: string[], event:
|
|
|
1374
1429
|
* ```
|
|
1375
1430
|
*/
|
|
1376
1431
|
declare function createAppletRelayBackend(pool: ApplesaucePool, tiers: RelayTiers): RelayPoolServiceOptions;
|
|
1432
|
+
/**
|
|
1433
|
+
* kehto's relay service over the shared pool, with publishes planned by the
|
|
1434
|
+
* event's kind.
|
|
1435
|
+
*
|
|
1436
|
+
* kehto plans every relay operation before it runs and then publishes only to
|
|
1437
|
+
* the planned relays (`publishToRelays`), but its publish plan cannot see the
|
|
1438
|
+
* event. kernl's plan does, so a profile update is planned onto discovery
|
|
1439
|
+
* relays and the user's own, and a note onto the outbox plus the super tier,
|
|
1440
|
+
* as before. An applet's explicit relay hint is planned as kehto plans it.
|
|
1441
|
+
*
|
|
1442
|
+
* @param pool - The shared applesauce pool.
|
|
1443
|
+
* @param tiers - Relay tiers used to route publishes and unhinted subscriptions.
|
|
1444
|
+
* @returns The `relay` service handler.
|
|
1445
|
+
* @example
|
|
1446
|
+
* ```ts
|
|
1447
|
+
* registry.relay = createAppletRelayService(pool, tiers);
|
|
1448
|
+
* registry.relay.planRelayOperation('w1', { type: 'relay.publish', id: '1', event: { kind: 0 } }).relayUrls;
|
|
1449
|
+
* ```
|
|
1450
|
+
*/
|
|
1451
|
+
declare function createAppletRelayService(pool: ApplesaucePool, tiers: RelayTiers): RelayPlanningServiceHandler;
|
|
1377
1452
|
/**
|
|
1378
1453
|
* The relay pool a messaging backend reads and writes through, satisfying
|
|
1379
1454
|
* kehto's `DmRelayPool` over the same shared applesauce pool.
|
|
@@ -1734,8 +1809,8 @@ type PublishedPointer = Exclude<AppletPointer, {
|
|
|
1734
1809
|
* release can still answer. `patienceMs` runs from the first relay that
|
|
1735
1810
|
* answers with nothing, so a slower relay that does hold the applet is not cut
|
|
1736
1811
|
* off. `timeoutMs` bounds a round of asking when no relay answers at all; a
|
|
1737
|
-
* lookup is at most two rounds. `retryDelayMs` is the pause before a
|
|
1738
|
-
*
|
|
1812
|
+
* lookup is at most two rounds. `retryDelayMs` is the pause before a relay
|
|
1813
|
+
* that refused the connection is dialled once more.
|
|
1739
1814
|
*/
|
|
1740
1815
|
interface ManifestTiming {
|
|
1741
1816
|
readonly settleMs: number;
|
|
@@ -1764,8 +1839,8 @@ declare const MANIFEST_TIMING: ManifestTiming;
|
|
|
1764
1839
|
* relay had a bad minute. For addresses, the newest event wins, since a named
|
|
1765
1840
|
* applet is an addressable event that its author replaces on every release. A
|
|
1766
1841
|
* relay that is down, silent or hangs up does not fail the lookup while
|
|
1767
|
-
* another one answers, a
|
|
1768
|
-
*
|
|
1842
|
+
* another one answers, a relay that refused the connection is dialled once
|
|
1843
|
+
* more, and hints that are not relay URLs are ignored.
|
|
1769
1844
|
*
|
|
1770
1845
|
* @param pool - The shared applesauce pool.
|
|
1771
1846
|
* @param tiers - Relay tiers; `apps` is asked first, `super` as the fallback.
|
|
@@ -1773,7 +1848,8 @@ declare const MANIFEST_TIMING: ManifestTiming;
|
|
|
1773
1848
|
* @param timing - Overrides for {@link MANIFEST_TIMING}, applied to each round.
|
|
1774
1849
|
* @returns The manifest event, unverified.
|
|
1775
1850
|
* @throws `unavailable:manifest` when a relay answered and none had it, or
|
|
1776
|
-
* there was no relay to ask; `unavailable:
|
|
1851
|
+
* there was no relay to ask; `unavailable:unreachable` when every relay in every
|
|
1852
|
+
* round failed to open a connection; `unavailable:network` when no relay answered in time.
|
|
1777
1853
|
* @example
|
|
1778
1854
|
* ```ts
|
|
1779
1855
|
* const event = await fetchManifestEvent(pool, tiers, decodePointer('naddr1…'));
|
|
@@ -2121,13 +2197,13 @@ type RuntimeFirewallState = Pick<FirewallStateContainer, 'setRateLimit' | 'setGl
|
|
|
2121
2197
|
* burst check, and the user's choices to deny or block live in the grants
|
|
2122
2198
|
* layer, not here.
|
|
2123
2199
|
*
|
|
2124
|
-
* @param firewallState - `
|
|
2200
|
+
* @param firewallState - The `legacyFirewall` from {@link createRuntimeFirewallHooks}.
|
|
2125
2201
|
* @param config - Current guard configuration.
|
|
2126
2202
|
* @param napplet - Applet identity (dTag).
|
|
2127
2203
|
* @returns Nothing; the firewall state is mutated and persisted.
|
|
2128
2204
|
* @example
|
|
2129
2205
|
* ```ts
|
|
2130
|
-
* applyRuntimeFirewallRules(
|
|
2206
|
+
* applyRuntimeFirewallRules(hooks.legacyFirewall, guardConfig, summary.identity.dTag);
|
|
2131
2207
|
* ```
|
|
2132
2208
|
*/
|
|
2133
2209
|
declare function applyRuntimeFirewallRules(firewallState: RuntimeFirewallState, config: GuardConfig, napplet: string): void;
|
|
@@ -2136,13 +2212,13 @@ declare function applyRuntimeFirewallRules(firewallState: RuntimeFirewallState,
|
|
|
2136
2212
|
* multiplier, which the runtime applies with the focus kernl reports through
|
|
2137
2213
|
* `getFocusContext`, and the startup burst guard.
|
|
2138
2214
|
*
|
|
2139
|
-
* @param firewallState - `
|
|
2215
|
+
* @param firewallState - The `legacyFirewall` from {@link createRuntimeFirewallHooks}.
|
|
2140
2216
|
* @param config - The guard configuration of the profile now in force.
|
|
2141
2217
|
* @returns Nothing; the firewall state is mutated and persisted.
|
|
2142
2218
|
* @example
|
|
2143
2219
|
* ```ts
|
|
2144
|
-
* applyRuntimeFirewallProfile(
|
|
2145
|
-
*
|
|
2220
|
+
* applyRuntimeFirewallProfile(hooks.legacyFirewall, createGuardConfig('balanced'));
|
|
2221
|
+
* hooks.legacyFirewall.getConfig().unfocusedMultiplier; // 0.5
|
|
2146
2222
|
* ```
|
|
2147
2223
|
*/
|
|
2148
2224
|
declare function applyRuntimeFirewallProfile(firewallState: RuntimeFirewallState, config: GuardConfig): void;
|
|
@@ -2165,7 +2241,8 @@ declare function applyRuntimeFirewallProfile(firewallState: RuntimeFirewallState
|
|
|
2165
2241
|
declare function toGuardEvent(event: FirewallEvent, at: number): GuardEvent;
|
|
2166
2242
|
/** The runtime firewall hooks kernl hands to `createShellAdapter`. */
|
|
2167
2243
|
interface RuntimeFirewallHooks {
|
|
2168
|
-
|
|
2244
|
+
/** The firewall the runtime evaluates; also what {@link applyRuntimeFirewallRules} configures. */
|
|
2245
|
+
readonly legacyFirewall: FirewallStateContainer;
|
|
2169
2246
|
readonly onFirewallEvent: (event: FirewallEvent) => void;
|
|
2170
2247
|
}
|
|
2171
2248
|
/** Options for {@link createRuntimeFirewallHooks}. */
|
|
@@ -2177,18 +2254,19 @@ interface RuntimeFirewallHooksOptions {
|
|
|
2177
2254
|
readonly now?: () => number;
|
|
2178
2255
|
}
|
|
2179
2256
|
/**
|
|
2180
|
-
* The runtime firewall's
|
|
2181
|
-
*
|
|
2257
|
+
* The runtime firewall, persisted in kernl's host storage, and its event
|
|
2258
|
+
* sink into the guard event stream. These report what the runtime itself
|
|
2182
2259
|
* refused, which is the startup burst and anything over budget when held
|
|
2183
2260
|
* envelopes are released; what kernl drops before the runtime sees it is
|
|
2184
2261
|
* reported by kernl's own guard layers.
|
|
2185
2262
|
*
|
|
2186
2263
|
* @param options - Host storage, the guard event sink and a clock.
|
|
2187
|
-
* @returns `
|
|
2264
|
+
* @returns `legacyFirewall` and `onFirewallEvent` for the `ShellAdapter`.
|
|
2188
2265
|
* @example
|
|
2189
2266
|
* ```ts
|
|
2190
2267
|
* const hooks = createRuntimeFirewallHooks({ storage: localStorage, onEvent: (event) => log.push(event) });
|
|
2191
2268
|
* const adapter: ShellAdapter = { ...rest, ...hooks };
|
|
2269
|
+
* applyRuntimeFirewallProfile(hooks.legacyFirewall, createGuardConfig('strict'));
|
|
2192
2270
|
* ```
|
|
2193
2271
|
*/
|
|
2194
2272
|
declare function createRuntimeFirewallHooks(options: RuntimeFirewallHooksOptions): RuntimeFirewallHooks;
|
|
@@ -2868,6 +2946,39 @@ declare function askUploadConsent(host: Pick<KernlHost, 'presentConsent'>, apple
|
|
|
2868
2946
|
*/
|
|
2869
2947
|
declare function createBlossomUploader(options: BlossomUploaderOptions): Uploader;
|
|
2870
2948
|
|
|
2949
|
+
/** What the social actions need from the shell. */
|
|
2950
|
+
interface CommonActionsOptions {
|
|
2951
|
+
readonly store: EventStore;
|
|
2952
|
+
readonly profiles: Pick<Profiles, 'settled'>;
|
|
2953
|
+
/** The signed-in account's key, or none. */
|
|
2954
|
+
readonly pubkey: () => string | undefined;
|
|
2955
|
+
/** The account's signer, or none for a read-only session. */
|
|
2956
|
+
readonly signer: () => Pick<ISigner, 'signEvent'> | undefined;
|
|
2957
|
+
/** The shell's signing gate: destructive changes, such as a new follow list, are put to the person first. */
|
|
2958
|
+
readonly consent: SigningConsent;
|
|
2959
|
+
/** Publishes a signed event and resolves how many relays accepted it; rejects when none did (D-028). */
|
|
2960
|
+
readonly publish: (event: NostrEvent) => Promise<number>;
|
|
2961
|
+
/** Loads the account's current follow list into the store before it is changed. */
|
|
2962
|
+
readonly loadFollows: (pubkey: string) => Promise<void>;
|
|
2963
|
+
}
|
|
2964
|
+
/**
|
|
2965
|
+
* kernl's NAP-COMMON hooks for kehto's `createCommonService`: profiles and
|
|
2966
|
+
* follows to read, and follow, unfollow, react and report to write, all on the
|
|
2967
|
+
* person's behalf. Reads are public data. A follow-list change replaces part
|
|
2968
|
+
* of the person's public record, so it passes the shell's signing gate and is
|
|
2969
|
+
* shown to them as what it changes; reactions and reports are posts. Every
|
|
2970
|
+
* write succeeds when any relay accepts it (D-028). A read-only session
|
|
2971
|
+
* cannot write (D-035).
|
|
2972
|
+
*
|
|
2973
|
+
* @param options - Store, profiles, account, signer, signing gate, publisher and follow-list loader.
|
|
2974
|
+
* @returns Options for `createCommonService`.
|
|
2975
|
+
* @example
|
|
2976
|
+
* ```ts
|
|
2977
|
+
* registry.common = createCommonService(createCommonActions({ store, profiles, pubkey, signer, consent, publish, loadFollows }));
|
|
2978
|
+
* ```
|
|
2979
|
+
*/
|
|
2980
|
+
declare function createCommonActions(options: CommonActionsOptions): CommonServiceOptions;
|
|
2981
|
+
|
|
2871
2982
|
/** The parts of the shell that know people and servers: the event cache, the loader over it, profiles, mailboxes and the directory. */
|
|
2872
2983
|
interface KernlNetwork {
|
|
2873
2984
|
readonly eventCache: ConnectedEventCache;
|
|
@@ -2905,6 +3016,22 @@ interface KernlNetworkParts {
|
|
|
2905
3016
|
* ```
|
|
2906
3017
|
*/
|
|
2907
3018
|
declare function createKernlNetwork(options: Pick<KernlOptions, 'eventCache'>, parts: KernlNetworkParts): KernlNetwork;
|
|
3019
|
+
/**
|
|
3020
|
+
* The social actions the shell offers applets, over the composed network:
|
|
3021
|
+
* profiles from the profile service, the account's follow list loaded before
|
|
3022
|
+
* it changes, writes signed through the signing gate and published to the
|
|
3023
|
+
* tier for their kind (D-035).
|
|
3024
|
+
*
|
|
3025
|
+
* @param parts - The store, pool, tiers and accounts.
|
|
3026
|
+
* @param network - The composed network.
|
|
3027
|
+
* @param consent - The shell's signing gate.
|
|
3028
|
+
* @returns Options for kehto's `createCommonService`.
|
|
3029
|
+
* @example
|
|
3030
|
+
* ```ts
|
|
3031
|
+
* createKernlServices({ ..., common: commonActionsFor(parts, network, consent) });
|
|
3032
|
+
* ```
|
|
3033
|
+
*/
|
|
3034
|
+
declare function commonActionsFor(parts: Omit<KernlNetworkParts, 'destroyed$'>, network: Pick<KernlNetwork, 'profiles' | 'replaceableLoader' | 'signer'>, consent: SigningConsent): CommonServiceOptions;
|
|
2908
3035
|
|
|
2909
3036
|
/**
|
|
2910
3037
|
* Whether a host-supplied theme has the colours NAP-THEME requires.
|
|
@@ -2939,6 +3066,10 @@ interface KernlServiceDeps {
|
|
|
2939
3066
|
readonly host: Pick<KernlHost, 'notify' | 'openLink'>;
|
|
2940
3067
|
readonly bridges: BridgeRegistry;
|
|
2941
3068
|
readonly messaging: MessagingRegistry;
|
|
3069
|
+
/** Applet settings (NAP-CONFIG); without them the `config` domain is not offered. */
|
|
3070
|
+
readonly config?: ConfigServiceOptions;
|
|
3071
|
+
/** Social actions for applets (NAP-COMMON); without them the `common` domain is not offered. */
|
|
3072
|
+
readonly common?: CommonServiceOptions;
|
|
2942
3073
|
/** Uploads for applets (NAP-UPLOAD); without it the `upload` domain is not offered. */
|
|
2943
3074
|
readonly uploader?: Uploader;
|
|
2944
3075
|
/** Names conversation participants for applets; without it they are listed by key alone. */
|
|
@@ -3039,6 +3170,8 @@ interface LifecycleContext {
|
|
|
3039
3170
|
readonly adapter: ShellAdapter;
|
|
3040
3171
|
readonly bridge: ShellBridge;
|
|
3041
3172
|
readonly pipeline: GuardPipeline;
|
|
3173
|
+
/** The runtime firewall kernl constructed; mounting installs the applet's rates in it. */
|
|
3174
|
+
readonly firewall: RuntimeFirewallState;
|
|
3042
3175
|
readonly grants: KernlGrants;
|
|
3043
3176
|
/** Every planned applet is installed, so others can hand it work. */
|
|
3044
3177
|
readonly installed: InstalledApplets;
|
|
@@ -3051,6 +3184,27 @@ interface LifecycleContext {
|
|
|
3051
3184
|
/** Applets the host ships with itself. */
|
|
3052
3185
|
readonly builtins: readonly BuiltinApplet[];
|
|
3053
3186
|
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Why a grant change stops a running window, or nothing when it does not.
|
|
3189
|
+
*
|
|
3190
|
+
* A window keeps the environment it was started with, and `shell.init` is not
|
|
3191
|
+
* sent again, so a window whose grant no longer covers a domain it was started
|
|
3192
|
+
* with would go on advertising it. Granting more never stops a window; the
|
|
3193
|
+
* applet sees the new domain the next time it opens.
|
|
3194
|
+
*
|
|
3195
|
+
* @param plan - The running window's plan; its environment is what it was started with.
|
|
3196
|
+
* @param record - The grant record that just changed.
|
|
3197
|
+
* @param baseline - Domains every applet holds, from `grants.baselineDomains()`.
|
|
3198
|
+
* @returns `blocked`, `grant-narrowed`, or `undefined` when the window may keep running.
|
|
3199
|
+
* @example
|
|
3200
|
+
* ```ts
|
|
3201
|
+
* grants.changes$.subscribe((record) => {
|
|
3202
|
+
* const reason = grantNarrowingReason(plan, record, grants.baselineDomains());
|
|
3203
|
+
* if (reason) handle.revoked(reason);
|
|
3204
|
+
* });
|
|
3205
|
+
* ```
|
|
3206
|
+
*/
|
|
3207
|
+
declare function grantNarrowingReason(plan: MountPlan, record: GrantRecord, baseline: readonly string[]): 'blocked' | 'grant-narrowed' | undefined;
|
|
3054
3208
|
/** The applet half of {@link Kernl}. */
|
|
3055
3209
|
type AppletLifecycle = Pick<Kernl, 'resolve' | 'install' | 'plan' | 'mount' | 'applets' | 'handleWindowMessage'>;
|
|
3056
3210
|
/**
|
|
@@ -3323,4 +3477,4 @@ declare const PACKAGE_NAME = "@kernlize/core";
|
|
|
3323
3477
|
*/
|
|
3324
3478
|
declare const KERNL_FRAME_POLICY_META: string;
|
|
3325
3479
|
|
|
3326
|
-
export { type AccountFileServers, type AccountFileServersOptions, type AccountMailboxes, type AccountMailboxesOptions, type ApplesaucePool, type AppletCatalog, type AppletHandle, type AppletIdentity, type AppletLifecycle, type AppletPointer, type AppletStatus, type AppletSummary, BASELINE_DOMAINS, BLOB_TIMEOUT_MS, BUILTIN_PUBLISHER, type BlossomUploaderOptions, type BuiltinApplet, CATALOG_EMIT_MS, CATALOG_LIMIT, CATALOG_SETTLE_MS, CATALOG_TIMEOUT_MS, CONTROLLER_DENY_POLICY, CURRENT_VERSION_TIMEOUT_MS, type CatalogEntry, type CatalogQuery, ConnectedEventCache, type ConsentLine, type ConsentPrompt, type ConsentSummary, DEFAULT_FILE_SERVERS, DEFAULT_MONITOR_RELAYS, DEFAULT_RELAY_TIERS, DEFAULT_SUGGESTIONS, DELIVERY_RETRY, DOMAIN_CAPABILITIES, type DefaultBridgesOptions, type DefaultMessagingOptions, type DirectoryPool, type EoseSubscription, EventCacheOpener, type FileServerState, type FrameLike, type GrantRecord, type Grants, type GrantsOptions, type GroupMessagingOptions, type GuardFacade, type GuardPipeline, type GuardPipelineOptions, HANDLER_PREFERENCES_KIND, type HandlerChoice, type HandlerDefaults, type HandlerDefaultsOptions, type HandlerOption, type HandlerPreferences, type HandlerPrompt, type IdentityProfile, type IdentityProviderOptions, type IdentityProviders, type InboxRelays, type InstallableApplet, type InstalledApplet, type InstalledApplets, type InstalledContract, type IntentDeliveryOptions, type IntentRouter, type IntentRouterOptions, type Intents, KERNL_FRAME_POLICY_META, type Kernl, KernlAccountManager, type KernlGrants, type KernlHost, type KernlIntentDeps, type KernlIntents, type KernlNetwork, type KernlNetworkParts, type KernlOptions, type KernlServiceDeps, type KernlServices, LINK_PROTOCOLS, type LifecycleContext, type LoadCatalogOptions, type LookupBefore, type LookupReplaceableOptions, MANIFEST_TIMING, MESSAGING_UNAVAILABLE_REASONS, type MailboxPool, type MailboxSigner, type MailboxState, type Mailboxes, type ManifestTiming, type MessagingBackendFactories, type MessagingEncryption, type MountDeps, type MountGuardHooks, type MountPlan, type MountedApplet, type MultiServerUpload, type NamespacedStore, type OutboxRelayPoolLike, PACKAGE_NAME, PLAINTEXT_KEY_ACCOUNT_TYPES, type PipelineDisposition, type PlanMountOptions, type PreferenceSigner, type ProfileCard, type ProfileLoader, type ProfilePointer, type Profiles, type ProfilesOptions, type PublishAnswer, type PublishOutcome, type PublishedPointer, RUNTIME_FIREWALL_STORAGE_KEY, RUNTIME_OP_CLASSES, type RatchetMessagingOptions, type RelayDirectory, type RelayDirectoryOptions, type RelayListing, type RelayPermissions, type RelayTier, type RelayTiers, type ResolveAppletIdentity, type ResolveAppletOptions, type ResolvedApplet, type RuntimeFirewallHooks, type RuntimeFirewallHooksOptions, type RuntimeFirewallRules, type RuntimeFirewallState, type RuntimeRateRule, type SealedGroupStoreOptions, type SealedRatchetStorageOptions, type Session, type ShellAdapterDeps, type SignerMessagingOptions, type SigningConsent, type SigningConsentOptions, type SigningTemplate, type StorageLike, type SuggestOptions, type SuggestPurpose, type TierMap, type TopicCount, UNKNOWN_CURRENT_VERSION, type UploadDetails, type WindowResolution, abbreviate, addressOf, applyRuntimeFirewallProfile, applyRuntimeFirewallRules, askUploadConsent, builtinAddress, capabilitiesForDomain, capabilitiesForDomains, catalogIdForRef, catalogRelays, createAccountFileServers, createAccountMailboxes, createAppletLifecycle, createAppletRelayBackend, createAuthHooks, createBlossomUploader, createConsentHandler, createDefaultBridges, createDefaultMessaging, createDmRelayPool, createEnvironmentResolver, createGrants, createGroupMessagesBackend, createGroupNetwork, createGuardPipeline, createHandlerDefaults, createIdentityProviders, createInstalledApplets, createIntentDelivery, createIntentRouter, createKernl, createKernlAccounts, createKernlIntents, createKernlNetwork, createKernlServices, createLegacyMessagesBackend, createNamespacedStore, createOutboxRelayPool, createPrivateMessagesBackend, createProfiles, createRatchetMessagesBackend, createRelayDirectory, createRelayPoolHooks, createRelayPoolLike, createRelayTiers, createReplaceableLoader, createRuntimeFirewallHooks, createSealedGroupStore, createSealedRatchetStorage, createShellAdapter, createSigningConsent, decodePointer, defaultFetchBlob, describeChange, describeOutcome, describeUpload, fetchManifestEvent, fileServerTags, fileServersFromEvent, fuzzyScore, isDestructiveKind, isReadOnlyAccount, isTheme, labelConversations, loadCatalog, lookupRelaysOf, lookupReplaceable, mailboxTags, mailboxesFromEvent, messagingSigner, mountApplet, newestEntries, openDefaultArtifactCache, parseHandlerPreferences, planMount, popularTopics, preferenceRelays, preferenceTemplate, preferredHandlers, publishAccepted, refForCatalogId, relayUrls, resolveApplet, resolveBuiltin, resolveWindow, resourceInitFor, runtimeFirewallRules, searchCatalog, selectRelayTier, signerAvailability, sizeWords, streamCatalog, subscribeWithEose, summarize, summarizePublish, toCatalogEntry, toGuardEvent, toProfileCard, toRelayUrl, toSession, wrapAccountSigner };
|
|
3480
|
+
export { type AccountFileServers, type AccountFileServersOptions, type AccountMailboxes, type AccountMailboxesOptions, type ApplesaucePool, type AppletCatalog, type AppletConfigOptions, type AppletHandle, type AppletIdentity, type AppletLifecycle, type AppletPointer, type AppletStatus, type AppletSummary, BASELINE_DOMAINS, BLOB_TIMEOUT_MS, BUILTIN_PUBLISHER, type BlossomUploaderOptions, type BuiltinApplet, CATALOG_EMIT_MS, CATALOG_LIMIT, CATALOG_SETTLE_MS, CATALOG_TIMEOUT_MS, CONTROLLER_DENY_POLICY, CURRENT_VERSION_TIMEOUT_MS, type CatalogEntry, type CatalogQuery, type CommonActionsOptions, ConnectedEventCache, type ConsentLine, type ConsentPrompt, type ConsentSummary, DEFAULT_FILE_SERVERS, DEFAULT_MONITOR_RELAYS, DEFAULT_RELAY_TIERS, DEFAULT_SUGGESTIONS, DELIVERY_RETRY, DOMAIN_CAPABILITIES, type DefaultBridgesOptions, type DefaultMessagingOptions, type DirectoryPool, type EoseSubscription, EventCacheOpener, type FileServerState, type FrameLike, type GrantRecord, type Grants, type GrantsOptions, type GroupMessagingOptions, type GuardFacade, type GuardPipeline, type GuardPipelineOptions, HANDLER_PREFERENCES_KIND, type HandlerChoice, type HandlerDefaults, type HandlerDefaultsOptions, type HandlerOption, type HandlerPreferences, type HandlerPrompt, type IdentityProfile, type IdentityProviderOptions, type IdentityProviders, type InboxRelays, type InstallableApplet, type InstalledApplet, type InstalledApplets, type InstalledContract, type IntentDeliveryOptions, type IntentRouter, type IntentRouterOptions, type Intents, KERNL_FRAME_POLICY_META, type Kernl, KernlAccountManager, type KernlGrants, type KernlHost, type KernlIntentDeps, type KernlIntents, type KernlNetwork, type KernlNetworkParts, type KernlOptions, type KernlServiceDeps, type KernlServices, LINK_PROTOCOLS, type LifecycleContext, type LoadCatalogOptions, type LookupBefore, type LookupReplaceableOptions, MANIFEST_TIMING, MESSAGING_UNAVAILABLE_REASONS, type MailboxPool, type MailboxSigner, type MailboxState, type Mailboxes, type ManifestTiming, type MessagingBackendFactories, type MessagingEncryption, type MountDeps, type MountGuardHooks, type MountPlan, type MountedApplet, type MultiServerUpload, type NamespacedStore, type OutboxRelayPoolLike, PACKAGE_NAME, PLAINTEXT_KEY_ACCOUNT_TYPES, type PipelineDisposition, type PlanMountOptions, type PreferenceSigner, type ProfileCard, type ProfileLoader, type ProfilePointer, type Profiles, type ProfilesOptions, type PublishAnswer, type PublishOutcome, type PublishedPointer, RUNTIME_FIREWALL_STORAGE_KEY, RUNTIME_OP_CLASSES, type RatchetMessagingOptions, type RelayDirectory, type RelayDirectoryOptions, type RelayListing, type RelayPermissions, type RelayTier, type RelayTiers, type ResolveAppletIdentity, type ResolveAppletOptions, type ResolvedApplet, type RuntimeFirewallHooks, type RuntimeFirewallHooksOptions, type RuntimeFirewallRules, type RuntimeFirewallState, type RuntimeRateRule, SHELL_RELAY_OPTIONS, type SealedGroupStoreOptions, type SealedRatchetStorageOptions, type Session, type SettingsPrompt, type ShellAdapterDeps, type SignerMessagingOptions, type SigningConsent, type SigningConsentOptions, type SigningTemplate, type StorageLike, type SuggestOptions, type SuggestPurpose, type TierMap, type TopicCount, UNKNOWN_CURRENT_VERSION, type UploadDetails, type WindowResolution, abbreviate, addressOf, applyRuntimeFirewallProfile, applyRuntimeFirewallRules, askUploadConsent, builtinAddress, capabilitiesForDomain, capabilitiesForDomains, catalogIdForRef, catalogRelays, commonActionsFor, createAccountFileServers, createAccountMailboxes, createAppletConfig, createAppletLifecycle, createAppletRelayBackend, createAppletRelayService, createAuthHooks, createBlossomUploader, createCommonActions, createConsentHandler, createDefaultBridges, createDefaultMessaging, createDmRelayPool, createEnvironmentResolver, createGrants, createGroupMessagesBackend, createGroupNetwork, createGuardPipeline, createHandlerDefaults, createIdentityProviders, createInstalledApplets, createIntentDelivery, createIntentRouter, createKernl, createKernlAccounts, createKernlIntents, createKernlNetwork, createKernlServices, createLegacyMessagesBackend, createNamespacedStore, createOutboxRelayPool, createPrivateMessagesBackend, createProfiles, createRatchetMessagesBackend, createRelayDirectory, createRelayPoolHooks, createRelayPoolLike, createRelayTiers, createReplaceableLoader, createRuntimeFirewallHooks, createSealedGroupStore, createSealedRatchetStorage, createShellAdapter, createSigningConsent, decodePointer, defaultFetchBlob, describeChange, describeOutcome, describeUpload, fetchManifestEvent, fileServerTags, fileServersFromEvent, fuzzyScore, grantNarrowingReason, isDestructiveKind, isReadOnlyAccount, isTheme, labelConversations, loadCatalog, lookupRelaysOf, lookupReplaceable, mailboxTags, mailboxesFromEvent, messagingSigner, mountApplet, newestEntries, openDefaultArtifactCache, parseHandlerPreferences, planMount, popularTopics, preferenceRelays, preferenceTemplate, preferredHandlers, publishAccepted, refForCatalogId, relayUrls, resolveApplet, resolveBuiltin, resolveWindow, resourceInitFor, runtimeFirewallRules, searchCatalog, selectRelayTier, signerAvailability, sizeWords, streamCatalog, subscribeWithEose, summarize, summarizePublish, toCatalogEntry, toGuardEvent, toProfileCard, toRelayUrl, toSession, wrapAccountSigner };
|