@makerbi/remodex 1.5.3 → 1.5.8
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/bin/remodex-jsonl-diagnose.js +0 -0
- package/bin/remodex.js +42 -10
- package/package.json +1 -1
- package/src/account-status.js +7 -1
- package/src/apply-patch-changes.js +185 -0
- package/src/bootstrap-codex-cli.js +1 -1
- package/src/bridge-status.js +122 -0
- package/src/bridge.js +823 -157
- package/src/codex-transport.js +38 -11
- package/src/desktop-handler.js +14 -1
- package/src/desktop-ipc-action-follower.js +173 -1
- package/src/index.js +4 -2
- package/src/macos-launch-agent.js +87 -2
- package/src/project-handler.js +162 -1
- package/src/push-notification-service-client.js +85 -37
- package/src/push-notification-tracker.js +15 -0
- package/src/rollout-live-mirror.js +331 -20
- package/src/rollout-watch.js +5 -1
- package/src/secure-device-state.js +26 -1
- package/src/secure-transport.js +40 -12
- package/src/session-jsonl-history.js +860 -14
- package/src/voice-handler.js +129 -62
- package/src/workspace-handler.js +327 -14
- package/src/private-defaults.json +0 -4
package/src/secure-transport.js
CHANGED
|
@@ -37,9 +37,12 @@ function createBridgeSecureTransport({
|
|
|
37
37
|
sessionId,
|
|
38
38
|
relayUrl,
|
|
39
39
|
deviceState,
|
|
40
|
+
displayName = "",
|
|
40
41
|
onTrustedPhoneUpdate = null,
|
|
42
|
+
persistTrustedPhone = true,
|
|
41
43
|
}) {
|
|
42
44
|
let currentDeviceState = deviceState;
|
|
45
|
+
const bridgeDisplayName = normalizeNonEmptyString(displayName);
|
|
43
46
|
let pendingHandshake = null;
|
|
44
47
|
let activeSession = null;
|
|
45
48
|
let liveSendWireMessage = null;
|
|
@@ -61,6 +64,7 @@ function createBridgeSecureTransport({
|
|
|
61
64
|
macDeviceId: currentDeviceState.macDeviceId,
|
|
62
65
|
macIdentityPublicKey: currentDeviceState.macIdentityPublicKey,
|
|
63
66
|
expiresAt: currentPairingExpiresAt,
|
|
67
|
+
displayName: bridgeDisplayName,
|
|
64
68
|
};
|
|
65
69
|
}
|
|
66
70
|
|
|
@@ -259,6 +263,7 @@ function createBridgeSecureTransport({
|
|
|
259
263
|
expiresAtForTranscript,
|
|
260
264
|
macSignature,
|
|
261
265
|
clientNonce: clientNonceBase64,
|
|
266
|
+
displayName: bridgeDisplayName,
|
|
262
267
|
});
|
|
263
268
|
}
|
|
264
269
|
|
|
@@ -346,6 +351,7 @@ function createBridgeSecureTransport({
|
|
|
346
351
|
nextOutboundCounter: 0,
|
|
347
352
|
isResumed: false,
|
|
348
353
|
sendWireMessage: liveSendWireMessage,
|
|
354
|
+
firstOutboundSeq: nextBridgeOutboundSeq,
|
|
349
355
|
};
|
|
350
356
|
|
|
351
357
|
nextKeyEpoch = pendingHandshake.keyEpoch + 1;
|
|
@@ -361,7 +367,8 @@ function createBridgeSecureTransport({
|
|
|
361
367
|
currentDeviceState = rememberTrustedPhone(
|
|
362
368
|
currentDeviceState,
|
|
363
369
|
pendingHandshake.phoneDeviceId,
|
|
364
|
-
pendingHandshake.phoneIdentityPublicKey
|
|
370
|
+
pendingHandshake.phoneIdentityPublicKey,
|
|
371
|
+
{ persist: persistTrustedPhone }
|
|
365
372
|
);
|
|
366
373
|
if (previousTrustedPhonePublicKey !== pendingHandshake.phoneIdentityPublicKey) {
|
|
367
374
|
onTrustedPhoneUpdate?.(currentDeviceState, {
|
|
@@ -372,6 +379,7 @@ function createBridgeSecureTransport({
|
|
|
372
379
|
}
|
|
373
380
|
if (pendingHandshake.handshakeMode === HANDSHAKE_MODE_QR_BOOTSTRAP) {
|
|
374
381
|
resetOutboundReplayState();
|
|
382
|
+
activeSession.firstOutboundSeq = nextBridgeOutboundSeq;
|
|
375
383
|
}
|
|
376
384
|
|
|
377
385
|
pendingHandshake = null;
|
|
@@ -396,7 +404,9 @@ function createBridgeSecureTransport({
|
|
|
396
404
|
|
|
397
405
|
const lastAppliedBridgeOutboundSeq = Number(message.lastAppliedBridgeOutboundSeq) || 0;
|
|
398
406
|
lastRelayedBridgeOutboundSeq = lastAppliedBridgeOutboundSeq;
|
|
399
|
-
const missingEntries = replayableOutboundEntries(lastAppliedBridgeOutboundSeq
|
|
407
|
+
const missingEntries = replayableOutboundEntries(lastAppliedBridgeOutboundSeq, {
|
|
408
|
+
includeCurrentSessionEntries: true,
|
|
409
|
+
});
|
|
400
410
|
activeSession.isResumed = true;
|
|
401
411
|
for (const entry of missingEntries) {
|
|
402
412
|
if (!sendBufferedEntry(entry, activeSession.sendWireMessage)) {
|
|
@@ -465,15 +475,22 @@ function createBridgeSecureTransport({
|
|
|
465
475
|
}
|
|
466
476
|
|
|
467
477
|
function trimOutboundBuffer() {
|
|
478
|
+
let removeCount = 0;
|
|
479
|
+
let removedBytes = 0;
|
|
468
480
|
while (
|
|
469
|
-
outboundBuffer.length > MAX_BRIDGE_OUTBOUND_MESSAGES
|
|
470
|
-
|| outboundBufferBytes > MAX_BRIDGE_OUTBOUND_BYTES
|
|
481
|
+
(outboundBuffer.length - removeCount) > MAX_BRIDGE_OUTBOUND_MESSAGES
|
|
482
|
+
|| (outboundBufferBytes - removedBytes) > MAX_BRIDGE_OUTBOUND_BYTES
|
|
471
483
|
) {
|
|
472
|
-
const
|
|
473
|
-
if (!
|
|
484
|
+
const entry = outboundBuffer[removeCount];
|
|
485
|
+
if (!entry) {
|
|
474
486
|
break;
|
|
475
487
|
}
|
|
476
|
-
|
|
488
|
+
removedBytes += entry.sizeBytes;
|
|
489
|
+
removeCount += 1;
|
|
490
|
+
}
|
|
491
|
+
if (removeCount > 0) {
|
|
492
|
+
outboundBuffer.splice(0, removeCount);
|
|
493
|
+
outboundBufferBytes = Math.max(0, outboundBufferBytes - removedBytes);
|
|
477
494
|
}
|
|
478
495
|
}
|
|
479
496
|
|
|
@@ -505,10 +522,21 @@ function createBridgeSecureTransport({
|
|
|
505
522
|
return sendWireMessage(JSON.stringify(envelope)) !== false;
|
|
506
523
|
}
|
|
507
524
|
|
|
508
|
-
function replayableOutboundEntries(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
525
|
+
function replayableOutboundEntries(
|
|
526
|
+
lastAppliedBridgeOutboundSeq,
|
|
527
|
+
{ includeCurrentSessionEntries = false } = {}
|
|
528
|
+
) {
|
|
529
|
+
return outboundBuffer.filter((entry) => {
|
|
530
|
+
if (entry.bridgeOutboundSeq > lastAppliedBridgeOutboundSeq) {
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Stale cursors from a previous Mac/session must not suppress responses
|
|
535
|
+
// produced after this secure channel became active, including initialize.
|
|
536
|
+
return includeCurrentSessionEntries
|
|
537
|
+
&& activeSession
|
|
538
|
+
&& entry.bridgeOutboundSeq >= activeSession.firstOutboundSeq;
|
|
539
|
+
});
|
|
512
540
|
}
|
|
513
541
|
|
|
514
542
|
// Replays from the last phone ack instead of local socket writes, so a relay
|
|
@@ -542,7 +570,7 @@ function debugSecureLog(message) {
|
|
|
542
570
|
|
|
543
571
|
function shortId(value) {
|
|
544
572
|
const normalized = normalizeNonEmptyString(value);
|
|
545
|
-
return normalized ? normalized.slice(0, 8) : "none";
|
|
573
|
+
return normalized ? createHash("sha256").update(normalized).digest("hex").slice(0, 8) : "none";
|
|
546
574
|
}
|
|
547
575
|
|
|
548
576
|
function shortFingerprint(publicKeyBase64) {
|