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