@kehto/paja 0.18.1 → 0.20.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/README.md +88 -45
- package/dist/browser-host.js +2696 -1396
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-YX6C2UU7.js → chunk-6WEO5D3Z.js} +259 -56
- package/dist/chunk-6WEO5D3Z.js.map +1 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +92 -18
- package/dist/index.js +9 -1
- package/dist/{server-Ia5n1Bqv.d.ts → server-5j5uoy2Z.d.ts} +5 -0
- package/package.json +5 -5
- package/dist/chunk-YX6C2UU7.js.map +0 -1
package/README.md
CHANGED
|
@@ -232,39 +232,27 @@ The file opens in a new runtime tab named after the file.
|
|
|
232
232
|
|
|
233
233
|
## Installed intent handlers and delivery
|
|
234
234
|
|
|
235
|
-
Paja
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
identity. A superseded target/source, failed open/readiness, or terminal send is
|
|
257
|
-
handled by the controller's replacement/retry/terminal policy and produces a
|
|
258
|
-
canonical failed `IntentResult`.
|
|
259
|
-
|
|
260
|
-
Reusing a handler tab activates it and remembers the new active tab. Paja's stage
|
|
261
|
-
shows exactly one tab, so a delivered intent always selects the handler tab:
|
|
262
|
-
`behavior.focus` is a hint, and honoring `false` as "deliver into the hidden
|
|
263
|
-
tab" would report a handled intent whose surface the user never sees. Reuse
|
|
264
|
-
still leaves the caller's tab open, so nothing is replaced. Newly created
|
|
265
|
-
handler tabs behave the same way. Pointer installation logs declared
|
|
266
|
-
archetypes and required domains; Paja warns when archetypes lack `inc`, which
|
|
267
|
-
its current convention delivery policy requires.
|
|
235
|
+
Paja stores immutable resolver-verified manifest facts separately from live tabs.
|
|
236
|
+
Closing a frame leaves its catalog record available for cold starts; explicit
|
|
237
|
+
artifact removal deletes it. Restored pointers are reverified before entering the
|
|
238
|
+
catalog. Entries preserve exact conventions and ordered parameter names under
|
|
239
|
+
publisher/kind-safe opaque IDs, including nameless root and snapshot artifacts.
|
|
240
|
+
The target's resolved `intent` domain must be available; INC is not required.
|
|
241
|
+
|
|
242
|
+
Selection uses exact contracts and user-owned default, chooser, recommendation,
|
|
243
|
+
and explicit-authorization policy. Explicit handler IDs require sender-aware
|
|
244
|
+
authorization and cannot address an arbitrary running frame.
|
|
245
|
+
|
|
246
|
+
The controller retains work before returning acceptance. It then opens or reuses
|
|
247
|
+
a verified target, waits for its registered source and real `shell.ready`, checks
|
|
248
|
+
that the generation is current, and sends one target-only `intent.deliver`.
|
|
249
|
+
Replacement, readiness failure, and terminal send failure remain host-observable
|
|
250
|
+
controller outcomes; they do not produce a second source result. Accepted work
|
|
251
|
+
survives source teardown and is never replayed by tab restoration.
|
|
252
|
+
|
|
253
|
+
Paja activates delivered handler tabs because its stage shows one tab at a time.
|
|
254
|
+
`behavior.focus` is advisory; `reuse: false` creates a new surface. Existing caller
|
|
255
|
+
tabs remain open. Installed contracts and domains appear in pointer diagnostics.
|
|
268
256
|
|
|
269
257
|
`@napplet/shim@0.30.0` supplies no generic shell API. Kehto deliberately keeps
|
|
270
258
|
its host-owned mandatory `window.napplet.shell` prelude: it installs the live
|
|
@@ -273,16 +261,31 @@ provides local `ready()`, `supports()`, read-only `services`, and one-shot
|
|
|
273
261
|
`onReady()`. This is the documented upstream-package-drift exception, not a
|
|
274
262
|
shim capability.
|
|
275
263
|
|
|
276
|
-
Before Paja assigns a verified runtime-pointer document to `srcdoc`, it
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
origins
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
264
|
+
Before Paja assigns a verified runtime-pointer document to `srcdoc`, it calls
|
|
265
|
+
`@kehto/shell`'s `prepareNappletSrcdoc`. The shell inserts validated CSP first,
|
|
266
|
+
then the mandatory namespace. Defaults permit inline script/style, WASM byte
|
|
267
|
+
compilation, `data:`/`blob:` images and `data:` fonts, and deny other resource
|
|
268
|
+
classes. Paja grants direct connections only to resolved relay and Blossom
|
|
269
|
+
origins plus explicit host grants.
|
|
270
|
+
|
|
271
|
+
Hosts can pass `csp` to `createPajaRuntimeHostConfig`:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
const config = createPajaRuntimeHostConfig({
|
|
275
|
+
pointer,
|
|
276
|
+
csp: {
|
|
277
|
+
connectOrigins: ['https://api.example'],
|
|
278
|
+
directives: { 'media-src': ['blob:'], 'img-src': ['data:'] },
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
The shell rejects broad JavaScript evaluation, non-origin connection grants,
|
|
284
|
+
and script policies that block its bootstrap. NIP-5D's CSP recommendations are
|
|
285
|
+
enforced; individual baseline source lists remain configurable. Existing
|
|
286
|
+
artifact CSP is retained. Set `frame-ancestors` on the host HTTP response, not
|
|
287
|
+
in a meta policy. See the [shared policy contract](https://github.com/kehto/web/blob/main/docs/policies/NIP-5D-CONFORMANCE.md#shell-csp-enforcement).
|
|
288
|
+
Local target-URL authoring mode retains its separate development policy and HMR.
|
|
286
289
|
|
|
287
290
|
Environment simulation can be supplied through CLI flags or a JSON config file:
|
|
288
291
|
|
|
@@ -461,10 +464,50 @@ Generated API module: `docs/api/modules/_kehto_paja.html` (run `pnpm docs:api`).
|
|
|
461
464
|
|
|
462
465
|
## NIP-5D event compatibility
|
|
463
466
|
|
|
464
|
-
Current manifests use a direct artifact `x` hash, plain-text `content`,
|
|
465
|
-
`z`/`i`
|
|
467
|
+
Current manifests use a direct artifact `x` hash, plain-text `content`, role-matched
|
|
468
|
+
`z`/`i` intent declarations, and required `R` / optional `O` domains. Kehto also
|
|
466
469
|
accepts legacy aggregate events through an isolated compatibility adapter.
|
|
467
470
|
Existing `aggregateHash` host/cache/ACL fields carry the verified artifact hash
|
|
468
471
|
for current events; legacy identities keep their original aggregate. Both paths
|
|
469
472
|
verify signatures and bytes before runtime injection and `srcdoc` execution.
|
|
470
473
|
For the schema and removal boundary, see [event migration](https://kehto.github.io/web/docs/migrations/NIP-5D-EVENT-SCHEMA.html).
|
|
474
|
+
|
|
475
|
+
## NAP-INTENT links and lifecycle
|
|
476
|
+
|
|
477
|
+
This follows [NAP-INTENT PR #106](https://github.com/napplet/naps/blob/fc121fc264615482143eda86125863d2e1f741a2/naps/NAP-INTENT.md) at `fc121fc264615482143eda86125863d2e1f741a2` and NIP-5D PR #2303 at `020cb8b33a9e4c6b8ca4b2f9d0ed0a67843b68f7`.
|
|
478
|
+
|
|
479
|
+
For a verified app with advertised intents, choose **Share → Create intent link**.
|
|
480
|
+
Select its convention, include the text parameters you want, or switch to JSON.
|
|
481
|
+
Parameters start omitted; selecting Include with an empty field sends an explicit
|
|
482
|
+
empty string. Names stay in advertised order and extra named fields are allowed.
|
|
483
|
+
No parameter type or requiredness is inferred. An empty advertised list still
|
|
484
|
+
permits a payload. Opening or editing the builder never invokes an intent.
|
|
485
|
+
Use **Copy link** or explicitly **Test intent** to open the review view.
|
|
486
|
+
|
|
487
|
+
The outer URL carries a complete percent-encoded convention URI in `intent`.
|
|
488
|
+
For example, `?intent=napplet%3Aprofile%2Fopen%3Fpubkey%3Dabc%252B123`
|
|
489
|
+
contains `napplet:profile/open?pubkey=abc%2B123` and delivers text `abc+123`.
|
|
490
|
+
Outer and inner layers decode once each; literal `+` stays plus. Optional outer
|
|
491
|
+
`payload` contains JSON, including null, primitives, arrays, or objects, and
|
|
492
|
+
cannot accompany an inner query. URLs are limited to 16 KiB UTF-8. Duplicate
|
|
493
|
+
keys, malformed encoding, and conflicting target instructions are rejected.
|
|
494
|
+
Ordinary pointer-only app links retain their existing behavior.
|
|
495
|
+
|
|
496
|
+
Choose recipient default routing, a named-35129 `#naddr` recommendation, or an
|
|
497
|
+
exact outer `pointer`. Explicit pointers must verify and advertise the exact
|
|
498
|
+
contract; failure never silently falls back. Otherwise an applicable user default
|
|
499
|
+
wins before a recommendation, then ordinary compatible selection applies.
|
|
500
|
+
Recommendation relay hints remain untrusted discovery inputs. Installing a
|
|
501
|
+
recommendation requires confirmation after signed metadata and bytes verify.
|
|
502
|
+
|
|
503
|
+
Incoming links show **Review intent** before execution. Edit, choose another
|
|
504
|
+
handler, explicitly save or clear a default, launch, retry, or cancel. Defaults
|
|
505
|
+
never change implicitly. Cancellation before Launch sends nothing; accepted
|
|
506
|
+
work is retained while completion or failure remains visible in the host.
|
|
507
|
+
|
|
508
|
+
Paja invokes through a separate signed launcher napplet with a verified artifact
|
|
509
|
+
and authenticated iframe endpoint. Its source supplies the opaque sender; the
|
|
510
|
+
URL cannot supply one. The hidden launcher is removed after acceptance and is
|
|
511
|
+
never persisted or restored. Verification precedes `srcdoc`, and host bootstrap
|
|
512
|
+
injection stays outside signed bytes. Native external-origin sender semantics
|
|
513
|
+
remain a documented upstream spec gap; no host sender identity is invented.
|