@kehto/paja 0.24.2 → 0.24.3

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 CHANGED
@@ -561,6 +561,10 @@ remain a documented upstream spec gap; no host sender identity is invented.
561
561
 
562
562
  This non-normative guidance defers to the living [NAP-GAMEPAD](https://github.com/napplet/naps/pull/108). Services export `createGamepadService` and `browserGamepadOptions`; shell exports `denyNappletControllerAccess`. Paja and the playground register one host reader and deny native gamepad/HID/USB paths before frame execution. Source-bound subscriptions receive immediate full snapshots; only the visible host's input owner gets live controls. Focus loss supplies neutral controls and timestamp zero; unsubscribe, window destruction, and service removal release polling. Non-browser or denied native readers report the proposal's unavailable reasons. See [Controller input](https://github.com/kehto/web/blob/main/docs/gamepad.md).
563
563
 
564
+ ## NIP-5D runtime pointers
565
+
566
+ Paja MUST load all three NIP-5D manifest kinds: root `15129`, named `35129`, and snapshot `5129`. Use an `naddr` with an empty identifier for the latest root, an `naddr` with the literal `d` identifier for the latest named napplet, or a `nevent` to pin a signed event of any of the three kinds. Snapshots require `nevent` because they are immutable events without replaceable coordinates. All paths verify the signed manifest and artifact hash before injecting `srcdoc`. Distinct snapshots retain separate tabs and catalog identities even when their artifact bytes match.
567
+
564
568
  ## Controller diagnostics
565
569
 
566
570
  Paja shows a numbered controller icon directly beside the console arrow for each controller the browser detects. Each slot has its own color and input animation; hover for the controller model and activity state. Buttons and stick movement light up only that controller (stick movement below 0.12 is ignored). Quick taps retain the highlight briefly so they are easy to spot. Reduced-motion settings keep the activity highlight without animation. Disconnecting removes the icon. Browsers may require a button press before exposing a newly connected controller. These host diagnostics work without a napplet gamepad subscription and do not change focus-scoped input delivery.
@@ -23542,6 +23542,9 @@ function unregisterSingleFrameWindow(bridge, runtime, windowId) {
23542
23542
  var PAJA_RUNTIME_TABS_STORAGE_KEY = "kehto:paja:runtime-tabs:v1";
23543
23543
  function resolvedTargetKey(target) {
23544
23544
  if (isPajaLocalTarget(target)) return ["local", target.dTag, target.aggregateHash].join(":");
23545
+ if (target.event.kind === NAPPLET_KIND_SNAPSHOT) {
23546
+ return [target.event.kind, target.event.id, target.aggregateHash].join(":");
23547
+ }
23545
23548
  return [
23546
23549
  target.event.kind,
23547
23550
  target.event.pubkey,
@@ -24342,7 +24345,7 @@ function resolvePointerBlossomServers(event, configured) {
24342
24345
  async function resolvePointerEvent(pointer, pool, relays, maxWaitMs) {
24343
24346
  const filter = pointer.type === "naddr" ? addressableFilter(pointer) : eventFilter(pointer);
24344
24347
  const result2 = await queryPointerRelays(pool, relays, filter, maxWaitMs);
24345
- const event = result2.events.filter((candidate) => matchesPointer(pointer, candidate)).sort((a, b) => b.created_at - a.created_at)[0];
24348
+ const event = result2.events.filter((candidate) => matchesPointer(pointer, candidate)).sort((a, b) => b.created_at - a.created_at || a.id.localeCompare(b.id))[0];
24346
24349
  if (!event) {
24347
24350
  if (result2.timedOut) {
24348
24351
  throw new Error(
@@ -24432,13 +24435,22 @@ function normalizeMaxWaitMs(value) {
24432
24435
  return Math.floor(value);
24433
24436
  }
24434
24437
  function addressableFilter(pointer) {
24435
- if (pointer.kind !== NAPPLET_KIND_NAMED) {
24436
- throw new Error(`naddr kind ${pointer.kind} is not a named NIP-5D napplet manifest kind.`);
24438
+ if (pointer.kind === NAPPLET_KIND_SNAPSHOT) {
24439
+ throw new Error("NIP-5D snapshot kind 5129 requires a nevent pointer with its signed event ID.");
24440
+ }
24441
+ if (pointer.kind !== NAPPLET_KIND_NAMED && pointer.kind !== NAPPLET_KIND_ROOT) {
24442
+ throw new Error(`naddr kind ${pointer.kind} is not a root or named NIP-5D napplet manifest kind.`);
24443
+ }
24444
+ if (pointer.kind === NAPPLET_KIND_ROOT && pointer.identifier !== "") {
24445
+ throw new Error("NIP-5D root naddr requires an empty identifier.");
24446
+ }
24447
+ if (pointer.kind === NAPPLET_KIND_NAMED && pointer.identifier === "") {
24448
+ throw new Error("NIP-5D named naddr requires a non-empty identifier.");
24437
24449
  }
24438
24450
  return {
24439
- kinds: [NAPPLET_KIND_NAMED],
24451
+ kinds: [pointer.kind],
24440
24452
  authors: [pointer.pubkey],
24441
- "#d": [pointer.identifier],
24453
+ ...pointer.kind === NAPPLET_KIND_NAMED ? { "#d": [pointer.identifier] } : {},
24442
24454
  limit: 1
24443
24455
  };
24444
24456
  }
@@ -24457,7 +24469,7 @@ function matchesPointer(pointer, event) {
24457
24469
  if (pointer.kind && event.kind !== pointer.kind) return false;
24458
24470
  return true;
24459
24471
  }
24460
- return event.kind === pointer.kind && event.pubkey === pointer.pubkey && event.tags.some((tag) => tag[0] === "d" && tag[1] === pointer.identifier);
24472
+ return event.kind === pointer.kind && event.pubkey === pointer.pubkey && (pointer.kind === NAPPLET_KIND_ROOT || event.tags.some((tag) => tag[0] === "d" && tag[1] === pointer.identifier));
24461
24473
  }
24462
24474
  function uniqueRelayUrls(values) {
24463
24475
  const out = [];