@coasys/ad4m 0.13.0-test-6 → 0.13.0-test-8

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 (279) hide show
  1. package/lib/index.cjs +1103 -747
  2. package/lib/index.js +1090 -747
  3. package/lib/src/Ad4mClient.d.ts +4 -1
  4. package/lib/src/Ad4mClient.js +2 -2
  5. package/lib/src/agent/AgentClient.js +17 -0
  6. package/lib/src/ai/AIClient.js +1 -1
  7. package/lib/src/apiClient.d.ts +5 -1
  8. package/lib/src/apiClient.js +14 -6
  9. package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +7 -0
  10. package/lib/src/generated/rest/AIModelLoadingStatus.js +2 -0
  11. package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +3 -0
  12. package/lib/src/generated/rest/AddAgentInfosRequest.js +2 -0
  13. package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +6 -0
  14. package/lib/src/generated/rest/AddLinkExpressionRequest.js +1 -0
  15. package/lib/src/generated/rest/AddLinkRequest.d.ts +6 -0
  16. package/lib/src/generated/rest/AddLinkRequest.js +1 -0
  17. package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +6 -0
  18. package/lib/src/generated/rest/AddLinksBulkRequest.js +1 -0
  19. package/lib/src/generated/rest/AddSdnaRequest.d.ts +6 -0
  20. package/lib/src/generated/rest/AddSdnaRequest.js +2 -0
  21. package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +4 -0
  22. package/lib/src/generated/rest/ApplyTemplateRequest.js +2 -0
  23. package/lib/src/generated/rest/AuthInfoInput.d.ts +10 -0
  24. package/lib/src/generated/rest/AuthInfoInput.js +1 -0
  25. package/lib/src/generated/rest/BroadcastRequest.d.ts +6 -0
  26. package/lib/src/generated/rest/BroadcastRequest.js +1 -0
  27. package/lib/src/generated/rest/CapabilityInput.d.ts +5 -0
  28. package/lib/src/generated/rest/CapabilityInput.js +1 -0
  29. package/lib/src/generated/rest/CommitBatchRequest.d.ts +3 -0
  30. package/lib/src/generated/rest/CommitBatchRequest.js +2 -0
  31. package/lib/src/generated/rest/ComputeLogEntry.d.ts +9 -0
  32. package/lib/src/generated/rest/ComputeLogEntry.js +2 -0
  33. package/lib/src/generated/rest/CreateExpressionRequest.d.ts +4 -0
  34. package/lib/src/generated/rest/CreateExpressionRequest.js +2 -0
  35. package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +3 -0
  36. package/lib/src/generated/rest/CreatePerspectiveRequest.js +2 -0
  37. package/lib/src/generated/rest/CreateSubjectRequest.d.ts +6 -0
  38. package/lib/src/generated/rest/CreateSubjectRequest.js +2 -0
  39. package/lib/src/generated/rest/CreateUserRequest.d.ts +4 -0
  40. package/lib/src/generated/rest/CreateUserRequest.js +2 -0
  41. package/lib/src/generated/rest/CreateUserResponse.d.ts +5 -0
  42. package/lib/src/generated/rest/CreateUserResponse.js +2 -0
  43. package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +6 -0
  44. package/lib/src/generated/rest/DecoratedExpressionProof.js +2 -0
  45. package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +10 -0
  46. package/lib/src/generated/rest/DecoratedLinkExpression.js +1 -0
  47. package/lib/src/generated/rest/DisposeQueryRequest.d.ts +3 -0
  48. package/lib/src/generated/rest/DisposeQueryRequest.js +2 -0
  49. package/lib/src/generated/rest/EmailTestRequest.d.ts +6 -0
  50. package/lib/src/generated/rest/EmailTestRequest.js +2 -0
  51. package/lib/src/generated/rest/EmbedRequest.d.ts +4 -0
  52. package/lib/src/generated/rest/EmbedRequest.js +2 -0
  53. package/lib/src/generated/rest/EntanglementProofInput.d.ts +6 -0
  54. package/lib/src/generated/rest/EntanglementProofInput.js +2 -0
  55. package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +4 -0
  56. package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +2 -0
  57. package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +4 -0
  58. package/lib/src/generated/rest/ExecuteCommandsRequest.js +2 -0
  59. package/lib/src/generated/rest/ExportRequest.d.ts +5 -0
  60. package/lib/src/generated/rest/ExportRequest.js +2 -0
  61. package/lib/src/generated/rest/ExpressionManyRequest.d.ts +3 -0
  62. package/lib/src/generated/rest/ExpressionManyRequest.js +2 -0
  63. package/lib/src/generated/rest/ExpressionProof.d.ts +4 -0
  64. package/lib/src/generated/rest/ExpressionProof.js +2 -0
  65. package/lib/src/generated/rest/ExpressionProofInput.d.ts +6 -0
  66. package/lib/src/generated/rest/ExpressionProofInput.js +2 -0
  67. package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +3 -0
  68. package/lib/src/generated/rest/FriendSendMessageRequest.js +2 -0
  69. package/lib/src/generated/rest/FriendsListRequest.d.ts +3 -0
  70. package/lib/src/generated/rest/FriendsListRequest.js +2 -0
  71. package/lib/src/generated/rest/GenerateAgentRequest.d.ts +3 -0
  72. package/lib/src/generated/rest/GenerateAgentRequest.js +2 -0
  73. package/lib/src/generated/rest/GenerateJwtRequest.d.ts +4 -0
  74. package/lib/src/generated/rest/GenerateJwtRequest.js +2 -0
  75. package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +4 -0
  76. package/lib/src/generated/rest/GetSubjectDataRequest.js +2 -0
  77. package/lib/src/generated/rest/HostingInfoResponse.d.ts +5 -0
  78. package/lib/src/generated/rest/HostingInfoResponse.js +2 -0
  79. package/lib/src/generated/rest/HostingWalletResponse.d.ts +4 -0
  80. package/lib/src/generated/rest/HostingWalletResponse.js +2 -0
  81. package/lib/src/generated/rest/ImportAgentRequest.d.ts +6 -0
  82. package/lib/src/generated/rest/ImportAgentRequest.js +2 -0
  83. package/lib/src/generated/rest/ImportRequest.d.ts +4 -0
  84. package/lib/src/generated/rest/ImportRequest.js +2 -0
  85. package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +3 -0
  86. package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +2 -0
  87. package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +3 -0
  88. package/lib/src/generated/rest/KeepAliveQueryRequest.js +2 -0
  89. package/lib/src/generated/rest/LanguageMetaInput.d.ts +6 -0
  90. package/lib/src/generated/rest/LanguageMetaInput.js +2 -0
  91. package/lib/src/generated/rest/Link.d.ts +5 -0
  92. package/lib/src/generated/rest/Link.js +2 -0
  93. package/lib/src/generated/rest/LinkExpression.d.ts +10 -0
  94. package/lib/src/generated/rest/LinkExpression.js +1 -0
  95. package/lib/src/generated/rest/LinkExpressionInput.d.ts +10 -0
  96. package/lib/src/generated/rest/LinkExpressionInput.js +1 -0
  97. package/lib/src/generated/rest/LinkInput.d.ts +5 -0
  98. package/lib/src/generated/rest/LinkInput.js +2 -0
  99. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +3 -0
  100. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +2 -0
  101. package/lib/src/generated/rest/LinkMutationRequest.d.ts +12 -0
  102. package/lib/src/generated/rest/LinkMutationRequest.js +1 -0
  103. package/lib/src/generated/rest/LinkMutationResponse.d.ts +9 -0
  104. package/lib/src/generated/rest/LinkMutationResponse.js +1 -0
  105. package/lib/src/generated/rest/LinkMutations.d.ts +6 -0
  106. package/lib/src/generated/rest/LinkMutations.js +1 -0
  107. package/lib/src/generated/rest/LinkMutationsRequest.d.ts +5 -0
  108. package/lib/src/generated/rest/LinkMutationsRequest.js +1 -0
  109. package/lib/src/generated/rest/LinkStatus.d.ts +1 -0
  110. package/lib/src/generated/rest/LinkStatus.js +2 -0
  111. package/lib/src/generated/rest/LinkUpdateInput.d.ts +5 -0
  112. package/lib/src/generated/rest/LinkUpdateInput.js +1 -0
  113. package/lib/src/generated/rest/LockAgentRequest.d.ts +3 -0
  114. package/lib/src/generated/rest/LockAgentRequest.js +2 -0
  115. package/lib/src/generated/rest/LoginUserRequest.d.ts +5 -0
  116. package/lib/src/generated/rest/LoginUserRequest.js +2 -0
  117. package/lib/src/generated/rest/ModelType.d.ts +1 -0
  118. package/lib/src/generated/rest/ModelType.js +2 -0
  119. package/lib/src/generated/rest/NotificationGrantRequest.d.ts +3 -0
  120. package/lib/src/generated/rest/NotificationGrantRequest.js +2 -0
  121. package/lib/src/generated/rest/NotificationInput.d.ts +10 -0
  122. package/lib/src/generated/rest/NotificationInput.js +2 -0
  123. package/lib/src/generated/rest/OpenLinkRequest.d.ts +3 -0
  124. package/lib/src/generated/rest/OpenLinkRequest.js +2 -0
  125. package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +3 -0
  126. package/lib/src/generated/rest/PermitCapabilityRequest.js +2 -0
  127. package/lib/src/generated/rest/PerspectiveInput.d.ts +4 -0
  128. package/lib/src/generated/rest/PerspectiveInput.js +1 -0
  129. package/lib/src/generated/rest/PromptRequest.d.ts +4 -0
  130. package/lib/src/generated/rest/PromptRequest.js +2 -0
  131. package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +4 -0
  132. package/lib/src/generated/rest/PublicPerspectiveInput.js +1 -0
  133. package/lib/src/generated/rest/PublishLanguageRequest.d.ts +5 -0
  134. package/lib/src/generated/rest/PublishLanguageRequest.js +1 -0
  135. package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +6 -0
  136. package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +1 -0
  137. package/lib/src/generated/rest/QueryRequest.d.ts +7 -0
  138. package/lib/src/generated/rest/QueryRequest.js +2 -0
  139. package/lib/src/generated/rest/RemoveLinkRequest.d.ts +5 -0
  140. package/lib/src/generated/rest/RemoveLinkRequest.js +1 -0
  141. package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +5 -0
  142. package/lib/src/generated/rest/RemoveLinksBulkRequest.js +1 -0
  143. package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +4 -0
  144. package/lib/src/generated/rest/RequestCapabilityRequest.js +1 -0
  145. package/lib/src/generated/rest/RequestPaymentRequest.d.ts +3 -0
  146. package/lib/src/generated/rest/RequestPaymentRequest.js +2 -0
  147. package/lib/src/generated/rest/RequestVerificationRequest.d.ts +4 -0
  148. package/lib/src/generated/rest/RequestVerificationRequest.js +2 -0
  149. package/lib/src/generated/rest/ResourceInput.d.ts +4 -0
  150. package/lib/src/generated/rest/ResourceInput.js +2 -0
  151. package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +4 -0
  152. package/lib/src/generated/rest/SetDefaultModelRequest.js +1 -0
  153. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +3 -0
  154. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +2 -0
  155. package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +3 -0
  156. package/lib/src/generated/rest/SetHotWalletAddressRequest.js +2 -0
  157. package/lib/src/generated/rest/SetMultiUserRequest.d.ts +3 -0
  158. package/lib/src/generated/rest/SetMultiUserRequest.js +2 -0
  159. package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +5 -0
  160. package/lib/src/generated/rest/SetOnlineStatusRequest.js +1 -0
  161. package/lib/src/generated/rest/SetStatusRequest.d.ts +3 -0
  162. package/lib/src/generated/rest/SetStatusRequest.js +2 -0
  163. package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +4 -0
  164. package/lib/src/generated/rest/SetUserFreeAccessRequest.js +2 -0
  165. package/lib/src/generated/rest/SignMessageRequest.d.ts +3 -0
  166. package/lib/src/generated/rest/SignMessageRequest.js +2 -0
  167. package/lib/src/generated/rest/SignalRequest.d.ts +6 -0
  168. package/lib/src/generated/rest/SignalRequest.js +1 -0
  169. package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +3 -0
  170. package/lib/src/generated/rest/SubscribeQueryRequest.js +2 -0
  171. package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +4 -0
  172. package/lib/src/generated/rest/SubscribeQueryResponse.js +2 -0
  173. package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +3 -0
  174. package/lib/src/generated/rest/TrustedAgentsRequest.js +2 -0
  175. package/lib/src/generated/rest/UnlockAgentRequest.d.ts +4 -0
  176. package/lib/src/generated/rest/UnlockAgentRequest.js +2 -0
  177. package/lib/src/generated/rest/UpdateLinkRequest.d.ts +7 -0
  178. package/lib/src/generated/rest/UpdateLinkRequest.js +1 -0
  179. package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +3 -0
  180. package/lib/src/generated/rest/UpdatePerspectiveRequest.js +2 -0
  181. package/lib/src/generated/rest/UpdateProfileRequest.d.ts +5 -0
  182. package/lib/src/generated/rest/UpdateProfileRequest.js +1 -0
  183. package/lib/src/generated/rest/UserStatistics.d.ts +9 -0
  184. package/lib/src/generated/rest/UserStatistics.js +2 -0
  185. package/lib/src/generated/rest/VerificationRequestResult.d.ts +6 -0
  186. package/lib/src/generated/rest/VerificationRequestResult.js +2 -0
  187. package/lib/src/generated/rest/VerifyEmailRequest.d.ts +6 -0
  188. package/lib/src/generated/rest/VerifyEmailRequest.js +2 -0
  189. package/lib/src/generated/rest/VerifySignatureRequest.d.ts +5 -0
  190. package/lib/src/generated/rest/VerifySignatureRequest.js +2 -0
  191. package/lib/src/generated/rest/WriteSettingsRequest.d.ts +3 -0
  192. package/lib/src/generated/rest/WriteSettingsRequest.js +2 -0
  193. package/lib/src/generated/rest/index.d.ts +73 -0
  194. package/lib/src/generated/rest/index.js +8 -0
  195. package/lib/src/generated/rest/routes.d.ts +587 -0
  196. package/lib/src/generated/rest/routes.js +3 -0
  197. package/lib/src/index.d.ts +4 -0
  198. package/lib/src/index.js +4 -0
  199. package/lib/src/model/Ad4mModel.d.ts +30 -21
  200. package/lib/src/model/Ad4mModel.js +93 -316
  201. package/lib/src/model/Ad4mModel.test.js +1536 -535
  202. package/lib/src/model/ModelQueryBuilder.d.ts +5 -10
  203. package/lib/src/model/ModelQueryBuilder.js +136 -47
  204. package/lib/src/model/Subject.js +6 -6
  205. package/lib/src/model/decorators.d.ts +7 -4
  206. package/lib/src/model/decorators.js +0 -7
  207. package/lib/src/model/hydration-batch.d.ts +34 -0
  208. package/lib/src/model/hydration-batch.js +147 -0
  209. package/lib/src/model/hydration-batching.test.d.ts +7 -0
  210. package/lib/src/model/hydration-batching.test.js +456 -0
  211. package/lib/src/model/query-cache.test.d.ts +1 -0
  212. package/lib/src/model/query-cache.test.js +43 -0
  213. package/lib/src/model/query-sparql-batch.d.ts +17 -0
  214. package/lib/src/model/query-sparql-batch.js +260 -0
  215. package/lib/src/model/query-sparql.d.ts +0 -10
  216. package/lib/src/model/query-sparql.js +10 -15
  217. package/lib/src/model/query-sparql.test.d.ts +1 -0
  218. package/lib/src/model/query-sparql.test.js +230 -0
  219. package/lib/src/model/relation-filtering.test.js +15 -15
  220. package/lib/src/model/shacl-gen.js +120 -47
  221. package/lib/src/model/subscription-delta.test.d.ts +24 -0
  222. package/lib/src/model/subscription-delta.test.js +180 -0
  223. package/lib/src/model/subscription-pool.d.ts +39 -0
  224. package/lib/src/model/subscription-pool.js +165 -0
  225. package/lib/src/model/types.d.ts +140 -4
  226. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
  227. package/lib/src/perspectives/PerspectiveClient.d.ts +13 -4
  228. package/lib/src/perspectives/PerspectiveClient.js +22 -6
  229. package/lib/src/perspectives/PerspectiveClient.test.d.ts +1 -0
  230. package/lib/src/perspectives/PerspectiveClient.test.js +224 -0
  231. package/lib/src/perspectives/PerspectiveProxy.d.ts +27 -7
  232. package/lib/src/perspectives/PerspectiveProxy.js +60 -12
  233. package/lib/src/perspectives/PerspectiveProxy.test.d.ts +1 -0
  234. package/lib/src/perspectives/PerspectiveProxy.test.js +34 -0
  235. package/lib/src/perspectives/PerspectiveResolver.d.ts +0 -1
  236. package/lib/src/perspectives/PerspectiveResolver.js +0 -11
  237. package/lib/src/perspectives/SparqlBindings.d.ts +47 -0
  238. package/lib/src/perspectives/SparqlBindings.js +65 -0
  239. package/lib/src/perspectives/WakerSubscriptionManager.js +5 -4
  240. package/lib/src/restClient.d.ts +52 -0
  241. package/lib/src/restClient.js +227 -0
  242. package/lib/src/runtime/RuntimeResolver.d.ts +28 -1
  243. package/lib/src/runtime/RuntimeResolver.js +197 -4
  244. package/lib/src/schema.gql +27 -1
  245. package/lib/src/shacl/NodeExpression.d.ts +44 -0
  246. package/lib/src/shacl/NodeExpression.js +39 -0
  247. package/lib/src/shacl/SHACLShape.d.ts +23 -0
  248. package/lib/src/shacl/SHACLShape.js +115 -1
  249. package/lib/src/shacl/builders.d.ts +58 -0
  250. package/lib/src/shacl/builders.js +76 -0
  251. package/lib/src/shacl/index.d.ts +36 -0
  252. package/lib/src/shacl/index.js +33 -0
  253. package/package.json +1 -1
  254. package/src/Ad4mClient.ts +7 -2
  255. package/src/agent/AgentClient.ts +23 -0
  256. package/src/ai/AIClient.ts +1 -1
  257. package/src/apiClient.ts +17 -6
  258. package/src/index.ts +4 -0
  259. package/src/model/Ad4mModel.test.ts +274 -72
  260. package/src/model/Ad4mModel.ts +141 -350
  261. package/src/model/ModelQueryBuilder.ts +131 -56
  262. package/src/model/decorators.ts +7 -13
  263. package/src/model/query-sparql.test.ts +35 -19
  264. package/src/model/query-sparql.ts +10 -16
  265. package/src/model/relation-filtering.test.ts +46 -39
  266. package/src/model/shacl-gen.ts +128 -54
  267. package/src/model/shacl-roundtrip.test.ts +197 -0
  268. package/src/model/types-typed-query.test.ts +360 -0
  269. package/src/model/types.ts +196 -4
  270. package/src/perspectives/PerspectiveClient.ts +24 -8
  271. package/src/perspectives/PerspectiveProxy.test.ts +85 -1
  272. package/src/perspectives/PerspectiveProxy.ts +65 -20
  273. package/src/perspectives/SparqlBindings.ts +79 -0
  274. package/src/perspectives/WakerSubscriptionManager.ts +5 -4
  275. package/src/shacl/NodeExpression.ts +54 -0
  276. package/src/shacl/SHACLShape.test.ts +172 -0
  277. package/src/shacl/SHACLShape.ts +173 -1
  278. package/src/shacl/builders.ts +86 -0
  279. package/src/shacl/index.ts +72 -0
