@xyo-network/os-runtime 4.1.1 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/neutral/DappCallerBase.d.ts +2 -2
  2. package/dist/neutral/OsCallerBase.d.ts +2 -2
  3. package/dist/neutral/XyOs.d.ts +2 -2
  4. package/dist/neutral/XyOsDapp.d.ts +2 -2
  5. package/dist/neutral/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts +1 -1
  6. package/dist/neutral/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  7. package/dist/neutral/adapter/Network.d.ts +1 -1
  8. package/dist/neutral/adapter/Settings.d.ts +1 -1
  9. package/dist/neutral/classes/cache/RunningAccessDappCache.d.ts +1 -1
  10. package/dist/neutral/classes/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
  11. package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
  12. package/dist/neutral/index.mjs +989 -640
  13. package/dist/neutral/index.mjs.map +1 -1
  14. package/dist/neutral/stack/OsPubSubNetworkStack.d.ts +2 -2
  15. package/dist/node/DappCallerBase.d.ts +2 -2
  16. package/dist/node/OsCallerBase.d.ts +2 -2
  17. package/dist/node/XyOs.d.ts +2 -2
  18. package/dist/node/XyOsDapp.d.ts +2 -2
  19. package/dist/node/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts +1 -1
  20. package/dist/node/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
  21. package/dist/node/adapter/Network.d.ts +1 -1
  22. package/dist/node/adapter/Settings.d.ts +1 -1
  23. package/dist/node/classes/cache/RunningAccessDappCache.d.ts +1 -1
  24. package/dist/node/classes/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
  25. package/dist/node/classes/settings/CallerBase.d.ts +1 -1
  26. package/dist/node/index.mjs +989 -640
  27. package/dist/node/index.mjs.map +1 -1
  28. package/dist/node/scripts/xyos/command/index.mjs +486 -345
  29. package/dist/node/scripts/xyos/command/index.mjs.map +1 -1
  30. package/dist/node/scripts/xyos/index.mjs +487 -360
  31. package/dist/node/scripts/xyos/index.mjs.map +1 -1
  32. package/dist/node/scripts/xyos/lib/index.mjs +453 -327
  33. package/dist/node/scripts/xyos/lib/index.mjs.map +1 -1
  34. package/dist/node/stack/OsPubSubNetworkStack.d.ts +2 -2
  35. package/package.json +14 -15
  36. package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +6 -7
@@ -1,8 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/scripts/xyos/lib/createFromTemplate.ts
2
- var createFromTemplate = async ({ target, template }) => {
5
+ var createFromTemplate = /* @__PURE__ */ __name(async ({ target, template }) => {
3
6
  console.log("Creating from template", template, "at", target);
4
7
  return await Promise.resolve();
5
- };
8
+ }, "createFromTemplate");
6
9
 
7
10
  // src/scripts/xyos/lib/headless.ts
8
11
  import fs from "node:fs";
@@ -36,6 +39,10 @@ var DappsArchivistPayloadDivinerModuleName = "DappsArchivistPayloadDiviner";
36
39
  var DappsArchivistPayloadDevelopmentDivinerModuleName = `${DappsArchivistPayloadDivinerModuleName}Development`;
37
40
  var RegisteredDappInterfacesArchivistModuleName = "RegisteredDappInterfacesArchivist";
38
41
  var OsCallerBase = class {
42
+ static {
43
+ __name(this, "OsCallerBase");
44
+ }
45
+ context;
39
46
  constructor(context) {
40
47
  this.context = context;
41
48
  }
@@ -46,48 +53,39 @@ var OsCallerBase = class {
46
53
  }
47
54
  // Get the dapps archivist development
48
55
  async getDappsArchivistDevelopment() {
49
- const mod = assertEx(
50
- await this.context.root.resolve(DappsArchivistDevelopmentModuleName),
51
- () => `${DappsArchivistDevelopmentModuleName} not found`
52
- );
56
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistDevelopmentModuleName), () => `${DappsArchivistDevelopmentModuleName} not found`);
53
57
  return asArchivistInstance(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`);
54
58
  }
55
59
  // Get the dapps archivist payload diviner
56
60
  async getDappsArchivistPayloadDiviner() {
57
- const mod = assertEx(
58
- await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName),
59
- () => `${DappsArchivistPayloadDivinerModuleName} not found`
60
- );
61
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName), () => `${DappsArchivistPayloadDivinerModuleName} not found`);
61
62
  return asDivinerInstance(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`);
62
63
  }
63
64
  // Get the dapps archivist payload diviner development
64
65
  async getDappsArchivistPayloadDivinerDevelopment() {
65
- const mod = assertEx(
66
- await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName),
67
- () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`
68
- );
66
+ const mod = assertEx(await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName), () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`);
69
67
  return asDivinerInstance(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`);
70
68
  }
71
69
  // Get the registered dapp interfaces archivist
72
70
  async getRegisteredDappInterfacesArchivist() {
73
- const mod = assertEx(
74
- await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName),
75
- () => `${RegisteredDappInterfacesArchivistModuleName} not found`
76
- );
71
+ const mod = assertEx(await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName), () => `${RegisteredDappInterfacesArchivistModuleName} not found`);
77
72
  return asArchivistInstance(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`);
78
73
  }
79
74
  };
80
75
 
81
76
  // src/wallet/DappSeedPhraseRepository.ts
82
77
  var DappSeedPhraseRepository = class extends OsCallerBase {
83
- constructor(xyOs, allowedNames) {
84
- super(xyOs);
85
- this.allowedNames = allowedNames;
78
+ static {
79
+ __name(this, "DappSeedPhraseRepository");
86
80
  }
81
+ allowedNames;
87
82
  // record of all dapps that have requested a seed phrase with the OS
88
- dappIdRepository = /* @__PURE__ */ new Map();
83
+ dappIdRepository;
89
84
  // record of all walletIds that have been issued to registered dapps
90
- walletIdRepository = /* @__PURE__ */ new Map();
85
+ walletIdRepository;
86
+ constructor(xyOs, allowedNames) {
87
+ super(xyOs), this.allowedNames = allowedNames, this.dappIdRepository = /* @__PURE__ */ new Map(), this.walletIdRepository = /* @__PURE__ */ new Map();
88
+ }
91
89
  async add(dappId) {
92
90
  const archivist = await this.getDappsArchivist();
93
91
  const seedPhrase = this.newPhrase();
@@ -98,7 +96,9 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
98
96
  seedPhrase,
99
97
  walletId
100
98
  };
101
- await archivist.insert([payload]);
99
+ await archivist.insert([
100
+ payload
101
+ ]);
102
102
  this.dappIdRepository.set(dappId, payload);
103
103
  this.walletIdRepository.set(walletId, payload);
104
104
  return walletId;
@@ -130,9 +130,13 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
130
130
  limit: 1,
131
131
  order: "desc",
132
132
  schema: PayloadDivinerQuerySchema,
133
- schemas: [DappWalletSeedPhraseSchema]
133
+ schemas: [
134
+ DappWalletSeedPhraseSchema
135
+ ]
134
136
  };
135
- const results = await diviner.divine([query]);
137
+ const results = await diviner.divine([
138
+ query
139
+ ]);
136
140
  return results.length > 0 ? results[0] : void 0;
137
141
  }
138
142
  async checkWalletId(walletId) {
@@ -141,10 +145,14 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
141
145
  limit: 1,
142
146
  order: "desc",
143
147
  schema: PayloadDivinerQuerySchema,
144
- schemas: [DappWalletSeedPhraseSchema],
148
+ schemas: [
149
+ DappWalletSeedPhraseSchema
150
+ ],
145
151
  walletId
146
152
  };
147
- const results = await diviner.divine([query]);
153
+ const results = await diviner.divine([
154
+ query
155
+ ]);
148
156
  return results.length > 0 ? results[0] : void 0;
149
157
  }
