lody 0.110.0 → 0.110.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-interaction-owner-CdfQZsA1.js → acp-interaction-owner-CcAOYmEj.js} +4 -4
- package/dist/{agent-execution-BDaiNzV1.js → agent-execution-DbMHu2MY.js} +73 -3
- package/dist/chunks/{vendor-diff-1FyGa8Sd.js → vendor-diff-CPHd5agL.js} +251 -1
- package/dist/{client-CdDGKDiJ.js → client-CBW0Grpt.js} +4 -4
- package/dist/{code-collab-Q9UJxF5f.js → code-collab-COUEig0Z.js} +238 -155
- package/dist/{daemon-session-tools-B2o_Rn8o.js → daemon-session-tools-DgWu5_Fi.js} +4 -4
- package/dist/{diff-line-counts-Cfd7ywAS.js → diff-line-counts-C4QnbxuZ.js} +2 -2
- package/dist/{diff-worker-task-D7Ri1Pxx.js → diff-worker-task-CRv8CGSL.js} +2 -2
- package/dist/diff-worker.js +3 -3
- package/dist/{directory-handle-D3jV-baK.js → directory-handle-DT-Xm7WB.js} +5 -5
- package/dist/{dsh-plugins-bpB7jsn7.js → dsh-plugins-D2C2tzW9.js} +10 -10
- package/dist/file-index-scan-worker.js +4 -4
- package/dist/{file-lock-De7Gp7uV.js → file-lock-Ct7V9_V7.js} +5 -5
- package/dist/{index-DCvrDzQ4.js → index-C4-tIIH9.js} +5 -5
- package/dist/{index-Ct3cdpLb.js → index-Drq2NUA9.js} +95 -93
- package/dist/{index-CCkzRWUs.js → index-FDl9UATC.js} +7 -7
- package/dist/{index-Dr_w9T6F.js → index-R0ifto56.js} +5 -5
- package/dist/index.js +4 -4
- package/dist/{register-D7pWlArd.js → register-DDeKCzbJ.js} +1012 -83
- package/dist/{remote-pairing-1sJYblth.js → remote-pairing-CcEqyvpe.js} +5 -5
- package/dist/{reset-identity-DdzOplMy.js → reset-identity-E0bQ4nDX.js} +6 -6
- package/dist/{review-viewer-Be1SFRPK.js → review-viewer-CuYdljPk.js} +2 -2
- package/dist/{schedule-command-client--Bl9vjMS.js → schedule-command-client-SjsG4n0y.js} +4 -4
- package/dist/{telemetry-CHUhwRVv.js → telemetry-CztoQabb.js} +1155 -751
- package/dist/turn-diff-store-worker.js +92 -4
- package/dist/{workspace-legacy-CAbHfoet.js → workspace-legacy-Cu3kw51y.js} +246 -113
- package/package.json +1 -1
|
@@ -9,12 +9,12 @@ import { C as CipherSuite, H as HkdfSha256$1, D as DhkemX25519HkdfSha256 } from
|
|
|
9
9
|
import { C as Chacha20Poly1305 } from "./chunks/vendor-@hpke-chacha20poly1305-CUhxL4CC.js";
|
|
10
10
|
import { O as OpenError } from "./chunks/vendor-@hpke-common-CfGjdxIH.js";
|
|
11
11
|
import { x as xchacha20poly1305 } from "./chunks/vendor-@noble-ciphers-DL-K0bMl.js";
|
|
12
|
-
import {
|
|
12
|
+
import { dn as sharingReplySchemas, dp as id$2, dq as sharingChangeSchema, dr as requestId$1, ds as captureScheduleAuthorization, dt as ScheduleDefinitionSchema, du as isCloudE2eeMemberRemoved, dv as isCloudE2eeDeviceRevoked, b1 as isE2eeReadQuery, cl as decodeE2eeRpcRequestBody, dw as isE2eeFeatureMethod, cp as encodeE2eeRpcRequestBody, cm as decodeE2eeRpcResponseBody, b5 as LocalMachineRpcResponseSchema, dx as E2eeFeatureInputSchema, b9 as E2EE_RPC_MAX_FRAME_BYTES, cq as encodeE2eeRpcResponseBody, dy as normalizeSessionTurnInputConfig, dz as queuedInputEvidence, aX as getSessionRoomId, dl as getScheduleRoomId, dA as readScheduleAuthorization, dB as scheduleChangedSince, dC as scheduleDocumentFromMirrorState, dD as scheduleDefinitionFingerprint, dE as ScheduleAuthorizationRequestSchema, dF as LocalE2eePrepareRequestSchema, b0 as LocalE2eePrepareResponseSchema, dG as createWorkspaceEpochTransitionLegacy, dH as encryptedWorkspaceNamespace, dI as encryptedWorkspaceResolver, ch as createLoroStreamsJsonStreamClient, dJ as encryptedWorkspaceRoom, dK as isSessionDocRoomId, dL as getScheduleIdFromRoomId } from "./telemetry-CztoQabb.js";
|
|
13
13
|
import { e as encodeStreamsRoomAdditionalData } from "./chunks/vendor-loro-repo-CINiPL9T.js";
|
|
14
14
|
import { g as decodeImportBlobMeta, i as isContainer } from "./chunks/vendor-loro-crdt-B0fZaMbx.js";
|
|
15
15
|
import { o as object, c as string, j as unknown, g as _enum, e as boolean, a as literal, B as custom, A as _instanceof, n as number, C as ZodError } from "./chunks/vendor-zod-CBWGVFD-.js";
|
|
16
16
|
import { p as platformLayer, g as getLodyDataDir, a as getLogger } from "./process-options-D4mni5t2.js";
|
|
17
|
-
import { lazyExecutionJournal } from "./agent-execution-
|
|
17
|
+
import { lazyExecutionJournal } from "./agent-execution-DbMHu2MY.js";
|
|
18
18
|
import { createHash, randomUUID, timingSafeEqual, randomBytes, createDecipheriv, createCipheriv } from "node:crypto";
|
|
19
19
|
import { mkdirSync, existsSync, chmodSync, closeSync, openSync, constants } from "node:fs";
|
|
20
20
|
import { dirname, isAbsolute, join as join$1 } from "node:path";
|
|
@@ -38,7 +38,7 @@ function decode$1(base64) {
|
|
|
38
38
|
for (let i = 0; i < binary.length; i++) bytes2[i] = binary.charCodeAt(i);
|
|
39
39
|
return bytes2;
|
|
40
40
|
}
|
|
41
|
-
const hex$
|
|
41
|
+
const hex$9 = (value) => {
|
|
42
42
|
const bytes2 = new Uint8Array(value.length / 2);
|
|
43
43
|
for (let i = 0; i < bytes2.length; i++) bytes2[i] = parseInt(value.slice(2 * i, 2 * i + 2), 16);
|
|
44
44
|
return bytes2;
|
|
@@ -62,16 +62,16 @@ function verifierExports(value) {
|
|
|
62
62
|
} : null;
|
|
63
63
|
}
|
|
64
64
|
function passesKnownAnswers(exports$1) {
|
|
65
|
-
const key2 = hex$
|
|
66
|
-
const message = hex$
|
|
65
|
+
const key2 = hex$9(KNOWN.key);
|
|
66
|
+
const message = hex$9(KNOWN.message);
|
|
67
67
|
const tampered = message.map((byte, index) => index === 0 ? byte ^ 1 : byte);
|
|
68
|
-
const valid = hex$
|
|
69
|
-
const torsion = hex$
|
|
68
|
+
const valid = hex$9(KNOWN.valid);
|
|
69
|
+
const torsion = hex$9(KNOWN.torsionR);
|
|
70
70
|
const verify2 = (k, m, s, checked) => call(exports$1, [k, s, m], () => exports$1.verify(m.length, checked));
|
|
71
71
|
const keyOk = (k) => call(exports$1, [k], () => exports$1.key_ok());
|
|
72
|
-
return keyOk(key2) && !keyOk(hex$
|
|
72
|
+
return keyOk(key2) && !keyOk(hex$9(KNOWN.smallOrderKey)) && !keyOk(hex$9(KNOWN.nonCanonicalKey)) && [0, 1].every(
|
|
73
73
|
(checked) => verify2(key2, message, valid, checked) && !verify2(key2, tampered, valid, checked) && !verify2(key2, message, torsion, checked)
|
|
74
|
-
) && !verify2(hex$
|
|
74
|
+
) && !verify2(hex$9(KNOWN.smallOrderKey), message, valid, 0);
|
|
75
75
|
}
|
|
76
76
|
function instance() {
|
|
77
77
|
if (loaded === void 0) {
|
|
@@ -4561,8 +4561,8 @@ class RecoveryVaultError extends TaggedError("RecoveryVaultError") {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
const vaultError = (code) => new RecoveryVaultError({ code });
|
|
4563
4563
|
const MAX_VAULT_BYTES = 256 * 1024;
|
|
4564
|
-
const hex$
|
|
4565
|
-
const digest$2 = (bytes2) => hex$
|
|
4564
|
+
const hex$8 = (bytes2) => Array.from(bytes2, (v) => v.toString(16).padStart(2, "0")).join("");
|
|
4565
|
+
const digest$2 = (bytes2) => hex$8(sha256(bytes2));
|
|
4566
4566
|
const fromHex$1 = (value, size = 32) => {
|
|
4567
4567
|
if (typeof value !== "string" || value.length !== size * 2 || !/^[0-9a-f]+$/.test(value))
|
|
4568
4568
|
throw vaultError("invalid-input");
|
|
@@ -5046,7 +5046,7 @@ const makeSession = fnUntraced(function* (input) {
|
|
|
5046
5046
|
locator,
|
|
5047
5047
|
readIndex: () => ownedOperation(index()),
|
|
5048
5048
|
readEntry: (ref) => ownedOperation(readEntry(ref)),
|
|
5049
|
-
upload: (value, entryId = hex$
|
|
5049
|
+
upload: (value, entryId = hex$8(random(32))) => ownedOperation(upload(value, entryId)),
|
|
5050
5050
|
reserve: (candidate) => ownedOperation(reserve(candidate)),
|
|
5051
5051
|
replace: (candidate) => ownedOperation(reserve(candidate, true)),
|
|
5052
5052
|
addPasskey: (capability) => ownedOperation(
|
|
@@ -5173,7 +5173,7 @@ const makeSession = fnUntraced(function* (input) {
|
|
|
5173
5173
|
});
|
|
5174
5174
|
const createRecoveryVault = fnUntraced(function* (input) {
|
|
5175
5175
|
if (!input.locator || input.locator.length > 2048) return yield* vaultError("invalid-input");
|
|
5176
|
-
const vaultId = yield* attempt$6(() => hex$
|
|
5176
|
+
const vaultId = yield* attempt$6(() => hex$8(random(32))), unlock = yield* attempt$6(() => random(32)), master = yield* attempt$6(() => random(32));
|
|
5177
5177
|
return yield* acquireUseRelease(
|
|
5178
5178
|
succeed$2({ unlock, master }),
|
|
5179
5179
|
(secret) => gen$1(function* () {
|
|
@@ -5400,7 +5400,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5400
5400
|
);
|
|
5401
5401
|
if (!trust.source || trust.source.length > 2048 || anchor.length !== 1)
|
|
5402
5402
|
return yield* vaultError("invalid-input");
|
|
5403
|
-
const key2 = `vault-v1/${vault.vaultId}/workspace/${hex$
|
|
5403
|
+
const key2 = `vault-v1/${vault.vaultId}/workspace/${hex$8(genesis.toBytes())}/${hex$8(membership.toBytes())}`;
|
|
5404
5404
|
const serial = yield* make$1(1);
|
|
5405
5405
|
let closed = false, observed;
|
|
5406
5406
|
yield* addFinalizer(
|
|
@@ -5416,7 +5416,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5416
5416
|
yield* guard();
|
|
5417
5417
|
const view = yield* ledger();
|
|
5418
5418
|
yield* fromResult(requireLedgerContinuation(view, view));
|
|
5419
|
-
if (!view.genesis.equals(genesis) || !view.inspectState().members.has(hex$
|
|
5419
|
+
if (!view.genesis.equals(genesis) || !view.inspectState().members.has(hex$8(membership.toBytes())))
|
|
5420
5420
|
return yield* vaultError("unauthorized");
|
|
5421
5421
|
if (observed) yield* fromResult(requireLedgerContinuation(observed, view));
|
|
5422
5422
|
observed = view;
|
|
@@ -5440,13 +5440,13 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5440
5440
|
return { raw: next, value };
|
|
5441
5441
|
});
|
|
5442
5442
|
const active = (view, identity2) => {
|
|
5443
|
-
const state = view.inspectState(), device = state.devices.get(hex$
|
|
5444
|
-
return !!device && device.kind === "recovery" && device.membershipId.equals(membership) && device.encryptionPublicKey.equals(identity2.encryptionPublicKey) && state.members.has(hex$
|
|
5443
|
+
const state = view.inspectState(), device = state.devices.get(hex$8(identity2.publicKey.toBytes()));
|
|
5444
|
+
return !!device && device.kind === "recovery" && device.membershipId.equals(membership) && device.encryptionPublicKey.equals(identity2.encryptionPublicKey) && state.members.has(hex$8(membership.toBytes()));
|
|
5445
5445
|
};
|
|
5446
5446
|
const useIdentity = (ref, work) => acquireUseRelease(
|
|
5447
5447
|
vault.readEntry(ref),
|
|
5448
5448
|
(bundle) => gen$1(function* () {
|
|
5449
|
-
if (bundle.genesis !== hex$
|
|
5449
|
+
if (bundle.genesis !== hex$8(genesis.toBytes()) || bundle.membershipId !== hex$8(membership.toBytes()) || !bytesEqual(bundle.trust.genesisRecord, trust.genesisRecord))
|
|
5450
5450
|
return yield* vaultError("authentication");
|
|
5451
5451
|
const identity2 = yield* importRecoveryIdentity(bundle);
|
|
5452
5452
|
return yield* work(identity2, bundle);
|
|
@@ -5464,7 +5464,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5464
5464
|
);
|
|
5465
5465
|
if (qualified.group.epoch !== epoch) return yield* vaultError("authentication");
|
|
5466
5466
|
const row = qualified.group.envelopes.find(
|
|
5467
|
-
(item) => item.recipient === hex$
|
|
5467
|
+
(item) => item.recipient === hex$8(identity2.publicKey.toBytes())
|
|
5468
5468
|
);
|
|
5469
5469
|
if (!row) return yield* vaultError("missing");
|
|
5470
5470
|
const context2 = {
|
|
@@ -5592,7 +5592,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5592
5592
|
let state = yield* load();
|
|
5593
5593
|
if (!state.value)
|
|
5594
5594
|
state = yield* save(state.raw, {
|
|
5595
|
-
entryId: hex$
|
|
5595
|
+
entryId: hex$8(random(32)),
|
|
5596
5596
|
reference: null,
|
|
5597
5597
|
record: null,
|
|
5598
5598
|
recordPosition: null,
|
|
@@ -5606,7 +5606,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5606
5606
|
if (!progress.reference) {
|
|
5607
5607
|
const index = yield* vault.readIndex();
|
|
5608
5608
|
let reference2 = index.value.entries.find(
|
|
5609
|
-
(ref) => !ref.retired && ref.genesis === hex$
|
|
5609
|
+
(ref) => !ref.retired && ref.genesis === hex$8(genesis.toBytes()) && ref.membershipId === hex$8(membership.toBytes())
|
|
5610
5610
|
);
|
|
5611
5611
|
if (!reference2) {
|
|
5612
5612
|
const candidate = yield* vault.readCandidate(progress.entryId);
|
|
@@ -5617,8 +5617,8 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5617
5617
|
} else
|
|
5618
5618
|
selected = yield* acquireUseRelease(
|
|
5619
5619
|
generateRecoveryPackage({
|
|
5620
|
-
genesis: hex$
|
|
5621
|
-
membershipId: hex$
|
|
5620
|
+
genesis: hex$8(genesis.toBytes()),
|
|
5621
|
+
membershipId: hex$8(membership.toBytes()),
|
|
5622
5622
|
generation: 0,
|
|
5623
5623
|
trust
|
|
5624
5624
|
}),
|
|
@@ -5664,7 +5664,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5664
5664
|
return yield* vaultError("authentication");
|
|
5665
5665
|
}
|
|
5666
5666
|
if (!active(view, identity2)) {
|
|
5667
|
-
const previousDevice = view.inspectState().devices.get(hex$
|
|
5667
|
+
const previousDevice = view.inspectState().devices.get(hex$8(identity2.publicKey.toBytes()));
|
|
5668
5668
|
if (previousDevice) return yield* vaultError("unauthorized");
|
|
5669
5669
|
if (!progress.record) {
|
|
5670
5670
|
const command = yield* prepareDeviceAdmission({
|
|
@@ -5708,7 +5708,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5708
5708
|
const restore = fnUntraced(function* (request) {
|
|
5709
5709
|
yield* current();
|
|
5710
5710
|
const index = yield* vault.readIndex(), reference = index.value.entries.find(
|
|
5711
|
-
(ref) => !ref.retired && ref.genesis === hex$
|
|
5711
|
+
(ref) => !ref.retired && ref.genesis === hex$8(genesis.toBytes()) && ref.membershipId === hex$8(membership.toBytes())
|
|
5712
5712
|
);
|
|
5713
5713
|
if (!reference) return yield* vaultError("missing");
|
|
5714
5714
|
return yield* useIdentity(
|
|
@@ -5725,7 +5725,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5725
5725
|
intent = yield* attempt$6(
|
|
5726
5726
|
() => getOrThrow(decodeUnknownResult(RestoreSchema)(parseCanonical(before)))
|
|
5727
5727
|
);
|
|
5728
|
-
if (intent.personal !== hex$
|
|
5728
|
+
if (intent.personal !== hex$8(personal.publicKey.toBytes()))
|
|
5729
5729
|
return yield* vaultError("conflict");
|
|
5730
5730
|
} else {
|
|
5731
5731
|
const command = yield* prepareDeviceAdmission({
|
|
@@ -5740,7 +5740,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5740
5740
|
);
|
|
5741
5741
|
const record = yield* signLedgerRecord(proposal, identity2);
|
|
5742
5742
|
intent = {
|
|
5743
|
-
personal: hex$
|
|
5743
|
+
personal: hex$8(personal.publicKey.toBytes()),
|
|
5744
5744
|
record,
|
|
5745
5745
|
position: view.length + 1
|
|
5746
5746
|
};
|
|
@@ -5755,7 +5755,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5755
5755
|
);
|
|
5756
5756
|
if (!bytesEqual(result2.record, intent.record)) return yield* vaultError("authentication");
|
|
5757
5757
|
if (result2.outcome !== "Committed") return { outcome: result2.outcome, epoch };
|
|
5758
|
-
const after = yield* current(), device = after.inspectState().devices.get(hex$
|
|
5758
|
+
const after = yield* current(), device = after.inspectState().devices.get(hex$8(personal.publicKey.toBytes()));
|
|
5759
5759
|
if (!device || device.kind !== "personal" || !device.membershipId.equals(membership) || !device.encryptionPublicKey.equals(personal.encryptionPublicKey) || !(yield* fromResult(
|
|
5760
5760
|
hasVerifiedCheckpoint(after, {
|
|
5761
5761
|
head: hashRecordBytes(intent.record),
|
|
@@ -5767,7 +5767,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5767
5767
|
outcome: "Committed",
|
|
5768
5768
|
epoch,
|
|
5769
5769
|
personal: personal.publicKey,
|
|
5770
|
-
role: after.inspectState().members.get(hex$
|
|
5770
|
+
role: after.inspectState().members.get(hex$8(membership.toBytes())).role
|
|
5771
5771
|
};
|
|
5772
5772
|
})
|
|
5773
5773
|
);
|
|
@@ -5795,12 +5795,12 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5795
5795
|
if (intent.done) return yield* checkedStatus();
|
|
5796
5796
|
} else {
|
|
5797
5797
|
const index2 = yield* vault.readIndex(), old = index2.value.entries.find(
|
|
5798
|
-
(ref) => !ref.retired && ref.genesis === hex$
|
|
5798
|
+
(ref) => !ref.retired && ref.genesis === hex$8(genesis.toBytes()) && ref.membershipId === hex$8(membership.toBytes())
|
|
5799
5799
|
);
|
|
5800
5800
|
if (!old) return yield* vaultError("missing");
|
|
5801
5801
|
intent = {
|
|
5802
5802
|
old,
|
|
5803
|
-
candidateId: hex$
|
|
5803
|
+
candidateId: hex$8(random(32)),
|
|
5804
5804
|
selected: null,
|
|
5805
5805
|
compromised: request.compromised,
|
|
5806
5806
|
revoke: null,
|
|
@@ -5873,8 +5873,8 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5873
5873
|
} else
|
|
5874
5874
|
reference = yield* acquireUseRelease(
|
|
5875
5875
|
generateRecoveryPackage({
|
|
5876
|
-
genesis: hex$
|
|
5877
|
-
membershipId: hex$
|
|
5876
|
+
genesis: hex$8(genesis.toBytes()),
|
|
5877
|
+
membershipId: hex$8(membership.toBytes()),
|
|
5878
5878
|
generation: intent.old.generation + 1,
|
|
5879
5879
|
trust
|
|
5880
5880
|
}),
|
|
@@ -5901,7 +5901,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5901
5901
|
if (tested.outcome !== "Committed" || !tested.status.recoverable)
|
|
5902
5902
|
return yield* vaultError("pending");
|
|
5903
5903
|
const index = yield* vault.readIndex(), selected = index.value.entries.find(
|
|
5904
|
-
(ref) => !ref.retired && ref.genesis === hex$
|
|
5904
|
+
(ref) => !ref.retired && ref.genesis === hex$8(genesis.toBytes()) && ref.membershipId === hex$8(membership.toBytes())
|
|
5905
5905
|
);
|
|
5906
5906
|
if (selected?.entryId !== candidate.entryId) {
|
|
5907
5907
|
if (selected?.entryId !== intent.old.entryId) return yield* vaultError("conflict");
|
|
@@ -5932,7 +5932,7 @@ const makeWorkspaceRecovery = fnUntraced(function* (input) {
|
|
|
5932
5932
|
yield* save(
|
|
5933
5933
|
state.raw,
|
|
5934
5934
|
state.value ? { ...state.value, skipped: true } : {
|
|
5935
|
-
entryId: hex$
|
|
5935
|
+
entryId: hex$8(random(32)),
|
|
5936
5936
|
reference: null,
|
|
5937
5937
|
record: null,
|
|
5938
5938
|
recordPosition: null,
|
|
@@ -5982,7 +5982,7 @@ const machineSharingGenerationFromHistory = fnUntraced(function* (input) {
|
|
|
5982
5982
|
class MachineSharingError extends TaggedError("MachineSharingError") {
|
|
5983
5983
|
}
|
|
5984
5984
|
const fail$h = (code) => new MachineSharingError({ code });
|
|
5985
|
-
const hex$
|
|
5985
|
+
const hex$7 = (value) => Buffer.from(value).toString("hex");
|
|
5986
5986
|
const unhex$2 = (value) => Uint8Array.from(Buffer.from(value, "hex"));
|
|
5987
5987
|
const parse = (schema, value) => try_$1({ try: () => schema.parse(value), catch: () => fail$h("sharing_invalid") });
|
|
5988
5988
|
const sql$3 = (f) => try_$1({
|
|
@@ -6007,7 +6007,7 @@ const authorizeOwner = fnUntraced(function* (options, machineId, requester, loca
|
|
|
6007
6007
|
if (!id$2.safeParse(machineId).success || localProjectId !== void 0 && !id$2.safeParse(localProjectId).success)
|
|
6008
6008
|
return void 0;
|
|
6009
6009
|
const current = yield* options.ledger();
|
|
6010
|
-
if (hex$
|
|
6010
|
+
if (hex$7(current.genesis.toBytes()) !== options.genesisHash) return void 0;
|
|
6011
6011
|
const state = current.inspectState();
|
|
6012
6012
|
const requesterDevice = state.devices.get(requester);
|
|
6013
6013
|
const machines = [...state.devices.entries()].filter(
|
|
@@ -6042,7 +6042,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6042
6042
|
(connection) => sql$3(() => connection.close()).pipe(orDie)
|
|
6043
6043
|
);
|
|
6044
6044
|
const credential = () => typeof options.credential === "string" ? succeed$2(options.credential) : options.credential();
|
|
6045
|
-
const self = hex$
|
|
6045
|
+
const self = hex$7(options.signer.publicKey.toBytes());
|
|
6046
6046
|
const cache = /* @__PURE__ */ new Map();
|
|
6047
6047
|
let invalidationToken = {};
|
|
6048
6048
|
let closed = false;
|
|
@@ -6073,7 +6073,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6073
6073
|
workspaceId: options.workspaceId,
|
|
6074
6074
|
genesisHash: options.genesisHash,
|
|
6075
6075
|
machineId,
|
|
6076
|
-
ownerMembershipId: hex$
|
|
6076
|
+
ownerMembershipId: hex$7(machine.membershipId.toBytes()),
|
|
6077
6077
|
generation: machineGeneration.generation
|
|
6078
6078
|
},
|
|
6079
6079
|
device,
|
|
@@ -6304,7 +6304,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6304
6304
|
if (!matches(binding, current.binding)) return yield* fail$h("sharing_conflict");
|
|
6305
6305
|
const selfDevice = current.ledger.inspectState().devices.get(self);
|
|
6306
6306
|
const permissions = contentPermissions(current.ledger, options.signer.publicKey);
|
|
6307
|
-
const canManage = selfDevice?.kind === "personal" && hex$
|
|
6307
|
+
const canManage = selfDevice?.kind === "personal" && hex$7(selfDevice.membershipId.toBytes()) === binding.ownerMembershipId && isSuccess(permissions) && permissions.success.mayWriteDocument;
|
|
6308
6308
|
const decision = authorizeMachineExecution({
|
|
6309
6309
|
ledger: current.ledger,
|
|
6310
6310
|
policy,
|
|
@@ -6333,7 +6333,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6333
6333
|
current.ledger,
|
|
6334
6334
|
getOrThrow(signingPublicKey(unhex$2(body.signer)))
|
|
6335
6335
|
);
|
|
6336
|
-
return signer?.kind !== "personal" || hex$
|
|
6336
|
+
return signer?.kind !== "personal" || hex$7(signer.membershipId.toBytes()) !== binding.ownerMembershipId || isFailure(permission) || !permission.success.mayWriteDocument;
|
|
6337
6337
|
})()),
|
|
6338
6338
|
...!decision.allowed ? { deniedReason: "e2ee_machine_not_shared" } : {},
|
|
6339
6339
|
removed: saved?.head?.status === "removed",
|
|
@@ -6449,7 +6449,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6449
6449
|
const { binding, ledger, machineGeneration } = yield* target(machineId);
|
|
6450
6450
|
if (generation !== binding.generation) return yield* fail$h("sharing_conflict");
|
|
6451
6451
|
const own2 = ledger.inspectState().devices.get(self);
|
|
6452
|
-
if (!own2 || own2.kind !== "personal" || hex$
|
|
6452
|
+
if (!own2 || own2.kind !== "personal" || hex$7(own2.membershipId.toBytes()) !== binding.ownerMembershipId)
|
|
6453
6453
|
return yield* fail$h("machine_not_owned");
|
|
6454
6454
|
return yield* admitted(
|
|
6455
6455
|
gen$1(function* () {
|
|
@@ -6508,7 +6508,7 @@ const makeMachineSharingHost = fn("MachineSharingHost.make")(function* (options)
|
|
|
6508
6508
|
revision: (expectedHead?.revision ?? 0) + 1,
|
|
6509
6509
|
previousDigest: expectedHead?.digest ?? null,
|
|
6510
6510
|
requestId: rid,
|
|
6511
|
-
frameHex: hex$
|
|
6511
|
+
frameHex: hex$7(frame)
|
|
6512
6512
|
}
|
|
6513
6513
|
};
|
|
6514
6514
|
retained2 = yield* retain(binding, retained2, true);
|
|
@@ -10615,7 +10615,7 @@ class E2eeWorkspace {
|
|
|
10615
10615
|
}
|
|
10616
10616
|
const CATCH_UP_TIMEOUT_MS = 3e4;
|
|
10617
10617
|
const CATCH_UP_COOLDOWN_MS = 6e4;
|
|
10618
|
-
const hex$
|
|
10618
|
+
const hex$6 = (bytes2) => Buffer.from(bytes2).toString("hex");
|
|
10619
10619
|
const ledgerState = (view) => `${view.inspectState().epoch.number}:${view.length}`;
|
|
10620
10620
|
function makeLedgerCatchUp(options) {
|
|
10621
10621
|
const now = options.now ?? Date.now;
|
|
@@ -10632,7 +10632,7 @@ function makeLedgerCatchUp(options) {
|
|
|
10632
10632
|
if (isFailure(metadata)) return false;
|
|
10633
10633
|
const state = view.inspectState();
|
|
10634
10634
|
const device = state.devices.get(metadata.success.device);
|
|
10635
|
-
if (!device || device.kind === "recovery" || !state.members.has(hex$
|
|
10635
|
+
if (!device || device.kind === "recovery" || !state.members.has(hex$6(device.membershipId.toBytes())))
|
|
10636
10636
|
return false;
|
|
10637
10637
|
const signer = signingPublicKey(Buffer.from(metadata.success.device, "hex"));
|
|
10638
10638
|
if (isFailure(signer)) return false;
|
|
@@ -10721,7 +10721,7 @@ function withLedgerCatchUp(native2, wrap) {
|
|
|
10721
10721
|
openFeature: wrap(native2.openFeature)
|
|
10722
10722
|
};
|
|
10723
10723
|
}
|
|
10724
|
-
const hex$
|
|
10724
|
+
const hex$5 = (bytes2) => Array.from(bytes2, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
10725
10725
|
function unhex$1(value, frameLimit) {
|
|
10726
10726
|
if (typeof value !== "string" || !/^(?:[0-9a-f]{2})+$/.test(value) || frameLimit !== void 0 && (value.length < 286 || value.length > 2 * frameLimit))
|
|
10727
10727
|
throw new Error("e2ee_rpc_frame");
|
|
@@ -10804,7 +10804,7 @@ function makeE2eeFeatureRpcClient(options) {
|
|
|
10804
10804
|
offset += 4;
|
|
10805
10805
|
if (length < 143 || length > E2EE_RPC_MAX_FRAME_BYTES || offset + length > bytes2.length)
|
|
10806
10806
|
throw new Error("e2ee_feature_frames");
|
|
10807
|
-
frames.push(hex$
|
|
10807
|
+
frames.push(hex$5(bytes2.subarray(offset, offset + length)));
|
|
10808
10808
|
offset += length;
|
|
10809
10809
|
}
|
|
10810
10810
|
if (!frames.length) throw new Error("e2ee_feature_frames");
|
|
@@ -10844,7 +10844,7 @@ function makeE2eeFeatureRpcClient(options) {
|
|
|
10844
10844
|
count,
|
|
10845
10845
|
method: body.method,
|
|
10846
10846
|
bytes: bytes2,
|
|
10847
|
-
requestId: hex$
|
|
10847
|
+
requestId: hex$5(body.requestId),
|
|
10848
10848
|
requesterDevice: opened.signer,
|
|
10849
10849
|
epoch: opened.epoch,
|
|
10850
10850
|
expiresAt: body.expiresAt
|
|
@@ -11015,7 +11015,7 @@ function makeE2eeFeatureRpcClient(options) {
|
|
|
11015
11015
|
frames: unpackFrames(saved.frame)
|
|
11016
11016
|
};
|
|
11017
11017
|
});
|
|
11018
|
-
const resultKey = (request) => `feature-response:${hex$
|
|
11018
|
+
const resultKey = (request) => `feature-response:${hex$5(digest$1(request.frame))}`;
|
|
11019
11019
|
const verifyPage = fnUntraced(function* (request, frame, signer) {
|
|
11020
11020
|
const binding = yield* options.binding(e2eeRpcResource(request.input.request.machineId));
|
|
11021
11021
|
const opened = yield* acquireRelease(
|
|
@@ -11028,7 +11028,7 @@ function makeE2eeFeatureRpcClient(options) {
|
|
|
11028
11028
|
(value) => sync(() => value.payload.fill(0))
|
|
11029
11029
|
);
|
|
11030
11030
|
try {
|
|
11031
|
-
if (hex$
|
|
11031
|
+
if (hex$5(response.requestId) !== request.requestId || hex$5(response.requestDigest) !== hex$5(digest$1(request.frame)))
|
|
11032
11032
|
return yield* fail$v(new Error("e2ee_rpc_response_binding"));
|
|
11033
11033
|
const page2 = yield* acquireRelease(
|
|
11034
11034
|
attempt$2(() => decodeFeatureResponsePage(response)),
|
|
@@ -11298,7 +11298,7 @@ function makeE2eeRpcClient(options) {
|
|
|
11298
11298
|
args,
|
|
11299
11299
|
requesterDevice: opened.signer,
|
|
11300
11300
|
epoch: opened.epoch,
|
|
11301
|
-
requestId: hex$
|
|
11301
|
+
requestId: hex$5(body.requestId),
|
|
11302
11302
|
expiresAt: body.expiresAt
|
|
11303
11303
|
};
|
|
11304
11304
|
} finally {
|
|
@@ -11318,7 +11318,7 @@ function makeE2eeRpcClient(options) {
|
|
|
11318
11318
|
if (loss) return yield* fail$v(loss);
|
|
11319
11319
|
const state = view.inspectState();
|
|
11320
11320
|
const device = state.devices.get(options.requesterDevice);
|
|
11321
|
-
const member = device && state.members.get(hex$
|
|
11321
|
+
const member = device && state.members.get(hex$5(device.membershipId.toBytes()));
|
|
11322
11322
|
if (!device || device.kind === "recovery" || !member || member.role === "guest")
|
|
11323
11323
|
return yield* fail$v(new Error("e2ee_rpc_denied"));
|
|
11324
11324
|
return yield* void_;
|
|
@@ -11331,7 +11331,7 @@ function makeE2eeRpcClient(options) {
|
|
|
11331
11331
|
if (loss) return yield* fail$v(loss);
|
|
11332
11332
|
const state = view.inspectState();
|
|
11333
11333
|
const device = state.devices.get(options.requesterDevice);
|
|
11334
|
-
if (!device || device.kind === "recovery" || !state.members.has(hex$
|
|
11334
|
+
if (!device || device.kind === "recovery" || !state.members.has(hex$5(device.membershipId.toBytes())))
|
|
11335
11335
|
return yield* fail$v(new Error("e2ee_rpc_denied"));
|
|
11336
11336
|
return yield* void_;
|
|
11337
11337
|
});
|
|
@@ -11342,9 +11342,9 @@ function makeE2eeRpcClient(options) {
|
|
|
11342
11342
|
const signer = yield* targetSigner(machineId, true);
|
|
11343
11343
|
const state = (yield* options.ledger()).inspectState();
|
|
11344
11344
|
const sameOwner = state.devices.get(options.requesterDevice)?.membershipId.equals(state.devices.get(signer).membershipId);
|
|
11345
|
-
if (!sameOwner && !(yield* (authorizeTarget?.(machineId) ?? succeed$2(
|
|
11346
|
-
//
|
|
11347
|
-
|
|
11345
|
+
if (!sameOwner && !(yield* (authorizeTarget?.(machineId) ?? succeed$2(true)).pipe(
|
|
11346
|
+
// Only a verified denial withholds the input; otherwise the machine decides.
|
|
11347
|
+
catch_(() => succeed$2(true))
|
|
11348
11348
|
)))
|
|
11349
11349
|
return yield* fail$v(new Error("e2ee_machine_not_shared"));
|
|
11350
11350
|
let saved = yield* options.originals.read("sent", key(args));
|
|
@@ -11385,7 +11385,7 @@ function makeE2eeRpcClient(options) {
|
|
|
11385
11385
|
return {
|
|
11386
11386
|
requestId: checked.requestId,
|
|
11387
11387
|
targetMachineId: machineId,
|
|
11388
|
-
frameHex: hex$
|
|
11388
|
+
frameHex: hex$5(saved.frame),
|
|
11389
11389
|
requesterDevice: checked.requesterDevice,
|
|
11390
11390
|
expiresAt: checked.expiresAt
|
|
11391
11391
|
};
|
|
@@ -11412,7 +11412,7 @@ function makeE2eeRpcClient(options) {
|
|
|
11412
11412
|
(value) => sync(() => value.payload.fill(0))
|
|
11413
11413
|
);
|
|
11414
11414
|
try {
|
|
11415
|
-
if (hex$
|
|
11415
|
+
if (hex$5(response.requestId) !== original.requestId || hex$5(response.requestDigest) !== hex$5(e2eeRpcDigest(saved.frame)) || response.kind !== "progress" || response.sequence !== 0)
|
|
11416
11416
|
return yield* fail$v(new Error("e2ee_rpc_response_binding"));
|
|
11417
11417
|
const ack = yield* attempt$1(
|
|
11418
11418
|
() => ackSchema.parse(
|
|
@@ -11654,6 +11654,84 @@ class E2eeRpcOriginals {
|
|
|
11654
11654
|
function makeE2eeRpcNative(options) {
|
|
11655
11655
|
return makeE2eeRpcClient({ ...options, originals: nativeRpcStore(options.originals) });
|
|
11656
11656
|
}
|
|
11657
|
+
const hex$4 = (bytes2) => Buffer.from(bytes2).toString("hex");
|
|
11658
|
+
const isContentUnauthorized = (cause) => cause instanceof Error && "code" in cause && cause._tag === "ContentError" && cause.code === "unauthorized";
|
|
11659
|
+
function makeVerifiedExecutionOriginal(options) {
|
|
11660
|
+
return (intent, doc, lookup = {}) => scoped(
|
|
11661
|
+
gen$1(function* () {
|
|
11662
|
+
if (options.isClosed() || intent.workspaceId !== options.workspaceId) return void 0;
|
|
11663
|
+
const fromDoc = lookup.origin ? void 0 : doc?.getMap("rpcDispatchOriginals").get(intent.userTurnId);
|
|
11664
|
+
const cached2 = yield* options.readIncoming(intent).pipe(catch_(() => succeed$2(void 0)));
|
|
11665
|
+
const rpcOriginal = typeof fromDoc === "string" ? fromDoc : cached2 ? hex$4(cached2.frame) : void 0;
|
|
11666
|
+
if (rpcOriginal !== void 0) {
|
|
11667
|
+
if (cached2 && hex$4(cached2.frame) !== rpcOriginal) return void 0;
|
|
11668
|
+
const view = yield* options.ledger();
|
|
11669
|
+
const state = view.inspectState();
|
|
11670
|
+
const machineId = state.devices.get(options.selfDevice)?.machineId;
|
|
11671
|
+
if (!machineId) return void 0;
|
|
11672
|
+
const verified2 = yield* options.openDispatch(machineId, rpcOriginal);
|
|
11673
|
+
if (verified2.args.sessionId !== intent.sessionId || verified2.args.userTurnId !== intent.userTurnId || !isDeepStrictEqual(verified2.args.inputConfig ?? {}, intent.inputConfig ?? {}))
|
|
11674
|
+
return void 0;
|
|
11675
|
+
if (verified2.requesterDevice !== options.selfDevice) {
|
|
11676
|
+
const device = state.devices.get(verified2.requesterDevice);
|
|
11677
|
+
const member = device && state.members.get(hex$4(device.membershipId.toBytes()));
|
|
11678
|
+
if (!member) return void 0;
|
|
11679
|
+
return {
|
|
11680
|
+
requesterDevice: verified2.requesterDevice,
|
|
11681
|
+
requesterCryptoUserId: hex$4(member.userId.toBytes()),
|
|
11682
|
+
expiresAt: verified2.expiresAt
|
|
11683
|
+
};
|
|
11684
|
+
}
|
|
11685
|
+
}
|
|
11686
|
+
if (!doc) return void 0;
|
|
11687
|
+
const resolved = yield* options.origins.resolve(
|
|
11688
|
+
intent,
|
|
11689
|
+
doc,
|
|
11690
|
+
(request) => options.openContent(intent, request),
|
|
11691
|
+
options.recover,
|
|
11692
|
+
lookup
|
|
11693
|
+
);
|
|
11694
|
+
if (!resolved || "state" in resolved || !resolved.queued || resolved.requesterDevice !== options.selfDevice)
|
|
11695
|
+
return resolved;
|
|
11696
|
+
const row = resolved.queued;
|
|
11697
|
+
const queuedOriginal = doc.getMap("queueDispatchOriginals").get(intent.userTurnId);
|
|
11698
|
+
const automation = normalizeSessionTurnInputConfig(row.inputConfig)?._lodyAutomation;
|
|
11699
|
+
if (automation === void 0 && typeof queuedOriginal === "string") {
|
|
11700
|
+
const state = (yield* options.ledger()).inspectState();
|
|
11701
|
+
const machineId = state.devices.get(options.selfDevice)?.machineId;
|
|
11702
|
+
if (!machineId) return void 0;
|
|
11703
|
+
const verified2 = yield* options.openDispatch(machineId, queuedOriginal).pipe(
|
|
11704
|
+
catch_(
|
|
11705
|
+
(cause) => isContentUnauthorized(cause) ? succeed$2(void 0) : fail$v(cause)
|
|
11706
|
+
)
|
|
11707
|
+
);
|
|
11708
|
+
if (!verified2) return void 0;
|
|
11709
|
+
const evidence = queuedInputEvidence(row.inputConfig);
|
|
11710
|
+
const device = state.devices.get(verified2.requesterDevice);
|
|
11711
|
+
const member = device && state.members.get(hex$4(device.membershipId.toBytes()));
|
|
11712
|
+
if (!evidence || !member || verified2.requesterDevice === options.selfDevice || verified2.args.sessionId !== intent.sessionId || verified2.args.userTurnId !== intent.userTurnId || verified2.args.userId !== row.userId || queuedInputEvidence(verified2.args.inputConfig) !== evidence)
|
|
11713
|
+
return void 0;
|
|
11714
|
+
return {
|
|
11715
|
+
requesterDevice: verified2.requesterDevice,
|
|
11716
|
+
requesterCryptoUserId: hex$4(member.userId.toBytes()),
|
|
11717
|
+
expiresAt: verified2.expiresAt
|
|
11718
|
+
};
|
|
11719
|
+
}
|
|
11720
|
+
const receipted = yield* try_$1({
|
|
11721
|
+
try: () => options.origins.hasQueuedInput({
|
|
11722
|
+
sessionId: intent.sessionId,
|
|
11723
|
+
userTurnId: intent.userTurnId,
|
|
11724
|
+
timestamp: row.timestamp,
|
|
11725
|
+
userId: row.userId,
|
|
11726
|
+
inputConfig: row.inputConfig
|
|
11727
|
+
}),
|
|
11728
|
+
catch: (cause) => cause
|
|
11729
|
+
}).pipe(catch_(() => succeed$2(false)));
|
|
11730
|
+
return receipted ? resolved : void 0;
|
|
11731
|
+
})
|
|
11732
|
+
);
|
|
11733
|
+
}
|
|
11734
|
+
const sessionContentResource = (sessionId) => `doc:${getSessionRoomId(sessionId)}`;
|
|
11657
11735
|
const attempt = (body) => try_$1({ try: body, catch: (cause) => cause });
|
|
11658
11736
|
const frameSchema = object({ sealed: _instanceof(Uint8Array), aad: _instanceof(Uint8Array) });
|
|
11659
11737
|
const context$1 = {
|
|
@@ -11707,7 +11785,10 @@ const projection = (map2) => {
|
|
|
11707
11785
|
inputConfig: read2("inputConfig"),
|
|
11708
11786
|
items: read2("items"),
|
|
11709
11787
|
scheduleRun: read2("scheduleRun"),
|
|
11710
|
-
derivedFrom: read2("derivedFrom")
|
|
11788
|
+
derivedFrom: read2("derivedFrom"),
|
|
11789
|
+
queuedInput: read2("queuedInput"),
|
|
11790
|
+
// A promoted row's requester is copied from its queue item, so it is signed content.
|
|
11791
|
+
...read2("queuedInput") === true ? { userId: read2("userId") } : {}
|
|
11711
11792
|
};
|
|
11712
11793
|
};
|
|
11713
11794
|
const derivedFromSchema = object({
|
|
@@ -11726,12 +11807,44 @@ class ExecutionOrigins {
|
|
|
11726
11807
|
db.pragma("synchronous = FULL");
|
|
11727
11808
|
db.exec(`CREATE TABLE IF NOT EXISTS frames(digest TEXT PRIMARY KEY, resource TEXT NOT NULL, sealed BLOB NOT NULL, aad BLOB NOT NULL);
|
|
11728
11809
|
CREATE TABLE IF NOT EXISTS spans(resource TEXT NOT NULL, peer TEXT NOT NULL, start INTEGER NOT NULL, end INTEGER NOT NULL, digest TEXT NOT NULL,
|
|
11729
|
-
PRIMARY KEY(resource, peer, start, end, digest))
|
|
11810
|
+
PRIMARY KEY(resource, peer, start, end, digest));
|
|
11811
|
+
CREATE TABLE IF NOT EXISTS queued_inputs(session TEXT NOT NULL, turn TEXT NOT NULL, digest TEXT NOT NULL,
|
|
11812
|
+
PRIMARY KEY(session, turn, digest));`);
|
|
11730
11813
|
return body(db);
|
|
11731
11814
|
} finally {
|
|
11732
11815
|
db.close();
|
|
11733
11816
|
}
|
|
11734
11817
|
}
|
|
11818
|
+
queuedInputRow(input) {
|
|
11819
|
+
const evidence = queuedInputEvidence(input.inputConfig);
|
|
11820
|
+
if (!evidence) throw new Error("e2ee_queued_input_invalid");
|
|
11821
|
+
return [
|
|
11822
|
+
input.sessionId,
|
|
11823
|
+
input.userTurnId,
|
|
11824
|
+
createHash("sha256").update(
|
|
11825
|
+
JSON.stringify([
|
|
11826
|
+
input.sessionId,
|
|
11827
|
+
input.userTurnId,
|
|
11828
|
+
input.timestamp,
|
|
11829
|
+
input.userId,
|
|
11830
|
+
evidence
|
|
11831
|
+
])
|
|
11832
|
+
).digest("hex")
|
|
11833
|
+
];
|
|
11834
|
+
}
|
|
11835
|
+
/** Written by this machine before it queues its own input; never derived from a document. */
|
|
11836
|
+
retainQueuedInput(input) {
|
|
11837
|
+
const row = this.queuedInputRow(input);
|
|
11838
|
+
this.database(
|
|
11839
|
+
(db) => db.prepare("INSERT OR IGNORE INTO queued_inputs VALUES (?, ?, ?)").run(...row)
|
|
11840
|
+
);
|
|
11841
|
+
}
|
|
11842
|
+
hasQueuedInput(input) {
|
|
11843
|
+
const row = this.queuedInputRow(input);
|
|
11844
|
+
return this.database(
|
|
11845
|
+
(db) => db.prepare("SELECT 1 FROM queued_inputs WHERE session=? AND turn=? AND digest=?").get(...row) !== void 0
|
|
11846
|
+
);
|
|
11847
|
+
}
|
|
11735
11848
|
/** Called only after signature AND AEAD verification; snapshot opens never call it. */
|
|
11736
11849
|
retain(resource, request, plaintext, target) {
|
|
11737
11850
|
if (request.context.kind !== "update_batch" || request.header.length !== 1 || request.header[0] !== 3)
|
|
@@ -11881,7 +11994,14 @@ class ExecutionOrigins {
|
|
|
11881
11994
|
requesterCryptoUserId: Buffer.from(opened.author.actor.toBytes()).toString("hex"),
|
|
11882
11995
|
expiresAt: timestamp + windowMs,
|
|
11883
11996
|
...schedule?.success ? { schedule: schedule.data } : {},
|
|
11884
|
-
...derivedFrom?.success ? { derivedFrom: derivedFrom.data } : {}
|
|
11997
|
+
...derivedFrom?.success ? { derivedFrom: derivedFrom.data } : {},
|
|
11998
|
+
...current.queuedInput === true ? {
|
|
11999
|
+
queued: {
|
|
12000
|
+
timestamp: current.timestamp,
|
|
12001
|
+
inputConfig: current.inputConfig,
|
|
12002
|
+
userId: current.userId
|
|
12003
|
+
}
|
|
12004
|
+
} : {}
|
|
11885
12005
|
};
|
|
11886
12006
|
if (original && !isDeepStrictEqual(original, verified2)) return void 0;
|
|
11887
12007
|
original = verified2;
|
|
@@ -15626,7 +15746,7 @@ async function retireRevokedMachineIdentity(options) {
|
|
|
15626
15746
|
requireOsProtection: existsSync(`${directory}.require-os`),
|
|
15627
15747
|
keyring: options.keyring
|
|
15628
15748
|
});
|
|
15629
|
-
const { Bytes } = yield* promise(() => import("./index-
|
|
15749
|
+
const { Bytes } = yield* promise(() => import("./index-FDl9UATC.js"));
|
|
15630
15750
|
const genesis = yield* fromResult(Bytes.genesisHash(bytes(options.genesisHash)));
|
|
15631
15751
|
const current = yield* custody.openDevice(genesis);
|
|
15632
15752
|
const key2 = hex(current.publicKey.toBytes());
|
|
@@ -15695,7 +15815,7 @@ async function eraseRemovedWorkspace(options) {
|
|
|
15695
15815
|
directory: join$1(directory, "custody"),
|
|
15696
15816
|
keyring: options.keyring
|
|
15697
15817
|
});
|
|
15698
|
-
const { Bytes } = yield* promise(() => import("./index-
|
|
15818
|
+
const { Bytes } = yield* promise(() => import("./index-FDl9UATC.js"));
|
|
15699
15819
|
const genesis = yield* fromResult(
|
|
15700
15820
|
Bytes.genesisHash(bytes(removal.genesisHash))
|
|
15701
15821
|
);
|
|
@@ -15826,7 +15946,7 @@ async function prepareCliE2eeMachineLegacy(options) {
|
|
|
15826
15946
|
);
|
|
15827
15947
|
}
|
|
15828
15948
|
async function prepareMachine(options) {
|
|
15829
|
-
const { Bytes, hashRecordBytes: hashRecordBytes2, verifyLedgerEffect: verifyLedgerEffect2 } = await import("./index-
|
|
15949
|
+
const { Bytes, hashRecordBytes: hashRecordBytes2, verifyLedgerEffect: verifyLedgerEffect2 } = await import("./index-FDl9UATC.js");
|
|
15830
15950
|
const binding = Binding.parse({
|
|
15831
15951
|
workspaceId: options.workspaceId,
|
|
15832
15952
|
genesisHash: options.genesisHash,
|
|
@@ -16025,7 +16145,7 @@ async function openWorkspaceOwned(scope2, options, requireActivation, pairing) {
|
|
|
16025
16145
|
keyring: options.keyring
|
|
16026
16146
|
});
|
|
16027
16147
|
const { Bytes, hashRecordBytes: hashRecordBytes2 } = yield* promise(
|
|
16028
|
-
() => import("./index-
|
|
16148
|
+
() => import("./index-FDl9UATC.js")
|
|
16029
16149
|
);
|
|
16030
16150
|
const genesis = yield* fromResult(Bytes.genesisHash(bytes(binding.genesisHash)));
|
|
16031
16151
|
if (hex(hashRecordBytes2(bytes(binding.genesisRecordHex)).toBytes()) !== binding.genesisHash)
|
|
@@ -16171,7 +16291,7 @@ async function openWorkspaceOwned(scope2, options, requireActivation, pairing) {
|
|
|
16171
16291
|
const rpc = makeE2eeRpcNative({
|
|
16172
16292
|
workspaceId: options.workspaceId,
|
|
16173
16293
|
requesterDevice: opened.signingPublicKey,
|
|
16174
|
-
authorizeTarget: (machineId) => opened.sharingRemote ? opened.sharing.authorize(machineId, opened.signingPublicKey, void 0, opened.sharingRemote).pipe(map$2((result2) => result2.allowed)) : succeed$2(
|
|
16294
|
+
authorizeTarget: (machineId) => opened.sharingRemote ? opened.sharing.authorize(machineId, opened.signingPublicKey, void 0, opened.sharingRemote).pipe(map$2((result2) => result2.allowed || result2.reason === "policy-unavailable")) : succeed$2(true),
|
|
16175
16295
|
originals: new E2eeRpcOriginals(
|
|
16176
16296
|
join$1(
|
|
16177
16297
|
repositoryDirectory(directory, binding.genesisHash, opened.signingPublicKey),
|
|
@@ -16398,7 +16518,7 @@ async function openWorkspaceOwned(scope2, options, requireActivation, pairing) {
|
|
|
16398
16518
|
scoped(
|
|
16399
16519
|
gen$1(function* () {
|
|
16400
16520
|
yield* openMachinePairingJournal(directory);
|
|
16401
|
-
const { Bytes } = yield* promise(() => import("./index-
|
|
16521
|
+
const { Bytes } = yield* promise(() => import("./index-FDl9UATC.js"));
|
|
16402
16522
|
const genesis = yield* fromResult(Bytes.genesisHash(bytes(options.genesisHash)));
|
|
16403
16523
|
const current = yield* opened.custody.openDevice(genesis);
|
|
16404
16524
|
if (hex(current.publicKey.toBytes()) !== opened.signingPublicKey || (yield* opened.custody.deviceCredential(genesis, current.publicKey)) !== opened.credential)
|
|
@@ -16658,6 +16778,26 @@ async function openWorkspaceOwned(scope2, options, requireActivation, pairing) {
|
|
|
16658
16778
|
isExecutionOpen: () => !closed
|
|
16659
16779
|
})
|
|
16660
16780
|
);
|
|
16781
|
+
const resolveVerifiedExecutionOriginal = makeVerifiedExecutionOriginal({
|
|
16782
|
+
workspaceId: options.workspaceId,
|
|
16783
|
+
selfDevice: opened.signingPublicKey,
|
|
16784
|
+
isClosed: () => closed,
|
|
16785
|
+
origins: executionOrigins,
|
|
16786
|
+
readIncoming: (intent) => rpc.readIncoming(intent),
|
|
16787
|
+
openDispatch: dispatchNative.openDispatch,
|
|
16788
|
+
ledger: () => opened.runtime.executionLedger(),
|
|
16789
|
+
openContent: (intent, request) => gen$1(function* () {
|
|
16790
|
+
if (closed || intent.workspaceId !== options.workspaceId)
|
|
16791
|
+
return yield* fail$v(new Error("e2ee_execution_origin_unavailable"));
|
|
16792
|
+
const contentBinding = yield* opened.runtime.binding(
|
|
16793
|
+
sessionContentResource(intent.sessionId),
|
|
16794
|
+
"loro",
|
|
16795
|
+
"current"
|
|
16796
|
+
);
|
|
16797
|
+
return yield* contentBinding.openAuthenticated(request);
|
|
16798
|
+
}),
|
|
16799
|
+
recover: originRecovery?.recover
|
|
16800
|
+
});
|
|
16661
16801
|
return {
|
|
16662
16802
|
attachmentToken: async () => {
|
|
16663
16803
|
if (closed) throw new Error("e2ee_closed");
|
|
@@ -16678,51 +16818,44 @@ async function openWorkspaceOwned(scope2, options, requireActivation, pairing) {
|
|
|
16678
16818
|
),
|
|
16679
16819
|
authorizeScheduleExecution,
|
|
16680
16820
|
authorizeScheduleExecutionLegacy: (request, doc) => run(authorizeScheduleExecution(request, doc)),
|
|
16681
|
-
resolveVerifiedExecutionOriginal
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
const cached2 = yield* rpc.readIncoming(intent).pipe(catch_(() => succeed$2(void 0)));
|
|
16686
|
-
const rpcOriginal = typeof fromDoc === "string" ? fromDoc : cached2 ? hex(cached2.frame) : void 0;
|
|
16687
|
-
if (rpcOriginal !== void 0) {
|
|
16688
|
-
if (cached2 && hex(cached2.frame) !== rpcOriginal) return void 0;
|
|
16689
|
-
const view = yield* opened.runtime.executionLedger();
|
|
16821
|
+
resolveVerifiedExecutionOriginal,
|
|
16822
|
+
ledgerIdentity: {
|
|
16823
|
+
ownsDevice: (device) => opened.runtime.executionLedger().pipe(
|
|
16824
|
+
map$2((view) => {
|
|
16690
16825
|
const state = view.inspectState();
|
|
16691
|
-
const
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
expiresAt: verified2.expiresAt
|
|
16704
|
-
};
|
|
16826
|
+
const own2 = state.devices.get(opened.signingPublicKey);
|
|
16827
|
+
const entry = state.devices.get(device);
|
|
16828
|
+
return !!own2 && !!entry && own2.membershipId.equals(entry.membershipId);
|
|
16829
|
+
})
|
|
16830
|
+
),
|
|
16831
|
+
memberDevice: (cryptoUserId) => opened.runtime.executionLedger().pipe(
|
|
16832
|
+
map$2((view) => {
|
|
16833
|
+
const state = view.inspectState();
|
|
16834
|
+
for (const [device, entry] of state.devices) {
|
|
16835
|
+
const member = state.members.get(hex(entry.membershipId.toBytes()));
|
|
16836
|
+
if (entry.kind === "personal" && member && hex(member.userId.toBytes()) === cryptoUserId)
|
|
16837
|
+
return device;
|
|
16705
16838
|
}
|
|
16706
|
-
|
|
16707
|
-
|
|
16708
|
-
|
|
16709
|
-
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
),
|
|
16839
|
+
return void 0;
|
|
16840
|
+
})
|
|
16841
|
+
)
|
|
16842
|
+
},
|
|
16843
|
+
authorizeMachineTarget: (machineId, localProjectId) => gen$1(function* () {
|
|
16844
|
+
const state = (yield* opened.runtime.executionLedger()).inspectState();
|
|
16845
|
+
const own2 = state.devices.get(opened.signingPublicKey);
|
|
16846
|
+
for (const device of state.devices.values())
|
|
16847
|
+
if (device.kind === "machine" && device.machineId === machineId && own2?.membershipId.equals(device.membershipId))
|
|
16848
|
+
return true;
|
|
16849
|
+
if (!opened.sharingRemote) return false;
|
|
16850
|
+
const result2 = yield* opened.sharing.authorize(
|
|
16851
|
+
machineId,
|
|
16852
|
+
opened.signingPublicKey,
|
|
16853
|
+
localProjectId,
|
|
16854
|
+
opened.sharingRemote
|
|
16855
|
+
);
|
|
16856
|
+
return result2.allowed;
|
|
16857
|
+
}),
|
|
16858
|
+
retainQueuedInput: (input) => executionOrigins.retainQueuedInput(input),
|
|
16726
16859
|
startRpc: (machineId, offer, trace, handleFeature) => run(
|
|
16727
16860
|
gen$1(function* () {
|
|
16728
16861
|
if (rpcFiber || closed) return;
|
|
@@ -16900,7 +17033,7 @@ async function retainMachineBootstrap(input, keyring) {
|
|
|
16900
17033
|
keyring
|
|
16901
17034
|
});
|
|
16902
17035
|
const { Bytes, signVerified: signVerified2 } = yield* promise(
|
|
16903
|
-
() => import("./index-
|
|
17036
|
+
() => import("./index-FDl9UATC.js")
|
|
16904
17037
|
);
|
|
16905
17038
|
const device = yield* custody.openDevice(
|
|
16906
17039
|
getOrThrow(Bytes.genesisHash(bytes(unsigned.genesisHash)))
|
|
@@ -16971,7 +17104,7 @@ async function loadMachineBootstrap(reference, machineId, keyring) {
|
|
|
16971
17104
|
keyring
|
|
16972
17105
|
});
|
|
16973
17106
|
const { Bytes, verifySignature: verifySignature2 } = yield* promise(
|
|
16974
|
-
() => import("./index-
|
|
17107
|
+
() => import("./index-FDl9UATC.js")
|
|
16975
17108
|
);
|
|
16976
17109
|
const genesis = getOrThrow(Bytes.genesisHash(bytes(bootstrap.genesisHash)));
|
|
16977
17110
|
const device = yield* custody.openDevice(genesis);
|
|
@@ -17170,4 +17303,4 @@ export {
|
|
|
17170
17303
|
confirmIndependentComparison as y,
|
|
17171
17304
|
contentAad as z
|
|
17172
17305
|
};
|
|
17173
|
-
//# sourceMappingURL=workspace-legacy-
|
|
17306
|
+
//# sourceMappingURL=workspace-legacy-Cu3kw51y.js.map
|