@@ -93,6 +93,16 @@ input CapabilityInput {
93
93
  with: ResourceInput!
94
94
  }
95
95
 
96
+ type ComputeLogEntry {
97
+ cost: Float!
98
+ creditsAfter: Float!
99
+ id: Float!
100
+ operation: String!
101
+ summary: String
102
+ timestamp: String!
103
+ userEmail: String!
104
+ }
105
+
96
106
  # The javascript `Date` as string. Type represents date and time as the ISO Date string.
97
107
  scalar DateTime
98
108
 
@@ -146,6 +156,7 @@ type ExpressionRendered {
146
156
 
147
157
  type HostingUserInfo {
148
158
  email: String!
159
+ freeAccess: Boolean!
149
160
  hotWalletAddress: String
150
161
  remainingCredits: String!
151
162
  }
@@ -380,6 +391,7 @@ type Mutation {
380
391
  runtimeLoginUser(email: String!, password: String!): String!
381
392
  runtimeOpenLink(url: String!): Boolean!
382
393
  runtimeQuit: Boolean!
394
+ runtimeReinstallUnytDna: PaymentRequestResult!
383
395
  runtimeRemoveFriends(dids: [String!]!): [String!]!
384
396
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
385
397
  runtimeRemoveNotification(id: String!): Boolean!
@@ -387,9 +399,14 @@ type Mutation {
387
399
  runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
388
400
  runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
389
401
  runtimeRestartHolochain: Boolean!
402
+ runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
403
+ runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
390
404
  runtimeSetHotWalletAddress(address: String!): Boolean!
391
405
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
392
406
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
407
+ runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
408
+ runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
409
+ runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
393
410
  runtimeTestEmail(to: String!): Boolean!
394
411
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
395
412
  runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
@@ -495,14 +512,18 @@ type Query {
495
512
  perspective(uuid: String!): PerspectiveHandle
496
513
  perspectiveQueryLinks(query: LinkQuery!, uuid: String!): [LinkExpression!]
497
514
  perspectiveQueryProlog(query: String!, uuid: String!): String!
498
- perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
499
515
  perspectiveSnapshot(uuid: String!): Perspective
500
516
  perspectives: [PerspectiveHandle!]!
517
+ runtimeComputeLog(limit: Float, since: String, userEmail: String): [ComputeLogEntry!]!
518
+ runtimeFreeHostingEnabled: Boolean!
501
519
  runtimeFriendStatus(did: String!): PerspectiveExpression
502
520
  runtimeFriends: [String!]!
503
521
  runtimeGetNetworkMetrics: String!
504
522
  runtimeHcAgentInfos: String!
505
523
  runtimeHostingUserInfo: HostingUserInfo!
524
+ runtimeHotAgentPubkey: String!
525
+ runtimeHotWalletBalance: String!
526
+ runtimeHotWalletHistory(page: Float, perPage: Float): String!
506
527
  runtimeInfo: RuntimeInfo!
507
528
  runtimeKnownLinkLanguageTemplates: [String!]!
508
529
  runtimeListUsers: [UserStatistics!]!
@@ -510,6 +531,8 @@ type Query {
510
531
  runtimeMessageOutbox(filter: String): [SentMessage!]!
511
532
  runtimeMultiUserEnabled: Boolean!
512
533
  runtimeNotifications: [Notification!]!
534
+ runtimeUnytAgentKey: String!
535
+ runtimeUnytVersionInfo: String!
513
536
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
514
537
  }
515
538
 
@@ -585,8 +608,11 @@ type UserCreationResult {
585
608
  type UserStatistics {
586
609
  did: String!
587
610
  email: String!
611
+ freeAccess: Boolean!
612
+ hotWalletAddress: String
588
613
  lastSeen: String
589
614
  perspectiveCount: Int!
615
+ remainingCredits: String!
590
616
  }
591
617
 
592
618
  type VerificationRequestResult {
@@ -0,0 +1,44 @@
1
+ /**
2
+ * SHACL-AF Node Expressions for property transforms.
3
+ *
4
+ * A `NodeExpression` is a JSON-serializable tree that describes how to transform
5
+ * a resolved property value. Unlike JS lambdas, these are portable, inspectable,
6
+ * and can be executed in the Rust model query engine.
7
+ *
8
+ * Each expression is a tagged union that evaluates to a `Value` (JSON-compatible).
9
+ */
10
+ /**
11
+ * Union type representing all supported transform expressions.
12
+ * Each variant maps to a SHACL-AF §6 expression construct.
13
+ */
14
+ export type NodeExpression = {
15
+ type: 'focus';
16
+ } | {
17
+ type: 'literal';
18
+ value: string | number | boolean;
19
+ } | {
20
+ type: 'path';
21
+ predicate: string;
22
+ } | {
23
+ type: 'exists';
24
+ expr: NodeExpression;
25
+ } | {
26
+ type: 'if';
27
+ cond: NodeExpression;
28
+ then: NodeExpression;
29
+ else?: NodeExpression;
30
+ } | {
31
+ type: 'concat';
32
+ args: NodeExpression[];
33
+ } | {
34
+ type: 'coalesce';
35
+ args: NodeExpression[];
36
+ } | {
37
+ type: 'function';
38
+ iri: string;
39
+ args: NodeExpression[];
40
+ };
41
+ /**
42
+ * Type guard to check if a value is a valid NodeExpression.
43
+ */
44
+ export declare function isNodeExpression(v: unknown): v is NodeExpression;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * SHACL-AF Node Expressions for property transforms.
3
+ *
4
+ * A `NodeExpression` is a JSON-serializable tree that describes how to transform
5
+ * a resolved property value. Unlike JS lambdas, these are portable, inspectable,
6
+ * and can be executed in the Rust model query engine.
7
+ *
8
+ * Each expression is a tagged union that evaluates to a `Value` (JSON-compatible).
9
+ */
10
+ /**
11
+ * Type guard to check if a value is a valid NodeExpression.
12
+ */
13
+ export function isNodeExpression(v) {
14
+ if (typeof v !== 'object' || v === null)
15
+ return false;
16
+ const obj = v;
17
+ const type = obj.type;
18
+ switch (type) {
19
+ case 'focus':
20
+ return typeof obj.type === 'string';
21
+ case 'literal':
22
+ return typeof obj.value === 'string' || typeof obj.value === 'number' || typeof obj.value === 'boolean';
23
+ case 'path':
24
+ return typeof obj.predicate === 'string';
25
+ case 'exists':
26
+ return isNodeExpression(obj.expr);
27
+ case 'if':
28
+ return isNodeExpression(obj.cond) && isNodeExpression(obj.then) &&
29
+ (obj.else === undefined || isNodeExpression(obj.else));
30
+ case 'concat':
31
+ return Array.isArray(obj.args) && obj.args.every(isNodeExpression);
32
+ case 'coalesce':
33
+ return Array.isArray(obj.args) && obj.args.every(isNodeExpression);
34
+ case 'function':
35
+ return typeof obj.iri === 'string' && Array.isArray(obj.args) && obj.args.every(isNodeExpression);
36
+ default:
37
+ return false;
38
+ }
39
+ }
@@ -1,4 +1,5 @@
1
1
  import { Link } from "../links/Links";
2
+ import type { NodeExpression } from "./NodeExpression";
2
3
  /**
3
4
  * AD4M Action - represents a link operation
4
5
  */
@@ -76,6 +77,28 @@ export interface SHACLPropertyShape {
76
77
  value: string;
77
78
  label?: string;
78
79
  }>;
80
+ /** AD4M-specific: kind of relation this property describes.
81
+ * Drives direction (forward/reverse), scalar-vs-collection rendering,
82
+ * and default max-count. */
83
+ relationKind?: 'hasMany' | 'hasOne' | 'belongsToOne' | 'belongsToMany';
84
+ /** AD4M-specific: target class name (local-name) for a relation property.
85
+ * Complements `class` (the SHACL node-shape URI) by providing the bare
86
+ * model class name used by the executor to look up the target shape
87
+ * through the perspective's shape cache. */
88
+ targetClassName?: string;
89
+ /** AD4M-specific: post-getter where-clause filter for a relation property. */
90
+ whereFilter?: any;
91
+ /** AD4M-specific: predicate-IRI lookup map for `whereFilter` keys
92
+ * (property name → predicate URI on the target class). */
93
+ wherePredicates?: Record<string, string>;
94
+ /** AD4M-specific: whether conformance/type filtering is enabled for this
95
+ * relation. `false` opts out of DB-level type filtering while keeping
96
+ * hydration via `include`. */
97
+ filter?: boolean;
98
+ /** AD4M-specific: Transform expression (SHACL-AF Node Expression).
99
+ * Applied to resolved property values in the Rust model query engine.
100
+ * Only used for properties with resolveLanguage set. */
101
+ transform?: NodeExpression;
79
102
  }
80
103
  /**
81
104
  * SHACL Node Shape
@@ -1,3 +1,4 @@
1
+ import { isNodeExpression } from "./NodeExpression";
1
2
  /**
2
3
  * Extract namespace from a URI
3
4
  * Examples:
@@ -328,7 +329,7 @@ export class SHACLShape {
328
329
  target: `literal:${prop.writable}`
329
330
  });
330
331
  }
331
- if (prop.resolveLanguage) {
332
+ if (prop.resolveLanguage != null) {
332
333
  links.push({
333
334
  source: propShapeId,
334
335
  predicate: "ad4m://resolveLanguage",
@@ -385,6 +386,48 @@ export class SHACLShape {
385
386
  target: `literal:string:${JSON.stringify(prop.in)}`
386
387
  });
387
388
  }
389
+ if (prop.relationKind) {
390
+ links.push({
391
+ source: propShapeId,
392
+ predicate: "ad4m://relationKind",
393
+ target: `literal:string:${prop.relationKind}`
394
+ });
395
+ }
396
+ if (prop.targetClassName) {
397
+ links.push({
398
+ source: propShapeId,
399
+ predicate: "ad4m://targetClassName",
400
+ target: `literal:string:${prop.targetClassName}`
401
+ });
402
+ }
403
+ if (prop.whereFilter !== undefined && prop.whereFilter !== null) {
404
+ links.push({
405
+ source: propShapeId,
406
+ predicate: "ad4m://whereFilter",
407
+ target: `literal:string:${JSON.stringify(prop.whereFilter)}`
408
+ });
409
+ }
410
+ if (prop.wherePredicates && Object.keys(prop.wherePredicates).length > 0) {
411
+ links.push({
412
+ source: propShapeId,
413
+ predicate: "ad4m://wherePredicates",
414
+ target: `literal:string:${JSON.stringify(prop.wherePredicates)}`
415
+ });
416
+ }
417
+ if (prop.filter !== undefined) {
418
+ links.push({
419
+ source: propShapeId,
420
+ predicate: "ad4m://filter",
421
+ target: `literal:${prop.filter}`
422
+ });
423
+ }
424
+ if (prop.transform && typeof prop.transform === 'object') {
425
+ links.push({
426
+ source: propShapeId,
427
+ predicate: "ad4m://transform",
428
+ target: `literal:string:${JSON.stringify(prop.transform)}`
429
+ });
430
+ }
388
431
  }
389
432
  return links;
390
433
  }
@@ -566,6 +609,60 @@ export class SHACLShape {
566
609
  // Ignore parse errors
567
610
  }
568
611
  }
612
+ const relationKindLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://relationKind");
613
+ if (relationKindLink) {
614
+ const val = relationKindLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
615
+ if (val === 'hasMany' || val === 'hasOne' || val === 'belongsToOne' || val === 'belongsToMany') {
616
+ prop.relationKind = val;
617
+ }
618
+ }
619
+ const targetClassNameLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://targetClassName");
620
+ if (targetClassNameLink) {
621
+ prop.targetClassName = targetClassNameLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
622
+ }
623
+ const whereFilterLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://whereFilter");
624
+ if (whereFilterLink) {
625
+ try {
626
+ const jsonStr = whereFilterLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
627
+ prop.whereFilter = JSON.parse(jsonStr);
628
+ }
629
+ catch (e) {
630
+ // Ignore parse errors
631
+ }
632
+ }
633
+ const wherePredicatesLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://wherePredicates");
634
+ if (wherePredicatesLink) {
635
+ try {
636
+ const jsonStr = wherePredicatesLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
637
+ prop.wherePredicates = JSON.parse(jsonStr);
638
+ }
639
+ catch (e) {
640
+ // Ignore parse errors
641
+ }
642
+ }
643
+ const filterLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://filter");
644
+ if (filterLink) {
645
+ let val = filterLink.target.replace(/^literal:\/\/|^literal:/, '');
646
+ if (val.startsWith('boolean:'))
647
+ val = val.substring(8);
648
+ prop.filter = val === 'true';
649
+ }
650
+ const transformLink = links.find(l => l.source === propShapeId && l.predicate === "ad4m://transform");
651
+ if (transformLink) {
652
+ const jsonStr = transformLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
653
+ try {
654
+ const parsed = JSON.parse(jsonStr);
655
+ if (!isNodeExpression(parsed)) {
656
+ throw new Error(`Invalid transform for property ${propShapeId}: ` +
657
+ `payload is not a valid NodeExpression. Received: ${jsonStr}`);
658
+ }
659
+ prop.transform = parsed;
660
+ }
661
+ catch (e) {
662
+ throw new Error(`Failed to deserialize transform for property ${propShapeId}: ` +
663
+ `${e instanceof Error ? e.message : String(e)}. Payload: ${jsonStr}`);
664
+ }
665
+ }
569
666
  shape.addProperty(prop);
570
667
  }
571
668
  return shape;
@@ -602,6 +699,12 @@ export class SHACLShape {
602
699
  conformance_conditions: p.conformanceConditions,
603
700
  class: p.class,
604
701
  in: p.in,
702
+ relation_kind: p.relationKind,
703
+ target_class_name: p.targetClassName,
704
+ where_filter: p.whereFilter,
705
+ where_predicates: p.wherePredicates,
706
+ filter: p.filter,
707
+ transform: p.transform,
605
708
  })),
606
709
  constructor_actions: this.constructor_actions,
607
710
  destructor_actions: this.destructor_actions,
@@ -615,6 +718,11 @@ export class SHACLShape {
615
718
  ? new SHACLShape(json.node_shape_uri, json.target_class)
616
719
  : new SHACLShape(json.target_class);
617
720
  for (const p of json.properties || []) {
721
+ // Validate transform if present
722
+ if (p.transform && !isNodeExpression(p.transform)) {
723
+ throw new Error(`Invalid transform for property ${p.name}: ` +
724
+ `payload is not a valid NodeExpression. Received: ${JSON.stringify(p.transform)}`);
725
+ }
618
726
  shape.addProperty({
619
727
  path: p.path,
620
728
  name: p.name,
@@ -636,6 +744,12 @@ export class SHACLShape {
636
744
  conformanceConditions: p.conformance_conditions,
637
745
  class: p.class,
638
746
  in: p.in,
747
+ relationKind: p.relation_kind,
748
+ targetClassName: p.target_class_name,
749
+ whereFilter: p.where_filter,
750
+ wherePredicates: p.where_predicates,
751
+ filter: p.filter,
752
+ transform: p.transform,
639
753
  });
640
754
  }
641
755
  if (json.constructor_actions) {
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Builder functions for SHACL-AF Node Expressions.
3
+ *
4
+ * These functions construct JSON-serializable expression trees for property transforms.
5
+ * All builders return frozen objects to prevent accidental mutation.
6
+ */
7
+ import type { NodeExpression } from './NodeExpression';
8
+ /**
9
+ * Identity expression: pass the focus node through unchanged.
10
+ */
11
+ export declare function focus(): NodeExpression;
12
+ /**
13
+ * Literal constant expression.
14
+ */
15
+ export declare function literal(value: string | number | boolean): NodeExpression;
16
+ /**
17
+ * Path expression: navigate to a property on the resolved object.
18
+ * The predicate can be a full IRI (e.g., "file_storage://data_base64")
19
+ * or a simple property name. The Rust evaluator will strip the namespace.
20
+ */
21
+ export declare function path(predicate: string): NodeExpression;
22
+ /**
23
+ * Existence check: returns true if the inner expression is non-null and non-empty.
24
+ */
25
+ export declare function exists(expr: NodeExpression): NodeExpression;
26
+ /**
27
+ * Conditional expression with optional else branch.
28
+ * Returns a chainable builder that supports `.then()` and `.else()`.
29
+ */
30
+ export declare function ifExpr(cond: NodeExpression): {
31
+ then: (thenExpr: NodeExpression) => {
32
+ else: (elseExpr?: NodeExpression) => Readonly<{
33
+ readonly else: NodeExpression;
34
+ readonly type: "if";
35
+ readonly cond: NodeExpression;
36
+ readonly then: NodeExpression;
37
+ }>;
38
+ toExpression: () => Readonly<{
39
+ readonly type: "if";
40
+ readonly cond: NodeExpression;
41
+ readonly then: NodeExpression;
42
+ }>;
43
+ };
44
+ };
45
+ /**
46
+ * String concatenation: joins evaluated arguments as strings.
47
+ * Null/undefined arguments are skipped.
48
+ */
49
+ export declare function concat(...args: NodeExpression[]): NodeExpression;
50
+ /**
51
+ * Coalesce: returns the first non-null evaluated argument.
52
+ */
53
+ export declare function coalesce(...args: NodeExpression[]): NodeExpression;
54
+ /**
55
+ * Function call: invoke a named transform function by IRI.
56
+ * Primarily used for built-in functions like "ad4m://fn/defaultFileDecode".
57
+ */
58
+ export declare function fn(iri: string, args?: NodeExpression[]): NodeExpression;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Builder functions for SHACL-AF Node Expressions.
3
+ *
4
+ * These functions construct JSON-serializable expression trees for property transforms.
5
+ * All builders return frozen objects to prevent accidental mutation.
6
+ */
7
+ /**
8
+ * Identity expression: pass the focus node through unchanged.
9
+ */
10
+ export function focus() {
11
+ return Object.freeze({ type: 'focus' });
12
+ }
13
+ /**
14
+ * Literal constant expression.
15
+ */
16
+ export function literal(value) {
17
+ return Object.freeze({ type: 'literal', value });
18
+ }
19
+ /**
20
+ * Path expression: navigate to a property on the resolved object.
21
+ * The predicate can be a full IRI (e.g., "file_storage://data_base64")
22
+ * or a simple property name. The Rust evaluator will strip the namespace.
23
+ */
24
+ export function path(predicate) {
25
+ return Object.freeze({ type: 'path', predicate });
26
+ }
27
+ /**
28
+ * Existence check: returns true if the inner expression is non-null and non-empty.
29
+ */
30
+ export function exists(expr) {
31
+ return Object.freeze({ type: 'exists', expr });
32
+ }
33
+ /**
34
+ * Conditional expression with optional else branch.
35
+ * Returns a chainable builder that supports `.then()` and `.else()`.
36
+ */
37
+ export function ifExpr(cond) {
38
+ return {
39
+ then: (thenExpr) => ({
40
+ else: (elseExpr) => {
41
+ return Object.freeze({
42
+ type: 'if',
43
+ cond,
44
+ then: thenExpr,
45
+ ...(elseExpr !== undefined && { else: elseExpr }),
46
+ });
47
+ },
48
+ // Allow chaining without explicit else()
49
+ toExpression: () => Object.freeze({
50
+ type: 'if',
51
+ cond,
52
+ then: thenExpr,
53
+ }),
54
+ }),
55
+ };
56
+ }
57
+ /**
58
+ * String concatenation: joins evaluated arguments as strings.
59
+ * Null/undefined arguments are skipped.
60
+ */
61
+ export function concat(...args) {
62
+ return Object.freeze({ type: 'concat', args });
63
+ }
64
+ /**
65
+ * Coalesce: returns the first non-null evaluated argument.
66
+ */
67
+ export function coalesce(...args) {
68
+ return Object.freeze({ type: 'coalesce', args });
69
+ }
70
+ /**
71
+ * Function call: invoke a named transform function by IRI.
72
+ * Primarily used for built-in functions like "ad4m://fn/defaultFileDecode".
73
+ */
74
+ export function fn(iri, args = []) {
75
+ return Object.freeze({ type: 'function', iri, args });
76
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * SHACL-AF Transform DSL — public API
3
+ *
4
+ * Re-exports builder functions and provides common built-in transforms.
5
+ */
6
+ import { focus, literal, path, exists, ifExpr, concat, coalesce, fn } from './builders';
7
+ export type { NodeExpression } from './NodeExpression';
8
+ export { isNodeExpression } from './NodeExpression';
9
+ export { focus, literal, path, exists, ifExpr, concat, coalesce, fn, };
10
+ /**
11
+ * Built-in transform: FileData → data: URI
12
+ *
13
+ * Converts a file stored via FILE_STORAGE_LANGUAGE into a data: URL.
14
+ * If the object has a `data_base64` field, returns:
15
+ * `data:{file_type};base64,{data_base64}`
16
+ * Otherwise passes through the input unchanged.
17
+ *
18
+ * This is the Rust equivalent of the JS `defaultFileDecode` function.
19
+ *
20
+ * Usage:
21
+ * ```typescript
22
+ * @Property({
23
+ * through: 'we://image',
24
+ * resolveLanguage: FILE_STORAGE_LANGUAGE,
25
+ * transform: fileToDataUri,
26
+ * })
27
+ * avatar?: string;
28
+ * ```
29
+ */
30
+ export declare const fileToDataUri: Readonly<{
31
+ readonly else: import("./NodeExpression").NodeExpression;
32
+ readonly type: "if";
33
+ readonly cond: import("./NodeExpression").NodeExpression;
34
+ readonly then: import("./NodeExpression").NodeExpression;
35
+ }>;
36
+ export { SHACLShape, SHACLPropertyShape, AD4MAction, ConformanceCondition, } from './SHACLShape';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * SHACL-AF Transform DSL — public API
3
+ *
4
+ * Re-exports builder functions and provides common built-in transforms.
5
+ */
6
+ import { focus, literal, path, exists, ifExpr, concat, coalesce, fn, } from './builders';
7
+ export { isNodeExpression } from './NodeExpression';
8
+ export { focus, literal, path, exists, ifExpr, concat, coalesce, fn, };
9
+ /**
10
+ * Built-in transform: FileData → data: URI
11
+ *
12
+ * Converts a file stored via FILE_STORAGE_LANGUAGE into a data: URL.
13
+ * If the object has a `data_base64` field, returns:
14
+ * `data:{file_type};base64,{data_base64}`
15
+ * Otherwise passes through the input unchanged.
16
+ *
17
+ * This is the Rust equivalent of the JS `defaultFileDecode` function.
18
+ *
19
+ * Usage:
20
+ * ```typescript
21
+ * @Property({
22
+ * through: 'we://image',
23
+ * resolveLanguage: FILE_STORAGE_LANGUAGE,
24
+ * transform: fileToDataUri,
25
+ * })
26
+ * avatar?: string;
27
+ * ```
28
+ */
29
+ export const fileToDataUri = ifExpr(exists(path('file_storage://data_base64')))
30
+ .then(concat(literal('data:'), coalesce(path('file_storage://file_type'), literal('image/png')), literal(';base64,'), path('file_storage://data_base64')))
31
+ .else(focus());
32
+ // Re-export SHACL types for convenience
33
+ export { SHACLShape, } from './SHACLShape';
package/package.json CHANGED
@@ -57,5 +57,5 @@
57
57
  "pnpm": {
58
58
  "patchedDependencies": {}
59
59
  },
60
- "version": "0.13.0-test-6"
60
+ "version": "0.13.0-test-8"
61
61
  }
package/src/Ad4mClient.ts CHANGED
@@ -29,10 +29,15 @@ export class Ad4mClient {
29
29
  #runtimeClient: RuntimeClient
30
30
  #aiClient: AIClient
31
31
 
32
- constructor(baseUrl: string, token?: string, subscribe: boolean = true) {
32
+ constructor(
33
+ baseUrl: string,
34
+ token?: string,
35
+ subscribe: boolean = true,
36
+ options?: { webSocketImpl?: new (url: string) => WebSocket; fetchImpl?: typeof fetch }
37
+ ) {
33
38
  this.#baseUrl = baseUrl
34
39
  this.#token = token
35
- this.#apiClient = new ApiClient(baseUrl, token)
40
+ this.#apiClient = new ApiClient(baseUrl, token, options?.webSocketImpl, options?.fetchImpl)
36
41
  this.#agentClient = new AgentClient(baseUrl, token, subscribe, this.#apiClient)
37
42
  this.#expressionClient = new ExpressionClient(baseUrl, token, this.#apiClient)
38
43
  this.#languageClient = new LanguageClient(baseUrl, token, this.#apiClient)
@@ -82,6 +82,13 @@ export class AgentClient {
82
82
  const agent = await this.#apiClient.call<Agent>('agent.get');
83
83
  let agentObject = new Agent(agent.did, agent.perspective);
84
84
  agentObject.directMessageLanguage = agent.directMessageLanguage;
85
+
86
+ // Auto-set selfDid so event-driven cache invalidation works
87
+ // without requiring apps to call setSelfDid() manually
88
+ if (agentObject.did && !this.#selfDid) {
89
+ this.#selfDid = agentObject.did;
90
+ }
91
+
85
92
  return agentObject;
86
93
  }
87
94
 
@@ -186,6 +193,14 @@ export class AgentClient {
186
193
  const a = await this.#apiClient.call<Agent>('agent.updateProfile', { publicPerspective: cleanedPerspective });
187
194
  const agent = new Agent(a.did, a.perspective);
188
195
  agent.directMessageLanguage = a.directMessageLanguage;
196
+
197
+ // Immediately update byDID cache so subsequent byDID() calls
198
+ // return fresh data without waiting for the subscription event
199
+ if (agent.did) {
200
+ this.#memCache.set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
201
+ this.#persistent.put(agent.did, agent); // fire-and-forget
202
+ }
203
+
189
204
  return agent;
190
205
  }
191
206
 
@@ -216,6 +231,14 @@ export class AgentClient {
216
231
  const a = await this.#apiClient.call<Agent>('agent.updateProfile', { dmLanguage: directMessageLanguage });
217
232
  const agent = new Agent(a.did, a.perspective);
218
233
  agent.directMessageLanguage = a.directMessageLanguage;
234
+
235
+ // Immediately update byDID cache so subsequent byDID() calls
236
+ // return fresh data without waiting for the subscription event
237
+ if (agent.did) {
238
+ this.#memCache.set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
239
+ this.#persistent.put(agent.did, agent); // fire-and-forget
240
+ }
241
+
219
242
  return agent;
220
243
  }
221
244
 
@@ -156,7 +156,7 @@ export class AIClient {
156
156
  typedAudio.byteOffset + typedAudio.byteLength
157
157
  );
158
158
 
159
- const response = await fetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
159
+ const response = await this.#apiClient.doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
160
160
  method: 'POST',
161
161
  headers: {
162
162
  'Content-Type': 'application/octet-stream',