@yu_robotics/remote-cli 1.6.252 → 1.6.255

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.
Files changed (72) hide show
  1. package/dist/client/WebSocketClient.d.ts +0 -3
  2. package/dist/client/WebSocketClient.d.ts.map +1 -1
  3. package/dist/client/WebSocketClient.js +1 -3
  4. package/dist/client/WebSocketClient.js.map +1 -1
  5. package/dist/commands/start.d.ts +0 -5
  6. package/dist/commands/start.d.ts.map +1 -1
  7. package/dist/commands/start.js +0 -25
  8. package/dist/commands/start.js.map +1 -1
  9. package/dist/executor/AgyExecutor.js +3 -3
  10. package/dist/executor/AgyExecutor.js.map +1 -1
  11. package/dist/executor/IExecutor.d.ts +1 -1
  12. package/dist/executor/IExecutor.d.ts.map +1 -1
  13. package/dist/index.js +0 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/maintenance/release-notes.json +1 -1
  16. package/dist/scheduling/ScheduleService.d.ts +3 -15
  17. package/dist/scheduling/ScheduleService.d.ts.map +1 -1
  18. package/dist/scheduling/ScheduleService.js +58 -93
  19. package/dist/scheduling/ScheduleService.js.map +1 -1
  20. package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
  21. package/native/prebuilds/darwin-arm64/manifest.json +1 -1
  22. package/native/prebuilds/darwin-x64/managed_native.node +0 -0
  23. package/native/prebuilds/darwin-x64/manifest.json +1 -1
  24. package/native/prebuilds/win32-arm64/managed_native.node +0 -0
  25. package/native/prebuilds/win32-arm64/manifest.json +1 -1
  26. package/native/prebuilds/win32-x64/managed_native.node +0 -0
  27. package/native/prebuilds/win32-x64/manifest.json +1 -1
  28. package/package.json +1 -1
  29. package/dist/service/SessionHostSupervisor.d.ts +0 -63
  30. package/dist/service/SessionHostSupervisor.d.ts.map +0 -1
  31. package/dist/service/SessionHostSupervisor.js +0 -323
  32. package/dist/service/SessionHostSupervisor.js.map +0 -1
  33. package/dist/sessionHost/HostClient.d.ts +0 -49
  34. package/dist/sessionHost/HostClient.d.ts.map +0 -1
  35. package/dist/sessionHost/HostClient.js +0 -101
  36. package/dist/sessionHost/HostClient.js.map +0 -1
  37. package/dist/sessionHost/HostProtocol.d.ts +0 -65
  38. package/dist/sessionHost/HostProtocol.d.ts.map +0 -1
  39. package/dist/sessionHost/HostProtocol.js +0 -78
  40. package/dist/sessionHost/HostProtocol.js.map +0 -1
  41. package/dist/sessionHost/HostServer.d.ts +0 -52
  42. package/dist/sessionHost/HostServer.d.ts.map +0 -1
  43. package/dist/sessionHost/HostServer.js +0 -413
  44. package/dist/sessionHost/HostServer.js.map +0 -1
  45. package/dist/sessionHost/HostStore.d.ts +0 -43
  46. package/dist/sessionHost/HostStore.d.ts.map +0 -1
  47. package/dist/sessionHost/HostStore.js +0 -206
  48. package/dist/sessionHost/HostStore.js.map +0 -1
  49. package/dist/sessionHost/RetainedFrontend.d.ts +0 -63
  50. package/dist/sessionHost/RetainedFrontend.d.ts.map +0 -1
  51. package/dist/sessionHost/RetainedFrontend.js +0 -244
  52. package/dist/sessionHost/RetainedFrontend.js.map +0 -1
  53. package/dist/sessionHost/RetainedHostLauncher.d.ts +0 -25
  54. package/dist/sessionHost/RetainedHostLauncher.d.ts.map +0 -1
  55. package/dist/sessionHost/RetainedHostLauncher.js +0 -132
  56. package/dist/sessionHost/RetainedHostLauncher.js.map +0 -1
  57. package/dist/sessionHost/RetainedRuntime.d.ts +0 -62
  58. package/dist/sessionHost/RetainedRuntime.d.ts.map +0 -1
  59. package/dist/sessionHost/RetainedRuntime.js +0 -478
  60. package/dist/sessionHost/RetainedRuntime.js.map +0 -1
  61. package/dist/sessionHost/RuntimeJournal.d.ts +0 -47
  62. package/dist/sessionHost/RuntimeJournal.d.ts.map +0 -1
  63. package/dist/sessionHost/RuntimeJournal.js +0 -103
  64. package/dist/sessionHost/RuntimeJournal.js.map +0 -1
  65. package/dist/sessionHost/entry.d.ts +0 -13
  66. package/dist/sessionHost/entry.d.ts.map +0 -1
  67. package/dist/sessionHost/entry.js +0 -107
  68. package/dist/sessionHost/entry.js.map +0 -1
  69. package/dist/update/PinnedHostBundle.d.ts +0 -49
  70. package/dist/update/PinnedHostBundle.d.ts.map +0 -1
  71. package/dist/update/PinnedHostBundle.js +0 -309
  72. package/dist/update/PinnedHostBundle.js.map +0 -1
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HostError = exports.MAX_RESPONSE_BYTES = exports.MAX_PAYLOAD_BYTES = exports.MAX_REQUEST_BYTES = exports.HOST_CAPABILITIES = exports.HOST_PROTOCOL = void 0;
4
- exports.object = object;
5
- exports.fields = fields;
6
- exports.identifier = identifier;
7
- exports.integer = integer;
8
- exports.secret = secret;
9
- exports.canonical = canonical;
10
- exports.payload = payload;
11
- exports.digest = digest;
12
- exports.sign = sign;
13
- exports.matchesSignature = matchesSignature;
14
- const crypto_1 = require("crypto");
15
- exports.HOST_PROTOCOL = 1;
16
- exports.HOST_CAPABILITIES = ['frontend-lease-v1', 'durable-operation-v1', 'output-replay-v1', 'sequenced-requests-v1', 'launcher-recovery-v1'];
17
- exports.MAX_REQUEST_BYTES = 64 * 1024;
18
- exports.MAX_PAYLOAD_BYTES = 16 * 1024;
19
- exports.MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
20
- class HostError extends Error {
21
- code;
22
- constructor(code) {
23
- super(code);
24
- this.code = code;
25
- }
26
- }
27
- exports.HostError = HostError;
28
- function object(value) {
29
- return !!value && typeof value === 'object' && !Array.isArray(value);
30
- }
31
- function fields(value, required, optional = []) {
32
- if (!object(value) || required.some(key => !Object.hasOwn(value, key))
33
- || Object.keys(value).some(key => !required.includes(key) && !optional.includes(key)))
34
- throw new HostError('invalid_request');
35
- }
36
- function identifier(value) {
37
- if (typeof value !== 'string' || !/^[a-zA-Z0-9_-]{1,128}$/.test(value))
38
- throw new HostError('invalid_identifier');
39
- }
40
- function integer(value) {
41
- if (!Number.isSafeInteger(value) || value < 0)
42
- throw new HostError('invalid_integer');
43
- }
44
- function secret(value) {
45
- if (typeof value !== 'string' || !/^[a-f0-9]{64}$/.test(value))
46
- throw new HostError('invalid_secret');
47
- }
48
- /** Canonical JSON rejects lossy values and bounds nesting before hashing or dispatch. */
49
- function canonical(value, depth = 0) {
50
- if (depth > 16)
51
- throw new HostError('invalid_payload');
52
- if (value === null || typeof value === 'string' || typeof value === 'boolean')
53
- return JSON.stringify(value);
54
- if (typeof value === 'number' && Number.isFinite(value))
55
- return JSON.stringify(value);
56
- if (Array.isArray(value))
57
- return '[' + value.map(item => canonical(item, depth + 1)).join(',') + ']';
58
- if (object(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value))) {
59
- return '{' + Object.keys(value).sort().map(key => JSON.stringify(key) + ':' + canonical(value[key], depth + 1)).join(',') + '}';
60
- }
61
- throw new HostError('invalid_payload');
62
- }
63
- function payload(value) {
64
- const encoded = canonical(value);
65
- if (Buffer.byteLength(encoded) > exports.MAX_PAYLOAD_BYTES)
66
- throw new HostError('payload_too_large');
67
- return JSON.parse(encoded);
68
- }
69
- function digest(value) { return (0, crypto_1.createHash)('sha256').update(value).digest('hex'); }
70
- /** Domain-separated authentication; the installation secret never crosses IPC. */
71
- function sign(key, direction, nonce, timestamp, data) {
72
- return (0, crypto_1.createHmac)('sha256', key).update([direction, nonce, timestamp, data].join('\n')).digest('hex');
73
- }
74
- function matchesSignature(actual, expected) {
75
- return typeof actual === 'string' && /^[a-f0-9]{64}$/.test(actual)
76
- && (0, crypto_1.timingSafeEqual)(Buffer.from(actual, 'hex'), Buffer.from(expected, 'hex'));
77
- }
78
- //# sourceMappingURL=HostProtocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HostProtocol.js","sourceRoot":"","sources":["../../src/sessionHost/HostProtocol.ts"],"names":[],"mappings":";;;AAsCA,wBAEC;AACD,wBAGC;AACD,gCAEC;AACD,0BAEC;AACD,wBAEC;AAED,8BASC;AACD,0BAIC;AACD,wBAA0G;AAE1G,oBAEC;AACD,4CAG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AA,wBAAe,EAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACjF,CAAC"}
@@ -1,52 +0,0 @@
1
- import { type HostLimits } from './HostStore';
2
- import { type HostAddress, type HostRuntime } from './HostProtocol';
3
- export interface HostOptions {
4
- /** Private directory. The launcher must provision a private ACL on Windows. */
5
- directory: string;
6
- installationId: string;
7
- /** Random 32-byte hex credential from the trusted launcher; never persisted or sent. */
8
- secret: string;
9
- launcherSecret?: string;
10
- runtime: HostRuntime;
11
- limits?: HostLimits;
12
- requestTimeoutMs?: number;
13
- ticketLifetimeMs?: number;
14
- maxSockets?: number;
15
- }
16
- /** Retains execution ownership independently of every HTTP frontend connection.
17
- * The trusted launcher passes address/credential out of band. Losing an HTTP
18
- * connection does not lose a lease: reconnect with the same lease or a prepared
19
- * successor ticket. No unauthenticated discovery or automatic lease stealing.
20
- * Releasing the writer lock proves neither native child exit nor safe restore;
21
- * the injected runtime adapter must independently qualify that ownership.
22
- */
23
- export declare class HostServer {
24
- private readonly options;
25
- private readonly store;
26
- private readonly hostId;
27
- private readonly server;
28
- private readonly sockets;
29
- private readonly executing;
30
- private readonly nonces;
31
- private lease?;
32
- private ticket?;
33
- private candidate?;
34
- private activated?;
35
- private observed;
36
- private started;
37
- private closing;
38
- private stopped;
39
- private stopping?;
40
- private readonly timeout;
41
- private readonly lifetime;
42
- private readonly maxSockets;
43
- constructor(options: HostOptions);
44
- listen(): Promise<HostAddress>;
45
- /** Local owner API only; frontend detach and socket close never call this. */
46
- stop(timeoutMs?: number): Promise<void>;
47
- private receive;
48
- private route;
49
- private receipt;
50
- private requireLease;
51
- }
52
- //# sourceMappingURL=HostServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HostServer.d.ts","sourceRoot":"","sources":["../../src/sessionHost/HostServer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAA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AAC,QAAQ,CAAC,UAAU,CAAS;gBAEP,OAAO,EAAE,WAAW;IAyB3C,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IAYpC,8EAA8E;IAC9E,IAAI,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YAyBvB,OAAO;IA+CrB,OAAO,CAAC,KAAK;IA8Ib,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,YAAY;CAIrB"}
@@ -1,413 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HostServer = void 0;
7
- const http_1 = __importDefault(require("http"));
8
- const path_1 = __importDefault(require("path"));
9
- const OwnershipRuntime_1 = require("../delegation/OwnershipRuntime");
10
- const crypto_1 = require("crypto");
11
- const perf_hooks_1 = require("perf_hooks");
12
- const HostStore_1 = require("./HostStore");
13
- const HostProtocol_1 = require("./HostProtocol");
14
- /** Retains execution ownership independently of every HTTP frontend connection.
15
- * The trusted launcher passes address/credential out of band. Losing an HTTP
16
- * connection does not lose a lease: reconnect with the same lease or a prepared
17
- * successor ticket. No unauthenticated discovery or automatic lease stealing.
18
- * Releasing the writer lock proves neither native child exit nor safe restore;
19
- * the injected runtime adapter must independently qualify that ownership.
20
- */
21
- class HostServer {
22
- options;
23
- store;
24
- hostId = (0, crypto_1.randomUUID)();
25
- server;
26
- sockets = new Set();
27
- executing = new Set();
28
- nonces = new Map();
29
- lease;
30
- ticket;
31
- candidate;
32
- activated;
33
- observed = 0;
34
- started = false;
35
- closing = false;
36
- stopped = false;
37
- stopping;
38
- timeout;
39
- lifetime;
40
- maxSockets;
41
- constructor(options) {
42
- this.options = options;
43
- (0, HostProtocol_1.identifier)(options.installationId);
44
- (0, HostProtocol_1.identifier)(options.runtime.authorityId);
45
- (0, HostProtocol_1.secret)(options.secret);
46
- if (options.launcherSecret !== undefined) {
47
- (0, HostProtocol_1.secret)(options.launcherSecret);
48
- if (options.launcherSecret === options.secret)
49
- throw new HostProtocol_1.HostError('separate_launcher_credential_required');
50
- }
51
- this.timeout = options.requestTimeoutMs ?? 5000;
52
- this.lifetime = options.ticketLifetimeMs ?? 30_000;
53
- this.maxSockets = options.maxSockets ?? 16;
54
- for (const [n, max] of [[this.timeout, 30_000], [this.lifetime, 120_000], [this.maxSockets, 128]]) {
55
- if (!Number.isInteger(n) || n < 1 || n > max)
56
- throw new HostProtocol_1.HostError('invalid_limit');
57
- }
58
- this.store = new HostStore_1.HostStore(options.directory, (0, HostProtocol_1.digest)(options.installationId + '\0' + options.secret), options.limits);
59
- this.server = http_1.default.createServer((request, response) => { void this.receive(request, response); });
60
- this.server.headersTimeout = this.timeout;
61
- this.server.requestTimeout = this.timeout;
62
- this.server.keepAliveTimeout = 1;
63
- this.server.maxHeadersCount = 16;
64
- this.server.on('connection', socket => {
65
- if (this.closing || this.sockets.size >= this.maxSockets) {
66
- socket.destroy();
67
- return;
68
- }
69
- this.sockets.add(socket);
70
- const deadline = setTimeout(() => socket.destroy(), this.timeout);
71
- socket.setTimeout(this.timeout, () => socket.destroy());
72
- socket.once('close', () => { clearTimeout(deadline); this.sockets.delete(socket); });
73
- });
74
- this.server.on('clientError', (_error, socket) => socket.destroy());
75
- }
76
- async listen() {
77
- if (this.started || this.closing)
78
- throw new HostProtocol_1.HostError('host_already_started');
79
- this.started = true;
80
- try {
81
- await new Promise((resolve, reject) => {
82
- this.server.once('error', reject);
83
- this.server.listen(0, '127.0.0.1', () => { this.server.removeListener('error', reject); resolve(); });
84
- });
85
- }
86
- catch {
87
- this.store.close();
88
- this.closing = true;
89
- throw new HostProtocol_1.HostError('host_listen_failed');
90
- }
91
- return { port: this.server.address().port, hostId: this.hostId, installationId: this.options.installationId };
92
- }
93
- /** Local owner API only; frontend detach and socket close never call this. */
94
- stop(timeoutMs = 5000) {
95
- if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 30_000)
96
- return Promise.reject(new HostProtocol_1.HostError('invalid_limit'));
97
- if (this.stopped)
98
- return Promise.resolve();
99
- if (this.stopping)
100
- return this.stopping;
101
- try {
102
- this.options.runtime.assertCanStop?.();
103
- }
104
- catch (error) {
105
- return Promise.reject(error);
106
- }
107
- this.closing = true;
108
- for (const socket of this.sockets)
109
- socket.destroy();
110
- const closed = new Promise(resolve => this.server.close(() => resolve()));
111
- const work = (async () => {
112
- let timer;
113
- try {
114
- await Promise.race([
115
- (async () => { await this.options.runtime.stop(); await Promise.all([...this.executing]); await closed; })(),
116
- new Promise((_, reject) => { timer = setTimeout(() => reject(new HostProtocol_1.HostError('host_stop_unconfirmed')), timeoutMs); }),
117
- ]);
118
- this.store.close();
119
- this.stopped = true;
120
- }
121
- finally {
122
- if (timer)
123
- clearTimeout(timer);
124
- }
125
- })();
126
- this.stopping = work;
127
- // Failed stop retains the writer lock. The owner may explicitly retry after
128
- // its runtime settles; no new host may assume native retirement from a timeout.
129
- void work.finally(() => { if (!this.stopped)
130
- this.stopping = undefined; }).catch(() => { });
131
- return work;
132
- }
133
- async receive(request, response) {
134
- let authenticated;
135
- const answer = (status, value) => {
136
- const data = JSON.stringify(value);
137
- if (!response.destroyed) {
138
- response.writeHead(status, { 'Content-Type': 'application/json', Connection: 'close',
139
- ...(authenticated ? { 'x-session-host-signature': (0, HostProtocol_1.sign)(authenticated.key, 'response', authenticated.nonce, authenticated.timestamp, data) } : {}) });
140
- response.end(data);
141
- }
142
- };
143
- const deadline = setTimeout(() => request.destroy(), this.timeout);
144
- try {
145
- if (this.closing)
146
- throw new HostProtocol_1.HostError('host_closing');
147
- if (request.method !== 'POST' || request.url !== '/v1' || request.headers['content-type'] !== 'application/json')
148
- throw new HostProtocol_1.HostError('invalid_transport');
149
- const nonce = request.headers['x-session-host-nonce'];
150
- const timestamp = request.headers['x-session-host-time'];
151
- if (typeof nonce !== 'string' || !/^[a-f0-9]{64}$/.test(nonce) || typeof timestamp !== 'string'
152
- || !/^\d{1,16}$/.test(timestamp) || Math.abs(Date.now() - Number(timestamp)) > 30_000)
153
- throw new HostProtocol_1.HostError('unauthorized');
154
- const chunks = [];
155
- let size = 0;
156
- for await (const chunk of request) {
157
- size += chunk.length;
158
- if (size > HostProtocol_1.MAX_REQUEST_BYTES)
159
- throw new HostProtocol_1.HostError('request_too_large');
160
- chunks.push(Buffer.from(chunk));
161
- }
162
- const data = Buffer.concat(chunks).toString('utf8');
163
- const launcher = !!this.options.launcherSecret && (0, HostProtocol_1.matchesSignature)(request.headers['x-session-host-signature'], (0, HostProtocol_1.sign)(this.options.launcherSecret, 'request', nonce, timestamp, data));
164
- const key = launcher ? this.options.launcherSecret : this.options.secret;
165
- if (!(0, HostProtocol_1.matchesSignature)(request.headers['x-session-host-signature'], (0, HostProtocol_1.sign)(key, 'request', nonce, timestamp, data)))
166
- throw new HostProtocol_1.HostError('unauthorized');
167
- authenticated = { nonce, timestamp, key, launcher };
168
- const now = perf_hooks_1.performance.now();
169
- for (const [key, expiry] of this.nonces)
170
- if (expiry <= now)
171
- this.nonces.delete(key);
172
- if (this.nonces.has(nonce))
173
- throw new HostProtocol_1.HostError('replayed_request');
174
- if (this.nonces.size >= 1024)
175
- throw new HostProtocol_1.HostError('authentication_capacity');
176
- this.nonces.set(nonce, now + 65_000);
177
- const envelope = JSON.parse(data);
178
- (0, HostProtocol_1.fields)(envelope, ['protocol', 'installationId', 'hostId', 'method', 'body']);
179
- if (envelope.protocol !== HostProtocol_1.HOST_PROTOCOL || envelope.installationId !== this.options.installationId || envelope.hostId !== this.hostId)
180
- throw new HostProtocol_1.HostError('host_identity_mismatch');
181
- if (typeof envelope.method !== 'string')
182
- throw new HostProtocol_1.HostError('invalid_request');
183
- answer(200, { ok: true, protocol: HostProtocol_1.HOST_PROTOCOL, hostId: this.hostId, value: await this.route(envelope.method, envelope.body, authenticated.launcher) });
184
- }
185
- catch (error) {
186
- // Neither native exception strings nor credentials/addresses cross this boundary.
187
- answer(error instanceof HostProtocol_1.HostError && error.code === 'unauthorized' ? 401 : 400, { ok: false, code: error instanceof HostProtocol_1.HostError ? error.code : 'invalid_request' });
188
- request.resume();
189
- }
190
- finally {
191
- clearTimeout(deadline);
192
- }
193
- }
194
- route(method, body, launcher = false) {
195
- if (this.closing)
196
- throw new HostProtocol_1.HostError('host_closing');
197
- if (method === 'hello') {
198
- (0, HostProtocol_1.fields)(body, []);
199
- return { capabilities: HostProtocol_1.HOST_CAPABILITIES, authorityId: this.options.runtime.authorityId,
200
- acceptedThrough: this.store.snapshot().acceptedThrough, retiredThrough: this.store.snapshot().retiredThrough, epoch: this.store.snapshot().epoch, acknowledged: this.store.snapshot().acknowledged,
201
- active: !!this.lease, storageHealthy: !this.store.failed };
202
- }
203
- if (this.store.failed)
204
- throw new HostProtocol_1.HostError('storage_unavailable');
205
- if (method === 'recoverFrontend') {
206
- (0, HostProtocol_1.fields)(body, ['frontendId', 'epoch']);
207
- (0, HostProtocol_1.identifier)(body.frontendId);
208
- (0, HostProtocol_1.integer)(body.epoch);
209
- if (!launcher)
210
- throw new HostProtocol_1.HostError('launcher_authority_required');
211
- if (body.epoch !== this.store.snapshot().epoch)
212
- throw new HostProtocol_1.HostError('stale_epoch');
213
- const proof = (0, OwnershipRuntime_1.kernelGate)(path_1.default.join(this.options.directory, 'frontend.lock'));
214
- if (!proof)
215
- throw new HostProtocol_1.HostError('frontend_still_alive');
216
- try {
217
- this.store.change(state => { state.epoch++; });
218
- this.lease = { frontendId: body.frontendId, epoch: this.store.snapshot().epoch, token: (0, crypto_1.randomBytes)(32).toString('hex') };
219
- this.ticket = undefined;
220
- this.candidate = undefined;
221
- this.activated = undefined;
222
- this.observed = this.store.snapshot().acknowledged;
223
- return this.lease;
224
- }
225
- finally {
226
- proof.close();
227
- }
228
- }
229
- if (launcher)
230
- throw new HostProtocol_1.HostError('frontend_authority_required');
231
- if (method === 'inspect') {
232
- (0, HostProtocol_1.fields)(body, ['lease', 'operation', 'args']);
233
- this.requireLease(body.lease);
234
- (0, HostProtocol_1.identifier)(body.operation);
235
- if (!this.options.runtime.inspect)
236
- throw new HostProtocol_1.HostError('runtime_inspection_unavailable');
237
- return this.options.runtime.inspect(body.operation, (0, HostProtocol_1.payload)(body.args));
238
- }
239
- if (method === 'prepare') {
240
- (0, HostProtocol_1.fields)(body, ['lease', 'successorId']);
241
- this.requireLease(body.lease);
242
- (0, HostProtocol_1.identifier)(body.successorId);
243
- if (body.successorId === this.lease.frontendId)
244
- throw new HostProtocol_1.HostError('invalid_successor');
245
- if (this.ticket && this.ticket.deadline > perf_hooks_1.performance.now()) {
246
- if (this.ticket.frontendId !== body.successorId || this.ticket.attached)
247
- throw new HostProtocol_1.HostError('replacement_pending');
248
- return { ticket: this.ticket.token, expires: this.ticket.expires };
249
- }
250
- this.candidate = undefined;
251
- this.ticket = { frontendId: body.successorId, epoch: this.lease.epoch, token: (0, crypto_1.randomBytes)(32).toString('hex'),
252
- expires: Date.now() + this.lifetime, deadline: perf_hooks_1.performance.now() + this.lifetime, attached: false };
253
- return { ticket: this.ticket.token, expires: this.ticket.expires };
254
- }
255
- if (method === 'attach') {
256
- (0, HostProtocol_1.fields)(body, ['frontendId', 'epoch'], ['ticket']);
257
- (0, HostProtocol_1.identifier)(body.frontendId);
258
- (0, HostProtocol_1.integer)(body.epoch);
259
- if (body.epoch !== this.store.snapshot().epoch)
260
- throw new HostProtocol_1.HostError('stale_epoch');
261
- if (this.candidate && this.candidate.deadline > perf_hooks_1.performance.now())
262
- throw new HostProtocol_1.HostError('replacement_pending');
263
- if (this.lease) {
264
- if (!this.ticket || this.ticket.attached || this.ticket.token !== body.ticket || this.ticket.frontendId !== body.frontendId
265
- || this.ticket.epoch !== body.epoch || this.ticket.deadline <= perf_hooks_1.performance.now())
266
- throw new HostProtocol_1.HostError('invalid_ticket');
267
- this.ticket.attached = true;
268
- }
269
- else if (body.ticket !== undefined)
270
- throw new HostProtocol_1.HostError('invalid_ticket');
271
- this.candidate = { frontendId: body.frontendId, epoch: body.epoch, token: (0, crypto_1.randomBytes)(32).toString('hex'),
272
- expires: this.lease ? this.ticket.expires : Date.now() + this.lifetime,
273
- deadline: this.lease ? this.ticket.deadline : perf_hooks_1.performance.now() + this.lifetime };
274
- return { attachment: this.candidate.token, expires: this.candidate.expires };
275
- }
276
- if (method === 'activate') {
277
- (0, HostProtocol_1.fields)(body, ['frontendId', 'epoch', 'attachment']);
278
- (0, HostProtocol_1.identifier)(body.frontendId);
279
- (0, HostProtocol_1.integer)(body.epoch);
280
- (0, HostProtocol_1.secret)(body.attachment);
281
- if (this.activated?.token === body.attachment && this.lease?.frontendId === body.frontendId
282
- && this.activated.lease.epoch === this.lease.epoch && body.epoch + 1 === this.lease.epoch)
283
- return this.lease;
284
- const candidate = this.candidate;
285
- if (!candidate || candidate.token !== body.attachment || candidate.frontendId !== body.frontendId
286
- || candidate.epoch !== body.epoch || candidate.epoch !== this.store.snapshot().epoch || candidate.deadline <= perf_hooks_1.performance.now())
287
- throw new HostProtocol_1.HostError('invalid_attachment');
288
- this.store.change(state => { state.epoch++; });
289
- this.lease = { frontendId: candidate.frontendId, epoch: this.store.snapshot().epoch, token: (0, crypto_1.randomBytes)(32).toString('hex') };
290
- this.activated = { token: candidate.token, lease: this.lease };
291
- this.candidate = undefined;
292
- this.ticket = undefined;
293
- this.observed = this.store.snapshot().acknowledged;
294
- return this.lease;
295
- }
296
- if (method === 'detach') {
297
- (0, HostProtocol_1.fields)(body, ['lease']);
298
- this.requireLease(body.lease);
299
- this.store.change(state => { state.epoch++; });
300
- this.lease = undefined;
301
- this.candidate = undefined;
302
- this.ticket = undefined;
303
- this.activated = undefined;
304
- return { detached: true };
305
- }
306
- if (method === 'submit') {
307
- (0, HostProtocol_1.fields)(body, ['lease', 'requestId', 'operation', 'args'], ['requestSequence']);
308
- this.requireLease(body.lease);
309
- (0, HostProtocol_1.identifier)(body.requestId);
310
- (0, HostProtocol_1.identifier)(body.operation);
311
- const args = (0, HostProtocol_1.payload)(body.args);
312
- const hash = (0, HostProtocol_1.digest)((0, HostProtocol_1.canonical)([body.operation, args]));
313
- const state = this.store.snapshot();
314
- let requestSequence;
315
- if (body.requestSequence !== undefined) {
316
- (0, HostProtocol_1.integer)(body.requestSequence);
317
- requestSequence = body.requestSequence;
318
- if (body.requestId !== `sequenced-${requestSequence}`)
319
- throw new HostProtocol_1.HostError('invalid_request_sequence');
320
- if (requestSequence <= state.retiredThrough)
321
- throw new HostProtocol_1.HostError('request_retired');
322
- }
323
- else if (body.requestId.startsWith('sequenced-'))
324
- throw new HostProtocol_1.HostError('invalid_request_sequence');
325
- const previous = state.operations.find(op => op.requestId === body.requestId);
326
- if (previous) {
327
- if (previous.requestSequence !== requestSequence)
328
- throw new HostProtocol_1.HostError('invalid_request_sequence');
329
- if (previous.digest !== hash)
330
- throw new HostProtocol_1.HostError('request_digest_mismatch');
331
- return this.receipt(previous);
332
- }
333
- if (requestSequence !== undefined && requestSequence !== state.acceptedThrough + 1)
334
- throw new HostProtocol_1.HostError('request_sequence_gap');
335
- if (state.operations.length >= this.store.limits.operations
336
- || state.events.length + state.operations.filter(op => op.status === 'pending').length >= this.store.limits.events)
337
- throw new HostProtocol_1.HostError('capacity_exhausted');
338
- const accepted = { requestId: body.requestId, status: 'pending' };
339
- this.store.change(next => { next.operations.push({ ...accepted, digest: hash, ...(requestSequence !== undefined ? { requestSequence } : {}) }); if (requestSequence !== undefined)
340
- next.acceptedThrough = requestSequence; });
341
- const operation = { requestId: body.requestId, method: body.operation, args };
342
- // Dispatch only this freshly committed acceptance; reconnects never enter here.
343
- const work = Promise.resolve().then(async () => {
344
- let completed;
345
- try {
346
- const result = await this.options.runtime.execute(operation);
347
- try {
348
- completed = { ...accepted, status: 'completed', result: (0, HostProtocol_1.payload)(result) };
349
- }
350
- catch {
351
- completed = { ...accepted, status: 'failed', error: 'invalid_runtime_result' };
352
- }
353
- }
354
- catch {
355
- completed = { ...accepted, status: 'failed', error: 'runtime_failed' };
356
- }
357
- this.store.change(next => {
358
- Object.assign(next.operations.find(op => op.requestId === operation.requestId), completed);
359
- this.store.addEvent(next, completed);
360
- });
361
- }).catch(() => { });
362
- this.executing.add(work);
363
- void work.finally(() => this.executing.delete(work));
364
- return accepted;
365
- }
366
- if (method === 'status') {
367
- (0, HostProtocol_1.fields)(body, ['lease', 'requestId']);
368
- this.requireLease(body.lease);
369
- (0, HostProtocol_1.identifier)(body.requestId);
370
- const operation = this.store.snapshot().operations.find(op => op.requestId === body.requestId);
371
- if (!operation)
372
- throw new HostProtocol_1.HostError('request_not_found');
373
- return this.receipt(operation);
374
- }
375
- if (method === 'events') {
376
- (0, HostProtocol_1.fields)(body, ['lease', 'after']);
377
- this.requireLease(body.lease);
378
- (0, HostProtocol_1.integer)(body.after);
379
- const after = body.after;
380
- const state = this.store.snapshot();
381
- if (after < state.acknowledged || after > state.sequence)
382
- throw new HostProtocol_1.HostError('cursor_unavailable');
383
- // Replaying from an older cursor is harmless; skipping unseen output cannot
384
- // grant ACK authority. Each new lease must observe the unacknowledged prefix.
385
- if (after > this.observed)
386
- throw new HostProtocol_1.HostError('cursor_not_observed');
387
- this.observed = state.sequence;
388
- return { acknowledged: state.acknowledged, through: state.sequence, events: state.events.filter(event => event.sequence > after) };
389
- }
390
- if (method === 'ack') {
391
- (0, HostProtocol_1.fields)(body, ['lease', 'through']);
392
- this.requireLease(body.lease);
393
- (0, HostProtocol_1.integer)(body.through);
394
- const through = body.through;
395
- if (through > this.observed || through < this.store.snapshot().acknowledged)
396
- throw new HostProtocol_1.HostError('ack_not_observed');
397
- this.store.change(state => { state.acknowledged = through; state.events = state.events.filter(event => event.sequence > through); this.store.compactAcknowledged(state); });
398
- return { acknowledged: through };
399
- }
400
- throw new HostProtocol_1.HostError('unknown_method');
401
- }
402
- receipt(operation) {
403
- const { requestId, status, result, error } = operation;
404
- return { requestId, status, ...(result !== undefined ? { result } : {}), ...(error ? { error } : {}) };
405
- }
406
- requireLease(value) {
407
- (0, HostProtocol_1.fields)(value, ['frontendId', 'epoch', 'token']);
408
- if (!this.lease || value.frontendId !== this.lease.frontendId || value.epoch !== this.lease.epoch || value.token !== this.lease.token)
409
- throw new HostProtocol_1.HostError('stale_lease');
410
- }
411
- }
412
- exports.HostServer = HostServer;
413
- //# sourceMappingURL=HostServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HostServer.js","sourceRoot":"","sources":["../../src/sessionHost/HostServer.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,gDAAwB;AACxB,qEAA4D;AAC5D,mCAAiD;AACjD,2CAAyC;AAEzC,2CAAyD;AACzD,iDAEgD;AAkBhD;;;;;;GAMG;AACH,MAAa,UAAU;IAoBQ;IAnBZ,KAAK,CAAY;IACjB,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IACtB,MAAM,CAAc;IACpB,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5B,SAAS,GAAG,IAAI,GAAG,EAAiB,CAAC;IACrC,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,CAAiB;IACtB,MAAM,CAAU;IAChB,SAAS,CAAa;IACtB,SAAS,CAA2C;IACpD,QAAQ,GAAG,CAAC,CAAC;IACb,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,CAAiB;IAChB,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,UAAU,CAAS;IAEpC,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QAC/C,IAAA,yBAAU,EAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAAC,IAAA,yBAAU,EAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAAC,IAAA,qBAAM,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpG,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YAAC,IAAA,qBAAM,EAAC,OAAO,CAAC,cAAc,CAA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from './HostProtocol';
2
- interface StoredOperation extends OperationReceipt {
3
- digest: string;
4
- requestSequence?: number;
5
- }
6
- export interface HostState {
7
- version: 2;
8
- acceptedThrough: number;
9
- retiredThrough: number;
10
- binding: string;
11
- epoch: number;
12
- sequence: number;
13
- acknowledged: number;
14
- operations: StoredOperation[];
15
- events: HostEvent[];
16
- }
17
- export interface HostLimits {
18
- operations: number;
19
- events: number;
20
- }
21
- /** Synchronous, bounded transactions: no await can interleave acceptance and dispatch. */
22
- export declare class HostStore {
23
- private gate;
24
- private readonly file;
25
- private readonly directory;
26
- private readonly identity;
27
- private value;
28
- private faulted;
29
- private closed;
30
- readonly limits: HostLimits;
31
- constructor(directory: string, binding: string, limits?: HostLimits);
32
- get failed(): boolean;
33
- snapshot(): HostState;
34
- change(update: (next: HostState) => void): void;
35
- addEvent(state: HostState, receipt: OperationReceipt): void;
36
- compactAcknowledged(state: HostState): void;
37
- close(): void;
38
- private checkFile;
39
- private validate;
40
- private validateReceipt;
41
- }
42
- export {};
43
- //# sourceMappingURL=HostStore.d.ts.map