@dxos/client-services 0.7.2 → 0.7.3-main.2dd075e
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/lib/browser/{chunk-K5O5LV2R.mjs → chunk-5GKWY67F.mjs} +340 -422
- package/dist/lib/browser/chunk-5GKWY67F.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-SPLKKUM4.cjs → chunk-RVO5327U.cjs} +329 -411
- package/dist/lib/node/chunk-RVO5327U.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-NSCBFSXO.mjs → chunk-LMUKPYXE.mjs} +334 -416
- package/dist/lib/node-esm/chunk-LMUKPYXE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +5 -2
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +1 -0
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/packlets/agents/edge-agent-service.ts +28 -3
- package/src/packlets/identity/identity-service.ts +16 -1
- package/src/packlets/services/service-context.ts +4 -1
- package/src/packlets/services/service-host.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +4 -13
- package/src/packlets/spaces/epoch-migrations.ts +3 -84
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-K5O5LV2R.mjs.map +0 -7
- package/dist/lib/node/chunk-SPLKKUM4.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-NSCBFSXO.mjs.map +0 -7
|
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
397
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
398
398
|
|
|
399
399
|
// packages/sdk/client-services/src/version.ts
|
|
400
|
-
var DXOS_VERSION = "0.7.
|
|
400
|
+
var DXOS_VERSION = "0.7.3-main.2dd075e";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -1223,10 +1223,10 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
|
1223
1223
|
import { Context as Context5, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
1224
1224
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
1225
1225
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
1226
|
-
import { SpaceDocVersion as
|
|
1226
|
+
import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
|
|
1227
1227
|
import { failedInvariant } from "@dxos/invariant";
|
|
1228
1228
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
1229
|
-
import { log as
|
|
1229
|
+
import { log as log11 } from "@dxos/log";
|
|
1230
1230
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
1231
1231
|
import { SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1232
1232
|
import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -1280,12 +1280,7 @@ var AutomergeSpaceState = class extends Resource2 {
|
|
|
1280
1280
|
};
|
|
1281
1281
|
|
|
1282
1282
|
// packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts
|
|
1283
|
-
import { migrateDocument } from "@dxos/echo-db";
|
|
1284
|
-
import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfType } from "@dxos/echo-pipeline";
|
|
1285
|
-
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
1286
|
-
import { TYPE_PROPERTIES } from "@dxos/echo-schema";
|
|
1287
1283
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1288
|
-
import { log as log4 } from "@dxos/log";
|
|
1289
1284
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
1290
1285
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
1291
1286
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
@@ -1312,133 +1307,16 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
1312
1307
|
};
|
|
1313
1308
|
}
|
|
1314
1309
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
1315
|
-
|
|
1316
|
-
F: __dxlog_file6,
|
|
1317
|
-
L: 64,
|
|
1318
|
-
S: void 0,
|
|
1319
|
-
C: (f, a) => f(...a)
|
|
1320
|
-
});
|
|
1321
|
-
const currentRootUrl = context.currentRoot;
|
|
1322
|
-
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
1323
|
-
timeout: LOAD_DOC_TIMEOUT
|
|
1324
|
-
});
|
|
1325
|
-
const objects = Object.entries(rootHandle.docSync().objects);
|
|
1326
|
-
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
1327
|
-
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
1328
|
-
invariant3(properties, "Properties not found", {
|
|
1329
|
-
F: __dxlog_file6,
|
|
1330
|
-
L: 75,
|
|
1331
|
-
S: void 0,
|
|
1332
|
-
A: [
|
|
1333
|
-
"properties",
|
|
1334
|
-
"'Properties not found'"
|
|
1335
|
-
]
|
|
1336
|
-
});
|
|
1337
|
-
const newRoot = context.echoHost.createDoc({
|
|
1338
|
-
...rootHandle.docSync(),
|
|
1339
|
-
objects: Object.fromEntries([
|
|
1340
|
-
properties
|
|
1341
|
-
])
|
|
1342
|
-
});
|
|
1343
|
-
invariant3(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
1344
|
-
F: __dxlog_file6,
|
|
1345
|
-
L: 82,
|
|
1346
|
-
S: void 0,
|
|
1347
|
-
A: [
|
|
1348
|
-
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
1349
|
-
""
|
|
1350
|
-
]
|
|
1351
|
-
});
|
|
1352
|
-
const newLinks = [];
|
|
1353
|
-
for (const [id, objData] of otherObjects) {
|
|
1354
|
-
const handle = context.echoHost.createDoc({
|
|
1355
|
-
version: SpaceDocVersion.CURRENT,
|
|
1356
|
-
access: {
|
|
1357
|
-
spaceKey: context.spaceKey.toHex()
|
|
1358
|
-
},
|
|
1359
|
-
objects: {
|
|
1360
|
-
[id]: objData
|
|
1361
|
-
}
|
|
1362
|
-
});
|
|
1363
|
-
newLinks.push([
|
|
1364
|
-
id,
|
|
1365
|
-
handle.url
|
|
1366
|
-
]);
|
|
1367
|
-
}
|
|
1368
|
-
newRoot.change((doc) => {
|
|
1369
|
-
doc.links ??= {};
|
|
1370
|
-
for (const [id, url] of newLinks) {
|
|
1371
|
-
doc.links[id] = url;
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
await context.echoHost.flush();
|
|
1375
|
-
return {
|
|
1376
|
-
newRoot: newRoot.url
|
|
1377
|
-
};
|
|
1310
|
+
throw new Error("Migration not available");
|
|
1378
1311
|
}
|
|
1379
1312
|
case CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
1380
|
-
|
|
1381
|
-
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
1382
|
-
timeout: LOAD_DOC_TIMEOUT
|
|
1383
|
-
});
|
|
1384
|
-
invariant3(rootHandle.docSync(), "Root doc not found", {
|
|
1385
|
-
F: __dxlog_file6,
|
|
1386
|
-
L: 115,
|
|
1387
|
-
S: void 0,
|
|
1388
|
-
A: [
|
|
1389
|
-
"rootHandle.docSync()",
|
|
1390
|
-
"'Root doc not found'"
|
|
1391
|
-
]
|
|
1392
|
-
});
|
|
1393
|
-
const newRootContent = await convertLegacySpaceRootDoc(structuredClone(rootHandle.docSync()));
|
|
1394
|
-
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
1395
|
-
try {
|
|
1396
|
-
const handle = await context.echoHost.loadDoc(ctx, url, {
|
|
1397
|
-
timeout: LOAD_DOC_TIMEOUT
|
|
1398
|
-
});
|
|
1399
|
-
invariant3(handle.docSync(), void 0, {
|
|
1400
|
-
F: __dxlog_file6,
|
|
1401
|
-
L: 122,
|
|
1402
|
-
S: void 0,
|
|
1403
|
-
A: [
|
|
1404
|
-
"handle.docSync()",
|
|
1405
|
-
""
|
|
1406
|
-
]
|
|
1407
|
-
});
|
|
1408
|
-
const newDoc = await convertLegacyReferences(structuredClone(handle.docSync()));
|
|
1409
|
-
const migratedDoc = migrateDocument(handle.docSync(), newDoc);
|
|
1410
|
-
const newHandle = context.echoHost.createDoc(migratedDoc, {
|
|
1411
|
-
preserveHistory: true
|
|
1412
|
-
});
|
|
1413
|
-
newRootContent.links[id] = newHandle.url;
|
|
1414
|
-
} catch (err) {
|
|
1415
|
-
log4.warn("Failed to migrate reference", {
|
|
1416
|
-
id,
|
|
1417
|
-
url,
|
|
1418
|
-
error: err
|
|
1419
|
-
}, {
|
|
1420
|
-
F: __dxlog_file6,
|
|
1421
|
-
L: 128,
|
|
1422
|
-
S: void 0,
|
|
1423
|
-
C: (f, a) => f(...a)
|
|
1424
|
-
});
|
|
1425
|
-
delete newRootContent.links[id];
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
const migratedRoot = migrateDocument(rootHandle.docSync(), newRootContent);
|
|
1429
|
-
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
1430
|
-
preserveHistory: true
|
|
1431
|
-
});
|
|
1432
|
-
await context.echoHost.flush();
|
|
1433
|
-
return {
|
|
1434
|
-
newRoot: newRoot.url
|
|
1435
|
-
};
|
|
1313
|
+
throw new Error("Migration not available");
|
|
1436
1314
|
}
|
|
1437
1315
|
// TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
|
|
1438
1316
|
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
1439
1317
|
invariant3(context.newAutomergeRoot, void 0, {
|
|
1440
1318
|
F: __dxlog_file6,
|
|
1441
|
-
L:
|
|
1319
|
+
L: 62,
|
|
1442
1320
|
S: void 0,
|
|
1443
1321
|
A: [
|
|
1444
1322
|
"context.newAutomergeRoot",
|
|
@@ -1460,7 +1338,7 @@ import { rejectOnDispose, Resource as Resource3 } from "@dxos/context";
|
|
|
1460
1338
|
import { verifyCredential as verifyCredential2 } from "@dxos/credentials";
|
|
1461
1339
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1462
1340
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1463
|
-
import { logInfo as logInfo2, log as
|
|
1341
|
+
import { logInfo as logInfo2, log as log4 } from "@dxos/log";
|
|
1464
1342
|
import { EdgeCallFailedError } from "@dxos/protocols";
|
|
1465
1343
|
import { schema as schema2 } from "@dxos/protocols/proto";
|
|
1466
1344
|
import { RpcExtension } from "@dxos/teleport";
|
|
@@ -1543,7 +1421,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1543
1421
|
* Request credentials to be notarized.
|
|
1544
1422
|
*/
|
|
1545
1423
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
|
|
1546
|
-
|
|
1424
|
+
log4("notarize", {
|
|
1547
1425
|
credentials
|
|
1548
1426
|
}, {
|
|
1549
1427
|
F: __dxlog_file7,
|
|
@@ -1563,7 +1441,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1563
1441
|
const errors = new Trigger2();
|
|
1564
1442
|
const ctx = this._ctx.derive({
|
|
1565
1443
|
onError: (err) => {
|
|
1566
|
-
|
|
1444
|
+
log4.warn("Notarization error", {
|
|
1567
1445
|
err
|
|
1568
1446
|
}, {
|
|
1569
1447
|
F: __dxlog_file7,
|
|
@@ -1597,7 +1475,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1597
1475
|
allNotarized,
|
|
1598
1476
|
errors.wait()
|
|
1599
1477
|
]);
|
|
1600
|
-
|
|
1478
|
+
log4("done", void 0, {
|
|
1601
1479
|
F: __dxlog_file7,
|
|
1602
1480
|
L: 187,
|
|
1603
1481
|
S: this,
|
|
@@ -1618,7 +1496,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1618
1496
|
...this._extensions
|
|
1619
1497
|
].find((peer2) => !peersTried.has(peer2));
|
|
1620
1498
|
if (!peer) {
|
|
1621
|
-
|
|
1499
|
+
log4.info("Exhausted all peers to notarize with", {
|
|
1622
1500
|
retryIn: retryTimeout
|
|
1623
1501
|
}, {
|
|
1624
1502
|
F: __dxlog_file7,
|
|
@@ -1631,7 +1509,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1631
1509
|
return;
|
|
1632
1510
|
}
|
|
1633
1511
|
peersTried.add(peer);
|
|
1634
|
-
|
|
1512
|
+
log4("try notarizing", {
|
|
1635
1513
|
peer: peer.localPeerId,
|
|
1636
1514
|
credentialId: credentials.map((credential) => credential.id)
|
|
1637
1515
|
}, {
|
|
@@ -1643,7 +1521,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1643
1521
|
await peer.rpc.NotarizationService.notarize({
|
|
1644
1522
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
1645
1523
|
});
|
|
1646
|
-
|
|
1524
|
+
log4("success", void 0, {
|
|
1647
1525
|
F: __dxlog_file7,
|
|
1648
1526
|
L: 221,
|
|
1649
1527
|
S: this,
|
|
@@ -1652,7 +1530,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1652
1530
|
await sleep(successDelay);
|
|
1653
1531
|
} catch (err) {
|
|
1654
1532
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1655
|
-
|
|
1533
|
+
log4.info("error notarizing (recoverable)", err, {
|
|
1656
1534
|
F: __dxlog_file7,
|
|
1657
1535
|
L: 226,
|
|
1658
1536
|
S: this,
|
|
@@ -1681,7 +1559,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1681
1559
|
jitter: timeouts.jitter
|
|
1682
1560
|
}
|
|
1683
1561
|
});
|
|
1684
|
-
|
|
1562
|
+
log4("edge notarization success", void 0, {
|
|
1685
1563
|
F: __dxlog_file7,
|
|
1686
1564
|
L: 254,
|
|
1687
1565
|
S: this,
|
|
@@ -1734,7 +1612,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1734
1612
|
});
|
|
1735
1613
|
const credentials = response.awaitingNotarization.credentials;
|
|
1736
1614
|
if (!credentials.length) {
|
|
1737
|
-
|
|
1615
|
+
log4("edge did not return credentials for notarization", void 0, {
|
|
1738
1616
|
F: __dxlog_file7,
|
|
1739
1617
|
L: 296,
|
|
1740
1618
|
S: this,
|
|
@@ -1742,7 +1620,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1742
1620
|
});
|
|
1743
1621
|
return;
|
|
1744
1622
|
}
|
|
1745
|
-
|
|
1623
|
+
log4("got edge credentials for notarization", {
|
|
1746
1624
|
count: credentials.length
|
|
1747
1625
|
}, {
|
|
1748
1626
|
F: __dxlog_file7,
|
|
@@ -1755,7 +1633,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1755
1633
|
return credentialCodec.decode(binary);
|
|
1756
1634
|
});
|
|
1757
1635
|
await this._notarizeCredentials(writer, decodedCredentials);
|
|
1758
|
-
|
|
1636
|
+
log4.info("notarized edge credentials", {
|
|
1759
1637
|
count: decodedCredentials.length
|
|
1760
1638
|
}, {
|
|
1761
1639
|
F: __dxlog_file7,
|
|
@@ -1807,7 +1685,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1807
1685
|
createExtension() {
|
|
1808
1686
|
const extension = new NotarizationTeleportExtension({
|
|
1809
1687
|
onOpen: async () => {
|
|
1810
|
-
|
|
1688
|
+
log4("extension opened", {
|
|
1811
1689
|
peer: extension.localPeerId
|
|
1812
1690
|
}, {
|
|
1813
1691
|
F: __dxlog_file7,
|
|
@@ -1819,7 +1697,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1819
1697
|
this._extensionOpened.emit();
|
|
1820
1698
|
},
|
|
1821
1699
|
onClose: async () => {
|
|
1822
|
-
|
|
1700
|
+
log4("extension closed", {
|
|
1823
1701
|
peer: extension.localPeerId
|
|
1824
1702
|
}, {
|
|
1825
1703
|
F: __dxlog_file7,
|
|
@@ -1835,7 +1713,7 @@ var NotarizationPlugin = class extends Resource3 {
|
|
|
1835
1713
|
}
|
|
1836
1714
|
_scheduleTimeout(ctx, errors, timeout) {
|
|
1837
1715
|
scheduleTask2(ctx, () => {
|
|
1838
|
-
|
|
1716
|
+
log4.warn("Notarization timeout", {
|
|
1839
1717
|
timeout,
|
|
1840
1718
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1841
1719
|
}, {
|
|
@@ -1854,14 +1732,14 @@ _ts_decorate2([
|
|
|
1854
1732
|
], NotarizationPlugin.prototype, "_spaceId", void 0);
|
|
1855
1733
|
var handleEdgeError = (error) => {
|
|
1856
1734
|
if (!(error instanceof EdgeCallFailedError) || error.errorData) {
|
|
1857
|
-
|
|
1735
|
+
log4.catch(error, void 0, {
|
|
1858
1736
|
F: __dxlog_file7,
|
|
1859
1737
|
L: 381,
|
|
1860
1738
|
S: void 0,
|
|
1861
1739
|
C: (f, a) => f(...a)
|
|
1862
1740
|
});
|
|
1863
1741
|
} else {
|
|
1864
|
-
|
|
1742
|
+
log4.info("Edge notarization failure", {
|
|
1865
1743
|
reason: error.reason
|
|
1866
1744
|
}, {
|
|
1867
1745
|
F: __dxlog_file7,
|
|
@@ -1909,7 +1787,7 @@ import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSign
|
|
|
1909
1787
|
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
1910
1788
|
import { invariant as invariant7 } from "@dxos/invariant";
|
|
1911
1789
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1912
|
-
import { log as
|
|
1790
|
+
import { log as log8 } from "@dxos/log";
|
|
1913
1791
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1914
1792
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
1915
1793
|
import { trace as trace3 } from "@dxos/tracing";
|
|
@@ -1918,7 +1796,7 @@ import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
|
1918
1796
|
// packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts
|
|
1919
1797
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
1920
1798
|
import { SpaceId } from "@dxos/keys";
|
|
1921
|
-
import { log as
|
|
1799
|
+
import { log as log5 } from "@dxos/log";
|
|
1922
1800
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
1923
1801
|
var DefaultSpaceStateMachine = class {
|
|
1924
1802
|
constructor(_params) {
|
|
@@ -1932,7 +1810,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1932
1810
|
switch (assertion["@type"]) {
|
|
1933
1811
|
case "dxos.halo.credentials.DefaultSpace": {
|
|
1934
1812
|
if (!credential.subject.id.equals(this._params.identityKey)) {
|
|
1935
|
-
|
|
1813
|
+
log5.warn("Invalid default space credential", {
|
|
1936
1814
|
expectedIdentity: this._params.identityKey,
|
|
1937
1815
|
credential
|
|
1938
1816
|
}, {
|
|
@@ -1944,7 +1822,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1944
1822
|
return;
|
|
1945
1823
|
}
|
|
1946
1824
|
if (!SpaceId.isValid(assertion.spaceId)) {
|
|
1947
|
-
|
|
1825
|
+
log5.warn("Invalid default space id", {
|
|
1948
1826
|
id: assertion.spaceId
|
|
1949
1827
|
}, {
|
|
1950
1828
|
F: __dxlog_file8,
|
|
@@ -1963,16 +1841,16 @@ var DefaultSpaceStateMachine = class {
|
|
|
1963
1841
|
|
|
1964
1842
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1965
1843
|
import { Event as Event4, synchronized, trackLeaks } from "@dxos/async";
|
|
1966
|
-
import { PropertiesType } from "@dxos/client-protocol";
|
|
1844
|
+
import { PropertiesType, TYPE_PROPERTIES } from "@dxos/client-protocol";
|
|
1967
1845
|
import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/context";
|
|
1968
1846
|
import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
1969
|
-
import {
|
|
1970
|
-
import {
|
|
1971
|
-
import {
|
|
1847
|
+
import { findInlineObjectOfType, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
1848
|
+
import { SpaceDocVersion, encodeReference } from "@dxos/echo-protocol";
|
|
1849
|
+
import { createObjectId, getTypeReference } from "@dxos/echo-schema";
|
|
1972
1850
|
import { writeMessages } from "@dxos/feed-store";
|
|
1973
1851
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1974
1852
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1975
|
-
import { log as
|
|
1853
|
+
import { log as log6 } from "@dxos/log";
|
|
1976
1854
|
import { AlreadyJoinedError, trace as Trace } from "@dxos/protocols";
|
|
1977
1855
|
import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
1978
1856
|
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
@@ -2095,7 +1973,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2095
1973
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
2096
1974
|
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
2097
1975
|
const rootDoc = rootHandle?.docSync();
|
|
2098
|
-
const properties = rootDoc &&
|
|
1976
|
+
const properties = rootDoc && findInlineObjectOfType(rootDoc, TYPE_PROPERTIES);
|
|
2099
1977
|
return {
|
|
2100
1978
|
key: space.key.toHex(),
|
|
2101
1979
|
state: SpaceState[space.state],
|
|
@@ -2115,65 +1993,65 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2115
1993
|
return this._spaces;
|
|
2116
1994
|
}
|
|
2117
1995
|
async _open() {
|
|
2118
|
-
|
|
1996
|
+
log6("open", void 0, {
|
|
2119
1997
|
F: __dxlog_file9,
|
|
2120
|
-
L:
|
|
1998
|
+
L: 192,
|
|
2121
1999
|
S: this,
|
|
2122
2000
|
C: (f, a) => f(...a)
|
|
2123
2001
|
});
|
|
2124
|
-
|
|
2002
|
+
log6.trace("dxos.echo.data-space-manager.open", Trace.begin({
|
|
2125
2003
|
id: this._instanceId
|
|
2126
2004
|
}), {
|
|
2127
2005
|
F: __dxlog_file9,
|
|
2128
|
-
L:
|
|
2006
|
+
L: 193,
|
|
2129
2007
|
S: this,
|
|
2130
2008
|
C: (f, a) => f(...a)
|
|
2131
2009
|
});
|
|
2132
|
-
|
|
2010
|
+
log6("metadata loaded", {
|
|
2133
2011
|
spaces: this._metadataStore.spaces.length
|
|
2134
2012
|
}, {
|
|
2135
2013
|
F: __dxlog_file9,
|
|
2136
|
-
L:
|
|
2014
|
+
L: 194,
|
|
2137
2015
|
S: this,
|
|
2138
2016
|
C: (f, a) => f(...a)
|
|
2139
2017
|
});
|
|
2140
2018
|
await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
2141
2019
|
try {
|
|
2142
|
-
|
|
2020
|
+
log6("load space", {
|
|
2143
2021
|
spaceMetadata
|
|
2144
2022
|
}, {
|
|
2145
2023
|
F: __dxlog_file9,
|
|
2146
|
-
L:
|
|
2024
|
+
L: 198,
|
|
2147
2025
|
S: this,
|
|
2148
2026
|
C: (f, a) => f(...a)
|
|
2149
2027
|
});
|
|
2150
2028
|
await this._constructSpace(spaceMetadata);
|
|
2151
2029
|
} catch (err) {
|
|
2152
|
-
|
|
2030
|
+
log6.error("Error loading space", {
|
|
2153
2031
|
spaceMetadata,
|
|
2154
2032
|
err
|
|
2155
2033
|
}, {
|
|
2156
2034
|
F: __dxlog_file9,
|
|
2157
|
-
L:
|
|
2035
|
+
L: 201,
|
|
2158
2036
|
S: this,
|
|
2159
2037
|
C: (f, a) => f(...a)
|
|
2160
2038
|
});
|
|
2161
2039
|
}
|
|
2162
2040
|
});
|
|
2163
2041
|
this.updated.emit();
|
|
2164
|
-
|
|
2042
|
+
log6.trace("dxos.echo.data-space-manager.open", Trace.end({
|
|
2165
2043
|
id: this._instanceId
|
|
2166
2044
|
}), {
|
|
2167
2045
|
F: __dxlog_file9,
|
|
2168
|
-
L:
|
|
2046
|
+
L: 207,
|
|
2169
2047
|
S: this,
|
|
2170
2048
|
C: (f, a) => f(...a)
|
|
2171
2049
|
});
|
|
2172
2050
|
}
|
|
2173
2051
|
async _close() {
|
|
2174
|
-
|
|
2052
|
+
log6("close", void 0, {
|
|
2175
2053
|
F: __dxlog_file9,
|
|
2176
|
-
L:
|
|
2054
|
+
L: 212,
|
|
2177
2055
|
S: this,
|
|
2178
2056
|
C: (f, a) => f(...a)
|
|
2179
2057
|
});
|
|
@@ -2188,7 +2066,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2188
2066
|
async createSpace() {
|
|
2189
2067
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
2190
2068
|
F: __dxlog_file9,
|
|
2191
|
-
L:
|
|
2069
|
+
L: 224,
|
|
2192
2070
|
S: this,
|
|
2193
2071
|
A: [
|
|
2194
2072
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2205,11 +2083,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2205
2083
|
dataFeedKey,
|
|
2206
2084
|
state: SpaceState.SPACE_ACTIVE
|
|
2207
2085
|
};
|
|
2208
|
-
|
|
2086
|
+
log6("creating space...", {
|
|
2209
2087
|
spaceKey
|
|
2210
2088
|
}, {
|
|
2211
2089
|
F: __dxlog_file9,
|
|
2212
|
-
L:
|
|
2090
|
+
L: 236,
|
|
2213
2091
|
S: this,
|
|
2214
2092
|
C: (f, a) => f(...a)
|
|
2215
2093
|
});
|
|
@@ -2221,7 +2099,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2221
2099
|
const memberCredential = credentials[1];
|
|
2222
2100
|
invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2223
2101
|
F: __dxlog_file9,
|
|
2224
|
-
L:
|
|
2102
|
+
L: 246,
|
|
2225
2103
|
S: this,
|
|
2226
2104
|
A: [
|
|
2227
2105
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2238,22 +2116,20 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2238
2116
|
return false;
|
|
2239
2117
|
}
|
|
2240
2118
|
switch (space.databaseRoot.getVersion()) {
|
|
2241
|
-
case
|
|
2242
|
-
const [_, properties] =
|
|
2119
|
+
case SpaceDocVersion.CURRENT: {
|
|
2120
|
+
const [_, properties] = findInlineObjectOfType(space.databaseRoot.docSync(), TYPE_PROPERTIES) ?? [];
|
|
2243
2121
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
2244
2122
|
}
|
|
2245
|
-
case
|
|
2246
|
-
|
|
2247
|
-
const [_, properties] = findInlineObjectOfType2(convertedDoc, LEGACY_TYPE_PROPERTIES) ?? [];
|
|
2248
|
-
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
2123
|
+
case SpaceDocVersion.LEGACY: {
|
|
2124
|
+
throw new Error("Legacy space version is not supported");
|
|
2249
2125
|
}
|
|
2250
2126
|
default:
|
|
2251
|
-
|
|
2127
|
+
log6.warn("unknown space version", {
|
|
2252
2128
|
version: space.databaseRoot.getVersion(),
|
|
2253
2129
|
spaceId: space.id
|
|
2254
2130
|
}, {
|
|
2255
2131
|
F: __dxlog_file9,
|
|
2256
|
-
L:
|
|
2132
|
+
L: 269,
|
|
2257
2133
|
S: this,
|
|
2258
2134
|
C: (f, a) => f(...a)
|
|
2259
2135
|
});
|
|
@@ -2288,7 +2164,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2288
2164
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
2289
2165
|
invariant5(automergeIndex, void 0, {
|
|
2290
2166
|
F: __dxlog_file9,
|
|
2291
|
-
L:
|
|
2167
|
+
L: 302,
|
|
2292
2168
|
S: this,
|
|
2293
2169
|
A: [
|
|
2294
2170
|
"automergeIndex",
|
|
@@ -2301,17 +2177,17 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2301
2177
|
}
|
|
2302
2178
|
// TODO(burdon): Rename join space.
|
|
2303
2179
|
async acceptSpace(opts) {
|
|
2304
|
-
|
|
2180
|
+
log6("accept space", {
|
|
2305
2181
|
opts
|
|
2306
2182
|
}, {
|
|
2307
2183
|
F: __dxlog_file9,
|
|
2308
|
-
L:
|
|
2184
|
+
L: 311,
|
|
2309
2185
|
S: this,
|
|
2310
2186
|
C: (f, a) => f(...a)
|
|
2311
2187
|
});
|
|
2312
2188
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
2313
2189
|
F: __dxlog_file9,
|
|
2314
|
-
L:
|
|
2190
|
+
L: 312,
|
|
2315
2191
|
S: this,
|
|
2316
2192
|
A: [
|
|
2317
2193
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2320,7 +2196,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2320
2196
|
});
|
|
2321
2197
|
invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2322
2198
|
F: __dxlog_file9,
|
|
2323
|
-
L:
|
|
2199
|
+
L: 313,
|
|
2324
2200
|
S: this,
|
|
2325
2201
|
A: [
|
|
2326
2202
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -2344,7 +2220,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2344
2220
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
2345
2221
|
invariant5(space, void 0, {
|
|
2346
2222
|
F: __dxlog_file9,
|
|
2347
|
-
L:
|
|
2223
|
+
L: 333,
|
|
2348
2224
|
S: this,
|
|
2349
2225
|
A: [
|
|
2350
2226
|
"space",
|
|
@@ -2357,7 +2233,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2357
2233
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
2358
2234
|
invariant5(credentials[0].credential, void 0, {
|
|
2359
2235
|
F: __dxlog_file9,
|
|
2360
|
-
L:
|
|
2236
|
+
L: 352,
|
|
2361
2237
|
S: this,
|
|
2362
2238
|
A: [
|
|
2363
2239
|
"credentials[0].credential",
|
|
@@ -2367,7 +2243,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2367
2243
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2368
2244
|
invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2369
2245
|
F: __dxlog_file9,
|
|
2370
|
-
L:
|
|
2246
|
+
L: 354,
|
|
2371
2247
|
S: this,
|
|
2372
2248
|
A: [
|
|
2373
2249
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2405,7 +2281,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2405
2281
|
const space = this._spaces.get(spaceKey);
|
|
2406
2282
|
invariant5(space, "Space not found.", {
|
|
2407
2283
|
F: __dxlog_file9,
|
|
2408
|
-
L:
|
|
2284
|
+
L: 391,
|
|
2409
2285
|
S: this,
|
|
2410
2286
|
A: [
|
|
2411
2287
|
"space",
|
|
@@ -2426,11 +2302,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2426
2302
|
space.stateUpdate.emit();
|
|
2427
2303
|
}
|
|
2428
2304
|
async _constructSpace(metadata) {
|
|
2429
|
-
|
|
2305
|
+
log6("construct space", {
|
|
2430
2306
|
metadata
|
|
2431
2307
|
}, {
|
|
2432
2308
|
F: __dxlog_file9,
|
|
2433
|
-
L:
|
|
2309
|
+
L: 410,
|
|
2434
2310
|
S: this,
|
|
2435
2311
|
C: (f, a) => f(...a)
|
|
2436
2312
|
});
|
|
@@ -2470,11 +2346,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2470
2346
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
2471
2347
|
await this._connectEchoMeshReplicator(space, session);
|
|
2472
2348
|
} catch (err) {
|
|
2473
|
-
|
|
2349
|
+
log6.warn("error on authorized connection", {
|
|
2474
2350
|
err
|
|
2475
2351
|
}, {
|
|
2476
2352
|
F: __dxlog_file9,
|
|
2477
|
-
L:
|
|
2353
|
+
L: 452,
|
|
2478
2354
|
S: this,
|
|
2479
2355
|
C: (f, a) => f(...a)
|
|
2480
2356
|
});
|
|
@@ -2482,9 +2358,9 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2482
2358
|
}
|
|
2483
2359
|
}),
|
|
2484
2360
|
onAuthFailure: () => {
|
|
2485
|
-
|
|
2361
|
+
log6.warn("auth failure", void 0, {
|
|
2486
2362
|
F: __dxlog_file9,
|
|
2487
|
-
L:
|
|
2363
|
+
L: 457,
|
|
2488
2364
|
S: this,
|
|
2489
2365
|
C: (f, a) => f(...a)
|
|
2490
2366
|
});
|
|
@@ -2513,22 +2389,22 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2513
2389
|
signingContext: this._signingContext,
|
|
2514
2390
|
callbacks: {
|
|
2515
2391
|
beforeReady: async () => {
|
|
2516
|
-
|
|
2392
|
+
log6("before space ready", {
|
|
2517
2393
|
space: space.key
|
|
2518
2394
|
}, {
|
|
2519
2395
|
F: __dxlog_file9,
|
|
2520
|
-
L:
|
|
2396
|
+
L: 484,
|
|
2521
2397
|
S: this,
|
|
2522
2398
|
C: (f, a) => f(...a)
|
|
2523
2399
|
});
|
|
2524
2400
|
},
|
|
2525
2401
|
afterReady: async () => {
|
|
2526
|
-
|
|
2402
|
+
log6("after space ready", {
|
|
2527
2403
|
space: space.key,
|
|
2528
2404
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
2529
2405
|
}, {
|
|
2530
2406
|
F: __dxlog_file9,
|
|
2531
|
-
L:
|
|
2407
|
+
L: 487,
|
|
2532
2408
|
S: this,
|
|
2533
2409
|
C: (f, a) => f(...a)
|
|
2534
2410
|
});
|
|
@@ -2543,11 +2419,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2543
2419
|
}
|
|
2544
2420
|
},
|
|
2545
2421
|
beforeClose: async () => {
|
|
2546
|
-
|
|
2422
|
+
log6("before space close", {
|
|
2547
2423
|
space: space.key
|
|
2548
2424
|
}, {
|
|
2549
2425
|
F: __dxlog_file9,
|
|
2550
|
-
L:
|
|
2426
|
+
L: 495,
|
|
2551
2427
|
S: this,
|
|
2552
2428
|
C: (f, a) => f(...a)
|
|
2553
2429
|
});
|
|
@@ -2564,11 +2440,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2564
2440
|
if (setting === EdgeReplicationSetting.ENABLED) {
|
|
2565
2441
|
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2566
2442
|
} else if (this._echoEdgeReplicator) {
|
|
2567
|
-
|
|
2443
|
+
log6("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
|
|
2568
2444
|
spaceId: dataSpace.id
|
|
2569
2445
|
}, {
|
|
2570
2446
|
F: __dxlog_file9,
|
|
2571
|
-
L:
|
|
2447
|
+
L: 509,
|
|
2572
2448
|
S: this,
|
|
2573
2449
|
C: (f, a) => f(...a)
|
|
2574
2450
|
});
|
|
@@ -2594,11 +2470,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2594
2470
|
async _connectEchoMeshReplicator(space, session) {
|
|
2595
2471
|
const replicator = this._meshReplicator;
|
|
2596
2472
|
if (!replicator) {
|
|
2597
|
-
|
|
2473
|
+
log6.warn("p2p automerge replication disabled", {
|
|
2598
2474
|
space: space.key
|
|
2599
2475
|
}, {
|
|
2600
2476
|
F: __dxlog_file9,
|
|
2601
|
-
L:
|
|
2477
|
+
L: 536,
|
|
2602
2478
|
S: this,
|
|
2603
2479
|
C: (f, a) => f(...a)
|
|
2604
2480
|
});
|
|
@@ -2621,17 +2497,17 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2621
2497
|
return (s && member.role === SpaceMember3.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
|
|
2622
2498
|
});
|
|
2623
2499
|
sessionsToClose.forEach((session) => {
|
|
2624
|
-
void session.close().catch(
|
|
2500
|
+
void session.close().catch(log6.error);
|
|
2625
2501
|
});
|
|
2626
2502
|
closedSessions += sessionsToClose.length;
|
|
2627
2503
|
}
|
|
2628
|
-
|
|
2504
|
+
log6("processed member role changes", {
|
|
2629
2505
|
roleChangeCount: memberInfo.length,
|
|
2630
2506
|
peersOnline: presence.getPeersOnline().length,
|
|
2631
2507
|
closedSessions
|
|
2632
2508
|
}, {
|
|
2633
2509
|
F: __dxlog_file9,
|
|
2634
|
-
L:
|
|
2510
|
+
L: 562,
|
|
2635
2511
|
S: this,
|
|
2636
2512
|
C: (f, a) => f(...a)
|
|
2637
2513
|
});
|
|
@@ -2642,15 +2518,15 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2642
2518
|
if (role === SpaceMember3.Role.REMOVED) {
|
|
2643
2519
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
2644
2520
|
if (session != null) {
|
|
2645
|
-
|
|
2521
|
+
log6("closing a session with a removed peer", {
|
|
2646
2522
|
peerId: peerState.peerId
|
|
2647
2523
|
}, {
|
|
2648
2524
|
F: __dxlog_file9,
|
|
2649
|
-
L:
|
|
2525
|
+
L: 576,
|
|
2650
2526
|
S: this,
|
|
2651
2527
|
C: (f, a) => f(...a)
|
|
2652
2528
|
});
|
|
2653
|
-
void session.close().catch(
|
|
2529
|
+
void session.close().catch(log6.error);
|
|
2654
2530
|
}
|
|
2655
2531
|
}
|
|
2656
2532
|
}
|
|
@@ -2713,7 +2589,7 @@ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentia
|
|
|
2713
2589
|
import { raise } from "@dxos/debug";
|
|
2714
2590
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2715
2591
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
2716
|
-
import { log as
|
|
2592
|
+
import { log as log7 } from "@dxos/log";
|
|
2717
2593
|
import { ApiError, SpaceNotFoundError, encodeError, IdentityNotInitializedError, AuthorizationError } from "@dxos/protocols";
|
|
2718
2594
|
import { SpaceMember as SpaceMember4, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
2719
2595
|
import { trace as trace2 } from "@dxos/tracing";
|
|
@@ -2789,7 +2665,7 @@ var SpacesServiceImpl = class {
|
|
|
2789
2665
|
const scheduler = new UpdateScheduler(ctx, async () => {
|
|
2790
2666
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2791
2667
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
2792
|
-
|
|
2668
|
+
log7("update", () => ({
|
|
2793
2669
|
ids: spaces.map((space) => space.id)
|
|
2794
2670
|
}), {
|
|
2795
2671
|
F: __dxlog_file10,
|
|
@@ -3070,7 +2946,7 @@ var Identity = class {
|
|
|
3070
2946
|
this._presence = params.presence;
|
|
3071
2947
|
this.identityKey = params.identityKey;
|
|
3072
2948
|
this.deviceKey = params.deviceKey;
|
|
3073
|
-
|
|
2949
|
+
log8.trace("dxos.halo.device", {
|
|
3074
2950
|
deviceKey: params.deviceKey
|
|
3075
2951
|
}, {
|
|
3076
2952
|
F: __dxlog_file11,
|
|
@@ -3212,7 +3088,7 @@ var Identity = class {
|
|
|
3212
3088
|
]));
|
|
3213
3089
|
}
|
|
3214
3090
|
async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
|
|
3215
|
-
|
|
3091
|
+
log8("Admitting device:", {
|
|
3216
3092
|
identityKey: this.identityKey,
|
|
3217
3093
|
hostDevice: this.deviceKey,
|
|
3218
3094
|
deviceKey,
|
|
@@ -3280,7 +3156,7 @@ import { Context as Context4 } from "@dxos/context";
|
|
|
3280
3156
|
import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator, generateSeedPhrase, keyPairFromSeedPhrase } from "@dxos/credentials";
|
|
3281
3157
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
3282
3158
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
3283
|
-
import { log as
|
|
3159
|
+
import { log as log9 } from "@dxos/log";
|
|
3284
3160
|
import { trace as trace4 } from "@dxos/protocols";
|
|
3285
3161
|
import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
3286
3162
|
import { AdmittedFeed as AdmittedFeed3, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -3315,7 +3191,7 @@ var IdentityManager = class {
|
|
|
3315
3191
|
}
|
|
3316
3192
|
async open(ctx) {
|
|
3317
3193
|
const traceId = PublicKey7.random().toHex();
|
|
3318
|
-
|
|
3194
|
+
log9.trace("dxos.halo.identity-manager.open", trace4.begin({
|
|
3319
3195
|
id: traceId
|
|
3320
3196
|
}), {
|
|
3321
3197
|
F: __dxlog_file12,
|
|
@@ -3324,7 +3200,7 @@ var IdentityManager = class {
|
|
|
3324
3200
|
C: (f, a) => f(...a)
|
|
3325
3201
|
});
|
|
3326
3202
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
3327
|
-
|
|
3203
|
+
log9("identity record", {
|
|
3328
3204
|
identityRecord
|
|
3329
3205
|
}, {
|
|
3330
3206
|
F: __dxlog_file12,
|
|
@@ -3336,7 +3212,7 @@ var IdentityManager = class {
|
|
|
3336
3212
|
this._identity = await this._constructIdentity(identityRecord);
|
|
3337
3213
|
await this._identity.open(ctx);
|
|
3338
3214
|
await this._identity.ready();
|
|
3339
|
-
|
|
3215
|
+
log9.trace("dxos.halo.identity", {
|
|
3340
3216
|
identityKey: identityRecord.identityKey,
|
|
3341
3217
|
displayName: this._identity.profileDocument?.displayName
|
|
3342
3218
|
}, {
|
|
@@ -3347,7 +3223,7 @@ var IdentityManager = class {
|
|
|
3347
3223
|
});
|
|
3348
3224
|
this.stateUpdate.emit();
|
|
3349
3225
|
}
|
|
3350
|
-
|
|
3226
|
+
log9.trace("dxos.halo.identity-manager.open", trace4.end({
|
|
3351
3227
|
id: traceId
|
|
3352
3228
|
}), {
|
|
3353
3229
|
F: __dxlog_file12,
|
|
@@ -3372,7 +3248,7 @@ var IdentityManager = class {
|
|
|
3372
3248
|
"'Identity already exists.'"
|
|
3373
3249
|
]
|
|
3374
3250
|
});
|
|
3375
|
-
|
|
3251
|
+
log9("creating identity...", void 0, {
|
|
3376
3252
|
F: __dxlog_file12,
|
|
3377
3253
|
L: 146,
|
|
3378
3254
|
S: this,
|
|
@@ -3441,7 +3317,7 @@ var IdentityManager = class {
|
|
|
3441
3317
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
3442
3318
|
this._identity = identity;
|
|
3443
3319
|
await this._identity.ready();
|
|
3444
|
-
|
|
3320
|
+
log9.trace("dxos.halo.identity", {
|
|
3445
3321
|
identityKey: identityRecord.identityKey,
|
|
3446
3322
|
displayName: this._identity.profileDocument?.displayName
|
|
3447
3323
|
}, {
|
|
@@ -3451,7 +3327,7 @@ var IdentityManager = class {
|
|
|
3451
3327
|
C: (f, a) => f(...a)
|
|
3452
3328
|
});
|
|
3453
3329
|
this.stateUpdate.emit();
|
|
3454
|
-
|
|
3330
|
+
log9("created identity", {
|
|
3455
3331
|
identityKey: identity.identityKey,
|
|
3456
3332
|
deviceKey: identity.deviceKey,
|
|
3457
3333
|
profile: identity.profileDocument
|
|
@@ -3490,7 +3366,7 @@ var IdentityManager = class {
|
|
|
3490
3366
|
* Prepare an identity object as the first step of acceptIdentity flow.
|
|
3491
3367
|
*/
|
|
3492
3368
|
async prepareIdentity(params) {
|
|
3493
|
-
|
|
3369
|
+
log9("accepting identity", {
|
|
3494
3370
|
params
|
|
3495
3371
|
}, {
|
|
3496
3372
|
F: __dxlog_file12,
|
|
@@ -3535,7 +3411,7 @@ var IdentityManager = class {
|
|
|
3535
3411
|
this._identity = identity;
|
|
3536
3412
|
await this._identity.ready();
|
|
3537
3413
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
3538
|
-
|
|
3414
|
+
log9.trace("dxos.halo.identity", {
|
|
3539
3415
|
identityKey: this._identity.identityKey,
|
|
3540
3416
|
displayName: this._identity.profileDocument?.displayName
|
|
3541
3417
|
}, {
|
|
@@ -3549,7 +3425,7 @@ var IdentityManager = class {
|
|
|
3549
3425
|
...profile
|
|
3550
3426
|
});
|
|
3551
3427
|
this.stateUpdate.emit();
|
|
3552
|
-
|
|
3428
|
+
log9("accepted identity", {
|
|
3553
3429
|
identityKey: identity.identityKey,
|
|
3554
3430
|
deviceKey: identity.deviceKey
|
|
3555
3431
|
}, {
|
|
@@ -3677,7 +3553,7 @@ var IdentityManager = class {
|
|
|
3677
3553
|
""
|
|
3678
3554
|
]
|
|
3679
3555
|
});
|
|
3680
|
-
|
|
3556
|
+
log9("constructing identity", {
|
|
3681
3557
|
identityRecord
|
|
3682
3558
|
}, {
|
|
3683
3559
|
F: __dxlog_file12,
|
|
@@ -3741,7 +3617,7 @@ var IdentityManager = class {
|
|
|
3741
3617
|
edgeConnection: this._edgeConnection,
|
|
3742
3618
|
edgeFeatures: this._edgeFeatures
|
|
3743
3619
|
});
|
|
3744
|
-
|
|
3620
|
+
log9("done", {
|
|
3745
3621
|
identityKey: identityRecord.identityKey
|
|
3746
3622
|
}, {
|
|
3747
3623
|
F: __dxlog_file12,
|
|
@@ -3768,7 +3644,7 @@ var IdentityManager = class {
|
|
|
3768
3644
|
}));
|
|
3769
3645
|
},
|
|
3770
3646
|
onAuthFailure: () => {
|
|
3771
|
-
|
|
3647
|
+
log9.warn("auth failure", void 0, {
|
|
3772
3648
|
F: __dxlog_file12,
|
|
3773
3649
|
L: 434,
|
|
3774
3650
|
S: this,
|
|
@@ -3796,9 +3672,9 @@ IdentityManager = _ts_decorate5([
|
|
|
3796
3672
|
import { Trigger as Trigger3, sleep as sleep2 } from "@dxos/async";
|
|
3797
3673
|
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
3798
3674
|
import { Resource as Resource5 } from "@dxos/context";
|
|
3799
|
-
import { signPresentation } from "@dxos/credentials";
|
|
3675
|
+
import { createCredential as createCredential2, signPresentation } from "@dxos/credentials";
|
|
3800
3676
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
3801
|
-
import { log as
|
|
3677
|
+
import { log as log10 } from "@dxos/log";
|
|
3802
3678
|
import { SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3803
3679
|
import { safeAwaitAll } from "@dxos/util";
|
|
3804
3680
|
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
@@ -3901,6 +3777,28 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3901
3777
|
nonce
|
|
3902
3778
|
});
|
|
3903
3779
|
}
|
|
3780
|
+
async createAuthCredential() {
|
|
3781
|
+
const identity = this._identityManager.identity;
|
|
3782
|
+
invariant9(identity, "Identity not initialized.", {
|
|
3783
|
+
F: __dxlog_file13,
|
|
3784
|
+
L: 117,
|
|
3785
|
+
S: this,
|
|
3786
|
+
A: [
|
|
3787
|
+
"identity",
|
|
3788
|
+
"'Identity not initialized.'"
|
|
3789
|
+
]
|
|
3790
|
+
});
|
|
3791
|
+
return await createCredential2({
|
|
3792
|
+
assertion: {
|
|
3793
|
+
"@type": "dxos.halo.credentials.Auth"
|
|
3794
|
+
},
|
|
3795
|
+
issuer: identity.identityKey,
|
|
3796
|
+
subject: identity.identityKey,
|
|
3797
|
+
chain: identity.deviceCredentialChain,
|
|
3798
|
+
signingKey: identity.deviceKey,
|
|
3799
|
+
signer: this._keyring
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3904
3802
|
async _fixIdentityWithoutDefaultSpace(identity) {
|
|
3905
3803
|
let recodedDefaultSpace = false;
|
|
3906
3804
|
let foundDefaultSpace = false;
|
|
@@ -3917,11 +3815,11 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3917
3815
|
}
|
|
3918
3816
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
3919
3817
|
if (foundDefaultSpace) {
|
|
3920
|
-
|
|
3818
|
+
log10.warn("Multiple default spaces found. Using the first one.", {
|
|
3921
3819
|
duplicate: space.id
|
|
3922
3820
|
}, {
|
|
3923
3821
|
F: __dxlog_file13,
|
|
3924
|
-
L:
|
|
3822
|
+
L: 151,
|
|
3925
3823
|
S: this,
|
|
3926
3824
|
C: (f, a) => f(...a)
|
|
3927
3825
|
});
|
|
@@ -3933,9 +3831,9 @@ var IdentityServiceImpl = class extends Resource5 {
|
|
|
3933
3831
|
recordedDefaultSpaceTrigger.wake();
|
|
3934
3832
|
}
|
|
3935
3833
|
}, (err) => {
|
|
3936
|
-
|
|
3834
|
+
log10.catch(err, void 0, {
|
|
3937
3835
|
F: __dxlog_file13,
|
|
3938
|
-
L:
|
|
3836
|
+
L: 162,
|
|
3939
3837
|
S: this,
|
|
3940
3838
|
C: (f, a) => f(...a)
|
|
3941
3839
|
});
|
|
@@ -4074,7 +3972,7 @@ var DataSpace = class {
|
|
|
4074
3972
|
});
|
|
4075
3973
|
}
|
|
4076
3974
|
this._state = params.initialState;
|
|
4077
|
-
|
|
3975
|
+
log11("new state", {
|
|
4078
3976
|
state: SpaceState4[this._state]
|
|
4079
3977
|
}, {
|
|
4080
3978
|
F: __dxlog_file14,
|
|
@@ -4142,7 +4040,7 @@ var DataSpace = class {
|
|
|
4142
4040
|
await this._inner.startProtocol();
|
|
4143
4041
|
await this._edgeFeedReplicator?.open();
|
|
4144
4042
|
this._state = SpaceState4.SPACE_CONTROL_ONLY;
|
|
4145
|
-
|
|
4043
|
+
log11("new state", {
|
|
4146
4044
|
state: SpaceState4[this._state]
|
|
4147
4045
|
}, {
|
|
4148
4046
|
F: __dxlog_file14,
|
|
@@ -4162,7 +4060,7 @@ var DataSpace = class {
|
|
|
4162
4060
|
await this._callbacks.beforeClose?.();
|
|
4163
4061
|
await this.preClose.callSerial();
|
|
4164
4062
|
this._state = SpaceState4.SPACE_CLOSED;
|
|
4165
|
-
|
|
4063
|
+
log11("new state", {
|
|
4166
4064
|
state: SpaceState4[this._state]
|
|
4167
4065
|
}, {
|
|
4168
4066
|
F: __dxlog_file14,
|
|
@@ -4204,7 +4102,7 @@ var DataSpace = class {
|
|
|
4204
4102
|
await this.initializeDataPipeline();
|
|
4205
4103
|
} catch (err) {
|
|
4206
4104
|
if (err instanceof CancelledError || err instanceof ContextDisposedError) {
|
|
4207
|
-
|
|
4105
|
+
log11("data pipeline initialization cancelled", err, {
|
|
4208
4106
|
F: __dxlog_file14,
|
|
4209
4107
|
L: 311,
|
|
4210
4108
|
S: this,
|
|
@@ -4212,14 +4110,14 @@ var DataSpace = class {
|
|
|
4212
4110
|
});
|
|
4213
4111
|
return;
|
|
4214
4112
|
}
|
|
4215
|
-
|
|
4113
|
+
log11.error("Error initializing data pipeline", err, {
|
|
4216
4114
|
F: __dxlog_file14,
|
|
4217
4115
|
L: 315,
|
|
4218
4116
|
S: this,
|
|
4219
4117
|
C: (f, a) => f(...a)
|
|
4220
4118
|
});
|
|
4221
4119
|
this._state = SpaceState4.SPACE_ERROR;
|
|
4222
|
-
|
|
4120
|
+
log11("new state", {
|
|
4223
4121
|
state: SpaceState4[this._state]
|
|
4224
4122
|
}, {
|
|
4225
4123
|
F: __dxlog_file14,
|
|
@@ -4239,7 +4137,7 @@ var DataSpace = class {
|
|
|
4239
4137
|
throw new SystemError("Invalid operation");
|
|
4240
4138
|
}
|
|
4241
4139
|
this._state = SpaceState4.SPACE_INITIALIZING;
|
|
4242
|
-
|
|
4140
|
+
log11("new state", {
|
|
4243
4141
|
state: SpaceState4[this._state]
|
|
4244
4142
|
}, {
|
|
4245
4143
|
F: __dxlog_file14,
|
|
@@ -4247,7 +4145,7 @@ var DataSpace = class {
|
|
|
4247
4145
|
S: this,
|
|
4248
4146
|
C: (f, a) => f(...a)
|
|
4249
4147
|
});
|
|
4250
|
-
|
|
4148
|
+
log11("initializing control pipeline", void 0, {
|
|
4251
4149
|
F: __dxlog_file14,
|
|
4252
4150
|
L: 335,
|
|
4253
4151
|
S: this,
|
|
@@ -4256,21 +4154,21 @@ var DataSpace = class {
|
|
|
4256
4154
|
await this._initializeAndReadControlPipeline();
|
|
4257
4155
|
await sleep3(1);
|
|
4258
4156
|
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
|
|
4259
|
-
|
|
4157
|
+
log11("initializing automerge root", void 0, {
|
|
4260
4158
|
F: __dxlog_file14,
|
|
4261
4159
|
L: 343,
|
|
4262
4160
|
S: this,
|
|
4263
4161
|
C: (f, a) => f(...a)
|
|
4264
4162
|
});
|
|
4265
4163
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4266
|
-
|
|
4164
|
+
log11("waiting for space to be ready", void 0, {
|
|
4267
4165
|
F: __dxlog_file14,
|
|
4268
4166
|
L: 347,
|
|
4269
4167
|
S: this,
|
|
4270
4168
|
C: (f, a) => f(...a)
|
|
4271
4169
|
});
|
|
4272
4170
|
await ready;
|
|
4273
|
-
|
|
4171
|
+
log11("space is ready", void 0, {
|
|
4274
4172
|
F: __dxlog_file14,
|
|
4275
4173
|
L: 349,
|
|
4276
4174
|
S: this,
|
|
@@ -4280,7 +4178,7 @@ var DataSpace = class {
|
|
|
4280
4178
|
async _enterReadyState() {
|
|
4281
4179
|
await this._callbacks.beforeReady?.();
|
|
4282
4180
|
this._state = SpaceState4.SPACE_READY;
|
|
4283
|
-
|
|
4181
|
+
log11("new state", {
|
|
4284
4182
|
state: SpaceState4[this._state]
|
|
4285
4183
|
}, {
|
|
4286
4184
|
F: __dxlog_file14,
|
|
@@ -4299,7 +4197,7 @@ var DataSpace = class {
|
|
|
4299
4197
|
});
|
|
4300
4198
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4301
4199
|
await this._createWritableFeeds();
|
|
4302
|
-
|
|
4200
|
+
log11("writable feeds created", void 0, {
|
|
4303
4201
|
F: __dxlog_file14,
|
|
4304
4202
|
L: 373,
|
|
4305
4203
|
S: this,
|
|
@@ -4351,7 +4249,7 @@ var DataSpace = class {
|
|
|
4351
4249
|
}
|
|
4352
4250
|
if (credentials.length > 0) {
|
|
4353
4251
|
try {
|
|
4354
|
-
|
|
4252
|
+
log11("will notarize credentials for feed admission", {
|
|
4355
4253
|
count: credentials.length
|
|
4356
4254
|
}, {
|
|
4357
4255
|
F: __dxlog_file14,
|
|
@@ -4364,14 +4262,14 @@ var DataSpace = class {
|
|
|
4364
4262
|
credentials,
|
|
4365
4263
|
timeout: 0
|
|
4366
4264
|
});
|
|
4367
|
-
|
|
4265
|
+
log11("credentials notarized", void 0, {
|
|
4368
4266
|
F: __dxlog_file14,
|
|
4369
4267
|
L: 435,
|
|
4370
4268
|
S: this,
|
|
4371
4269
|
C: (f, a) => f(...a)
|
|
4372
4270
|
});
|
|
4373
4271
|
} catch (err) {
|
|
4374
|
-
|
|
4272
|
+
log11.error("error notarizing credentials for feed admission", err, {
|
|
4375
4273
|
F: __dxlog_file14,
|
|
4376
4274
|
L: 437,
|
|
4377
4275
|
S: this,
|
|
@@ -4383,7 +4281,7 @@ var DataSpace = class {
|
|
|
4383
4281
|
}
|
|
4384
4282
|
}
|
|
4385
4283
|
_onNewAutomergeRoot(rootUrl) {
|
|
4386
|
-
|
|
4284
|
+
log11("loading automerge root doc for space", {
|
|
4387
4285
|
space: this.key,
|
|
4388
4286
|
rootUrl
|
|
4389
4287
|
}, {
|
|
@@ -4417,7 +4315,7 @@ var DataSpace = class {
|
|
|
4417
4315
|
}
|
|
4418
4316
|
const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
|
|
4419
4317
|
this._databaseRoot = root;
|
|
4420
|
-
if (root.getVersion() !==
|
|
4318
|
+
if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
|
|
4421
4319
|
this._state = SpaceState4.SPACE_REQUIRES_MIGRATION;
|
|
4422
4320
|
this.stateUpdate.emit();
|
|
4423
4321
|
} else if (this._state !== SpaceState4.SPACE_READY) {
|
|
@@ -4434,7 +4332,7 @@ var DataSpace = class {
|
|
|
4434
4332
|
if (err instanceof ContextDisposedError) {
|
|
4435
4333
|
return;
|
|
4436
4334
|
}
|
|
4437
|
-
|
|
4335
|
+
log11.warn("error loading automerge root doc", {
|
|
4438
4336
|
space: this.key,
|
|
4439
4337
|
rootUrl,
|
|
4440
4338
|
err
|
|
@@ -4526,7 +4424,7 @@ var DataSpace = class {
|
|
|
4526
4424
|
await this._close();
|
|
4527
4425
|
}
|
|
4528
4426
|
this._state = SpaceState4.SPACE_INACTIVE;
|
|
4529
|
-
|
|
4427
|
+
log11("new state", {
|
|
4530
4428
|
state: SpaceState4[this._state]
|
|
4531
4429
|
}, {
|
|
4532
4430
|
F: __dxlog_file14,
|
|
@@ -4721,7 +4619,7 @@ import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
|
|
|
4721
4619
|
import { createKeyPair, sign as sign2 } from "@dxos/crypto";
|
|
4722
4620
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
4723
4621
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4724
|
-
import { log as
|
|
4622
|
+
import { log as log17 } from "@dxos/log";
|
|
4725
4623
|
import { createTeleportProtocolFactory } from "@dxos/network-manager";
|
|
4726
4624
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace7 } from "@dxos/protocols";
|
|
4727
4625
|
import { Invitation as Invitation7 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -4735,7 +4633,7 @@ import { scheduleMicroTask as scheduleMicroTask3, scheduleTask as scheduleTask5
|
|
|
4735
4633
|
import { sign } from "@dxos/crypto";
|
|
4736
4634
|
import { invariant as invariant11 } from "@dxos/invariant";
|
|
4737
4635
|
import { SpaceId as SpaceId2 } from "@dxos/keys";
|
|
4738
|
-
import { log as
|
|
4636
|
+
import { log as log12 } from "@dxos/log";
|
|
4739
4637
|
import { EdgeAuthChallengeError, EdgeCallFailedError as EdgeCallFailedError2 } from "@dxos/protocols";
|
|
4740
4638
|
import { schema as schema3 } from "@dxos/protocols/proto";
|
|
4741
4639
|
import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -4773,7 +4671,7 @@ var EdgeInvitationHandler = class {
|
|
|
4773
4671
|
}
|
|
4774
4672
|
handle(ctx, guardedState, protocol, deviceProfile) {
|
|
4775
4673
|
if (!this._client) {
|
|
4776
|
-
|
|
4674
|
+
log12("edge disabled", void 0, {
|
|
4777
4675
|
F: __dxlog_file16,
|
|
4778
4676
|
L: 66,
|
|
4779
4677
|
S: this,
|
|
@@ -4785,7 +4683,7 @@ var EdgeInvitationHandler = class {
|
|
|
4785
4683
|
const spaceId = invitation.spaceId;
|
|
4786
4684
|
const canBeHandledByEdge = invitation.authMethod !== Invitation4.AuthMethod.SHARED_SECRET && invitation.type === Invitation4.Type.DELEGATED && invitation.kind === Invitation4.Kind.SPACE && spaceId != null && SpaceId2.isValid(spaceId);
|
|
4787
4685
|
if (!canBeHandledByEdge) {
|
|
4788
|
-
|
|
4686
|
+
log12("invitation could not be handled by edge", {
|
|
4789
4687
|
invitation
|
|
4790
4688
|
}, {
|
|
4791
4689
|
F: __dxlog_file16,
|
|
@@ -4808,7 +4706,7 @@ var EdgeInvitationHandler = class {
|
|
|
4808
4706
|
await this._handleSpaceInvitationFlow(ctx, guardedState, admissionRequest.space, spaceId);
|
|
4809
4707
|
} catch (error) {
|
|
4810
4708
|
if (error instanceof EdgeCallFailedError2) {
|
|
4811
|
-
|
|
4709
|
+
log12.info("join space with edge unsuccessful", {
|
|
4812
4710
|
reason: error.message,
|
|
4813
4711
|
retryable: error.isRetryable,
|
|
4814
4712
|
after: error.retryAfterMs ?? this._calculateNextRetryMs()
|
|
@@ -4822,7 +4720,7 @@ var EdgeInvitationHandler = class {
|
|
|
4822
4720
|
scheduleTask5(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
|
|
4823
4721
|
}
|
|
4824
4722
|
} else if (requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
4825
|
-
|
|
4723
|
+
log12.info("failed to handle invitation with edge", {
|
|
4826
4724
|
error
|
|
4827
4725
|
}, {
|
|
4828
4726
|
F: __dxlog_file16,
|
|
@@ -4839,14 +4737,14 @@ var EdgeInvitationHandler = class {
|
|
|
4839
4737
|
}
|
|
4840
4738
|
async _handleSpaceInvitationFlow(ctx, guardedState, admissionRequest, spaceId) {
|
|
4841
4739
|
try {
|
|
4842
|
-
|
|
4740
|
+
log12("edge invitation flow", void 0, {
|
|
4843
4741
|
F: __dxlog_file16,
|
|
4844
4742
|
L: 123,
|
|
4845
4743
|
S: this,
|
|
4846
4744
|
C: (f, a) => f(...a)
|
|
4847
4745
|
});
|
|
4848
4746
|
this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
|
|
4849
|
-
|
|
4747
|
+
log12.verbose("edge invitation flow acquired the lock", void 0, {
|
|
4850
4748
|
F: __dxlog_file16,
|
|
4851
4749
|
L: 125,
|
|
4852
4750
|
S: this,
|
|
@@ -4919,7 +4817,7 @@ var EdgeInvitationHandler = class {
|
|
|
4919
4817
|
import { Trigger as Trigger4 } from "@dxos/async";
|
|
4920
4818
|
import { cancelWithContext as cancelWithContext4, Context as Context6 } from "@dxos/context";
|
|
4921
4819
|
import { invariant as invariant12 } from "@dxos/invariant";
|
|
4922
|
-
import { log as
|
|
4820
|
+
import { log as log13 } from "@dxos/log";
|
|
4923
4821
|
import { InvalidInvitationExtensionRoleError } from "@dxos/protocols";
|
|
4924
4822
|
import { schema as schema4 } from "@dxos/protocols/proto";
|
|
4925
4823
|
import { InvitationOptions } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
@@ -4979,14 +4877,14 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4979
4877
|
async onOpen(context) {
|
|
4980
4878
|
await super.onOpen(context);
|
|
4981
4879
|
try {
|
|
4982
|
-
|
|
4880
|
+
log13.verbose("guest acquire lock", void 0, {
|
|
4983
4881
|
F: __dxlog_file17,
|
|
4984
4882
|
L: 89,
|
|
4985
4883
|
S: this,
|
|
4986
4884
|
C: (f, a) => f(...a)
|
|
4987
4885
|
});
|
|
4988
4886
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
4989
|
-
|
|
4887
|
+
log13.verbose("guest lock acquired", void 0, {
|
|
4990
4888
|
F: __dxlog_file17,
|
|
4991
4889
|
L: 91,
|
|
4992
4890
|
S: this,
|
|
@@ -4995,7 +4893,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4995
4893
|
await cancelWithContext4(this._ctx, this.rpc.InvitationHostService.options({
|
|
4996
4894
|
role: InvitationOptions.Role.GUEST
|
|
4997
4895
|
}));
|
|
4998
|
-
|
|
4896
|
+
log13.verbose("options sent", void 0, {
|
|
4999
4897
|
F: __dxlog_file17,
|
|
5000
4898
|
L: 96,
|
|
5001
4899
|
S: this,
|
|
@@ -5004,7 +4902,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
5004
4902
|
await cancelWithContext4(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5005
4903
|
timeout: OPTIONS_TIMEOUT
|
|
5006
4904
|
}));
|
|
5007
|
-
|
|
4905
|
+
log13.verbose("options received", void 0, {
|
|
5008
4906
|
F: __dxlog_file17,
|
|
5009
4907
|
L: 98,
|
|
5010
4908
|
S: this,
|
|
@@ -5038,7 +4936,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
5038
4936
|
if (this._invitationFlowLock != null) {
|
|
5039
4937
|
this._invitationFlowLock.release();
|
|
5040
4938
|
this._invitationFlowLock = null;
|
|
5041
|
-
|
|
4939
|
+
log13.verbose("invitation flow lock released", void 0, {
|
|
5042
4940
|
F: __dxlog_file17,
|
|
5043
4941
|
L: 131,
|
|
5044
4942
|
S: this,
|
|
@@ -5054,7 +4952,7 @@ import { cancelWithContext as cancelWithContext5, Context as Context7 } from "@d
|
|
|
5054
4952
|
import { randomBytes, verify } from "@dxos/crypto";
|
|
5055
4953
|
import { invariant as invariant13, InvariantViolation } from "@dxos/invariant";
|
|
5056
4954
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
5057
|
-
import { log as
|
|
4955
|
+
import { log as log14 } from "@dxos/log";
|
|
5058
4956
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace6 } from "@dxos/protocols";
|
|
5059
4957
|
import { schema as schema5 } from "@dxos/protocols/proto";
|
|
5060
4958
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -5111,7 +5009,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5111
5009
|
introduce: async (request) => {
|
|
5112
5010
|
const { profile, invitationId } = request;
|
|
5113
5011
|
const traceId = PublicKey9.random().toHex();
|
|
5114
|
-
|
|
5012
|
+
log14.trace("dxos.sdk.invitation-handler.host.introduce", trace6.begin({
|
|
5115
5013
|
id: traceId
|
|
5116
5014
|
}), {
|
|
5117
5015
|
F: __dxlog_file18,
|
|
@@ -5122,7 +5020,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5122
5020
|
const invitation = this._requireActiveInvitation();
|
|
5123
5021
|
this._assertInvitationState(Invitation5.State.CONNECTED);
|
|
5124
5022
|
if (invitationId !== invitation?.invitationId) {
|
|
5125
|
-
|
|
5023
|
+
log14.warn("incorrect invitationId", {
|
|
5126
5024
|
expected: invitation.invitationId,
|
|
5127
5025
|
actual: invitationId
|
|
5128
5026
|
}, {
|
|
@@ -5137,7 +5035,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5137
5035
|
authMethod: Invitation5.AuthMethod.NONE
|
|
5138
5036
|
};
|
|
5139
5037
|
}
|
|
5140
|
-
|
|
5038
|
+
log14.verbose("guest introduced themselves", {
|
|
5141
5039
|
guestProfile: profile
|
|
5142
5040
|
}, {
|
|
5143
5041
|
F: __dxlog_file18,
|
|
@@ -5148,7 +5046,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5148
5046
|
this.guestProfile = profile;
|
|
5149
5047
|
this._callbacks.onStateUpdate(Invitation5.State.READY_FOR_AUTHENTICATION);
|
|
5150
5048
|
this._challenge = invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
|
|
5151
|
-
|
|
5049
|
+
log14.trace("dxos.sdk.invitation-handler.host.introduce", trace6.end({
|
|
5152
5050
|
id: traceId
|
|
5153
5051
|
}), {
|
|
5154
5052
|
F: __dxlog_file18,
|
|
@@ -5163,7 +5061,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5163
5061
|
},
|
|
5164
5062
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
5165
5063
|
const traceId = PublicKey9.random().toHex();
|
|
5166
|
-
|
|
5064
|
+
log14.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.begin({
|
|
5167
5065
|
id: traceId
|
|
5168
5066
|
}), {
|
|
5169
5067
|
F: __dxlog_file18,
|
|
@@ -5172,7 +5070,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5172
5070
|
C: (f, a) => f(...a)
|
|
5173
5071
|
});
|
|
5174
5072
|
const invitation = this._requireActiveInvitation();
|
|
5175
|
-
|
|
5073
|
+
log14.verbose("received authentication request", {
|
|
5176
5074
|
authCode: code
|
|
5177
5075
|
}, {
|
|
5178
5076
|
F: __dxlog_file18,
|
|
@@ -5188,7 +5086,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5188
5086
|
this._callbacks.onStateUpdate(Invitation5.State.AUTHENTICATING);
|
|
5189
5087
|
switch (invitation.authMethod) {
|
|
5190
5088
|
case Invitation5.AuthMethod.NONE: {
|
|
5191
|
-
|
|
5089
|
+
log14("authentication not required", void 0, {
|
|
5192
5090
|
F: __dxlog_file18,
|
|
5193
5091
|
L: 154,
|
|
5194
5092
|
S: this,
|
|
@@ -5224,7 +5122,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5224
5122
|
break;
|
|
5225
5123
|
}
|
|
5226
5124
|
default: {
|
|
5227
|
-
|
|
5125
|
+
log14.error("invalid authentication method", {
|
|
5228
5126
|
authMethod: invitation.authMethod
|
|
5229
5127
|
}, {
|
|
5230
5128
|
F: __dxlog_file18,
|
|
@@ -5246,7 +5144,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5246
5144
|
status
|
|
5247
5145
|
};
|
|
5248
5146
|
}
|
|
5249
|
-
|
|
5147
|
+
log14.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.end({
|
|
5250
5148
|
id: traceId,
|
|
5251
5149
|
data: {
|
|
5252
5150
|
status
|
|
@@ -5263,7 +5161,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5263
5161
|
},
|
|
5264
5162
|
admit: async (request) => {
|
|
5265
5163
|
const traceId = PublicKey9.random().toHex();
|
|
5266
|
-
|
|
5164
|
+
log14.trace("dxos.sdk.invitation-handler.host.admit", trace6.begin({
|
|
5267
5165
|
id: traceId
|
|
5268
5166
|
}), {
|
|
5269
5167
|
F: __dxlog_file18,
|
|
@@ -5280,7 +5178,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5280
5178
|
}
|
|
5281
5179
|
}
|
|
5282
5180
|
const response = await this._callbacks.admit(request);
|
|
5283
|
-
|
|
5181
|
+
log14.trace("dxos.sdk.invitation-handler.host.admit", trace6.end({
|
|
5284
5182
|
id: traceId
|
|
5285
5183
|
}), {
|
|
5286
5184
|
F: __dxlog_file18,
|
|
@@ -5300,14 +5198,14 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5300
5198
|
async onOpen(context) {
|
|
5301
5199
|
await super.onOpen(context);
|
|
5302
5200
|
try {
|
|
5303
|
-
|
|
5201
|
+
log14.verbose("host acquire lock", void 0, {
|
|
5304
5202
|
F: __dxlog_file18,
|
|
5305
5203
|
L: 239,
|
|
5306
5204
|
S: this,
|
|
5307
5205
|
C: (f, a) => f(...a)
|
|
5308
5206
|
});
|
|
5309
5207
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
5310
|
-
|
|
5208
|
+
log14.verbose("host lock acquired", void 0, {
|
|
5311
5209
|
F: __dxlog_file18,
|
|
5312
5210
|
L: 241,
|
|
5313
5211
|
S: this,
|
|
@@ -5317,7 +5215,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5317
5215
|
await this.rpc.InvitationHostService.options({
|
|
5318
5216
|
role: InvitationOptions2.Role.HOST
|
|
5319
5217
|
});
|
|
5320
|
-
|
|
5218
|
+
log14.verbose("options sent", void 0, {
|
|
5321
5219
|
F: __dxlog_file18,
|
|
5322
5220
|
L: 244,
|
|
5323
5221
|
S: this,
|
|
@@ -5326,7 +5224,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5326
5224
|
await cancelWithContext5(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5327
5225
|
timeout: OPTIONS_TIMEOUT2
|
|
5328
5226
|
}));
|
|
5329
|
-
|
|
5227
|
+
log14.verbose("options received", void 0, {
|
|
5330
5228
|
F: __dxlog_file18,
|
|
5331
5229
|
L: 246,
|
|
5332
5230
|
S: this,
|
|
@@ -5379,7 +5277,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5379
5277
|
if (this._invitationFlowLock != null) {
|
|
5380
5278
|
this._invitationFlowLock?.release();
|
|
5381
5279
|
this._invitationFlowLock = null;
|
|
5382
|
-
|
|
5280
|
+
log14.verbose("invitation flow lock released", void 0, {
|
|
5383
5281
|
F: __dxlog_file18,
|
|
5384
5282
|
L: 299,
|
|
5385
5283
|
S: this,
|
|
@@ -5392,7 +5290,7 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
|
|
|
5392
5290
|
|
|
5393
5291
|
// packages/sdk/client-services/src/packlets/invitations/invitation-state.ts
|
|
5394
5292
|
import { Mutex as Mutex3 } from "@dxos/async";
|
|
5395
|
-
import { log as
|
|
5293
|
+
import { log as log15 } from "@dxos/log";
|
|
5396
5294
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5397
5295
|
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
|
|
5398
5296
|
var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
@@ -5461,14 +5359,14 @@ var logStateUpdate = (invitation, actor, newState, error) => {
|
|
|
5461
5359
|
errorStack: error?.stack
|
|
5462
5360
|
};
|
|
5463
5361
|
if (isNonTerminalState(newState)) {
|
|
5464
|
-
|
|
5362
|
+
log15.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5465
5363
|
F: __dxlog_file19,
|
|
5466
5364
|
L: 98,
|
|
5467
5365
|
S: void 0,
|
|
5468
5366
|
C: (f, a) => f(...a)
|
|
5469
5367
|
});
|
|
5470
5368
|
} else {
|
|
5471
|
-
|
|
5369
|
+
log15.info("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5472
5370
|
F: __dxlog_file19,
|
|
5473
5371
|
L: 100,
|
|
5474
5372
|
S: void 0,
|
|
@@ -5489,7 +5387,7 @@ var isNonTerminalState = (currentState) => {
|
|
|
5489
5387
|
// packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
|
|
5490
5388
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
5491
5389
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
5492
|
-
import { log as
|
|
5390
|
+
import { log as log16 } from "@dxos/log";
|
|
5493
5391
|
import { InvitationOptions as InvitationOptions3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
5494
5392
|
import { ComplexSet as ComplexSet4 } from "@dxos/util";
|
|
5495
5393
|
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
@@ -5531,7 +5429,7 @@ var InvitationTopology = class {
|
|
|
5531
5429
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
5532
5430
|
this._seenPeers = new ComplexSet4(PublicKey10.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
5533
5431
|
if (firstUnknownPeer != null) {
|
|
5534
|
-
|
|
5432
|
+
log16("invitation connect", {
|
|
5535
5433
|
ownPeerId,
|
|
5536
5434
|
remotePeerId: firstUnknownPeer
|
|
5537
5435
|
}, {
|
|
@@ -5578,7 +5476,7 @@ var InvitationsHandler = class {
|
|
|
5578
5476
|
this._connectionParams = _connectionParams;
|
|
5579
5477
|
}
|
|
5580
5478
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
5581
|
-
|
|
5479
|
+
log17.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
|
|
5582
5480
|
state: invitation.state,
|
|
5583
5481
|
invitationId: invitation.invitationId,
|
|
5584
5482
|
kind: invitation.kind,
|
|
@@ -5604,7 +5502,7 @@ var InvitationsHandler = class {
|
|
|
5604
5502
|
},
|
|
5605
5503
|
admit: async (admissionRequest) => {
|
|
5606
5504
|
try {
|
|
5607
|
-
|
|
5505
|
+
log17.verbose("dxos.sdk.invitations-handler.host.admit", {
|
|
5608
5506
|
invitationId: invitation.invitationId,
|
|
5609
5507
|
...protocol.toJSON()
|
|
5610
5508
|
}, {
|
|
@@ -5641,7 +5539,7 @@ var InvitationsHandler = class {
|
|
|
5641
5539
|
scheduleTask7(connectionCtx, async () => {
|
|
5642
5540
|
const traceId = PublicKey11.random().toHex();
|
|
5643
5541
|
try {
|
|
5644
|
-
|
|
5542
|
+
log17.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.begin({
|
|
5645
5543
|
id: traceId
|
|
5646
5544
|
}), {
|
|
5647
5545
|
F: __dxlog_file21,
|
|
@@ -5649,7 +5547,7 @@ var InvitationsHandler = class {
|
|
|
5649
5547
|
S: this,
|
|
5650
5548
|
C: (f, a) => f(...a)
|
|
5651
5549
|
});
|
|
5652
|
-
|
|
5550
|
+
log17.verbose("connected", {
|
|
5653
5551
|
...protocol.toJSON()
|
|
5654
5552
|
}, {
|
|
5655
5553
|
F: __dxlog_file21,
|
|
@@ -5660,7 +5558,7 @@ var InvitationsHandler = class {
|
|
|
5660
5558
|
const deviceKey = await extension.completedTrigger.wait({
|
|
5661
5559
|
timeout: invitation.timeout
|
|
5662
5560
|
});
|
|
5663
|
-
|
|
5561
|
+
log17.verbose("admitted guest", {
|
|
5664
5562
|
guest: deviceKey,
|
|
5665
5563
|
...protocol.toJSON()
|
|
5666
5564
|
}, {
|
|
@@ -5671,7 +5569,7 @@ var InvitationsHandler = class {
|
|
|
5671
5569
|
});
|
|
5672
5570
|
guardedState.set(extension, Invitation7.State.SUCCESS);
|
|
5673
5571
|
metrics.increment("dxos.invitation.success");
|
|
5674
|
-
|
|
5572
|
+
log17.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.end({
|
|
5675
5573
|
id: traceId
|
|
5676
5574
|
}), {
|
|
5677
5575
|
F: __dxlog_file21,
|
|
@@ -5688,7 +5586,7 @@ var InvitationsHandler = class {
|
|
|
5688
5586
|
if (err instanceof TimeoutError2) {
|
|
5689
5587
|
if (stateChanged) {
|
|
5690
5588
|
metrics.increment("dxos.invitation.timeout");
|
|
5691
|
-
|
|
5589
|
+
log17.verbose("timeout", {
|
|
5692
5590
|
...protocol.toJSON()
|
|
5693
5591
|
}, {
|
|
5694
5592
|
F: __dxlog_file21,
|
|
@@ -5700,7 +5598,7 @@ var InvitationsHandler = class {
|
|
|
5700
5598
|
} else {
|
|
5701
5599
|
if (stateChanged) {
|
|
5702
5600
|
metrics.increment("dxos.invitation.failed");
|
|
5703
|
-
|
|
5601
|
+
log17.error("failed", err, {
|
|
5704
5602
|
F: __dxlog_file21,
|
|
5705
5603
|
L: 159,
|
|
5706
5604
|
S: this,
|
|
@@ -5708,7 +5606,7 @@ var InvitationsHandler = class {
|
|
|
5708
5606
|
});
|
|
5709
5607
|
}
|
|
5710
5608
|
}
|
|
5711
|
-
|
|
5609
|
+
log17.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.error({
|
|
5712
5610
|
id: traceId,
|
|
5713
5611
|
error: err
|
|
5714
5612
|
}), {
|
|
@@ -5724,7 +5622,7 @@ var InvitationsHandler = class {
|
|
|
5724
5622
|
onError: (err) => {
|
|
5725
5623
|
const stateChanged = guardedState.set(extension, Invitation7.State.CONNECTING);
|
|
5726
5624
|
if (err instanceof InvalidInvitationExtensionRoleError3) {
|
|
5727
|
-
|
|
5625
|
+
log17("invalid role", {
|
|
5728
5626
|
...err.context
|
|
5729
5627
|
}, {
|
|
5730
5628
|
F: __dxlog_file21,
|
|
@@ -5737,7 +5635,7 @@ var InvitationsHandler = class {
|
|
|
5737
5635
|
if (err instanceof TimeoutError2) {
|
|
5738
5636
|
if (stateChanged) {
|
|
5739
5637
|
metrics.increment("dxos.invitation.timeout");
|
|
5740
|
-
|
|
5638
|
+
log17.verbose("timeout", {
|
|
5741
5639
|
err
|
|
5742
5640
|
}, {
|
|
5743
5641
|
F: __dxlog_file21,
|
|
@@ -5749,7 +5647,7 @@ var InvitationsHandler = class {
|
|
|
5749
5647
|
} else {
|
|
5750
5648
|
if (stateChanged) {
|
|
5751
5649
|
metrics.increment("dxos.invitation.failed");
|
|
5752
|
-
|
|
5650
|
+
log17.error("failed", err, {
|
|
5753
5651
|
F: __dxlog_file21,
|
|
5754
5652
|
L: 182,
|
|
5755
5653
|
S: this,
|
|
@@ -5763,14 +5661,14 @@ var InvitationsHandler = class {
|
|
|
5763
5661
|
};
|
|
5764
5662
|
if (invitation.lifetime && invitation.created) {
|
|
5765
5663
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
5766
|
-
|
|
5664
|
+
log17.warn("invitation has already expired", void 0, {
|
|
5767
5665
|
F: __dxlog_file21,
|
|
5768
5666
|
L: 193,
|
|
5769
5667
|
S: this,
|
|
5770
5668
|
C: (f, a) => f(...a)
|
|
5771
5669
|
});
|
|
5772
5670
|
guardedState.set(null, Invitation7.State.EXPIRED);
|
|
5773
|
-
void ctx.dispose().catch((err) =>
|
|
5671
|
+
void ctx.dispose().catch((err) => log17.catch(err, void 0, {
|
|
5774
5672
|
F: __dxlog_file21,
|
|
5775
5673
|
L: 195,
|
|
5776
5674
|
S: this,
|
|
@@ -5792,7 +5690,7 @@ var InvitationsHandler = class {
|
|
|
5792
5690
|
});
|
|
5793
5691
|
}
|
|
5794
5692
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
5795
|
-
|
|
5693
|
+
log17.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
|
|
5796
5694
|
state: invitation.state,
|
|
5797
5695
|
invitationId: invitation.invitationId,
|
|
5798
5696
|
kind: invitation.kind,
|
|
@@ -5819,7 +5717,7 @@ var InvitationsHandler = class {
|
|
|
5819
5717
|
const guardedState = createGuardedInvitationState(ctx, invitation, stream);
|
|
5820
5718
|
const shouldCancelInvitationFlow = (extension) => {
|
|
5821
5719
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
5822
|
-
|
|
5720
|
+
log17("should cancel invitation flow", {
|
|
5823
5721
|
isLockedByAnotherConnection,
|
|
5824
5722
|
invitationType: Invitation7.Type.DELEGATED,
|
|
5825
5723
|
triedPeers: triedPeersIds.size
|
|
@@ -5847,7 +5745,7 @@ var InvitationsHandler = class {
|
|
|
5847
5745
|
return;
|
|
5848
5746
|
}
|
|
5849
5747
|
connectionCtx.onDispose(async () => {
|
|
5850
|
-
|
|
5748
|
+
log17.verbose("extension disposed", {
|
|
5851
5749
|
admitted,
|
|
5852
5750
|
currentState: guardedState.current.state
|
|
5853
5751
|
}, {
|
|
@@ -5866,7 +5764,7 @@ var InvitationsHandler = class {
|
|
|
5866
5764
|
scheduleTask7(connectionCtx, async () => {
|
|
5867
5765
|
const traceId = PublicKey11.random().toHex();
|
|
5868
5766
|
try {
|
|
5869
|
-
|
|
5767
|
+
log17.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.begin({
|
|
5870
5768
|
id: traceId
|
|
5871
5769
|
}), {
|
|
5872
5770
|
F: __dxlog_file21,
|
|
@@ -5878,7 +5776,7 @@ var InvitationsHandler = class {
|
|
|
5878
5776
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5879
5777
|
extensionCtx.close();
|
|
5880
5778
|
}, timeout);
|
|
5881
|
-
|
|
5779
|
+
log17.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
5882
5780
|
...protocol.toJSON()
|
|
5883
5781
|
}, {
|
|
5884
5782
|
F: __dxlog_file21,
|
|
@@ -5887,7 +5785,7 @@ var InvitationsHandler = class {
|
|
|
5887
5785
|
C: (f, a) => f(...a)
|
|
5888
5786
|
});
|
|
5889
5787
|
guardedState.set(extension, Invitation7.State.CONNECTED);
|
|
5890
|
-
|
|
5788
|
+
log17.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
5891
5789
|
invitationId: invitation.invitationId,
|
|
5892
5790
|
...protocol.toJSON()
|
|
5893
5791
|
}, {
|
|
@@ -5900,7 +5798,7 @@ var InvitationsHandler = class {
|
|
|
5900
5798
|
invitationId: invitation.invitationId,
|
|
5901
5799
|
...protocol.createIntroduction()
|
|
5902
5800
|
});
|
|
5903
|
-
|
|
5801
|
+
log17.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
|
|
5904
5802
|
invitationId: invitation.invitationId,
|
|
5905
5803
|
...protocol.toJSON(),
|
|
5906
5804
|
authMethod: introductionResponse.authMethod
|
|
@@ -5923,7 +5821,7 @@ var InvitationsHandler = class {
|
|
|
5923
5821
|
break;
|
|
5924
5822
|
}
|
|
5925
5823
|
}
|
|
5926
|
-
|
|
5824
|
+
log17.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
|
|
5927
5825
|
invitationId: invitation.invitationId,
|
|
5928
5826
|
...protocol.toJSON()
|
|
5929
5827
|
}, {
|
|
@@ -5936,7 +5834,7 @@ var InvitationsHandler = class {
|
|
|
5936
5834
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
5937
5835
|
admitted = true;
|
|
5938
5836
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
5939
|
-
|
|
5837
|
+
log17.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
|
|
5940
5838
|
invitationId: invitation.invitationId,
|
|
5941
5839
|
...protocol.toJSON()
|
|
5942
5840
|
}, {
|
|
@@ -5950,7 +5848,7 @@ var InvitationsHandler = class {
|
|
|
5950
5848
|
...result,
|
|
5951
5849
|
state: Invitation7.State.SUCCESS
|
|
5952
5850
|
});
|
|
5953
|
-
|
|
5851
|
+
log17.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.end({
|
|
5954
5852
|
id: traceId
|
|
5955
5853
|
}), {
|
|
5956
5854
|
F: __dxlog_file21,
|
|
@@ -5960,7 +5858,7 @@ var InvitationsHandler = class {
|
|
|
5960
5858
|
});
|
|
5961
5859
|
} catch (err) {
|
|
5962
5860
|
if (err instanceof TimeoutError2) {
|
|
5963
|
-
|
|
5861
|
+
log17.verbose("timeout", {
|
|
5964
5862
|
...protocol.toJSON()
|
|
5965
5863
|
}, {
|
|
5966
5864
|
F: __dxlog_file21,
|
|
@@ -5970,7 +5868,7 @@ var InvitationsHandler = class {
|
|
|
5970
5868
|
});
|
|
5971
5869
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5972
5870
|
} else {
|
|
5973
|
-
|
|
5871
|
+
log17.verbose("auth failed", err, {
|
|
5974
5872
|
F: __dxlog_file21,
|
|
5975
5873
|
L: 365,
|
|
5976
5874
|
S: this,
|
|
@@ -5979,7 +5877,7 @@ var InvitationsHandler = class {
|
|
|
5979
5877
|
guardedState.error(extension, err);
|
|
5980
5878
|
}
|
|
5981
5879
|
extensionCtx.close(err);
|
|
5982
|
-
|
|
5880
|
+
log17.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.error({
|
|
5983
5881
|
id: traceId,
|
|
5984
5882
|
error: err
|
|
5985
5883
|
}), {
|
|
@@ -5996,7 +5894,7 @@ var InvitationsHandler = class {
|
|
|
5996
5894
|
return;
|
|
5997
5895
|
}
|
|
5998
5896
|
if (err instanceof TimeoutError2) {
|
|
5999
|
-
|
|
5897
|
+
log17.verbose("timeout", {
|
|
6000
5898
|
...protocol.toJSON()
|
|
6001
5899
|
}, {
|
|
6002
5900
|
F: __dxlog_file21,
|
|
@@ -6006,7 +5904,7 @@ var InvitationsHandler = class {
|
|
|
6006
5904
|
});
|
|
6007
5905
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
6008
5906
|
} else {
|
|
6009
|
-
|
|
5907
|
+
log17.verbose("auth failed", err, {
|
|
6010
5908
|
F: __dxlog_file21,
|
|
6011
5909
|
L: 381,
|
|
6012
5910
|
S: this,
|
|
@@ -6021,7 +5919,7 @@ var InvitationsHandler = class {
|
|
|
6021
5919
|
const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
|
|
6022
5920
|
onInvitationSuccess: async (admissionResponse, admissionRequest) => {
|
|
6023
5921
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
6024
|
-
|
|
5922
|
+
log17.info("admitted by edge", {
|
|
6025
5923
|
...protocol.toJSON()
|
|
6026
5924
|
}, {
|
|
6027
5925
|
F: __dxlog_file21,
|
|
@@ -6087,7 +5985,7 @@ var InvitationsHandler = class {
|
|
|
6087
5985
|
}
|
|
6088
5986
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
6089
5987
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6090
|
-
|
|
5988
|
+
log17("guest waiting for authentication code...", void 0, {
|
|
6091
5989
|
F: __dxlog_file21,
|
|
6092
5990
|
L: 457,
|
|
6093
5991
|
S: this,
|
|
@@ -6095,7 +5993,7 @@ var InvitationsHandler = class {
|
|
|
6095
5993
|
});
|
|
6096
5994
|
setState(Invitation7.State.READY_FOR_AUTHENTICATION);
|
|
6097
5995
|
const authCode = await authenticated.wait(options);
|
|
6098
|
-
|
|
5996
|
+
log17("sending authentication request", void 0, {
|
|
6099
5997
|
F: __dxlog_file21,
|
|
6100
5998
|
L: 461,
|
|
6101
5999
|
S: this,
|
|
@@ -6112,7 +6010,7 @@ var InvitationsHandler = class {
|
|
|
6112
6010
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
6113
6011
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
6114
6012
|
} else {
|
|
6115
|
-
|
|
6013
|
+
log17("retrying invalid code", {
|
|
6116
6014
|
attempt
|
|
6117
6015
|
}, {
|
|
6118
6016
|
F: __dxlog_file21,
|
|
@@ -6132,7 +6030,7 @@ var InvitationsHandler = class {
|
|
|
6132
6030
|
if (introductionResponse.challenge == null) {
|
|
6133
6031
|
throw new Error("challenge missing in the introduction");
|
|
6134
6032
|
}
|
|
6135
|
-
|
|
6033
|
+
log17("sending authentication request", void 0, {
|
|
6136
6034
|
F: __dxlog_file21,
|
|
6137
6035
|
L: 491,
|
|
6138
6036
|
S: this,
|
|
@@ -6260,7 +6158,7 @@ var InvitationsServiceImpl = class {
|
|
|
6260
6158
|
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
|
|
6261
6159
|
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
6262
6160
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
6263
|
-
import { log as
|
|
6161
|
+
import { log as log18 } from "@dxos/log";
|
|
6264
6162
|
import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError, SpaceNotFoundError as SpaceNotFoundError2 } from "@dxos/protocols";
|
|
6265
6163
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6266
6164
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -6328,7 +6226,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6328
6226
|
""
|
|
6329
6227
|
]
|
|
6330
6228
|
});
|
|
6331
|
-
|
|
6229
|
+
log18("writing guest credentials", {
|
|
6332
6230
|
host: this._signingContext.deviceKey,
|
|
6333
6231
|
guest: request.space.deviceKey
|
|
6334
6232
|
}, {
|
|
@@ -6383,7 +6281,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6383
6281
|
]
|
|
6384
6282
|
});
|
|
6385
6283
|
}
|
|
6386
|
-
|
|
6284
|
+
log18("writing delegate space invitation", {
|
|
6387
6285
|
host: this._signingContext.deviceKey,
|
|
6388
6286
|
id: invitation.invitationId
|
|
6389
6287
|
}, {
|
|
@@ -6444,7 +6342,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6444
6342
|
""
|
|
6445
6343
|
]
|
|
6446
6344
|
});
|
|
6447
|
-
|
|
6345
|
+
log18("cancelling delegated space invitation", {
|
|
6448
6346
|
host: this._signingContext.deviceKey,
|
|
6449
6347
|
id: invitation.invitationId
|
|
6450
6348
|
}, {
|
|
@@ -6546,7 +6444,7 @@ import { generatePasscode } from "@dxos/credentials";
|
|
|
6546
6444
|
import { hasInvitationExpired } from "@dxos/echo-pipeline";
|
|
6547
6445
|
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6548
6446
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
6549
|
-
import { log as
|
|
6447
|
+
import { log as log19 } from "@dxos/log";
|
|
6550
6448
|
import { Invitation as Invitation9 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6551
6449
|
import { SpaceMember as SpaceMember7 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
6552
6450
|
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
@@ -6591,7 +6489,7 @@ var InvitationsManager = class {
|
|
|
6591
6489
|
try {
|
|
6592
6490
|
await this._persistIfRequired(handler, stream, invitation);
|
|
6593
6491
|
} catch (err) {
|
|
6594
|
-
|
|
6492
|
+
log19.catch(err, void 0, {
|
|
6595
6493
|
F: __dxlog_file23,
|
|
6596
6494
|
L: 82,
|
|
6597
6495
|
S: this,
|
|
@@ -6633,7 +6531,7 @@ var InvitationsManager = class {
|
|
|
6633
6531
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
6634
6532
|
};
|
|
6635
6533
|
} catch (err) {
|
|
6636
|
-
|
|
6534
|
+
log19.catch(err, void 0, {
|
|
6637
6535
|
F: __dxlog_file23,
|
|
6638
6536
|
L: 110,
|
|
6639
6537
|
S: this,
|
|
@@ -6665,7 +6563,7 @@ var InvitationsManager = class {
|
|
|
6665
6563
|
return invitation;
|
|
6666
6564
|
}
|
|
6667
6565
|
async authenticate({ invitationId, authCode }) {
|
|
6668
|
-
|
|
6566
|
+
log19("authenticating...", void 0, {
|
|
6669
6567
|
F: __dxlog_file23,
|
|
6670
6568
|
L: 140,
|
|
6671
6569
|
S: this,
|
|
@@ -6682,7 +6580,7 @@ var InvitationsManager = class {
|
|
|
6682
6580
|
});
|
|
6683
6581
|
const observable = this._acceptInvitations.get(invitationId);
|
|
6684
6582
|
if (!observable) {
|
|
6685
|
-
|
|
6583
|
+
log19.warn("invalid invitation", {
|
|
6686
6584
|
invitationId
|
|
6687
6585
|
}, {
|
|
6688
6586
|
F: __dxlog_file23,
|
|
@@ -6695,7 +6593,7 @@ var InvitationsManager = class {
|
|
|
6695
6593
|
}
|
|
6696
6594
|
}
|
|
6697
6595
|
async cancelInvitation({ invitationId }) {
|
|
6698
|
-
|
|
6596
|
+
log19("cancelInvitation...", {
|
|
6699
6597
|
invitationId
|
|
6700
6598
|
}, {
|
|
6701
6599
|
F: __dxlog_file23,
|
|
@@ -6784,7 +6682,7 @@ var InvitationsManager = class {
|
|
|
6784
6682
|
L: 236
|
|
6785
6683
|
});
|
|
6786
6684
|
ctx.onDispose(() => {
|
|
6787
|
-
|
|
6685
|
+
log19("complete", {
|
|
6788
6686
|
...handler.toJSON()
|
|
6789
6687
|
}, {
|
|
6790
6688
|
F: __dxlog_file23,
|
|
@@ -6817,7 +6715,7 @@ var InvitationsManager = class {
|
|
|
6817
6715
|
const ctx = new Context8({
|
|
6818
6716
|
onError: (err) => {
|
|
6819
6717
|
if (err instanceof TimeoutError3) {
|
|
6820
|
-
|
|
6718
|
+
log19("timeout", {
|
|
6821
6719
|
...handler.toJSON()
|
|
6822
6720
|
}, {
|
|
6823
6721
|
F: __dxlog_file23,
|
|
@@ -6830,7 +6728,7 @@ var InvitationsManager = class {
|
|
|
6830
6728
|
state: Invitation9.State.TIMEOUT
|
|
6831
6729
|
});
|
|
6832
6730
|
} else {
|
|
6833
|
-
|
|
6731
|
+
log19.warn("auth failed", err, {
|
|
6834
6732
|
F: __dxlog_file23,
|
|
6835
6733
|
L: 266,
|
|
6836
6734
|
S: this,
|
|
@@ -6848,7 +6746,7 @@ var InvitationsManager = class {
|
|
|
6848
6746
|
L: 260
|
|
6849
6747
|
});
|
|
6850
6748
|
ctx.onDispose(() => {
|
|
6851
|
-
|
|
6749
|
+
log19("complete", {
|
|
6852
6750
|
...handler.toJSON()
|
|
6853
6751
|
}, {
|
|
6854
6752
|
F: __dxlog_file23,
|
|
@@ -6895,7 +6793,7 @@ var InvitationsManager = class {
|
|
|
6895
6793
|
try {
|
|
6896
6794
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
6897
6795
|
} catch (err) {
|
|
6898
|
-
|
|
6796
|
+
log19.catch(err, void 0, {
|
|
6899
6797
|
F: __dxlog_file23,
|
|
6900
6798
|
L: 309,
|
|
6901
6799
|
S: this,
|
|
@@ -6913,7 +6811,7 @@ var InvitationsManager = class {
|
|
|
6913
6811
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
6914
6812
|
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6915
6813
|
import { LockFile } from "@dxos/lock-file";
|
|
6916
|
-
import { log as
|
|
6814
|
+
import { log as log20, logInfo as logInfo3 } from "@dxos/log";
|
|
6917
6815
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
6918
6816
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6919
6817
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6931,7 +6829,7 @@ var Lock = class {
|
|
|
6931
6829
|
return this._lockPath;
|
|
6932
6830
|
}
|
|
6933
6831
|
async acquire() {
|
|
6934
|
-
|
|
6832
|
+
log20("acquiring lock...", void 0, {
|
|
6935
6833
|
F: __dxlog_file24,
|
|
6936
6834
|
L: 32,
|
|
6937
6835
|
S: this,
|
|
@@ -6939,7 +6837,7 @@ var Lock = class {
|
|
|
6939
6837
|
});
|
|
6940
6838
|
this._fileHandle = await LockFile.acquire(this._lockPath);
|
|
6941
6839
|
await this._onAcquire?.();
|
|
6942
|
-
|
|
6840
|
+
log20("acquired lock", void 0, {
|
|
6943
6841
|
F: __dxlog_file24,
|
|
6944
6842
|
L: 37,
|
|
6945
6843
|
S: this,
|
|
@@ -7047,7 +6945,7 @@ import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as schedul
|
|
|
7047
6945
|
import { Resource as Resource6 } from "@dxos/context";
|
|
7048
6946
|
import { invariant as invariant19 } from "@dxos/invariant";
|
|
7049
6947
|
import { PublicKey as PublicKey13 } from "@dxos/keys";
|
|
7050
|
-
import { log as
|
|
6948
|
+
import { log as log21 } from "@dxos/log";
|
|
7051
6949
|
import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
|
|
7052
6950
|
import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7053
6951
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
@@ -7115,7 +7013,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7115
7013
|
// TODO: agents don't have data feed, should be removed
|
|
7116
7014
|
dataFeedKey: PublicKey13.random()
|
|
7117
7015
|
});
|
|
7118
|
-
|
|
7016
|
+
log21("agent created", response, {
|
|
7119
7017
|
F: __dxlog_file25,
|
|
7120
7018
|
L: 71,
|
|
7121
7019
|
S: this,
|
|
@@ -7125,7 +7023,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7125
7023
|
}
|
|
7126
7024
|
async _open() {
|
|
7127
7025
|
const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
|
|
7128
|
-
|
|
7026
|
+
log21("edge agent manager open", {
|
|
7129
7027
|
isEnabled
|
|
7130
7028
|
}, {
|
|
7131
7029
|
F: __dxlog_file25,
|
|
@@ -7170,7 +7068,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7170
7068
|
]
|
|
7171
7069
|
});
|
|
7172
7070
|
try {
|
|
7173
|
-
|
|
7071
|
+
log21("fetching agent status", void 0, {
|
|
7174
7072
|
F: __dxlog_file25,
|
|
7175
7073
|
L: 115,
|
|
7176
7074
|
S: this,
|
|
@@ -7187,7 +7085,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7187
7085
|
} catch (err) {
|
|
7188
7086
|
if (err instanceof EdgeCallFailedError3) {
|
|
7189
7087
|
if (!err.isRetryable) {
|
|
7190
|
-
|
|
7088
|
+
log21.warn("non retryable error on agent status fetch attempt", {
|
|
7191
7089
|
err
|
|
7192
7090
|
}, {
|
|
7193
7091
|
F: __dxlog_file25,
|
|
@@ -7199,7 +7097,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7199
7097
|
}
|
|
7200
7098
|
}
|
|
7201
7099
|
const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
|
|
7202
|
-
|
|
7100
|
+
log21.info("agent status fetching failed", {
|
|
7203
7101
|
err,
|
|
7204
7102
|
retryAfterMs
|
|
7205
7103
|
}, {
|
|
@@ -7228,7 +7126,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7228
7126
|
...space.inner.spaceState.feeds.values()
|
|
7229
7127
|
].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
|
|
7230
7128
|
space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
|
|
7231
|
-
|
|
7129
|
+
log21.info("set active edge polling", {
|
|
7232
7130
|
enabled: agentFeedNeedsNotarization,
|
|
7233
7131
|
spaceId: space.id
|
|
7234
7132
|
}, {
|
|
@@ -7246,7 +7144,7 @@ var EdgeAgentManager = class extends Resource6 {
|
|
|
7246
7144
|
if (deviceKey) {
|
|
7247
7145
|
this._ensureAgentIsInSpaces(deviceKey);
|
|
7248
7146
|
}
|
|
7249
|
-
|
|
7147
|
+
log21.info("agent status update", {
|
|
7250
7148
|
status
|
|
7251
7149
|
}, {
|
|
7252
7150
|
F: __dxlog_file25,
|
|
@@ -7263,10 +7161,29 @@ _ts_decorate9([
|
|
|
7263
7161
|
// packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
|
|
7264
7162
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
7265
7163
|
import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
|
|
7266
|
-
import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
7164
|
+
import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
7267
7165
|
var EdgeAgentServiceImpl = class {
|
|
7268
|
-
constructor(_agentManagerProvider) {
|
|
7166
|
+
constructor(_agentManagerProvider, _edgeConnection) {
|
|
7269
7167
|
this._agentManagerProvider = _agentManagerProvider;
|
|
7168
|
+
this._edgeConnection = _edgeConnection;
|
|
7169
|
+
}
|
|
7170
|
+
queryEdgeStatus() {
|
|
7171
|
+
return new Stream11(({ ctx, next }) => {
|
|
7172
|
+
next({
|
|
7173
|
+
status: QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
|
|
7174
|
+
});
|
|
7175
|
+
if (!this._edgeConnection) {
|
|
7176
|
+
return;
|
|
7177
|
+
}
|
|
7178
|
+
ctx.onDispose(
|
|
7179
|
+
// TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
|
|
7180
|
+
this._edgeConnection.onReconnected(() => {
|
|
7181
|
+
next({
|
|
7182
|
+
status: QueryEdgeStatusResponse.EdgeStatus.CONNECTED
|
|
7183
|
+
});
|
|
7184
|
+
})
|
|
7185
|
+
);
|
|
7186
|
+
});
|
|
7270
7187
|
}
|
|
7271
7188
|
async createAgent() {
|
|
7272
7189
|
return (await this._agentManagerProvider()).createAgent();
|
|
@@ -7313,7 +7230,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
|
7313
7230
|
import { invariant as invariant21 } from "@dxos/invariant";
|
|
7314
7231
|
import { Keyring } from "@dxos/keyring";
|
|
7315
7232
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
7316
|
-
import { log as
|
|
7233
|
+
import { log as log23 } from "@dxos/log";
|
|
7317
7234
|
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace10 } from "@dxos/protocols";
|
|
7318
7235
|
import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7319
7236
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
@@ -7325,7 +7242,7 @@ import { generateSeedPhrase as generateSeedPhrase2, keyPairFromSeedPhrase as key
|
|
|
7325
7242
|
import { sign as sign3 } from "@dxos/crypto";
|
|
7326
7243
|
import { invariant as invariant20 } from "@dxos/invariant";
|
|
7327
7244
|
import { PublicKey as PublicKey14 } from "@dxos/keys";
|
|
7328
|
-
import { log as
|
|
7245
|
+
import { log as log22 } from "@dxos/log";
|
|
7329
7246
|
import { EdgeAuthChallengeError as EdgeAuthChallengeError2 } from "@dxos/protocols";
|
|
7330
7247
|
import { schema as schema6 } from "@dxos/protocols/proto";
|
|
7331
7248
|
import { Timeframe as Timeframe5 } from "@dxos/timeframe";
|
|
@@ -7407,7 +7324,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7407
7324
|
signature: Buffer.from(signature).toString("base64")
|
|
7408
7325
|
});
|
|
7409
7326
|
}
|
|
7410
|
-
|
|
7327
|
+
log22.info("recovering identity", response, {
|
|
7411
7328
|
F: __dxlog_file26,
|
|
7412
7329
|
L: 77,
|
|
7413
7330
|
S: this,
|
|
@@ -7549,7 +7466,8 @@ var ServiceContext = class extends Resource7 {
|
|
|
7549
7466
|
});
|
|
7550
7467
|
this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
|
|
7551
7468
|
this.echoHost = new EchoHost({
|
|
7552
|
-
kv: this.level
|
|
7469
|
+
kv: this.level,
|
|
7470
|
+
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
|
|
7553
7471
|
});
|
|
7554
7472
|
this._meshReplicator = new MeshEchoReplicator();
|
|
7555
7473
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
@@ -7566,17 +7484,17 @@ var ServiceContext = class extends Resource7 {
|
|
|
7566
7484
|
}
|
|
7567
7485
|
async _open(ctx) {
|
|
7568
7486
|
await this._checkStorageVersion();
|
|
7569
|
-
|
|
7487
|
+
log23("opening...", void 0, {
|
|
7570
7488
|
F: __dxlog_file27,
|
|
7571
|
-
L:
|
|
7489
|
+
L: 198,
|
|
7572
7490
|
S: this,
|
|
7573
7491
|
C: (f, a) => f(...a)
|
|
7574
7492
|
});
|
|
7575
|
-
|
|
7493
|
+
log23.trace("dxos.sdk.service-context.open", trace10.begin({
|
|
7576
7494
|
id: this._instanceId
|
|
7577
7495
|
}), {
|
|
7578
7496
|
F: __dxlog_file27,
|
|
7579
|
-
L:
|
|
7497
|
+
L: 199,
|
|
7580
7498
|
S: this,
|
|
7581
7499
|
C: (f, a) => f(...a)
|
|
7582
7500
|
});
|
|
@@ -7599,33 +7517,33 @@ var ServiceContext = class extends Resource7 {
|
|
|
7599
7517
|
await this._initialize(ctx);
|
|
7600
7518
|
}
|
|
7601
7519
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
7602
|
-
|
|
7520
|
+
log23("loaded persistent invitations", {
|
|
7603
7521
|
count: loadedInvitations.invitations?.length
|
|
7604
7522
|
}, {
|
|
7605
7523
|
F: __dxlog_file27,
|
|
7606
|
-
L:
|
|
7524
|
+
L: 227,
|
|
7607
7525
|
S: this,
|
|
7608
7526
|
C: (f, a) => f(...a)
|
|
7609
7527
|
});
|
|
7610
|
-
|
|
7528
|
+
log23.trace("dxos.sdk.service-context.open", trace10.end({
|
|
7611
7529
|
id: this._instanceId
|
|
7612
7530
|
}), {
|
|
7613
7531
|
F: __dxlog_file27,
|
|
7614
|
-
L:
|
|
7532
|
+
L: 229,
|
|
7615
7533
|
S: this,
|
|
7616
7534
|
C: (f, a) => f(...a)
|
|
7617
7535
|
});
|
|
7618
|
-
|
|
7536
|
+
log23("opened", void 0, {
|
|
7619
7537
|
F: __dxlog_file27,
|
|
7620
|
-
L:
|
|
7538
|
+
L: 230,
|
|
7621
7539
|
S: this,
|
|
7622
7540
|
C: (f, a) => f(...a)
|
|
7623
7541
|
});
|
|
7624
7542
|
}
|
|
7625
7543
|
async _close(ctx) {
|
|
7626
|
-
|
|
7544
|
+
log23("closing...", void 0, {
|
|
7627
7545
|
F: __dxlog_file27,
|
|
7628
|
-
L:
|
|
7546
|
+
L: 234,
|
|
7629
7547
|
S: this,
|
|
7630
7548
|
C: (f, a) => f(...a)
|
|
7631
7549
|
});
|
|
@@ -7642,9 +7560,9 @@ var ServiceContext = class extends Resource7 {
|
|
|
7642
7560
|
await this.networkManager.close();
|
|
7643
7561
|
await this.signalManager.close();
|
|
7644
7562
|
await this._edgeConnection?.close();
|
|
7645
|
-
|
|
7563
|
+
log23("closed", void 0, {
|
|
7646
7564
|
F: __dxlog_file27,
|
|
7647
|
-
L:
|
|
7565
|
+
L: 250,
|
|
7648
7566
|
S: this,
|
|
7649
7567
|
C: (f, a) => f(...a)
|
|
7650
7568
|
});
|
|
@@ -7655,7 +7573,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7655
7573
|
await identity.joinNetwork();
|
|
7656
7574
|
await this._initialize(new Context9(void 0, {
|
|
7657
7575
|
F: __dxlog_file27,
|
|
7658
|
-
L:
|
|
7576
|
+
L: 257
|
|
7659
7577
|
}));
|
|
7660
7578
|
return identity;
|
|
7661
7579
|
}
|
|
@@ -7666,7 +7584,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7666
7584
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7667
7585
|
invariant21(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
7668
7586
|
F: __dxlog_file27,
|
|
7669
|
-
L:
|
|
7587
|
+
L: 266,
|
|
7670
7588
|
S: this,
|
|
7671
7589
|
A: [
|
|
7672
7590
|
"factory",
|
|
@@ -7692,7 +7610,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7692
7610
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7693
7611
|
await this._initialize(new Context9(void 0, {
|
|
7694
7612
|
F: __dxlog_file27,
|
|
7695
|
-
L:
|
|
7613
|
+
L: 285
|
|
7696
7614
|
}));
|
|
7697
7615
|
return identity;
|
|
7698
7616
|
}
|
|
@@ -7704,9 +7622,9 @@ var ServiceContext = class extends Resource7 {
|
|
|
7704
7622
|
}
|
|
7705
7623
|
// Called when identity is created.
|
|
7706
7624
|
async _initialize(ctx) {
|
|
7707
|
-
|
|
7625
|
+
log23("initializing spaces...", void 0, {
|
|
7708
7626
|
F: __dxlog_file27,
|
|
7709
|
-
L:
|
|
7627
|
+
L: 300,
|
|
7710
7628
|
S: this,
|
|
7711
7629
|
C: (f, a) => f(...a)
|
|
7712
7630
|
});
|
|
@@ -7745,7 +7663,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7745
7663
|
this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
|
|
7746
7664
|
invariant21(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
7747
7665
|
F: __dxlog_file27,
|
|
7748
|
-
L:
|
|
7666
|
+
L: 338,
|
|
7749
7667
|
S: this,
|
|
7750
7668
|
A: [
|
|
7751
7669
|
"this.dataSpaceManager",
|
|
@@ -7765,33 +7683,33 @@ var ServiceContext = class extends Resource7 {
|
|
|
7765
7683
|
return;
|
|
7766
7684
|
}
|
|
7767
7685
|
if (!this.dataSpaceManager) {
|
|
7768
|
-
|
|
7686
|
+
log23("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
7769
7687
|
details: assertion
|
|
7770
7688
|
}, {
|
|
7771
7689
|
F: __dxlog_file27,
|
|
7772
|
-
L:
|
|
7690
|
+
L: 354,
|
|
7773
7691
|
S: this,
|
|
7774
7692
|
C: (f, a) => f(...a)
|
|
7775
7693
|
});
|
|
7776
7694
|
return;
|
|
7777
7695
|
}
|
|
7778
7696
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
7779
|
-
|
|
7697
|
+
log23("space already exists, ignoring space admission", {
|
|
7780
7698
|
details: assertion
|
|
7781
7699
|
}, {
|
|
7782
7700
|
F: __dxlog_file27,
|
|
7783
|
-
L:
|
|
7701
|
+
L: 358,
|
|
7784
7702
|
S: this,
|
|
7785
7703
|
C: (f, a) => f(...a)
|
|
7786
7704
|
});
|
|
7787
7705
|
return;
|
|
7788
7706
|
}
|
|
7789
7707
|
try {
|
|
7790
|
-
|
|
7708
|
+
log23("accepting space recorded in halo", {
|
|
7791
7709
|
details: assertion
|
|
7792
7710
|
}, {
|
|
7793
7711
|
F: __dxlog_file27,
|
|
7794
|
-
L:
|
|
7712
|
+
L: 363,
|
|
7795
7713
|
S: this,
|
|
7796
7714
|
C: (f, a) => f(...a)
|
|
7797
7715
|
});
|
|
@@ -7800,9 +7718,9 @@ var ServiceContext = class extends Resource7 {
|
|
|
7800
7718
|
genesisFeedKey: assertion.genesisFeedKey
|
|
7801
7719
|
});
|
|
7802
7720
|
} catch (err) {
|
|
7803
|
-
|
|
7721
|
+
log23.catch(err, void 0, {
|
|
7804
7722
|
F: __dxlog_file27,
|
|
7805
|
-
L:
|
|
7723
|
+
L: 369,
|
|
7806
7724
|
S: this,
|
|
7807
7725
|
C: (f, a) => f(...a)
|
|
7808
7726
|
});
|
|
@@ -7818,12 +7736,12 @@ var ServiceContext = class extends Resource7 {
|
|
|
7818
7736
|
let edgeIdentity;
|
|
7819
7737
|
const identity = this.identityManager.identity;
|
|
7820
7738
|
if (identity) {
|
|
7821
|
-
|
|
7739
|
+
log23.info("Setting identity on edge connection", {
|
|
7822
7740
|
identity: identity.identityKey.toHex(),
|
|
7823
7741
|
swarms: this.networkManager.topics
|
|
7824
7742
|
}, {
|
|
7825
7743
|
F: __dxlog_file27,
|
|
7826
|
-
L:
|
|
7744
|
+
L: 383,
|
|
7827
7745
|
S: this,
|
|
7828
7746
|
C: (f, a) => f(...a)
|
|
7829
7747
|
});
|
|
@@ -7837,7 +7755,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7837
7755
|
});
|
|
7838
7756
|
invariant21(identity.deviceCredentialChain, void 0, {
|
|
7839
7757
|
F: __dxlog_file27,
|
|
7840
|
-
L:
|
|
7758
|
+
L: 401,
|
|
7841
7759
|
S: this,
|
|
7842
7760
|
A: [
|
|
7843
7761
|
"identity.deviceCredentialChain",
|
|
@@ -7974,7 +7892,7 @@ var createLevel = async (config) => {
|
|
|
7974
7892
|
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
7975
7893
|
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
7976
7894
|
import { invariant as invariant22 } from "@dxos/invariant";
|
|
7977
|
-
import { log as
|
|
7895
|
+
import { log as log24 } from "@dxos/log";
|
|
7978
7896
|
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
7979
7897
|
import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
|
|
7980
7898
|
var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
@@ -7990,7 +7908,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
7990
7908
|
{
|
|
7991
7909
|
const directory = await storage.createDirectory();
|
|
7992
7910
|
const files = await directory.list();
|
|
7993
|
-
|
|
7911
|
+
log24.info("begin exporting files", {
|
|
7994
7912
|
count: files.length
|
|
7995
7913
|
}, {
|
|
7996
7914
|
F: __dxlog_file28,
|
|
@@ -8008,7 +7926,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8008
7926
|
value: data
|
|
8009
7927
|
});
|
|
8010
7928
|
}
|
|
8011
|
-
|
|
7929
|
+
log24.info("done exporting files", {
|
|
8012
7930
|
count: files.length
|
|
8013
7931
|
}, {
|
|
8014
7932
|
F: __dxlog_file28,
|
|
@@ -8018,7 +7936,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8018
7936
|
});
|
|
8019
7937
|
}
|
|
8020
7938
|
{
|
|
8021
|
-
|
|
7939
|
+
log24.info("begin exporting kv pairs", void 0, {
|
|
8022
7940
|
F: __dxlog_file28,
|
|
8023
7941
|
L: 45,
|
|
8024
7942
|
S: void 0,
|
|
@@ -8037,7 +7955,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8037
7955
|
});
|
|
8038
7956
|
count++;
|
|
8039
7957
|
}
|
|
8040
|
-
|
|
7958
|
+
log24.info("done exporting kv pairs", {
|
|
8041
7959
|
count
|
|
8042
7960
|
}, {
|
|
8043
7961
|
F: __dxlog_file28,
|
|
@@ -8109,7 +8027,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8109
8027
|
if (++count % 1e3 === 0) {
|
|
8110
8028
|
await batch.write();
|
|
8111
8029
|
batch = level.batch();
|
|
8112
|
-
|
|
8030
|
+
log24.info("importing", {
|
|
8113
8031
|
count,
|
|
8114
8032
|
total: archive.storage.length,
|
|
8115
8033
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
@@ -8121,7 +8039,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8121
8039
|
});
|
|
8122
8040
|
}
|
|
8123
8041
|
}
|
|
8124
|
-
|
|
8042
|
+
log24.info("committing changes..", void 0, {
|
|
8125
8043
|
F: __dxlog_file28,
|
|
8126
8044
|
L: 109,
|
|
8127
8045
|
S: void 0,
|
|
@@ -8137,7 +8055,7 @@ import { Context as Context10 } from "@dxos/context";
|
|
|
8137
8055
|
import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
|
|
8138
8056
|
import { invariant as invariant24 } from "@dxos/invariant";
|
|
8139
8057
|
import { PublicKey as PublicKey19 } from "@dxos/keys";
|
|
8140
|
-
import { log as
|
|
8058
|
+
import { log as log26 } from "@dxos/log";
|
|
8141
8059
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
8142
8060
|
import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
|
|
8143
8061
|
import { trace as trace11 } from "@dxos/protocols";
|
|
@@ -8322,7 +8240,7 @@ var ContactsServiceImpl = class {
|
|
|
8322
8240
|
import { Event as Event10 } from "@dxos/async";
|
|
8323
8241
|
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
8324
8242
|
import { PublicKey as PublicKey18 } from "@dxos/keys";
|
|
8325
|
-
import { getContextFromEntry, log as
|
|
8243
|
+
import { getContextFromEntry, log as log25 } from "@dxos/log";
|
|
8326
8244
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
8327
8245
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
8328
8246
|
var LoggingServiceImpl = class {
|
|
@@ -8335,11 +8253,11 @@ var LoggingServiceImpl = class {
|
|
|
8335
8253
|
};
|
|
8336
8254
|
}
|
|
8337
8255
|
async open() {
|
|
8338
|
-
|
|
8256
|
+
log25.runtimeConfig.processors.push(this._logProcessor);
|
|
8339
8257
|
}
|
|
8340
8258
|
async close() {
|
|
8341
|
-
const index =
|
|
8342
|
-
|
|
8259
|
+
const index = log25.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
8260
|
+
log25.runtimeConfig.processors.splice(index, 1);
|
|
8343
8261
|
}
|
|
8344
8262
|
async controlMetrics({ reset, record }) {
|
|
8345
8263
|
if (reset) {
|
|
@@ -8645,7 +8563,7 @@ var ClientServicesHost = class {
|
|
|
8645
8563
|
"'service host is open'"
|
|
8646
8564
|
]
|
|
8647
8565
|
});
|
|
8648
|
-
|
|
8566
|
+
log26("initializing...", void 0, {
|
|
8649
8567
|
F: __dxlog_file30,
|
|
8650
8568
|
L: 204,
|
|
8651
8569
|
S: this,
|
|
@@ -8667,7 +8585,7 @@ var ClientServicesHost = class {
|
|
|
8667
8585
|
}
|
|
8668
8586
|
}
|
|
8669
8587
|
if (!options.signalManager) {
|
|
8670
|
-
|
|
8588
|
+
log26.warn("running signaling without telemetry metadata.", void 0, {
|
|
8671
8589
|
F: __dxlog_file30,
|
|
8672
8590
|
L: 215,
|
|
8673
8591
|
S: this,
|
|
@@ -8705,7 +8623,7 @@ var ClientServicesHost = class {
|
|
|
8705
8623
|
peerKey: this._edgeConnection.peerKey
|
|
8706
8624
|
} : void 0
|
|
8707
8625
|
});
|
|
8708
|
-
|
|
8626
|
+
log26("initialized", void 0, {
|
|
8709
8627
|
F: __dxlog_file30,
|
|
8710
8628
|
L: 250,
|
|
8711
8629
|
S: this,
|
|
@@ -8717,7 +8635,7 @@ var ClientServicesHost = class {
|
|
|
8717
8635
|
return;
|
|
8718
8636
|
}
|
|
8719
8637
|
const traceId = PublicKey19.random().toHex();
|
|
8720
|
-
|
|
8638
|
+
log26.trace("dxos.client-services.host.open", trace11.begin({
|
|
8721
8639
|
id: traceId
|
|
8722
8640
|
}), {
|
|
8723
8641
|
F: __dxlog_file30,
|
|
@@ -8762,7 +8680,7 @@ var ClientServicesHost = class {
|
|
|
8762
8680
|
]
|
|
8763
8681
|
});
|
|
8764
8682
|
this._opening = true;
|
|
8765
|
-
|
|
8683
|
+
log26("opening...", {
|
|
8766
8684
|
lockKey: this._resourceLock?.lockKey
|
|
8767
8685
|
}, {
|
|
8768
8686
|
F: __dxlog_file30,
|
|
@@ -8804,7 +8722,7 @@ var ClientServicesHost = class {
|
|
|
8804
8722
|
config: this._config,
|
|
8805
8723
|
context: this._serviceContext
|
|
8806
8724
|
}),
|
|
8807
|
-
EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
|
|
8725
|
+
EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider, this._edgeConnection)
|
|
8808
8726
|
});
|
|
8809
8727
|
await this._serviceContext.open(ctx);
|
|
8810
8728
|
await identityService.open();
|
|
@@ -8823,7 +8741,7 @@ var ClientServicesHost = class {
|
|
|
8823
8741
|
this._open = true;
|
|
8824
8742
|
this._statusUpdate.emit();
|
|
8825
8743
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8826
|
-
|
|
8744
|
+
log26("opened", {
|
|
8827
8745
|
deviceKey
|
|
8828
8746
|
}, {
|
|
8829
8747
|
F: __dxlog_file30,
|
|
@@ -8831,7 +8749,7 @@ var ClientServicesHost = class {
|
|
|
8831
8749
|
S: this,
|
|
8832
8750
|
C: (f, a) => f(...a)
|
|
8833
8751
|
});
|
|
8834
|
-
|
|
8752
|
+
log26.trace("dxos.client-services.host.open", trace11.end({
|
|
8835
8753
|
id: traceId
|
|
8836
8754
|
}), {
|
|
8837
8755
|
F: __dxlog_file30,
|
|
@@ -8845,7 +8763,7 @@ var ClientServicesHost = class {
|
|
|
8845
8763
|
return;
|
|
8846
8764
|
}
|
|
8847
8765
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8848
|
-
|
|
8766
|
+
log26("closing...", {
|
|
8849
8767
|
deviceKey
|
|
8850
8768
|
}, {
|
|
8851
8769
|
F: __dxlog_file30,
|
|
@@ -8863,7 +8781,7 @@ var ClientServicesHost = class {
|
|
|
8863
8781
|
await this._level?.close();
|
|
8864
8782
|
this._open = false;
|
|
8865
8783
|
this._statusUpdate.emit();
|
|
8866
|
-
|
|
8784
|
+
log26("closed", {
|
|
8867
8785
|
deviceKey
|
|
8868
8786
|
}, {
|
|
8869
8787
|
F: __dxlog_file30,
|
|
@@ -8874,7 +8792,7 @@ var ClientServicesHost = class {
|
|
|
8874
8792
|
}
|
|
8875
8793
|
async reset() {
|
|
8876
8794
|
const traceId = PublicKey19.random().toHex();
|
|
8877
|
-
|
|
8795
|
+
log26.trace("dxos.sdk.client-services-host.reset", trace11.begin({
|
|
8878
8796
|
id: traceId
|
|
8879
8797
|
}), {
|
|
8880
8798
|
F: __dxlog_file30,
|
|
@@ -8882,7 +8800,7 @@ var ClientServicesHost = class {
|
|
|
8882
8800
|
S: this,
|
|
8883
8801
|
C: (f, a) => f(...a)
|
|
8884
8802
|
});
|
|
8885
|
-
|
|
8803
|
+
log26.info("resetting...", void 0, {
|
|
8886
8804
|
F: __dxlog_file30,
|
|
8887
8805
|
L: 394,
|
|
8888
8806
|
S: this,
|
|
@@ -8892,13 +8810,13 @@ var ClientServicesHost = class {
|
|
|
8892
8810
|
this._statusUpdate.emit();
|
|
8893
8811
|
await this._serviceContext?.close();
|
|
8894
8812
|
await this._storage.reset();
|
|
8895
|
-
|
|
8813
|
+
log26.info("reset", void 0, {
|
|
8896
8814
|
F: __dxlog_file30,
|
|
8897
8815
|
L: 401,
|
|
8898
8816
|
S: this,
|
|
8899
8817
|
C: (f, a) => f(...a)
|
|
8900
8818
|
});
|
|
8901
|
-
|
|
8819
|
+
log26.trace("dxos.sdk.client-services-host.reset", trace11.end({
|
|
8902
8820
|
id: traceId
|
|
8903
8821
|
}), {
|
|
8904
8822
|
F: __dxlog_file30,
|
|
@@ -8980,4 +8898,4 @@ export {
|
|
|
8980
8898
|
importProfileData,
|
|
8981
8899
|
ClientServicesHost
|
|
8982
8900
|
};
|
|
8983
|
-
//# sourceMappingURL=chunk-
|
|
8901
|
+
//# sourceMappingURL=chunk-LMUKPYXE.mjs.map
|