@kehto/paja 0.25.0 → 0.26.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 CHANGED
@@ -59,14 +59,15 @@ warning, when the target would block the sandboxed frame.
59
59
 
60
60
  Every drawer section is a flush, independent native accordion: **Pointer** (in
61
61
  runtime-pointer mode), **Interfaces**, **ACL**, **Signer**, **Resource servers**,
62
- **Messages**, then **Events** last. Headers support Enter/Space, visible keyboard focus and
62
+ **Language models**, **Messages**, then **Events** last. Headers support Enter/Space, visible keyboard focus and
63
63
  state chevrons; bodies keep their padding and live controls when hidden. Sections
64
64
  start expanded unless a validated origin-local boolean preference says otherwise.
65
65
  The collapsed map uses `kehto:paja:sidebar-sections:v1`, separately from whole-drawer
66
66
  visibility and resource server values. Storage failures leave session-only toggles
67
67
  usable; collapsing never reloads the running app or discards unsaved drafts.
68
68
 
69
- The console shows supported interfaces with per-domain injection toggles,
69
+ The console shows supported interfaces with per-domain injection toggles
70
+ (green when ready, yellow `⚠` when advertised but unconfigured, red when disabled),
70
71
  runtime ACL controls, signer controls, and a filterable message log with visible
71
72
  error details. It starts expanded and collapses to the left with the chevron
72
73
  button in the top bar; the same button brings the whole panel back. The toolbar
@@ -157,6 +158,21 @@ The focused host regression runs in Chromium and Firefox after `pnpm build`:
157
158
  `pnpm exec playwright install firefox`, then
158
159
  `pnpm exec playwright test --config playwright.paja-fs.config.ts`.
159
160
 
161
+ **Language models** configures draft [NAP-LLM](https://github.com/napplet/naps/pull/134)
162
+ connections: pick a provider preset (OpenAI, Anthropic, Google Gemini, OpenRouter,
163
+ Groq, Mistral, DeepSeek, xAI, Together, Fireworks, Perplexity, Azure OpenAI, or local
164
+ Ollama, LM Studio, llama.cpp and vLLM servers), enter the model and an optional API
165
+ key, and choose whether to remember the key. Remembered keys are encrypted with
166
+ AES-GCM under a PBKDF2-SHA-256 key derived from a vault password you create (at
167
+ least 12 characters); otherwise the key lasts for the page session only. Keys are
168
+ sent solely to the connection's base URL (HTTPS, or HTTP on loopback) and never to
169
+ napplets or the message log. The `llm` interface is advertised whenever the panel is
170
+ present; it shows `⚠ llm` until a connection exists. A napplet's `select()` then
171
+ offers to open the panel and answers `unsupported` until you add one; with
172
+ connections, a chooser lists the compatible ones. Every `generate()` shows a consent
173
+ dialog naming the napplet, route, model and disclosed counts before any prompt
174
+ text leaves the browser. See [Language models](https://github.com/kehto/web/blob/main/docs/llm.md).
175
+
160
176
  Other domains are equally capability-bound. Relay, outbox, and count require
161
177
  live relays; count uses NIP-45 `COUNT` without downloading events. Storage
162
178
  requires writable `localStorage`; the memory setting is an unadvertised fixture.
@@ -576,6 +592,10 @@ remain a documented upstream spec gap; no host sender identity is invented.
576
592
 
577
593
  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).
578
594
 
595
+ ## LLM integration
596
+
597
+ This non-normative guidance defers to the living [NAP-LLM](https://github.com/napplet/naps/pull/134) (checked at `3e10939`). Services export `createLlmService`, `LlmServiceError`, the provider mappers and `LLM_PROVIDER_PRESETS`; shell exports `getShellDomainState` and the `LlmHooks` adapter field; acl exports `llm:generate`. The runtime routes `llm.*` to one registered service and answers every sanctioned request with exactly one `llm.<op>.result`, shaping missing-service and ACL failures as `{ code: 'unsupported' }`. Hosts implement `LlmConnectionHost`; the service enforces schema, handle ownership, consent before submission, duplicate ids, cancellation and deadline races, ordered deltas and safe errors. Advertisement stays binary on the wire while hosts report a third `unconfigured` state until the user adds a connection. See [Language models](https://github.com/kehto/web/blob/main/docs/llm.md).
598
+
579
599
  ## NIP-5D runtime pointers
580
600
 
581
601
  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.