@zeph-to/cli 2.1.0 → 2.1.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/dist/agent-rules-fetch.d.ts.map +1 -1
- package/dist/agent-rules-fetch.js +7 -2
- package/dist/crypto.d.ts +0 -4
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +27 -8
- package/dist/input-sequencer.d.ts +1 -2
- package/dist/input-sequencer.d.ts.map +1 -1
- package/dist/input-sequencer.js +2 -3
- package/dist/listener.d.ts +4 -0
- package/dist/listener.d.ts.map +1 -1
- package/dist/listener.js +45 -29
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-rules-fetch.d.ts","sourceRoot":"","sources":["../src/agent-rules-fetch.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,gBAAgB,QAAuC,CAAC;AACrE,eAAO,MAAM,yBAAyB,QAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-rules-fetch.d.ts","sourceRoot":"","sources":["../src/agent-rules-fetch.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,gBAAgB,QAAuC,CAAC;AACrE,eAAO,MAAM,yBAAyB,QAAqB,CAAC;AAkD5D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,iBAAiB,GAAG,IAWrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAU9D,CAAC;AAIF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAK5D,eAAO,MAAM,iBAAiB,QAAO,iBAAmC,CAAC;AACzE,eAAO,MAAM,uBAAuB,QAAO,cAA8B,CAAC;AAS1E,iBAAiB;AACjB,eAAO,MAAM,mBAAmB,QAAO,IAEtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,cAWxC,CAAC;AAWF,eAAO,MAAM,QAAQ,QAAO,MAK3B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,6FAA6F;IAC7F,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAU,YAAW,OAAO,KAAa,KAAG,OAAO,CAAC,aAAa,CA4C5F,CAAC"}
|
|
@@ -55,11 +55,16 @@ const isRule = (v) => {
|
|
|
55
55
|
return false;
|
|
56
56
|
if (typeof r.state !== 'string' || !VALID_STATES.has(r.state))
|
|
57
57
|
return false;
|
|
58
|
-
|
|
58
|
+
// Safe integers, not merely finite. These numbers arrive from the server
|
|
59
|
+
// and decide behavior: a fractional priority orders rules by values no
|
|
60
|
+
// author can reason about, 1e21 outranks every rule ever written including
|
|
61
|
+
// the kill-switch, and a fractional tailLines slices a capture at a
|
|
62
|
+
// fraction of a line.
|
|
63
|
+
if (!Number.isSafeInteger(r.priority))
|
|
59
64
|
return false;
|
|
60
65
|
if (r.region !== undefined && r.region !== 'tail' && r.region !== 'whole')
|
|
61
66
|
return false;
|
|
62
|
-
if (r.tailLines !== undefined && (
|
|
67
|
+
if (r.tailLines !== undefined && (!Number.isSafeInteger(r.tailLines) || r.tailLines < 1 || r.tailLines > 200))
|
|
63
68
|
return false;
|
|
64
69
|
if (r.contains !== undefined && !isStringArray(r.contains))
|
|
65
70
|
return false;
|
package/dist/crypto.d.ts
CHANGED
|
@@ -122,10 +122,6 @@ export interface EncryptedEphemeralPayload extends EncryptedPayload {
|
|
|
122
122
|
*/
|
|
123
123
|
export declare const initDeviceCrypto: () => Promise<string>;
|
|
124
124
|
export declare const getDevicePublicKey: () => string | null;
|
|
125
|
-
/**
|
|
126
|
-
* Encrypt an ephemeral payload (e.g. a stream frame) for one recipient
|
|
127
|
-
* device. Requires initDeviceCrypto() to have completed.
|
|
128
|
-
*/
|
|
129
125
|
export declare const encryptEphemeral: (plaintext: string, recipientPublicKeyRaw: string) => Promise<EncryptedEphemeralPayload>;
|
|
130
126
|
/**
|
|
131
127
|
* Open an ephemeral envelope addressed to this device — the exact inverse of
|
package/dist/crypto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA+EH,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA+EH,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AA0ED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAyB5E,CAAC;AAsCF,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC3B,S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ACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,yBAAyB,KACjC,OAAO,CAAC,MAAM,CAIhB,CAAC"}
|
package/dist/crypto.js
CHANGED
|
@@ -76,11 +76,13 @@ const importKeyPair = async (exported) => {
|
|
|
76
76
|
return { publicKey, privateKey };
|
|
77
77
|
};
|
|
78
78
|
const deriveAesKey = async (privateKey, publicKey) => crypto.subtle.deriveKey({ name: 'ECDH', public: publicKey }, privateKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
|
|
79
|
-
const encrypt = async (plaintext, senderPrivateKey, recipientPublicKey
|
|
79
|
+
const encrypt = async (plaintext, senderPrivateKey, recipientPublicKey,
|
|
80
|
+
/** Pre-derived ECDH secret for this pair, when the caller keeps one. */
|
|
81
|
+
shared) => {
|
|
80
82
|
const messageKey = await crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']);
|
|
81
83
|
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
82
84
|
const ciphertext = await crypto.subtle.encrypt({ name: 'AES-GCM', iv }, messageKey, new TextEncoder().encode(plaintext));
|
|
83
|
-
const sharedKey = await deriveAesKey(senderPrivateKey, recipientPublicKey);
|
|
85
|
+
const sharedKey = shared ?? await deriveAesKey(senderPrivateKey, recipientPublicKey);
|
|
84
86
|
const rawMessageKey = await crypto.subtle.exportKey('raw', messageKey);
|
|
85
87
|
const keyIv = crypto.getRandomValues(new Uint8Array(12));
|
|
86
88
|
const encryptedKey = await crypto.subtle.encrypt({ name: 'AES-GCM', iv: keyIv }, sharedKey, rawMessageKey);
|
|
@@ -91,8 +93,10 @@ const encrypt = async (plaintext, senderPrivateKey, recipientPublicKey) => {
|
|
|
91
93
|
keyIv: toBase64(keyIv.buffer),
|
|
92
94
|
};
|
|
93
95
|
};
|
|
94
|
-
const decrypt = async (payload, recipientPrivateKey, senderPublicKey
|
|
95
|
-
|
|
96
|
+
const decrypt = async (payload, recipientPrivateKey, senderPublicKey,
|
|
97
|
+
/** Pre-derived ECDH secret for this pair, when the caller keeps one. */
|
|
98
|
+
shared) => {
|
|
99
|
+
const sharedKey = shared ?? await deriveAesKey(recipientPrivateKey, senderPublicKey);
|
|
96
100
|
const rawMessageKey = await crypto.subtle.decrypt({ name: 'AES-GCM', iv: new Uint8Array(fromBase64(payload.keyIv)) }, sharedKey, fromBase64(payload.encryptedKey));
|
|
97
101
|
const messageKey = await crypto.subtle.importKey('raw', rawMessageKey, { name: 'AES-GCM' }, false, ['decrypt']);
|
|
98
102
|
const plaintext = await crypto.subtle.decrypt({ name: 'AES-GCM', iv: new Uint8Array(fromBase64(payload.iv)) }, messageKey, fromBase64(payload.ciphertext));
|
|
@@ -341,11 +345,26 @@ exports.getDevicePublicKey = getDevicePublicKey;
|
|
|
341
345
|
* Encrypt an ephemeral payload (e.g. a stream frame) for one recipient
|
|
342
346
|
* device. Requires initDeviceCrypto() to have completed.
|
|
343
347
|
*/
|
|
348
|
+
/**
|
|
349
|
+
* One imported peer key plus the ECDH secret derived with it. A stream talks to
|
|
350
|
+
* exactly one subscriber, and the input half binds to that same key, so both
|
|
351
|
+
* directions reuse one entry for the stream's life — deriving per frame AND per
|
|
352
|
+
* keystroke was two WebCrypto operations repeating the same answer.
|
|
353
|
+
*/
|
|
354
|
+
let peerCache = null;
|
|
355
|
+
const peerFor = async (raw, privateKey) => {
|
|
356
|
+
if (peerCache?.b64 === raw)
|
|
357
|
+
return peerCache;
|
|
358
|
+
const key = await importPublicKey(raw);
|
|
359
|
+
const shared = await deriveAesKey(privateKey, key);
|
|
360
|
+
peerCache = { b64: raw, key, shared };
|
|
361
|
+
return peerCache;
|
|
362
|
+
};
|
|
344
363
|
const encryptEphemeral = async (plaintext, recipientPublicKeyRaw) => {
|
|
345
364
|
if (!deviceKeyPair || !deviceExportedPublicKey)
|
|
346
365
|
throw new Error('Device crypto not initialized');
|
|
347
|
-
const
|
|
348
|
-
const payload = await encrypt(plaintext, deviceKeyPair.privateKey,
|
|
366
|
+
const peer = await peerFor(recipientPublicKeyRaw, deviceKeyPair.privateKey);
|
|
367
|
+
const payload = await encrypt(plaintext, deviceKeyPair.privateKey, peer.key, peer.shared);
|
|
349
368
|
return { ...payload, senderPublicKey: deviceExportedPublicKey };
|
|
350
369
|
};
|
|
351
370
|
exports.encryptEphemeral = encryptEphemeral;
|
|
@@ -367,7 +386,7 @@ exports.encryptEphemeral = encryptEphemeral;
|
|
|
367
386
|
const decryptEphemeral = async (payload) => {
|
|
368
387
|
if (!deviceKeyPair)
|
|
369
388
|
throw new Error('Device crypto not initialized');
|
|
370
|
-
const
|
|
371
|
-
return decrypt(payload, deviceKeyPair.privateKey,
|
|
389
|
+
const peer = await peerFor(payload.senderPublicKey, deviceKeyPair.privateKey);
|
|
390
|
+
return decrypt(payload, deviceKeyPair.privateKey, peer.key, peer.shared);
|
|
372
391
|
};
|
|
373
392
|
exports.decryptEphemeral = decryptEphemeral;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* - in-order seq delivers immediately (typing latency is the whole point of
|
|
11
11
|
* this path; nothing is buffered on the happy path)
|
|
12
|
-
* - a gap holds later keys for
|
|
12
|
+
* - a gap holds later keys for INPUT_HOLD_MS, then delivers what arrived anyway.
|
|
13
13
|
* Approximate order beats dropped keys: the relay is at-most-once, so a
|
|
14
14
|
* never-arriving seq must not wedge everything behind it forever.
|
|
15
15
|
* - a new epoch (sender restart) resets the high-water mark, and the old
|
|
@@ -48,7 +48,6 @@ export type SequencedInput = {
|
|
|
48
48
|
epoch: number;
|
|
49
49
|
};
|
|
50
50
|
export type InputSequencerOptions<T> = {
|
|
51
|
-
holdMs?: number;
|
|
52
51
|
schedule?: ScheduleFlush;
|
|
53
52
|
/** Called for each HELD message dropped without delivery — an epoch change
|
|
54
53
|
* or reset() sweeping the buffer. Accept-time drops are reported via the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-sequencer.d.ts","sourceRoot":"","sources":["../src/input-sequencer.ts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AK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI;IACnC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;8EAE0E;IAC1E,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI;IACnD,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,YAAY,CAAC;IACjC;2BACuB;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AASF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,cAAc,EACzD,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EACzB,OAAM,qBAAqB,CAAC,CAAC,CAAM,KACpC,cAAc,CAAC,CAAC,CAkFlB,CAAC"}
|
package/dist/input-sequencer.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* - in-order seq delivers immediately (typing latency is the whole point of
|
|
12
12
|
* this path; nothing is buffered on the happy path)
|
|
13
|
-
* - a gap holds later keys for
|
|
13
|
+
* - a gap holds later keys for INPUT_HOLD_MS, then delivers what arrived anyway.
|
|
14
14
|
* Approximate order beats dropped keys: the relay is at-most-once, so a
|
|
15
15
|
* never-arriving seq must not wedge everything behind it forever.
|
|
16
16
|
* - a new epoch (sender restart) resets the high-water mark, and the old
|
|
@@ -41,7 +41,6 @@ const defaultSchedule = (fn, ms) => {
|
|
|
41
41
|
return () => clearTimeout(timer);
|
|
42
42
|
};
|
|
43
43
|
const createInputSequencer = (deliver, opts = {}) => {
|
|
44
|
-
const holdMs = opts.holdMs ?? exports.INPUT_HOLD_MS;
|
|
45
44
|
const schedule = opts.schedule ?? defaultSchedule;
|
|
46
45
|
let epoch = null;
|
|
47
46
|
let highWater = 0;
|
|
@@ -112,7 +111,7 @@ const createInputSequencer = (deliver, opts = {}) => {
|
|
|
112
111
|
// One deadline per gap: it dates from when the hole opened, so a
|
|
113
112
|
// steady stream of later keys can't extend the wait indefinitely.
|
|
114
113
|
if (!cancelFlush)
|
|
115
|
-
cancelFlush = schedule(flush,
|
|
114
|
+
cancelFlush = schedule(flush, exports.INPUT_HOLD_MS);
|
|
116
115
|
return 'ok';
|
|
117
116
|
};
|
|
118
117
|
return {
|
package/dist/listener.d.ts
CHANGED
|
@@ -204,6 +204,10 @@ export interface FrameBudget {
|
|
|
204
204
|
* passed. False means this tick must skip WITHOUT marking the frame as sent —
|
|
205
205
|
* the diff-gate would otherwise swallow that content for good.
|
|
206
206
|
*/
|
|
207
|
+
/** Is there budget left this second? A peek, so a tick can decline to pay for a
|
|
208
|
+
* blocking capture it could not send anyway — spending the token here instead
|
|
209
|
+
* would burn budget on ticks the diff-gate goes on to skip. */
|
|
210
|
+
export declare const hasFrameBudget: (budget: FrameBudget, now: number) => boolean;
|
|
207
211
|
export declare const claimFrameSend: (budget: FrameBudget, now: number) => boolean;
|
|
208
212
|
export declare const STREAM_LEASE_MS = 15000;
|
|
209
213
|
export declare const MAX_CONCURRENT_STREAMS = 3;
|
package/dist/listener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAoBH,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAiD,KAAK,UAAU,EAA4C,MAAM,kBAAkB,CAAC;AAE5I,OAAO,EAA4E,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACvI,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmCtG,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE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AM,KAAG,MAIhD,CAAC;AA4DF,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MA2BvD,CAAC;AAsPF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACrB,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACtC,QAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,MAAM,KAChB,MAAM,GAAG,IAIX,CAAC;AA0DF,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CAsI3F,CAAC"}
|
package/dist/listener.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.handleListener = exports.resolveWsUrl = exports.computeListenerDeviceId = exports.computeBackoff = exports.handlePush = exports.gcAttachments = exports.setAttachmentContext = exports.writeRemoteMarker = exports.collectSessions = exports.collectSessionsVerbose = exports.handleCommandInput = exports.pendingInputDecrypts = exports.MAX_PENDING_DECRYPTS = exports.MAX_INPUT_LANES = exports.validateInputMessage = exports.MAX_INPUT_BODY_CHARS = exports.MAX_INPUT_KEYS = exports.handleStreamControl = exports.buildStreamFrame = exports.isStreamCapReached = exports.stopAllStreams = exports.stopStream = exports.MAX_CONCURRENT_STREAMS = exports.STREAM_LEASE_MS = exports.claimFrameSend = exports.streamCadence = exports.MAX_FRAMES_PER_SEC = exports.BURST_WINDOW_MS = exports.BURST_INTERVAL_MS = exports.STREAM_INTERVAL_MS = exports.scheduleInjectSnapshots = exports.handleScreenRequest = exports.collectWatchHits = exports.resetPatternWatches = exports.setPatternWatches = exports.deriveSessionState = exports.resetSessionStates = exports.detectRemoteAgent = exports.parseSessionName = exports.invalidateTmuxSocketCache = exports.resolveKeys = exports.paneCurrentCommand = exports.checkRateLimit = exports.AUTH_FAILURE_CODES = exports.sessionsReportDue = exports.sessionsFingerprint = exports.SESSION_REPORT_HEARTBEAT_MS = void 0;
|
|
28
|
+
exports.handleListener = exports.resolveWsUrl = exports.computeListenerDeviceId = exports.computeBackoff = exports.handlePush = exports.gcAttachments = exports.setAttachmentContext = exports.writeRemoteMarker = exports.collectSessions = exports.collectSessionsVerbose = exports.handleCommandInput = exports.pendingInputDecrypts = exports.MAX_PENDING_DECRYPTS = exports.MAX_INPUT_LANES = exports.validateInputMessage = exports.MAX_INPUT_BODY_CHARS = exports.MAX_INPUT_KEYS = exports.handleStreamControl = exports.buildStreamFrame = exports.isStreamCapReached = exports.stopAllStreams = exports.stopStream = exports.MAX_CONCURRENT_STREAMS = exports.STREAM_LEASE_MS = exports.claimFrameSend = exports.hasFrameBudget = exports.streamCadence = exports.MAX_FRAMES_PER_SEC = exports.BURST_WINDOW_MS = exports.BURST_INTERVAL_MS = exports.STREAM_INTERVAL_MS = exports.scheduleInjectSnapshots = exports.handleScreenRequest = exports.collectWatchHits = exports.resetPatternWatches = exports.setPatternWatches = exports.deriveSessionState = exports.resetSessionStates = exports.detectRemoteAgent = exports.parseSessionName = exports.invalidateTmuxSocketCache = exports.resolveKeys = exports.paneCurrentCommand = exports.checkRateLimit = exports.AUTH_FAILURE_CODES = exports.sessionsReportDue = exports.sessionsFingerprint = exports.SESSION_REPORT_HEARTBEAT_MS = void 0;
|
|
29
29
|
const child_process_1 = require("child_process");
|
|
30
30
|
const crypto_1 = require("crypto");
|
|
31
31
|
const fs_1 = require("fs");
|
|
@@ -744,6 +744,13 @@ const pendingInjectSnapshots = new Map();
|
|
|
744
744
|
* captures so a burst of arrow presses yields frames after the LAST press.
|
|
745
745
|
*/
|
|
746
746
|
const scheduleInjectSnapshots = (sessionName, send, delays = INJECT_SNAPSHOT_DELAYS_MS) => {
|
|
747
|
+
// These snapshots exist to show the phone what a keystroke did when nobody
|
|
748
|
+
// is mirroring the pane. A live stream already repaints it at the burst
|
|
749
|
+
// cadence, so scheduling them there is two extra blocking captures and two
|
|
750
|
+
// extra sends per keystroke — outside the stream's own send budget, which
|
|
751
|
+
// is exactly the cost the budget exists to bound.
|
|
752
|
+
if (activeStreams.has(sessionName))
|
|
753
|
+
return;
|
|
747
754
|
for (const t of pendingInjectSnapshots.get(sessionName) ?? [])
|
|
748
755
|
clearTimeout(t);
|
|
749
756
|
let lastContent = null;
|
|
@@ -797,6 +804,13 @@ exports.streamCadence = streamCadence;
|
|
|
797
804
|
* passed. False means this tick must skip WITHOUT marking the frame as sent —
|
|
798
805
|
* the diff-gate would otherwise swallow that content for good.
|
|
799
806
|
*/
|
|
807
|
+
/** Is there budget left this second? A peek, so a tick can decline to pay for a
|
|
808
|
+
* blocking capture it could not send anyway — spending the token here instead
|
|
809
|
+
* would burn budget on ticks the diff-gate goes on to skip. */
|
|
810
|
+
const hasFrameBudget = (budget, now) => now - budget.windowStartedAt >= 1_000 || now < budget.windowStartedAt
|
|
811
|
+
? true
|
|
812
|
+
: budget.sent < exports.MAX_FRAMES_PER_SEC;
|
|
813
|
+
exports.hasFrameBudget = hasFrameBudget;
|
|
800
814
|
const claimFrameSend = (budget, now) => {
|
|
801
815
|
// `now < windowStartedAt` = the clock ran backwards (NTP step, resume).
|
|
802
816
|
// Without the guard the window never rolls again and a spent budget
|
|
@@ -1104,6 +1118,15 @@ const handleStreamControl = (req, send) => {
|
|
|
1104
1118
|
(0, exports.stopStream)(sessionName);
|
|
1105
1119
|
return false;
|
|
1106
1120
|
}
|
|
1121
|
+
// capturePane is a blocking tmux spawn. Asking the budget first means a
|
|
1122
|
+
// second that is already full costs nothing rather than paying for a
|
|
1123
|
+
// capture whose frame could not go out — a peek, not a claim, so a tick
|
|
1124
|
+
// the diff-gate goes on to skip does not spend the token.
|
|
1125
|
+
if (!(0, exports.hasFrameBudget)(budget, Date.now())) {
|
|
1126
|
+
stats.skipped++;
|
|
1127
|
+
stats.rateCapped++;
|
|
1128
|
+
return true;
|
|
1129
|
+
}
|
|
1107
1130
|
const captured = capturePane(sessionName, true, STREAM_CAPTURE_LINES);
|
|
1108
1131
|
if (!captured || captured.content === lastContent) {
|
|
1109
1132
|
stats.skipped++;
|
|
@@ -1356,18 +1379,14 @@ const enqueueInput = (input, send) => {
|
|
|
1356
1379
|
// would let the higher epoch supersede the other and silence it.
|
|
1357
1380
|
const senderKey = input.deviceId ? `${input.sessionName}#${input.deviceId}` : input.sessionName;
|
|
1358
1381
|
const sequencer = inputSequencerFor(senderKey);
|
|
1359
|
-
if (!sequencer)
|
|
1360
|
-
|
|
1361
|
-
send(streamErrorFrame(input.sessionName, 'input_rejected', input));
|
|
1362
|
-
return;
|
|
1363
|
-
}
|
|
1382
|
+
if (!sequencer)
|
|
1383
|
+
return refuseInput(input, send, 'sender lane cap reached');
|
|
1364
1384
|
const accepted = sequencer.accept({ ...input, send });
|
|
1365
1385
|
if (accepted !== 'ok') {
|
|
1366
1386
|
// overflow / superseded / stale — the message was dropped, and the
|
|
1367
1387
|
// sender must hear so instead of waiting on a keystroke that never
|
|
1368
1388
|
// lands (the sequencer reports swept HELD messages via onDiscard).
|
|
1369
|
-
|
|
1370
|
-
send(streamErrorFrame(input.sessionName, 'input_rejected', input));
|
|
1389
|
+
refuseInput(input, send, accepted);
|
|
1371
1390
|
}
|
|
1372
1391
|
};
|
|
1373
1392
|
/**
|
|
@@ -1399,17 +1418,21 @@ exports.pendingInputDecrypts = pendingInputDecrypts;
|
|
|
1399
1418
|
* plaintext path runs — the envelope hides the payload from the relay, never
|
|
1400
1419
|
* from the whitelist or the caps.
|
|
1401
1420
|
*/
|
|
1421
|
+
/**
|
|
1422
|
+
* Refuse one input message: log why here, tell the sender only THAT it was
|
|
1423
|
+
* refused. The reason is derived from plaintext the relay must not learn, so it
|
|
1424
|
+
* never rides the frame; a message with no sessionName gets no frame at all,
|
|
1425
|
+
* since the sender would have nothing to match it against.
|
|
1426
|
+
*/
|
|
1427
|
+
const refuseInput = (msg, send, reason) => {
|
|
1428
|
+
log(`! input ${msg.sessionName ?? '(no session)'}: ${reason} — drop`);
|
|
1429
|
+
if (typeof msg.sessionName === 'string' && msg.sessionName) {
|
|
1430
|
+
send(streamErrorFrame(msg.sessionName, 'input_rejected', msg));
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1402
1433
|
const handleEncryptedInput = (msg, send) => {
|
|
1403
1434
|
const { sessionName } = msg;
|
|
1404
|
-
const refuse = (reason) =>
|
|
1405
|
-
log(`! input ${sessionName ?? '(no session)'}: ${reason} — drop`);
|
|
1406
|
-
// No sessionName means the sender can't match the error to anything.
|
|
1407
|
-
// The reason never rides along: it is derived from plaintext the relay
|
|
1408
|
-
// must not learn, so it stays in this host's log.
|
|
1409
|
-
if (typeof sessionName === 'string' && sessionName) {
|
|
1410
|
-
send(streamErrorFrame(sessionName, 'input_rejected', msg));
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1435
|
+
const refuse = (reason) => refuseInput(msg, send, reason);
|
|
1413
1436
|
if (typeof sessionName !== 'string' || !sessionName)
|
|
1414
1437
|
return refuse('no sessionName');
|
|
1415
1438
|
const stream = activeStreams.get(sessionName);
|
|
@@ -1467,11 +1490,10 @@ const handleEncryptedInput = (msg, send) => {
|
|
|
1467
1490
|
// A real envelope clears the strikes: the cap is there to stop a flood,
|
|
1468
1491
|
// not to retire a stream that saw one corrupted message.
|
|
1469
1492
|
const live = activeStreams.get(sessionName);
|
|
1470
|
-
if (live?.stats
|
|
1471
|
-
live.inputDecryptFailures = 0;
|
|
1472
|
-
if (activeStreams.get(sessionName)?.stats !== incarnation) {
|
|
1493
|
+
if (live?.stats !== incarnation) {
|
|
1473
1494
|
return refuse('stream replaced while decrypting');
|
|
1474
1495
|
}
|
|
1496
|
+
live.inputDecryptFailures = 0;
|
|
1475
1497
|
const payload = parseSealedInput(opened);
|
|
1476
1498
|
if (!payload)
|
|
1477
1499
|
return refuse('sealed payload is not an input object');
|
|
@@ -1522,11 +1544,7 @@ const handleCommandInput = (msg, send) => {
|
|
|
1522
1544
|
}
|
|
1523
1545
|
const checked = (0, exports.validateInputMessage)(msg);
|
|
1524
1546
|
if (!checked.ok) {
|
|
1525
|
-
|
|
1526
|
-
// No sessionName means the sender can't match the error to anything.
|
|
1527
|
-
if (typeof msg.sessionName === 'string' && msg.sessionName) {
|
|
1528
|
-
send(streamErrorFrame(msg.sessionName, 'input_rejected', msg));
|
|
1529
|
-
}
|
|
1547
|
+
refuseInput(msg, send, checked.reason);
|
|
1530
1548
|
return true;
|
|
1531
1549
|
}
|
|
1532
1550
|
const { input } = checked;
|
|
@@ -1535,8 +1553,7 @@ const handleCommandInput = (msg, send) => {
|
|
|
1535
1553
|
// against. The sender learns in one hop and falls back to a REST push.
|
|
1536
1554
|
const stream = activeStreams.get(input.sessionName);
|
|
1537
1555
|
if (!stream) {
|
|
1538
|
-
|
|
1539
|
-
send(streamErrorFrame(input.sessionName, 'input_rejected', input));
|
|
1556
|
+
refuseInput(input, send, 'no live stream');
|
|
1540
1557
|
return true;
|
|
1541
1558
|
}
|
|
1542
1559
|
// This stream's outbound half is E2EE for that subscriber, so accepting a
|
|
@@ -1544,8 +1561,7 @@ const handleCommandInput = (msg, send) => {
|
|
|
1544
1561
|
// and nothing about it proves the subscriber sent it. An encrypted stream
|
|
1545
1562
|
// takes sealed input (above) or none.
|
|
1546
1563
|
if (stream.subscriberPublicKey) {
|
|
1547
|
-
|
|
1548
|
-
send(streamErrorFrame(input.sessionName, 'input_rejected', input));
|
|
1564
|
+
refuseInput(input, send, 'stream is E2EE, plaintext input refused');
|
|
1549
1565
|
return true;
|
|
1550
1566
|
}
|
|
1551
1567
|
enqueueInput(input, send);
|