@coasys/ad4m 0.10.0 → 0.10.1-dev-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 (64) hide show
  1. package/lib/index.cjs +3785 -843
  2. package/lib/index.js +3777 -839
  3. package/lib/src/Ad4mClient.js +2 -1
  4. package/lib/src/Literal.js +4 -1
  5. package/lib/src/ai/AIClient.d.ts +8 -2
  6. package/lib/src/ai/AIClient.js +25 -14
  7. package/lib/src/ai/AIResolver.d.ts +25 -6
  8. package/lib/src/ai/AIResolver.js +102 -18
  9. package/lib/src/index.d.ts +4 -3
  10. package/lib/src/index.js +4 -3
  11. package/lib/src/model/Ad4mModel.d.ts +730 -0
  12. package/lib/src/model/Ad4mModel.js +1399 -0
  13. package/lib/src/{subject → model}/Subject.d.ts +2 -2
  14. package/lib/src/{subject → model}/Subject.js +18 -18
  15. package/lib/src/model/decorators.d.ts +502 -0
  16. package/lib/src/model/decorators.js +683 -0
  17. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +2 -2
  18. package/lib/src/neighbourhood/NeighbourhoodClient.js +13 -10
  19. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -2
  20. package/lib/src/neighbourhood/NeighbourhoodProxy.js +4 -4
  21. package/lib/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  22. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +73 -0
  23. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +2 -2
  24. package/lib/src/neighbourhood/NeighbourhoodResolver.js +6 -4
  25. package/lib/src/perspectives/PerspectiveClient.d.ts +23 -11
  26. package/lib/src/perspectives/PerspectiveClient.js +147 -51
  27. package/lib/src/perspectives/PerspectiveProxy.d.ts +494 -54
  28. package/lib/src/perspectives/PerspectiveProxy.js +684 -67
  29. package/lib/src/perspectives/PerspectiveResolver.d.ts +24 -9
  30. package/lib/src/perspectives/PerspectiveResolver.js +151 -46
  31. package/lib/src/runtime/RuntimeClient.d.ts +8 -2
  32. package/lib/src/runtime/RuntimeClient.js +64 -0
  33. package/lib/src/runtime/RuntimeResolver.d.ts +27 -1
  34. package/lib/src/runtime/RuntimeResolver.js +138 -0
  35. package/lib/src/schema.gql +55 -16
  36. package/lib/src/typeDefs.js +55 -16
  37. package/package.json +4 -3
  38. package/src/Ad4mClient.test.ts +51 -19
  39. package/src/Ad4mClient.ts +3 -1
  40. package/src/Literal.ts +4 -1
  41. package/src/ai/AIClient.ts +35 -14
  42. package/src/ai/AIResolver.ts +78 -16
  43. package/src/index.ts +4 -3
  44. package/src/model/Ad4mModel.ts +1651 -0
  45. package/src/{subject → model}/Subject.ts +16 -16
  46. package/src/{subject/SDNADecorators.ts → model/decorators.ts} +384 -50
  47. package/src/neighbourhood/NeighbourhoodClient.ts +13 -10
  48. package/src/neighbourhood/NeighbourhoodProxy.test.ts +100 -0
  49. package/src/neighbourhood/NeighbourhoodProxy.ts +4 -4
  50. package/src/neighbourhood/NeighbourhoodResolver.ts +2 -2
  51. package/src/perspectives/PerspectiveClient.ts +156 -51
  52. package/src/perspectives/PerspectiveProxy.ts +766 -82
  53. package/src/perspectives/PerspectiveResolver.ts +134 -23
  54. package/src/runtime/RuntimeClient.ts +71 -2
  55. package/src/runtime/RuntimeResolver.ts +91 -1
  56. package/lib/src/subject/SDNADecorators.d.ts +0 -188
  57. package/lib/src/subject/SDNADecorators.js +0 -360
  58. package/lib/src/subject/SubjectEntity.d.ts +0 -102
  59. package/lib/src/subject/SubjectEntity.js +0 -267
  60. package/src/subject/SubjectEntity.ts +0 -315
  61. package/yarn-error.log +0 -90
  62. /package/lib/src/{subject → model}/util.d.ts +0 -0
  63. /package/lib/src/{subject → model}/util.js +0 -0
  64. /package/src/{subject → model}/util.ts +0 -0
@@ -194,6 +194,82 @@ TriggeredNotification = __decorate([
194
194
  ObjectType()
195
195
  ], TriggeredNotification);
196
196
  export { TriggeredNotification };