150
158
  newPhrase() {
@@ -162,42 +170,37 @@ var IntentArchivistModuleName = "IntentArchivist";
162
170
  var IntentArchivistPayloadDivinerModuleName = "IntentArchivistPayloadDiviner";
163
171
  var DappArchivistPayloadDivinerModuleName = "DappArchivistPayloadDiviner";
164
172
  var DappCallerBase = class {
173
+ static {
174
+ __name(this, "DappCallerBase");
175
+ }
176
+ context;
165
177
  constructor(context) {
166
178
  this.context = context;
167
179
  }
168
180
  /**
169
- * Get the DappArchivist
170
- */
181
+ * Get the DappArchivist
182
+ */
171
183
  async getDappArchivist() {
172
- const mod = assertEx2(
173
- await this.context.root.resolve(DappArchivistModuleName),
174
- () => `${DappArchivistModuleName} not found [${toJsonString(this.context.root.publicChildren())}]`
175
- );
184
+ const mod = assertEx2(await this.context.root.resolve(DappArchivistModuleName), () => `${DappArchivistModuleName} not found [${toJsonString(this.context.root.publicChildren())}]`);
176
185
  return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`);
177
186
  }
178
187
  /**
179
- * Get the DappArchivistPayloadDiviner
180
- */
188
+ * Get the DappArchivistPayloadDiviner
189
+ */
181
190
  async getDappArchivistPayloadDiviner() {
182
- const mod = assertEx2(
183
- await this.context.root.resolve(DappArchivistPayloadDivinerModuleName),
184
- () => `${DappArchivistPayloadDivinerModuleName} not found`
185
- );
191
+ const mod = assertEx2(await this.context.root.resolve(DappArchivistPayloadDivinerModuleName), () => `${DappArchivistPayloadDivinerModuleName} not found`);
186
192
  return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`);
187
193
  }
188
194
  /**
189
- * Get the IntentArchivist
190
- */
195
+ * Get the IntentArchivist
196
+ */
191
197
  async getDappIntentArchivist() {
192
198
  const mod = assertEx2(await this.context.root.resolve(IntentArchivistModuleName), () => `${IntentArchivistModuleName} not found`);
193
199
  return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`);
194
200
  }
195
201
  // Get the IntentArchivistPayloadDiviner
196
202
  async getDappIntentArchivistPayloadDiviner() {
197
- const mod = assertEx2(
198
- await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName),
199
- () => `${IntentArchivistPayloadDivinerModuleName} not found`
200
- );
203
+ const mod = assertEx2(await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName), () => `${IntentArchivistPayloadDivinerModuleName} not found`);
201
204
  return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`);
202
205
  }
203
206
  };
