@kernlize/core 0.13.0 → 0.14.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.
@@ -238,6 +238,13 @@ function createWindowManager(options = {}) {
238
238
  leave(id);
239
239
  changed();
240
240
  },
241
+ replace(id, next) {
242
+ const index = desk.entries.findIndex((entry) => entry.id === id);
243
+ if (index === -1 || find(desk, next)) return;
244
+ desk.entries[index] = { ...desk.entries[index], id: next, minimised: false, stopped: false, target: void 0 };
245
+ if (desk.focusedId === id) desk.focusedId = null;
246
+ manager.focus(next);
247
+ },
241
248
  attach(id, target) {
242
249
  const entry = find(desk, id);
243
250
  if (!entry || entry.target) return;
@@ -280,4 +287,4 @@ export {
280
287
  createDefaultLayouts,
281
288
  createWindowManager
282
289
  };
283
- //# sourceMappingURL=chunk-E7SNLTN2.js.map
290
+ //# sourceMappingURL=chunk-ALAK4MW6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wm/layouts.ts","../src/wm/layout-registry.ts","../src/wm/window-manager.ts"],"sourcesContent":["import type { LayoutStrategy, Rect, WindowPlacement, WindowState } from '@kehto/wm';\n\n/** Spacing options shared by the tiling layouts. */\nexport interface LayoutOptions {\n /** Pixels between windows. Defaults to 0. */\n readonly gap?: number;\n /** Pixels between the windows and the container edge. Defaults to `gap`. */\n readonly margin?: number;\n}\n\n/** Options for {@link createMasterStackLayout}. */\nexport interface MasterStackOptions extends LayoutOptions {\n /** Share of the width the master window takes. Defaults to 0.6. */\n readonly ratio?: number;\n}\n\n/**\n * Windows keep the rectangles they have. The strategy for a free-floating desktop.\n *\n * @example\n * ```ts\n * floatingLayout.arrange(windows, { x: 0, y: 0, w: 1200, h: 800 });\n * // every window keeps the rect it already had\n * ```\n */\nexport const floatingLayout: LayoutStrategy = {\n arrange: (windows) => windows.map(({ id, rect }) => ({ id, rect: { ...rect } })),\n};\n\nfunction visible(windows: ReadonlyArray<WindowState>): WindowState[] {\n return windows.filter((window) => !window.minimized);\n}\n\ninterface Spacing {\n readonly gap: number;\n readonly margin: number;\n}\n\nfunction spacing(options: LayoutOptions): Spacing {\n const gap = options.gap ?? 0;\n return { gap, margin: options.margin ?? gap };\n}\n\nfunction inset(rect: Rect, margin: number): Rect {\n return { x: rect.x + margin, y: rect.y + margin, w: Math.max(0, rect.w - margin * 2), h: Math.max(0, rect.h - margin * 2) };\n}\n\n/** Round the edges, not the sizes: two windows that share an edge then agree on where it is, so they never overlap or leave a hole. */\nfunction place(id: string, rect: Rect): WindowPlacement {\n const x = Math.round(rect.x);\n const y = Math.round(rect.y);\n return { id, rect: { x, y, w: Math.round(rect.x + rect.w) - x, h: Math.round(rect.y + rect.h) - y } };\n}\n\nfunction splitRows(area: Rect, count: number, gap: number): Rect[] {\n const h = (area.h - gap * (count - 1)) / count;\n return Array.from({ length: count }, (_, index) => ({ x: area.x, y: area.y + index * (h + gap), w: area.w, h }));\n}\n\nfunction splitColumns(area: Rect, count: number, gap: number): Rect[] {\n const w = (area.w - gap * (count - 1)) / count;\n return Array.from({ length: count }, (_, index) => ({ x: area.x + index * (w + gap), y: area.y, w, h: area.h }));\n}\n\n/**\n * The dwindle layout: each window after the first takes half of the remaining\n * area, splitting vertically then horizontally in turn, so the last window\n * ends up in the smallest corner. Minimised windows are left out.\n *\n * @param options - Gap between windows and margin at the container edge.\n * @returns A `LayoutStrategy`.\n * @example\n * ```ts\n * createDwindleLayout({ gap: 8 }).arrange(windows, { x: 0, y: 0, w: 1200, h: 800 });\n * ```\n */\nexport function createDwindleLayout(options: LayoutOptions = {}): LayoutStrategy {\n const { gap, margin } = spacing(options);\n return {\n arrange(windows, containerRect) {\n const shown = visible(windows);\n const placements: WindowPlacement[] = [];\n let remaining = inset(containerRect, margin);\n shown.forEach((window, index) => {\n if (index === shown.length - 1) {\n placements.push(place(window.id, remaining));\n return;\n }\n const splitVertically = index % 2 === 0;\n const [first, rest] = splitVertically ? splitColumns(remaining, 2, gap) : splitRows(remaining, 2, gap);\n placements.push(place(window.id, first as Rect));\n remaining = rest as Rect;\n });\n return placements;\n },\n };\n}\n\n/**\n * Equal-width columns in window order. Minimised windows are left out.\n *\n * @param options - Gap between windows and margin at the container edge.\n * @returns A `LayoutStrategy`.\n * @example\n * ```ts\n * createColumnsLayout().arrange(windows, container)[0]?.rect.x; // 0\n * ```\n */\nexport function createColumnsLayout(options: LayoutOptions = {}): LayoutStrategy {\n const { gap, margin } = spacing(options);\n return {\n arrange(windows, containerRect) {\n const shown = visible(windows);\n const columns = splitColumns(inset(containerRect, margin), shown.length, gap);\n return shown.map((window, index) => place(window.id, columns[index] as Rect));\n },\n };\n}\n\n/**\n * One master window on the left, the rest stacked on the right. The focused\n * window is the master; without focus, the first window is. Minimised windows\n * are left out and a single window fills the container.\n *\n * @param options - Master width ratio, gap and margin.\n * @returns A `LayoutStrategy`.\n * @example\n * ```ts\n * createMasterStackLayout({ ratio: 0.5, gap: 4 }).arrange(windows, container);\n * ```\n */\nexport function createMasterStackLayout(options: MasterStackOptions = {}): LayoutStrategy {\n const { gap, margin } = spacing(options);\n const ratio = options.ratio ?? 0.6;\n return {\n arrange(windows, containerRect) {\n const shown = visible(windows);\n if (shown.length === 0) return [];\n const area = inset(containerRect, margin);\n const master = shown.find((window) => window.focused) ?? (shown[0] as WindowState);\n const stack = shown.filter((window) => window !== master);\n if (stack.length === 0) return [place(master.id, area)];\n const masterWidth = (area.w - gap) * ratio;\n const masterRect: Rect = { x: area.x, y: area.y, w: masterWidth, h: area.h };\n const stackArea: Rect = { x: area.x + masterWidth + gap, y: area.y, w: area.w - masterWidth - gap, h: area.h };\n const rows = splitRows(stackArea, stack.length, gap);\n return [place(master.id, masterRect), ...stack.map((window, index) => place(window.id, rows[index] as Rect))];\n },\n };\n}\n","import type { LayoutStrategy } from '@kehto/wm';\nimport { createColumnsLayout, createDwindleLayout, createMasterStackLayout, floatingLayout, type LayoutOptions } from './layouts.js';\n\n/** A layout as the person picks it: a stable id and the words the shell shows. */\nexport interface LayoutChoice {\n /** Stable id, kept in storage as the person's choice. */\n readonly id: string;\n /** What the shell calls the layout. */\n readonly label: string;\n}\n\n/** A named layout strategy. */\nexport interface LayoutEntry extends LayoutChoice {\n /** Where the windows go. */\n readonly strategy: LayoutStrategy;\n /**\n * True when the person places the windows and the strategy hands their rectangles back.\n * A window manager lets windows be moved and resized only in a freeform layout.\n */\n readonly freeform?: boolean;\n}\n\n/** The layouts a window manager offers, in the order the shell lists them. */\nexport interface LayoutRegistry {\n /**\n * Add a layout.\n * @throws `invalid:duplicate-layout` when the id is taken.\n */\n register(entry: LayoutEntry): void;\n /** The layout with this id, if there is one. */\n get(id: string): LayoutEntry | undefined;\n /** Every layout, in registration order. */\n list(): readonly LayoutEntry[];\n}\n\n/**\n * Create a layout registry, optionally holding some layouts already.\n *\n * @param entries - Layouts to register, in order.\n * @returns A `LayoutRegistry`.\n * @example\n * ```ts\n * const layouts = createLayoutRegistry([{ id: 'floating', label: 'floating', strategy: floatingLayout, freeform: true }]);\n * layouts.register({ id: 'columns', label: 'columns', strategy: createColumnsLayout({ gap: 8 }) });\n * layouts.list().map((layout) => layout.id); // ['floating', 'columns']\n * ```\n */\nexport function createLayoutRegistry(entries: readonly LayoutEntry[] = []): LayoutRegistry {\n const layouts = new Map<string, LayoutEntry>();\n const registry: LayoutRegistry = {\n register(entry) {\n if (layouts.has(entry.id)) throw new Error('invalid:duplicate-layout');\n layouts.set(entry.id, entry);\n },\n get: (id) => layouts.get(id),\n list: () => [...layouts.values()],\n };\n for (const entry of entries) registry.register(entry);\n return registry;\n}\n\n/**\n * The layouts kernl ships, floating first: `floating`, `dwindle` (shown as \"tiled\"), `columns` and\n * `master-stack` (shown as \"main and stack\"). The spacing applies to the three that arrange windows.\n *\n * @param options - Gap between windows and margin at the container edge, for the tiling layouts.\n * @returns A `LayoutRegistry` holding the four layouts; register your own on top.\n * @example\n * ```ts\n * const layouts = createDefaultLayouts({ gap: 8, margin: 0 });\n * layouts.register({ id: 'rows', label: 'rows', strategy: myRowsLayout });\n * ```\n */\nexport function createDefaultLayouts(options: LayoutOptions = {}): LayoutRegistry {\n return createLayoutRegistry([\n { id: 'floating', label: 'floating', strategy: floatingLayout, freeform: true },\n { id: 'dwindle', label: 'tiled', strategy: createDwindleLayout(options) },\n { id: 'columns', label: 'columns', strategy: createColumnsLayout(options) },\n { id: 'master-stack', label: 'main and stack', strategy: createMasterStackLayout(options) },\n ]);\n}\n","import type { Rect } from '@kehto/wm';\nimport type { WindowVisibility } from '@kernlize/guard';\nimport { BehaviorSubject, type Observable } from 'rxjs';\nimport { createDefaultLayouts, type LayoutChoice, type LayoutEntry, type LayoutRegistry } from './layout-registry.js';\n\n/** A width and a height in CSS pixels. */\nexport interface WindowSize {\n readonly w: number;\n readonly h: number;\n}\n\n/** One window as the manager has it now. */\nexport interface ManagedWindow {\n readonly id: string;\n /** Where the window is drawn: the layout's placement, or the window's own rectangle when the layout leaves it out. */\n readonly rect: Rect;\n /** Stacking order. The highest is in front. */\n readonly z: number;\n /** Whether the person is working in this window. */\n readonly focused: boolean;\n readonly minimised: boolean;\n /** Its applet was stopped. The window stays until it is closed, takes no focus and is never reported visible. */\n readonly stopped: boolean;\n}\n\n/** Everything a shell needs to draw its windows. A new object is published after every change. */\nexport interface WindowManagerState {\n /** Every window, in opening order. The order never changes while a window lives, so a frame is never moved in the document. */\n readonly windows: readonly ManagedWindow[];\n readonly focusedId: string | null;\n /** The layout in use. */\n readonly layout: LayoutChoice;\n /** The rectangle windows are laid out in. */\n readonly area: Rect;\n /** The area is narrow: every window fills it, whatever the layout. */\n readonly compact: boolean;\n /** Whether the person may move and resize windows now. */\n readonly freeform: boolean;\n}\n\n/** What the manager reports a window's visibility to. An `AppletHandle` is one. */\nexport interface VisibilityTarget {\n setVisibility(visibility: WindowVisibility): void;\n}\n\n/**\n * Where windows are, which one has the person's attention, and what the guard is told about each.\n *\n * A shell draws from `state$` and calls the methods from its own events. One obligation is fixed for\n * every implementation: `visibilityOf` and the reports sent to each attached target must be true. A\n * window the person cannot see is not visible, and a window they are not working in is not focused.\n * The guard holds a hidden applet's requests and gives an unfocused one a smaller budget on the\n * strength of these reports. Everything else is the implementation's choice.\n */\nexport interface WindowManager {\n /** The current state, then every state after it. */\n readonly state$: Observable<WindowManagerState>;\n /** The current state. */\n snapshot(): WindowManagerState;\n /** The layouts the person can choose between. */\n layouts(): readonly LayoutChoice[];\n /** Add a window in front, focused. Opening an id that is already open brings that window to the front. */\n open(id: string): void;\n /** Remove a window and stop reporting to it. */\n close(id: string): void;\n /** Bring a window to the front and give it the person's attention. Shows it if it was minimised. */\n focus(id: string): void;\n /** The person is working in the shell itself; no window is focused. */\n blur(): void;\n /** Hide a window without closing it. */\n minimise(id: string): void;\n /** Move or resize a window. Ignored unless the state is `freeform`. */\n move(id: string, rect: Rect): void;\n /** Mark a window's applet as stopped: it loses focus, is no longer reported to, and waits to be closed. */\n stop(id: string): void;\n /**\n * The window's applet starts again under the id `next`: the window keeps its rectangle, its place\n * in the opening order and in any arrangement, is shown, is no longer stopped, and comes to the\n * front, focused. Its old target is reported to no more; the new applet is attached under `next`.\n * Does nothing when `id` is not open or `next` already is.\n */\n replace(id: string, next: string): void;\n /** Report this window's visibility to `target`, now and after every change. Called once per window, when its applet is mounted. */\n attach(id: string, target: VisibilityTarget): void;\n /** What the guard is told about a window when it asks. An unknown window is neither visible nor focused. */\n visibilityOf(id: string): WindowVisibility;\n /** Set the rectangle windows are laid out in. */\n setArea(area: Rect): void;\n /**\n * Switch layout.\n * @throws `invalid:unknown-layout` when no layout has this id.\n */\n setLayout(id: string): void;\n /** Tell the manager whether the page itself can be seen. A hidden page hides every window. */\n setPageVisible(visible: boolean): void;\n /** Stop reporting and complete `state$`. */\n destroy(): void;\n}\n\n/** Options for {@link createWindowManager}. */\nexport interface WindowManagerOptions {\n /** The layouts on offer. Defaults to `createDefaultLayouts()`. */\n readonly layouts?: LayoutRegistry;\n /** The id of the layout to start in. Defaults to the first registered; an id that is not registered is ignored. */\n readonly layout?: string;\n /** The rectangle to lay windows out in until `setArea` is called. Defaults to 1280 by 800 at the origin. */\n readonly area?: Rect;\n /** At or below this area width every window fills the area. Defaults to 720; 0 turns it off. */\n readonly compactWidth?: number;\n /** The size a new window opens at. Defaults to 720 by 660. */\n readonly windowSize?: WindowSize;\n /** The smallest a window may be made. Defaults to 280 by 160. */\n readonly minSize?: WindowSize;\n /** Called with the id after every `setLayout`, so the choice can be remembered. */\n readonly onLayout?: (id: string) => void;\n /** Clock for `msSinceFocusGain`. Defaults to `Date.now`. */\n readonly now?: () => number;\n}\n\ninterface Entry {\n readonly id: string;\n own: Rect;\n z: number;\n minimised: boolean;\n stopped: boolean;\n focusGainedAt: number;\n target: VisibilityTarget | undefined;\n}\n\ninterface Desk {\n readonly entries: Entry[];\n layout: LayoutEntry;\n area: Rect;\n focusedId: string | null;\n pageVisible: boolean;\n nextZ: number;\n}\n\nconst DEFAULT_AREA: Rect = { x: 0, y: 0, w: 1280, h: 800 };\nconst DEFAULT_SIZE: WindowSize = { w: 720, h: 660 };\nconst MIN_SIZE: WindowSize = { w: 280, h: 160 };\nconst DEFAULT_COMPACT_WIDTH = 720;\nconst CASCADE_STEP = 32;\nconst CASCADE_WRAP = 8;\n\n/** Keep a window inside the area, no smaller than `min` and no larger than the area. */\nfunction clamp(rect: Rect, area: Rect, min: WindowSize): Rect {\n const w = Math.min(Math.max(rect.w, min.w), area.w);\n const h = Math.min(Math.max(rect.h, min.h), area.h);\n const x = Math.min(Math.max(rect.x, area.x), area.x + area.w - w);\n const y = Math.min(Math.max(rect.y, area.y), area.y + area.h - h);\n return { x, y, w, h };\n}\n\n/** Step each new window down and right so it does not hide the one before; start over after eight. */\nfunction cascade(index: number, area: Rect, size: WindowSize, min: WindowSize): Rect {\n const offset = (index % CASCADE_WRAP) * CASCADE_STEP;\n return clamp({ x: area.x + 40 + offset, y: area.y + 24 + offset, ...size }, area, min);\n}\n\nfunction startingLayout(layouts: LayoutRegistry, wanted: string | undefined): LayoutEntry {\n const layout = layouts.get(wanted ?? '') ?? layouts.list()[0];\n if (!layout) throw new Error('invalid:no-layouts');\n return layout;\n}\n\nconst sameRect = (a: Rect, b: Rect): boolean => a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;\n\nconst find = (desk: Desk, id: string): Entry | undefined => desk.entries.find((entry) => entry.id === id);\n\n/** The front-most window the person can see. */\nfunction front(desk: Desk): Entry | undefined {\n return desk.entries\n .filter((entry) => !entry.minimised && !entry.stopped)\n .reduce<Entry | undefined>((best, entry) => (best && best.z > entry.z ? best : entry), undefined);\n}\n\nfunction visibility(desk: Desk, id: string, now: () => number): WindowVisibility {\n const entry = find(desk, id);\n if (!entry) return { visible: false, focused: false };\n const visible = desk.pageVisible && !entry.minimised && !entry.stopped;\n const focused = visible && desk.focusedId === id;\n return focused ? { visible, focused, msSinceFocusGain: now() - entry.focusGainedAt } : { visible, focused };\n}\n\n/**\n * Run the layout. A strategy is told the front-most window is the focused one, so an arrangement that\n * follows focus does not reshuffle when the person turns to the shell's own panels and no window is focused.\n */\nfunction arrange(desk: Desk, compact: boolean): Map<string, Rect> {\n const placed = new Map<string, Rect>();\n if (compact) return placed;\n const leader = front(desk);\n const states = desk.entries.map((entry) => ({ id: entry.id, focused: entry === leader, minimized: entry.minimised || entry.stopped, rect: { ...entry.own } }));\n for (const placement of desk.layout.strategy.arrange(states, { ...desk.area })) placed.set(placement.id, placement.rect);\n return placed;\n}\n\nfunction describe(desk: Desk, compactWidth: number): WindowManagerState {\n const compact = desk.area.w <= compactWidth;\n const placed = arrange(desk, compact);\n const rectOf = (entry: Entry): Rect => ({ ...(compact ? desk.area : (placed.get(entry.id) ?? entry.own)) });\n return {\n windows: desk.entries.map((entry) => ({\n id: entry.id,\n rect: rectOf(entry),\n z: entry.z,\n focused: desk.focusedId === entry.id,\n minimised: entry.minimised,\n stopped: entry.stopped,\n })),\n focusedId: desk.focusedId,\n layout: { id: desk.layout.id, label: desk.layout.label },\n area: { ...desk.area },\n compact,\n freeform: !compact && desk.layout.freeform === true,\n };\n}\n\n/**\n * Create kernl's window manager: windows cascade as they open, the person picks a layout from a\n * registry, a narrow area shows one window at a time, and each attached applet is told whether it\n * can be seen and whether it has the person's attention.\n *\n * It holds no DOM and draws nothing. Feed it the shell's events, draw from `state$`, and answer\n * `KernlHost.getVisibility` with `visibilityOf`.\n *\n * @param options - Layouts, starting layout, sizes and a clock.\n * @returns A `WindowManager`.\n * @throws `invalid:no-layouts` when the registry is empty.\n * @example\n * ```ts\n * const windows = createWindowManager({ layouts: createDefaultLayouts({ gap: 8, margin: 0 }) });\n * windows.state$.subscribe((state) => draw(state.windows));\n * windows.setArea({ x: 0, y: 0, w: 1440, h: 900 });\n * windows.open(plan.windowId);\n * windows.attach(plan.windowId, kernl.mount(plan, frame));\n * windows.setLayout('columns');\n * ```\n */\nexport function createWindowManager(options: WindowManagerOptions = {}): WindowManager {\n const layouts = options.layouts ?? createDefaultLayouts();\n const now = options.now ?? Date.now;\n const compactWidth = options.compactWidth ?? DEFAULT_COMPACT_WIDTH;\n const size = options.windowSize ?? DEFAULT_SIZE;\n const min = options.minSize ?? MIN_SIZE;\n const desk: Desk = { entries: [], layout: startingLayout(layouts, options.layout), area: options.area ?? DEFAULT_AREA, focusedId: null, pageVisible: true, nextZ: 1 };\n const state = new BehaviorSubject(describe(desk, compactWidth));\n\n const report = (): void => {\n for (const entry of desk.entries) entry.target?.setVisibility(visibility(desk, entry.id, now));\n };\n const publish = (): void => state.next(describe(desk, compactWidth));\n /** Focus moved or a window was shown or hidden: tell the applets first, then redraw. */\n const changed = (): void => {\n report();\n publish();\n };\n const focusOn = (entry: Entry | undefined): void => {\n desk.focusedId = entry?.id ?? null;\n if (entry) entry.focusGainedAt = now();\n };\n const leave = (id: string): void => {\n if (desk.focusedId === id) focusOn(front(desk));\n };\n\n const manager: WindowManager = {\n state$: state.asObservable(),\n snapshot: () => state.value,\n layouts: () => layouts.list().map(({ id, label }) => ({ id, label })),\n open(id) {\n if (!find(desk, id)) {\n const own = cascade(desk.entries.length, desk.area, size, min);\n desk.entries.push({ id, own, z: 0, minimised: false, stopped: false, focusGainedAt: 0, target: undefined });\n }\n manager.focus(id);\n },\n close(id) {\n const index = desk.entries.findIndex((entry) => entry.id === id);\n if (index === -1) return;\n desk.entries.splice(index, 1);\n leave(id);\n changed();\n },\n focus(id) {\n const entry = find(desk, id);\n if (!entry || entry.stopped) return;\n entry.minimised = false;\n if (desk.focusedId !== id) focusOn(entry);\n entry.z = desk.nextZ++;\n changed();\n },\n blur() {\n if (desk.focusedId === null) return;\n focusOn(undefined);\n changed();\n },\n minimise(id) {\n const entry = find(desk, id);\n if (!entry) return;\n entry.minimised = true;\n leave(id);\n changed();\n },\n move(id, rect) {\n const entry = find(desk, id);\n if (!entry || !state.value.freeform) return;\n entry.own = clamp(rect, desk.area, min);\n publish();\n },\n stop(id) {\n const entry = find(desk, id);\n if (!entry) return;\n entry.stopped = true;\n entry.target = undefined;\n leave(id);\n changed();\n },\n replace(id, next) {\n const index = desk.entries.findIndex((entry) => entry.id === id);\n if (index === -1 || find(desk, next)) return;\n desk.entries[index] = { ...(desk.entries[index] as Entry), id: next, minimised: false, stopped: false, target: undefined };\n if (desk.focusedId === id) desk.focusedId = null;\n manager.focus(next);\n },\n attach(id, target) {\n const entry = find(desk, id);\n if (!entry || entry.target) return;\n entry.target = target;\n target.setVisibility(visibility(desk, id, now));\n },\n visibilityOf: (id) => visibility(desk, id, now),\n setArea(area) {\n if (sameRect(area, desk.area)) return;\n desk.area = { ...area };\n for (const entry of desk.entries) entry.own = clamp(entry.own, desk.area, min);\n publish();\n },\n setLayout(id) {\n const layout = layouts.get(id);\n if (!layout) throw new Error('invalid:unknown-layout');\n desk.layout = layout;\n options.onLayout?.(id);\n publish();\n },\n setPageVisible(visible) {\n if (visible === desk.pageVisible) return;\n desk.pageVisible = visible;\n report();\n },\n destroy() {\n for (const entry of desk.entries) entry.target = undefined;\n state.complete();\n },\n };\n return manager;\n}\n"],"mappings":";AAyBO,I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AA,IAChD;AAAA,IACA,cAAc,CAAC,OAAO,WAAW,MAAM,IAAI,GAAG;AAAA,IAC9C,QAAQ,MAAM;AACZ,UAAI,SAAS,MAAM,KAAK,IAAI,EAAG;AAC/B,WAAK,OAAO,EAAE,GAAG,KAAK;AACtB,iBAAW,SAAS,KAAK,QAAS,OAAM,MAAM,MAAM,MAAM,KAAK,KAAK,MAAM,GAAG;AAC7E,cAAQ;AAAA,IACV;AAAA,IACA,UAAU,IAAI;AACZ,YAAM,SAAS,QAAQ,IAAI,EAAE;AAC7B,UAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,wBAAwB;AACrD,WAAK,SAAS;AACd,cAAQ,WAAW,EAAE;AACrB,cAAQ;AAAA,IACV;AAAA,IACA,eAAeA,UAAS;AACtB,UAAIA,aAAY,KAAK,YAAa;AAClC,WAAK,cAAcA;AACnB,aAAO;AAAA,IACT;AAAA,IACA,UAAU;AACR,iBAAW,SAAS,KAAK,QAAS,OAAM,SAAS;AACjD,YAAM,SAAS;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;","names":["visible"]}
package/dist/index.d.ts CHANGED
@@ -77,6 +77,75 @@ declare function validFamily(family: CvmRegistryFamily): boolean;
77
77
  */
78
78
  declare function createMultiplayerSettings(storage: StorageLike): MultiplayerSettings;
79
79
 
80
+ /** Which way a message went, from the applet's side. */
81
+ type AppletMessageDirection = 'from-applet' | 'to-applet';
82
+ /**
83
+ * One message between an applet and the shell. `via` is the channel: `window` for a window-level
84
+ * message (NIP-5D allows one, `napplet.hello`), `port` for everything on the bound port.
85
+ */
86
+ interface AppletMessage {
87
+ readonly windowId: string;
88
+ readonly direction: AppletMessageDirection;
89
+ readonly via: 'window' | 'port';
90
+ /** The envelope's `type`, or `unknown` for anything that is not an envelope. */
91
+ readonly type: string;
92
+ /** What failed, when the envelope reports a failure; see {@link appletMessageFailure}. */
93
+ readonly error?: string;
94
+ /** The message itself. It can hold private messages, signed events and stored values: keep it in memory only. */
95
+ readonly message: unknown;
96
+ readonly at: number;
97
+ }
98
+ /**
99
+ * What an envelope says failed: its `error` string, or for a `*.error` envelope its `message`,
100
+ * its `reason` or its type. kehto's runtime answers a failed request with a `*.result` carrying
101
+ * `error`, so this covers its replies; kehto's own devtools read envelopes the same way.
102
+ *
103
+ * @param message - Any message an applet sent or received.
104
+ * @returns The failure, or `undefined` when the message reports none.
105
+ * @example
106
+ * ```ts
107
+ * appletMessageFailure({ type: 'inc.channel.open.result', id: '1', error: 'target denied' }); // 'target denied'
108
+ * appletMessageFailure({ type: 'storage.get.result', id: '2', value: 'x' }); // undefined
109
+ * ```
110
+ */
111
+ declare function appletMessageFailure(message: unknown): string | undefined;
112
+ /**
113
+ * Describe one message for {@link AppletMessage} reporting, timestamped now.
114
+ *
115
+ * @param windowId - The applet's window.
116
+ * @param direction - Which way it went.
117
+ * @param via - The channel it went over.
118
+ * @param message - The message itself.
119
+ * @returns The report.
120
+ * @example
121
+ * ```ts
122
+ * describeAppletMessage('applet-1', 'to-applet', 'port', { type: 'shell.init', id: '1' }).type; // 'shell.init'
123
+ * ```
124
+ */
125
+ declare function describeAppletMessage(windowId: string, direction: AppletMessageDirection, via: AppletMessage['via'], message: unknown): AppletMessage;
126
+ /** The shell's side of {@link AppletMessage} reporting. */
127
+ interface AppletTraffic {
128
+ readonly traffic$: Observable<AppletMessage>;
129
+ /** Report a message an applet sent. */
130
+ fromApplet(windowId: string, via: AppletMessage['via'], message: unknown): void;
131
+ /** Stop reporting; idempotent. */
132
+ close(): void;
133
+ }
134
+ /**
135
+ * Report what this shell's applets send and receive, for the windows `owns` accepts. Window ids
136
+ * are counted per shell, so two shells on one page can both have an `applet-1` and would each hear
137
+ * the other's; a host runs one shell per page.
138
+ *
139
+ * @param owns - Whether a window belongs to this shell.
140
+ * @returns The stream and the hooks that feed it.
141
+ * @example
142
+ * ```ts
143
+ * const traffic = createAppletTraffic((windowId) => handles.has(windowId));
144
+ * traffic.traffic$.subscribe((message) => log.push(message));
145
+ * ```
146
+ */
147
+ declare function createAppletTraffic(owns: (windowId: string) => boolean): AppletTraffic;
148
+
80
149
  /** The slice of applesauce's `RelayPool` kernl adapts. Narrow so tests can supply a fake. */
81
150
  type ApplesaucePool = Pick<RelayPool, 'req' | 'request' | 'publish'>;
82
151
  /**
@@ -1512,6 +1581,23 @@ interface MountPlan {
1512
1581
  readonly missingRequired: readonly string[];
1513
1582
  }
1514
1583
  /** Lifecycle of one mounted applet. */
1584
+ /** A guard limit an applet crossed and was quarantined for. */
1585
+ interface AppletStopLimit {
1586
+ /** `flood`: too many messages inside the quarantine window. `hidden-resource`: too many web fetches while hidden. */
1587
+ readonly cause: 'flood' | 'hidden-resource';
1588
+ /** The limit itself, from the profile in force when the applet was stopped. */
1589
+ readonly count: number;
1590
+ /** The span `count` is measured over, in milliseconds; absent for `hidden-resource`. */
1591
+ readonly windowMs?: number;
1592
+ readonly profile: GuardProfile;
1593
+ }
1594
+ /** What is known about why an applet was stopped, beyond its reason code. */
1595
+ interface AppletStopDetails {
1596
+ /** kehto's own diagnostic line, for a reason kehto observed. Never carries a message payload. */
1597
+ readonly detail?: string;
1598
+ /** The guard limit crossed, for a quarantine. */
1599
+ readonly limit?: AppletStopLimit;
1600
+ }
1515
1601
  type AppletStatus = 'mounting' | 'running' | 'revoked' | 'closed';
1516
1602
  /** The structural subset of an iframe element `mountApplet` needs. Lets the core stay DOM-free in tests. */
1517
1603
  interface FrameLike {
@@ -1751,8 +1837,12 @@ interface KernlHost {
1751
1837
  }): void;
1752
1838
  /** Current visibility for a window, when the core needs it synchronously. */
1753
1839
  getVisibility(windowId: string): WindowVisibility;
1754
- /** Called after the core removed a frame because its binding was revoked. */
1755
- onRevoked(windowId: string, reason: string): void;
1840
+ /**
1841
+ * Called after the core removed a frame because its binding was revoked. `reason` is a stable
1842
+ * code: one of kehto's revocation reasons, or kernl's own (`quarantine`, `host`, `grant-narrowed`,
1843
+ * `blocked`, `firewall`). `details` carries what else is known about the stop.
1844
+ */
1845
+ onRevoked(windowId: string, reason: string, details?: AppletStopDetails): void;
1756
1846
  /**
1757
1847
  * Ask the user which applet should take a request. Resolve `undefined` on
1758
1848
  * dismiss. Without it, requests with several handlers and no default are refused.
@@ -1908,6 +1998,11 @@ interface Kernl {
1908
1998
  readonly pool: RelayPool;
1909
1999
  readonly bridge: ShellBridge;
1910
2000
  readonly guard: GuardFacade;
2001
+ /**
2002
+ * Every message between this shell's applets and itself, both ways, on the window and on the
2003
+ * port. Envelopes can hold private messages and signed events: a host keeps them in memory only.
2004
+ */
2005
+ readonly traffic$: Observable<AppletMessage>;
1911
2006
  readonly grants: Grants;
1912
2007
  readonly relays: RelayTiers;
1913
2008
  readonly messaging: MessagingRegistry;
@@ -2852,12 +2947,12 @@ interface MountDeps {
2852
2947
  readonly originRegistry: Pick<OriginRegistry, 'register' | 'setEnvironment' | 'unregister'>;
2853
2948
  readonly guard: MountGuardHooks;
2854
2949
  /** Called after the frame was removed because the bridge revoked the binding. */
2855
- readonly onRevoked?: (windowId: string, reason: string) => void;
2950
+ readonly onRevoked?: (windowId: string, reason: string, details?: AppletStopDetails) => void;
2856
2951
  }
2857
2952
  /** An {@link AppletHandle} with the entry point the bridge's revocation hook calls. */
2858
2953
  interface MountedApplet extends AppletHandle {
2859
2954
  /** Mark the applet revoked and remove its frame. Idempotent with `close`. */
2860
- revoked(reason: string): void;
2955
+ revoked(reason: string, details?: AppletStopDetails): void;
2861
2956
  }
2862
2957
  /**
2863
2958
  * Put a planned applet into a frame, in the NIP-5D order the shell depends on:
@@ -2895,8 +2990,11 @@ interface GuardPipelineOptions {
2895
2990
  readonly now?: () => number;
2896
2991
  /** Receives every guard event from every layer. */
2897
2992
  readonly onEvent?: (event: GuardEvent) => void;
2898
- /** Called once when a window crosses the quarantine threshold; kernl revokes it here, before the triggering envelope is dispatched. */
2899
- readonly onQuarantine?: (windowId: string, napplet: string) => void;
2993
+ /**
2994
+ * Called once when a window crosses the quarantine threshold; kernl revokes it here, before the
2995
+ * triggering envelope is dispatched. `reason` is the guard's: `flood:quarantine` or `flood:hidden-resource`.
2996
+ */
2997
+ readonly onQuarantine?: (windowId: string, napplet: string, reason: string) => void;
2900
2998
  /** Visibility for a window the pipeline has not been told about yet. */
2901
2999
  readonly getVisibility?: (windowId: string) => WindowVisibility;
2902
3000
  /** Called when a window becomes visible; kernl releases the port envelopes kehto held for it here. */
@@ -4553,6 +4651,8 @@ interface ShellAdapterDeps {
4553
4651
  /** The firewall's host side: rules, questions, stored answers and the runtime's rate limiter; see `createFirewallPermissions`. */
4554
4652
  readonly permissions: PermissionAdapter;
4555
4653
  readonly onUnroutedMessage?: (info: UnroutedMessageInfo) => void;
4654
+ /** Hears every envelope on a bound port before the guard decides it; observe-only. */
4655
+ readonly onNappletMessage?: NonNullable<ShellAdapter['onNappletMessage']>;
4556
4656
  /** Takes a key an applet had no shortcut for, so the shell's own shortcuts work while an applet has focus (D-054). */
4557
4657
  readonly onShortcut?: (key: ShortcutKey) => void;
4558
4658
  }
@@ -5207,4 +5307,4 @@ declare const PACKAGE_NAME = "@kernlize/core";
5207
5307
  */
5208
5308
  declare const KERNL_FRAME_POLICY_META: string;
5209
5309
 
5210
- export { type AccountFileServers, type AccountFileServersOptions, type AccountMailboxes, type AccountMailboxesOptions, type AdmissionRuntime, type ApplesaucePool, type AppletAdmissions, 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 BoundPreludeOptions, 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 CheckedConnection, type ClientFor, type CommonActionsOptions, ConnectedEventCache, type ConnectionChange, type ConnectionRouting, type ConsentLine, type ConsentPrompt, type ConsentSummary, DEFAULT_FILE_SERVERS, DEFAULT_MONITOR_RELAYS, DEFAULT_RELAY_TIERS, DEFAULT_SOULSEEK_LIMITS, DEFAULT_SUGGESTIONS, DELIVERY_RETRY, DIRECT_MAX_PAYLOAD_BYTES, DIRECT_SIGNALING_PROFILE, DIRECT_SIGNAL_KIND, DOMAIN_CAPABILITIES, DOWNLOAD_BINDINGS, DOWNLOAD_DOMAINS, DOWNLOAD_PROGRAMS, type DefaultBridgesOptions, type DefaultMessagingOptions, type DirectConnectionsDeps, type DirectConnectionsOptions, type DirectConnectionsSettings, type DirectIceServer, type DirectSignalingOptions, type DirectoryPool, type DomainBinding, type DomainBindingMethod, type DownloadClients, type DownloadClientsOptions, type DownloadClientsState, type DownloadConnection, type DownloadDomain, type DownloadProgram, type DownloadProgramInfo, type DownloadQuestion, type DownloadQuestionLine, type DownloadService, type DownloadServiceDeps, type DownloadSignIn, type DownloadsOptions, type EoseSubscription, EventCacheOpener, FIREWALL_DECISIONS_STORAGE_KEY, FIREWALL_PROMPT_TIMEOUT_MS, FIREWALL_RULES_STORAGE_KEY, type FileServerState, type Firewall, type FirewallApplet, type FirewallChoice, type FirewallDecision, type FirewallOptions, type FirewallPermissionsOptions, type FirewallPrompt, type FirewallRequest, type FirewallRuleTarget, type FirewallRules, type FirewallSummary, type ForwardedKeys, 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, KEY_REPEAT_WINDOW_MS, type Kernl, KernlAccountManager, type KernlDownloads, type KernlDownloadsDeps, type KernlFirewall, type KernlGrants, type KernlHost, type KernlIntentDeps, type KernlIntents, type KernlMultiplayer, type KernlNetwork, type KernlNetworkParts, type KernlOptions, type KernlServiceDeps, type KernlServices, type KeymapHold, type KeymapHoldOptions, LINK_PROTOCOLS, type LifecycleContext, type LoadCatalogOptions, type LookupBefore, type LookupReplaceableOptions, MANIFEST_TIMING, MAX_UNMOUNTED_PLANS, MESSAGES_DOMAIN, MESSAGE_COMPANION_DOMAINS, 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 MultiplayerSettings, type MultiplayerState, type NamespacedStore, type NzbDocument, type NzbDownloader, type NzbServiceOptions, type OutboxRelayPoolLike, PACKAGE_NAME, PERSON_HINT_TIMEOUT_MS, PLAINTEXT_KEY_ACCOUNT_TYPES, type People, type PeopleOptions, type PersonPointer, type PipelineDisposition, type PlanMountOptions, type PlannedExtensions, type PreferenceSigner, type ProfileCard, type ProfileLoader, type ProfilePointer, type Profiles, type ProfilesOptions, type PublishAnswer, type PublishOutcome, type PublishedPointer, type RatchetMessagingOptions, type RelayDirectory, type RelayDirectoryOptions, type RelayListing, type RelayPermissions, type RelayTier, type RelayTiers, type RemoteToolsOptions, type RemoteToolsSettings, type ResolveAppletIdentity, type ResolveAppletOptions, type ResolvedApplet, type RoutedClient, type RoutedDomain, SHELL_RELAY_OPTIONS, SOULSEEK_SESSION_QUESTION, type SealedGroupStoreOptions, type SealedRatchetStorageOptions, type SecretsDescription, type SecretsProvider, type Session, type SettingsPrompt, type ShellAdapterDeps, type ShortcutKey, type ShortcutSettings, type ShortcutsOptions, type ShortcutsService, type SignalRelay, type SignalSigner, type SignerMessagingOptions, type SigningConsent, type SigningConsentOptions, type SigningTemplate, type SoulseekLimits, type SoulseekServiceOptions, type StorageLike, type SuggestOptions, type SuggestPurpose, THROWAWAY_IDENTITY_TYPE, TOOL_DISCOVERY_TIMEOUT_MS, ThrowawayIdentity, type TierMap, type ToolDiscoveryOptions, type ToolFamilyCandidate, type TopicCount, type TorrentServiceOptions, UNKNOWN_CURRENT_VERSION, type UploadDetails, type WindowIdentities, type WindowResolution, abbreviate, acceptAnyRelay, addressOf, answerFor, askUploadConsent, builtinAddress, capabilitiesForDomain, capabilitiesForDomains, capabilitiesInForce, catalogIdForRef, catalogRelays, commonActionsFor, createAccountFileServers, createAccountMailboxes, createAppletAdmissions, createAppletConfig, createAppletLifecycle, createAppletRelayBackend, createAppletRelayService, createAuthHooks, createBlossomUploader, createCommonActions, createConsentHandler, createCvmRelayPool, createDefaultBridges, createDefaultMessaging, createDirectConnectionsService, createDirectSignaling, createDmRelayPool, createDownloadClients, createEnvironmentResolver, createFirewall, createFirewallPermissions, createFirewallRules, createForwardedKeys, createGrants, createGroupMessagesBackend, createGroupNetwork, createGuardPipeline, createHandlerDefaults, createIdentityProviders, createInstalledApplets, createIntentDelivery, createIntentRouter, createKernl, createKernlAccounts, createKernlDownloads, createKernlIntents, createKernlNetwork, createKernlServices, createKeymapHold, createLegacyMessagesBackend, createMemorySecrets, createMultiplayerSettings, createNamespacedStore, createNzbService, createOutboxRelayPool, createPeople, createPrivateMessagesBackend, createProfiles, createRatchetMessagesBackend, createRelayDirectory, createRelayPoolHooks, createRelayPoolLike, createRelayTiers, createRemoteToolsService, createReplaceableLoader, createRuntimeRateLimiter, createSealedGroupStore, createSealedRatchetStorage, createShellAdapter, createShortcutsService, createSigningConsent, createSoulseekService, createStorageSecrets, createThrowawayIdentity, createTorrentService, createWindowIdentities, currentPageScheme, decodePointer, defaultFetchBlob, defaultFirewallRules, describeApproval, describeChange, describeDirectConnection, describeDownloadQuestion, describeOutcome, describeUpload, directNamespace, discoverToolFamilies, domainsInForce, fetchManifestEvent, fetchThroughFirewall, fileServerTags, fileServersFromEvent, fuzzyScore, grantNarrowingReason, isDestructiveKind, isReadOnlyAccount, isTheme, labelConversations, loadCatalog, locateRecipients, locateSendRecipients, lookupRelaysOf, lookupReplaceable, mailboxTags, mailboxesFromEvent, mergeFamilies, messagingSigner, mountApplet, newestEntries, openDefaultArtifactCache, parseHandlerPreferences, parsePerson, permissionPrincipalFor, planMount, popularTopics, preferenceRelays, preferenceTemplate, preferredHandlers, publishAccepted, readNzbDocument, refForCatalogId, relayUrls, resolveApplet, resolveAppletEnvironment, resolveBuiltin, resolveWindow, resourceErrorFor, resourceInitFor, runtimeOpClass, sealsApplet, searchCatalog, selectRelayTier, shellRelayOrigins, signerAvailability, sizeWords, streamCatalog, subscribeWithEose, summarize, summarizePublish, supportsDomainBindings, toCatalogEntry, toGuardEvent, toProfileCard, toRelayUrl, toSession, validFamily, withheldDomains, wrapAccountSigner };
5310
+ export { type AccountFileServers, type AccountFileServersOptions, type AccountMailboxes, type AccountMailboxesOptions, type AdmissionRuntime, type ApplesaucePool, type AppletAdmissions, type AppletCatalog, type AppletConfigOptions, type AppletHandle, type AppletIdentity, type AppletLifecycle, type AppletMessage, type AppletMessageDirection, type AppletPointer, type AppletStatus, type AppletStopDetails, type AppletStopLimit, type AppletSummary, type AppletTraffic, BASELINE_DOMAINS, BLOB_TIMEOUT_MS, BUILTIN_PUBLISHER, type BlossomUploaderOptions, type BoundPreludeOptions, 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 CheckedConnection, type ClientFor, type CommonActionsOptions, ConnectedEventCache, type ConnectionChange, type ConnectionRouting, type ConsentLine, type ConsentPrompt, type ConsentSummary, DEFAULT_FILE_SERVERS, DEFAULT_MONITOR_RELAYS, DEFAULT_RELAY_TIERS, DEFAULT_SOULSEEK_LIMITS, DEFAULT_SUGGESTIONS, DELIVERY_RETRY, DIRECT_MAX_PAYLOAD_BYTES, DIRECT_SIGNALING_PROFILE, DIRECT_SIGNAL_KIND, DOMAIN_CAPABILITIES, DOWNLOAD_BINDINGS, DOWNLOAD_DOMAINS, DOWNLOAD_PROGRAMS, type DefaultBridgesOptions, type DefaultMessagingOptions, type DirectConnectionsDeps, type DirectConnectionsOptions, type DirectConnectionsSettings, type DirectIceServer, type DirectSignalingOptions, type DirectoryPool, type DomainBinding, type DomainBindingMethod, type DownloadClients, type DownloadClientsOptions, type DownloadClientsState, type DownloadConnection, type DownloadDomain, type DownloadProgram, type DownloadProgramInfo, type DownloadQuestion, type DownloadQuestionLine, type DownloadService, type DownloadServiceDeps, type DownloadSignIn, type DownloadsOptions, type EoseSubscription, EventCacheOpener, FIREWALL_DECISIONS_STORAGE_KEY, FIREWALL_PROMPT_TIMEOUT_MS, FIREWALL_RULES_STORAGE_KEY, type FileServerState, type Firewall, type FirewallApplet, type FirewallChoice, type FirewallDecision, type FirewallOptions, type FirewallPermissionsOptions, type FirewallPrompt, type FirewallRequest, type FirewallRuleTarget, type FirewallRules, type FirewallSummary, type ForwardedKeys, 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, KEY_REPEAT_WINDOW_MS, type Kernl, KernlAccountManager, type KernlDownloads, type KernlDownloadsDeps, type KernlFirewall, type KernlGrants, type KernlHost, type KernlIntentDeps, type KernlIntents, type KernlMultiplayer, type KernlNetwork, type KernlNetworkParts, type KernlOptions, type KernlServiceDeps, type KernlServices, type KeymapHold, type KeymapHoldOptions, LINK_PROTOCOLS, type LifecycleContext, type LoadCatalogOptions, type LookupBefore, type LookupReplaceableOptions, MANIFEST_TIMING, MAX_UNMOUNTED_PLANS, MESSAGES_DOMAIN, MESSAGE_COMPANION_DOMAINS, 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 MultiplayerSettings, type MultiplayerState, type NamespacedStore, type NzbDocument, type NzbDownloader, type NzbServiceOptions, type OutboxRelayPoolLike, PACKAGE_NAME, PERSON_HINT_TIMEOUT_MS, PLAINTEXT_KEY_ACCOUNT_TYPES, type People, type PeopleOptions, type PersonPointer, type PipelineDisposition, type PlanMountOptions, type PlannedExtensions, type PreferenceSigner, type ProfileCard, type ProfileLoader, type ProfilePointer, type Profiles, type ProfilesOptions, type PublishAnswer, type PublishOutcome, type PublishedPointer, type RatchetMessagingOptions, type RelayDirectory, type RelayDirectoryOptions, type RelayListing, type RelayPermissions, type RelayTier, type RelayTiers, type RemoteToolsOptions, type RemoteToolsSettings, type ResolveAppletIdentity, type ResolveAppletOptions, type ResolvedApplet, type RoutedClient, type RoutedDomain, SHELL_RELAY_OPTIONS, SOULSEEK_SESSION_QUESTION, type SealedGroupStoreOptions, type SealedRatchetStorageOptions, type SecretsDescription, type SecretsProvider, type Session, type SettingsPrompt, type ShellAdapterDeps, type ShortcutKey, type ShortcutSettings, type ShortcutsOptions, type ShortcutsService, type SignalRelay, type SignalSigner, type SignerMessagingOptions, type SigningConsent, type SigningConsentOptions, type SigningTemplate, type SoulseekLimits, type SoulseekServiceOptions, type StorageLike, type SuggestOptions, type SuggestPurpose, THROWAWAY_IDENTITY_TYPE, TOOL_DISCOVERY_TIMEOUT_MS, ThrowawayIdentity, type TierMap, type ToolDiscoveryOptions, type ToolFamilyCandidate, type TopicCount, type TorrentServiceOptions, UNKNOWN_CURRENT_VERSION, type UploadDetails, type WindowIdentities, type WindowResolution, abbreviate, acceptAnyRelay, addressOf, answerFor, appletMessageFailure, askUploadConsent, builtinAddress, capabilitiesForDomain, capabilitiesForDomains, capabilitiesInForce, catalogIdForRef, catalogRelays, commonActionsFor, createAccountFileServers, createAccountMailboxes, createAppletAdmissions, createAppletConfig, createAppletLifecycle, createAppletRelayBackend, createAppletRelayService, createAppletTraffic, createAuthHooks, createBlossomUploader, createCommonActions, createConsentHandler, createCvmRelayPool, createDefaultBridges, createDefaultMessaging, createDirectConnectionsService, createDirectSignaling, createDmRelayPool, createDownloadClients, createEnvironmentResolver, createFirewall, createFirewallPermissions, createFirewallRules, createForwardedKeys, createGrants, createGroupMessagesBackend, createGroupNetwork, createGuardPipeline, createHandlerDefaults, createIdentityProviders, createInstalledApplets, createIntentDelivery, createIntentRouter, createKernl, createKernlAccounts, createKernlDownloads, createKernlIntents, createKernlNetwork, createKernlServices, createKeymapHold, createLegacyMessagesBackend, createMemorySecrets, createMultiplayerSettings, createNamespacedStore, createNzbService, createOutboxRelayPool, createPeople, createPrivateMessagesBackend, createProfiles, createRatchetMessagesBackend, createRelayDirectory, createRelayPoolHooks, createRelayPoolLike, createRelayTiers, createRemoteToolsService, createReplaceableLoader, createRuntimeRateLimiter, createSealedGroupStore, createSealedRatchetStorage, createShellAdapter, createShortcutsService, createSigningConsent, createSoulseekService, createStorageSecrets, createThrowawayIdentity, createTorrentService, createWindowIdentities, currentPageScheme, decodePointer, defaultFetchBlob, defaultFirewallRules, describeAppletMessage, describeApproval, describeChange, describeDirectConnection, describeDownloadQuestion, describeOutcome, describeUpload, directNamespace, discoverToolFamilies, domainsInForce, fetchManifestEvent, fetchThroughFirewall, fileServerTags, fileServersFromEvent, fuzzyScore, grantNarrowingReason, isDestructiveKind, isReadOnlyAccount, isTheme, labelConversations, loadCatalog, locateRecipients, locateSendRecipients, lookupRelaysOf, lookupReplaceable, mailboxTags, mailboxesFromEvent, mergeFamilies, messagingSigner, mountApplet, newestEntries, openDefaultArtifactCache, parseHandlerPreferences, parsePerson, permissionPrincipalFor, planMount, popularTopics, preferenceRelays, preferenceTemplate, preferredHandlers, publishAccepted, readNzbDocument, refForCatalogId, relayUrls, resolveApplet, resolveAppletEnvironment, resolveBuiltin, resolveWindow, resourceErrorFor, resourceInitFor, runtimeOpClass, sealsApplet, searchCatalog, selectRelayTier, shellRelayOrigins, signerAvailability, sizeWords, streamCatalog, subscribeWithEose, summarize, summarizePublish, supportsDomainBindings, toCatalogEntry, toGuardEvent, toProfileCard, toRelayUrl, toSession, validFamily, withheldDomains, wrapAccountSigner };