@volter/teams 0.1.74 → 0.1.75
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/browser-channel.d.ts +2 -1
- package/browser-channel.mjs +8 -2
- package/package.json +1 -1
package/browser-channel.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ export declare class TurnDeliveryUnconfirmedError extends Error {
|
|
|
54
54
|
/**
|
|
55
55
|
* One line typed into the channel's session as its user's own turn; rejects when the machine refuses the stream.
|
|
56
56
|
* `turnKey`: one per typed line, reused on retry, so the machine types the line once.
|
|
57
|
-
* Receipt waits time out after thirty seconds
|
|
57
|
+
* Receipt waits time out after thirty seconds and retain at most 256 KB of UTF-8 text.
|
|
58
|
+
* Cancellation stops waiting; it
|
|
58
59
|
* does not undo delivery. After acceptance, a lost, invalid or cancelled receipt
|
|
59
60
|
* rejects with TurnDeliveryUnconfirmedError. Reuse the same key when retrying it.
|
|
60
61
|
*/
|
package/browser-channel.mjs
CHANGED
|
@@ -185,7 +185,7 @@ export async function sendBrowserTurn(channel, text, { turnKey, signal } = {}) {
|
|
|
185
185
|
signal?.throwIfAborted();
|
|
186
186
|
const stream = await channel.open('mail', { request: { op: 'turn', text, ...(turnKey ? { turn_key: String(turnKey) } : {}) } });
|
|
187
187
|
return new Promise((resolve, reject) => {
|
|
188
|
-
let answer = '', settled = false;
|
|
188
|
+
let answer = '', bytes = 0, settled = false;
|
|
189
189
|
const cleanup = () => { clearTimeout(timer); stream.off('data', data); stream.off('close', closed); signal?.removeEventListener('abort', cancelled); };
|
|
190
190
|
const fail = error => {
|
|
191
191
|
if (settled) return;
|
|
@@ -196,7 +196,13 @@ export async function sendBrowserTurn(channel, text, { turnKey, signal } = {}) {
|
|
|
196
196
|
};
|
|
197
197
|
const cancelled = () => fail(new TurnDeliveryUnconfirmedError('Turn delivery wait cancelled'));
|
|
198
198
|
const timer = setTimeout(() => fail(new TurnDeliveryUnconfirmedError('Turn delivery acknowledgement timed out')), 30_000);
|
|
199
|
-
const data = chunk => {
|
|
199
|
+
const data = chunk => {
|
|
200
|
+
if (typeof chunk !== 'string') { fail(new TurnDeliveryUnconfirmedError('Invalid turn delivery receipt frame')); return; }
|
|
201
|
+
if (chunk.length > 256_000 - bytes) { fail(new TurnDeliveryUnconfirmedError('Turn delivery receipt too large')); return; }
|
|
202
|
+
bytes += encoder.encode(chunk).byteLength;
|
|
203
|
+
if (bytes > 256_000) { fail(new TurnDeliveryUnconfirmedError('Turn delivery receipt too large')); return; }
|
|
204
|
+
answer += chunk;
|
|
205
|
+
};
|
|
200
206
|
const closed = reason => {
|
|
201
207
|
if (settled) return;
|
|
202
208
|
settled = true; cleanup();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/teams",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
|
|
6
6
|
"license": "MIT",
|