@kehto/paja 0.9.0 → 0.11.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 CHANGED
@@ -4,7 +4,7 @@ import { NostrEvent } from 'nostr-tools';
4
4
  import { Filter } from 'nostr-tools/filter';
5
5
  import { ResolvedNapplet } from '@kehto/nip/5d';
6
6
  import { ShellCapabilities } from '@kehto/shell';
7
- import { IntentCatalogEntry, IntentTargetController, IntentRetentionParams, IntentRetainedDelivery } from '@kehto/services';
7
+ import { IntentCatalogEntry, IntentTargetController, IntentDispatchParams, IntentTargetDispatch } from '@kehto/services';
8
8
 
9
9
  /**
10
10
  * Load a JSON Paja config file from disk.
@@ -138,7 +138,7 @@ declare function injectPajaRuntimeCsp(html: string, origins: readonly string[]):
138
138
 
139
139
  declare const PAJA_LEGACY_COMPATIBILITY_DOMAIN: string;
140
140
  /** Domain list mirrored from the upstream web runtime for parity checks. */
141
- declare const PAJA_UPSTREAM_WEB_DOMAINS: readonly ["ble", "common", "config", "count", "cvm", "dm", "identity", string, "inc", "intent", "keys", "link", "lists", "media", "notify", "outbox", "relay", "resource", "serial", "storage", "theme", "upload", "webrtc"];
141
+ declare const PAJA_UPSTREAM_WEB_DOMAINS: readonly ["ble", "common", "config", "count", "cvm", "dm", "fs", "identity", string, "inc", "intent", "keys", "link", "lists", "media", "notify", "outbox", "relay", "resource", "serial", "storage", "theme", "upload", "webrtc"];
142
142
  /** Domains required during the initial Paja handshake. */
143
143
  declare const PAJA_HANDSHAKE_DOMAINS: readonly ["shell"];
144
144
  /** Compatibility aliases for renamed upstream capability domains. */
@@ -184,11 +184,12 @@ interface InstalledNappletRecord {
184
184
  readonly pointer: PajaDecodedPointer;
185
185
  /** Optional manifest title for handler selection UI. */
186
186
  readonly title?: string;
187
+ /** Verified NAP domains required by the artifact. */
188
+ readonly requires: readonly string[];
187
189
  /** Exact manifest convention contracts used for intent eligibility. */
188
190
  readonly archetypes: readonly {
189
191
  readonly slug: string;
190
192
  readonly convention: string;
191
- readonly eventKinds?: readonly number[];
192
193
  }[];
193
194
  }
194
195
  /** Listener notified when an installed artifact is inserted or removed. */
@@ -230,12 +231,12 @@ declare class InstalledNappletCatalog {
230
231
  }
231
232
 
232
233
  /**
233
- * Browser-owned retained NAP-INTENT target lifecycle policy.
234
+ * Browser-owned NAP-INTENT target lifecycle policy.
234
235
  *
235
236
  * Retention is intentionally independent from browser frames. The host supplies
236
237
  * generation creation/reuse, source-bound readiness, current-generation checks,
237
- * and delivery. This controller freezes responsibility before an accepted
238
- * result, then starts that policy only afterward.
238
+ * and convention delivery. The controller resolves only after the target is
239
+ * ready and the delivery is enqueued.
239
240
  *
240
241
  * @packageDocumentation
241
242
  */
@@ -250,31 +251,28 @@ type BrowserIntentTerminalReason = 'open-failed' | 'ready-failed' | 'no-current-
250
251
  /** Browser lifecycle callbacks injected by the Paja host. */
