@haex-space/vault-sdk 4.0.0 → 4.1.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/dist/cli/index.mjs.map +1 -1
- package/dist/{client-C6pEREPM.d.ts → client-CD5QZi7F.d.ts} +29 -10
- package/dist/{client-GdCi-m2s.d.mts → client-Cx4ZyQFL.d.mts} +29 -10
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +57 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -12
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +1 -1
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/nuxt.js.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +57 -13
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +56 -12
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +55 -11
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +55 -11
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +57 -13
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +56 -12
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-Ba4G6ZpC.d.mts → types-BwFKGH70.d.mts} +1 -1
- package/dist/{types-Ba4G6ZpC.d.ts → types-BwFKGH70.d.ts} +1 -1
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +57 -13
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +56 -12
- package/dist/vue.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -278,6 +278,8 @@ var SHELL_COMMANDS = {
|
|
|
278
278
|
create: "extension_shell_create",
|
|
279
279
|
/** Write data to a shell session's stdin */
|
|
280
280
|
write: "extension_shell_write",
|
|
281
|
+
/** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
|
|
282
|
+
ack: "extension_shell_ack",
|
|
281
283
|
/** Resize a shell session's terminal */
|
|
282
284
|
resize: "extension_shell_resize",
|
|
283
285
|
/** Close a shell session */
|
|
@@ -318,9 +320,9 @@ var MAIL_COMMANDS = {
|
|
|
318
320
|
sendMessage: "extension_mail_send_message",
|
|
319
321
|
/** Build RFC822 bytes without sending (for Drafts via APPEND) */
|
|
320
322
|
buildRfc822: "extension_mail_build_rfc822",
|
|
321
|
-
/** Start (or replace) a background
|
|
323
|
+
/** Start (or replace) a background new-mail watch for an account/mailbox */
|
|
322
324
|
startWatch: "extension_mail_start_watch",
|
|
323
|
-
/** Stop a background
|
|
325
|
+
/** Stop a background new-mail watch */
|
|
324
326
|
stopWatch: "extension_mail_stop_watch"
|
|
325
327
|
};
|
|
326
328
|
|
|
@@ -1234,9 +1236,44 @@ var SpacesAPI = class {
|
|
|
1234
1236
|
};
|
|
1235
1237
|
|
|
1236
1238
|
// src/api/shell.ts
|
|
1239
|
+
var NOT_SUPPORTED = 8e3;
|
|
1240
|
+
function isUnsupported(error) {
|
|
1241
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
1242
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
1243
|
+
}
|
|
1237
1244
|
var ShellAPI = class {
|
|
1238
1245
|
constructor(sdk) {
|
|
1239
1246
|
this.sdk = sdk;
|
|
1247
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
1248
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
1249
|
+
this.flushScheduled = false;
|
|
1250
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
1251
|
+
this.ackUnsupported = false;
|
|
1252
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
1256
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
1257
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
1258
|
+
* task.
|
|
1259
|
+
*/
|
|
1260
|
+
acknowledge(event) {
|
|
1261
|
+
const sessionId = event.data?.sessionId;
|
|
1262
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
1263
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
1264
|
+
if (this.flushScheduled) return;
|
|
1265
|
+
this.flushScheduled = true;
|
|
1266
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
1267
|
+
}
|
|
1268
|
+
flushAcknowledgements() {
|
|
1269
|
+
this.flushScheduled = false;
|
|
1270
|
+
const counts = [...this.unacknowledged];
|
|
1271
|
+
this.unacknowledged.clear();
|
|
1272
|
+
for (const [sessionId, count] of counts) {
|
|
1273
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
1274
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1240
1277
|
}
|
|
1241
1278
|
/**
|
|
1242
1279
|
* List available shell environments on the host system.
|
|
@@ -1452,22 +1489,29 @@ var MailAPI = class {
|
|
|
1452
1489
|
});
|
|
1453
1490
|
}
|
|
1454
1491
|
/**
|
|
1455
|
-
* Start (or replace) a background
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
1492
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
1493
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
1494
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
1495
|
+
* `fetch`/`send`).
|
|
1496
|
+
*
|
|
1497
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
1498
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
1499
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
1500
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
1501
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
1459
1502
|
*
|
|
1460
|
-
* `
|
|
1461
|
-
*
|
|
1503
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
1504
|
+
* `accountId`; holzi requires it.
|
|
1462
1505
|
*/
|
|
1463
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
1506
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
1464
1507
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
1465
1508
|
accountId,
|
|
1466
1509
|
mailboxName,
|
|
1467
|
-
intervalSeconds
|
|
1510
|
+
intervalSeconds,
|
|
1511
|
+
imap
|
|
1468
1512
|
});
|
|
1469
1513
|
}
|
|
1470
|
-
/** Stop a background
|
|
1514
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
1471
1515
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
1472
1516
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
1473
1517
|
accountId,
|