@makerbi/remodex 1.5.4 → 2.0.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/bin/remodex.js +77 -13
- 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 +3 -2
- package/src/bridge.js +837 -73
- package/src/codex-transport.js +10 -10
- package/src/desktop-handler.js +14 -1
- package/src/desktop-ipc-action-follower.js +129 -0
- package/src/git-handler.js +92 -28
- package/src/index.js +4 -2
- package/src/ios-app-compatibility.js +7 -7
- package/src/macos-launch-agent.js +132 -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/qr.js +2 -5
- package/src/rollout-live-mirror.js +331 -20
- package/src/rollout-watch.js +5 -1
- package/src/secure-device-state.js +66 -2
- package/src/secure-transport.js +47 -12
- package/src/session-jsonl-history.js +850 -16
- package/src/voice-handler.js +162 -65
- package/src/workspace-handler.js +327 -14
package/src/secure-transport.js
CHANGED
|
@@ -37,9 +37,13 @@ function createBridgeSecureTransport({
|
|
|
37
37
|
sessionId,
|
|
38
38
|
relayUrl,
|
|
39
39
|
deviceState,
|
|
40
|
+
displayName = "",
|
|
40
41
|
onTrustedPhoneUpdate = null,
|
|
42
|
+
onSecureSessionReady = null,
|
|
43
|
+
persistTrustedPhone = true,
|
|
41
44
|
}) {
|
|
42
45
|
let currentDeviceState = deviceState;
|
|
46
|
+
const bridgeDisplayName = normalizeNonEmptyString(displayName);
|
|
43
47
|
let pendingHandshake = null;
|
|
44
48
|
let activeSession = null;
|
|
45
49
|
let liveSendWireMessage = null;
|
|
@@ -61,6 +65,7 @@ function createBridgeSecureTransport({
|
|
|
61
65
|
macDeviceId: currentDeviceState.macDeviceId,
|
|
62
66
|
macIdentityPublicKey: currentDeviceState.macIdentityPublicKey,
|
|
63
67
|
expiresAt: currentPairingExpiresAt,
|
|
68
|
+
displayName: bridgeDisplayName,
|
|
64
69
|
};
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -259,6 +264,7 @@ function createBridgeSecureTransport({
|
|
|
259
264
|
expiresAtForTranscript,
|
|
260
265
|
macSignature,
|
|
261
266
|
clientNonce: clientNonceBase64,
|
|
267
|
+
displayName: bridgeDisplayName,
|
|
262
268
|
});
|
|
263
269
|
}
|
|
264
270
|
|
|
@@ -346,6 +352,7 @@ function createBridgeSecureTransport({
|
|
|
346
352
|
nextOutboundCounter: 0,
|
|
347
353
|
isResumed: false,
|
|
348
354
|
sendWireMessage: liveSendWireMessage,
|
|
355
|
+
firstOutboundSeq: nextBridgeOutboundSeq,
|
|
349
356
|
};
|
|
350
357
|
|
|
351
358
|
nextKeyEpoch = pendingHandshake.keyEpoch + 1;
|
|
@@ -361,7 +368,8 @@ function createBridgeSecureTransport({
|
|
|
361
368
|
currentDeviceState = rememberTrustedPhone(
|
|
362
369
|
currentDeviceState,
|
|
363
370
|
pendingHandshake.phoneDeviceId,
|
|
364
|
-
pendingHandshake.phoneIdentityPublicKey
|
|
371
|
+
pendingHandshake.phoneIdentityPublicKey,
|
|
372
|
+
{ persist: persistTrustedPhone }
|
|
365
373
|
);
|
|
366
374
|
if (previousTrustedPhonePublicKey !== pendingHandshake.phoneIdentityPublicKey) {
|
|
367
375
|
onTrustedPhoneUpdate?.(currentDeviceState, {
|
|
@@ -372,9 +380,16 @@ function createBridgeSecureTransport({
|
|
|
372
380
|
}
|
|
373
381
|
if (pendingHandshake.handshakeMode === HANDSHAKE_MODE_QR_BOOTSTRAP) {
|
|
374
382
|
resetOutboundReplayState();
|
|
383
|
+
activeSession.firstOutboundSeq = nextBridgeOutboundSeq;
|
|
375
384
|
}
|
|
376
385
|
|
|
386
|
+
const completedHandshakeMode = pendingHandshake.handshakeMode;
|
|
377
387
|
pendingHandshake = null;
|
|
388
|
+
onSecureSessionReady?.({
|
|
389
|
+
phoneDeviceId: activeSession.phoneDeviceId,
|
|
390
|
+
handshakeMode: completedHandshakeMode,
|
|
391
|
+
keyEpoch: activeSession.keyEpoch,
|
|
392
|
+
});
|
|
378
393
|
sendControlMessage({
|
|
379
394
|
kind: "secureReady",
|
|
380
395
|
sessionId,
|
|
@@ -396,7 +411,9 @@ function createBridgeSecureTransport({
|
|
|
396
411
|
|
|
397
412
|
const lastAppliedBridgeOutboundSeq = Number(message.lastAppliedBridgeOutboundSeq) || 0;
|
|
398
413
|
lastRelayedBridgeOutboundSeq = lastAppliedBridgeOutboundSeq;
|
|
399
|
-
const missingEntries = replayableOutboundEntries(lastAppliedBridgeOutboundSeq
|
|
414
|
+
const missingEntries = replayableOutboundEntries(lastAppliedBridgeOutboundSeq, {
|
|
415
|
+
includeCurrentSessionEntries: true,
|
|
416
|
+
});
|
|
400
417
|
activeSession.isResumed = true;
|
|
401
418
|
for (const entry of missingEntries) {
|
|
402
419
|
if (!sendBufferedEntry(entry, activeSession.sendWireMessage)) {
|
|
@@ -465,15 +482,22 @@ function createBridgeSecureTransport({
|
|
|
465
482
|
}
|
|
466
483
|
|
|
467
484
|
function trimOutboundBuffer() {
|
|
485
|
+
let removeCount = 0;
|
|
486
|
+
let removedBytes = 0;
|
|
468
487
|
while (
|
|
469
|
-
outboundBuffer.length > MAX_BRIDGE_OUTBOUND_MESSAGES
|
|
470
|
-
|| outboundBufferBytes > MAX_BRIDGE_OUTBOUND_BYTES
|
|
488
|
+
(outboundBuffer.length - removeCount) > MAX_BRIDGE_OUTBOUND_MESSAGES
|
|
489
|
+
|| (outboundBufferBytes - removedBytes) > MAX_BRIDGE_OUTBOUND_BYTES
|
|
471
490
|
) {
|
|
472
|
-
const
|
|
473
|
-
if (!
|
|
491
|
+
const entry = outboundBuffer[removeCount];
|
|
492
|
+
if (!entry) {
|
|
474
493
|
break;
|
|
475
494
|
}
|
|
476
|
-
|
|
495
|
+
removedBytes += entry.sizeBytes;
|
|
496
|
+
removeCount += 1;
|
|
497
|
+
}
|
|
498
|
+
if (removeCount > 0) {
|
|
499
|
+
outboundBuffer.splice(0, removeCount);
|
|
500
|
+
outboundBufferBytes = Math.max(0, outboundBufferBytes - removedBytes);
|
|
477
501
|
}
|
|
478
502
|
}
|
|
479
503
|
|
|
@@ -505,10 +529,21 @@ function createBridgeSecureTransport({
|
|
|
505
529
|
return sendWireMessage(JSON.stringify(envelope)) !== false;
|
|
506
530
|
}
|
|
507
531
|
|
|
508
|
-
function replayableOutboundEntries(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
532
|
+
function replayableOutboundEntries(
|
|
533
|
+
lastAppliedBridgeOutboundSeq,
|
|
534
|
+
{ includeCurrentSessionEntries = false } = {}
|
|
535
|
+
) {
|
|
536
|
+
return outboundBuffer.filter((entry) => {
|
|
537
|
+
if (entry.bridgeOutboundSeq > lastAppliedBridgeOutboundSeq) {
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Stale cursors from a previous Mac/session must not suppress responses
|
|
542
|
+
// produced after this secure channel became active, including initialize.
|
|
543
|
+
return includeCurrentSessionEntries
|
|
544
|
+
&& activeSession
|
|
545
|
+
&& entry.bridgeOutboundSeq >= activeSession.firstOutboundSeq;
|
|
546
|
+
});
|
|
512
547
|
}
|
|
513
548
|
|
|
514
549
|
// Replays from the last phone ack instead of local socket writes, so a relay
|
|
@@ -542,7 +577,7 @@ function debugSecureLog(message) {
|
|
|
542
577
|
|
|
543
578
|
function shortId(value) {
|
|
544
579
|
const normalized = normalizeNonEmptyString(value);
|
|
545
|
-
return normalized ? normalized.slice(0, 8) : "none";
|
|
580
|
+
return normalized ? createHash("sha256").update(normalized).digest("hex").slice(0, 8) : "none";
|
|
546
581
|
}
|
|
547
582
|
|
|
548
583
|
function shortFingerprint(publicKeyBase64) {
|