@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 +22 -2
- package/dist/browser-host.js +2298 -769
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-FGY4IESF.js → chunk-EYSQOKVF.js} +455 -4
- package/dist/chunk-EYSQOKVF.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +303 -6
- package/dist/index.js +19 -1
- package/dist/{server-Cd34l9ts.d.ts → server-CRv7mQBf.d.ts} +1 -1
- package/package.json +6 -6
- package/dist/chunk-FGY4IESF.js.map +0 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { P as PajaRawOptions, s as startPajaServer, a as PajaCommand, w as waitForTargetUrl } from './server-
|
|
2
|
+
import { P as PajaRawOptions, s as startPajaServer, a as PajaCommand, w as waitForTargetUrl } from './server-CRv7mQBf.js';
|
|
3
3
|
import '@kehto/shell';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { P as PajaRawOptions, b as PajaHostConfig } from './server-
|
|
2
|
-
export { D as DEFAULT_PAJA_AGGREGATE_HASH, c as DEFAULT_PAJA_DTAG, d as DEFAULT_PAJA_HOST, e as DEFAULT_PAJA_PORT, f as DEFAULT_PAJA_RUNTIME_WAIT_MS, g as DEFAULT_PAJA_WINDOW_ID, h as DEFAULT_READY_TIMEOUT_MS, J as JsonPrimitive, i as JsonRecord, j as JsonValue, k as PAJA_SIMULATION_DOMAINS, l as PajaCapabilityDomain, a as PajaCommand, m as PajaHmrStrategy, n as PajaOptions, o as PajaOptionsError, p as PajaPointerRuntimeConfig, q as PajaServer, r as PajaServerOptions, t as PajaSimulation, u as PajaSimulationError, v as PajaSimulationRawOptions, x as PajaTargetMode, R as ReadinessError, y as ReadinessFetch, W as WaitForTargetUrlOptions, z as createPajaHostConfig, A as createPajaRuntimeHostConfig, B as formatPajaUrl, C as normalizePajaOptions, E as normalizePajaSimulation, s as startPajaServer, F as summarizePajaSimulation, w as waitForTargetUrl } from './server-
|
|
1
|
+
import { P as PajaRawOptions, b as PajaHostConfig } from './server-CRv7mQBf.js';
|
|
2
|
+
export { D as DEFAULT_PAJA_AGGREGATE_HASH, c as DEFAULT_PAJA_DTAG, d as DEFAULT_PAJA_HOST, e as DEFAULT_PAJA_PORT, f as DEFAULT_PAJA_RUNTIME_WAIT_MS, g as DEFAULT_PAJA_WINDOW_ID, h as DEFAULT_READY_TIMEOUT_MS, J as JsonPrimitive, i as JsonRecord, j as JsonValue, k as PAJA_SIMULATION_DOMAINS, l as PajaCapabilityDomain, a as PajaCommand, m as PajaHmrStrategy, n as PajaOptions, o as PajaOptionsError, p as PajaPointerRuntimeConfig, q as PajaServer, r as PajaServerOptions, t as PajaSimulation, u as PajaSimulationError, v as PajaSimulationRawOptions, x as PajaTargetMode, R as ReadinessError, y as ReadinessFetch, W as WaitForTargetUrlOptions, z as createPajaHostConfig, A as createPajaRuntimeHostConfig, B as formatPajaUrl, C as normalizePajaOptions, E as normalizePajaSimulation, s as startPajaServer, F as summarizePajaSimulation, w as waitForTargetUrl } from './server-CRv7mQBf.js';
|
|
3
3
|
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, NormalizedIntentUri } from '@kehto/shell';
|
|
7
7
|
export { NappletCspDirective, NappletCspDirectives, NappletCspOptions } from '@kehto/shell';
|
|
8
|
-
import { IntentCatalogEntry, IntentTargetController, IntentDispatchParams, IntentTargetAcceptance } from '@kehto/services';
|
|
8
|
+
import { IntentCatalogEntry, IntentTargetController, IntentDispatchParams, IntentTargetAcceptance, LlmProviderProtocol, LlmCredentialHeader, LlmConnectionHost, LlmRequirements, HttpLlmProvider } from '@kehto/services';
|
|
9
|
+
import { NostrEvent as NostrEvent$1 } from '@napplet/core';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Load a JSON Paja config file from disk.
|
|
@@ -138,7 +139,7 @@ declare function injectPajaRuntimeCsp(html: string, origins: readonly string[]):
|
|
|
138
139
|
|
|
139
140
|
declare const PAJA_LEGACY_COMPATIBILITY_DOMAIN: string;
|
|
140
141
|
/** 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", "fs", "gamepad", "identity", string, "inc", "intent", "keys", "link", "lists", "media", "notify", "outbox", "relay", "resource", "serial", "shell", "storage", "theme", "upload", "webrtc"];
|
|
142
|
+
declare const PAJA_UPSTREAM_WEB_DOMAINS: readonly ["ble", "common", "config", "count", "cvm", "dm", "fs", "gamepad", "identity", string, "inc", "intent", "keys", "link", "lists", "llm", "media", "notify", "outbox", "relay", "resource", "serial", "shell", "storage", "theme", "upload", "webrtc"];
|
|
142
143
|
/** Retained compatibility export; no domain requires a Paja handshake. */
|
|
143
144
|
declare const PAJA_HANDSHAKE_DOMAINS: readonly [];
|
|
144
145
|
/** Compatibility aliases for renamed upstream capability domains. */
|
|
@@ -146,7 +147,7 @@ declare const PAJA_COMPATIBILITY_ALIASES: {
|
|
|
146
147
|
readonly [PAJA_LEGACY_COMPATIBILITY_DOMAIN]: "inc";
|
|
147
148
|
};
|
|
148
149
|
/** Domains Paja may advertise when each corresponding host backend is live. */
|
|
149
|
-
declare const PAJA_ADVERTISED_DOMAINS: readonly ["shell", "gamepad", "relay", "outbox", "identity", "storage", "inc", "theme", "keys", "link", "common", "lists", "serial", "ble", "webrtc", "media", "notify", "config", "resource", "cvm", "upload", "intent", "count", "dm", "fs"];
|
|
150
|
+
declare const PAJA_ADVERTISED_DOMAINS: readonly ["shell", "gamepad", "relay", "outbox", "identity", "storage", "inc", "theme", "keys", "link", "common", "lists", "serial", "ble", "webrtc", "media", "notify", "config", "resource", "cvm", "upload", "intent", "count", "dm", "fs", "llm"];
|
|
150
151
|
/** Service names Paja expects the host runtime to provide. */
|
|
151
152
|
declare const PAJA_REQUIRED_SERVICES: readonly ["gamepad", "config", "cvm", "identity", "intent", "keys", "link", "common", "lists", "serial", "ble", "webrtc", "media", "notify", "outbox", "relay", "resource", "theme", "upload", "count", "dm", "fs"];
|
|
152
153
|
/**
|
|
@@ -477,6 +478,302 @@ declare function resolvePajaIntentLauncher(): Promise<PajaResolvedPointer>;
|
|
|
477
478
|
/** Send a shared-link URI only to the frame registered for this launcher generation. */
|
|
478
479
|
declare function postPajaIntentLauncherMessage(frame: Pick<HTMLIFrameElement, 'contentWindow'>, message: PajaIntentLauncherMessage): void;
|
|
479
480
|
|
|
481
|
+
/** Napplet source attached to a window-scoped signer request. */
|
|
482
|
+
interface PajaSignerSource {
|
|
483
|
+
/** Originating runtime window. */
|
|
484
|
+
readonly windowId: string;
|
|
485
|
+
/** Host-owned napplet identity. Runtime-pointer hashes identify verified artifacts. */
|
|
486
|
+
readonly napplet: {
|
|
487
|
+
readonly dTag: string;
|
|
488
|
+
readonly aggregateHash: string;
|
|
489
|
+
};
|
|
490
|
+
/** Stable Paja target boundary: exact direct URL or verified artifact hash. */
|
|
491
|
+
readonly runtimeScope: string;
|
|
492
|
+
/** Host-owned lifecycle check; never persisted or supplied by a napplet. */
|
|
493
|
+
readonly isCurrent?: () => boolean;
|
|
494
|
+
}
|
|
495
|
+
/** Source identity plus the signer account whose authority is being granted. */
|
|
496
|
+
interface PajaSignerRequestContext extends PajaSignerSource {
|
|
497
|
+
/** Active signer public key, or host-generated for document-scoped ephemeral transport events. */
|
|
498
|
+
readonly signerPubkey: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Confirmation requests Paja raises before user-visible operations.
|
|
503
|
+
*
|
|
504
|
+
* Each variant carries only what the confirmation dialog shows and logs; prompt
|
|
505
|
+
* bodies, credentials and secrets stay out of these records.
|
|
506
|
+
*/
|
|
507
|
+
|
|
508
|
+
/** Confirmation request emitted before Paja signs, publishes, or uploads. */
|
|
509
|
+
type PajaConfirmationRequest = ({
|
|
510
|
+
readonly action: 'sign' | 'publish';
|
|
511
|
+
readonly event: NostrEvent$1 | Partial<NostrEvent$1>;
|
|
512
|
+
readonly signerContext?: PajaSignerRequestContext;
|
|
513
|
+
} | {
|
|
514
|
+
readonly action: 'upload';
|
|
515
|
+
readonly windowId: string;
|
|
516
|
+
readonly napplet: {
|
|
517
|
+
readonly dTag: string;
|
|
518
|
+
readonly aggregateHash: string;
|
|
519
|
+
};
|
|
520
|
+
readonly filename?: string;
|
|
521
|
+
readonly size: number;
|
|
522
|
+
readonly mimeType?: string;
|
|
523
|
+
readonly server: string;
|
|
524
|
+
readonly warning: string;
|
|
525
|
+
} | {
|
|
526
|
+
readonly action: 'link';
|
|
527
|
+
readonly windowId: string;
|
|
528
|
+
readonly napplet: {
|
|
529
|
+
readonly dTag: string;
|
|
530
|
+
readonly aggregateHash: string;
|
|
531
|
+
};
|
|
532
|
+
readonly url: string;
|
|
533
|
+
readonly label?: string;
|
|
534
|
+
} | {
|
|
535
|
+
readonly action: 'serial' | 'ble';
|
|
536
|
+
readonly windowId: string;
|
|
537
|
+
readonly label?: string;
|
|
538
|
+
readonly details: string;
|
|
539
|
+
} | {
|
|
540
|
+
readonly action: 'notify';
|
|
541
|
+
readonly windowId: string;
|
|
542
|
+
readonly napplet: {
|
|
543
|
+
readonly dTag: string;
|
|
544
|
+
readonly aggregateHash: string;
|
|
545
|
+
};
|
|
546
|
+
readonly channel?: string;
|
|
547
|
+
} | {
|
|
548
|
+
readonly action: 'webrtc';
|
|
549
|
+
readonly windowId: string;
|
|
550
|
+
readonly napplet: {
|
|
551
|
+
readonly dTag: string;
|
|
552
|
+
readonly aggregateHash: string;
|
|
553
|
+
};
|
|
554
|
+
readonly scope: string;
|
|
555
|
+
readonly warning: string;
|
|
556
|
+
} | {
|
|
557
|
+
readonly action: 'dm';
|
|
558
|
+
readonly recipients: readonly string[];
|
|
559
|
+
readonly content: string;
|
|
560
|
+
readonly warning: string;
|
|
561
|
+
} | {
|
|
562
|
+
/** NAP-LLM disclosure consent before one generation is submitted. */
|
|
563
|
+
readonly action: 'llm';
|
|
564
|
+
readonly windowId: string;
|
|
565
|
+
readonly napplet: {
|
|
566
|
+
readonly dTag: string;
|
|
567
|
+
readonly aggregateHash: string;
|
|
568
|
+
};
|
|
569
|
+
readonly connection: string;
|
|
570
|
+
readonly model: string;
|
|
571
|
+
readonly route: string;
|
|
572
|
+
readonly messages: number;
|
|
573
|
+
readonly characters: number;
|
|
574
|
+
readonly images: number;
|
|
575
|
+
readonly format: 'text' | 'json';
|
|
576
|
+
readonly warning: string;
|
|
577
|
+
} | {
|
|
578
|
+
/** A napplet asked for a model while no compatible connection is configured. */
|
|
579
|
+
readonly action: 'llm-configure';
|
|
580
|
+
readonly windowId: string;
|
|
581
|
+
readonly napplet: {
|
|
582
|
+
readonly dTag: string;
|
|
583
|
+
readonly aggregateHash: string;
|
|
584
|
+
};
|
|
585
|
+
readonly requirements: string;
|
|
586
|
+
readonly configured: number;
|
|
587
|
+
} | {
|
|
588
|
+
readonly action: 'fs';
|
|
589
|
+
readonly windowId: string;
|
|
590
|
+
readonly kind: 'file' | 'files' | 'directory' | 'save-file';
|
|
591
|
+
readonly description: string;
|
|
592
|
+
}) & {
|
|
593
|
+
readonly isCurrent?: () => boolean;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
/** Async-capable host policy callback for user-visible Paja operations. */
|
|
597
|
+
type PajaConfirmationHandler = (request: PajaConfirmationRequest) => boolean | Promise<boolean>;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Paja's encrypted store for NAP-LLM provider credentials.
|
|
601
|
+
*
|
|
602
|
+
* API keys are optional to remember. When the user asks Paja to remember one,
|
|
603
|
+
* it is encrypted with AES-GCM under a key derived from a user password with
|
|
604
|
+
* PBKDF2-SHA-256 (600 000 iterations, random salt). Only the ciphertext,
|
|
605
|
+
* salt, IV and KDF parameters touch `localStorage`. Plaintext keys live in
|
|
606
|
+
* memory while the vault is unlocked and are handed only to the provider
|
|
607
|
+
* request builder; they are never logged, never placed in the message log and
|
|
608
|
+
* never cross the napplet wire. Session-only keys skip storage entirely.
|
|
609
|
+
*/
|
|
610
|
+
/** Durable storage key for the encrypted credential document. */
|
|
611
|
+
declare const PAJA_LLM_VAULT_STORAGE_KEY = "kehto:paja:llm-vault:v1";
|
|
612
|
+
/** Minimum vault password length. */
|
|
613
|
+
declare const PAJA_LLM_VAULT_MIN_PASSWORD_LENGTH = 12;
|
|
614
|
+
/** Where a connection's credential lives. */
|
|
615
|
+
type PajaLlmCredentialStorage = 'vault' | 'session' | 'none';
|
|
616
|
+
/** Encrypted-at-rest credential store with a session-only tier. */
|
|
617
|
+
interface PajaLlmVault {
|
|
618
|
+
/** True when an encrypted document exists in storage. */
|
|
619
|
+
hasStoredSecrets(): boolean;
|
|
620
|
+
/** True when the vault key is derived and stored secrets are readable. */
|
|
621
|
+
isUnlocked(): boolean;
|
|
622
|
+
/** Derive the key and decrypt stored secrets. Resolves false for a wrong password or corrupt document. */
|
|
623
|
+
unlock(password: string): Promise<boolean>;
|
|
624
|
+
/** Create an empty vault with a new password. Replaces any existing document. */
|
|
625
|
+
create(password: string): Promise<void>;
|
|
626
|
+
/** Drop the derived key and decrypted secrets; session-only secrets survive. */
|
|
627
|
+
lock(): void;
|
|
628
|
+
/** Read a credential from the unlocked vault or the session tier. */
|
|
629
|
+
getCredential(connectionId: string): string | undefined;
|
|
630
|
+
/** Store a credential. `vault` requires an unlocked vault and re-encrypts the document. */
|
|
631
|
+
setCredential(connectionId: string, credential: string, storage: Exclude<PajaLlmCredentialStorage, 'none'>): Promise<void>;
|
|
632
|
+
/** Remove a credential from both tiers; vault removal requires an unlocked vault. */
|
|
633
|
+
removeCredential(connectionId: string): Promise<void>;
|
|
634
|
+
/** Forget every secret and delete the encrypted document. */
|
|
635
|
+
clear(): void;
|
|
636
|
+
/** Observe lock, unlock, create and clear transitions. */
|
|
637
|
+
subscribe(listener: () => void): () => void;
|
|
638
|
+
}
|
|
639
|
+
/** Web Crypto subset the vault needs. */
|
|
640
|
+
interface PajaLlmVaultCrypto {
|
|
641
|
+
getRandomValues<T extends ArrayBufferView>(array: T): T;
|
|
642
|
+
subtle: Pick<SubtleCrypto, 'importKey' | 'deriveKey' | 'encrypt' | 'decrypt'>;
|
|
643
|
+
}
|
|
644
|
+
/** Options for {@link createPajaLlmVault}. */
|
|
645
|
+
interface PajaLlmVaultOptions {
|
|
646
|
+
/** Durable storage; null keeps everything session-only. Defaults to localStorage when available. */
|
|
647
|
+
storage?: Storage | null;
|
|
648
|
+
/** Web Crypto implementation. Defaults to `globalThis.crypto`. */
|
|
649
|
+
crypto?: PajaLlmVaultCrypto;
|
|
650
|
+
/** PBKDF2 iteration count for new vaults. */
|
|
651
|
+
iterations?: number;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Validate a vault password before deriving a key from it.
|
|
655
|
+
*
|
|
656
|
+
* @param password - Candidate password.
|
|
657
|
+
* @returns A user-facing problem, or null when acceptable.
|
|
658
|
+
* @example
|
|
659
|
+
* validatePajaLlmVaultPassword('short'); // 'Use at least 12 characters.'
|
|
660
|
+
*/
|
|
661
|
+
declare function validatePajaLlmVaultPassword(password: string): string | null;
|
|
662
|
+
/**
|
|
663
|
+
* Create Paja's credential vault.
|
|
664
|
+
*
|
|
665
|
+
* @param options - Storage, crypto and KDF overrides.
|
|
666
|
+
* @returns A vault whose plaintext never leaves memory.
|
|
667
|
+
* @example
|
|
668
|
+
* const vault = createPajaLlmVault();
|
|
669
|
+
* await vault.create(password);
|
|
670
|
+
* await vault.setCredential(connection.id, apiKey, 'vault');
|
|
671
|
+
*/
|
|
672
|
+
declare function createPajaLlmVault(options?: PajaLlmVaultOptions): PajaLlmVault;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Paja's NAP-LLM connection store and runtime host.
|
|
676
|
+
*
|
|
677
|
+
* Connection metadata (name, protocol, base URL, model, capabilities) is plain
|
|
678
|
+
* host configuration in `localStorage`. Credentials live in the separate
|
|
679
|
+
* {@link PajaLlmVault}. The host implements the service's
|
|
680
|
+
* `LlmConnectionHost` seam: it shows the chooser, asks for disclosure consent
|
|
681
|
+
* before every generation, resolves the credential and calls the provider.
|
|
682
|
+
* The credential is placed only on the request to the connection's own base URL.
|
|
683
|
+
*/
|
|
684
|
+
|
|
685
|
+
/** Durable storage key for connection metadata (never credentials). */
|
|
686
|
+
declare const PAJA_LLM_CONNECTIONS_STORAGE_KEY = "kehto:paja:llm-connections:v1";
|
|
687
|
+
/** One saved provider connection. Credentials are referenced, never embedded. */
|
|
688
|
+
interface PajaLlmConnectionRecord {
|
|
689
|
+
readonly id: string;
|
|
690
|
+
readonly name: string;
|
|
691
|
+
readonly presetId: string;
|
|
692
|
+
readonly protocol: LlmProviderProtocol;
|
|
693
|
+
readonly baseUrl: string;
|
|
694
|
+
readonly model: string;
|
|
695
|
+
readonly images: boolean;
|
|
696
|
+
readonly json: boolean;
|
|
697
|
+
readonly credentialHeader?: LlmCredentialHeader;
|
|
698
|
+
readonly credentialStorage: PajaLlmCredentialStorage;
|
|
699
|
+
}
|
|
700
|
+
/** Observable connection list with validated writes. */
|
|
701
|
+
interface PajaLlmConnectionStore {
|
|
702
|
+
list(): readonly PajaLlmConnectionRecord[];
|
|
703
|
+
get(id: string): PajaLlmConnectionRecord | undefined;
|
|
704
|
+
/** Validate and persist; returns the stored record or throws a user-facing Error. */
|
|
705
|
+
save(record: PajaLlmConnectionRecord): PajaLlmConnectionRecord;
|
|
706
|
+
remove(id: string): boolean;
|
|
707
|
+
subscribe(listener: () => void): () => void;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Normalise and validate an API base URL for a provider connection.
|
|
711
|
+
*
|
|
712
|
+
* HTTPS is required except for loopback hosts, so a remembered key can only
|
|
713
|
+
* travel encrypted to the configured server or to the user's own machine.
|
|
714
|
+
*
|
|
715
|
+
* @param value - User-entered URL.
|
|
716
|
+
* @returns The canonical origin plus path without a trailing slash.
|
|
717
|
+
* @throws Error with user-facing text for an unusable URL.
|
|
718
|
+
* @example normalizePajaLlmBaseUrl('https://api.openai.com/v1/'); // 'https://api.openai.com/v1'
|
|
719
|
+
*/
|
|
720
|
+
declare function normalizePajaLlmBaseUrl(value: string): string;
|
|
721
|
+
/**
|
|
722
|
+
* Create the connection store.
|
|
723
|
+
*
|
|
724
|
+
* @param storage - Durable storage or null for session-only connections.
|
|
725
|
+
* @returns An observable, validated connection list.
|
|
726
|
+
* @example const store = createPajaLlmConnectionStore();
|
|
727
|
+
*/
|
|
728
|
+
declare function createPajaLlmConnectionStore(storage?: Storage | null): PajaLlmConnectionStore;
|
|
729
|
+
/** Who is asking, for chooser and consent copy. */
|
|
730
|
+
interface PajaLlmRequestIdentity {
|
|
731
|
+
readonly dTag: string;
|
|
732
|
+
readonly aggregateHash: string;
|
|
733
|
+
}
|
|
734
|
+
/** UI and policy callbacks the Paja host needs from the page. */
|
|
735
|
+
interface PajaLlmHostOptions {
|
|
736
|
+
store: PajaLlmConnectionStore;
|
|
737
|
+
vault: PajaLlmVault;
|
|
738
|
+
/** Host confirmation dialog shared with signer, upload and other operations. */
|
|
739
|
+
confirm: PajaConfirmationHandler;
|
|
740
|
+
/** Show the connection chooser; resolve null when the user declines. */
|
|
741
|
+
chooseConnection(candidates: readonly PajaLlmConnectionRecord[], context: {
|
|
742
|
+
windowId: string;
|
|
743
|
+
napplet: PajaLlmRequestIdentity;
|
|
744
|
+
requirements: LlmRequirements;
|
|
745
|
+
}): Promise<PajaLlmConnectionRecord | null>;
|
|
746
|
+
/** Ask for the vault password; resolve null when the user cancels. */
|
|
747
|
+
requestUnlock(): Promise<boolean>;
|
|
748
|
+
/** Reveal and focus the Language models panel. */
|
|
749
|
+
openPanel(): void;
|
|
750
|
+
/** Resolve the napplet identity bound to a runtime window. */
|
|
751
|
+
getIdentity(windowId: string): PajaLlmRequestIdentity;
|
|
752
|
+
/** Provider transport; defaults to the fetch-based provider. */
|
|
753
|
+
provider?: HttpLlmProvider;
|
|
754
|
+
}
|
|
755
|
+
/** Paja's NAP-LLM host plus the configuration probe the shell adapter needs. */
|
|
756
|
+
interface PajaLlmHost extends LlmConnectionHost {
|
|
757
|
+
/** True when at least one connection exists. */
|
|
758
|
+
isConfigured(): boolean;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Describe the disclosure route for a connection without credentials.
|
|
762
|
+
* @param record - Saved connection.
|
|
763
|
+
* @returns Human-readable route from this browser to the provider origin.
|
|
764
|
+
* @example describePajaLlmRoute(record); // 'Paja (this browser) → OpenAI at https://api.openai.com'
|
|
765
|
+
*/
|
|
766
|
+
declare function describePajaLlmRoute(record: PajaLlmConnectionRecord): string;
|
|
767
|
+
/**
|
|
768
|
+
* Create Paja's NAP-LLM host.
|
|
769
|
+
*
|
|
770
|
+
* @param options - Store, vault, dialogs and provider transport.
|
|
771
|
+
* @returns A host for `createLlmService({ host })` plus the configured probe.
|
|
772
|
+
* @example
|
|
773
|
+
* const host = createPajaLlmHost({ store, vault, confirm, chooseConnection, requestUnlock, openPanel, getIdentity });
|
|
774
|
+
*/
|
|
775
|
+
declare function createPajaLlmHost(options: PajaLlmHostOptions): PajaLlmHost;
|
|
776
|
+
|
|
480
777
|
/**
|
|
481
778
|
* Target dev-server CORS diagnostics.
|
|
482
779
|
*
|
|
@@ -545,4 +842,4 @@ type PajaTargetCorsFetch = (input: string, init: {
|
|
|
545
842
|
*/
|
|
546
843
|
declare function probeTargetCors(targetUrl: string, fetchImpl?: PajaTargetCorsFetch): Promise<PajaTargetCorsDiagnostic>;
|
|
547
844
|
|
|
548
|
-
export { BrowserIntentController, type BrowserIntentControllerOptions, type BrowserIntentGeneration, type BrowserIntentTerminalReason, InstalledNappletCatalog, type InstalledNappletCatalogListener, type InstalledNappletRecord, PAJA_ADVERTISED_DOMAINS, PAJA_COMPATIBILITY_ALIASES, PAJA_HANDSHAKE_DOMAINS, PAJA_LOCAL_SINGLE_FILE_HINT, PAJA_NAPPLET_MANIFEST_KIND, PAJA_NAPPLET_MANIFEST_KINDS, PAJA_REQUIRED_SERVICES, PAJA_TARGET_CORS_HINT, PAJA_UPSTREAM_WEB_DOMAINS, type PajaDecodedPointer, PajaHostConfig, type PajaIntentLauncherMessage, type PajaIntentLinkDescriptor, type PajaLocalFileInput, type PajaLocalTarget, type PajaPointerRelayPool, PajaRawOptions, type PajaResolvedPointer, type PajaRuntimeTarget, type PajaTargetCorsDiagnostic, type PajaTargetCorsFetch, type PajaTargetCorsStatus, type ParsedPajaIntentLink, type ResolvePajaPointerOptions, classifyTargetCors, createPajaIntentLink, createPajaLocalTarget, decodePajaPointer, findRelativeAssetReferences, getMissingAdvertisedDomains, getMissingServices, injectPajaRuntimeCsp, isPajaLocalHtmlFile, isPajaLocalTarget, loadPajaConfigFile, mergePajaRawOptions, parsePajaIntentLink, postPajaIntentLauncherMessage, probeTargetCors, readNappletIdMeta, renderPajaHtml, resolvePajaIntentLauncher, resolvePajaPointer, resolvePajaRawOptions };
|
|
845
|
+
export { BrowserIntentController, type BrowserIntentControllerOptions, type BrowserIntentGeneration, type BrowserIntentTerminalReason, InstalledNappletCatalog, type InstalledNappletCatalogListener, type InstalledNappletRecord, PAJA_ADVERTISED_DOMAINS, PAJA_COMPATIBILITY_ALIASES, PAJA_HANDSHAKE_DOMAINS, PAJA_LLM_CONNECTIONS_STORAGE_KEY, PAJA_LLM_VAULT_MIN_PASSWORD_LENGTH, PAJA_LLM_VAULT_STORAGE_KEY, PAJA_LOCAL_SINGLE_FILE_HINT, PAJA_NAPPLET_MANIFEST_KIND, PAJA_NAPPLET_MANIFEST_KINDS, PAJA_REQUIRED_SERVICES, PAJA_TARGET_CORS_HINT, PAJA_UPSTREAM_WEB_DOMAINS, type PajaConfirmationHandler, type PajaConfirmationRequest, type PajaDecodedPointer, PajaHostConfig, type PajaIntentLauncherMessage, type PajaIntentLinkDescriptor, type PajaLlmConnectionRecord, type PajaLlmConnectionStore, type PajaLlmCredentialStorage, type PajaLlmHost, type PajaLlmHostOptions, type PajaLlmRequestIdentity, type PajaLlmVault, type PajaLlmVaultCrypto, type PajaLlmVaultOptions, type PajaLocalFileInput, type PajaLocalTarget, type PajaPointerRelayPool, PajaRawOptions, type PajaResolvedPointer, type PajaRuntimeTarget, type PajaSignerRequestContext, type PajaSignerSource, type PajaTargetCorsDiagnostic, type PajaTargetCorsFetch, type PajaTargetCorsStatus, type ParsedPajaIntentLink, type ResolvePajaPointerOptions, classifyTargetCors, createPajaIntentLink, createPajaLlmConnectionStore, createPajaLlmHost, createPajaLlmVault, createPajaLocalTarget, decodePajaPointer, describePajaLlmRoute, findRelativeAssetReferences, getMissingAdvertisedDomains, getMissingServices, injectPajaRuntimeCsp, isPajaLocalHtmlFile, isPajaLocalTarget, loadPajaConfigFile, mergePajaRawOptions, normalizePajaLlmBaseUrl, parsePajaIntentLink, postPajaIntentLauncherMessage, probeTargetCors, readNappletIdMeta, renderPajaHtml, resolvePajaIntentLauncher, resolvePajaPointer, resolvePajaRawOptions, validatePajaLlmVaultPassword };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
PAJA_ADVERTISED_DOMAINS,
|
|
12
12
|
PAJA_COMPATIBILITY_ALIASES,
|
|
13
13
|
PAJA_HANDSHAKE_DOMAINS,
|
|
14
|
+
PAJA_LLM_CONNECTIONS_STORAGE_KEY,
|
|
15
|
+
PAJA_LLM_VAULT_MIN_PASSWORD_LENGTH,
|
|
16
|
+
PAJA_LLM_VAULT_STORAGE_KEY,
|
|
14
17
|
PAJA_LOCAL_SINGLE_FILE_HINT,
|
|
15
18
|
PAJA_NAPPLET_MANIFEST_KIND,
|
|
16
19
|
PAJA_NAPPLET_MANIFEST_KINDS,
|
|
@@ -24,9 +27,13 @@ import {
|
|
|
24
27
|
classifyTargetCors,
|
|
25
28
|
createPajaHostConfig,
|
|
26
29
|
createPajaIntentLink,
|
|
30
|
+
createPajaLlmConnectionStore,
|
|
31
|
+
createPajaLlmHost,
|
|
32
|
+
createPajaLlmVault,
|
|
27
33
|
createPajaLocalTarget,
|
|
28
34
|
createPajaRuntimeHostConfig,
|
|
29
35
|
decodePajaPointer,
|
|
36
|
+
describePajaLlmRoute,
|
|
30
37
|
findRelativeAssetReferences,
|
|
31
38
|
formatPajaUrl,
|
|
32
39
|
getMissingAdvertisedDomains,
|
|
@@ -36,6 +43,7 @@ import {
|
|
|
36
43
|
isPajaLocalTarget,
|
|
37
44
|
loadPajaConfigFile,
|
|
38
45
|
mergePajaRawOptions,
|
|
46
|
+
normalizePajaLlmBaseUrl,
|
|
39
47
|
normalizePajaOptions,
|
|
40
48
|
normalizePajaSimulation,
|
|
41
49
|
parsePajaIntentLink,
|
|
@@ -48,8 +56,9 @@ import {
|
|
|
48
56
|
resolvePajaRawOptions,
|
|
49
57
|
startPajaServer,
|
|
50
58
|
summarizePajaSimulation,
|
|
59
|
+
validatePajaLlmVaultPassword,
|
|
51
60
|
waitForTargetUrl
|
|
52
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-EYSQOKVF.js";
|
|
53
62
|
export {
|
|
54
63
|
BrowserIntentController,
|
|
55
64
|
DEFAULT_PAJA_AGGREGATE_HASH,
|
|
@@ -63,6 +72,9 @@ export {
|
|
|
63
72
|
PAJA_ADVERTISED_DOMAINS,
|
|
64
73
|
PAJA_COMPATIBILITY_ALIASES,
|
|
65
74
|
PAJA_HANDSHAKE_DOMAINS,
|
|
75
|
+
PAJA_LLM_CONNECTIONS_STORAGE_KEY,
|
|
76
|
+
PAJA_LLM_VAULT_MIN_PASSWORD_LENGTH,
|
|
77
|
+
PAJA_LLM_VAULT_STORAGE_KEY,
|
|
66
78
|
PAJA_LOCAL_SINGLE_FILE_HINT,
|
|
67
79
|
PAJA_NAPPLET_MANIFEST_KIND,
|
|
68
80
|
PAJA_NAPPLET_MANIFEST_KINDS,
|
|
@@ -76,9 +88,13 @@ export {
|
|
|
76
88
|
classifyTargetCors,
|
|
77
89
|
createPajaHostConfig,
|
|
78
90
|
createPajaIntentLink,
|
|
91
|
+
createPajaLlmConnectionStore,
|
|
92
|
+
createPajaLlmHost,
|
|
93
|
+
createPajaLlmVault,
|
|
79
94
|
createPajaLocalTarget,
|
|
80
95
|
createPajaRuntimeHostConfig,
|
|
81
96
|
decodePajaPointer,
|
|
97
|
+
describePajaLlmRoute,
|
|
82
98
|
findRelativeAssetReferences,
|
|
83
99
|
formatPajaUrl,
|
|
84
100
|
getMissingAdvertisedDomains,
|
|
@@ -88,6 +104,7 @@ export {
|
|
|
88
104
|
isPajaLocalTarget,
|
|
89
105
|
loadPajaConfigFile,
|
|
90
106
|
mergePajaRawOptions,
|
|
107
|
+
normalizePajaLlmBaseUrl,
|
|
91
108
|
normalizePajaOptions,
|
|
92
109
|
normalizePajaSimulation,
|
|
93
110
|
parsePajaIntentLink,
|
|
@@ -100,6 +117,7 @@ export {
|
|
|
100
117
|
resolvePajaRawOptions,
|
|
101
118
|
startPajaServer,
|
|
102
119
|
summarizePajaSimulation,
|
|
120
|
+
validatePajaLlmVaultPassword,
|
|
103
121
|
waitForTargetUrl
|
|
104
122
|
};
|
|
105
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -9,7 +9,7 @@ type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
|
9
9
|
/** JSON object used for Paja simulation fixtures and config/theme values. */
|
|
10
10
|
type JsonRecord = Record<string, JsonValue>;
|
|
11
11
|
/** Capability domain names Paja can advertise or disable. */
|
|
12
|
-
type PajaCapabilityDomain = 'shell' | 'gamepad' | 'relay' | 'outbox' | 'storage' | 'identity' | 'keys' | 'config' | 'resource' | 'theme' | 'notify' | 'media' | 'upload' | 'intent' | 'count' | 'link' | 'common' | 'lists' | 'serial' | 'ble' | 'webrtc' | 'dm' | 'fs' | 'cvm' | 'inc';
|
|
12
|
+
type PajaCapabilityDomain = 'shell' | 'gamepad' | 'relay' | 'outbox' | 'storage' | 'identity' | 'keys' | 'config' | 'resource' | 'theme' | 'notify' | 'media' | 'upload' | 'intent' | 'count' | 'link' | 'common' | 'lists' | 'serial' | 'ble' | 'webrtc' | 'dm' | 'fs' | 'cvm' | 'inc' | 'llm';
|
|
13
13
|
/** Raw simulation controls accepted from CLI args or JSON config. */
|
|
14
14
|
interface PajaSimulationRawOptions {
|
|
15
15
|
/** Per-domain capability overrides. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kehto/paja",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.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,12 +25,12 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kehto/acl": "^0.
|
|
28
|
+
"@kehto/acl": "^0.20.0",
|
|
29
29
|
"@kehto/firewall": "^0.6.1",
|
|
30
|
-
"@kehto/nip": "^0.
|
|
31
|
-
"@kehto/runtime": "^0.
|
|
32
|
-
"@kehto/services": "^0.
|
|
33
|
-
"@kehto/shell": "^0.
|
|
30
|
+
"@kehto/nip": "^0.8.0",
|
|
31
|
+
"@kehto/runtime": "^0.27.0",
|
|
32
|
+
"@kehto/services": "^0.27.0",
|
|
33
|
+
"@kehto/shell": "^0.26.0",
|
|
34
34
|
"@kehto/wm": "^0.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|