197
+ let ImportStats = class ImportStats {
198
+ };
199
+ __decorate([
200
+ Field(),
201
+ __metadata("design:type", Number)
202
+ ], ImportStats.prototype, "total", void 0);
203
+ __decorate([
204
+ Field(),
205
+ __metadata("design:type", Number)
206
+ ], ImportStats.prototype, "imported", void 0);
207
+ __decorate([
208
+ Field(),
209
+ __metadata("design:type", Number)
210
+ ], ImportStats.prototype, "failed", void 0);
211
+ __decorate([
212
+ Field(),
213
+ __metadata("design:type", Number)
214
+ ], ImportStats.prototype, "omitted", void 0);
215
+ __decorate([
216
+ Field(type => [String]),
217
+ __metadata("design:type", Array)
218
+ ], ImportStats.prototype, "errors", void 0);
219
+ ImportStats = __decorate([
220
+ ObjectType()
221
+ ], ImportStats);
222
+ export { ImportStats };
223
+ let ImportResult = class ImportResult {
224
+ };
225
+ __decorate([
226
+ Field(),
227
+ __metadata("design:type", ImportStats)
228
+ ], ImportResult.prototype, "perspectives", void 0);
229
+ __decorate([
230
+ Field(),
231
+ __metadata("design:type", ImportStats)
232
+ ], ImportResult.prototype, "links", void 0);
233
+ __decorate([
234
+ Field(),
235
+ __metadata("design:type", ImportStats)
236
+ ], ImportResult.prototype, "expressions", void 0);
237
+ __decorate([
238
+ Field(),
239
+ __metadata("design:type", ImportStats)
240
+ ], ImportResult.prototype, "perspectiveDiffs", void 0);
241
+ __decorate([
242
+ Field(),
243
+ __metadata("design:type", ImportStats)
244
+ ], ImportResult.prototype, "notifications", void 0);
245
+ __decorate([
246
+ Field(),
247
+ __metadata("design:type", ImportStats)
248
+ ], ImportResult.prototype, "models", void 0);
249
+ __decorate([
250
+ Field(),
251
+ __metadata("design:type", ImportStats)
252
+ ], ImportResult.prototype, "defaultModels", void 0);
253
+ __decorate([
254
+ Field(),
255
+ __metadata("design:type", ImportStats)
256
+ ], ImportResult.prototype, "tasks", void 0);
257
+ __decorate([
258
+ Field(),
259
+ __metadata("design:type", ImportStats)
260
+ ], ImportResult.prototype, "friends", void 0);
261
+ __decorate([
262
+ Field(),
263
+ __metadata("design:type", ImportStats)
264
+ ], ImportResult.prototype, "trustedAgents", void 0);
265
+ __decorate([
266
+ Field(),
267
+ __metadata("design:type", ImportStats)
268
+ ], ImportResult.prototype, "knownLinkLanguages", void 0);
269
+ ImportResult = __decorate([
270
+ ObjectType()
271
+ ], ImportResult);
272
+ export { ImportResult };
197
273
  /**
198
274
  * Resolver classes are used here to define the GraphQL schema
199
275
  * (through the type-graphql annotations)
@@ -244,6 +320,15 @@ let RuntimeResolver = class RuntimeResolver {
244
320
  runtimeHcAgentInfos() {
245
321
  return JSON.stringify([{ "agent": { "type": "Buffer", "data": [9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186] }, "signature": { "type": "Buffer", "data": [195, 143, 170, 36, 234, 123, 255, 85, 188, 138, 124, 2, 91, 18, 53, 231, 44, 41, 240, 8, 80, 131, 100, 150, 165, 125, 146, 90, 17, 200, 190, 129, 114, 211, 11, 146, 150, 128, 198, 199, 79, 118, 157, 101, 194, 68, 58, 245, 98, 182, 79, 139, 140, 41, 143, 129, 8, 136, 87, 77, 180, 231, 218, 11] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 9, 191, 231, 58, 255, 107, 202, 55, 206, 57, 9, 103, 17, 34, 206, 195, 207, 114, 5, 73, 77, 198, 56, 136, 17, 227, 242, 231, 194, 135, 128, 48, 170, 189, 119, 186, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 101, 83, 52, 86, 112, 54, 109, 118, 80, 48, 122, 116, 85, 101, 104, 114, 117, 113, 89, 52, 102, 66, 53, 101, 69, 98, 121, 48, 69, 66, 100, 89, 84, 50, 95, 67, 48, 69, 112, 77, 111, 76, 111, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 104, 189, 50, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38] }, "signature": { "type": "Buffer", "data": [233, 192, 38, 3, 59, 248, 124, 231, 57, 255, 40, 154, 50, 60, 119, 252, 68, 198, 154, 109, 175, 155, 106, 217, 211, 155, 109, 223, 249, 91, 221, 210, 17, 132, 72, 230, 11, 230, 247, 119, 72, 244, 145, 91, 75, 7, 67, 5, 130, 151, 44, 231, 52, 220, 28, 154, 212, 82, 58, 90, 203, 211, 236, 4] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 98, 187, 145, 48, 115, 209, 94, 143, 31, 153, 102, 69, 138, 29, 133, 213, 34, 52, 39, 164, 157, 139, 178, 111, 23, 33, 118, 250, 28, 155, 78, 246, 128, 49, 179, 38, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 55, 101, 77, 106, 48, 73, 83, 72, 56, 56, 81, 56, 45, 89, 51, 74, 89, 70, 53, 76, 72, 57, 83, 54, 68, 119, 71, 73, 49, 88, 45, 115, 87, 53, 68, 104, 66, 87, 121, 71, 119, 78, 115, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 103, 45, 197, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109] }, "signature": { "type": "Buffer", "data": [88, 189, 229, 122, 44, 171, 194, 156, 90, 79, 148, 49, 207, 224, 34, 199, 219, 88, 24, 243, 103, 127, 123, 41, 87, 171, 127, 92, 6, 216, 198, 171, 26, 226, 237, 217, 122, 78, 98, 146, 55, 255, 68, 240, 202, 83, 58, 140, 147, 185, 3, 66, 15, 216, 210, 22, 99, 197, 73, 234, 120, 17, 74, 1] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 181, 101, 115, 45, 214, 127, 198, 153, 159, 184, 30, 87, 67, 224, 208, 184, 203, 176, 130, 158, 236, 127, 153, 125, 243, 183, 188, 167, 154, 25, 118, 254, 101, 145, 210, 109, 164, 117, 114, 108, 115, 145, 217, 99, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 114, 70, 71, 83, 100, 113, 104, 101, 68, 107, 70, 70, 56, 69, 102, 109, 45, 69, 116, 55, 119, 81, 101, 120, 83, 88, 55, 65, 112, 69, 51, 89, 86, 99, 45, 120, 102, 52, 104, 106, 77, 115, 77, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 56, 46, 54, 48, 47, 112, 47, 55, 55, 52, 52, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 23, 220, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }, { "agent": { "type": "Buffer", "data": [3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56] }, "signature": { "type": "Buffer", "data": [129, 12, 55, 104, 239, 121, 138, 2, 86, 106, 136, 51, 219, 79, 170, 8, 195, 69, 81, 188, 225, 192, 247, 196, 54, 39, 164, 110, 75, 39, 240, 56, 245, 189, 154, 77, 72, 11, 97, 250, 202, 149, 242, 97, 128, 28, 47, 164, 236, 104, 136, 82, 212, 246, 44, 143, 132, 119, 255, 135, 112, 11, 20, 13] }, "agent_info": { "type": "Buffer", "data": [134, 165, 115, 112, 97, 99, 101, 196, 36, 203, 165, 212, 173, 24, 215, 165, 196, 25, 145, 248, 113, 246, 139, 205, 182, 241, 138, 57, 0, 26, 8, 217, 179, 23, 126, 59, 136, 128, 213, 110, 225, 173, 72, 197, 95, 165, 97, 103, 101, 110, 116, 196, 36, 3, 171, 237, 107, 186, 245, 165, 47, 237, 235, 211, 49, 245, 62, 113, 53, 255, 252, 223, 226, 75, 118, 148, 187, 23, 53, 70, 174, 160, 184, 64, 63, 94, 210, 227, 56, 164, 117, 114, 108, 115, 145, 217, 97, 107, 105, 116, 115, 117, 110, 101, 45, 112, 114, 111, 120, 121, 58, 47, 47, 104, 121, 112, 115, 86, 121, 103, 117, 80, 84, 115, 53, 118, 73, 80, 65, 102, 97, 112, 90, 88, 113, 117, 84, 115, 79, 80, 100, 67, 81, 79, 79, 117, 103, 57, 51, 82, 103, 106, 95, 114, 85, 73, 47, 107, 105, 116, 115, 117, 110, 101, 45, 113, 117, 105, 99, 47, 104, 47, 49, 54, 53, 46, 50, 50, 46, 51, 50, 46, 49, 49, 47, 112, 47, 53, 55, 55, 57, 47, 45, 45, 172, 115, 105, 103, 110, 101, 100, 95, 97, 116, 95, 109, 115, 207, 0, 0, 1, 123, 233, 113, 188, 123, 176, 101, 120, 112, 105, 114, 101, 115, 95, 97, 102, 116, 101, 114, 95, 109, 115, 206, 0, 18, 79, 128, 169, 109, 101, 116, 97, 95, 105, 110, 102, 111, 196, 34, 129, 187, 100, 104, 116, 95, 115, 116, 111, 114, 97, 103, 101, 95, 97, 114, 99, 95, 104, 97, 108, 102, 95, 108, 101, 110, 103, 116, 104, 206, 128, 0, 0, 1] } }]);
246
322
  }
323
+ runtimeGetNetworkMetrics() {
324
+ return JSON.stringify({
325
+ "metrics": {},
326
+ "stats": {}
327
+ });
328
+ }
329
+ runtimeRestartHolochain() {
330
+ return true;
331
+ }
247
332
  runtimeHcAddAgentInfos(agentInfos) {
248
333
  return true;
249
334
  }
@@ -322,6 +407,18 @@ let RuntimeResolver = class RuntimeResolver {
322
407
  }
323
408
  };
324
409
  }
410
+ runtimeExportDb(filePath) {
411
+ return true;
412
+ }
413
+ runtimeImportDb(filePath) {
414
+ return true;
415
+ }
416
+ runtimeExportPerspective(perspectiveUuid, filePath) {
417
+ return true;
418
+ }
419
+ runtimeImportPerspective(filePath) {
420
+ return true;
421
+ }
325
422
  };
326
423
  __decorate([
327
424
  Mutation(returns => Boolean),
@@ -408,6 +505,18 @@ __decorate([
408
505
  __metadata("design:paramtypes", []),
409
506
  __metadata("design:returntype", String)
410
507
  ], RuntimeResolver.prototype, "runtimeHcAgentInfos", null);
508
+ __decorate([
509
+ Query(),
510
+ __metadata("design:type", Function),
511
+ __metadata("design:paramtypes", []),
512
+ __metadata("design:returntype", String)
513
+ ], RuntimeResolver.prototype, "runtimeGetNetworkMetrics", null);
514
+ __decorate([
515
+ Mutation(returns => Boolean),
516
+ __metadata("design:type", Function),
517
+ __metadata("design:paramtypes", []),
518
+ __metadata("design:returntype", Boolean)
519
+ ], RuntimeResolver.prototype, "runtimeRestartHolochain", null);
411
520
  __decorate([
412
521
  Mutation(returns => Boolean),
413
522
  __param(0, Arg("agentInfos", type => String)),
@@ -514,6 +623,35 @@ __decorate([
514
623
  __metadata("design:paramtypes", []),
515
624
  __metadata("design:returntype", TriggeredNotification)
516
625
  ], RuntimeResolver.prototype, "runtimeNotificationTriggered", null);
626
+ __decorate([
627
+ Mutation(),
628
+ __param(0, Arg("filePath", type => String)),
629
+ __metadata("design:type", Function),
630
+ __metadata("design:paramtypes", [String]),
631
+ __metadata("design:returntype", Boolean)
632
+ ], RuntimeResolver.prototype, "runtimeExportDb", null);
633
+ __decorate([
634
+ Mutation(),
635
+ __param(0, Arg("filePath", type => String)),
636
+ __metadata("design:type", Function),
637
+ __metadata("design:paramtypes", [String]),
638
+ __metadata("design:returntype", Boolean)
639
+ ], RuntimeResolver.prototype, "runtimeImportDb", null);
640
+ __decorate([
641
+ Mutation(),
642
+ __param(0, Arg("perspectiveUuid", type => String)),
643
+ __param(1, Arg("filePath", type => String)),
644
+ __metadata("design:type", Function),
645
+ __metadata("design:paramtypes", [String, String]),
646
+ __metadata("design:returntype", Boolean)
647
+ ], RuntimeResolver.prototype, "runtimeExportPerspective", null);
648
+ __decorate([
649
+ Mutation(),
650
+ __param(0, Arg("filePath", type => String)),
651
+ __metadata("design:type", Function),
652
+ __metadata("design:paramtypes", [String]),
653
+ __metadata("design:returntype", Boolean)
654
+ ], RuntimeResolver.prototype, "runtimeImportPerspective", null);
517
655
  RuntimeResolver = __decorate([
518
656
  Resolver()
519
657
  ], RuntimeResolver);
@@ -251,14 +251,16 @@ input LinkQuery {
251
251
 
252
252
  type LocalModel {
253
253
  fileName: String!
254
- modelParameters: String!
255
- tokenizerSource: String!
254
+ huggingfaceRepo: String
255
+ revision: String
256
+ tokenizerSource: TokenizerSource
256
257
  }
257
258
 
258
259
  input LocalModelInput {
259
260
  fileName: String!
260
- modelParameters: String!
261
- tokenizerSource: String!
261
+ huggingfaceRepo: String
262
+ revision: String
263
+ tokenizerSource: TokenizerSourceInput
262
264
  }
263
265
 
264
266
  type Model {
@@ -311,8 +313,8 @@ type Mutation {
311
313
  aiAddTask(task: AITaskInput!): AITask!
312
314
  aiCloseTranscriptionStream(streamId: String!): String!
313
315
  aiEmbed(modelId: String!, text: String!): String!
314
- aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
315
- aiOpenTranscriptionStream(modelId: String!): String!
316
+ aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
317
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
316
318
  aiPrompt(prompt: String!, taskId: String!): String!
317
319
  aiRemoveModel(modelId: String!): Boolean!
318
320
  aiRemoveTask(taskId: String!): AITask!
@@ -328,38 +330,48 @@ type Mutation {
328
330
  languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
329
331
  neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
330
332
  neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
331
- neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
332
- neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
333
+ neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
334
+ neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
333
335
  neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
334
336
  neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
335
337
  neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
336
338
  neighbourhoodSetOnlineStatusU(perspectiveUUID: String!, status: PerspectiveUnsignedInput!): Boolean!
337
339
  perspectiveAdd(name: String!): PerspectiveHandle!
338
- perspectiveAddLink(link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
339
- perspectiveAddLinkExpression(link: LinkExpressionInput!, status: String, uuid: String!): LinkExpression!
340
- perspectiveAddLinks(links: [LinkInput!]!, status: String, uuid: String!): [LinkExpression!]!
340
+ perspectiveAddLink(batchId: String, link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
341
+ perspectiveAddLinkExpression(batchId: String, link: LinkExpressionInput!, status: String = "shared", uuid: String!): LinkExpression!
342
+ perspectiveAddLinks(batchId: String, links: [LinkInput!]!, status: String = "shared", uuid: String!): [LinkExpression!]!
341
343
  perspectiveAddSdna(name: String!, sdnaCode: String!, sdnaType: String!, uuid: String!): Boolean!
342
- perspectiveCreateSubject(expressionAddress: String!, subjectClass: String!, uuid: String!): Boolean!
343
- perspectiveExecuteCommands(commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
344
+ perspectiveCommitBatch(batchId: String!, uuid: String!): LinkExpressionMutations!
345
+ perspectiveCreateBatch(uuid: String!): String!
346
+ perspectiveCreateSubject(batchId: String, expressionAddress: String!, initialValues: String, subjectClass: String!, uuid: String!): Boolean!
347
+ perspectiveDisposeQuerySubscription(subscriptionId: String!, uuid: String!): Boolean!
348
+ perspectiveExecuteCommands(batchId: String, commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
344
349
  perspectiveGetSubjectData(expressionAddress: String!, subjectClass: String!, uuid: String!): String!
350
+ perspectiveKeepAliveQuery(subscriptionId: String!, uuid: String!): Boolean!
345
351
  perspectiveLinkMutations(mutations: LinkMutations!, status: String, uuid: String!): LinkExpressionMutations!
346
352
  perspectivePublishSnapshot(uuid: String!): String
347
353
  perspectiveRemove(uuid: String!): Boolean!
348
- perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
349
- perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
354
+ perspectiveRemoveLink(batchId: String, link: LinkExpressionInput!, uuid: String!): Boolean!
355
+ perspectiveRemoveLinks(batchId: String, links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
356
+ perspectiveSubscribeQuery(query: String!, uuid: String!): QuerySubscription!
350
357
  perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
351
- perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
358
+ perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
352
359
  runtimeAddFriends(dids: [String!]!): [String!]!
353
360
  runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
361
+ runtimeExportDb(filePath: String!): Boolean!
362
+ runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
354
363
  runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
355
364
  runtimeGrantNotification(id: String!): Boolean!
356
365
  runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
366
+ runtimeImportDb(filePath: String!): Boolean!
367
+ runtimeImportPerspective(filePath: String!): Boolean!
357
368
  runtimeOpenLink(url: String!): Boolean!
358
369
  runtimeQuit: Boolean!
359
370
  runtimeRemoveFriends(dids: [String!]!): [String!]!
360
371
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
361
372
  runtimeRemoveNotification(id: String!): Boolean!
362
373
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
374
+ runtimeRestartHolochain: Boolean!
363
375
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
364
376
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
365
377
  }
@@ -462,6 +474,7 @@ type Query {
462
474
  perspectives: [PerspectiveHandle!]!
463
475
  runtimeFriendStatus(did: String!): PerspectiveExpression
464
476
  runtimeFriends: [String!]!
477
+ runtimeGetNetworkMetrics: String!
465
478
  runtimeHcAgentInfos: String!
466
479
  runtimeInfo: RuntimeInfo!
467
480
  runtimeKnownLinkLanguageTemplates: [String!]!
@@ -471,6 +484,11 @@ type Query {
471
484
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
472
485
  }
473
486
 
487
+ type QuerySubscription {
488
+ result: String!
489
+ subscriptionId: String!
490
+ }
491
+
474
492
  type Resource {
475
493
  domain: String!
476
494
  pointers: [String!]!
@@ -503,6 +521,7 @@ type Subscription {
503
521
  perspectiveLinkAdded(uuid: String!): LinkExpression
504
522
  perspectiveLinkRemoved(uuid: String!): LinkExpression
505
523
  perspectiveLinkUpdated(uuid: String!): LinkExpressionUpdated
524
+ perspectiveQuerySubscription(subscriptionId: String!): String!
506
525
  perspectiveRemoved: String
507
526
  perspectiveSyncStateChange(uuid: String!): String!
508
527
  perspectiveUpdated: PerspectiveHandle
@@ -510,8 +529,28 @@ type Subscription {
510
529
  runtimeNotificationTriggered: TriggeredNotification
511
530
  }
512
531
 
532
+ type TokenizerSource {
533
+ fileName: String!
534
+ repo: String!
535
+ revision: String!
536
+ }
537
+
538
+ input TokenizerSourceInput {
539
+ fileName: String!
540
+ repo: String!
541
+ revision: String!
542
+ }
543
+
513
544
  type TriggeredNotification {
514
545
  notification: Notification!
515
546
  perspectiveId: String!
516
547
  triggerMatch: String!
517
548
  }
549
+
550
+ input VoiceActivityParamsInput {
551
+ endThreshold: Float
552
+ endWindow: Float
553
+ startThreshold: Float
554
+ startWindow: Float
555
+ timeBeforeSpeech: Float
556
+ }
@@ -247,14 +247,16 @@ input LinkQuery {
247
247
 
248
248
  type LocalModel {
249
249
  fileName: String!
250
- modelParameters: String!
251
- tokenizerSource: String!
250
+ huggingfaceRepo: String
251
+ revision: String
252
+ tokenizerSource: TokenizerSource
252
253
  }
253
254
 
254
255
  input LocalModelInput {
255
256
  fileName: String!
256
- modelParameters: String!
257
- tokenizerSource: String!
257
+ huggingfaceRepo: String
258
+ revision: String
259
+ tokenizerSource: TokenizerSourceInput
258
260
  }
259
261
 
260
262
  type Model {
@@ -307,8 +309,8 @@ type Mutation {
307
309
  aiAddTask(task: AITaskInput!): AITask!
308
310
  aiCloseTranscriptionStream(streamId: String!): String!
309
311
  aiEmbed(modelId: String!, text: String!): String!
310
- aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
311
- aiOpenTranscriptionStream(modelId: String!): String!
312
+ aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
313
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
312
314
  aiPrompt(prompt: String!, taskId: String!): String!
313
315
  aiRemoveModel(modelId: String!): Boolean!
314
316
  aiRemoveTask(taskId: String!): AITask!
@@ -324,38 +326,48 @@ type Mutation {
324
326
  languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
325
327
  neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
326
328
  neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
327
- neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
328
- neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
329
+ neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
330
+ neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
329
331
  neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
330
332
  neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
331
333
  neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
332
334
  neighbourhoodSetOnlineStatusU(perspectiveUUID: String!, status: PerspectiveUnsignedInput!): Boolean!
333
335
  perspectiveAdd(name: String!): PerspectiveHandle!
334
- perspectiveAddLink(link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
335
- perspectiveAddLinkExpression(link: LinkExpressionInput!, status: String, uuid: String!): LinkExpression!
336
- perspectiveAddLinks(links: [LinkInput!]!, status: String, uuid: String!): [LinkExpression!]!
336
+ perspectiveAddLink(batchId: String, link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
337
+ perspectiveAddLinkExpression(batchId: String, link: LinkExpressionInput!, status: String = "shared", uuid: String!): LinkExpression!
338
+ perspectiveAddLinks(batchId: String, links: [LinkInput!]!, status: String = "shared", uuid: String!): [LinkExpression!]!
337
339
  perspectiveAddSdna(name: String!, sdnaCode: String!, sdnaType: String!, uuid: String!): Boolean!
338
- perspectiveCreateSubject(expressionAddress: String!, subjectClass: String!, uuid: String!): Boolean!
339
- perspectiveExecuteCommands(commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
340
+ perspectiveCommitBatch(batchId: String!, uuid: String!): LinkExpressionMutations!
341
+ perspectiveCreateBatch(uuid: String!): String!
342
+ perspectiveCreateSubject(batchId: String, expressionAddress: String!, initialValues: String, subjectClass: String!, uuid: String!): Boolean!
343
+ perspectiveDisposeQuerySubscription(subscriptionId: String!, uuid: String!): Boolean!
344
+ perspectiveExecuteCommands(batchId: String, commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
340
345
  perspectiveGetSubjectData(expressionAddress: String!, subjectClass: String!, uuid: String!): String!
346
+ perspectiveKeepAliveQuery(subscriptionId: String!, uuid: String!): Boolean!
341
347
  perspectiveLinkMutations(mutations: LinkMutations!, status: String, uuid: String!): LinkExpressionMutations!
342
348
  perspectivePublishSnapshot(uuid: String!): String
343
349
  perspectiveRemove(uuid: String!): Boolean!
344
- perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
345
- perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
350
+ perspectiveRemoveLink(batchId: String, link: LinkExpressionInput!, uuid: String!): Boolean!
351
+ perspectiveRemoveLinks(batchId: String, links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
352
+ perspectiveSubscribeQuery(query: String!, uuid: String!): QuerySubscription!
346
353
  perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
347
- perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
354
+ perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
348
355
  runtimeAddFriends(dids: [String!]!): [String!]!
349
356
  runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
357
+ runtimeExportDb(filePath: String!): Boolean!
358
+ runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
350
359
  runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
351
360
  runtimeGrantNotification(id: String!): Boolean!
352
361
  runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
362
+ runtimeImportDb(filePath: String!): Boolean!
363
+ runtimeImportPerspective(filePath: String!): Boolean!
353
364
  runtimeOpenLink(url: String!): Boolean!
354
365
  runtimeQuit: Boolean!
355
366
  runtimeRemoveFriends(dids: [String!]!): [String!]!
356
367
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
357
368
  runtimeRemoveNotification(id: String!): Boolean!
358
369
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
370
+ runtimeRestartHolochain: Boolean!
359
371
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
360
372
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
361
373
  }
@@ -458,6 +470,7 @@ type Query {
458
470
  perspectives: [PerspectiveHandle!]!
459
471
  runtimeFriendStatus(did: String!): PerspectiveExpression
460
472
  runtimeFriends: [String!]!
473
+ runtimeGetNetworkMetrics: String!
461
474
  runtimeHcAgentInfos: String!
462
475
  runtimeInfo: RuntimeInfo!
463
476
  runtimeKnownLinkLanguageTemplates: [String!]!
@@ -467,6 +480,11 @@ type Query {
467
480
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
468
481
  }
469
482
 
483
+ type QuerySubscription {
484
+ result: String!
485
+ subscriptionId: String!
486
+ }
487
+
470
488
  type Resource {
471
489
  domain: String!
472
490
  pointers: [String!]!
@@ -499,6 +517,7 @@ type Subscription {
499
517
  perspectiveLinkAdded(uuid: String!): LinkExpression
500
518
  perspectiveLinkRemoved(uuid: String!): LinkExpression
501
519
  perspectiveLinkUpdated(uuid: String!): LinkExpressionUpdated
520
+ perspectiveQuerySubscription(subscriptionId: String!): String!
502
521
  perspectiveRemoved: String
503
522
  perspectiveSyncStateChange(uuid: String!): String!
504
523
  perspectiveUpdated: PerspectiveHandle
@@ -506,9 +525,29 @@ type Subscription {
506
525
  runtimeNotificationTriggered: TriggeredNotification
507
526
  }
508
527
 
528
+ type TokenizerSource {
529
+ fileName: String!
530
+ repo: String!
531
+ revision: String!
532
+ }
533
+
534
+ input TokenizerSourceInput {
535
+ fileName: String!
536
+ repo: String!
537
+ revision: String!
538
+ }
539
+
509
540
  type TriggeredNotification {
510
541
  notification: Notification!
511
542
  perspectiveId: String!
512
543
  triggerMatch: String!
513
544
  }
545
+
546
+ input VoiceActivityParamsInput {
547
+ endThreshold: Float
548
+ endWindow: Float
549
+ startThreshold: Float
550
+ startWindow: Float
551
+ timeBeforeSpeech: Float
552
+ }
514
553
  `
package/package.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/src/index.d.ts",
7
7
  "type": "module",
8
+
8
9
  "scripts": {
9
10
  "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
10
11
  "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
@@ -38,7 +39,6 @@
38
39
  "express": "4.18.2",
39
40
  "graphql": "15.7.2",
40
41
  "reflect-metadata": "^0.1.13",
41
- "type-graphql": "1.1.1",
42
42
  "pako": "*",
43
43
  "base64-js": "*"
44
44
  },
@@ -52,6 +52,7 @@
52
52
  "graphql-ws": "5.12.0",
53
53
  "honkit": "^4.0.0",
54
54
  "jest": "^26.6.0",
55
+ "type-graphql": "1.1.1",
55
56
  "patch-package": "^8.0.0",
56
57
  "rollup": "^2.56.3",
57
58
  "ts-jest": "^26.5.6",
@@ -63,10 +64,10 @@
63
64
  "react-dom": "*"
64
65
  },
65
66
  "patchedDependencies": {},
66
- "version": "0.10.0",
67
67
  "pnpm": {
68
68
  "patchedDependencies": {
69
69
  "graphql@15.7.2": "patches/graphql@15.7.2.patch"
70
70
  }
71
- }
71
+ },
72
+ "version": "0.10.1-dev-1"
72
73
  }
@@ -1158,9 +1158,26 @@ describe('Ad4mClient', () => {
1158
1158
  expect(models).toBeDefined();
1159
1159
  expect(Array.isArray(models)).toBe(true);
1160
1160
  if (models.length > 0) {
1161
- expect(models[0]).toHaveProperty('name');
1162
- expect(models[0]).toHaveProperty('api');
1163
- expect(models[0]).toHaveProperty('local');
1161
+ const model = models[0];
1162
+ expect(model).toHaveProperty('name');
1163
+ expect(model).toHaveProperty('id');
1164
+ expect(model).toHaveProperty('modelType');
1165
+ if (model.api) {
1166
+ expect(model.api).toHaveProperty('baseUrl');
1167
+ expect(model.api).toHaveProperty('apiKey');
1168
+ expect(model.api).toHaveProperty('model');
1169
+ expect(model.api).toHaveProperty('apiType');
1170
+ }
1171
+ if (model.local) {
1172
+ expect(model.local).toHaveProperty('fileName');
1173
+ if (model.local.tokenizerSource) {
1174
+ expect(model.local.tokenizerSource).toHaveProperty('repo');
1175
+ expect(model.local.tokenizerSource).toHaveProperty('revision');
1176
+ expect(model.local.tokenizerSource).toHaveProperty('fileName');
1177
+ }
1178
+ expect(model.local).toHaveProperty('huggingfaceRepo');
1179
+ expect(model.local).toHaveProperty('revision');
1180
+ }
1164
1181
  }
1165
1182
  })
1166
1183
 
@@ -1175,8 +1192,13 @@ describe('Ad4mClient', () => {
1175
1192
  },
1176
1193
  local: {
1177
1194
  fileName: "new-test-model.bin",
1178
- tokenizerSource: "new-test-tokenizer",
1179
- modelParameters: "{}"
1195
+ tokenizerSource: {
1196
+ repo: "test-repo",
1197
+ revision: "main",
1198
+ fileName: "tokenizer.json"
1199
+ },
1200
+ huggingfaceRepo: "test-repo",
1201
+ revision: "main"
1180
1202
  },
1181
1203
  modelType: "LLM"
1182
1204
  };
@@ -1196,8 +1218,13 @@ describe('Ad4mClient', () => {
1196
1218
  },
1197
1219
  local: {
1198
1220
  fileName: "updated-test-model.bin",
1199
- tokenizerSource: "updated-test-tokenizer",
1200
- modelParameters: "{}"
1221
+ tokenizerSource: {
1222
+ repo: "test-repo",
1223
+ revision: "main",
1224
+ fileName: "tokenizer.json"
1225
+ },
1226
+ huggingfaceRepo: "test-repo",
1227
+ revision: "main"
1201
1228
  },
1202
1229
  modelType: "LLM"
1203
1230
  };
@@ -1222,18 +1249,23 @@ describe('Ad4mClient', () => {
1222
1249
  const setResult = await ad4mClient.ai.setDefaultModel(modelType, modelName);
1223
1250
  expect(setResult).toBe(true);
1224
1251
 
1225
- const model = await ad4mClient.ai.getDefaultModel(modelType);
1226
- expect(model).toBeDefined();
1227
- expect(model.name).toBe("Default Test Model");
1228
- expect(model.api).toBeDefined();
1229
- expect(model.api.baseUrl).toBe("https://api.example.com");
1230
- expect(model.api.apiKey).toBe("test-api-key");
1231
- expect(model.api.apiType).toBe("OpenAi");
1232
- expect(model.local).toBeDefined();
1233
- expect(model.local.fileName).toBe("test-model.bin");
1234
- expect(model.local.tokenizerSource).toBe("test-tokenizer");
1235
- expect(model.local.modelParameters).toBe("{}");
1236
- expect(model.modelType).toBe(modelType);
1252
+ const defaultModel = await ad4mClient.ai.getDefaultModel(modelType);
1253
+ expect(defaultModel).toBeDefined();
1254
+ expect(defaultModel.name).toBe("Default Test Model");
1255
+ expect(defaultModel.api).toBeDefined();
1256
+ expect(defaultModel.api.baseUrl).toBe("https://api.example.com");
1257
+ expect(defaultModel.api.apiKey).toBe("test-api-key");
1258
+ expect(defaultModel.api.apiType).toBe("OpenAi");
1259
+ expect(defaultModel.local).toBeDefined();
1260
+ expect(defaultModel.local.fileName).toBe("test-model.bin");
1261
+ if (defaultModel.local.tokenizerSource) {
1262
+ expect(defaultModel.local.tokenizerSource.repo).toBe("test-repo");
1263
+ expect(defaultModel.local.tokenizerSource.revision).toBe("main");
1264
+ expect(defaultModel.local.tokenizerSource.fileName).toBe("tokenizer.json");
1265
+ }
1266
+ expect(defaultModel.local.huggingfaceRepo).toBe("test-repo");
1267
+ expect(defaultModel.local.revision).toBe("main");
1268
+ expect(defaultModel.modelType).toBe(modelType);
1237
1269
  })
1238
1270
 
1239
1271
  it('embed()', async () => {
package/src/Ad4mClient.ts CHANGED
@@ -33,11 +33,13 @@ export class Ad4mClient {
33
33
  this.#expressionClient = new ExpressionClient(this.#apolloClient)
34
34
  this.#languageClient = new LanguageClient(this.#apolloClient)
35
35
  this.#neighbourhoodClient = new NeighbourhoodClient(this.#apolloClient)
36
+ this.#aiClient = new AIClient(this.#apolloClient, subscribe)
36
37
  this.#perspectiveClient = new PerspectiveClient(this.#apolloClient, subscribe)
37
38
  this.#perspectiveClient.setExpressionClient(this.#expressionClient)
38
39
  this.#perspectiveClient.setNeighbourhoodClient(this.#neighbourhoodClient)
40
+ this.#perspectiveClient.setAIClient(this.#aiClient)
39
41
  this.#runtimeClient = new RuntimeClient(this.#apolloClient, subscribe)
40
- this.#aiClient = new AIClient(this.#apolloClient, subscribe)
42
+
41
43
  }
42
44
 
43
45
  get agent(): AgentClient {
package/src/Literal.ts CHANGED
@@ -27,7 +27,7 @@ export class Literal {
27
27
  toUrl(): string {
28
28
  if(this.#url && !this.#literal)
29
29
  return this.#url
30
- if(!this.#url && !this.#literal)
30
+ if(!this.#url && (this.#literal === undefined || this.#literal === "" || this.#literal === null))
31
31
  throw new Error("Can't turn empty Literal into URL")
32
32
 
33
33
  let encoded
@@ -38,6 +38,9 @@ export class Literal {
38
38
  case 'number':
39
39
  encoded = `number:${encodeRFC3986URIComponent(this.#literal)}`
40
40
  break;
41
+ case 'boolean':
42
+ encoded = `boolean:${encodeRFC3986URIComponent(this.#literal)}`
43
+ break;
41
44
  case 'object':
42
45
  encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(this.#literal))}`
43
46
  break;