@stim-cli/core 1.20.1 → 1.21.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/{core-CzCQ9yWY.mjs → core-DisO3hs1.mjs} +257 -60
- package/dist/{index-DNBFsz-Q.d.mts → index-_wkluvP_.d.mts} +341 -90
- package/dist/index.d.mts +70 -5
- package/dist/index.mjs +3 -3
- package/dist/keyed-delta-BBoOeR2J.mjs +289 -0
- package/dist/noise-DYIbymAJ.d.mts +100 -0
- package/dist/noise-session.d.mts +164 -0
- package/dist/noise-session.mjs +402 -0
- package/dist/noise.d.mts +2 -0
- package/dist/noise.mjs +393 -0
- package/dist/{ownership-claim-Xxxr9MPp.d.mts → ownership-claim-Bf8Lq6AY.d.mts} +2 -1
- package/dist/{ownership-claim-O31Y5iIb.mjs → ownership-claim-DHUs_Dir.mjs} +1 -1
- package/dist/ownership-claim.d.mts +2 -2
- package/dist/ownership-claim.mjs +2 -2
- package/dist/phone-protocol.d.mts +85 -16
- package/dist/phone-protocol.mjs +2 -1
- package/dist/{protocol-Bp-bcZIR.d.mts → protocol-D8R_3dkO.d.mts} +307 -65
- package/dist/protocol.d.mts +2 -2
- package/dist/protocol.mjs +50 -10
- package/dist/receive-protocol.d.mts +1 -1
- package/dist/receive-protocol.mjs +18062 -12744
- package/dist/state.d.mts +2 -2
- package/dist/state.mjs +1140 -334
- package/dist/toolchain.d.mts +64 -0
- package/dist/toolchain.mjs +326 -0
- package/dist/workspace-link.d.mts +16 -0
- package/dist/workspace-link.mjs +50 -0
- package/package.json +21 -1
package/dist/noise.mjs
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { createCipheriv, createDecipheriv, createHash, createHmac, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync } from "node:crypto";
|
|
2
|
+
//#region noise.ts
|
|
3
|
+
const NOISE_XX = "Noise_XX_25519_ChaChaPoly_SHA256";
|
|
4
|
+
const NOISE_XX_PSK2 = "Noise_XXpsk2_25519_ChaChaPoly_SHA256";
|
|
5
|
+
/** Largest handshake message either side writes or reads, payload included. */
|
|
6
|
+
const MAX_HANDSHAKE_MESSAGE_BYTES = 1024;
|
|
7
|
+
const KEY_BYTES = 32;
|
|
8
|
+
const HASH_BYTES = 32;
|
|
9
|
+
const TAG_BYTES = 16;
|
|
10
|
+
const MAX_NONCE = 2n ** 64n - 1n;
|
|
11
|
+
const EMPTY = Buffer.alloc(0);
|
|
12
|
+
const TEXT = 1;
|
|
13
|
+
const BINARY = 2;
|
|
14
|
+
const PKCS8_X25519 = Buffer.from("302e020100300506032b656e04220420", "hex");
|
|
15
|
+
const SPKI_X25519 = Buffer.from("302a300506032b656e032100", "hex");
|
|
16
|
+
/** Thrown for any handshake or transport failure; the handshake or transport is unusable afterwards. */
|
|
17
|
+
var NoiseError = class extends Error {
|
|
18
|
+
name = "NoiseError";
|
|
19
|
+
};
|
|
20
|
+
function generateNoiseKeyPair() {
|
|
21
|
+
const { privateKey } = generateKeyPairSync("x25519");
|
|
22
|
+
return noiseKeyPairFromPrivateKey(privateKey.export({
|
|
23
|
+
format: "der",
|
|
24
|
+
type: "pkcs8"
|
|
25
|
+
}).subarray(-32));
|
|
26
|
+
}
|
|
27
|
+
function noiseKeyPairFromPrivateKey(privateKey) {
|
|
28
|
+
if (privateKey.length !== KEY_BYTES) throw new RangeError("An X25519 private key is 32 bytes");
|
|
29
|
+
const key = createPrivateKey({
|
|
30
|
+
key: Buffer.concat([PKCS8_X25519, privateKey]),
|
|
31
|
+
format: "der",
|
|
32
|
+
type: "pkcs8"
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
publicKey: createPublicKey(key).export({
|
|
36
|
+
format: "der",
|
|
37
|
+
type: "spki"
|
|
38
|
+
}).subarray(-32),
|
|
39
|
+
privateKey: Buffer.from(privateKey)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const nodeDh = (privateKey, publicKey) => diffieHellman({
|
|
43
|
+
privateKey: createPrivateKey({
|
|
44
|
+
key: Buffer.concat([PKCS8_X25519, privateKey]),
|
|
45
|
+
format: "der",
|
|
46
|
+
type: "pkcs8"
|
|
47
|
+
}),
|
|
48
|
+
publicKey: createPublicKey({
|
|
49
|
+
key: Buffer.concat([SPKI_X25519, publicKey]),
|
|
50
|
+
format: "der",
|
|
51
|
+
type: "spki"
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
function nonceBytes(n) {
|
|
55
|
+
const nonce = Buffer.alloc(12);
|
|
56
|
+
nonce.writeBigUInt64LE(n, 4);
|
|
57
|
+
return nonce;
|
|
58
|
+
}
|
|
59
|
+
function aeadEncrypt(k, n, ad, plaintext) {
|
|
60
|
+
const cipher = createCipheriv("chacha20-poly1305", k, nonceBytes(n), { authTagLength: TAG_BYTES });
|
|
61
|
+
cipher.setAAD(ad, { plaintextLength: plaintext.length });
|
|
62
|
+
return Buffer.concat([
|
|
63
|
+
cipher.update(plaintext),
|
|
64
|
+
cipher.final(),
|
|
65
|
+
cipher.getAuthTag()
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
function aeadDecrypt(k, n, ad, ciphertext) {
|
|
69
|
+
if (ciphertext.length < TAG_BYTES) throw new NoiseError("Message is shorter than its authentication tag");
|
|
70
|
+
const body = ciphertext.subarray(0, ciphertext.length - TAG_BYTES);
|
|
71
|
+
const decipher = createDecipheriv("chacha20-poly1305", k, nonceBytes(n), { authTagLength: TAG_BYTES });
|
|
72
|
+
decipher.setAAD(ad, { plaintextLength: body.length });
|
|
73
|
+
decipher.setAuthTag(ciphertext.subarray(ciphertext.length - TAG_BYTES));
|
|
74
|
+
try {
|
|
75
|
+
return Buffer.concat([decipher.update(body), decipher.final()]);
|
|
76
|
+
} catch {
|
|
77
|
+
throw new NoiseError("Message failed authentication");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function sha256(...parts) {
|
|
81
|
+
const hash = createHash("sha256");
|
|
82
|
+
for (const part of parts) hash.update(part);
|
|
83
|
+
return hash.digest();
|
|
84
|
+
}
|
|
85
|
+
function hmac(key, ...parts) {
|
|
86
|
+
const mac = createHmac("sha256", key);
|
|
87
|
+
for (const part of parts) mac.update(part);
|
|
88
|
+
return mac.digest();
|
|
89
|
+
}
|
|
90
|
+
function hkdf(chainingKey, input) {
|
|
91
|
+
const temp = hmac(chainingKey, input);
|
|
92
|
+
const first = hmac(temp, Uint8Array.of(1));
|
|
93
|
+
const second = hmac(temp, first, Uint8Array.of(2));
|
|
94
|
+
return [
|
|
95
|
+
first,
|
|
96
|
+
second,
|
|
97
|
+
hmac(temp, second, Uint8Array.of(3))
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
/** Noise's CipherState: a key and a 64-bit counter used as the nonce. */
|
|
101
|
+
var CipherState = class {
|
|
102
|
+
#k;
|
|
103
|
+
#n = 0n;
|
|
104
|
+
constructor(key) {
|
|
105
|
+
if (key && key.length !== KEY_BYTES) throw new RangeError("A cipher key is 32 bytes");
|
|
106
|
+
this.#k = key && Buffer.from(key);
|
|
107
|
+
}
|
|
108
|
+
hasKey() {
|
|
109
|
+
return this.#k !== void 0;
|
|
110
|
+
}
|
|
111
|
+
setNonce(n) {
|
|
112
|
+
this.#n = n;
|
|
113
|
+
}
|
|
114
|
+
encryptWithAd(ad, plaintext) {
|
|
115
|
+
if (!this.#k) return Buffer.from(plaintext);
|
|
116
|
+
if (this.#n >= MAX_NONCE) throw new NoiseError("Nonce exhausted");
|
|
117
|
+
const ciphertext = aeadEncrypt(this.#k, this.#n, ad, plaintext);
|
|
118
|
+
this.#n++;
|
|
119
|
+
return ciphertext;
|
|
120
|
+
}
|
|
121
|
+
decryptWithAd(ad, ciphertext) {
|
|
122
|
+
if (!this.#k) return Buffer.from(ciphertext);
|
|
123
|
+
if (this.#n >= MAX_NONCE) throw new NoiseError("Nonce exhausted");
|
|
124
|
+
const plaintext = aeadDecrypt(this.#k, this.#n, ad, ciphertext);
|
|
125
|
+
this.#n++;
|
|
126
|
+
return plaintext;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var SymmetricState = class {
|
|
130
|
+
#ck;
|
|
131
|
+
#h;
|
|
132
|
+
cipher = new CipherState();
|
|
133
|
+
constructor(protocol) {
|
|
134
|
+
const name = Buffer.from(protocol, "ascii");
|
|
135
|
+
this.#h = name.length <= HASH_BYTES ? Buffer.concat([name, Buffer.alloc(HASH_BYTES - name.length)]) : sha256(name);
|
|
136
|
+
this.#ck = this.#h;
|
|
137
|
+
}
|
|
138
|
+
get handshakeHash() {
|
|
139
|
+
return Buffer.from(this.#h);
|
|
140
|
+
}
|
|
141
|
+
mixKey(input) {
|
|
142
|
+
const [ck, k] = hkdf(this.#ck, input);
|
|
143
|
+
this.#ck = ck;
|
|
144
|
+
this.cipher = new CipherState(k);
|
|
145
|
+
}
|
|
146
|
+
mixHash(data) {
|
|
147
|
+
this.#h = sha256(this.#h, data);
|
|
148
|
+
}
|
|
149
|
+
mixKeyAndHash(input) {
|
|
150
|
+
const [ck, h, k] = hkdf(this.#ck, input);
|
|
151
|
+
this.#ck = ck;
|
|
152
|
+
this.mixHash(h);
|
|
153
|
+
this.cipher = new CipherState(k);
|
|
154
|
+
}
|
|
155
|
+
encryptAndHash(plaintext) {
|
|
156
|
+
const ciphertext = this.cipher.encryptWithAd(this.#h, plaintext);
|
|
157
|
+
this.mixHash(ciphertext);
|
|
158
|
+
return ciphertext;
|
|
159
|
+
}
|
|
160
|
+
decryptAndHash(ciphertext) {
|
|
161
|
+
const plaintext = this.cipher.decryptWithAd(this.#h, ciphertext);
|
|
162
|
+
this.mixHash(ciphertext);
|
|
163
|
+
return plaintext;
|
|
164
|
+
}
|
|
165
|
+
split() {
|
|
166
|
+
const [first, second] = hkdf(this.#ck, EMPTY);
|
|
167
|
+
return [new CipherState(first), new CipherState(second)];
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const PATTERNS = {
|
|
171
|
+
[NOISE_XX]: [
|
|
172
|
+
["e"],
|
|
173
|
+
[
|
|
174
|
+
"e",
|
|
175
|
+
"ee",
|
|
176
|
+
"s",
|
|
177
|
+
"es"
|
|
178
|
+
],
|
|
179
|
+
["s", "se"]
|
|
180
|
+
],
|
|
181
|
+
[NOISE_XX_PSK2]: [
|
|
182
|
+
["e"],
|
|
183
|
+
[
|
|
184
|
+
"e",
|
|
185
|
+
"ee",
|
|
186
|
+
"s",
|
|
187
|
+
"es",
|
|
188
|
+
"psk"
|
|
189
|
+
],
|
|
190
|
+
["s", "se"]
|
|
191
|
+
]
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Noise's HandshakeState for {@link NOISE_XX} and {@link NOISE_XX_PSK2}. The initiator writes messages 1 and 3. Any
|
|
195
|
+
* error from {@link writeMessage} or {@link readMessage}, including an out-of-turn call, a call after the last
|
|
196
|
+
* message, or an invalid or oversized message, ends the handshake: every later call throws {@link NoiseError}.
|
|
197
|
+
*/
|
|
198
|
+
var HandshakeState = class {
|
|
199
|
+
#symmetric;
|
|
200
|
+
#messages;
|
|
201
|
+
#initiator;
|
|
202
|
+
#s;
|
|
203
|
+
#psk;
|
|
204
|
+
#dh;
|
|
205
|
+
#e;
|
|
206
|
+
#re;
|
|
207
|
+
#rs;
|
|
208
|
+
#index = 0;
|
|
209
|
+
#failed = false;
|
|
210
|
+
#split = false;
|
|
211
|
+
constructor(options) {
|
|
212
|
+
if (options.protocol === "Noise_XXpsk2_25519_ChaChaPoly_SHA256" !== (options.psk !== void 0)) throw new TypeError(`${options.protocol} psk mismatch`);
|
|
213
|
+
if (options.psk && options.psk.length !== KEY_BYTES) throw new RangeError("A PSK is 32 bytes");
|
|
214
|
+
this.#symmetric = new SymmetricState(options.protocol);
|
|
215
|
+
this.#symmetric.mixHash(options.prologue);
|
|
216
|
+
this.#messages = PATTERNS[options.protocol];
|
|
217
|
+
this.#initiator = options.initiator;
|
|
218
|
+
this.#s = options.staticKeyPair;
|
|
219
|
+
this.#psk = options.psk && Buffer.from(options.psk);
|
|
220
|
+
this.#e = options.ephemeralKeyPair;
|
|
221
|
+
this.#dh = options.dh ?? nodeDh;
|
|
222
|
+
}
|
|
223
|
+
get isComplete() {
|
|
224
|
+
return this.#index === this.#messages.length;
|
|
225
|
+
}
|
|
226
|
+
/** The peer's static public key, once the message that carries it has been read and authenticated. */
|
|
227
|
+
get remoteStaticPublicKey() {
|
|
228
|
+
return this.#failed || !this.#rs ? void 0 : Buffer.from(this.#rs);
|
|
229
|
+
}
|
|
230
|
+
get handshakeHash() {
|
|
231
|
+
if (!this.isComplete) throw new NoiseError("The handshake is not complete");
|
|
232
|
+
return this.#symmetric.handshakeHash;
|
|
233
|
+
}
|
|
234
|
+
writeMessage(payload = EMPTY) {
|
|
235
|
+
return this.#step(true, (tokens) => {
|
|
236
|
+
const parts = [];
|
|
237
|
+
for (const token of tokens) if (token === "e") {
|
|
238
|
+
this.#e ??= generateNoiseKeyPair();
|
|
239
|
+
parts.push(this.#e.publicKey);
|
|
240
|
+
this.#mixEphemeral(this.#e.publicKey);
|
|
241
|
+
} else if (token === "s") parts.push(this.#symmetric.encryptAndHash(this.#s.publicKey));
|
|
242
|
+
else this.#mixToken(token);
|
|
243
|
+
parts.push(this.#symmetric.encryptAndHash(payload));
|
|
244
|
+
const message = Buffer.concat(parts);
|
|
245
|
+
if (message.length > 1024) throw new NoiseError("Handshake message is too large");
|
|
246
|
+
return message;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
readMessage(message) {
|
|
250
|
+
return this.#step(false, (tokens) => {
|
|
251
|
+
if (message.length > 1024) throw new NoiseError("Handshake message is too large");
|
|
252
|
+
let offset = 0;
|
|
253
|
+
const take = (length) => {
|
|
254
|
+
if (message.length - offset < length) throw new NoiseError("Handshake message is truncated");
|
|
255
|
+
const part = Buffer.from(message.subarray(offset, offset + length));
|
|
256
|
+
offset += length;
|
|
257
|
+
return part;
|
|
258
|
+
};
|
|
259
|
+
for (const token of tokens) if (token === "e") {
|
|
260
|
+
this.#re = take(KEY_BYTES);
|
|
261
|
+
this.#mixEphemeral(this.#re);
|
|
262
|
+
} else if (token === "s") {
|
|
263
|
+
const length = KEY_BYTES + (this.#symmetric.cipher.hasKey() ? TAG_BYTES : 0);
|
|
264
|
+
this.#rs = this.#symmetric.decryptAndHash(take(length));
|
|
265
|
+
} else this.#mixToken(token);
|
|
266
|
+
return this.#symmetric.decryptAndHash(message.subarray(offset));
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
/** Noise's Split(), returning this side's sending and receiving cipher states. It can be called once. */
|
|
270
|
+
split() {
|
|
271
|
+
if (this.#failed || !this.isComplete) throw new NoiseError("The handshake is not complete");
|
|
272
|
+
if (this.#split) throw new NoiseError("The handshake has already been split");
|
|
273
|
+
this.#split = true;
|
|
274
|
+
const [initiatorToResponder, responderToInitiator] = this.#symmetric.split();
|
|
275
|
+
return this.#initiator ? {
|
|
276
|
+
send: initiatorToResponder,
|
|
277
|
+
receive: responderToInitiator
|
|
278
|
+
} : {
|
|
279
|
+
send: responderToInitiator,
|
|
280
|
+
receive: initiatorToResponder
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
#step(writing, run) {
|
|
284
|
+
if (this.#failed) throw new NoiseError("The handshake has failed");
|
|
285
|
+
try {
|
|
286
|
+
const tokens = this.#messages[this.#index];
|
|
287
|
+
if (!tokens) throw new NoiseError("The handshake is complete");
|
|
288
|
+
if (writing !== (this.#initiator === (this.#index % 2 === 0))) throw new NoiseError(`It is not this side's turn to ${writing ? "write" : "read"}`);
|
|
289
|
+
const result = run(tokens);
|
|
290
|
+
this.#index++;
|
|
291
|
+
return result;
|
|
292
|
+
} catch (error) {
|
|
293
|
+
this.#failed = true;
|
|
294
|
+
throw error instanceof NoiseError ? error : new NoiseError("Handshake failed", { cause: error });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
#mixEphemeral(publicKey) {
|
|
298
|
+
this.#symmetric.mixHash(publicKey);
|
|
299
|
+
if (this.#psk) this.#symmetric.mixKey(publicKey);
|
|
300
|
+
}
|
|
301
|
+
#x25519(keyPair, publicKey) {
|
|
302
|
+
try {
|
|
303
|
+
return Buffer.from(this.#dh(keyPair.privateKey, publicKey));
|
|
304
|
+
} catch {
|
|
305
|
+
throw new NoiseError("X25519 failed; the peer sent an invalid public key");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
#mixToken(token) {
|
|
309
|
+
if (token === "psk") {
|
|
310
|
+
if (!this.#psk) throw new NoiseError("Pattern needs a PSK");
|
|
311
|
+
this.#symmetric.mixKeyAndHash(this.#psk);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const remote = (key) => {
|
|
315
|
+
if (!key) throw new NoiseError(`Token ${token} needs a remote key`);
|
|
316
|
+
return key;
|
|
317
|
+
};
|
|
318
|
+
const e = this.#e;
|
|
319
|
+
if (!e) throw new NoiseError(`Token ${token} needs an ephemeral key`);
|
|
320
|
+
if (token === "ee") this.#symmetric.mixKey(this.#x25519(e, remote(this.#re)));
|
|
321
|
+
else if (token === "es") this.#symmetric.mixKey(this.#initiator ? this.#x25519(e, remote(this.#rs)) : this.#x25519(this.#s, remote(this.#re)));
|
|
322
|
+
else this.#symmetric.mixKey(this.#initiator ? this.#x25519(this.#s, remote(this.#re)) : this.#x25519(e, remote(this.#rs)));
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const utf8 = new TextDecoder("utf-8", {
|
|
326
|
+
fatal: true,
|
|
327
|
+
ignoreBOM: true
|
|
328
|
+
});
|
|
329
|
+
/**
|
|
330
|
+
* Stim's transport framing after the handshake: each WebSocket message is one ChaCha20-Poly1305 message with empty
|
|
331
|
+
* associated data under the next counter value. The first plaintext byte is the message type, 0x01 text or 0x02
|
|
332
|
+
* binary. Counters are not sent, so a reordered, replayed, dropped or altered message fails to decrypt. Any decryption
|
|
333
|
+
* failure closes the transport: every later call throws {@link NoiseError}. Nonce 2^64-1 is reserved and never used:
|
|
334
|
+
* after a direction's last usable message, at counter 2^64-2, the next call in that direction closes the transport.
|
|
335
|
+
*/
|
|
336
|
+
var NoiseTransport = class {
|
|
337
|
+
#send;
|
|
338
|
+
#receive;
|
|
339
|
+
#maxSend;
|
|
340
|
+
#maxReceive;
|
|
341
|
+
#closed = false;
|
|
342
|
+
constructor(options) {
|
|
343
|
+
if (!options.send.hasKey() || !options.receive.hasKey()) throw new TypeError("Transport cipher states need keys");
|
|
344
|
+
this.#send = options.send;
|
|
345
|
+
this.#receive = options.receive;
|
|
346
|
+
this.#maxSend = options.maxSendBytes;
|
|
347
|
+
this.#maxReceive = options.maxReceiveBytes;
|
|
348
|
+
}
|
|
349
|
+
get closed() {
|
|
350
|
+
return this.#closed;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Encrypts a string as a text message or bytes as a binary message. Data over `maxSendBytes` (UTF-8 bytes for text)
|
|
354
|
+
* throws a `RangeError`, consumes no counter, and leaves the transport open: it is the caller's own error and nothing
|
|
355
|
+
* was sent.
|
|
356
|
+
*/
|
|
357
|
+
encrypt(data) {
|
|
358
|
+
this.#assertOpen();
|
|
359
|
+
const body = typeof data === "string" ? Buffer.from(data, "utf8") : data;
|
|
360
|
+
if (body.length > this.#maxSend) throw new RangeError(`Message exceeds ${this.#maxSend} bytes`);
|
|
361
|
+
try {
|
|
362
|
+
return this.#send.encryptWithAd(EMPTY, Buffer.concat([Uint8Array.of(typeof data === "string" ? TEXT : BINARY), body]));
|
|
363
|
+
} catch (error) {
|
|
364
|
+
this.#closed = true;
|
|
365
|
+
throw error;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
decrypt(message) {
|
|
369
|
+
this.#assertOpen();
|
|
370
|
+
try {
|
|
371
|
+
if (message.length > this.#maxReceive + 1 + TAG_BYTES) throw new NoiseError("Message is too large");
|
|
372
|
+
const plaintext = this.#receive.decryptWithAd(EMPTY, message);
|
|
373
|
+
const body = plaintext.subarray(1);
|
|
374
|
+
if (plaintext[0] === TEXT) return {
|
|
375
|
+
type: "text",
|
|
376
|
+
data: utf8.decode(body)
|
|
377
|
+
};
|
|
378
|
+
if (plaintext[0] === BINARY) return {
|
|
379
|
+
type: "binary",
|
|
380
|
+
data: body
|
|
381
|
+
};
|
|
382
|
+
throw new NoiseError("Unknown message type");
|
|
383
|
+
} catch (error) {
|
|
384
|
+
this.#closed = true;
|
|
385
|
+
throw error instanceof NoiseError ? error : new NoiseError("Message is not valid", { cause: error });
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
#assertOpen() {
|
|
389
|
+
if (this.#closed) throw new NoiseError("The transport is closed");
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
//#endregion
|
|
393
|
+
export { CipherState, HandshakeState, MAX_HANDSHAKE_MESSAGE_BYTES, NOISE_XX, NOISE_XX_PSK2, NoiseError, NoiseTransport, generateNoiseKeyPair, noiseKeyPairFromPrivateKey };
|
|
@@ -96,6 +96,7 @@ interface ClaimFailure {
|
|
|
96
96
|
declare function claimFailure(err: unknown, retryCommand: string | null): ClaimFailure | null;
|
|
97
97
|
declare function exclusiveClaimDir(root: string): string;
|
|
98
98
|
declare function sharedClaimDir(root: string): string;
|
|
99
|
+
declare function sleepSync(ms: number): void;
|
|
99
100
|
/**
|
|
100
101
|
* Whether any member of the process group `pid` leads is alive. A recorded child is resolved through
|
|
101
102
|
* its group rather than through the one process, so a package manager's postinstall descendant keeps
|
|
@@ -149,4 +150,4 @@ declare function markClaimChildPending(handle: ClaimHandle): void;
|
|
|
149
150
|
declare function setClaimChild(handle: ClaimHandle, record: ProcessRecord): void;
|
|
150
151
|
declare function clearClaimChild(handle: ClaimHandle): void;
|
|
151
152
|
//#endregion
|
|
152
|
-
export { setClaimChild as A, inspectClaimSet as C, processGroupAlive as D, markClaimChildPending as E, sharedClaimDir as M,
|
|
153
|
+
export { setClaimChild as A, inspectClaimSet as C, processGroupAlive as D, markClaimChildPending as E, sharedClaimDir as M, sleepSync as N, readClaimSet as O, tryAcquireClaim as P, exclusiveClaimDir as S, isClaimUnavailable as T, claimFailure as _, ClaimFailure as a, clearClaimChild as b, ClaimMode as c, ClaimProblem as d, ClaimRefusedError as f, ClaimUnavailableError as g, ClaimSurvey as h, ClaimDetails as i, settleClaim as j, releaseClaim as k, ClaimOptions as l, ClaimSetState as m, CLAIM_UNAVAILABLE as n, ClaimHandle as o, ClaimSetClearance as p, ClaimAttempt as r, ClaimHolder as s, CLAIM_REFUSED as t, ClaimOwner as u, claimLiveness as v, isClaimRefusal as w, clearFreeClaimSet as x, claimRemoveCommand as y };
|
|
@@ -659,4 +659,4 @@ function writeChild(handle, body) {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
//#endregion
|
|
662
|
-
export { quotedPath as S, releaseClaim as _, claimFailure as a, sharedClaimDir as b, clearClaimChild as c, inspectClaimSet as d, isClaimRefusal as f, readClaimSet as g, processGroupAlive as h, ClaimUnavailableError as i, clearFreeClaimSet as l, markClaimChildPending as m, CLAIM_UNAVAILABLE as n, claimLiveness as o, isClaimUnavailable as p, ClaimRefusedError as r, claimRemoveCommand as s, CLAIM_REFUSED as t, exclusiveClaimDir as u, setClaimChild as v,
|
|
662
|
+
export { quotedPath as C, tryAcquireClaim as S, releaseClaim as _, claimFailure as a, sharedClaimDir as b, clearClaimChild as c, inspectClaimSet as d, isClaimRefusal as f, readClaimSet as g, processGroupAlive as h, ClaimUnavailableError as i, clearFreeClaimSet as l, markClaimChildPending as m, CLAIM_UNAVAILABLE as n, claimLiveness as o, isClaimUnavailable as p, ClaimRefusedError as r, claimRemoveCommand as s, CLAIM_REFUSED as t, exclusiveClaimDir as u, setClaimChild as v, sleepSync as x, settleClaim as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as setClaimChild, C as inspectClaimSet, D as processGroupAlive, E as markClaimChildPending, M as sharedClaimDir, N as
|
|
2
|
-
export { CLAIM_REFUSED, CLAIM_UNAVAILABLE, ClaimAttempt, ClaimDetails, ClaimFailure, ClaimHandle, ClaimHolder, ClaimMode, ClaimOptions, ClaimOwner, ClaimProblem, ClaimRefusedError, ClaimSetClearance, ClaimSetState, ClaimSurvey, ClaimUnavailableError, claimFailure, claimLiveness, claimRemoveCommand, clearClaimChild, clearFreeClaimSet, exclusiveClaimDir, inspectClaimSet, isClaimRefusal, isClaimUnavailable, markClaimChildPending, processGroupAlive, readClaimSet, releaseClaim, setClaimChild, settleClaim, sharedClaimDir, tryAcquireClaim };
|
|
1
|
+
import { A as setClaimChild, C as inspectClaimSet, D as processGroupAlive, E as markClaimChildPending, M as sharedClaimDir, N as sleepSync, O as readClaimSet, P as tryAcquireClaim, S as exclusiveClaimDir, T as isClaimUnavailable, _ as claimFailure, a as ClaimFailure, b as clearClaimChild, c as ClaimMode, d as ClaimProblem, f as ClaimRefusedError, g as ClaimUnavailableError, h as ClaimSurvey, i as ClaimDetails, j as settleClaim, k as releaseClaim, l as ClaimOptions, m as ClaimSetState, n as CLAIM_UNAVAILABLE, o as ClaimHandle, p as ClaimSetClearance, r as ClaimAttempt, s as ClaimHolder, t as CLAIM_REFUSED, u as ClaimOwner, v as claimLiveness, w as isClaimRefusal, x as clearFreeClaimSet, y as claimRemoveCommand } from "./ownership-claim-Bf8Lq6AY.mjs";
|
|
2
|
+
export { CLAIM_REFUSED, CLAIM_UNAVAILABLE, ClaimAttempt, ClaimDetails, ClaimFailure, ClaimHandle, ClaimHolder, ClaimMode, ClaimOptions, ClaimOwner, ClaimProblem, ClaimRefusedError, ClaimSetClearance, ClaimSetState, ClaimSurvey, ClaimUnavailableError, claimFailure, claimLiveness, claimRemoveCommand, clearClaimChild, clearFreeClaimSet, exclusiveClaimDir, inspectClaimSet, isClaimRefusal, isClaimUnavailable, markClaimChildPending, processGroupAlive, readClaimSet, releaseClaim, setClaimChild, settleClaim, sharedClaimDir, sleepSync, tryAcquireClaim };
|
package/dist/ownership-claim.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as releaseClaim, a as claimFailure, b as sharedClaimDir, c as clearClaimChild, d as inspectClaimSet, f as isClaimRefusal, g as readClaimSet, h as processGroupAlive, i as ClaimUnavailableError, l as clearFreeClaimSet, m as markClaimChildPending, n as CLAIM_UNAVAILABLE, o as claimLiveness, p as isClaimUnavailable, r as ClaimRefusedError, s as claimRemoveCommand, t as CLAIM_REFUSED, u as exclusiveClaimDir, v as setClaimChild, x as
|
|
2
|
-
export { CLAIM_REFUSED, CLAIM_UNAVAILABLE, ClaimRefusedError, ClaimUnavailableError, claimFailure, claimLiveness, claimRemoveCommand, clearClaimChild, clearFreeClaimSet, exclusiveClaimDir, inspectClaimSet, isClaimRefusal, isClaimUnavailable, markClaimChildPending, processGroupAlive, readClaimSet, releaseClaim, setClaimChild, settleClaim, sharedClaimDir, tryAcquireClaim };
|
|
1
|
+
import { S as tryAcquireClaim, _ as releaseClaim, a as claimFailure, b as sharedClaimDir, c as clearClaimChild, d as inspectClaimSet, f as isClaimRefusal, g as readClaimSet, h as processGroupAlive, i as ClaimUnavailableError, l as clearFreeClaimSet, m as markClaimChildPending, n as CLAIM_UNAVAILABLE, o as claimLiveness, p as isClaimUnavailable, r as ClaimRefusedError, s as claimRemoveCommand, t as CLAIM_REFUSED, u as exclusiveClaimDir, v as setClaimChild, x as sleepSync, y as settleClaim } from "./ownership-claim-DHUs_Dir.mjs";
|
|
2
|
+
export { CLAIM_REFUSED, CLAIM_UNAVAILABLE, ClaimRefusedError, ClaimUnavailableError, claimFailure, claimLiveness, claimRemoveCommand, clearClaimChild, clearFreeClaimSet, exclusiveClaimDir, inspectClaimSet, isClaimRefusal, isClaimUnavailable, markClaimChildPending, processGroupAlive, readClaimSet, releaseClaim, setClaimChild, settleClaim, sharedClaimDir, sleepSync, tryAcquireClaim };
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { $t as
|
|
2
|
-
import { $
|
|
1
|
+
import { $t as AndroidDeviceState, Br as MaintenanceStatus, Cn as DeviceLeaseState, Cr as ArchivedWorkspace, Dn as EnvironmentDisk, Fr as MaintenancePass, In as MachineUsageState, Ir as MaintenancePressure, Kn as RemoteDeviceState, On as EnvironmentState, Pn as MachineOwner, Qn as StatusIssue, Sn as DeviceAppProcess, Sr as ArchivedUsage, Tn as DiskMeasure, Ut as withDerivedFacts, Wn as PhysicalDeviceState, Yn as SimulatorState, Zt as AgentSession, _n as BuildReport, a as MachineView, cn as BuildDiagnostic, dn as BuildMissChange, dr as WorktreeGit, er as StatusPayload, f as statusViews, fn as BuildMissReason, fr as WorktreePullRequest, hn as BuildPlanPayload, hr as MacosBuild, i as ArchivedSummary, in as BuildActivity, ja as HostedMacosPlacement, jn as LastBuildReport, jr as MaintenanceAction, kn as GitChip, ln as BuildHistoryEntry, lr as WorkspaceStage, mn as BuildPlacement, or as WebBrowserState, pr as MacosAppRecord, r as applyKeyedDelta, sn as BuildDetail, ur as WorktreeFacts, xn as DeviceActivity, yn as BuildWaitingFor, zn as MetroBundleState } from "./index-_wkluvP_.mjs";
|
|
2
|
+
import { $t as LogsQueryResult, An as ProtocolError, B as ControlBeginParams, C as BuildMachineReport, Cn as NotificationsListResult, Dr as WorkspaceEvent, E as BuildPlanParams, En as PROTOCOL_VERSION, Er as WorkspaceDiff, G as DEVICE_HOST_METHODS, Gn as ReplayRange, Hn as ReplayKeyframe, It as InputSimulatorParams, Jt as LogLevel, Kn as ReplaySpan, Mn as PushRegisterParams, Mr as WorkspaceRef, Nr as WorkspacesEvent, Or as WorkspaceFile, Qn as ServerEvent, Qt as LogsEvent, St as FramesSubscribeResult, Tt as HelloResult, U as ControlEndedEvent, Un as ReplayKeyframeParams, V as ControlBeginResult, Vn as ReplayEndedEvent, Vt as KeyModifier, Wn as ReplayMarker, X as DesktopReloadProgressEvent, Xn as SERVER_UPDATE_METHODS, Xt as LogSource, Y as DesktopReloadEndedEvent, Yn as RotateDirection, Yt as LogRecord, Z as DesktopReportEvent, Zt as LogsEndedEvent, _n as NotificationEntry, _t as FrameEvent, a as ActionResult, an as MachineHistory, at as DeviceFrameEvent, bn as NotificationSuppression, c as ArchivedListParams, cn as MachineUsage, cr as SimulatorOptions, dn as MacosWindowsEvent, dt as ErrorEvent, gr as UsageSample, gt as FrameDelayedEvent, hr as UsageHistory, i as ActionParams, in as MachineEvent, it as DeviceFrameArtwork, jn as PushEvent, jr as WorkspacePatch, jt as InputKey, k as BuildProgressEvent, kn as Platform, kr as WorkspaceFiles, kt as InputButton, ln as MachineVolume, mn as Methods, nt as DesktopStopEndedEvent, o as ArchiveDetailParams, ot as DevicePosture, pr as TouchPhase, qn as ReplayTarget, qt as LogFilter, r as ActionName, rn as MachineDetails, rt as DesktopStopProgressEvent, sr as SimulatorCommand, st as DeviceUsageSeries, t as ACTIONS, u as BUILD_METHODS, ur as StatusEvent, v as BuildClientSummary, vn as NotificationEvent, vt as FrameTarget, wt as HelloParams, yn as NotificationLevel } from "./protocol-D8R_3dkO.mjs";
|
|
3
3
|
//#region phone-protocol.d.ts
|
|
4
4
|
type PhonePlatform = BuildPlanParams["platform"];
|
|
5
5
|
type PhoneDevicePlatform = Platform;
|
|
6
6
|
type PhoneReloadPlatform = Exclude<PhoneDevicePlatform, "macos">;
|
|
7
|
+
/**
|
|
8
|
+
* What a protocol 2 pairing QR code carries, as JSON with `v: 2`; readers ignore other fields. `fingerprint` is
|
|
9
|
+
* base64url of the SHA-256 of the server's X25519 public key. A pairing typed in by hand has no fingerprint.
|
|
10
|
+
*/
|
|
7
11
|
interface PhonePairingPayload {
|
|
8
|
-
v:
|
|
12
|
+
v: 2;
|
|
9
13
|
name: string;
|
|
10
14
|
endpoint: string;
|
|
11
15
|
pairingToken: string;
|
|
16
|
+
fingerprint?: string;
|
|
12
17
|
}
|
|
13
18
|
type PhoneSimState = Omit<SimulatorState, "activity" | "app" | "appPresence"> & {
|
|
14
19
|
activity?: PhoneDeviceActivity;
|
|
@@ -115,9 +120,10 @@ type PhoneStageFacts = Omit<WorkspaceStage, "kind" | "platform" | "closedApps">
|
|
|
115
120
|
slot: string;
|
|
116
121
|
}[];
|
|
117
122
|
};
|
|
118
|
-
type PhonePullRequestFacts = Omit<WorktreePullRequest, "state" | "reviewDecision"> & {
|
|
123
|
+
type PhonePullRequestFacts = Omit<WorktreePullRequest, "state" | "reviewDecision" | "checkedAt"> & {
|
|
119
124
|
state: string;
|
|
120
|
-
reviewDecision
|
|
125
|
+
reviewDecision?: string | null;
|
|
126
|
+
checkedAt?: string;
|
|
121
127
|
};
|
|
122
128
|
type PhoneStatusIssue = Omit<StatusIssue, "code" | "severity"> & {
|
|
123
129
|
code: string;
|
|
@@ -131,7 +137,8 @@ type PhoneWebBrowserState = Omit<OptionalFields<WebBrowserState, "targetId">, "b
|
|
|
131
137
|
}) | null;
|
|
132
138
|
activity?: PhoneDeviceActivity;
|
|
133
139
|
};
|
|
134
|
-
type PhoneMacosAppState = Omit<MacosAppRecord, "build" | "hostLaunched" | "host"> & {
|
|
140
|
+
type PhoneMacosAppState = Omit<MacosAppRecord, "build" | "hostLaunched" | "host" | "arguments"> & {
|
|
141
|
+
arguments?: string[];
|
|
135
142
|
state: string;
|
|
136
143
|
build: Omit<MacosBuild, "state"> & {
|
|
137
144
|
state: string;
|
|
@@ -146,7 +153,11 @@ type PhoneMacosAppState = Omit<MacosAppRecord, "build" | "hostLaunched" | "host"
|
|
|
146
153
|
};
|
|
147
154
|
};
|
|
148
155
|
};
|
|
149
|
-
type PhoneEnvironmentState = Omit<EnvironmentState, "slots" | "metro" | "build" | "issues" | "android" | "ios" | "web" | "macos" | "phase" | "stage" | "warmStep" | "memorySource" | "worktree" | "remoteDevices" | "physicalDevices" | "lastBuilds" | "builds" | "agents" | "endedAgents"> & {
|
|
156
|
+
type PhoneEnvironmentState = Omit<EnvironmentState, "slots" | "metro" | "build" | "issues" | "android" | "ios" | "web" | "macos" | "phase" | "stage" | "warmStep" | "memorySource" | "worktree" | "remoteDevices" | "physicalDevices" | "lastBuilds" | "builds" | "agents" | "endedAgents" | "logs"> & {
|
|
157
|
+
logs?: {
|
|
158
|
+
dir?: string;
|
|
159
|
+
errorsSinceMarker: number;
|
|
160
|
+
} | null;
|
|
150
161
|
phase?: string;
|
|
151
162
|
stage?: PhoneStageFacts;
|
|
152
163
|
warmStep?: string;
|
|
@@ -205,11 +216,14 @@ type PhoneStatusUsage = Omit<UsageHistory, "devices"> & {
|
|
|
205
216
|
})[];
|
|
206
217
|
};
|
|
207
218
|
type PhoneBuildResult = string;
|
|
208
|
-
type PhoneBuildHistoryEntry = Omit<BuildHistoryEntry, keyof LastBuildReport | "result" | "phases"> & PhoneLastBuild & {
|
|
219
|
+
type PhoneBuildHistoryEntry = Omit<BuildHistoryEntry, keyof LastBuildReport | "result" | "phases" | "configuration" | "cacheKey"> & PhoneLastBuild & {
|
|
209
220
|
result: PhoneBuildResult;
|
|
210
221
|
phases: Partial<Record<string, number>>;
|
|
222
|
+
configuration?: string | null;
|
|
223
|
+
cacheKey?: string | null;
|
|
211
224
|
};
|
|
212
|
-
type PhoneLastBuild = Omit<LastBuildReport, "platform" | "status" | "cacheHit" | "missReason"> & {
|
|
225
|
+
type PhoneLastBuild = Omit<LastBuildReport, "platform" | "status" | "cacheHit" | "missReason" | "fingerprint"> & {
|
|
226
|
+
fingerprint?: string | null;
|
|
213
227
|
platform: string;
|
|
214
228
|
status: string;
|
|
215
229
|
cacheHit: PhoneBuildCacheHit;
|
|
@@ -253,6 +267,38 @@ type PhoneStatusPayload = Omit<StatusPayload, "environments" | "machine" | "unpr
|
|
|
253
267
|
machine?: PhoneMachineUsageState | null;
|
|
254
268
|
ownLeases?: string[];
|
|
255
269
|
};
|
|
270
|
+
type PhoneWorkspaceSummary = PhoneEnvironmentState;
|
|
271
|
+
type PhoneWorktreeRow = Pick<PhoneWorktreeFacts, "path" | "branch" | "repository" | "git" | "gitChip" | "pullRequest">;
|
|
272
|
+
type PhoneArchivedWorkspace = NonNullable<PhoneStatusPayload["archived"]>[number];
|
|
273
|
+
type PhoneArchivedSummary = ArchivedSummary;
|
|
274
|
+
type PhoneMachineView = Omit<MachineView, "machine" | "maintenance"> & {
|
|
275
|
+
machine: PhoneMachineUsageState | null;
|
|
276
|
+
/**
|
|
277
|
+
* Already without `recent` and `sizes`. An `Omit` here made the RPC validator generator, which mishandles `Omit` of an
|
|
278
|
+
* intersection, require `plan` to be an object, and the phone refused every machine event with maintenance.
|
|
279
|
+
*/
|
|
280
|
+
maintenance: PhoneMaintenanceStatus | null;
|
|
281
|
+
};
|
|
282
|
+
type PhoneKeyedDelta<T> = {
|
|
283
|
+
upsert: T[];
|
|
284
|
+
remove: string[];
|
|
285
|
+
};
|
|
286
|
+
type PhoneWorkspacesEvent = Omit<WorkspacesEvent, "snapshot" | "workspaces" | "worktrees"> & {
|
|
287
|
+
snapshot?: {
|
|
288
|
+
workspaces: PhoneWorkspaceSummary[];
|
|
289
|
+
worktrees: PhoneWorktreeRow[];
|
|
290
|
+
archived: PhoneArchivedSummary;
|
|
291
|
+
};
|
|
292
|
+
workspaces?: PhoneKeyedDelta<PhoneWorkspaceSummary>;
|
|
293
|
+
worktrees?: PhoneKeyedDelta<PhoneWorktreeRow>;
|
|
294
|
+
};
|
|
295
|
+
type PhoneWorkspaceEvent = Omit<WorkspaceEvent, "environment"> & {
|
|
296
|
+
environment: PhoneEnvironmentState | null;
|
|
297
|
+
};
|
|
298
|
+
type PhoneMachineEvent = Omit<MachineEvent, "machine" | "usage"> & {
|
|
299
|
+
machine: PhoneMachineView;
|
|
300
|
+
usage?: PhoneStatusUsage;
|
|
301
|
+
};
|
|
256
302
|
type PhoneMachineOwnerKind = string;
|
|
257
303
|
type PhoneMachineOwner = Omit<OptionalFields<MachineOwner, "memoryMb">, "kind"> & {
|
|
258
304
|
kind: PhoneMachineOwnerKind;
|
|
@@ -336,7 +382,6 @@ type PhoneMachineHistory = Omit<MachineHistory, "samples"> & {
|
|
|
336
382
|
type PhoneMachineDetails = OptionalFields<MachineDetails, "buildMachines">;
|
|
337
383
|
type PhoneBuildClientSummary = BuildClientSummary;
|
|
338
384
|
type PhoneBuildMachineReport = BuildMachineReport;
|
|
339
|
-
type PhoneClientAuth = PairingAuth | DeviceAuth;
|
|
340
385
|
type PhonePushEvent = PushEvent;
|
|
341
386
|
type PhoneNotificationLevel = NotificationLevel;
|
|
342
387
|
type PhonePushRegisterParams = PushRegisterParams;
|
|
@@ -394,7 +439,7 @@ type PhoneControlEndedEvent = Omit<ControlEndedEvent, "reason"> & {
|
|
|
394
439
|
type PhoneNotificationEvent = Omit<NotificationEvent, "notification"> & {
|
|
395
440
|
notification: PhoneNotificationEntry;
|
|
396
441
|
};
|
|
397
|
-
type PhoneServerEvent = Exclude<ServerEvent, BuildProgressEvent | StatusEvent | LogsEvent | ErrorEvent | FrameEvent | ControlEndedEvent | NotificationEvent | MacosWindowsEvent> | PhoneMacosWindowsEvent | PhoneStatusEvent | PhoneLogsEvent | PhoneErrorEvent | PhoneFrameEvent | PhoneControlEndedEvent | PhoneNotificationEvent;
|
|
442
|
+
type PhoneServerEvent = Exclude<ServerEvent, BuildProgressEvent | StatusEvent | WorkspacesEvent | WorkspaceEvent | MachineEvent | LogsEvent | ErrorEvent | FrameEvent | ControlEndedEvent | NotificationEvent | MacosWindowsEvent | DesktopReportEvent | DesktopStopProgressEvent | DesktopStopEndedEvent | DesktopReloadProgressEvent | DesktopReloadEndedEvent> | PhoneMacosWindowsEvent | PhoneStatusEvent | PhoneWorkspacesEvent | PhoneWorkspaceEvent | PhoneMachineEvent | PhoneLogsEvent | PhoneErrorEvent | PhoneFrameEvent | PhoneControlEndedEvent | PhoneNotificationEvent;
|
|
398
443
|
/** Fields introduced after protocol v1's initial release remain optional on the receiving client. */
|
|
399
444
|
type OptionalFields<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
400
445
|
type PhoneHelloResult = OptionalFields<Omit<HelloResult, "server" | "features" | "capabilities" | "actions" | "approval">, "device"> & {
|
|
@@ -407,11 +452,35 @@ type PhoneHelloResult = OptionalFields<Omit<HelloResult, "server" | "features" |
|
|
|
407
452
|
expiresAt: string;
|
|
408
453
|
};
|
|
409
454
|
};
|
|
410
|
-
type PhoneMethods = Omit<Methods, (typeof BUILD_METHODS)[number] | (typeof DEVICE_HOST_METHODS)[number] | (typeof SERVER_UPDATE_METHODS)[number] | "machines.update.start" | "machines.update.status" | "device-host.sessions" | "device-host.sessions.stop" | "route.setup" | "hello" | "logs.query" | "machine.get" | "machine.details" | "machine.history" | "workspace.diff" | "frames.subscribe" | "replay.range" | "archive.detail" | "replay.keyframe" | "build.plan" | "action" | "control.begin" | "notifications.list"> & {
|
|
411
|
-
|
|
412
|
-
params:
|
|
413
|
-
|
|
455
|
+
type PhoneMethods = Omit<Methods, (typeof BUILD_METHODS)[number] | (typeof DEVICE_HOST_METHODS)[number] | (typeof SERVER_UPDATE_METHODS)[number] | "desktop.authenticate" | "desktop.reports.get" | "desktop.reports.subscribe" | "desktop.reports.invalidate" | "desktop.settings.get" | "desktop.settings.write" | "desktop.logs.subscribe" | "desktop.doctor.run" | "desktop.stop.subscribe" | "desktop.reload.subscribe" | "machines.update.start" | "machines.update.status" | "device-host.sessions" | "device-host.sessions.stop" | "route.setup" | "hello" | "logs.query" | "machine.get" | "machine.details" | "machine.history" | "workspace.diff" | "frames.subscribe" | "replay.range" | "archive.detail" | "replay.keyframe" | "build.plan" | "action" | "control.begin" | "notifications.list" | "builds.history" | "archived.list" | "worktrees.list" | "maintenance.get"> & {
|
|
456
|
+
"builds.history": {
|
|
457
|
+
params: WorkspaceRef;
|
|
458
|
+
result: {
|
|
459
|
+
builds?: Partial<Record<string, PhoneBuildHistoryEntry[]>>;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
"archived.list": {
|
|
463
|
+
params?: ArchivedListParams;
|
|
464
|
+
result: {
|
|
465
|
+
archived: PhoneArchivedWorkspace[];
|
|
466
|
+
usage: ArchivedUsage;
|
|
467
|
+
next: string | null;
|
|
414
468
|
};
|
|
469
|
+
};
|
|
470
|
+
"worktrees.list": {
|
|
471
|
+
params?: Record<string, never>;
|
|
472
|
+
result: {
|
|
473
|
+
worktrees: PhoneWorktreeFacts[];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
"maintenance.get": {
|
|
477
|
+
params?: Record<string, never>;
|
|
478
|
+
result: {
|
|
479
|
+
maintenance: PhoneMaintenanceStatus | null;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
hello: {
|
|
483
|
+
params: Omit<HelloParams, "access">;
|
|
415
484
|
result: PhoneHelloResult;
|
|
416
485
|
};
|
|
417
486
|
"machine.history": {
|
|
@@ -481,4 +550,4 @@ type PhoneResponse<M extends PhoneMethod = PhoneMethod> = {
|
|
|
481
550
|
};
|
|
482
551
|
type PhoneServerMessage = PhoneResponse | PhoneServerEvent;
|
|
483
552
|
//#endregion
|
|
484
|
-
export { ACTIONS, type PhoneActionName as ActionName, PhoneActionName, type PhoneActionParams as ActionParams, PhoneActionParams, type PhoneActionResult as ActionResult, PhoneActionResult, type PhoneAgentSession as AgentSession, PhoneAgentSession, type PhoneAndroidState as AndroidState, PhoneAndroidState, type PhoneAppPresence as AppPresence, PhoneAppPresence, type PhoneArchiveDetailResult as ArchiveDetailResult, PhoneArchiveDetailResult, type PhoneBuildActivity as BuildActivity, PhoneBuildActivity, type PhoneBuildCacheHit as BuildCacheHit, PhoneBuildCacheHit, type PhoneBuildClientSummary as BuildClientSummary, PhoneBuildClientSummary, type PhoneBuildDetail as BuildDetail, PhoneBuildDetail, type PhoneBuildDiagnostic as BuildDiagnostic, PhoneBuildDiagnostic, type PhoneBuildHistoryEntry as BuildHistoryEntry, PhoneBuildHistoryEntry, type PhoneBuildMachineReport as BuildMachineReport, PhoneBuildMachineReport, type PhoneBuildMissCategory as BuildMissCategory, PhoneBuildMissCategory, type PhoneBuildMissChange as BuildMissChange, PhoneBuildMissChange, type PhoneBuildMissReason as BuildMissReason, PhoneBuildMissReason, type PhoneBuildPhase as BuildPhase, PhoneBuildPhase, type PhoneBuildPlacement as BuildPlacement, PhoneBuildPlacement, type PhoneBuildPlan as BuildPlan, PhoneBuildPlan, type PhoneBuildPlanParams as BuildPlanParams, PhoneBuildPlanParams, type PhoneBuildReport as BuildReport, PhoneBuildReport, type PhoneBuildResult as BuildResult, PhoneBuildResult, type
|
|
553
|
+
export { ACTIONS, type PhoneActionName as ActionName, PhoneActionName, type PhoneActionParams as ActionParams, PhoneActionParams, type PhoneActionResult as ActionResult, PhoneActionResult, type PhoneAgentSession as AgentSession, PhoneAgentSession, type PhoneAndroidState as AndroidState, PhoneAndroidState, type PhoneAppPresence as AppPresence, PhoneAppPresence, type PhoneArchiveDetailResult as ArchiveDetailResult, PhoneArchiveDetailResult, type PhoneArchivedSummary as ArchivedSummary, PhoneArchivedSummary, type PhoneArchivedWorkspace as ArchivedWorkspace, PhoneArchivedWorkspace, type PhoneBuildActivity as BuildActivity, PhoneBuildActivity, type PhoneBuildCacheHit as BuildCacheHit, PhoneBuildCacheHit, type PhoneBuildClientSummary as BuildClientSummary, PhoneBuildClientSummary, type PhoneBuildDetail as BuildDetail, PhoneBuildDetail, type PhoneBuildDiagnostic as BuildDiagnostic, PhoneBuildDiagnostic, type PhoneBuildHistoryEntry as BuildHistoryEntry, PhoneBuildHistoryEntry, type PhoneBuildMachineReport as BuildMachineReport, PhoneBuildMachineReport, type PhoneBuildMissCategory as BuildMissCategory, PhoneBuildMissCategory, type PhoneBuildMissChange as BuildMissChange, PhoneBuildMissChange, type PhoneBuildMissReason as BuildMissReason, PhoneBuildMissReason, type PhoneBuildPhase as BuildPhase, PhoneBuildPhase, type PhoneBuildPlacement as BuildPlacement, PhoneBuildPlacement, type PhoneBuildPlan as BuildPlan, PhoneBuildPlan, type PhoneBuildPlanParams as BuildPlanParams, PhoneBuildPlanParams, type PhoneBuildReport as BuildReport, PhoneBuildReport, type PhoneBuildResult as BuildResult, PhoneBuildResult, type PhoneControlBeginParams as ControlBeginParams, PhoneControlBeginParams, type PhoneControlBeginResult as ControlBeginResult, PhoneControlBeginResult, type PhoneControlEndedEvent as ControlEndedEvent, PhoneControlEndedEvent, type PhoneDeviceActivity as DeviceActivity, PhoneDeviceActivity, type PhoneDeviceAppProcess as DeviceAppProcess, PhoneDeviceAppProcess, type PhoneDeviceDisk as DeviceDisk, PhoneDeviceDisk, type PhoneDeviceFrameArtwork as DeviceFrameArtwork, PhoneDeviceFrameArtwork, type PhoneDeviceFrameEvent as DeviceFrameEvent, PhoneDeviceFrameEvent, type PhoneDeviceLeaseState as DeviceLeaseState, PhoneDeviceLeaseState, type PhoneDevicePlatform as DevicePlatform, PhoneDevicePlatform, type PhoneDevicePosture as DevicePosture, PhoneDevicePosture, type PhoneEndedAgentSession as EndedAgentSession, PhoneEndedAgentSession, type PhoneEnvironmentState as EnvironmentState, PhoneEnvironmentState, type PhoneErrorEvent as ErrorEvent, PhoneErrorEvent, type PhoneFrameDelayedEvent as FrameDelayedEvent, PhoneFrameDelayedEvent, type PhoneFrameEvent as FrameEvent, PhoneFrameEvent, type PhoneFrameTarget as FrameTarget, PhoneFrameTarget, type PhoneGitChipFacts as GitChipFacts, PhoneGitChipFacts, type PhoneGitChipPart as GitChipPart, PhoneGitChipPart, type PhoneHelloResult as HelloResult, PhoneHelloResult, type PhoneInputButton as InputButton, PhoneInputButton, type PhoneInputKey as InputKey, PhoneInputKey, type PhoneInputSimulatorParams as InputSimulatorParams, PhoneInputSimulatorParams, type PhoneKeyModifier as KeyModifier, PhoneKeyModifier, type PhoneLastBuild as LastBuild, PhoneLastBuild, type PhoneLogFilter as LogFilter, PhoneLogFilter, type PhoneLogLevel as LogLevel, PhoneLogLevel, type PhoneLogRecord as LogRecord, PhoneLogRecord, type PhoneLogSource as LogSource, PhoneLogSource, type PhoneLogsEndedEvent as LogsEndedEvent, PhoneLogsEndedEvent, type PhoneLogsEvent as LogsEvent, PhoneLogsEvent, type PhoneMachineDetails as MachineDetails, PhoneMachineDetails, type PhoneMachineEvent as MachineEvent, PhoneMachineEvent, type PhoneMachineHistory as MachineHistory, PhoneMachineHistory, type PhoneMachineOwner as MachineOwner, PhoneMachineOwner, type PhoneMachineOwnerKind as MachineOwnerKind, PhoneMachineOwnerKind, type PhoneMachineUsage as MachineUsage, PhoneMachineUsage, type PhoneMachineUsageState as MachineUsageState, PhoneMachineUsageState, type PhoneMachineView as MachineView, PhoneMachineView, type PhoneMachineVolume as MachineVolume, PhoneMachineVolume, type PhoneMacosAppState as MacosAppState, PhoneMacosAppState, type PhoneMacosWindowsEvent as MacosWindowsEvent, PhoneMacosWindowsEvent, type PhoneMemoryPressure as MemoryPressure, PhoneMemoryPressure, type PhoneMethod as Method, PhoneMethod, type PhoneMethods as Methods, PhoneMethods, type PhoneMetroBundle as MetroBundle, PhoneMetroBundle, type PhoneNotificationEntry as NotificationEntry, PhoneNotificationEntry, type PhoneNotificationEvent as NotificationEvent, PhoneNotificationEvent, type PhoneNotificationLevel as NotificationLevel, PhoneNotificationLevel, type PhoneNotificationSuppression as NotificationSuppression, PhoneNotificationSuppression, type PhoneNotificationTarget as NotificationTarget, PhoneNotificationTarget, type PhoneNotificationsListResult as NotificationsListResult, PhoneNotificationsListResult, PROTOCOL_VERSION, type PhonePairingPayload as PairingPayload, PhonePairingPayload, PhoneKeyedDelta, PhoneMaintenanceStatus, PhonePhysicalDeviceState, type PhonePhysicalDeviceState as PhysicalDeviceState, PhonePlatform, type PhonePlatform as Platform, PhoneProtocolError, type PhoneProtocolError as ProtocolError, PhonePullRequestFacts, type PhonePullRequestFacts as PullRequestFacts, PhonePushEvent, type PhonePushEvent as PushEvent, PhonePushRegisterParams, type PhonePushRegisterParams as PushRegisterParams, PhoneReloadPlatform, type PhoneReloadPlatform as ReloadPlatform, PhoneRemoteDeviceState, type PhoneRemoteDeviceState as RemoteDeviceState, PhoneReplayEndedEvent, type PhoneReplayEndedEvent as ReplayEndedEvent, PhoneReplayKeyframe, type PhoneReplayKeyframe as ReplayKeyframe, PhoneReplayMarker, type PhoneReplayMarker as ReplayMarker, PhoneReplayRange, type PhoneReplayRange as ReplayRange, PhoneReplayRate, type PhoneReplayRate as ReplayRate, PhoneReplaySpan, type PhoneReplaySpan as ReplaySpan, PhoneResponse, type PhoneResponse as Response, PhoneRotateDirection, type PhoneRotateDirection as RotateDirection, PhoneServerEvent, type PhoneServerEvent as ServerEvent, PhoneServerMessage, type PhoneServerMessage as ServerMessage, PhoneSimState, type PhoneSimState as SimState, PhoneSimulatorCommand, type PhoneSimulatorCommand as SimulatorCommand, PhoneSimulatorOptions, type PhoneSimulatorOptions as SimulatorOptions, PhoneStackFrame, type PhoneStackFrame as StackFrame, PhoneStageFacts, type PhoneStageFacts as StageFacts, PhoneStatusEvent, type PhoneStatusEvent as StatusEvent, PhoneStatusIssue, type PhoneStatusIssue as StatusIssue, PhoneStatusPayload, type PhoneStatusPayload as StatusPayload, PhoneStatusUsage, type PhoneStatusUsage as StatusUsage, PhoneTouchPhase, type PhoneTouchPhase as TouchPhase, PhoneUsageSample, type PhoneUsageSample as UsageSample, PhoneWebBrowserState, type PhoneWebBrowserState as WebBrowserState, PhoneWorkspaceDiff, type PhoneWorkspaceDiff as WorkspaceDiff, PhoneWorkspaceDisk, type PhoneWorkspaceDisk as WorkspaceDisk, PhoneWorkspaceEvent, type PhoneWorkspaceEvent as WorkspaceEvent, PhoneWorkspaceFile, type PhoneWorkspaceFile as WorkspaceFile, PhoneWorkspaceFiles, type PhoneWorkspaceFiles as WorkspaceFiles, PhoneWorkspacePatch, type PhoneWorkspacePatch as WorkspacePatch, PhoneWorkspaceSummary, type PhoneWorkspaceSummary as WorkspaceSummary, PhoneWorkspacesEvent, type PhoneWorkspacesEvent as WorkspacesEvent, PhoneWorktreeFacts, type PhoneWorktreeFacts as WorktreeFacts, PhoneWorktreeGit, type PhoneWorktreeGit as WorktreeGit, PhoneWorktreeRow, type PhoneWorktreeRow as WorktreeRow, applyKeyedDelta, statusViews, withDerivedFacts };
|