@kehto/paja 0.28.1 → 0.30.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 +21 -0
- package/dist/browser-host.js +294 -12
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-2M7FG76K.js → chunk-4GUFJFK7.js} +79 -7
- package/dist/chunk-4GUFJFK7.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +3 -1
- package/package.json +5 -5
- package/dist/chunk-2M7FG76K.js.map +0 -1
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -96,9 +96,63 @@ interface PajaPointerRelayPool {
|
|
|
96
96
|
}): {
|
|
97
97
|
close(reason?: string): void | Promise<void>;
|
|
98
98
|
};
|
|
99
|
+
/** Open (or reuse) the connection to one relay; rejects when it cannot connect. */
|
|
100
|
+
ensureRelay?(url: string, params?: {
|
|
101
|
+
readonly connectionTimeout?: number;
|
|
102
|
+
}): Promise<unknown>;
|
|
99
103
|
close?(relays: string[]): void;
|
|
100
104
|
destroy?(): void;
|
|
101
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Per-relay connection outcomes observed while a pointer was being resolved.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const summary: PajaRelayConnectionSummary = {
|
|
112
|
+
* total: 3, connected: [], pending: ['wss://slow.example'],
|
|
113
|
+
* failed: [{ url: 'wss://down.example', reason: 'connection failed' }],
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
interface PajaRelayConnectionSummary {
|
|
118
|
+
/** Distinct relays the resolver tried to reach. */
|
|
119
|
+
readonly total: number;
|
|
120
|
+
/** Relays whose WebSocket opened. */
|
|
121
|
+
readonly connected: readonly string[];
|
|
122
|
+
/** Relays whose connection attempt failed, with the transport reason. */
|
|
123
|
+
readonly failed: readonly {
|
|
124
|
+
readonly url: string;
|
|
125
|
+
readonly reason: string;
|
|
126
|
+
}[];
|
|
127
|
+
/** Relays still connecting when the query settled. */
|
|
128
|
+
readonly pending: readonly string[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Thrown when pointer resolution could not open a single relay connection.
|
|
132
|
+
*
|
|
133
|
+
* Zero connections means the manifest was never asked for — the browser is
|
|
134
|
+
* offline, the relays are blocked, or the browser reached its WebSocket
|
|
135
|
+
* connection limit (for example many tabs each holding relay sockets). Hosts
|
|
136
|
+
* surface this distinctly from a slow relay or a missing manifest.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* try {
|
|
141
|
+
* await resolvePajaPointer(pointer);
|
|
142
|
+
* } catch (error) {
|
|
143
|
+
* if (error instanceof PajaRelayUnreachableError) showRelayBanner(error.connections);
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare class PajaRelayUnreachableError extends Error {
|
|
148
|
+
/** What the resolver observed per relay. */
|
|
149
|
+
readonly connections: PajaRelayConnectionSummary;
|
|
150
|
+
/** Stable discriminator for hosts that cannot rely on `instanceof` across bundles. */
|
|
151
|
+
readonly code: "relay-unreachable";
|
|
152
|
+
constructor(message: string,
|
|
153
|
+
/** What the resolver observed per relay. */
|
|
154
|
+
connections: PajaRelayConnectionSummary);
|
|
155
|
+
}
|
|
102
156
|
/** Options for resolving a Paja runtime pointer. */
|
|
103
157
|
interface ResolvePajaPointerOptions {
|
|
104
158
|
/** Relay pool override; defaults to a `nostr-tools` `SimplePool`. */
|
|
@@ -848,4 +902,4 @@ type PajaTargetCorsFetch = (input: string, init: {
|
|
|
848
902
|
*/
|
|
849
903
|
declare function probeTargetCors(targetUrl: string, fetchImpl?: PajaTargetCorsFetch): Promise<PajaTargetCorsDiagnostic>;
|
|
850
904
|
|
|
851
|
-
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 PajaLlmChooserContext, 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 };
|
|
905
|
+
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 PajaLlmChooserContext, 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 PajaRelayConnectionSummary, PajaRelayUnreachableError, 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
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
PAJA_TARGET_CORS_HINT,
|
|
23
23
|
PAJA_UPSTREAM_WEB_DOMAINS,
|
|
24
24
|
PajaOptionsError,
|
|
25
|
+
PajaRelayUnreachableError,
|
|
25
26
|
PajaSimulationError,
|
|
26
27
|
ReadinessError,
|
|
27
28
|
classifyTargetCors,
|
|
@@ -58,7 +59,7 @@ import {
|
|
|
58
59
|
summarizePajaSimulation,
|
|
59
60
|
validatePajaLlmVaultPassword,
|
|
60
61
|
waitForTargetUrl
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-4GUFJFK7.js";
|
|
62
63
|
export {
|
|
63
64
|
BrowserIntentController,
|
|
64
65
|
DEFAULT_PAJA_AGGREGATE_HASH,
|
|
@@ -83,6 +84,7 @@ export {
|
|
|
83
84
|
PAJA_TARGET_CORS_HINT,
|
|
84
85
|
PAJA_UPSTREAM_WEB_DOMAINS,
|
|
85
86
|
PajaOptionsError,
|
|
87
|
+
PajaRelayUnreachableError,
|
|
86
88
|
PajaSimulationError,
|
|
87
89
|
ReadinessError,
|
|
88
90
|
classifyTargetCors,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kehto/paja",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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.20.2",
|
|
29
|
-
"@kehto/runtime": "^0.27.2",
|
|
30
28
|
"@kehto/nip": "^0.8.0",
|
|
29
|
+
"@kehto/runtime": "^0.27.2",
|
|
31
30
|
"@kehto/firewall": "^0.6.3",
|
|
32
|
-
"@kehto/services": "^0.
|
|
33
|
-
"@kehto/shell": "^0.
|
|
31
|
+
"@kehto/services": "^0.29.0",
|
|
32
|
+
"@kehto/shell": "^0.29.0",
|
|
33
|
+
"@kehto/acl": "^0.20.2",
|
|
34
34
|
"@kehto/wm": "^0.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|