@coasys/ad4m 0.10.0 → 0.10.1-multi-user-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 (72) hide show
  1. package/lib/index.cjs +3730 -906
  2. package/lib/index.js +3722 -902
  3. package/lib/src/Ad4mClient.js +2 -1
  4. package/lib/src/Literal.js +4 -1
  5. package/lib/src/agent/Agent.d.ts +12 -0
  6. package/lib/src/agent/Agent.js +48 -0
  7. package/lib/src/agent/AgentClient.d.ts +3 -1
  8. package/lib/src/agent/AgentClient.js +23 -0
  9. package/lib/src/ai/AIClient.d.ts +8 -2
  10. package/lib/src/ai/AIClient.js +25 -14
  11. package/lib/src/ai/AIResolver.d.ts +25 -6
  12. package/lib/src/ai/AIResolver.js +102 -18
  13. package/lib/src/index.d.ts +4 -3
  14. package/lib/src/index.js +4 -3
  15. package/lib/src/language/Language.d.ts +12 -1
  16. package/lib/src/model/Ad4mModel.d.ts +622 -0
  17. package/lib/src/model/Ad4mModel.js +1118 -0
  18. package/lib/src/{subject → model}/Subject.d.ts +2 -2
  19. package/lib/src/{subject → model}/Subject.js +18 -18
  20. package/lib/src/model/decorators.d.ts +502 -0
  21. package/lib/src/model/decorators.js +683 -0
  22. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +2 -2
  23. package/lib/src/neighbourhood/NeighbourhoodClient.js +13 -10
  24. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -2
  25. package/lib/src/neighbourhood/NeighbourhoodProxy.js +4 -4
  26. package/lib/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  27. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +73 -0
  28. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +2 -2
  29. package/lib/src/neighbourhood/NeighbourhoodResolver.js +6 -4
  30. package/lib/src/perspectives/PerspectiveClient.d.ts +23 -11
  31. package/lib/src/perspectives/PerspectiveClient.js +147 -51
  32. package/lib/src/perspectives/PerspectiveProxy.d.ts +494 -54
  33. package/lib/src/perspectives/PerspectiveProxy.js +684 -67
  34. package/lib/src/perspectives/PerspectiveResolver.d.ts +24 -9
  35. package/lib/src/perspectives/PerspectiveResolver.js +151 -46
  36. package/lib/src/runtime/RuntimeClient.d.ts +11 -2
  37. package/lib/src/runtime/RuntimeClient.js +94 -0
  38. package/lib/src/runtime/RuntimeResolver.d.ts +36 -1
  39. package/lib/src/runtime/RuntimeResolver.js +193 -0
  40. package/lib/src/schema.gql +65 -16
  41. package/lib/src/typeDefs.js +65 -16
  42. package/package.json +4 -3
  43. package/src/Ad4mClient.test.ts +51 -19
  44. package/src/Ad4mClient.ts +3 -1
  45. package/src/Literal.ts +4 -1
  46. package/src/agent/Agent.ts +36 -0
  47. package/src/agent/AgentClient.ts +30 -0
  48. package/src/ai/AIClient.ts +35 -14
  49. package/src/ai/AIResolver.ts +78 -16
  50. package/src/index.ts +4 -3
  51. package/src/language/Language.ts +16 -4
  52. package/src/model/Ad4mModel.ts +1279 -0
  53. package/src/{subject → model}/Subject.ts +16 -16
  54. package/src/{subject/SDNADecorators.ts → model/decorators.ts} +384 -50
  55. package/src/neighbourhood/NeighbourhoodClient.ts +13 -10
  56. package/src/neighbourhood/NeighbourhoodProxy.test.ts +100 -0
  57. package/src/neighbourhood/NeighbourhoodProxy.ts +4 -4
  58. package/src/neighbourhood/NeighbourhoodResolver.ts +2 -2
  59. package/src/perspectives/PerspectiveClient.ts +156 -51
  60. package/src/perspectives/PerspectiveProxy.ts +766 -82
  61. package/src/perspectives/PerspectiveResolver.ts +134 -23
  62. package/src/runtime/RuntimeClient.ts +104 -2
  63. package/src/runtime/RuntimeResolver.ts +126 -1
  64. package/lib/src/subject/SDNADecorators.d.ts +0 -188
  65. package/lib/src/subject/SDNADecorators.js +0 -360
  66. package/lib/src/subject/SubjectEntity.d.ts +0 -102
  67. package/lib/src/subject/SubjectEntity.js +0 -267
  68. package/src/subject/SubjectEntity.ts +0 -315
  69. package/yarn-error.log +0 -90
  70. /package/lib/src/{subject → model}/util.d.ts +0 -0
  71. /package/lib/src/{subject → model}/util.js +0 -0
  72. /package/src/{subject → model}/util.ts +0 -0