251
252
  interface BrowserIntentControllerOptions {
252
253
  /** Open a compatible target or reuse its current generation. */
253
- openOrReuse(params: IntentRetentionParams, attempt: number): BrowserIntentGeneration | null | Promise<BrowserIntentGeneration | null>;
254
+ openOrReuse(params: IntentDispatchParams, attempt: number): BrowserIntentGeneration | null | Promise<BrowserIntentGeneration | null>;
254
255
  /** Await source-bound NAP-SHELL readiness for a selected generation. */
255
256
  waitForReady(generation: BrowserIntentGeneration): void | Promise<void>;
256
257
  /** Return true only while the generation remains the selected current target. */
257
258
  isCurrent(generation: BrowserIntentGeneration): boolean | Promise<boolean>;
258
- /** Send the retained delivery to the current ready generation exactly once. */
259
- send(generation: BrowserIntentGeneration, delivery: IntentRetentionParams['delivery']): void | Promise<void>;
260
- /** Maximum open/replacement attempts after acceptance. Finite values clamp to 1–10; defaults to two. */
259
+ /** Return the runtime-assigned window identifier once the target is ready. */
260
+ getWindowId(generation: BrowserIntentGeneration): string | null;
261
+ /** Send the convention through the ordinary carrier to the ready generation. */
262
+ send(generation: BrowserIntentGeneration, params: IntentDispatchParams): void | Promise<void>;
263
+ /** Maximum open/replacement attempts. Finite values clamp to 1–10; defaults to two. */
261
264
  maxAttempts?: number;
262
- /** Observe terminal post-acceptance policy without producing another result. */
263
- onTerminal?(params: IntentRetentionParams, reason: BrowserIntentTerminalReason): void;
265
+ /** Observe terminal target policy. */
266
+ onTerminal?(params: IntentDispatchParams, reason: BrowserIntentTerminalReason): void;
264
267
  }
265
268
  /**
266
- * Retains immutable delivery responsibility before the intent service accepts.
267
- *
268
- * It has no public lifecycle state: host callbacks own generation identity,
269
- * readiness, reuse, and replacement. A returned task is inert until its
270
- * `start()` method is invoked by the intent service after sending acceptance.
269
+ * Creates/focuses a target and enqueues one convention delivery.
271
270
  */
272
271
  declare class BrowserIntentController implements IntentTargetController {
273
272
  private readonly options;
274
273
  private readonly maxAttempts;
275
274
  constructor(options: BrowserIntentControllerOptions);
276
- retain(params: IntentRetentionParams): IntentRetainedDelivery;
277
- private start;
275
+ dispatch(params: IntentDispatchParams): Promise<IntentTargetDispatch>;
278
276
  }
279
277
 
280
278
  /**
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  startPajaServer,
40
40
  summarizePajaSimulation,
41
41
  waitForTargetUrl
42
- } from "./chunk-OWVINAW7.js";
42
+ } from "./chunk-EOCGC7A2.js";
43
43
  export {
44
44
  BrowserIntentController,
45
45
  DEFAULT_PAJA_AGGREGATE_HASH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kehto/paja",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Paja local authoring workshop for hosting napplets in a real Kehto iframe during development",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,22 +25,22 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@kehto/acl": "^0.16.0",
29
- "@kehto/firewall": "^0.4.0",
30
- "@kehto/nip": "^0.4.2",
31
- "@kehto/runtime": "^0.19.0",
32
- "@kehto/services": "^0.17.0",
33
- "@kehto/shell": "^0.18.0",
28
+ "@kehto/acl": "^0.17.0",
29
+ "@kehto/firewall": "^0.5.0",
30
+ "@kehto/nip": "^0.5.1",
31
+ "@kehto/runtime": "^0.21.0",
32
+ "@kehto/services": "^0.19.0",
33
+ "@kehto/shell": "^0.19.2",
34
34
  "@kehto/wm": "^0.0.2"
35
35
  },
36
36
  "peerDependencies": {
37
- "@napplet/core": ">=0.29.0 <0.30.0",
38
- "@napplet/nap": ">=0.29.0 <0.30.0",
37
+ "@napplet/core": ">=0.31.0 <0.32.0",
38
+ "@napplet/nap": ">=0.31.0 <0.32.0",
39
39
  "nostr-tools": ">=2.23.3 <=2.x"
40
40
  },
41
41
  "devDependencies": {
42
- "@napplet/core": ">=0.29.0 <0.30.0",
43
- "@napplet/nap": ">=0.29.0 <0.30.0",
42
+ "@napplet/core": ">=0.31.0 <0.32.0",
43
+ "@napplet/nap": ">=0.31.0 <0.32.0",
44
44
  "nostr-tools": "^2.23.3",
45
45
  "tsup": "^8.5.0",
46
46
  "typescript": "^5.9.3",