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