@kehto/paja 0.26.1 → 0.27.1
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 +4 -2
- package/dist/browser-host.js +480 -108
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-EYSQOKVF.js → chunk-2M7FG76K.js} +16 -10
- package/dist/chunk-2M7FG76K.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +17 -11
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-EYSQOKVF.js.map +0 -1
|
@@ -620,6 +620,8 @@ function renderPajaHtml(config) {
|
|
|
620
620
|
.event-box-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
|
|
621
621
|
.event-box-count { color: var(--accent); }
|
|
622
622
|
.event-box-note { color: var(--muted); font-style: italic; text-transform: none; letter-spacing: normal; }
|
|
623
|
+
.event-box-authors { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 4px; }
|
|
624
|
+
.event-author { min-width: 0; padding: 0 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; text-transform: none; letter-spacing: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
623
625
|
.event-relay { padding: 1px 0 2px; }
|
|
624
626
|
.event-relay-head { display: grid; grid-template-columns: minmax(0, 1fr) 56px 22px auto; align-items: center; gap: 6px; padding: 2px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
|
|
625
627
|
.event-relay-url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
|
|
@@ -2212,8 +2214,8 @@ function countCharacters(request) {
|
|
|
2212
2214
|
}
|
|
2213
2215
|
function createPajaLlmHost(options) {
|
|
2214
2216
|
const { store, vault, confirm, getIdentity } = options;
|
|
2215
|
-
const provider = options.provider ?? createHttpLlmProvider();
|
|
2216
|
-
async function ensureCredential(record) {
|
|
2217
|
+
const provider = options.provider ?? createHttpLlmProvider({ stream: true });
|
|
2218
|
+
async function ensureCredential(record, signal) {
|
|
2217
2219
|
if (record.credentialStorage === "none") return void 0;
|
|
2218
2220
|
const existing = vault.getCredential(record.id);
|
|
2219
2221
|
if (existing !== void 0) return existing;
|
|
@@ -2222,7 +2224,7 @@ function createPajaLlmHost(options) {
|
|
|
2222
2224
|
throw new LlmServiceError("unsupported", "This connection's API key was kept for one session only. Enter it again in Language models.");
|
|
2223
2225
|
}
|
|
2224
2226
|
if (!vault.isUnlocked()) {
|
|
2225
|
-
const unlocked = await options.requestUnlock();
|
|
2227
|
+
const unlocked = await options.requestUnlock(signal);
|
|
2226
2228
|
if (!unlocked) throw new LlmServiceError("user-cancelled", "The credential vault stayed locked.");
|
|
2227
2229
|
}
|
|
2228
2230
|
const credential = vault.getCredential(record.id);
|
|
@@ -2232,16 +2234,17 @@ function createPajaLlmHost(options) {
|
|
|
2232
2234
|
}
|
|
2233
2235
|
return credential;
|
|
2234
2236
|
}
|
|
2235
|
-
async function select(context, requirements) {
|
|
2237
|
+
async function select(context, requirements, prompt) {
|
|
2238
|
+
const signal = prompt?.signal;
|
|
2236
2239
|
const napplet = getIdentity(context.windowId);
|
|
2237
2240
|
const candidates = store.list().filter((record) => meets(record, requirements));
|
|
2238
2241
|
if (candidates.length === 0) {
|
|
2239
|
-
const configure = await confirm({ action: "llm-configure", windowId: context.windowId, napplet, requirements: describeRequirements(requirements), configured: store.list().length });
|
|
2242
|
+
const configure = await confirm({ action: "llm-configure", windowId: context.windowId, napplet, requirements: describeRequirements(requirements), configured: store.list().length, ...signal ? { signal } : {} });
|
|
2240
2243
|
if (!configure) return null;
|
|
2241
2244
|
options.openPanel();
|
|
2242
2245
|
throw new LlmServiceError("unsupported", "No compatible language model connection is configured yet. Add one in Paja's Language models panel, then select again.");
|
|
2243
2246
|
}
|
|
2244
|
-
const chosen = await options.chooseConnection(candidates, { windowId: context.windowId, napplet, requirements });
|
|
2247
|
+
const chosen = await options.chooseConnection(candidates, { windowId: context.windowId, napplet, requirements, ...signal ? { signal } : {} });
|
|
2245
2248
|
if (!chosen) return null;
|
|
2246
2249
|
const current = store.get(chosen.id);
|
|
2247
2250
|
return current && meets(current, requirements) ? toConnection(current) : null;
|
|
@@ -2253,11 +2256,14 @@ function createPajaLlmHost(options) {
|
|
|
2253
2256
|
const record = store.get(connectionId);
|
|
2254
2257
|
return record ? toConnection(record) : null;
|
|
2255
2258
|
},
|
|
2256
|
-
async authorize(context, connection, request) {
|
|
2259
|
+
async authorize(context, connection, request, prompt) {
|
|
2260
|
+
const signal = prompt?.signal;
|
|
2257
2261
|
const record = store.get(connection.id);
|
|
2258
2262
|
if (!record) throw new LlmServiceError("selection-expired", "The selected connection was removed; select again.");
|
|
2259
|
-
await ensureCredential(record);
|
|
2263
|
+
await ensureCredential(record, signal);
|
|
2264
|
+
if (signal?.aborted) return false;
|
|
2260
2265
|
return confirm({
|
|
2266
|
+
...signal ? { signal } : {},
|
|
2261
2267
|
action: "llm",
|
|
2262
2268
|
windowId: context.windowId,
|
|
2263
2269
|
napplet: getIdentity(context.windowId),
|
|
@@ -2281,7 +2287,7 @@ function createPajaLlmHost(options) {
|
|
|
2281
2287
|
model: record.model,
|
|
2282
2288
|
...credential === void 0 ? {} : { credential },
|
|
2283
2289
|
...record.credentialHeader ? { credentialHeader: record.credentialHeader } : {}
|
|
2284
|
-
}, request, hooks.signal);
|
|
2290
|
+
}, request, hooks.signal, (text) => hooks.onDelta(text));
|
|
2285
2291
|
},
|
|
2286
2292
|
subscribe(listener) {
|
|
2287
2293
|
const stopStore = store.subscribe(listener);
|
|
@@ -2507,4 +2513,4 @@ export {
|
|
|
2507
2513
|
validatePajaLlmVaultPassword,
|
|
2508
2514
|
createPajaLlmVault
|
|
2509
2515
|
};
|
|
2510
|
-
//# sourceMappingURL=chunk-
|
|
2516
|
+
//# sourceMappingURL=chunk-2M7FG76K.js.map
|