@@ -340,20 +343,26 @@ var os_node_manifest_default = {
340
343
  import { asDivinerInstance as asDivinerInstance3 } from "@xyo-network/diviner-model";
341
344
  import { ResolveHelper } from "@xyo-network/module-model";
342
345
  import { NameRegistrarTransformer } from "@xyo-network/module-resolver";
343
- var initializeXns = async (xnsNode) => {
346
+ var initializeXns = /* @__PURE__ */ __name(async (xnsNode) => {
344
347
  if (ResolveHelper.transformers.length === 0) {
345
348
  const registrarDiviner = asDivinerInstance3(await xnsNode?.resolve("AddressRecords:AddressRecordIndexDiviner"));
346
349
  if (registrarDiviner) {
347
350
  const transformer = new NameRegistrarTransformer(registrarDiviner, "xyo");
348
- ResolveHelper.transformers = [transformer];
351
+ ResolveHelper.transformers = [
352
+ transformer
353
+ ];
349
354
  return true;
350
355
  }
351
356
  }
352
357
  return false;
353
- };
358
+ }, "initializeXns");
354
359
 
355
360
  // src/lib/NameTransforms.ts
356
361
  var NameTransforms = class _NameTransforms {
362
+ static {
363
+ __name(this, "NameTransforms");
364
+ }
365
+ value;
357
366
  constructor(value) {
358
367
  this.value = value;
359
368
  }
@@ -381,19 +390,22 @@ var NameTransforms = class _NameTransforms {
381
390
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema2 } from "@xyo-network/diviner-payload-model";
382
391
  import { DappIntentSchema, DappMode } from "@xyo-network/os-model";
383
392
  var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
393
+ static {
394
+ __name(this, "DappIntentCaller");
395
+ }
384
396
  static OsDappName = "XyOs";
385
397
  constructor(context) {
386
398
  super(context);
387
399
  }
388
400
  /**
389
- * Build a new intent
390
- * @param {DappId} sourceDappId
391
- * @param {DappIntentTypes} intent
392
- * @param {DappId} targetDappId
393
- * @param {DappMode} targetMode
394
- * @param {DappIntent['params']} params?
395
- * @returns DappIntent
396
- */
401
+ * Build a new intent
402
+ * @param {DappId} sourceDappId
403
+ * @param {DappIntentTypes} intent
404
+ * @param {DappId} targetDappId
405
+ * @param {DappMode} targetMode
406
+ * @param {DappIntent['params']} params?
407
+ * @returns DappIntent
408
+ */
397
409
  static buildIntent(sourceDappId, intent, targetDappId, targetMode = DappMode.Window, params) {
398
410
  return {
399
411
  intent,
@@ -409,7 +421,9 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
409
421
  async addIntent(id, intent, mode) {
410
422
  const intentArchivist = await this.getDappIntentArchivist();
411
423
  const newIntent = _DappIntentCaller.buildIntent(id, intent, mode);
412
- await intentArchivist.insert([newIntent]);
424
+ await intentArchivist.insert([
425
+ newIntent
426
+ ]);
413
427
  }
414
428
  // Get all intents
415
429
  async allIntents() {
@@ -430,7 +444,9 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
430
444
  schema: PayloadDivinerQuerySchema2,
431
445
  sourceDappId: dappName
432
446
  };
433
- return await diviner.divine([query]);
447
+ return await diviner.divine([
448
+ query
449
+ ]);
434
450
  }
435
451
  };
436
452
 
@@ -438,17 +454,15 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
438
454
  import { forget as forget2 } from "@xylabs/forget";
439
455
  import { fulfilled, rejected } from "@xylabs/promise";
440
456
  import { ModuleFactoryLocator as ModuleFactoryLocator3 } from "@xyo-network/module-factory-locator";
441
- import {
442
- DappIntentTypes,
443
- DappMode as DappMode2,
444
- isRegisteredDappAccessDappSet,
445
- isRegisteredDappExposedDappSet
446
- } from "@xyo-network/os-model";
457
+ import { DappIntentTypes, DappMode as DappMode2, isRegisteredDappAccessDappSet, isRegisteredDappExposedDappSet } from "@xyo-network/os-model";
447
458
 
448
459
  // src/event/bus/Connection.ts
449
460
  import { assertEx as assertEx3 } from "@xylabs/assert";
450
461
  import { BaseEmitter } from "@xyo-network/module-event-emitter";
451
462
  var EventBusConnection = class extends BaseEmitter {
463
+ static {
464
+ __name(this, "EventBusConnection");
465
+ }
452
466
  _id;
453
467
  description;
454
468
  type;
@@ -468,19 +482,15 @@ var EventBusConnection = class extends BaseEmitter {
468
482
  // src/event/bus/EventBus.ts
469
483
  import { assertEx as assertEx4 } from "@xylabs/assert";
470
484
  import { forget } from "@xylabs/forget";
471
- import {
472
- asArchivistInstance as asArchivistInstance3,
473
- MemoryArchivist,
474
- MemoryArchivistConfigSchema
475
- } from "@xyo-network/archivist";
476
- import {
477
- isEventBusEvent,
478
- isPubSubConnections
479
- } from "@xyo-network/os-model";
485
+ import { asArchivistInstance as asArchivistInstance3, MemoryArchivist, MemoryArchivistConfigSchema } from "@xyo-network/archivist";
486
+ import { isEventBusEvent, isPubSubConnections } from "@xyo-network/os-model";
480
487
  import { PayloadBuilder } from "@xyo-network/payload-builder";
481
488
  import { Mutex } from "async-mutex";
482
489
  import { v4 as uuid2 } from "uuid";
483
490
  var EventBus = class {
491
+ static {
492
+ __name(this, "EventBus");
493
+ }
484
494
  // Internal Archivist to store event data
485
495
  _archivist;
486
496
  // Store all connections
@@ -489,10 +499,7 @@ var EventBus = class {
489
499
  publisherCallbacks = {};
490
500
  startMutex = new Mutex();
491
501
  get archivist() {
492
- return asArchivistInstance3(
493
- assertEx4(this._archivist, () => "Archivist not found. Did you forget to call start()?"),
494
- "not a valid archivist instance"
495
- );
502
+ return asArchivistInstance3(assertEx4(this._archivist, () => "Archivist not found. Did you forget to call start()?"), "not a valid archivist instance");
496
503
  }
497
504
  addConnection(connection) {
498
505
  const id = uuid2();
@@ -521,7 +528,12 @@ var EventBus = class {
521
528
  console.warn("EventBus already started");
522
529
  return this;
523
530
  }
524
- this._archivist = await MemoryArchivist.create({ config: { name: storeName, schema: MemoryArchivistConfigSchema } });
531
+ this._archivist = await MemoryArchivist.create({
532
+ config: {
533
+ name: storeName,
534
+ schema: MemoryArchivistConfigSchema
535
+ }
536
+ });
525
537
  this.archivist.on("inserted", ({ payloads }) => {
526
538
  const eventBusEvent = payloads.find(isEventBusEvent);
527
539
  if (!eventBusEvent) return;
@@ -531,7 +543,9 @@ var EventBus = class {
531
543
  for (const [eventName, callback] of connection.subscribableEvents.entries()) {
532
544
  if (eventName !== eventBusEvent.name) continue;
533
545
  if (callback) {
534
- const forgettable = async () => await callback({ payloads });
546
+ const forgettable = /* @__PURE__ */ __name(async () => await callback({
547
+ payloads
548
+ }), "forgettable");
535
549
  forget(forgettable());
536
550
  }
537
551
  }
@@ -543,16 +557,22 @@ var EventBus = class {
543
557
  }
544
558
  handlePublisherAdd(connection) {
545
559
  for (const eventName of connection.publishableEvents ?? []) {
546
- const connectionPublisherCallback = async ({ payloads }) => {
547
- const event = { name: eventName, schema: "network.xyo.event.bus.event" };
560
+ const connectionPublisherCallback = /* @__PURE__ */ __name(async ({ payloads }) => {
561
+ const event = {
562
+ name: eventName,
563
+ schema: "network.xyo.event.bus.event"
564
+ };
548
565
  const eventPayloads = payloads ?? [];
549
566
  event.sources = await PayloadBuilder.dataHashes(eventPayloads);
550
567
  try {
551
- await this.archivist.insert([event, ...payloads ?? []]);
568
+ await this.archivist.insert([
569
+ event,
570
+ ...payloads ?? []
571
+ ]);
552
572
  } catch (e) {
553
573
  console.error("Error inserting event into archivist", e);
554
574
  }
555
- };
575
+ }, "connectionPublisherCallback");
556
576
  connection.on(eventName, connectionPublisherCallback);
557
577
  const callbackId = connection.id + eventName;
558
578
  this.publisherCallbacks[callbackId] = connectionPublisherCallback;
@@ -569,6 +589,9 @@ var EventBus = class {
569
589
 
570
590
  // src/event/bus/PubSubConnection.ts
571
591
  var EventBusPubSubConnection = class extends EventBusConnection {
592
+ static {
593
+ __name(this, "EventBusPubSubConnection");
594
+ }
572
595
  publishableEvents;
573
596
  subscribableEvents;
574
597
  constructor(request) {
@@ -584,42 +607,52 @@ var EventBusPubSubConnection = class extends EventBusConnection {
584
607
  // src/event/connections/DappAccessRequest.ts
585
608
  var DappAccessRequestEvent = "dappAccessRequest";
586
609
  var dappAccessRequestConnectionRequest = {
587
- publishableEvents: [DappAccessRequestEvent],
610
+ publishableEvents: [
611
+ DappAccessRequestEvent
612
+ ],
588
613
  type: "PubSub"
589
614
  };
590
- var dappAccessRequestConnection = () => new EventBusPubSubConnection(dappAccessRequestConnectionRequest);
615
+ var dappAccessRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(dappAccessRequestConnectionRequest), "dappAccessRequestConnection");
591
616
 
592
617
  // src/event/connections/ExposeDappRequest.ts
593
618
  var ExposeDappRequestEvent = "exposeDappRequest";
594
619
  var exposeDappConnectionRequest = {
595
- publishableEvents: [ExposeDappRequestEvent],
620
+ publishableEvents: [
621
+ ExposeDappRequestEvent
622
+ ],
596
623
  type: "PubSub"
597
624
  };
598
- var exposeDappRequestConnection = () => new EventBusPubSubConnection(exposeDappConnectionRequest);
625
+ var exposeDappRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(exposeDappConnectionRequest), "exposeDappRequestConnection");
599
626
 
600
627
  // src/event/connections/OsPubSubNetworkReady.ts
601
628
  var OsPubSubNetworkReadyEvent = "osPubSubNetworkReady";
602
629
  var osPubSubNetworkConnectionRequest = {
603
- publishableEvents: [OsPubSubNetworkReadyEvent],
630
+ publishableEvents: [
631
+ OsPubSubNetworkReadyEvent
632
+ ],
604
633
  type: "PubSub"
605
634
  };
606
- var osPubSubNetworkReadyConnection = () => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest);
635
+ var osPubSubNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest), "osPubSubNetworkReadyConnection");
607
636
 
608
637
  // src/event/connections/OsSettingsReady.ts
609
638
  var OsSettingsReadyEvent = "osSettingsReady";
610
639
  var osSettingsConnectionRequest = {
611
- publishableEvents: [OsSettingsReadyEvent],
640
+ publishableEvents: [
641
+ OsSettingsReadyEvent
642
+ ],
612
643
  type: "PubSub"
613
644
  };
614
- var osSettingsReadyConnection = () => new EventBusPubSubConnection(osSettingsConnectionRequest);
645
+ var osSettingsReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osSettingsConnectionRequest), "osSettingsReadyConnection");
615
646
 
616
647
  // src/event/connections/OsXyoPublicReady.ts
617
648
  var OsXyoPublicNetworkReadyEvent = "osXyoPublicNetworkReady";
618
649
  var osXyoPublicNetworkConnectionRequest = {
619
- publishableEvents: [OsXyoPublicNetworkReadyEvent],
650
+ publishableEvents: [
651
+ OsXyoPublicNetworkReadyEvent
652
+ ],
620
653
  type: "PubSub"
621
654
  };
622
- var osXyoPublicNetworkReadyConnection = () => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest);
655
+ var osXyoPublicNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest), "osXyoPublicNetworkReadyConnection");
623
656
 
624
657
  // src/XyOsDapp.ts
625
658
  import { assertEx as assertEx6 } from "@xylabs/assert";
@@ -671,6 +704,9 @@ import { BaseEmitter as BaseEmitter2 } from "@xyo-network/module-event-emitter";
671
704
  import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
672
705
  import { Mutex as Mutex2 } from "async-mutex";
673
706
  var XyOsContextBase = class extends BaseEmitter2 {
707
+ static {
708
+ __name(this, "XyOsContextBase");
709
+ }
674
710
  _bootMutex = new Mutex2();
675
711
  _platformLocator;
676
712
  _root;
@@ -754,10 +790,15 @@ var XyOsContextBase = class extends BaseEmitter2 {
754
790
 
755
791
  // src/XyOsDapp.ts
756
792
  var XyOsDapp = class extends XyOsContextBase {
793
+ static {
794
+ __name(this, "XyOsDapp");
795
+ }
757
796
  dapp;
758
797
  constructor(params) {
759
798
  super(params);
760
- this.dapp = { ...params.dapp };
799
+ this.dapp = {
800
+ ...params.dapp
801
+ };
761
802
  }
762
803
  get eventBus() {
763
804
  return this.parent.eventBus;
@@ -769,12 +810,12 @@ var XyOsDapp = class extends XyOsContextBase {
769
810
  return this.parent.exposedNodeOuter;
770
811
  }
771
812
  /**
772
- * @deprecated Dapps should not have access to the bios. This is done for the
773
- * settings dapp, but should be refactored out. Bios could possibly be an
774
- * optional property of the parent context passed in for dapps that require
775
- * elevated permissions.
776
- * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
777
- */
813
+ * @deprecated Dapps should not have access to the bios. This is done for the
814
+ * settings dapp, but should be refactored out. Bios could possibly be an
815
+ * optional property of the parent context passed in for dapps that require
816
+ * elevated permissions.
817
+ * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
818
+ */
778
819
  get kernel() {
779
820
  return assertEx6(this.parent.kernel, () => "Missing kernel");
780
821
  }
@@ -793,15 +834,17 @@ var XyOsDapp = class extends XyOsContextBase {
793
834
  assertEx6(this._root === void 0, () => "Dapp already booted");
794
835
  const finalLocator = locator ? (this.params.locator ?? new ModuleFactoryLocator2()).merge(locator) : this.params.locator ?? new ModuleFactoryLocator2();
795
836
  console.log("XyOsDapp:boot:finalLocator", finalLocator);
796
- const dappNodesWrapper = new ManifestWrapper({ ...this.manifest, schema: DappPackageManifestPayloadSchema }, wallet, finalLocator);
837
+ const dappNodesWrapper = new ManifestWrapper({
838
+ ...this.manifest,
839
+ schema: DappPackageManifestPayloadSchema
840
+ }, wallet, finalLocator);
797
841
  const dappNodes = await dappNodesWrapper.loadNodes();
798
842
  const dappManifestWallet = await wallet.derivePath("99999");
799
843
  dapp_window_manifest_default.nodes[0].config.name = this.dapp.name + "Root";
800
- const wrapper = new ManifestWrapper(
801
- { ...dapp_window_manifest_default, schema: DappPackageManifestPayloadSchema },
802
- dappManifestWallet,
803
- finalLocator
804
- );
844
+ const wrapper = new ManifestWrapper({
845
+ ...dapp_window_manifest_default,
846
+ schema: DappPackageManifestPayloadSchema
847
+ }, dappManifestWallet, finalLocator);
805
848
  const node = await wrapper.loadNodeFromIndex(0);
806
849
  for (const dappNode of dappNodes) {
807
850
  await node.register(dappNode);
@@ -823,12 +866,7 @@ import semver from "semver";
823
866
 
824
867
  // src/classes/system/Queries.ts
825
868
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema3 } from "@xyo-network/diviner-payload-model";
826
- import {
827
- DappConfigSchema,
828
- DappIconSchema,
829
- DappWidgetConfigSchema,
830
- UnregisteredDappAccessSchema
831
- } from "@xyo-network/os-model";
869
+ import { DappConfigSchema, DappIconSchema, DappWidgetConfigSchema, UnregisteredDappAccessSchema } from "@xyo-network/os-model";
832
870
  import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
833
871
  var SystemDappQueries = {
834
872
  async getDappAccess(diviner, name, version) {
@@ -836,10 +874,14 @@ var SystemDappQueries = {
836
874
  order: "desc",
837
875
  registeringDappId: name,
838
876
  schema: PayloadDivinerQuerySchema3,
839
- schemas: [UnregisteredDappAccessSchema],
877
+ schemas: [
878
+ UnregisteredDappAccessSchema
879
+ ],
840
880
  version
841
881
  };
842
- return await diviner.divine([accessQuery]);
882
+ return await diviner.divine([
883
+ accessQuery
884
+ ]);
843
885
  },
844
886
  async getLatestConfig(diviner, name) {
845
887
  const configQuery = {
@@ -847,9 +889,13 @@ var SystemDappQueries = {
847
889
  name,
848
890
  order: "desc",
849
891
  schema: PayloadDivinerQuerySchema3,
850
- schemas: [DappConfigSchema]
892
+ schemas: [
893
+ DappConfigSchema
894
+ ]
851
895
  };
852
- const [dappConfig] = await diviner.divine([configQuery]);
896
+ const [dappConfig] = await diviner.divine([
897
+ configQuery
898
+ ]);
853
899
  return dappConfig;
854
900
  },
855
901
  async getLatestIcon(diviner, name, version) {
@@ -857,10 +903,14 @@ var SystemDappQueries = {
857
903
  name,
858
904
  order: "desc",
859
905
  schema: PayloadDivinerQuerySchema3,
860
- schemas: [DappIconSchema],
906
+ schemas: [
907
+ DappIconSchema
908
+ ],
861
909
  version
862
910
  };
863
- const [dappIcon] = await diviner.divine([iconQuery]);
911
+ const [dappIcon] = await diviner.divine([
912
+ iconQuery
913
+ ]);
864
914
  return dappIcon;
865
915
  },
866
916
  async getWidgetConfigs(diviner, name, version) {
@@ -868,10 +918,14 @@ var SystemDappQueries = {
868
918
  dappId: name,
869
919
  order: "desc",
870
920
  schema: PayloadDivinerQuerySchema3,
871
- schemas: [DappWidgetConfigSchema],
921
+ schemas: [
922
+ DappWidgetConfigSchema
923
+ ],
872
924
  version
873
925
  };
874
- const widgetConfigs = await diviner.divine([widgetConfigQuery]);
926
+ const widgetConfigs = await diviner.divine([
927
+ widgetConfigQuery
928
+ ]);
875
929
  const uniqueConfigs = {};
876
930
  for (const widgetConfig of widgetConfigs) {
877
931
  const hash = await PayloadBuilder2.dataHash(widgetConfig);
@@ -883,25 +937,28 @@ var SystemDappQueries = {
883
937
 
884
938
  // src/classes/system/ManageSystemDapps.ts
885
939
  var ManageSystemDapps = class extends OsCallerBase {
940
+ static {
941
+ __name(this, "ManageSystemDapps");
942
+ }
943
+ defaultSystemNames;
944
+ defaultSystemDapps;
945
+ defaultSystemDappParams;
946
+ locator;
947
+ developmentMode;
948
+ onErrorCallbacks;
886
949
  constructor(context, defaultSystemNames, defaultSystemDapps, defaultSystemDappParams, locator, developmentMode) {
887
- super(context);
888
- this.defaultSystemNames = defaultSystemNames;
889
- this.defaultSystemDapps = defaultSystemDapps;
890
- this.defaultSystemDappParams = defaultSystemDappParams;
891
- this.locator = locator;
892
- this.developmentMode = developmentMode;
950
+ super(context), this.defaultSystemNames = defaultSystemNames, this.defaultSystemDapps = defaultSystemDapps, this.defaultSystemDappParams = defaultSystemDappParams, this.locator = locator, this.developmentMode = developmentMode, this.onErrorCallbacks = [];
893
951
  }
894
- onErrorCallbacks = [];
895
952
  /**
896
- * Add a callback to listen for errors throwing during system dapp registration
897
- * @param {ErrorListener} errorListener
898
- */
953
+ * Add a callback to listen for errors throwing during system dapp registration
954
+ * @param {ErrorListener} errorListener
955
+ */
899
956
  addErrorListener(errorListener) {
900
957
  this.onErrorCallbacks.push(errorListener);
901
958
  }
902
959
  /**
903
- * Installs the dapps into the OS and builds the appropriate DappSet
904
- */
960
+ * Installs the dapps into the OS and builds the appropriate DappSet
961
+ */
905
962
  async install() {
906
963
  await this.insertPayloads();
907
964
  return await this.latestSets();
@@ -925,9 +982,13 @@ var ManageSystemDapps = class extends OsCallerBase {
925
982
  console.error(`${systemDappPayload.version} does not appear to be a valid semver value`, e);
926
983
  continue;
927
984
  }
928
- const [existing] = await archivist.get([await PayloadBuilder3.dataHash(systemDappPayload)]);
985
+ const [existing] = await archivist.get([
986
+ await PayloadBuilder3.dataHash(systemDappPayload)
987
+ ]);
929
988
  if (existing) continue;
930
- await archivist.insert([systemDappPayload]);
989
+ await archivist.insert([
990
+ systemDappPayload
991
+ ]);
931
992
  }
932
993
  return true;
933
994
  } catch (e) {
@@ -982,11 +1043,7 @@ var ManageSystemDapps = class extends OsCallerBase {
982
1043
 
983
1044
  // src/classes/registration/DappRegistry.ts
984
1045
  import { HDWallet as HDWallet3 } from "@xyo-network/account";
985
- import {
986
- DappRegisteredSchema,
987
- DappRegisteredState,
988
- isRegisteredDappAccess
989
- } from "@xyo-network/os-model";
1046
+ import { DappRegisteredSchema, DappRegisteredState, isRegisteredDappAccess } from "@xyo-network/os-model";
990
1047
 
991
1048
  // src/classes/registration/ValidateDappAccessDiviner/Config.ts
992
1049
  import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
@@ -998,20 +1055,22 @@ var ValidateDappAccessDivinerConfigSchema = "network.xyo.os.dapp.access.registra
998
1055
  import { HDWallet as HDWallet2 } from "@xyo-network/account";
999
1056
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
1000
1057
  import { ManifestWrapper as ManifestWrapper2, PackageManifestPayloadSchema } from "@xyo-network/manifest";
1001
- import {
1002
- isDappPackageManifestPayload,
1003
- isUnregisteredDappAccess,
1004
- RegisteredDappAccessSchema
1005
- } from "@xyo-network/os-model";
1006
- import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
1058
+ import { isDappPackageManifestPayload, isUnregisteredDappAccess, RegisteredDappAccessSchema } from "@xyo-network/os-model";
1007
1059
 
1008
1060
  // src/access-interfaces/ValidDappAccessInterfaces.ts
1009
1061
  import { RegisteredNames, RegisteredNamesInterface } from "@xyo-network/os-model";
1010
- var ValidDappAccessInterfaces = { [RegisteredNames]: RegisteredNamesInterface };
1062
+ var ValidDappAccessInterfaces = {
1063
+ [RegisteredNames]: RegisteredNamesInterface
1064
+ };
1011
1065
 
1012
1066
  // src/classes/registration/ValidateDappAccessDiviner/Diviner.ts
1013
1067
  var ValidateDappAccessDiviner = class extends AbstractDiviner {
1014
- static configSchemas = [ValidateDappAccessDivinerConfigSchema];
1068
+ static {
1069
+ __name(this, "ValidateDappAccessDiviner");
1070
+ }
1071
+ static configSchemas = [
1072
+ ValidateDappAccessDivinerConfigSchema
1073
+ ];
1015
1074
  async divineHandler(payloads) {
1016
1075
  const dappManifest = payloads?.filter(isDappPackageManifestPayload);
1017
1076
  const accessors = payloads?.filter(isUnregisteredDappAccess);
@@ -1037,48 +1096,49 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
1037
1096
  const interfaceChildren = await getNodeChildren(dappAccessInterface.manifest, dappParams);
1038
1097
  const valid = compareChildren(interfaceChildren, dappChildren);
1039
1098
  if (valid) {
1040
- const payload = await PayloadBuilder4.build({
1099
+ const payload = {
1041
1100
  ...access,
1042
1101
  schema: RegisteredDappAccessSchema,
1043
1102
  timestamp: Date.now()
1044
- });
1103
+ };
1045
1104
  registeredAccessors.push(payload);
1046
1105
  } else {
1047
- const failedRegistration = await PayloadBuilder4.build({
1106
+ const failedRegistration = {
1048
1107
  accessor: access,
1049
1108
  errorMessage: "Invalid dapp access interface",
1050
1109
  schema: FailedAccessorSchema
1051
- });
1110
+ };
1052
1111
  failedAccessors.push(failedRegistration);
1053
1112
  }
1054
1113
  }
1055
1114
  } catch (e) {
1056
- failedAccessors.push(
1057
- await PayloadBuilder4.build({
1058
- accessor: access,
1059
- errorMessage: e.message,
1060
- schema: FailedAccessorSchema
1061
- })
1062
- );
1115
+ failedAccessors.push({
1116
+ accessor: access,
1117
+ errorMessage: e.message,
1118
+ schema: FailedAccessorSchema
1119
+ });
1063
1120
  }
1064
1121
  }
1065
- return [...registeredAccessors, ...failedAccessors];
1122
+ return [
1123
+ ...registeredAccessors,
1124
+ ...failedAccessors
1125
+ ];
1066
1126
  }
1067
1127
  };
1068
- var compareChildren = (interfaceChildren, dappChildren) => {
1128
+ var compareChildren = /* @__PURE__ */ __name((interfaceChildren, dappChildren) => {
1069
1129
  return interfaceChildren.every((interfaceChild) => Object.values(interfaceChild).every((interfaceChildName) => dappChildren.some((dappChild) => Object.values(dappChild).includes(interfaceChildName))));
1070
- };
1071
- var dappPackageManifestToPackageManifest = (dappPackageManifest) => {
1130
+ }, "compareChildren");
1131
+ var dappPackageManifestToPackageManifest = /* @__PURE__ */ __name((dappPackageManifest) => {
1072
1132
  return {
1073
1133
  ...dappPackageManifest,
1074
1134
  schema: PackageManifestPayloadSchema
1075
1135
  };
1076
- };
1077
- var getChildrenFromNode = async (node) => {
1136
+ }, "dappPackageManifestToPackageManifest");
1137
+ var getChildrenFromNode = /* @__PURE__ */ __name(async (node) => {
1078
1138
  const nodeManifest = (await node.state())?.[0];
1079
1139
  return nodeManifest.status?.children;
1080
- };
1081
- var getNodeChildren = async (manifestToTest, dappParams) => {
1140
+ }, "getChildrenFromNode");
1141
+ var getNodeChildren = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1082
1142
  const testNodes = await getNodeToTest(manifestToTest, dappParams);
1083
1143
  const children = [];
1084
1144
  for (const node of testNodes) {
@@ -1088,35 +1148,32 @@ var getNodeChildren = async (manifestToTest, dappParams) => {
1088
1148
  }
1089
1149
  }
1090
1150
  return children;
1091
- };
1092
- var getNodeToTest = async (manifestToTest, dappParams) => {
1151
+ }, "getNodeChildren");
1152
+ var getNodeToTest = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1093
1153
  const dappManifestWrapper = new ManifestWrapper2(manifestToTest, await HDWallet2.random(), dappParams.locator);
1094
1154
  return await dappManifestWrapper.loadNodes();
1095
- };
1155
+ }, "getNodeToTest");
1096
1156
 
1097
1157
  // src/classes/registration/DappRegistry.ts
1098
1158
  var DappRegistry = class {
1159
+ static {
1160
+ __name(this, "DappRegistry");
1161
+ }
1162
+ dappSeedPhraseRepository;
1163
+ dappRegistry;
1099
1164
  constructor(dappSeedPhraseRepository) {
1100
1165
  this.dappSeedPhraseRepository = dappSeedPhraseRepository;
1166
+ this.dappRegistry = /* @__PURE__ */ new Map();
1101
1167
  }
1102
- dappRegistry = /* @__PURE__ */ new Map();
1103
1168
  /**
1104
- * Register a Dapp with window manager and if successful, return its id
1105
- *
1106
- * @param {UnregisteredDapp} dapp Manifest and UI of the Dapp to register
1107
- * @returns {RegisteredDapp} dapp with registration fields
1108
- **/
1169
+ * Register a Dapp with window manager and if successful, return its id
1170
+ *
1171
+ * @param {UnregisteredDapp} dapp Manifest and UI of the Dapp to register
1172
+ * @returns {RegisteredDapp} dapp with registration fields
1173
+ **/
1109
1174
  async registerDapp(dapp) {
1110
1175
  if (dapp) {
1111
- const {
1112
- exposedModuleIds,
1113
- manifest,
1114
- modes,
1115
- name,
1116
- version,
1117
- params,
1118
- widgetConfigs
1119
- } = this.extractDappProperties(dapp);
1176
+ const { exposedModuleIds, manifest, modes, name, version, params, widgetConfigs } = this.extractDappProperties(dapp);
1120
1177
  try {
1121
1178
  const walletId = await this.dappSeedPhraseRepository.findOrCreate(name);
1122
1179
  const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params);
@@ -1151,27 +1208,16 @@ var DappRegistry = class {
1151
1208
  }
1152
1209
  }
1153
1210
  /**
1154
- * Unregister a dapp so it can no longer be launched
1155
- *
1156
- * @param dappId
1157
- */
1211
+ * Unregister a dapp so it can no longer be launched
1212
+ *
1213
+ * @param dappId
1214
+ */
1158
1215
  unregisterDapp(dappId) {
1159
1216
  this.dappRegistry.delete(dappId);
1160
1217
  }
1161
1218
  extractDappProperties(dapp) {
1162
- const {
1163
- params,
1164
- config,
1165
- widgetConfigs
1166
- } = dapp;
1167
- const {
1168
- exposedModuleIds,
1169
- manifest,
1170
- modes,
1171
- name,
1172
- sources,
1173
- version
1174
- } = config;
1219
+ const { params, config, widgetConfigs } = dapp;
1220
+ const { exposedModuleIds, manifest, modes, name, sources, version } = config;
1175
1221
  return {
1176
1222
  exposedModuleIds,
1177
1223
  manifest,
@@ -1186,10 +1232,15 @@ var DappRegistry = class {
1186
1232
  async validateDappAccessPayloads(manifest, accessors = [], params) {
1187
1233
  const validateDappAccess = await ValidateDappAccessDiviner.create({
1188
1234
  account: await HDWallet3.random(),
1189
- config: { schema: ValidateDappAccessDivinerConfigSchema },
1235
+ config: {
1236
+ schema: ValidateDappAccessDivinerConfigSchema
1237
+ },
1190
1238
  dappParams: params
1191
1239
  });
1192
- const payloads = await validateDappAccess.divine([manifest, ...accessors]);
1240
+ const payloads = await validateDappAccess.divine([
1241
+ manifest,
1242
+ ...accessors
1243
+ ]);
1193
1244
  const failedAccessors = payloads.filter(isFailedAccessor);
1194
1245
  const registeredAccessors = payloads.filter(isRegisteredDappAccess);
1195
1246
  if (failedAccessors.length > 0) {
@@ -1201,6 +1252,26 @@ var DappRegistry = class {
1201
1252
 
1202
1253
  // src/classes/registration/DappRegistrationService.ts
1203
1254
  var DappRegistrationService = class {
1255
+ static {
1256
+ __name(this, "DappRegistrationService");
1257
+ }
1258
+ context;
1259
+ params;
1260
+ locator;
1261
+ developmentMode;
1262
+ // Dapps that have been built with their own context
1263
+ builtDapps;
1264
+ dappRegistry;
1265
+ dappSeedPhraseRepository;
1266
+ manageSystemDapps;
1267
+ // Dapps that have been registered with dappAccessRequests
1268
+ registeredAccessDappSets;
1269
+ // Dapps that have been registered with the dapp registry
1270
+ registeredDappSets;
1271
+ // Dapps that have been registered with exposeDappRequests
1272
+ registeredExposedDappSets;
1273
+ dappAccessRequestConnection;
1274
+ exposeDappRequestConnection;
1204
1275
  constructor(context, params = {
1205
1276
  dappNames: [],
1206
1277
  dappParams: {},
@@ -1210,34 +1281,23 @@ var DappRegistrationService = class {
1210
1281
  this.params = params;
1211
1282
  this.locator = locator;
1212
1283
  this.developmentMode = developmentMode;
1213
- this.manageSystemDapps = new ManageSystemDapps(
1214
- context,
1215
- this.params?.dappNames ?? [],
1216
- this.params?.dappPayloads ?? [],
1217
- this.params?.dappParams ?? {},
1218
- this.locator,
1219
- this.developmentMode
1220
- );
1284
+ this.builtDapps = {};
1285
+ this.registeredAccessDappSets = /* @__PURE__ */ new Set();
1286
+ this.registeredDappSets = /* @__PURE__ */ new Set();
1287
+ this.registeredExposedDappSets = /* @__PURE__ */ new Set();
1288
+ this.dappAccessRequestConnection = dappAccessRequestConnection();
1289
+ this.exposeDappRequestConnection = exposeDappRequestConnection();
1290
+ this.manageSystemDapps = new ManageSystemDapps(context, this.params?.dappNames ?? [], this.params?.dappPayloads ?? [], this.params?.dappParams ?? {}, this.locator, this.developmentMode);
1221
1291
  this.dappSeedPhraseRepository = new DappSeedPhraseRepository(context, this.params?.dappNames ?? []);
1222
1292
  this.dappRegistry = new DappRegistry(this.dappSeedPhraseRepository);
1223
1293
  this.addConnectionRequests();
1224
1294
  }
1225
- // Dapps that have been built with their own context
1226
- builtDapps = {};
1227
- dappRegistry;
1228
- dappSeedPhraseRepository;
1229
- manageSystemDapps;
1230
- // Dapps that have been registered with dappAccessRequests
1231
- registeredAccessDappSets = /* @__PURE__ */ new Set();
1232
- // Dapps that have been registered with the dapp registry
1233
- registeredDappSets = /* @__PURE__ */ new Set();
1234
- // Dapps that have been registered with exposeDappRequests
1235
- registeredExposedDappSets = /* @__PURE__ */ new Set();
1236
- dappAccessRequestConnection = dappAccessRequestConnection();
1237
- exposeDappRequestConnection = exposeDappRequestConnection();
1238
1295
  async buildDapp(manifest, dappId = NameTransforms.slug(manifest.nodes[0]?.config.name), name = NameTransforms.moduleName(manifest.nodes[0]?.config.name)) {
1239
1296
  const dapp = new XyOsDapp({
1240
- dapp: { id: dappId, name },
1297
+ dapp: {
1298
+ id: dappId,
1299
+ name
1300
+ },
1241
1301
  locator: this.locator,
1242
1302
  manifest,
1243
1303
  parent: this.context,
@@ -1250,37 +1310,43 @@ var DappRegistrationService = class {
1250
1310
  return this.params?.dappParams[dappId];
1251
1311
  }
1252
1312
  async start() {
1253
- const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), { name: "Install System dApps" });
1313
+ const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), {
1314
+ name: "Install System dApps"
1315
+ });
1254
1316
  const activeDapps = systemDapps.filter(({ dapp }) => dapp.icon.active === true);
1255
- const results = await Promise.allSettled(
1256
- activeDapps.map(async (dappSet) => {
1257
- const { dapp } = dappSet;
1258
- const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1259
- const result = { dapp: registeredDapp, dappIcon: dapp.icon };
1260
- const forgetHandlers = async () => {
1261
- try {
1262
- await this.postRegistrationHandlers(result);
1263
- } catch (e) {
1264
- console.error("Error in post registration handlers", e);
1265
- }
1266
- };
1267
- forget2(forgetHandlers());
1268
- return result;
1269
- })
1270
- );
1317
+ const results = await Promise.allSettled(activeDapps.map(async (dappSet) => {
1318
+ const { dapp } = dappSet;
1319
+ const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1320
+ const result = {
1321
+ dapp: registeredDapp,
1322
+ dappIcon: dapp.icon
1323
+ };
1324
+ const forgetHandlers = /* @__PURE__ */ __name(async () => {
1325
+ try {
1326
+ await this.postRegistrationHandlers(result);
1327
+ } catch (e) {
1328
+ console.error("Error in post registration handlers", e);
1329
+ }
1330
+ }, "forgetHandlers");
1331
+ forget2(forgetHandlers());
1332
+ return result;
1333
+ }));
1271
1334
  const failed = results.filter(rejected).map((result) => result.reason);
1272
1335
  const succeeded = results.filter(fulfilled).map((result) => result.value);
1273
1336
  for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp);
1274
- return { failed, succeeded };
1337
+ return {
1338
+ failed,
1339
+ succeeded
1340
+ };
1275
1341
  }
1276
1342
  addConnectionRequests() {
1277
1343
  this.context.eventBus.addConnection(this.dappAccessRequestConnection);
1278
1344
  this.context.eventBus.addConnection(this.exposeDappRequestConnection);
1279
1345
  }
1280
1346
  /**
1281
- * A method to get the user property from context and eventually modify it before handing it to a dapp
1282
- * i.e. curating user-approved signers
1283
- */
1347
+ * A method to get the user property from context and eventually modify it before handing it to a dapp
1348
+ * i.e. curating user-approved signers
1349
+ */
1284
1350
  getUser() {
1285
1351
  return this.context.user;
1286
1352
  }
@@ -1288,17 +1354,19 @@ var DappRegistrationService = class {
1288
1354
  if (registeredDapp.dapp) {
1289
1355
  if (isRegisteredDappExposedDappSet(registeredDapp)) {
1290
1356
  this.registeredExposedDappSets.add(registeredDapp);
1291
- const exposeIntent = DappIntentCaller.buildIntent(
1292
- DappIntentCaller.OsDappName,
1293
- DappIntentTypes.Launch,
1294
- registeredDapp.dapp.config.name,
1295
- DappMode2.Exposed
1296
- );
1297
- await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, { payloads: [registeredDapp.dapp.config, exposeIntent] });
1357
+ const exposeIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Launch, registeredDapp.dapp.config.name, DappMode2.Exposed);
1358
+ await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, {
1359
+ payloads: [
1360
+ registeredDapp.dapp.config,
1361
+ exposeIntent
1362
+ ]
1363
+ });
1298
1364
  }
1299
1365
  if (isRegisteredDappAccessDappSet(registeredDapp)) {
1300
1366
  this.registeredAccessDappSets.add(registeredDapp);
1301
- await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, { payloads: registeredDapp.dapp.accessors });
1367
+ await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, {
1368
+ payloads: registeredDapp.dapp.accessors
1369
+ });
1302
1370
  }
1303
1371
  }
1304
1372
  }
@@ -1308,6 +1376,9 @@ var DappRegistrationService = class {
1308
1376
  import { assertEx as assertEx7 } from "@xylabs/assert";
1309
1377
  import { HDWallet as HDWallet4 } from "@xyo-network/account";
1310
1378
  var Signers = class {
1379
+ static {
1380
+ __name(this, "Signers");
1381
+ }
1311
1382
  _paths;
1312
1383
  _signerAccounts;
1313
1384
  _walletStore;
@@ -1358,26 +1429,32 @@ import { IndexedDbPayloadDiviner } from "@xyo-network/diviner-payload-indexeddb"
1358
1429
  import { ManifestWrapper as ManifestWrapper3 } from "@xyo-network/manifest-wrapper";
1359
1430
  import { ModuleFactoryLocator as ModuleFactoryLocator4 } from "@xyo-network/module-factory-locator";
1360
1431
  var OS_NODE_PATH = "1'";
1361
- var getDefaultOsNodeLocator = () => {
1432
+ var getDefaultOsNodeLocator = /* @__PURE__ */ __name(() => {
1362
1433
  const locator = new ModuleFactoryLocator4();
1363
- locator.register(IndexedDbArchivist, { "network.xyo.archivist.persistence.scope": "device" });
1364
- locator.register(IndexedDbPayloadDiviner, { "network.xyo.archivist.persistence.scope": "device" });
1434
+ locator.register(IndexedDbArchivist, {
1435
+ "network.xyo.archivist.persistence.scope": "device"
1436
+ });
1437
+ locator.register(IndexedDbPayloadDiviner, {
1438
+ "network.xyo.archivist.persistence.scope": "device"
1439
+ });
1365
1440
  return locator;
1366
- };
1367
- var loadOsNode = async (osWallet, locator) => {
1441
+ }, "getDefaultOsNodeLocator");
1442
+ var loadOsNode = /* @__PURE__ */ __name(async (osWallet, locator) => {
1368
1443
  try {
1369
1444
  const osNodeWallet = await osWallet.derivePath(OS_NODE_PATH);
1370
1445
  const osNodeLocator = locator ?? getDefaultOsNodeLocator();
1371
1446
  const manifestWrapper = new ManifestWrapper3(os_node_manifest_default, osNodeWallet, osNodeLocator);
1372
1447
  const osNode = (await manifestWrapper.loadNodes())[0];
1373
- return [osNode];
1448
+ return [
1449
+ osNode
1450
+ ];
1374
1451
  } catch (e) {
1375
1452
  const error = e;
1376
1453
  console.error(`Error creating os node: ${error.message}`);
1377
1454
  console.error(`Error creating os node: ${error.stack}`);
1378
1455
  throw new Error(`Error creating os node: ${error.message}`);
1379
1456
  }
1380
- };
1457
+ }, "loadOsNode");
1381
1458
 
1382
1459
  // src/stack/Base.ts
1383
1460
  import { assertEx as assertEx8 } from "@xylabs/assert";
@@ -1386,6 +1463,9 @@ import { BaseEmitter as BaseEmitter3 } from "@xyo-network/module-event-emitter";
1386
1463
  import { isModuleInstance } from "@xyo-network/module-model";
1387
1464
  import { asAttachableNodeInstance } from "@xyo-network/node-model";
1388
1465
  var StackBase = class extends BaseEmitter3 {
1466
+ static {
1467
+ __name(this, "StackBase");
1468
+ }
1389
1469
  // flag to check that all adapters are initialized
1390
1470
  initialized = false;
1391
1471
  // adapters to initialize into the stack
@@ -1420,57 +1500,57 @@ var StackBase = class extends BaseEmitter3 {
1420
1500
  initialize() {
1421
1501
  this.assignStack();
1422
1502
  for (const adapter of this.adapterSet) {
1423
- const driverReadyListener = async ({ node }) => await this.handleDriverReady(node);
1503
+ const driverReadyListener = /* @__PURE__ */ __name(async ({ node }) => await this.handleDriverReady(node), "driverReadyListener");
1424
1504
  adapter.on("driverReady", driverReadyListener);
1425
1505
  this.listeners.push({
1426
1506
  adapter,
1427
1507
  eventName: "driverReady",
1428
1508
  listener: driverReadyListener
1429
1509
  });
1430
- const driverErrorListener = async ({ error }) => {
1510
+ const driverErrorListener = /* @__PURE__ */ __name(async ({ error }) => {
1431
1511
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, error);
1432
- await this.emit("driverError", { error });
1433
- };
1512
+ await this.emit("driverError", {
1513
+ error
1514
+ });
1515
+ }, "driverErrorListener");
1434
1516
  adapter.on("driverError", driverErrorListener);
1435
1517
  this.listeners.push({
1436
1518
  adapter,
1437
1519
  eventName: "driverError",
1438
1520
  listener: driverErrorListener
1439
1521
  });
1440
- const startAdapter = async () => await adapter.start();
1522
+ const startAdapter = /* @__PURE__ */ __name(async () => await adapter.start(), "startAdapter");
1441
1523
  forget3(startAdapter());
1442
1524
  }
1443
1525
  }
1444
1526
  /**
1445
- * Stops the stack
1446
- */
1527
+ * Stops the stack
1528
+ */
1447
1529
  stop() {
1448
- for (const {
1449
- eventName,
1450
- listener,
1451
- adapter
1452
- } of this.listeners) {
1530
+ for (const { eventName, listener, adapter } of this.listeners) {
1453
1531
  adapter.off(eventName, listener);
1454
1532
  }
1455
1533
  }
1456
1534
  /**
1457
- * Adds a node to the stack. Idempotent to avoid adding the
1458
- * same node multiple times
1459
- * @param node The node to add to the stack
1460
- * @returns
1461
- */
1535
+ * Adds a node to the stack. Idempotent to avoid adding the
1536
+ * same node multiple times
1537
+ * @param node The node to add to the stack
1538
+ * @returns
1539
+ */
1462
1540
  async addNodeToStackNode(node) {
1463
1541
  const stackNode = await this.getStackNode();
1464
- const existingModule = await stackNode.resolve(node.address, { direction: "down" });
1542
+ const existingModule = await stackNode.resolve(node.address, {
1543
+ direction: "down"
1544
+ });
1465
1545
  if (isModuleInstance(existingModule)) return;
1466
1546
  await stackNode.register?.(node);
1467
1547
  await stackNode.attach?.(node.address, true);
1468
1548
  }
1469
1549
  assignStack() {
1470
- const assign = async () => {
1550
+ const assign = /* @__PURE__ */ __name(async () => {
1471
1551
  const stackNode = await this.getStackNode();
1472
1552
  this._stack = stackNode;
1473
- };
1553
+ }, "assign");
1474
1554
  forget3(assign());
1475
1555
  }
1476
1556
  async getStackNode() {
@@ -1479,25 +1559,34 @@ var StackBase = class extends BaseEmitter3 {
1479
1559
  }
1480
1560
  async handleDriverReady(node) {
1481
1561
  try {
1482
- await this.emit("driverReady", { node });
1562
+ await this.emit("driverReady", {
1563
+ node
1564
+ });
1483
1565
  await this.addNodeToStackNode(node);
1484
1566
  await this.updateInitializationState(node);
1485
1567
  } catch (error) {
1486
1568
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, node.id, error);
1487
- await this.emit("stackError", { error });
1569
+ await this.emit("stackError", {
1570
+ error
1571
+ });
1488
1572
  }
1489
1573
  }
1490
1574
  async updateInitializationState(node) {
1491
1575
  this.initializedNodes.push(node);
1492
1576
  this.initialized = this.adapterSet.every((n) => n.initialized);
1493
1577
  if (this.initialized) {
1494
- await this.emit("initialized", { stack: await this.getStackNode() });
1578
+ await this.emit("initialized", {
1579
+ stack: await this.getStackNode()
1580
+ });
1495
1581
  }
1496
1582
  }
1497
1583
  };
1498
1584
 
1499
1585
  // src/stack/Manager.ts
1500
1586
  var StackManager = class {
1587
+ static {
1588
+ __name(this, "StackManager");
1589
+ }
1501
1590
  initializedStacksMap = /* @__PURE__ */ new Map();
1502
1591
  stackMap;
1503
1592
  constructor(stackMap) {
@@ -1539,27 +1628,30 @@ import { BaseEmitter as BaseEmitter4 } from "@xyo-network/module-event-emitter";
1539
1628
  import { asAttachableNodeInstance as asAttachableNodeInstance2 } from "@xyo-network/node-model";
1540
1629
  import { v4 as uuid3 } from "uuid";
1541
1630
  var NodeAdapterBase = class extends BaseEmitter4 {
1631
+ static {
1632
+ __name(this, "NodeAdapterBase");
1633
+ }
1634
+ kernel;
1635
+ driverName;
1636
+ initialized;
1637
+ _id;
1542
1638
  constructor(kernel, driverName) {
1543
- super({});
1544
- this.kernel = kernel;
1545
- this.driverName = driverName;
1639
+ super({}), this.kernel = kernel, this.driverName = driverName, this.initialized = false, this._id = "";
1546
1640
  this._id = uuid3();
1547
1641
  }
1548
- initialized = false;
1549
- _id = "";
1550
1642
  get id() {
1551
1643
  return assertEx9(this._id, () => "NodeAdapterBase id not initialized");
1552
1644
  }
1553
1645
  async start() {
1554
1646
  try {
1555
- const moduleAttachedInsertListener = ({ payloads }) => {
1647
+ const moduleAttachedInsertListener = /* @__PURE__ */ __name(({ payloads }) => {
1556
1648
  const moduleAttachedEvent = this.findModuleEventPayloads(payloads);
1557
1649
  for (const payload of moduleAttachedEvent) {
1558
1650
  if (payload.name === this.driverName) {
1559
1651
  this.validateAndReturnDriver();
1560
1652
  }
1561
1653
  }
1562
- };
1654
+ }, "moduleAttachedInsertListener");
1563
1655
  const eventsArchivist = await this.getEventsArchivist();
1564
1656
  const weakRefInsertListener = new WeakRef(moduleAttachedInsertListener);
1565
1657
  const insertListenerRef = weakRefInsertListener.deref();
@@ -1568,7 +1660,9 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1568
1660
  if (node) return node;
1569
1661
  this.initialized = false;
1570
1662
  } catch (error) {
1571
- await this.emit("driverError", { error });
1663
+ await this.emit("driverError", {
1664
+ error
1665
+ });
1572
1666
  }
1573
1667
  }
1574
1668
  findModuleEventPayloads(payloads) {
@@ -1586,7 +1680,9 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1586
1680
  if (mod) {
1587
1681
  const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`);
1588
1682
  this.initialized = true;
1589
- const emit = async () => await this.emit("driverReady", { node });
1683
+ const emit = /* @__PURE__ */ __name(async () => await this.emit("driverReady", {
1684
+ node
1685
+ }), "emit");
1590
1686
  forget4(emit());
1591
1687
  return node;
1592
1688
  }
@@ -1595,6 +1691,9 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1595
1691
 
1596
1692
  // src/adapter/Network.ts
1597
1693
  var NetworkAdapter = class extends NodeAdapterBase {
1694
+ static {
1695
+ __name(this, "NetworkAdapter");
1696
+ }
1598
1697
  _connection;
1599
1698
  constructor(kernel, driverName) {
1600
1699
  super(kernel, driverName);
@@ -1615,6 +1714,9 @@ var NetworkAdapter = class extends NodeAdapterBase {
1615
1714
 
1616
1715
  // src/adapter/Settings.ts
1617
1716
  var SettingsAdapter = class extends NodeAdapterBase {
1717
+ static {
1718
+ __name(this, "SettingsAdapter");
1719
+ }
1618
1720
  _settings = void 0;
1619
1721
  constructor(kernel, driverName) {
1620
1722
  super(kernel, driverName);
@@ -1634,26 +1736,31 @@ var SettingsAdapter = class extends NodeAdapterBase {
1634
1736
  };
1635
1737
 
1636
1738
  // src/adapters/OsPubSubBridgeNetwork.ts
1637
- var OsPubSubBridgeNetworkAdapters = (kernel) => [
1739
+ var OsPubSubBridgeNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
1638
1740
  new NetworkAdapter(kernel, PubSubBridgeNodeNodeName),
1639
1741
  new NetworkAdapter(kernel, ExposedNodeOuterNodeName)
1640
- ];
1742
+ ], "OsPubSubBridgeNetworkAdapters");
1641
1743
 
1642
1744
  // src/adapters/OsSettings.ts
1643
1745
  import { OsSettingsNodeName } from "@xyo-network/os-model";
1644
- var OsSettingsAdapters = (kernel) => [new SettingsAdapter(kernel, OsSettingsNodeName)];
1746
+ var OsSettingsAdapters = /* @__PURE__ */ __name((kernel) => [
1747
+ new SettingsAdapter(kernel, OsSettingsNodeName)
1748
+ ], "OsSettingsAdapters");
1645
1749
 
1646
1750
  // src/adapters/OsXyoPublicNetwork.ts
1647
1751
  import { XyoPublicNodeName } from "@xyo-network/os-model";
1648
- var OsXyoPublicNetworkAdapters = (kernel) => [
1752
+ var OsXyoPublicNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
1649
1753
  new NetworkAdapter(kernel, XyoPublicNodeName)
1650
- ];
1754
+ ], "OsXyoPublicNetworkAdapters");
1651
1755
 
1652
1756
  // src/stack/OsPubSubNetworkStack.ts
1653
1757
  import { assertEx as assertEx10 } from "@xylabs/assert";
1654
1758
  import { asAttachableNodeInstance as asAttachableNodeInstance3, asNodeInstance } from "@xyo-network/node-model";
1655
1759
  import { ExposedNodeOuterNodeName as ExposedNodeOuterNodeName2, PubSubBridgeNodeNodeName as PubSubBridgeNodeNodeName2 } from "@xyo-network/os-model";
1656
1760
  var OsPubSubNetworkStack = class extends StackBase {
1761
+ static {
1762
+ __name(this, "OsPubSubNetworkStack");
1763
+ }
1657
1764
  _exposedNode;
1658
1765
  _exposedNodeOuter;
1659
1766
  busConnection = osPubSubNetworkReadyConnection();
@@ -1696,13 +1803,15 @@ var OsPubSubNetworkStack = class extends StackBase {
1696
1803
  super.stop();
1697
1804
  this._exposedNode = void 0;
1698
1805
  this._exposedNodeOuter = void 0;
1699
- if (this.busConnection._id)
1700
- this.context.eventBus.removeConnection(this.busConnection.id);
1806
+ if (this.busConnection._id) this.context.eventBus.removeConnection(this.busConnection.id);
1701
1807
  }
1702
1808
  };
1703
1809
 
1704
1810
  // src/stack/OsSettingsStack.ts
1705
1811
  var OsSettingsStack = class extends StackBase {
1812
+ static {
1813
+ __name(this, "OsSettingsStack");
1814
+ }
1706
1815
  busConnection = osSettingsReadyConnection();
1707
1816
  constructor(context, adapters) {
1708
1817
  super(context, adapters, "OsSettingsStackNode");
@@ -1720,6 +1829,9 @@ var OsSettingsStack = class extends StackBase {
1720
1829
  // src/stack/XyoPublicNetworkStack.ts
1721
1830
  import { XyoPublicNodeName as XyoPublicNodeName2 } from "@xyo-network/os-model";
1722
1831
  var XyoPublicNetworkStack = class extends StackBase {
1832
+ static {
1833
+ __name(this, "XyoPublicNetworkStack");
1834
+ }
1723
1835
  busConnection = osXyoPublicNetworkReadyConnection();
1724
1836
  constructor(context, adapters) {
1725
1837
  super(context, adapters, "OsXyoPublicNetworkStackNode");
@@ -1758,6 +1870,9 @@ var OsStackMap = {
1758
1870
 
1759
1871
  // src/XyOs.ts
1760
1872
  var XyOs = class _XyOs extends XyOsContextBase {
1873
+ static {
1874
+ __name(this, "XyOs");
1875
+ }
1761
1876
  _exposedNode;
1762
1877
  _exposedNodeOuter;
1763
1878
  _kernel;
@@ -1765,16 +1880,9 @@ var XyOs = class _XyOs extends XyOsContextBase {
1765
1880
  dappRegistrationService;
1766
1881
  signers;
1767
1882
  stackManager;
1768
- constructor({
1769
- logger = console,
1770
- eventBus = new EventBus(),
1771
- kernel = new Kernel({ logger }),
1772
- locator = new ModuleFactoryLocator5(),
1773
- dappsConfiguration,
1774
- developmentMode,
1775
- stackMap = OsStackMap,
1776
- ...params
1777
- } = {}) {
1883
+ constructor({ logger = console, eventBus = new EventBus(), kernel = new Kernel({
1884
+ logger
1885
+ }), locator = new ModuleFactoryLocator5(), dappsConfiguration, developmentMode, stackMap = OsStackMap, ...params } = {}) {
1778
1886
  super({
1779
1887
  eventBus,
1780
1888
  kernel,
@@ -1812,14 +1920,19 @@ var XyOs = class _XyOs extends XyOsContextBase {
1812
1920
  return this.stackManager.stacks;
1813
1921
  }
1814
1922
  get user() {
1815
- return { signers: this.signers?.getWalletKindSigner("user") };
1923
+ return {
1924
+ signers: this.signers?.getWalletKindSigner("user")
1925
+ };
1816
1926
  }
1817
1927
  static async monitor(fn, eventConfig) {
1818
1928
  const { name, additionalProperties } = eventConfig;
1819
1929
  const monitor = this.monitoring;
1820
1930
  monitor?.startTimer(name);
1821
1931
  const result = await fn();
1822
- monitor?.stopTimer({ additionalProperties, name });
1932
+ monitor?.stopTimer({
1933
+ additionalProperties,
1934
+ name
1935
+ });
1823
1936
  return result;
1824
1937
  }
1825
1938
  async boot(wallet, locator = new ModuleFactoryLocator5()) {
@@ -1828,13 +1941,18 @@ var XyOs = class _XyOs extends XyOsContextBase {
1828
1941
  return await this._bootMutex.runExclusive(async () => {
1829
1942
  await this.eventBus.start();
1830
1943
  if (this.kernel?.status === "created") {
1831
- await this.kernel.boot(await boot(), { locator: fullLocator, kernelDrivers: [] });
1944
+ await this.kernel.boot(await boot(), {
1945
+ locator: fullLocator,
1946
+ kernelDrivers: []
1947
+ });
1832
1948
  }
1833
1949
  if (this.kernel?.status !== "booted") {
1834
1950
  throw new Error("Kernel not booted");
1835
1951
  }
1836
1952
  assertEx11(this._root === void 0, () => "XyOs already booted");
1837
- const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), { name: "Load XyOs" });
1953
+ const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), {
1954
+ name: "Load XyOs"
1955
+ });
1838
1956
  this._root = root;
1839
1957
  this.stackManager.initialize(this);
1840
1958
  if (this.signers) await this.signers.initialize();
@@ -1865,26 +1983,32 @@ var XyOs = class _XyOs extends XyOsContextBase {
1865
1983
 
1866
1984
  // src/scripts/xyos/lib/headless.ts
1867
1985
  var { terminal } = tk;
1868
- var terminate = () => {
1986
+ var terminate = /* @__PURE__ */ __name(() => {
1869
1987
  terminal.grabInput(false);
1870
1988
  setTimeout(function() {
1871
1989
  process.exit(0);
1872
1990
  }, 100);
1873
- };
1874
- var headless = async ({
1875
- manifest,
1876
- config,
1877
- kernelDrivers
1878
- } = {}) => {
1991
+ }, "terminate");
1992
+ var headless = /* @__PURE__ */ __name(async ({ manifest, config, kernelDrivers } = {}) => {
1879
1993
  console.log(chalk.green("Starting Headless xyOS..."));
1880
- const configExplorer = cosmiconfig("xyos", { cache: true, loaders: { ".ts": TypeScriptLoader() } });
1994
+ const configExplorer = cosmiconfig("xyos", {
1995
+ cache: true,
1996
+ loaders: {
1997
+ ".ts": TypeScriptLoader()
1998
+ }
1999
+ });
1881
2000
  const configResult = await (config ? configExplorer.load(config) : configExplorer.search());
1882
2001
  const xyosConfig = configResult?.config ?? {};
1883
2002
  const manifestToLoad = manifest ?? (typeof xyosConfig.manifest === "string" ? xyosConfig.manifest : void 0);
1884
2003
  const manifestObject = manifestToLoad ? JSON.parse(fs.readFileSync(manifestToLoad, "utf8")) : typeof xyosConfig.manifest === "object" ? xyosConfig.manifest : void 0;
1885
2004
  const osWallet = await HDWallet5.random();
1886
- const kernel = new Kernel2({ logColor: "cyan", logger: console });
1887
- await kernel.boot(await boot2(), { kernelDrivers });
2005
+ const kernel = new Kernel2({
2006
+ logColor: "cyan",
2007
+ logger: console
2008
+ });
2009
+ await kernel.boot(await boot2(), {
2010
+ kernelDrivers
2011
+ });
1888
2012
  const xyOs = new XyOs({
1889
2013
  kernel,
1890
2014
  stackMap: {},
@@ -1893,14 +2017,16 @@ var headless = async ({
1893
2017
  });
1894
2018
  await xyOs.boot(osWallet);
1895
2019
  console.log(chalk.green("Started Headless xyOS..."));
1896
- terminal.grabInput({ mouse: "button" });
2020
+ terminal.grabInput({
2021
+ mouse: "button"
2022
+ });
1897
2023
  terminal.on("key", function(name) {
1898
2024
  console.log("'key' event:", name);
1899
2025
  if (name === "CTRL_C") {
1900
2026
  terminate();
1901
2027
  }
1902
2028
  });
1903
- };
2029
+ }, "headless");
1904
2030
  export {
1905
2031
  createFromTemplate,
1906
2032
  headless