@@ -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;
@@ -291,3 +291,39 @@ export class AuthInfoInput {
291
291
  this.appIconPath = appIconPath;
292
292
  }
293
293
  }
294
+
295
+ @ObjectType()
296
+ export class User {
297
+ @Field()
298
+ username: string;
299
+
300
+ @Field()
301
+ did: string;
302
+
303
+ @Field()
304
+ password: string;
305
+
306
+ constructor(username: string, did: string, password: string) {
307
+ this.username = username;
308
+ this.did = did;
309
+ this.password = password;
310
+ }
311
+ }
312
+
313
+ @ObjectType()
314
+ export class UserCreationResult {
315
+ @Field()
316
+ did: string;
317
+
318
+ @Field()
319
+ success: boolean;
320
+
321
+ @Field({ nullable: true })
322
+ error?: string;
323
+
324
+ constructor(did: string, success: boolean, error?: string) {
325
+ this.did = did;
326
+ this.success = success;
327
+ this.error = error;
328
+ }
329
+ }
@@ -8,6 +8,7 @@ import {
8
8
  AuthInfoInput,
9
9
  EntanglementProof,
10
10
  EntanglementProofInput,
11
+ UserCreationResult,
11
12
  } from "./Agent";
12
13
  import { AgentStatus } from "./AgentStatus";
13
14
  import { LinkMutations } from "../links/Links";
@@ -528,4 +529,33 @@ export class AgentClient {
528
529
  );
529
530
  return agentSignMessage;
530
531
  }
532
+
533
+ // Multi-user methods
534
+ async createUser(email: string, password: string): Promise<UserCreationResult> {
535
+ const { runtimeCreateUser } = unwrapApolloResult(
536
+ await this.#apolloClient.mutate({
537
+ mutation: gql`mutation runtimeCreateUser($email: String!, $password: String!) {
538
+ runtimeCreateUser(email: $email, password: $password) {
539
+ did
540
+ success
541
+ error
542
+ }
543
+ }`,
544
+ variables: { email, password },
545
+ })
546
+ );
547
+ return runtimeCreateUser;
548
+ }
549
+
550
+ async loginUser(email: string, password: string): Promise<string> {
551
+ const { runtimeLoginUser } = unwrapApolloResult(
552
+ await this.#apolloClient.mutate({
553
+ mutation: gql`mutation runtimeLoginUser($email: String!, $password: String!) {
554
+ runtimeLoginUser(email: $email, password: $password)
555
+ }`,
556
+ variables: { email, password },
557
+ })
558
+ );
559
+ return runtimeLoginUser;
560
+ }
531
561
  }
@@ -28,8 +28,13 @@ export class AIClient {
28
28
  }
29
29
  local {
30
30
  fileName
31
- tokenizerSource
32
- modelParameters
31
+ tokenizerSource {
32
+ repo
33
+ revision
34
+ fileName
35
+ }
36
+ huggingfaceRepo
37
+ revision
33
38
  }
34
39
  modelType
35
40
  }
@@ -102,8 +107,13 @@ export class AIClient {
102
107
  }
103
108
  local {
104
109
  fileName
105
- tokenizerSource
106
- modelParameters
110
+ tokenizerSource {
111
+ repo
112
+ revision
113
+ fileName
114
+ }
115
+ huggingfaceRepo
116
+ revision
107
117
  }
108
118
  modelType
109
119
  }
@@ -283,15 +293,26 @@ export class AIClient {
283
293
  return decompressed;
284
294
  }
285
295
 
286
- async openTranscriptionStream(modelId: string, streamCallback: (text: string) => void): Promise<string> {
296
+ async openTranscriptionStream(
297
+ modelId: string,
298
+ streamCallback: (text: string) => void,
299
+ params?: {
300
+ startThreshold?: number;
301
+ startWindow?: number;
302
+ endThreshold?: number;
303
+ endWindow?: number;
304
+ timeBeforeSpeech?: number;
305
+ }
306
+ ): Promise<string> {
287
307
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
288
308
  mutation: gql`
289
- mutation AiOpenTranscriptionStream($modelId: String!) {
290
- aiOpenTranscriptionStream(modelId: $modelId)
309
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
310
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
291
311
  }
292
312
  `,
293
313
  variables: {
294
- modelId
314
+ modelId,
315
+ params
295
316
  }
296
317
  }));
