@xyo-network/os-runtime 7.3.1 → 7.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/scripts/xyos/index.ts
5
2
  import yargs from "yargs";
6
3
  import { hideBin } from "yargs/helpers";
7
4
 
8
5
  // src/scripts/xyos/command/config.ts
9
- var commandConfig = /* @__PURE__ */ __name((argv) => {
6
+ var commandConfig = (argv) => {
10
7
  return argv.command("config [action] <target>", "Create an xyos project", (yargs2) => {
11
8
  return yargs2.positional("action", {
12
- choices: [
13
- "create",
14
- "validate",
15
- "display"
16
- ],
9
+ choices: ["create", "validate", "display"],
17
10
  description: "Action to take on config",
18
11
  type: "string"
19
12
  }).positional("target", {
@@ -24,16 +17,16 @@ var commandConfig = /* @__PURE__ */ __name((argv) => {
24
17
  console.log(`Taking action [${action}] on manifest at ${target}`);
25
18
  return await Promise.resolve();
26
19
  });
27
- }, "commandConfig");
20
+ };
28
21
 
29
22
  // src/scripts/xyos/lib/createFromTemplate.ts
30
- var createFromTemplate = /* @__PURE__ */ __name(async ({ target, template }) => {
23
+ var createFromTemplate = async ({ target, template }) => {
31
24
  console.log("Creating from template", template, "at", target);
32
25
  return await Promise.resolve();
33
- }, "createFromTemplate");
26
+ };
34
27
 
35
28
  // src/scripts/xyos/lib/headless.ts
36
- import fs from "fs";
29
+ import fs from "node:fs";
37
30
  import { boot as boot2 } from "@xyo-network/bios";
38
31
  import { Kernel as Kernel2 } from "@xyo-network/kernel";
39
32
  import { HDWallet as HDWallet5 } from "@xyo-network/sdk-js";
@@ -51,9 +44,6 @@ import { ModuleFactoryLocator as ModuleFactoryLocator6 } from "@xyo-network/sdk-
51
44
  // src/event/bus/Connection.ts
52
45
  import { assertEx, BaseEmitter } from "@xylabs/sdk-js";
53
46
  var EventBusConnection = class extends BaseEmitter {
54
- static {
55
- __name(this, "EventBusConnection");
56
- }
57
47
  _id;
58
48
  description;
59
49
  type;
@@ -71,18 +61,22 @@ var EventBusConnection = class extends BaseEmitter {
71
61
  };
72
62
 
73
63
  // src/event/bus/EventBus.ts
74
- import { assertEx as assertEx2, findAs, forget } from "@xylabs/sdk-js";
64
+ import {
65
+ assertEx as assertEx2,
66
+ findAs,
67
+ forget
68
+ } from "@xylabs/sdk-js";
75
69
  import { asArchivistInstance } from "@xyo-network/archivist";
76
- import { asOptionalEventBusEvent, isPubSubConnections } from "@xyo-network/os-model";
70
+ import {
71
+ asOptionalEventBusEvent,
72
+ isPubSubConnections
73
+ } from "@xyo-network/os-model";
77
74
  import { PayloadBuilder } from "@xyo-network/payload-builder";
78
75
  import { asSchema } from "@xyo-network/payload-model";
79
76
  import { MemoryArchivist, MemoryArchivistConfigSchema } from "@xyo-network/sdk-js";
80
77
  import { Mutex } from "async-mutex";
81
78
  import { v4 as uuid } from "uuid";
82
79
  var EventBus = class {
83
- static {
84
- __name(this, "EventBus");
85
- }
86
80
  // Internal Archivist to store event data
87
81
  _archivist;
88
82
  // Store all connections
@@ -91,9 +85,11 @@ var EventBus = class {
91
85
  publisherCallbacks = {};
92
86
  startMutex = new Mutex();
93
87
  get archivist() {
94
- return asArchivistInstance(assertEx2(this._archivist, () => "Archivist not found. Did you forget to call start()?"), "not a valid archivist instance", {
95
- required: true
96
- });
88
+ return asArchivistInstance(
89
+ assertEx2(this._archivist, () => "Archivist not found. Did you forget to call start()?"),
90
+ "not a valid archivist instance",
91
+ { required: true }
92
+ );
97
93
  }
98
94
  addConnection(connection) {
99
95
  const id = uuid();
@@ -122,12 +118,7 @@ var EventBus = class {
122
118
  console.warn("EventBus already started");
123
119
  return this;
124
120
  }
125
- this._archivist = await MemoryArchivist.create({
126
- config: {
127
- name: storeName,
128
- schema: MemoryArchivistConfigSchema
129
- }
130
- });
121
+ this._archivist = await MemoryArchivist.create({ config: { name: storeName, schema: MemoryArchivistConfigSchema } });
131
122
  this.archivist.on("inserted", ({ payloads }) => {
132
123
  const eventBusEvent = findAs(payloads, asOptionalEventBusEvent);
133
124
  if (!eventBusEvent) return;
@@ -137,9 +128,7 @@ var EventBus = class {
137
128
  for (const [eventName, callback] of connection.subscribableEvents.entries()) {
138
129
  if (eventName !== eventBusEvent.name) continue;
139
130
  if (callback) {
140
- const forgettable = /* @__PURE__ */ __name(async () => await callback({
141
- payloads
142
- }), "forgettable");
131
+ const forgettable = async () => await callback({ payloads });
143
132
  forget(forgettable());
144
133
  }
145
134
  }
@@ -151,22 +140,16 @@ var EventBus = class {
151
140
  }
152
141
  handlePublisherAdd(connection) {
153
142
  for (const eventName of connection.publishableEvents ?? []) {
154
- const connectionPublisherCallback = /* @__PURE__ */ __name(async ({ payloads }) => {
155
- const event = {
156
- name: eventName,
157
- schema: asSchema("network.xyo.event.bus.event", true)
158
- };
143
+ const connectionPublisherCallback = async ({ payloads }) => {
144
+ const event = { name: eventName, schema: asSchema("network.xyo.event.bus.event", true) };
159
145
  const eventPayloads = payloads ?? [];
160
146
  event.sources = await PayloadBuilder.dataHashes(eventPayloads);
161
147
  try {
162
- await this.archivist.insert([
163
- event,
164
- ...payloads ?? []
165
- ]);
148
+ await this.archivist.insert([event, ...payloads ?? []]);
166
149
  } catch (e) {
167
150
  console.error("Error inserting event into archivist", e);
168
151
  }
169
- }, "connectionPublisherCallback");
152
+ };
170
153
  connection.on(eventName, connectionPublisherCallback);
171
154
  const callbackId = connection.id + eventName;
172
155
  this.publisherCallbacks[callbackId] = connectionPublisherCallback;
@@ -183,9 +166,6 @@ var EventBus = class {
183
166
 
184
167
  // src/event/bus/PubSubConnection.ts
185
168
  var EventBusPubSubConnection = class extends EventBusConnection {
186
- static {
187
- __name(this, "EventBusPubSubConnection");
188
- }
189
169
  publishableEvents;
190
170
  subscribableEvents;
191
171
  constructor(request) {
@@ -201,76 +181,61 @@ var EventBusPubSubConnection = class extends EventBusConnection {
201
181
  // src/event/connections/DappAccessRequest.ts
202
182
  var DappAccessRequestEvent = "dappAccessRequest";
203
183
  var dappAccessRequestConnectionRequest = {
204
- publishableEvents: [
205
- DappAccessRequestEvent
206
- ],
184
+ publishableEvents: [DappAccessRequestEvent],
207
185
  type: "PubSub"
208
186
  };
209
- var dappAccessRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(dappAccessRequestConnectionRequest), "dappAccessRequestConnection");
187
+ var dappAccessRequestConnection = () => new EventBusPubSubConnection(dappAccessRequestConnectionRequest);
210
188
 
211
189
  // src/event/connections/ExposeDappRequest.ts
212
190
  var ExposeDappRequestEvent = "exposeDappRequest";
213
191
  var exposeDappConnectionRequest = {
214
- publishableEvents: [
215
- ExposeDappRequestEvent
216
- ],
192
+ publishableEvents: [ExposeDappRequestEvent],
217
193
  type: "PubSub"
218
194
  };
219
- var exposeDappRequestConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(exposeDappConnectionRequest), "exposeDappRequestConnection");
195
+ var exposeDappRequestConnection = () => new EventBusPubSubConnection(exposeDappConnectionRequest);
220
196
 
221
197
  // src/event/connections/OsPubSubNetworkReady.ts
222
198
  var OsPubSubNetworkReadyEvent = "osPubSubNetworkReady";
223
199
  var osPubSubNetworkConnectionRequest = {
224
- publishableEvents: [
225
- OsPubSubNetworkReadyEvent
226
- ],
200
+ publishableEvents: [OsPubSubNetworkReadyEvent],
227
201
  type: "PubSub"
228
202
  };
229
- var osPubSubNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest), "osPubSubNetworkReadyConnection");
203
+ var osPubSubNetworkReadyConnection = () => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest);
230
204
 
231
205
  // src/event/connections/OsSettingsReady.ts
232
206
  var OsSettingsReadyEvent = "osSettingsReady";
233
207
  var osSettingsConnectionRequest = {
234
- publishableEvents: [
235
- OsSettingsReadyEvent
236
- ],
208
+ publishableEvents: [OsSettingsReadyEvent],
237
209
  type: "PubSub"
238
210
  };
239
- var osSettingsReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osSettingsConnectionRequest), "osSettingsReadyConnection");
211
+ var osSettingsReadyConnection = () => new EventBusPubSubConnection(osSettingsConnectionRequest);
240
212
 
241
213
  // src/event/connections/OsXyoPublicReady.ts
242
214
  var OsXyoPublicNetworkReadyEvent = "osXyoPublicNetworkReady";
243
215
  var osXyoPublicNetworkConnectionRequest = {
244
- publishableEvents: [
245
- OsXyoPublicNetworkReadyEvent
246
- ],
216
+ publishableEvents: [OsXyoPublicNetworkReadyEvent],
247
217
  type: "PubSub"
248
218
  };
249
- var osXyoPublicNetworkReadyConnection = /* @__PURE__ */ __name(() => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest), "osXyoPublicNetworkReadyConnection");
219
+ var osXyoPublicNetworkReadyConnection = () => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest);
250
220
 
251
221
  // src/lib/initializeXns.ts
252
222
  import { asDivinerInstance } from "@xyo-network/diviner-model";
253
223
  import { ResolveHelper } from "@xyo-network/module";
254
224
  import { NameRegistrarTransformer } from "@xyo-network/module-resolver";
255
- var initializeXns = /* @__PURE__ */ __name(async (xnsNode) => {
225
+ var initializeXns = async (xnsNode) => {
256
226
  if (ResolveHelper.transformers.length === 0) {
257
227
  const registrarDiviner = asDivinerInstance(await xnsNode?.resolve("AddressRecords:AddressRecordIndexDiviner"));
258
228
  if (registrarDiviner) {
259
229
  const transformer = new NameRegistrarTransformer(registrarDiviner, "xyo");
260
- ResolveHelper.transformers = [
261
- transformer
262
- ];
230
+ ResolveHelper.transformers = [transformer];
263
231
  return true;
264
232
  }
265
233
  }
266
234
  return false;
267
- }, "initializeXns");
235
+ };
268
236
 
269
237
  // src/lib/NameTransforms.ts
270
238
  var NameTransforms = class _NameTransforms {
271
- static {
272
- __name(this, "NameTransforms");
273
- }
274
239
  value;
275
240
  constructor(value) {
276
241
  this.value = value;
@@ -436,38 +401,39 @@ var os_node_manifest_default = {
436
401
 
437
402
  // src/loadOsNode.ts
438
403
  var OS_NODE_PATH = "1'";
439
- var getDefaultOsNodeLocator = /* @__PURE__ */ __name(() => {
404
+ var getDefaultOsNodeLocator = () => {
440
405
  const locator = new ModuleFactoryLocator();
441
- locator.register(IndexedDbArchivist.factory(), {
442
- "network.xyo.archivist.persistence.scope": "device"
443
- });
444
- locator.register(IndexedDbPayloadDiviner.factory(), {
445
- "network.xyo.archivist.persistence.scope": "device"
446
- });
406
+ locator.register(IndexedDbArchivist.factory(), { "network.xyo.archivist.persistence.scope": "device" });
407
+ locator.register(IndexedDbPayloadDiviner.factory(), { "network.xyo.archivist.persistence.scope": "device" });
447
408
  return locator;
448
- }, "getDefaultOsNodeLocator");
449
- var loadOsNode = /* @__PURE__ */ __name(async (osWallet, locator) => {
409
+ };
410
+ var loadOsNode = async (osWallet, locator) => {
450
411
  try {
451
412
  const osNodeWallet = await osWallet.derivePath(OS_NODE_PATH);
452
413
  const osNodeLocator = locator ?? getDefaultOsNodeLocator();
453
414
  const manifestWrapper = new ManifestWrapper(os_node_manifest_default, osNodeWallet, osNodeLocator);
454
415
  const osNode = (await manifestWrapper.loadNodes())[0];
455
- return [
456
- osNode
457
- ];
416
+ return [osNode];
458
417
  } catch (e) {
459
418
  const error = e;
460
419
  console.error(`Error creating os node: ${error.message}`);
461
420
  console.error(`Error creating os node: ${error.stack}`);
462
- throw new Error(`Error creating os node: ${error.message}`, {
463
- cause: e
464
- });
421
+ throw new Error(`Error creating os node: ${error.message}`, { cause: e });
465
422
  }
466
- }, "loadOsNode");
423
+ };
467
424
 
468
425
  // src/registration/DappRegistrationService.ts
469
- import { forget as forget2, fulfilled, rejected } from "@xylabs/sdk-js";
470
- import { DappIntentTypes, DappMode as DappMode2, isRegisteredDappAccessDappSet, isRegisteredDappExposedDappSet } from "@xyo-network/os-model";
426
+ import {
427
+ forget as forget2,
428
+ fulfilled,
429
+ rejected
430
+ } from "@xylabs/sdk-js";
431
+ import {
432
+ DappIntentTypes,
433
+ DappMode as DappMode2,
434
+ isRegisteredDappAccessDappSet,
435
+ isRegisteredDappExposedDappSet
436
+ } from "@xyo-network/os-model";
471
437
  import { ModuleFactoryLocator as ModuleFactoryLocator5 } from "@xyo-network/sdk-js";
472
438
 
473
439
  // src/intent/Caller.ts
@@ -483,67 +449,62 @@ var IntentArchivistModuleName = "IntentArchivist";
483
449
  var IntentArchivistPayloadDivinerModuleName = "IntentArchivistPayloadDiviner";
484
450
  var DappArchivistPayloadDivinerModuleName = "DappArchivistPayloadDiviner";
485
451
  var DappCallerBase = class {
486
- static {
487
- __name(this, "DappCallerBase");
488
- }
489
452
  context;
490
453
  constructor(context) {
491
454
  this.context = context;
492
455
  }
493
456
  /**
494
- * Get the DappArchivist
495
- */
457
+ * Get the DappArchivist
458
+ */
496
459
  async getDappArchivist() {
497
- const mod = assertEx3(await this.context.root.resolve(DappArchivistModuleName), () => `${DappArchivistModuleName} not found [${toSafeJsonString(this.context.root.publicChildren())}]`);
498
- return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`, {
499
- required: true
500
- });
460
+ const mod = assertEx3(
461
+ await this.context.root.resolve(DappArchivistModuleName),
462
+ () => `${DappArchivistModuleName} not found [${toSafeJsonString(this.context.root.publicChildren())}]`
463
+ );
464
+ return asArchivistInstance2(mod, () => `${DappArchivistModuleName} is not an archivist`, { required: true });
501
465
  }
502
466
  /**
503
- * Get the DappArchivistPayloadDiviner
504
- */
467
+ * Get the DappArchivistPayloadDiviner
468
+ */
505
469
  async getDappArchivistPayloadDiviner() {
506
- const mod = assertEx3(await this.context.root.resolve(DappArchivistPayloadDivinerModuleName), () => `${DappArchivistPayloadDivinerModuleName} not found`);
507
- return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, {
508
- required: true
509
- });
470
+ const mod = assertEx3(
471
+ await this.context.root.resolve(DappArchivistPayloadDivinerModuleName),
472
+ () => `${DappArchivistPayloadDivinerModuleName} not found`
473
+ );
474
+ return asDivinerInstance2(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
510
475
  }
511
476
  /**
512
- * Get the IntentArchivist
513
- */
477
+ * Get the IntentArchivist
478
+ */
514
479
  async getDappIntentArchivist() {
515
480
  const mod = assertEx3(await this.context.root.resolve(IntentArchivistModuleName), () => `${IntentArchivistModuleName} not found`);
516
- return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`, {
517
- required: true
518
- });
481
+ return asArchivistInstance2(mod, () => `${IntentArchivistModuleName} is not an archivist`, { required: true });
519
482
  }
520
483
  // Get the IntentArchivistPayloadDiviner
521
484
  async getDappIntentArchivistPayloadDiviner() {
522
- const mod = assertEx3(await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName), () => `${IntentArchivistPayloadDivinerModuleName} not found`);
523
- return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, {
524
- required: true
525
- });
485
+ const mod = assertEx3(
486
+ await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName),
487
+ () => `${IntentArchivistPayloadDivinerModuleName} not found`
488
+ );
489
+ return asDivinerInstance2(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
526
490
  }
527
491
  };
528
492
 
529
493
  // src/intent/Caller.ts
530
494
  var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
531
- static {
532
- __name(this, "DappIntentCaller");
533
- }
534
495
  static OsDappName = "XyOs";
535
496
  constructor(context) {
536
497
  super(context);
537
498
  }
538
499
  /**
539
- * Build a new intent
540
- * @param sourceDappId
541
- * @param intent
542
- * @param targetDappId
543
- * @param targetMode
544
- * @param params?
545
- * @returns DappIntent
546
- */
500
+ * Build a new intent
501
+ * @param sourceDappId
502
+ * @param intent
503
+ * @param targetDappId
504
+ * @param targetMode
505
+ * @param params?
506
+ * @returns DappIntent
507
+ */
547
508
  static buildIntent(sourceDappId, intent, targetDappId, targetMode = DappMode.Window, params) {
548
509
  return {
549
510
  intent,
@@ -559,9 +520,7 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
559
520
  async addIntent(id, intent, mode) {
560
521
  const intentArchivist = await this.getDappIntentArchivist();
561
522
  const newIntent = _DappIntentCaller.buildIntent(id, intent, mode);
562
- await intentArchivist.insert([
563
- newIntent
564
- ]);
523
+ await intentArchivist.insert([newIntent]);
565
524
  }
566
525
  // Get all intents
567
526
  async allIntents() {
@@ -582,9 +541,7 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
582
541
  schema: PayloadDivinerQuerySchema,
583
542
  sourceDappId: dappName
584
543
  };
585
- return await diviner.divine([
586
- query
587
- ]);
544
+ return await diviner.divine([query]);
588
545
  }
589
546
  };
590
547
 
@@ -602,9 +559,6 @@ var DappsArchivistPayloadDivinerModuleName = "DappsArchivistPayloadDiviner";
602
559
  var DappsArchivistPayloadDevelopmentDivinerModuleName = `${DappsArchivistPayloadDivinerModuleName}Development`;
603
560
  var RegisteredDappInterfacesArchivistModuleName = "RegisteredDappInterfacesArchivist";
604
561
  var OsCallerBase = class {
605
- static {
606
- __name(this, "OsCallerBase");
607
- }
608
562
  context;
609
563
  constructor(context) {
610
564
  this.context = context;
@@ -612,43 +566,50 @@ var OsCallerBase = class {
612
566
  // Get the dapps archivist
613
567
  async getDappsArchivist() {
614
568
  const mod = assertEx4(await this.context.root.resolve(DappsArchivistModuleName), () => `${DappsArchivistModuleName} not found`);
615
- return asArchivistInstance3(mod, () => `${DappsArchivistModuleName} is not an archivist`, {
616
- required: true
617
- });
569
+ return asArchivistInstance3(mod, () => `${DappsArchivistModuleName} is not an archivist`, { required: true });
618
570
  }
619
571
  // Get the dapps archivist development
620
572
  async getDappsArchivistDevelopment() {
621
- const mod = assertEx4(await this.context.root.resolve(DappsArchivistDevelopmentModuleName), () => `${DappsArchivistDevelopmentModuleName} not found`);
622
- return asArchivistInstance3(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, {
623
- required: true
624
- });
573
+ const mod = assertEx4(
574
+ await this.context.root.resolve(DappsArchivistDevelopmentModuleName),
575
+ () => `${DappsArchivistDevelopmentModuleName} not found`
576
+ );
577
+ return asArchivistInstance3(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, { required: true });
625
578
  }
626
579
  // Get the dapps archivist payload diviner
627
580
  async getDappsArchivistPayloadDiviner() {
628
- const mod = assertEx4(await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName), () => `${DappsArchivistPayloadDivinerModuleName} not found`);
629
- return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, {
630
- required: true
631
- });
581
+ const mod = assertEx4(
582
+ await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName),
583
+ () => `${DappsArchivistPayloadDivinerModuleName} not found`
584
+ );
585
+ return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, { required: true });
632
586
  }
633
587
  // Get the dapps archivist payload diviner development
634
588
  async getDappsArchivistPayloadDivinerDevelopment() {
635
- const mod = assertEx4(await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName), () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`);
636
- return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, {
637
- required: true
638
- });
589
+ const mod = assertEx4(
590
+ await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName),
591
+ () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`
592
+ );
593
+ return asDivinerInstance3(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, { required: true });
639
594
  }
640
595
  // Get the registered dapp interfaces archivist
641
596
  async getRegisteredDappInterfacesArchivist() {
642
- const mod = assertEx4(await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName), () => `${RegisteredDappInterfacesArchivistModuleName} not found`);
643
- return asArchivistInstance3(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, {
644
- required: true
645
- });
597
+ const mod = assertEx4(
598
+ await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName),
599
+ () => `${RegisteredDappInterfacesArchivistModuleName} not found`
600
+ );
601
+ return asArchivistInstance3(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, { required: true });
646
602
  }
647
603
  };
648
604
 
649
605
  // src/system/Queries.ts
650
606
  import { PayloadDivinerQuerySchema as PayloadDivinerQuerySchema2 } from "@xyo-network/diviner-payload-model";
651
- import { DappConfigSchema, DappIconSchema, DappWidgetConfigSchema, UnregisteredDappAccessSchema } from "@xyo-network/os-model";
607
+ import {
608
+ DappConfigSchema,
609
+ DappIconSchema,
610
+ DappWidgetConfigSchema,
611
+ UnregisteredDappAccessSchema
612
+ } from "@xyo-network/os-model";
652
613
  import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
653
614
  var SystemDappQueries = {
654
615
  async getDappAccess(diviner, name, version) {
@@ -656,14 +617,10 @@ var SystemDappQueries = {
656
617
  order: "desc",
657
618
  registeringDappId: name,
658
619
  schema: PayloadDivinerQuerySchema2,
659
- schemas: [
660
- UnregisteredDappAccessSchema
661
- ],
620
+ schemas: [UnregisteredDappAccessSchema],
662
621
  version
663
622
  };
664
- return await diviner.divine([
665
- accessQuery
666
- ]);
623
+ return await diviner.divine([accessQuery]);
667
624
  },
668
625
  async getLatestConfig(diviner, name) {
669
626
  const configQuery = {
@@ -671,13 +628,9 @@ var SystemDappQueries = {
671
628
  name,
672
629
  order: "desc",
673
630
  schema: PayloadDivinerQuerySchema2,
674
- schemas: [
675
- DappConfigSchema
676
- ]
631
+ schemas: [DappConfigSchema]
677
632
  };
678
- const [dappConfig] = await diviner.divine([
679
- configQuery
680
- ]);
633
+ const [dappConfig] = await diviner.divine([configQuery]);
681
634
  return dappConfig;
682
635
  },
683
636
  async getLatestIcon(diviner, name, version) {
@@ -685,14 +638,10 @@ var SystemDappQueries = {
685
638
  name,
686
639
  order: "desc",
687
640
  schema: PayloadDivinerQuerySchema2,
688
- schemas: [
689
- DappIconSchema
690
- ],
641
+ schemas: [DappIconSchema],
691
642
  version
692
643
  };
693
- const [dappIcon] = await diviner.divine([
694
- iconQuery
695
- ]);
644
+ const [dappIcon] = await diviner.divine([iconQuery]);
696
645
  return dappIcon;
697
646
  },
698
647
  async getWidgetConfigs(diviner, name, version) {
@@ -700,14 +649,10 @@ var SystemDappQueries = {
700
649
  dappId: name,
701
650
  order: "desc",
702
651
  schema: PayloadDivinerQuerySchema2,
703
- schemas: [
704
- DappWidgetConfigSchema
705
- ],
652
+ schemas: [DappWidgetConfigSchema],
706
653
  version
707
654
  };
708
- const widgetConfigs = await diviner.divine([
709
- widgetConfigQuery
710
- ]);
655
+ const widgetConfigs = await diviner.divine([widgetConfigQuery]);
711
656
  const uniqueConfigs = {};
712
657
  for (const widgetConfig of widgetConfigs) {
713
658
  const hash = await PayloadBuilder2.dataHash(widgetConfig);
@@ -719,9 +664,6 @@ var SystemDappQueries = {
719
664
 
720
665
  // src/system/ManageSystemDapps.ts
721
666
  var ManageSystemDapps = class extends OsCallerBase {
722
- static {
723
- __name(this, "ManageSystemDapps");
724
- }
725
667
  defaultSystemDappParams;
726
668
  defaultSystemDapps;
727
669
  defaultSystemNames;
@@ -737,15 +679,15 @@ var ManageSystemDapps = class extends OsCallerBase {
737
679
  this.developmentMode = developmentMode;
738
680
  }
739
681
  /**
740
- * Add a callback to listen for errors throwing during system dapp registration
741
- * @param errorListener
742
- */
682
+ * Add a callback to listen for errors throwing during system dapp registration
683
+ * @param errorListener
684
+ */
743
685
  addErrorListener(errorListener) {
744
686
  this.onErrorCallbacks.push(errorListener);
745
687
  }
746
688
  /**
747
- * Installs the dapps into the OS and builds the appropriate DappSet
748
- */
689
+ * Installs the dapps into the OS and builds the appropriate DappSet
690
+ */
749
691
  async install() {
750
692
  await this.insertPayloads();
751
693
  return await this.latestSets();
@@ -769,13 +711,9 @@ var ManageSystemDapps = class extends OsCallerBase {
769
711
  console.error(`${systemDappPayload.version} does not appear to be a valid semver value`, e);
770
712
  continue;
771
713
  }
772
- const [existing] = await archivist.get([
773
- await PayloadBuilder3.dataHash(systemDappPayload)
774
- ]);
714
+ const [existing] = await archivist.get([await PayloadBuilder3.dataHash(systemDappPayload)]);
775
715
  if (existing) continue;
776
- await archivist.insert([
777
- systemDappPayload
778
- ]);
716
+ await archivist.insert([systemDappPayload]);
779
717
  }
780
718
  return true;
781
719
  } catch (e) {
@@ -834,9 +772,6 @@ import { DappWalletSeedPhraseSchema } from "@xyo-network/os-model";
834
772
  import { HDWallet } from "@xyo-network/sdk-js";
835
773
  import { v4 as uuid2 } from "uuid";
836
774
  var DappSeedPhraseRepository = class extends OsCallerBase {
837
- static {
838
- __name(this, "DappSeedPhraseRepository");
839
- }
840
775
  allowedNames;
841
776
  // record of all dapps that have requested a seed phrase with the OS
842
777
  dappIdRepository = /* @__PURE__ */ new Map();
@@ -856,9 +791,7 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
856
791
  seedPhrase,
857
792
  walletId
858
793
  };
859
- await archivist.insert([
860
- payload
861
- ]);
794
+ await archivist.insert([payload]);
862
795
  this.dappIdRepository.set(dappId, payload);
863
796
  this.walletIdRepository.set(walletId, payload);
864
797
  return walletId;
@@ -874,9 +807,7 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
874
807
  throw new Error(`failed to add seed phrase: ${dappName}`);
875
808
  } catch (e) {
876
809
  console.error(e);
877
- throw new Error(`failed to add seed phrase: ${dappName}`, {
878
- cause: e
879
- });
810
+ throw new Error(`failed to add seed phrase: ${dappName}`, { cause: e });
880
811
  }
881
812
  } else {
882
813
  throw new Error(`${dappName} is not allowed to register a seed phase. NOTE: this is a safeguard till 3rd party dApps can be validated`);
@@ -892,13 +823,9 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
892
823
  limit: 1,
893
824
  order: "desc",
894
825
  schema: PayloadDivinerQuerySchema3,
895
- schemas: [
896
- DappWalletSeedPhraseSchema
897
- ]
826
+ schemas: [DappWalletSeedPhraseSchema]
898
827
  };
899
- const results = await diviner.divine([
900
- query
901
- ]);
828
+ const results = await diviner.divine([query]);
902
829
  return results.length > 0 ? results[0] : void 0;
903
830
  }
904
831
  async checkWalletId(walletId) {
@@ -907,14 +834,10 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
907
834
  limit: 1,
908
835
  order: "desc",
909
836
  schema: PayloadDivinerQuerySchema3,
910
- schemas: [
911
- DappWalletSeedPhraseSchema
912
- ],
837
+ schemas: [DappWalletSeedPhraseSchema],
913
838
  walletId
914
839
  };
915
- const results = await diviner.divine([
916
- query
917
- ]);
840
+ const results = await diviner.divine([query]);
918
841
  return results.length > 0 ? results[0] : void 0;
919
842
  }
920
843
  newPhrase() {
@@ -925,7 +848,10 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
925
848
  // src/XyOsDapp.ts
926
849
  import { assertEx as assertEx6 } from "@xylabs/sdk-js";
927
850
  import { DappPackageManifestPayloadSchema } from "@xyo-network/os-model";
928
- import { ManifestWrapper as ManifestWrapper2, ModuleFactoryLocator as ModuleFactoryLocator3 } from "@xyo-network/sdk-js";
851
+ import {
852
+ ManifestWrapper as ManifestWrapper2,
853
+ ModuleFactoryLocator as ModuleFactoryLocator3
854
+ } from "@xyo-network/sdk-js";
929
855
 
930
856
  // src/manifests/dapp-window.manifest.json
931
857
  var dapp_window_manifest_default = {
@@ -970,9 +896,6 @@ import { assertEx as assertEx5, BaseEmitter as BaseEmitter2 } from "@xylabs/sdk-
970
896
  import { ModuleFactoryLocator as ModuleFactoryLocator2 } from "@xyo-network/sdk-js";
971
897
  import { Mutex as Mutex2 } from "async-mutex";
972
898
  var XyOsContextBase = class extends BaseEmitter2 {
973
- static {
974
- __name(this, "XyOsContextBase");
975
- }
976
899
  _bootMutex = new Mutex2();
977
900
  _platformLocator;
978
901
  _root;
@@ -1056,15 +979,10 @@ var XyOsContextBase = class extends BaseEmitter2 {
1056
979
 
1057
980
  // src/XyOsDapp.ts
1058
981
  var XyOsDapp = class extends XyOsContextBase {
1059
- static {
1060
- __name(this, "XyOsDapp");
1061
- }
1062
982
  dapp;
1063
983
  constructor(params) {
1064
984
  super(params);
1065
- this.dapp = {
1066
- ...params.dapp
1067
- };
985
+ this.dapp = { ...params.dapp };
1068
986
  }
1069
987
  get eventBus() {
1070
988
  return this.parent.eventBus;
@@ -1076,12 +994,12 @@ var XyOsDapp = class extends XyOsContextBase {
1076
994
  return this.parent.exposedNodeOuter;
1077
995
  }
1078
996
  /**
1079
- * @deprecated Dapps should not have access to the bios. This is done for the
1080
- * settings dapp, but should be refactored out. Bios could possibly be an
1081
- * optional property of the parent context passed in for dapps that require
1082
- * elevated permissions.
1083
- * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
1084
- */
997
+ * @deprecated Dapps should not have access to the bios. This is done for the
998
+ * settings dapp, but should be refactored out. Bios could possibly be an
999
+ * optional property of the parent context passed in for dapps that require
1000
+ * elevated permissions.
1001
+ * ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
1002
+ */
1085
1003
  get kernel() {
1086
1004
  return assertEx6(this.parent.kernel, () => "Missing kernel");
1087
1005
  }
@@ -1100,18 +1018,16 @@ var XyOsDapp = class extends XyOsContextBase {
1100
1018
  assertEx6(this._root === void 0, () => "Dapp already booted");
1101
1019
  const finalLocator = locator ? (this.params.locator ?? new ModuleFactoryLocator3()).merge(locator) : this.params.locator ?? new ModuleFactoryLocator3();
1102
1020
  console.log("XyOsDapp:boot:finalLocator", finalLocator);
1103
- const dappNodesWrapper = new ManifestWrapper2({
1104
- ...this.manifest,
1105
- schema: DappPackageManifestPayloadSchema
1106
- }, wallet, finalLocator);
1021
+ const dappNodesWrapper = new ManifestWrapper2({ ...this.manifest, schema: DappPackageManifestPayloadSchema }, wallet, finalLocator);
1107
1022
  const dappNodes = await dappNodesWrapper.loadNodes();
1108
1023
  const manifest = dapp_window_manifest_default;
1109
1024
  const dappManifestWallet = await wallet.derivePath("99999");
1110
1025
  manifest.nodes[0].config.name = this.dapp.name + "Root";
1111
- const wrapper = new ManifestWrapper2({
1112
- ...manifest,
1113
- schema: DappPackageManifestPayloadSchema
1114
- }, dappManifestWallet, finalLocator);
1026
+ const wrapper = new ManifestWrapper2(
1027
+ { ...manifest, schema: DappPackageManifestPayloadSchema },
1028
+ dappManifestWallet,
1029
+ finalLocator
1030
+ );
1115
1031
  const node = await wrapper.loadNodeFromIndex(0);
1116
1032
  for (const dappNode of dappNodes) {
1117
1033
  await node.register(dappNode);
@@ -1128,7 +1044,11 @@ var XyOsDapp = class extends XyOsContextBase {
1128
1044
  };
1129
1045
 
1130
1046
  // src/registration/DappRegistry.ts
1131
- import { DappRegisteredSchema, DappRegisteredState, isRegisteredDappAccess } from "@xyo-network/os-model";
1047
+ import {
1048
+ DappRegisteredSchema,
1049
+ DappRegisteredState,
1050
+ isRegisteredDappAccess
1051
+ } from "@xyo-network/os-model";
1132
1052
  import { HDWallet as HDWallet3 } from "@xyo-network/sdk-js";
1133
1053
 
1134
1054
  // src/registration/ValidateDappAccessDiviner/Config.ts
@@ -1139,23 +1059,25 @@ var ValidateDappAccessDivinerConfigSchema = asSchema2("network.xyo.os.dapp.acces
1139
1059
 
1140
1060
  // src/registration/ValidateDappAccessDiviner/Diviner.ts
1141
1061
  import { AbstractDiviner } from "@xyo-network/diviner-abstract";
1142
- import { isDappPackageManifestPayload, isUnregisteredDappAccess, RegisteredDappAccessSchema } from "@xyo-network/os-model";
1143
- import { HDWallet as HDWallet2, ManifestWrapper as ManifestWrapper3, ModuleFactoryLocator as ModuleFactoryLocator4, PackageManifestPayloadSchema } from "@xyo-network/sdk-js";
1062
+ import {
1063
+ isDappPackageManifestPayload,
1064
+ isUnregisteredDappAccess,
1065
+ RegisteredDappAccessSchema
1066
+ } from "@xyo-network/os-model";
1067
+ import {
1068
+ HDWallet as HDWallet2,
1069
+ ManifestWrapper as ManifestWrapper3,
1070
+ ModuleFactoryLocator as ModuleFactoryLocator4,
1071
+ PackageManifestPayloadSchema
1072
+ } from "@xyo-network/sdk-js";
1144
1073
 
1145
1074
  // src/models/access/ValidDappAccessInterfaces.ts
1146
1075
  import { RegisteredNames, RegisteredNamesInterface } from "@xyo-network/os-model";
1147
- var ValidDappAccessInterfaces = {
1148
- [RegisteredNames]: RegisteredNamesInterface
1149
- };
1076
+ var ValidDappAccessInterfaces = { [RegisteredNames]: RegisteredNamesInterface };
1150
1077
 
1151
1078
  // src/registration/ValidateDappAccessDiviner/Diviner.ts
1152
1079
  var ValidateDappAccessDiviner = class extends AbstractDiviner {
1153
- static {
1154
- __name(this, "ValidateDappAccessDiviner");
1155
- }
1156
- static configSchemas = [
1157
- ValidateDappAccessDivinerConfigSchema
1158
- ];
1080
+ static configSchemas = [ValidateDappAccessDivinerConfigSchema];
1159
1081
  async divineHandler(payloads) {
1160
1082
  const dappManifest = payloads?.filter(isDappPackageManifestPayload) ?? [];
1161
1083
  const accessors = payloads?.filter(isUnregisteredDappAccess) ?? [];
@@ -1197,33 +1119,32 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
1197
1119
  }
1198
1120
  }
1199
1121
  } catch (e) {
1200
- failedAccessors.push({
1201
- accessor: access,
1202
- errorMessage: e.message,
1203
- schema: FailedAccessorSchema
1204
- });
1122
+ failedAccessors.push(
1123
+ {
1124
+ accessor: access,
1125
+ errorMessage: e.message,
1126
+ schema: FailedAccessorSchema
1127
+ }
1128
+ );
1205
1129
  }
1206
1130
  }
1207
- return [
1208
- ...registeredAccessors,
1209
- ...failedAccessors
1210
- ];
1131
+ return [...registeredAccessors, ...failedAccessors];
1211
1132
  }
1212
1133
  };
1213
- var compareChildren = /* @__PURE__ */ __name((interfaceChildren, dappChildren) => {
1134
+ var compareChildren = (interfaceChildren, dappChildren) => {
1214
1135
  return interfaceChildren.every((interfaceChild) => Object.values(interfaceChild).every((interfaceChildName) => dappChildren.some((dappChild) => Object.values(dappChild).includes(interfaceChildName))));
1215
- }, "compareChildren");
1216
- var dappPackageManifestToPackageManifest = /* @__PURE__ */ __name((dappPackageManifest) => {
1136
+ };
1137
+ var dappPackageManifestToPackageManifest = (dappPackageManifest) => {
1217
1138
  return {
1218
1139
  ...dappPackageManifest,
1219
1140
  schema: PackageManifestPayloadSchema
1220
1141
  };
1221
- }, "dappPackageManifestToPackageManifest");
1222
- var getChildrenFromNode = /* @__PURE__ */ __name(async (node) => {
1142
+ };
1143
+ var getChildrenFromNode = async (node) => {
1223
1144
  const nodeManifest = (await node.state())?.[0];
1224
1145
  return nodeManifest.status?.children;
1225
- }, "getChildrenFromNode");
1226
- var getNodeChildren = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1146
+ };
1147
+ var getNodeChildren = async (manifestToTest, dappParams) => {
1227
1148
  const testNodes = await getNodeToTest(manifestToTest, dappParams);
1228
1149
  const children = [];
1229
1150
  for (const node of testNodes) {
@@ -1233,30 +1154,35 @@ var getNodeChildren = /* @__PURE__ */ __name(async (manifestToTest, dappParams)
1233
1154
  }
1234
1155
  }
1235
1156
  return children;
1236
- }, "getNodeChildren");
1237
- var getNodeToTest = /* @__PURE__ */ __name(async (manifestToTest, dappParams) => {
1157
+ };
1158
+ var getNodeToTest = async (manifestToTest, dappParams) => {
1238
1159
  const dappManifestWrapper = new ManifestWrapper3(manifestToTest, await HDWallet2.random(), dappParams.locator ?? new ModuleFactoryLocator4());
1239
1160
  return await dappManifestWrapper.loadNodes();
1240
- }, "getNodeToTest");
1161
+ };
1241
1162
 
1242
1163
  // src/registration/DappRegistry.ts
1243
1164
  var DappRegistry = class {
1244
- static {
1245
- __name(this, "DappRegistry");
1246
- }
1247
1165
  dappRegistry = /* @__PURE__ */ new Map();
1248
1166
  dappSeedPhraseRepository;
1249
1167
  constructor(dappSeedPhraseRepository) {
1250
1168
  this.dappSeedPhraseRepository = dappSeedPhraseRepository;
1251
1169
  }
1252
1170
  /**
1253
- * Register a Dapp with window manager and if successful, return its id
1254
- * @param dapp Manifest and UI of the Dapp to register
1255
- * @returns dapp with registration fields
1256
- */
1171
+ * Register a Dapp with window manager and if successful, return its id
1172
+ * @param dapp Manifest and UI of the Dapp to register
1173
+ * @returns dapp with registration fields
1174
+ */
1257
1175
  async registerDapp(dapp) {
1258
1176
  if (dapp) {
1259
- const { exposedModuleIds, manifest, modes, name, version, params, widgetConfigs } = this.extractDappProperties(dapp);
1177
+ const {
1178
+ exposedModuleIds,
1179
+ manifest,
1180
+ modes,
1181
+ name,
1182
+ version,
1183
+ params,
1184
+ widgetConfigs
1185
+ } = this.extractDappProperties(dapp);
1260
1186
  try {
1261
1187
  const walletId = await this.dappSeedPhraseRepository.findOrCreate(name);
1262
1188
  const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params);
@@ -1291,15 +1217,26 @@ var DappRegistry = class {
1291
1217
  }
1292
1218
  }
1293
1219
  /**
1294
- * Unregister a dapp so it can no longer be launched
1295
- * @param dappId
1296
- */
1220
+ * Unregister a dapp so it can no longer be launched
1221
+ * @param dappId
1222
+ */
1297
1223
  unregisterDapp(dappId) {
1298
1224
  this.dappRegistry.delete(dappId);
1299
1225
  }
1300
1226
  extractDappProperties(dapp) {
1301
- const { params, config, widgetConfigs } = dapp;
1302
- const { exposedModuleIds, manifest, modes, name, sources, version } = config;
1227
+ const {
1228
+ params,
1229
+ config,
1230
+ widgetConfigs
1231
+ } = dapp;
1232
+ const {
1233
+ exposedModuleIds,
1234
+ manifest,
1235
+ modes,
1236
+ name,
1237
+ sources,
1238
+ version
1239
+ } = config;
1303
1240
  return {
1304
1241
  exposedModuleIds,
1305
1242
  manifest,
@@ -1314,15 +1251,10 @@ var DappRegistry = class {
1314
1251
  async validateDappAccessPayloads(manifest, accessors = [], params) {
1315
1252
  const validateDappAccess = await ValidateDappAccessDiviner.create({
1316
1253
  account: await HDWallet3.random(),
1317
- config: {
1318
- schema: ValidateDappAccessDivinerConfigSchema
1319
- },
1254
+ config: { schema: ValidateDappAccessDivinerConfigSchema },
1320
1255
  dappParams: params
1321
1256
  });
1322
- const payloads = await validateDappAccess.divine([
1323
- manifest,
1324
- ...accessors
1325
- ]);
1257
+ const payloads = await validateDappAccess.divine([manifest, ...accessors]);
1326
1258
  const failedAccessors = payloads.filter(isFailedAccessor);
1327
1259
  const registeredAccessors = payloads.filter(isRegisteredDappAccess);
1328
1260
  if (failedAccessors.length > 0) {
@@ -1334,9 +1266,6 @@ var DappRegistry = class {
1334
1266
 
1335
1267
  // src/registration/DappRegistrationService.ts
1336
1268
  var DappRegistrationService = class {
1337
- static {
1338
- __name(this, "DappRegistrationService");
1339
- }
1340
1269
  // Dapps that have been built with their own context
1341
1270
  builtDapps = {};
1342
1271
  dappRegistry;
@@ -1363,17 +1292,21 @@ var DappRegistrationService = class {
1363
1292
  };
1364
1293
  this.locator = locator;
1365
1294
  this.developmentMode = developmentMode;
1366
- this.manageSystemDapps = new ManageSystemDapps(context, this.params?.dappNames ?? [], this.params?.dappPayloads ?? [], this.params?.dappParams ?? {}, this.locator, this.developmentMode);
1295
+ this.manageSystemDapps = new ManageSystemDapps(
1296
+ context,
1297
+ this.params?.dappNames ?? [],
1298
+ this.params?.dappPayloads ?? [],
1299
+ this.params?.dappParams ?? {},
1300
+ this.locator,
1301
+ this.developmentMode
1302
+ );
1367
1303
  this.dappSeedPhraseRepository = new DappSeedPhraseRepository(context, this.params?.dappNames ?? []);
1368
1304
  this.dappRegistry = new DappRegistry(this.dappSeedPhraseRepository);
1369
1305
  this.addConnectionRequests();
1370
1306
  }
1371
1307
  async buildDapp(manifest, dappId = NameTransforms.slug(manifest.nodes[0]?.config.name), name = NameTransforms.moduleName(manifest.nodes[0]?.config.name)) {
1372
1308
  const dapp = new XyOsDapp({
1373
- dapp: {
1374
- id: dappId,
1375
- name
1376
- },
1309
+ dapp: { id: dappId, name },
1377
1310
  locator: this.locator,
1378
1311
  manifest,
1379
1312
  parent: this.context,
@@ -1386,46 +1319,40 @@ var DappRegistrationService = class {
1386
1319
  return this.params?.dappParams[dappId];
1387
1320
  }
1388
1321
  async start() {
1389
- const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), {
1390
- name: "Install System dApps"
1391
- });
1322
+ const systemDapps = await this.context.monitor(async () => await this.manageSystemDapps.install(), { name: "Install System dApps" });
1392
1323
  const activeDapps = systemDapps.filter(({ dapp }) => dapp.icon.active === true);
1393
- const results = await Promise.allSettled(activeDapps.map(async (dappSet) => {
1394
- const { dapp } = dappSet;
1395
- const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1396
- const result = {
1397
- dapp: registeredDapp,
1398
- dappIcon: dapp.icon
1399
- };
1400
- const forgetHandlers = /* @__PURE__ */ __name(async () => {
1401
- try {
1402
- await this.postRegistrationHandlers(result);
1403
- } catch (e) {
1404
- console.error("Error in post registration handlers", e);
1405
- }
1406
- }, "forgetHandlers");
1407
- forget2(forgetHandlers());
1408
- return result;
1409
- }));
1324
+ const results = await Promise.allSettled(
1325
+ activeDapps.map(async (dappSet) => {
1326
+ const { dapp } = dappSet;
1327
+ const registeredDapp = await this.dappRegistry.registerDapp(dapp);
1328
+ const result = { dapp: registeredDapp, dappIcon: dapp.icon };
1329
+ const forgetHandlers = async () => {
1330
+ try {
1331
+ await this.postRegistrationHandlers(result);
1332
+ } catch (e) {
1333
+ console.error("Error in post registration handlers", e);
1334
+ }
1335
+ };
1336
+ forget2(forgetHandlers());
1337
+ return result;
1338
+ })
1339
+ );
1410
1340
  const failed = results.filter(rejected).map((result) => {
1411
1341
  const reason = result.reason;
1412
1342
  return reason instanceof Error ? reason.message : String(reason);
1413
1343
  });
1414
1344
  const succeeded = results.filter(fulfilled).map((result) => result.value);
1415
1345
  for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp);
1416
- return {
1417
- failed,
1418
- succeeded
1419
- };
1346
+ return { failed, succeeded };
1420
1347
  }
1421
1348
  addConnectionRequests() {
1422
1349
  this.context.eventBus.addConnection(this.dappAccessRequestConnection);
1423
1350
  this.context.eventBus.addConnection(this.exposeDappRequestConnection);
1424
1351
  }
1425
1352
  /**
1426
- * A method to get the user property from context and eventually modify it before handing it to a dapp
1427
- * i.e. curating user-approved signers
1428
- */
1353
+ * A method to get the user property from context and eventually modify it before handing it to a dapp
1354
+ * i.e. curating user-approved signers
1355
+ */
1429
1356
  getUser() {
1430
1357
  return this.context.user;
1431
1358
  }
@@ -1433,19 +1360,17 @@ var DappRegistrationService = class {
1433
1360
  if (registeredDapp.dapp) {
1434
1361
  if (isRegisteredDappExposedDappSet(registeredDapp)) {
1435
1362
  this.registeredExposedDappSets.add(registeredDapp);
1436
- const exposeIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Launch, registeredDapp.dapp.config.name, DappMode2.Exposed);
1437
- await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, {
1438
- payloads: [
1439
- registeredDapp.dapp.config,
1440
- exposeIntent
1441
- ]
1442
- });
1363
+ const exposeIntent = DappIntentCaller.buildIntent(
1364
+ DappIntentCaller.OsDappName,
1365
+ DappIntentTypes.Launch,
1366
+ registeredDapp.dapp.config.name,
1367
+ DappMode2.Exposed
1368
+ );
1369
+ await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, { payloads: [registeredDapp.dapp.config, exposeIntent] });
1443
1370
  }
1444
1371
  if (isRegisteredDappAccessDappSet(registeredDapp)) {
1445
1372
  this.registeredAccessDappSets.add(registeredDapp);
1446
- await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, {
1447
- payloads: registeredDapp.dapp.accessors
1448
- });
1373
+ await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, { payloads: registeredDapp.dapp.accessors });
1449
1374
  }
1450
1375
  }
1451
1376
  }
@@ -1455,9 +1380,6 @@ var DappRegistrationService = class {
1455
1380
  import { assertEx as assertEx7 } from "@xylabs/sdk-js";
1456
1381
  import { HDWallet as HDWallet4 } from "@xyo-network/sdk-js";
1457
1382
  var Signers = class {
1458
- static {
1459
- __name(this, "Signers");
1460
- }
1461
1383
  _paths;
1462
1384
  _signerAccounts;
1463
1385
  _walletStore;
@@ -1503,13 +1425,14 @@ var Signers = class {
1503
1425
  };
1504
1426
 
1505
1427
  // src/stack/Base.ts
1506
- import { assertEx as assertEx8, BaseEmitter as BaseEmitter3, forget as forget3 } from "@xylabs/sdk-js";
1428
+ import {
1429
+ assertEx as assertEx8,
1430
+ BaseEmitter as BaseEmitter3,
1431
+ forget as forget3
1432
+ } from "@xylabs/sdk-js";
1507
1433
  import { isModuleInstance } from "@xyo-network/module-model";
1508
1434
  import { asAttachableNodeInstance } from "@xyo-network/node-model";
1509
1435
  var StackBase = class extends BaseEmitter3 {
1510
- static {
1511
- __name(this, "StackBase");
1512
- }
1513
1436
  // flag to check that all adapters are initialized
1514
1437
  initialized = false;
1515
1438
  // adapters to initialize into the stack
@@ -1544,95 +1467,84 @@ var StackBase = class extends BaseEmitter3 {
1544
1467
  initialize() {
1545
1468
  this.assignStack();
1546
1469
  for (const adapter of this.adapterSet) {
1547
- const driverReadyListener = /* @__PURE__ */ __name(async ({ node }) => await this.handleDriverReady(node), "driverReadyListener");
1470
+ const driverReadyListener = async ({ node }) => await this.handleDriverReady(node);
1548
1471
  adapter.on("driverReady", driverReadyListener);
1549
1472
  this.listeners.push({
1550
1473
  adapter,
1551
1474
  eventName: "driverReady",
1552
1475
  listener: driverReadyListener
1553
1476
  });
1554
- const driverErrorListener = /* @__PURE__ */ __name(async ({ error }) => {
1477
+ const driverErrorListener = async ({ error }) => {
1555
1478
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, error);
1556
- await this.emit("driverError", {
1557
- error
1558
- });
1559
- }, "driverErrorListener");
1479
+ await this.emit("driverError", { error });
1480
+ };
1560
1481
  adapter.on("driverError", driverErrorListener);
1561
1482
  this.listeners.push({
1562
1483
  adapter,
1563
1484
  eventName: "driverError",
1564
1485
  listener: driverErrorListener
1565
1486
  });
1566
- const startAdapter = /* @__PURE__ */ __name(async () => await adapter.start(), "startAdapter");
1487
+ const startAdapter = async () => await adapter.start();
1567
1488
  forget3(startAdapter());
1568
1489
  }
1569
1490
  }
1570
1491
  /**
1571
- * Stops the stack
1572
- */
1492
+ * Stops the stack
1493
+ */
1573
1494
  stop() {
1574
- for (const { eventName, listener, adapter } of this.listeners) {
1495
+ for (const {
1496
+ eventName,
1497
+ listener,
1498
+ adapter
1499
+ } of this.listeners) {
1575
1500
  adapter.off(eventName, listener);
1576
1501
  }
1577
1502
  }
1578
1503
  /**
1579
- * Adds a node to the stack. Idempotent to avoid adding the
1580
- * same node multiple times
1581
- * @param node The node to add to the stack
1582
- * @returns
1583
- */
1504
+ * Adds a node to the stack. Idempotent to avoid adding the
1505
+ * same node multiple times
1506
+ * @param node The node to add to the stack
1507
+ * @returns
1508
+ */
1584
1509
  async addNodeToStackNode(node) {
1585
1510
  const stackNode = await this.getStackNode();
1586
- const existingModule = await stackNode.resolve(node.address, {
1587
- direction: "down"
1588
- });
1511
+ const existingModule = await stackNode.resolve(node.address, { direction: "down" });
1589
1512
  if (isModuleInstance(existingModule)) return;
1590
1513
  await stackNode.register?.(node);
1591
1514
  await stackNode.attach?.(node.address, true);
1592
1515
  }
1593
1516
  assignStack() {
1594
- const assign = /* @__PURE__ */ __name(async () => {
1517
+ const assign = async () => {
1595
1518
  const stackNode = await this.getStackNode();
1596
1519
  this._stack = stackNode;
1597
- }, "assign");
1520
+ };
1598
1521
  forget3(assign());
1599
1522
  }
1600
1523
  async getStackNode() {
1601
1524
  const mod = assertEx8(await this.context.root.resolve(this.stackNodeModuleId), () => `${this.stackNodeModuleId} not found`);
1602
- return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`, {
1603
- required: true
1604
- });
1525
+ return asAttachableNodeInstance(mod, () => `${this.stackNodeModuleId} not a NodeInstance`, { required: true });
1605
1526
  }
1606
1527
  async handleDriverReady(node) {
1607
1528
  try {
1608
- await this.emit("driverReady", {
1609
- node
1610
- });
1529
+ await this.emit("driverReady", { node });
1611
1530
  await this.addNodeToStackNode(node);
1612
1531
  await this.updateInitializationState(node);
1613
1532
  } catch (error) {
1614
1533
  console.error(`Error updating ${this.stackNodeModuleId} stack node`, node.id, error);
1615
- await this.emit("stackError", {
1616
- error
1617
- });
1534
+ await this.emit("stackError", { error });
1618
1535
  }
1619
1536
  }
1620
1537
  async updateInitializationState(node) {
1621
1538
  this.initializedNodes.push(node);
1622
1539
  this.initialized = this.adapterSet.every((n) => n.initialized);
1623
1540
  if (this.initialized) {
1624
- await this.emit("initialized", {
1625
- stack: await this.getStackNode()
1626
- });
1541
+ await this.emit("initialized", { stack: await this.getStackNode() });
1627
1542
  }
1628
1543
  }
1629
1544
  };
1630
1545
 
1631
1546
  // src/stack/Manager.ts
1632
1547
  var StackManager = class {
1633
- static {
1634
- __name(this, "StackManager");
1635
- }
1636
1548
  initializedStacksMap = /* @__PURE__ */ new Map();
1637
1549
  stackMap;
1638
1550
  constructor(stackMap) {
@@ -1667,15 +1579,18 @@ var StackManager = class {
1667
1579
  import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from "@xyo-network/os-model";
1668
1580
 
1669
1581
  // src/adapter/Base.ts
1670
- import { assertEx as assertEx9, BaseEmitter as BaseEmitter4, forget as forget4 } from "@xylabs/sdk-js";
1582
+ import {
1583
+ assertEx as assertEx9,
1584
+ BaseEmitter as BaseEmitter4,
1585
+ forget as forget4
1586
+ } from "@xylabs/sdk-js";
1671
1587
  import { asArchivistInstance as asArchivistInstance4 } from "@xyo-network/archivist";
1672
1588
  import { asAttachableNodeInstance as asAttachableNodeInstance2 } from "@xyo-network/node-model";
1673
- import { asSchema as asSchema3 } from "@xyo-network/payload-model";
1589
+ import {
1590
+ asSchema as asSchema3
1591
+ } from "@xyo-network/payload-model";
1674
1592
  import { v4 as uuid3 } from "uuid";
1675
1593
  var NodeAdapterBase = class extends BaseEmitter4 {
1676
- static {
1677
- __name(this, "NodeAdapterBase");
1678
- }
1679
1594
  initialized = false;
1680
1595
  _id = "";
1681
1596
  driverName;
@@ -1691,14 +1606,14 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1691
1606
  }
1692
1607
  async start() {
1693
1608
  try {
1694
- const moduleAttachedInsertListener = /* @__PURE__ */ __name(({ payloads }) => {
1609
+ const moduleAttachedInsertListener = ({ payloads }) => {
1695
1610
  const moduleAttachedEvent = this.findModuleEventPayloads(payloads);
1696
1611
  for (const payload of moduleAttachedEvent) {
1697
1612
  if (payload.name === this.driverName) {
1698
1613
  this.validateAndReturnDriver();
1699
1614
  }
1700
1615
  }
1701
- }, "moduleAttachedInsertListener");
1616
+ };
1702
1617
  const eventsArchivist = await this.getEventsArchivist();
1703
1618
  const weakRefInsertListener = new WeakRef(moduleAttachedInsertListener);
1704
1619
  const insertListenerRef = weakRefInsertListener.deref();
@@ -1707,9 +1622,7 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1707
1622
  if (node) return node;
1708
1623
  this.initialized = false;
1709
1624
  } catch (error) {
1710
- await this.emit("driverError", {
1711
- error
1712
- });
1625
+ await this.emit("driverError", { error });
1713
1626
  }
1714
1627
  }
1715
1628
  findModuleEventPayloads(payloads) {
@@ -1720,20 +1633,14 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1720
1633
  }
1721
1634
  async getEventsArchivist() {
1722
1635
  const mod = assertEx9(await (await this.kernel.getNode()).resolve("KernelNode:ModuleEvents"), () => "KernelNode:ModuleEvents not found");
1723
- return asArchivistInstance4(mod, () => `${mod.id} is not an archivist`, {
1724
- required: true
1725
- });
1636
+ return asArchivistInstance4(mod, () => `${mod.id} is not an archivist`, { required: true });
1726
1637
  }
1727
1638
  validateAndReturnDriver() {
1728
1639
  const mod = this.kernel.initialized[this.driverName];
1729
1640
  if (mod) {
1730
- const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`, {
1731
- required: true
1732
- });
1641
+ const node = asAttachableNodeInstance2(mod, () => `${mod.id} is not a node`, { required: true });
1733
1642
  this.initialized = true;
1734
- const emit = /* @__PURE__ */ __name(async () => await this.emit("driverReady", {
1735
- node
1736
- }), "emit");
1643
+ const emit = async () => await this.emit("driverReady", { node });
1737
1644
  forget4(emit());
1738
1645
  return node;
1739
1646
  }
@@ -1742,9 +1649,6 @@ var NodeAdapterBase = class extends BaseEmitter4 {
1742
1649
 
1743
1650
  // src/adapter/Network.ts
1744
1651
  var NetworkAdapter = class extends NodeAdapterBase {
1745
- static {
1746
- __name(this, "NetworkAdapter");
1747
- }
1748
1652
  _connection;
1749
1653
  constructor(kernel, driverName) {
1750
1654
  super(kernel, driverName);
@@ -1765,9 +1669,6 @@ var NetworkAdapter = class extends NodeAdapterBase {
1765
1669
 
1766
1670
  // src/adapter/Settings.ts
1767
1671
  var SettingsAdapter = class extends NodeAdapterBase {
1768
- static {
1769
- __name(this, "SettingsAdapter");
1770
- }
1771
1672
  _settings = void 0;
1772
1673
  constructor(kernel, driverName) {
1773
1674
  super(kernel, driverName);
@@ -1787,31 +1688,26 @@ var SettingsAdapter = class extends NodeAdapterBase {
1787
1688
  };
1788
1689
 
1789
1690
  // src/adapters/OsPubSubBridgeNetwork.ts
1790
- var OsPubSubBridgeNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
1691
+ var OsPubSubBridgeNetworkAdapters = (kernel) => [
1791
1692
  new NetworkAdapter(kernel, PubSubBridgeNodeNodeName),
1792
1693
  new NetworkAdapter(kernel, ExposedNodeOuterNodeName)
1793
- ], "OsPubSubBridgeNetworkAdapters");
1694
+ ];
1794
1695
 
1795
1696
  // src/adapters/OsSettings.ts
1796
1697
  import { OsSettingsNodeName } from "@xyo-network/os-model";
1797
- var OsSettingsAdapters = /* @__PURE__ */ __name((kernel) => [
1798
- new SettingsAdapter(kernel, OsSettingsNodeName)
1799
- ], "OsSettingsAdapters");
1698
+ var OsSettingsAdapters = (kernel) => [new SettingsAdapter(kernel, OsSettingsNodeName)];
1800
1699
 
1801
1700
  // src/adapters/OsXyoPublicNetwork.ts
1802
1701
  import { XyoPublicNodeName } from "@xyo-network/os-model";
1803
- var OsXyoPublicNetworkAdapters = /* @__PURE__ */ __name((kernel) => [
1702
+ var OsXyoPublicNetworkAdapters = (kernel) => [
1804
1703
  new NetworkAdapter(kernel, XyoPublicNodeName)
1805
- ], "OsXyoPublicNetworkAdapters");
1704
+ ];
1806
1705
 
1807
1706
  // src/stack/OsPubSubNetworkStack.ts
1808
1707
  import { assertEx as assertEx10 } from "@xylabs/sdk-js";
1809
1708
  import { asAttachableNodeInstance as asAttachableNodeInstance3, asNodeInstance } from "@xyo-network/node-model";
1810
1709
  import { ExposedNodeOuterNodeName as ExposedNodeOuterNodeName2, PubSubBridgeNodeNodeName as PubSubBridgeNodeNodeName2 } from "@xyo-network/os-model";
1811
1710
  var OsPubSubNetworkStack = class extends StackBase {
1812
- static {
1813
- __name(this, "OsPubSubNetworkStack");
1814
- }
1815
1711
  _exposedNode;
1816
1712
  _exposedNodeOuter;
1817
1713
  busConnection = osPubSubNetworkReadyConnection();
@@ -1854,15 +1750,13 @@ var OsPubSubNetworkStack = class extends StackBase {
1854
1750
  super.stop();
1855
1751
  this._exposedNode = void 0;
1856
1752
  this._exposedNodeOuter = void 0;
1857
- if (this.busConnection._id) this.context.eventBus.removeConnection(this.busConnection.id);
1753
+ if (this.busConnection._id)
1754
+ this.context.eventBus.removeConnection(this.busConnection.id);
1858
1755
  }
1859
1756
  };
1860
1757
 
1861
1758
  // src/stack/OsSettingsStack.ts
1862
1759
  var OsSettingsStack = class extends StackBase {
1863
- static {
1864
- __name(this, "OsSettingsStack");
1865
- }
1866
1760
  busConnection = osSettingsReadyConnection();
1867
1761
  constructor(context, adapters) {
1868
1762
  super(context, adapters, "OsSettingsStackNode");
@@ -1880,9 +1774,6 @@ var OsSettingsStack = class extends StackBase {
1880
1774
  // src/stack/XyoPublicNetworkStack.ts
1881
1775
  import { XyoPublicNodeName as XyoPublicNodeName2 } from "@xyo-network/os-model";
1882
1776
  var XyoPublicNetworkStack = class extends StackBase {
1883
- static {
1884
- __name(this, "XyoPublicNetworkStack");
1885
- }
1886
1777
  busConnection = osXyoPublicNetworkReadyConnection();
1887
1778
  constructor(context, adapters) {
1888
1779
  super(context, adapters, "OsXyoPublicNetworkStackNode");
@@ -1921,9 +1812,6 @@ var OsStackMap = {
1921
1812
 
1922
1813
  // src/XyOs.ts
1923
1814
  var XyOs = class _XyOs extends XyOsContextBase {
1924
- static {
1925
- __name(this, "XyOs");
1926
- }
1927
1815
  _exposedNode;
1928
1816
  _exposedNodeOuter;
1929
1817
  _kernel;
@@ -1931,9 +1819,16 @@ var XyOs = class _XyOs extends XyOsContextBase {
1931
1819
  dappRegistrationService;
1932
1820
  signers;
1933
1821
  stackManager;
1934
- constructor({ logger = console, eventBus = new EventBus(), kernel = new Kernel({
1935
- logger
1936
- }), locator = new ModuleFactoryLocator6(), dappsConfiguration, developmentMode, stackMap = OsStackMap, ...params } = {}) {
1822
+ constructor({
1823
+ logger = console,
1824
+ eventBus = new EventBus(),
1825
+ kernel = new Kernel({ logger }),
1826
+ locator = new ModuleFactoryLocator6(),
1827
+ dappsConfiguration,
1828
+ developmentMode,
1829
+ stackMap = OsStackMap,
1830
+ ...params
1831
+ } = {}) {
1937
1832
  super({
1938
1833
  eventBus,
1939
1834
  kernel,
@@ -1971,19 +1866,14 @@ var XyOs = class _XyOs extends XyOsContextBase {
1971
1866
  return this.stackManager.stacks;
1972
1867
  }
1973
1868
  get user() {
1974
- return {
1975
- signers: this.signers?.getWalletKindSigner("user")
1976
- };
1869
+ return { signers: this.signers?.getWalletKindSigner("user") };
1977
1870
  }
1978
1871
  static async monitor(fn, eventConfig) {
1979
1872
  const { name, additionalProperties } = eventConfig;
1980
1873
  const monitor = this.monitoring;
1981
1874
  monitor?.startTimer(name);
1982
1875
  const result = await fn();
1983
- monitor?.stopTimer({
1984
- additionalProperties,
1985
- name
1986
- });
1876
+ monitor?.stopTimer({ additionalProperties, name });
1987
1877
  return result;
1988
1878
  }
1989
1879
  async boot(wallet, locator = new ModuleFactoryLocator6()) {
@@ -1992,18 +1882,13 @@ var XyOs = class _XyOs extends XyOsContextBase {
1992
1882
  return await this._bootMutex.runExclusive(async () => {
1993
1883
  await this.eventBus.start();
1994
1884
  if (this.kernel?.status === "created") {
1995
- await this.kernel.boot(await boot(), {
1996
- locator: fullLocator,
1997
- kernelDrivers: []
1998
- });
1885
+ await this.kernel.boot(await boot(), { locator: fullLocator, kernelDrivers: [] });
1999
1886
  }
2000
1887
  if (this.kernel?.status !== "booted") {
2001
1888
  throw new Error("Kernel not booted");
2002
1889
  }
2003
1890
  assertEx11(this._root === void 0, () => "XyOs already booted");
2004
- const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), {
2005
- name: "Load XyOs"
2006
- });
1891
+ const [root] = await _XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), { name: "Load XyOs" });
2007
1892
  this._root = root;
2008
1893
  this.stackManager.initialize(this);
2009
1894
  if (this.signers) await this.signers.initialize();
@@ -2034,32 +1919,26 @@ var XyOs = class _XyOs extends XyOsContextBase {
2034
1919
 
2035
1920
  // src/scripts/xyos/lib/headless.ts
2036
1921
  var { terminal } = tk;
2037
- var terminate = /* @__PURE__ */ __name(() => {
1922
+ var terminate = () => {
2038
1923
  terminal.grabInput(false);
2039
1924
  setTimeout(function() {
2040
1925
  process.exit(0);
2041
1926
  }, 100);
2042
- }, "terminate");
2043
- var headless = /* @__PURE__ */ __name(async ({ manifest, config, kernelDrivers } = {}) => {
1927
+ };
1928
+ var headless = async ({
1929
+ manifest,
1930
+ config,
1931
+ kernelDrivers
1932
+ } = {}) => {
2044
1933
  console.log(chalk.green("Starting Headless xyOS..."));
2045
- const configExplorer = cosmiconfig("xyos", {
2046
- cache: true,
2047
- loaders: {
2048
- ".ts": TypeScriptLoader()
2049
- }
2050
- });
1934
+ const configExplorer = cosmiconfig("xyos", { cache: true, loaders: { ".ts": TypeScriptLoader() } });
2051
1935
  const configResult = await (config ? configExplorer.load(config) : configExplorer.search());
2052
1936
  const xyosConfig = configResult?.config ?? {};
2053
1937
  const manifestToLoad = manifest ?? (typeof xyosConfig.manifest === "string" ? xyosConfig.manifest : void 0);
2054
1938
  const manifestObject = manifestToLoad ? JSON.parse(fs.readFileSync(manifestToLoad, "utf8")) : typeof xyosConfig.manifest === "object" ? xyosConfig.manifest : void 0;
2055
1939
  const osWallet = await HDWallet5.random();
2056
- const kernel = new Kernel2({
2057
- logColor: "cyan",
2058
- logger: console
2059
- });
2060
- await kernel.boot(await boot2(), {
2061
- kernelDrivers
2062
- });
1940
+ const kernel = new Kernel2({ logColor: "cyan", logger: console });
1941
+ await kernel.boot(await boot2(), { kernelDrivers });
2063
1942
  const xyOs = new XyOs({
2064
1943
  kernel,
2065
1944
  stackMap: {},
@@ -2068,28 +1947,20 @@ var headless = /* @__PURE__ */ __name(async ({ manifest, config, kernelDrivers }
2068
1947
  });
2069
1948
  await xyOs.boot(osWallet);
2070
1949
  console.log(chalk.green("Started Headless xyOS..."));
2071
- terminal.grabInput({
2072
- mouse: "button"
2073
- });
1950
+ terminal.grabInput({ mouse: "button" });
2074
1951
  terminal.on("key", function(name) {
2075
1952
  console.log("'key' event:", name);
2076
1953
  if (name === "CTRL_C") {
2077
1954
  terminate();
2078
1955
  }
2079
1956
  });
2080
- }, "headless");
1957
+ };
2081
1958
 
2082
1959
  // src/scripts/xyos/command/create.ts
2083
- var commandCreate = /* @__PURE__ */ __name((argv) => {
1960
+ var commandCreate = (argv) => {
2084
1961
  return argv.command("create [template] <target>", "Create an xyos project", (yargs2) => {
2085
1962
  return yargs2.positional("template", {
2086
- choices: [
2087
- "react",
2088
- "headless",
2089
- "dapp",
2090
- "diviner",
2091
- "witness"
2092
- ],
1963
+ choices: ["react", "headless", "dapp", "diviner", "witness"],
2093
1964
  description: "Template to use",
2094
1965
  type: "string"
2095
1966
  }).positional("target", {
@@ -2098,22 +1969,15 @@ var commandCreate = /* @__PURE__ */ __name((argv) => {
2098
1969
  });
2099
1970
  }, async ({ template, target }) => {
2100
1971
  console.log(`Using template ${template} at location ${target}`);
2101
- return await createFromTemplate({
2102
- target,
2103
- template
2104
- });
1972
+ return await createFromTemplate({ target, template });
2105
1973
  });
2106
- }, "commandCreate");
1974
+ };
2107
1975
 
2108
1976
  // src/scripts/xyos/command/manifest.ts
2109
- var commandManifest = /* @__PURE__ */ __name((argv) => {
1977
+ var commandManifest = (argv) => {
2110
1978
  return argv.command("manifest [action] <target>", "Create an xyos project", (yargs2) => {
2111
1979
  return yargs2.positional("action", {
2112
- choices: [
2113
- "create",
2114
- "validate",
2115
- "display"
2116
- ],
1980
+ choices: ["create", "validate", "display"],
2117
1981
  description: "Action to take on manifest",
2118
1982
  type: "string"
2119
1983
  }).positional("target", {
@@ -2124,10 +1988,10 @@ var commandManifest = /* @__PURE__ */ __name((argv) => {
2124
1988
  console.log(`Taking action [${action}] on manifest at ${target}`);
2125
1989
  return await Promise.resolve();
2126
1990
  });
2127
- }, "commandManifest");
1991
+ };
2128
1992
 
2129
1993
  // src/scripts/xyos/command/start.ts
2130
- var commandStart = /* @__PURE__ */ __name((argv) => {
1994
+ var commandStart = (argv) => {
2131
1995
  return argv.command("start", "Start xyOS in headless mode", (yargs2) => {
2132
1996
  return yargs2.option("config", {
2133
1997
  alias: "c",
@@ -2142,7 +2006,11 @@ var commandStart = /* @__PURE__ */ __name((argv) => {
2142
2006
  description: "Kernel driver to load",
2143
2007
  type: "string"
2144
2008
  });
2145
- }, async ({ config, manifest, kernelDriver }) => {
2009
+ }, async ({
2010
+ config,
2011
+ manifest,
2012
+ kernelDriver
2013
+ }) => {
2146
2014
  if (config) {
2147
2015
  console.log(`Using config: ${config}`);
2148
2016
  }
@@ -2152,13 +2020,25 @@ var commandStart = /* @__PURE__ */ __name((argv) => {
2152
2020
  await headless({
2153
2021
  manifest,
2154
2022
  config,
2155
- kernelDrivers: kernelDriver ? [
2156
- kernelDriver
2157
- ] : []
2023
+ kernelDrivers: kernelDriver ? [kernelDriver] : []
2158
2024
  });
2159
2025
  });
2160
- }, "commandStart");
2026
+ };
2161
2027
 
2162
2028
  // src/scripts/xyos/index.ts
2163
- commandManifest(commandConfig(commandCreate(commandStart(yargs(hideBin(process.argv)))))).usage("Usage: $0 <command> [options]").scriptName("xyos").demandCommand(1).parse().catch(console.error);
2164
- //# sourceMappingURL=index.mjs.map
2029
+ commandManifest(
2030
+ commandConfig(
2031
+ commandCreate(
2032
+ commandStart(
2033
+ yargs(
2034
+ hideBin(
2035
+ process.argv
2036
+ )
2037
+ )
2038
+ )
2039
+ )
2040
+ )
2041
+ ).usage("Usage: $0 <command> [options]").scriptName("xyos").demandCommand(1).parse().catch(
2042
+ console.error
2043
+ );
2044
+ //# sourceMappingURL=index.mjs.map