297
318
 
@@ -336,19 +357,19 @@ export class AIClient {
336
357
  return aiCloseTranscriptionStream;
337
358
  }
338
359
 
339
- async feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void> {
340
- const { feedTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
360
+ async feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void> {
361
+ const { aiFeedTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
341
362
  mutation: gql`
342
- mutation AiFeedTranscriptionStream($streamId: String!, $audio: [Float!]!) {
343
- aiFeedTranscriptionStream(streamId: $streamId, audio: $audio)
363
+ mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
364
+ aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
344
365
  }
345
366
  `,
346
367
  variables: {
347
- streamId,
368
+ streamIds: Array.isArray(streamIds) ? streamIds : [streamIds],
348
369
  audio: audio
349
370
  }
350
371
  }));
351
372
 
352
- return feedTranscriptionStream;
373
+ return aiFeedTranscriptionStream;
353
374
  }
354
375
  }
@@ -24,15 +24,30 @@ export class ModelApi {
24
24
  }
25
25
 
26
26
  @ObjectType()
27
- export class LocalModel {
27
+ export class TokenizerSource {
28
28
  @Field()
29
- fileName: string;
29
+ repo: string;
30
30
 
31
31
  @Field()
32
- tokenizerSource: string;
32
+ revision: string;
33
33
 
34
34
  @Field()
35
- modelParameters: string;
35
+ fileName: string;
36
+ }
37
+
38
+ @ObjectType()
39
+ export class LocalModel {
40
+ @Field()
41
+ fileName: string;
42
+
43
+ @Field({ nullable: true })
44
+ tokenizerSource?: TokenizerSource;
45
+
46
+ @Field({ nullable: true })
47
+ huggingfaceRepo?: string;
48
+
49
+ @Field({ nullable: true })
50
+ revision?: string;
36
51
  }
37
52
 
38
53
  export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
@@ -71,15 +86,30 @@ export class ModelApiInput {
71
86
  }
72
87
 
73
88
  @InputType()
74
- export class LocalModelInput {
89
+ export class TokenizerSourceInput {
75
90
  @Field()
76
- fileName: string;
91
+ repo: string;
77
92
 
78
93
  @Field()
79
- tokenizerSource: string;
94
+ revision: string;
80
95
 
81
96
  @Field()
82
- modelParameters: string;
97
+ fileName: string;
98
+ }
99
+
100
+ @InputType()
101
+ export class LocalModelInput {
102
+ @Field()
103
+ fileName: string;
104
+
105
+ @Field({ nullable: true })
106
+ tokenizerSource?: TokenizerSourceInput;
107
+
108
+ @Field({ nullable: true })
109
+ huggingfaceRepo?: string;
110
+
111
+ @Field({ nullable: true })
112
+ revision?: string;
83
113
  }
84
114
 
85
115
  @InputType()
@@ -97,6 +127,24 @@ export class ModelInput {
97
127
  modelType: ModelType;
98
128
  }
99
129
 
130
+ @InputType()
131
+ export class VoiceActivityParamsInput {
132
+ @Field(() => Float, { nullable: true })
133
+ startThreshold?: number;
134
+
135
+ @Field(() => Float, { nullable: true })
136
+ startWindow?: number;
137
+
138
+ @Field(() => Float, { nullable: true })
139
+ endThreshold?: number;
140
+
141
+ @Field(() => Float, { nullable: true })
142
+ endWindow?: number;
143
+
144
+ @Field(() => Float, { nullable: true })
145
+ timeBeforeSpeech?: number;
146
+ }
147
+
100
148
  @Resolver()
101
149
  export default class AIResolver {
102
150
  @Query(returns => [Model])
@@ -113,8 +161,13 @@ export default class AIResolver {
113
161
  },
114
162
  local: {
115
163
  fileName: "test-model.bin",
116
- tokenizerSource: "test-tokenizer",
117
- modelParameters: "{}"
164
+ tokenizerSource: {
165
+ repo: "test-repo",
166
+ revision: "main",
167
+ fileName: "tokenizer.json"
168
+ },
169
+ huggingfaceRepo: "test-repo",
170
+ revision: "main"
118
171
  },
119
172
  modelType: "LLM"
120
173
  }
@@ -165,8 +218,13 @@ export default class AIResolver {
165
218
  },
166
219
  local: {
167
220
  fileName: "test-model.bin",
168
- tokenizerSource: "test-tokenizer",
169
- modelParameters: "{}"
221
+ tokenizerSource: {
222
+ repo: "test-repo",
223
+ revision: "main",
224
+ fileName: "tokenizer.json"
225
+ },
226
+ huggingfaceRepo: "test-repo",
227
+ revision: "main"
170
228
  },
171
229
  modelType: modelType
172
230
  }
@@ -279,7 +337,8 @@ export default class AIResolver {
279
337
 
280
338
  @Mutation(() => String)
281
339
  aiOpenTranscriptionStream(
282
- @Arg("modelId") modelId: string
340
+ @Arg("modelId") modelId: string,
341
+ @Arg("params", () => VoiceActivityParamsInput, { nullable: true }) params?: VoiceActivityParamsInput
283
342
  ): string {
284
343
  return "streamId"
285
344
  }
@@ -293,12 +352,15 @@ export default class AIResolver {
293
352
 
294
353
  @Mutation(() => String)
295
354
  aiFeedTranscriptionStream(
296
- @Arg("streamId") streamId: string,
355
+ @Arg("streamIds", type => [String]) streamIds: string[],
297
356
  @Arg("audio", () => [Float]) audio: number[],
298
357
  @PubSub() pubSub: any
299
358
  ): boolean {
300
- pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
301
- return true
359
+ // Publish for each stream ID
360
+ for (const streamId of streamIds) {
361
+ pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
362
+ }
363
+ return true;
302
364
  }
303
365
 
304
366
  @Subscription({ topics: AI_TRANSCRIPTION_TEXT_TOPIC, nullable: false })
package/src/index.ts CHANGED
@@ -19,14 +19,15 @@ export * from "./perspectives/PerspectiveProxy";
19
19
  export * from "./perspectives/PerspectiveDiff";
20
20
  export * from "./perspectives/LinkQuery";
21
21
  export * from "./SmartLiteral";
22
- export * from "./subject/SDNADecorators";
23
- export * from "./subject/Subject";
22
+ export * from "./model/decorators";
23
+ export * from "./model/Subject";
24
24
  export * from "./neighbourhood/Neighbourhood";
25
25
  export * from "./neighbourhood/NeighbourhoodProxy";
26
26
  export * from "./typeDefs";
27
27
  export * from "./DID";
28
28
  export * from "./utils";
29
- export * from './subject/SubjectEntity'
30
29
  export * from "./agent/AgentClient";
31
30
  export * from "./ai/AIClient"
32
31
  export * from "./ai/Tasks"
32
+ export * from "./runtime/RuntimeResolver"
33
+ export * from './model/Ad4mModel'
@@ -168,10 +168,10 @@ export interface LinkSyncAdapter {
168
168
  /** What revision are we on now -> what changes are included in output of render() */
169
169
  currentRevision(): Promise<string>;
170
170
 
171
- /**
172
- * Check for and get new changes,
171
+ /**
172
+ * Check for and get new changes,
173
173
  * notify others of local changes.
174
- * This function will be called every
174
+ * This function will be called every
175
175
  * few seconds by the ad4m-executor.
176
176
  * */
177
177
  sync(): Promise<PerspectiveDiff>;
@@ -187,6 +187,18 @@ export interface LinkSyncAdapter {
187
187
 
188
188
  /** Add a sync state callback method */
189
189
  addSyncStateChangeCallback(callback: SyncStateChangeObserver);
190
+
191
+ /**
192
+ * Set the local agents (DIDs) that own this perspective/neighbourhood.
193
+ * This is used to determine which agents should be registered in the DHT.
194
+ * Optional - if not implemented, all local agents may be registered.
195
+ *
196
+ * This is a temporary hack to support multiple users on one node joining the same neighbourhood.
197
+ * Once we migrate the LanguageController to Rust and run Languages per user, each user will get their
198
+ * own language instance and we won't need to explicitly set local agents. This will provide better
199
+ * isolation and avoid the need to share language state between users.
200
+ */
201
+ setLocalAgents?(agents: DID[]): void;
190
202
  }
191
203
 
192
204
  export type MessageCallback = (message: PerspectiveExpression) => void;
@@ -255,7 +267,7 @@ export class OnlineAgent {
255
267
  status: PerspectiveExpression
256
268
  }
257
269
 
258
- export type TelepresenceSignalCallback = (payload: PerspectiveExpression) => void;
270
+ export type TelepresenceSignalCallback = (payload: PerspectiveExpression, recipientDid?: string) => void;
259
271
  export interface TelepresenceAdapter {
260
272
  setOnlineStatus(status: PerspectiveExpression): Promise<void>;
261
273
  getOnlineAgents(): Promise<OnlineAgent[]>;