@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
@@ -41,11 +41,12 @@ export class Ad4mClient {
41
41
  __classPrivateFieldSet(this, _Ad4mClient_expressionClient, new ExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
42
42
  __classPrivateFieldSet(this, _Ad4mClient_languageClient, new LanguageClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
43
43
  __classPrivateFieldSet(this, _Ad4mClient_neighbourhoodClient, new NeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
44
+ __classPrivateFieldSet(this, _Ad4mClient_aiClient, new AIClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
44
45
  __classPrivateFieldSet(this, _Ad4mClient_perspectiveClient, new PerspectiveClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
45
46
  __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f"));
46
47
  __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f"));
48
+ __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setAIClient(__classPrivateFieldGet(this, _Ad4mClient_aiClient, "f"));
47
49
  __classPrivateFieldSet(this, _Ad4mClient_runtimeClient, new RuntimeClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
48
- __classPrivateFieldSet(this, _Ad4mClient_aiClient, new AIClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
49
50
  }
50
51
  get agent() {
51
52
  return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
@@ -34,7 +34,7 @@ export class Literal {
34
34
  toUrl() {
35
35
  if (__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
36
36
  return __classPrivateFieldGet(this, _Literal_url, "f");
37
- if (!__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
37
+ if (!__classPrivateFieldGet(this, _Literal_url, "f") && (__classPrivateFieldGet(this, _Literal_literal, "f") === undefined || __classPrivateFieldGet(this, _Literal_literal, "f") === "" || __classPrivateFieldGet(this, _Literal_literal, "f") === null))
38
38
  throw new Error("Can't turn empty Literal into URL");
39
39
  let encoded;
40
40
  switch (typeof __classPrivateFieldGet(this, _Literal_literal, "f")) {
@@ -44,6 +44,9 @@ export class Literal {
44
44
  case 'number':
45
45
  encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
46
46
  break;
47
+ case 'boolean':
48
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
49
+ break;
47
50
  case 'object':
48
51
  encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet(this, _Literal_literal, "f")))}`;
49
52
  break;
@@ -101,4 +101,16 @@ export declare class AuthInfoInput {
101
101
  capabilities?: CapabilityInput[];
102
102
  constructor(appName: string, appDesc: string, appDomain: string, appUrl?: string, appIconPath?: string, capabilities?: CapabilityInput[]);
103
103
  }
104
+ export declare class User {
105
+ username: string;
106
+ did: string;
107
+ password: string;
108
+ constructor(username: string, did: string, password: string);
109
+ }
110
+ export declare class UserCreationResult {
111
+ did: string;
112
+ success: boolean;
113
+ error?: string;
114
+ constructor(did: string, success: boolean, error?: string);
115
+ }
104
116
  export {};
@@ -335,3 +335,51 @@ AuthInfoInput = __decorate([
335
335
  __metadata("design:paramtypes", [String, String, String, String, String, Array])
336
336
  ], AuthInfoInput);
337
337
  export { AuthInfoInput };
338
+ let User = class User {
339
+ constructor(username, did, password) {
340
+ this.username = username;
341
+ this.did = did;
342
+ this.password = password;
343
+ }
344
+ };
345
+ __decorate([
346
+ Field(),
347
+ __metadata("design:type", String)
348
+ ], User.prototype, "username", void 0);
349
+ __decorate([
350
+ Field(),
351
+ __metadata("design:type", String)
352
+ ], User.prototype, "did", void 0);
353
+ __decorate([
354
+ Field(),
355
+ __metadata("design:type", String)
356
+ ], User.prototype, "password", void 0);
357
+ User = __decorate([
358
+ ObjectType(),
359
+ __metadata("design:paramtypes", [String, String, String])
360
+ ], User);
361
+ export { User };
362
+ let UserCreationResult = class UserCreationResult {
363
+ constructor(did, success, error) {
364
+ this.did = did;
365
+ this.success = success;
366
+ this.error = error;
367
+ }
368
+ };
369
+ __decorate([
370
+ Field(),
371
+ __metadata("design:type", String)
372
+ ], UserCreationResult.prototype, "did", void 0);
373
+ __decorate([
374
+ Field(),
375
+ __metadata("design:type", Boolean)
376
+ ], UserCreationResult.prototype, "success", void 0);
377
+ __decorate([
378
+ Field({ nullable: true }),
379
+ __metadata("design:type", String)
380
+ ], UserCreationResult.prototype, "error", void 0);
381
+ UserCreationResult = __decorate([
382
+ ObjectType(),
383
+ __metadata("design:paramtypes", [String, Boolean, String])
384
+ ], UserCreationResult);
385
+ export { UserCreationResult };
@@ -1,6 +1,6 @@
1
1
  import { ApolloClient } from "@apollo/client/core";
2
2
  import { PerspectiveInput } from "../perspectives/Perspective";
3
- import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput } from "./Agent";
3
+ import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, UserCreationResult } from "./Agent";
4
4
  import { AgentStatus } from "./AgentStatus";
5
5
  import { LinkMutations } from "../links/Links";
6
6
  export interface InitializeArgs {
@@ -54,4 +54,6 @@ export declare class AgentClient {
54
54
  revokeToken(requestId: string): Promise<Apps[]>;
55
55
  isLocked(): Promise<boolean>;
56
56
  signMessage(message: string): Promise<string>;
57
+ createUser(email: string, password: string): Promise<UserCreationResult>;
58
+ loginUser(email: string, password: string): Promise<string>;
57
59
  }
@@ -427,5 +427,28 @@ export class AgentClient {
427
427
  }));
428
428
  return agentSignMessage;
429
429
  }
430
+ // Multi-user methods
431
+ async createUser(email, password) {
432
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
433
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
434
+ runtimeCreateUser(email: $email, password: $password) {
435
+ did
436
+ success
437
+ error
438
+ }
439
+ }`,
440
+ variables: { email, password },
441
+ }));
442
+ return runtimeCreateUser;
443
+ }
444
+ async loginUser(email, password) {
445
+ const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet(this, _AgentClient_apolloClient, "f").mutate({
446
+ mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
447
+ runtimeLoginUser(email: $email, password: $password)
448
+ }`,
449
+ variables: { email, password },
450
+ }));
451
+ return runtimeLoginUser;
452
+ }
430
453
  }
431
454
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
@@ -20,7 +20,13 @@ export declare class AIClient {
20
20
  modelLoadingStatus(model: string): Promise<AIModelLoadingStatus>;
21
21
  prompt(taskId: string, prompt: string): Promise<string>;
22
22
  embed(modelId: string, text: string): Promise<Array<number>>;
23
- openTranscriptionStream(modelId: string, streamCallback: (text: string) => void): Promise<string>;
23
+ openTranscriptionStream(modelId: string, streamCallback: (text: string) => void, params?: {
24
+ startThreshold?: number;
25
+ startWindow?: number;
26
+ endThreshold?: number;
27
+ endWindow?: number;
28
+ timeBeforeSpeech?: number;
29
+ }): Promise<string>;
24
30
  closeTranscriptionStream(streamId: string): Promise<void>;
25
- feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void>;
31
+ feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void>;
26
32
  }
@@ -36,8 +36,13 @@ export class AIClient {
36
36
  }
37
37
  local {
38
38
  fileName
39
- tokenizerSource
40
- modelParameters
39
+ tokenizerSource {
40
+ repo
41
+ revision
42
+ fileName
43
+ }
44
+ huggingfaceRepo
45
+ revision
41
46
  }
42
47
  modelType
43
48
  }
@@ -105,8 +110,13 @@ export class AIClient {
105
110
  }
106
111
  local {
107
112
  fileName
108
- tokenizerSource
109
- modelParameters
113
+ tokenizerSource {
114
+ repo
115
+ revision
116
+ fileName
117
+ }
118
+ huggingfaceRepo
119
+ revision
110
120
  }
111
121
  modelType
112
122
  }
@@ -269,15 +279,16 @@ export class AIClient {
269
279
  const decompressed = JSON.parse(pako.inflate(compressed, { to: 'string' }));
270
280
  return decompressed;
271
281
  }
272
- async openTranscriptionStream(modelId, streamCallback) {
282
+ async openTranscriptionStream(modelId, streamCallback, params) {
273
283
  const { aiOpenTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
274
284
  mutation: gql `
275
- mutation AiOpenTranscriptionStream($modelId: String!) {
276
- aiOpenTranscriptionStream(modelId: $modelId)
285
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
286
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
277
287
  }
278
288
  `,
279
289
  variables: {
280
- modelId
290
+ modelId,
291
+ params
281
292
  }
282
293
  }));
283
294
  const subscription = __classPrivateFieldGet(this, _AIClient_apolloClient, "f").subscribe({
@@ -313,19 +324,19 @@ export class AIClient {
313
324
  }
314
325
  return aiCloseTranscriptionStream;
315
326
  }
316
- async feedTranscriptionStream(streamId, audio) {
317
- const { feedTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
327
+ async feedTranscriptionStream(streamIds, audio) {
328
+ const { aiFeedTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
318
329
  mutation: gql `
319
- mutation AiFeedTranscriptionStream($streamId: String!, $audio: [Float!]!) {
320
- aiFeedTranscriptionStream(streamId: $streamId, audio: $audio)
330
+ mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
331
+ aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
321
332
  }
322
333
  `,
323
334
  variables: {
324
- streamId,
335
+ streamIds: Array.isArray(streamIds) ? streamIds : [streamIds],
325
336
  audio: audio
326
337
  }
327
338
  }));
328
- return feedTranscriptionStream;
339
+ return aiFeedTranscriptionStream;
329
340
  }
330
341
  }
331
342
  _AIClient_apolloClient = new WeakMap(), _AIClient_transcriptionSubscriptions = new WeakMap();
@@ -5,10 +5,16 @@ export declare class ModelApi {
5
5
  model: string;
6
6
  apiType: String;
7
7
  }
8
+ export declare class TokenizerSource {
9
+ repo: string;
10
+ revision: string;
11
+ fileName: string;
12
+ }
8
13
  export declare class LocalModel {
9
14
  fileName: string;
10
- tokenizerSource: string;
11
- modelParameters: string;
15
+ tokenizerSource?: TokenizerSource;
16
+ huggingfaceRepo?: string;
17
+ revision?: string;
12
18
  }
13
19
  export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
14
20
  export declare class Model {
@@ -24,10 +30,16 @@ export declare class ModelApiInput {
24
30
  model: string;
25
31
  apiType: string;
26
32
  }
33
+ export declare class TokenizerSourceInput {
34
+ repo: string;
35
+ revision: string;
36
+ fileName: string;
37
+ }
27
38
  export declare class LocalModelInput {
28
39
  fileName: string;
29
- tokenizerSource: string;
30
- modelParameters: string;
40
+ tokenizerSource?: TokenizerSourceInput;
41
+ huggingfaceRepo?: string;
42
+ revision?: string;
31
43
  }
32
44
  export declare class ModelInput {
33
45
  name: string;
@@ -35,6 +47,13 @@ export declare class ModelInput {
35
47
  local?: LocalModelInput;
36
48
  modelType: ModelType;
37
49
  }
50
+ export declare class VoiceActivityParamsInput {
51
+ startThreshold?: number;
52
+ startWindow?: number;
53
+ endThreshold?: number;
54
+ endWindow?: number;
55
+ timeBeforeSpeech?: number;
56
+ }
38
57
  export default class AIResolver {
39
58
  aiGetModels(): Model[];
40
59
  aiAddModel(model: ModelInput): string;
@@ -49,8 +68,8 @@ export default class AIResolver {
49
68
  aiModelLoadingStatus(model: string): AIModelLoadingStatus;
50
69
  aiPrompt(taskId: string, input: string): string;
51
70
  aiEmbed(modelId: string, text: string): string;
52
- aiOpenTranscriptionStream(modelId: string): string;
71
+ aiOpenTranscriptionStream(modelId: string, params?: VoiceActivityParamsInput): string;
53
72
  aiCloseTranscriptionStream(streamId: string): boolean;
54
- aiFeedTranscriptionStream(streamId: string, audio: number[], pubSub: any): boolean;
73
+ aiFeedTranscriptionStream(streamIds: string[], audio: number[], pubSub: any): boolean;
55
74
  aiTranscriptionText(streamId: string): string;
56
75
  }
@@ -39,20 +39,42 @@ ModelApi = __decorate([
39
39
  ObjectType()
40
40
  ], ModelApi);
41
41
  export { ModelApi };
42
- let LocalModel = class LocalModel {
42
+ let TokenizerSource = class TokenizerSource {
43
43
  };
44
44
  __decorate([
45
45
  Field(),
46
46
  __metadata("design:type", String)
47
- ], LocalModel.prototype, "fileName", void 0);
47
+ ], TokenizerSource.prototype, "repo", void 0);
48
48
  __decorate([
49
49
  Field(),
50
50
  __metadata("design:type", String)
51
- ], LocalModel.prototype, "tokenizerSource", void 0);
51
+ ], TokenizerSource.prototype, "revision", void 0);
52
52
  __decorate([
53
53
  Field(),
54
54
  __metadata("design:type", String)
55
- ], LocalModel.prototype, "modelParameters", void 0);
55
+ ], TokenizerSource.prototype, "fileName", void 0);
56
+ TokenizerSource = __decorate([
57
+ ObjectType()
58
+ ], TokenizerSource);
59
+ export { TokenizerSource };
60
+ let LocalModel = class LocalModel {
61
+ };
62
+ __decorate([
63
+ Field(),
64
+ __metadata("design:type", String)
65
+ ], LocalModel.prototype, "fileName", void 0);
66
+ __decorate([
67
+ Field({ nullable: true }),
68
+ __metadata("design:type", TokenizerSource)
69
+ ], LocalModel.prototype, "tokenizerSource", void 0);
70
+ __decorate([
71
+ Field({ nullable: true }),
72
+ __metadata("design:type", String)
73
+ ], LocalModel.prototype, "huggingfaceRepo", void 0);
74
+ __decorate([
75
+ Field({ nullable: true }),
76
+ __metadata("design:type", String)
77
+ ], LocalModel.prototype, "revision", void 0);
56
78
  LocalModel = __decorate([
57
79
  ObjectType()
58
80
  ], LocalModel);
@@ -105,20 +127,42 @@ ModelApiInput = __decorate([
105
127
  InputType()
106
128
  ], ModelApiInput);
107
129
  export { ModelApiInput };
108
- let LocalModelInput = class LocalModelInput {
130
+ let TokenizerSourceInput = class TokenizerSourceInput {
109
131
  };
110
132
  __decorate([
111
133
  Field(),
112
134
  __metadata("design:type", String)
113
- ], LocalModelInput.prototype, "fileName", void 0);
135
+ ], TokenizerSourceInput.prototype, "repo", void 0);
114
136
  __decorate([
115
137
  Field(),
116
138
  __metadata("design:type", String)
117
- ], LocalModelInput.prototype, "tokenizerSource", void 0);
139
+ ], TokenizerSourceInput.prototype, "revision", void 0);
140
+ __decorate([
141
+ Field(),
142
+ __metadata("design:type", String)
143
+ ], TokenizerSourceInput.prototype, "fileName", void 0);
144
+ TokenizerSourceInput = __decorate([
145
+ InputType()
146
+ ], TokenizerSourceInput);
147
+ export { TokenizerSourceInput };
148
+ let LocalModelInput = class LocalModelInput {
149
+ };
118
150
  __decorate([
119
151
  Field(),
120
152
  __metadata("design:type", String)
121
- ], LocalModelInput.prototype, "modelParameters", void 0);
153
+ ], LocalModelInput.prototype, "fileName", void 0);
154
+ __decorate([
155
+ Field({ nullable: true }),
156
+ __metadata("design:type", TokenizerSourceInput)
157
+ ], LocalModelInput.prototype, "tokenizerSource", void 0);
158
+ __decorate([
159
+ Field({ nullable: true }),
160
+ __metadata("design:type", String)
161
+ ], LocalModelInput.prototype, "huggingfaceRepo", void 0);
162
+ __decorate([
163
+ Field({ nullable: true }),
164
+ __metadata("design:type", String)
165
+ ], LocalModelInput.prototype, "revision", void 0);
122
166
  LocalModelInput = __decorate([
123
167
  InputType()
124
168
  ], LocalModelInput);
@@ -145,6 +189,32 @@ ModelInput = __decorate([
145
189
  InputType()
146
190
  ], ModelInput);
147
191
  export { ModelInput };
192
+ let VoiceActivityParamsInput = class VoiceActivityParamsInput {
193
+ };
194
+ __decorate([
195
+ Field(() => Float, { nullable: true }),
196
+ __metadata("design:type", Number)
197
+ ], VoiceActivityParamsInput.prototype, "startThreshold", void 0);
198
+ __decorate([
199
+ Field(() => Float, { nullable: true }),
200
+ __metadata("design:type", Number)
201
+ ], VoiceActivityParamsInput.prototype, "startWindow", void 0);
202
+ __decorate([
203
+ Field(() => Float, { nullable: true }),
204
+ __metadata("design:type", Number)
205
+ ], VoiceActivityParamsInput.prototype, "endThreshold", void 0);
206
+ __decorate([
207
+ Field(() => Float, { nullable: true }),
208
+ __metadata("design:type", Number)
209
+ ], VoiceActivityParamsInput.prototype, "endWindow", void 0);
210
+ __decorate([
211
+ Field(() => Float, { nullable: true }),
212
+ __metadata("design:type", Number)
213
+ ], VoiceActivityParamsInput.prototype, "timeBeforeSpeech", void 0);
214
+ VoiceActivityParamsInput = __decorate([
215
+ InputType()
216
+ ], VoiceActivityParamsInput);
217
+ export { VoiceActivityParamsInput };
148
218
  let AIResolver = class AIResolver {
149
219
  aiGetModels() {
150
220
  return [
@@ -159,8 +229,13 @@ let AIResolver = class AIResolver {
159
229
  },
160
230
  local: {
161
231
  fileName: "test-model.bin",
162
- tokenizerSource: "test-tokenizer",
163
- modelParameters: "{}"
232
+ tokenizerSource: {
233
+ repo: "test-repo",
234
+ revision: "main",
235
+ fileName: "tokenizer.json"
236
+ },
237
+ huggingfaceRepo: "test-repo",
238
+ revision: "main"
164
239
  },
165
240
  modelType: "LLM"
166
241
  }
@@ -195,8 +270,13 @@ let AIResolver = class AIResolver {
195
270
  },
196
271
  local: {
197
272
  fileName: "test-model.bin",
198
- tokenizerSource: "test-tokenizer",
199
- modelParameters: "{}"
273
+ tokenizerSource: {
274
+ repo: "test-repo",
275
+ revision: "main",
276
+ fileName: "tokenizer.json"
277
+ },
278
+ huggingfaceRepo: "test-repo",
279
+ revision: "main"
200
280
  },
201
281
  modelType: modelType
202
282
  };
@@ -227,14 +307,17 @@ let AIResolver = class AIResolver {
227
307
  const compressedString = base64js.fromByteArray(compressed);
228
308
  return compressedString;
229
309
  }
230
- aiOpenTranscriptionStream(modelId) {
310
+ aiOpenTranscriptionStream(modelId, params) {
231
311
  return "streamId";
232
312
  }
233
313
  aiCloseTranscriptionStream(streamId) {
234
314
  return true;
235
315
  }
236
- aiFeedTranscriptionStream(streamId, audio, pubSub) {
237
- pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
316
+ aiFeedTranscriptionStream(streamIds, audio, pubSub) {
317
+ // Publish for each stream ID
318
+ for (const streamId of streamIds) {
319
+ pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
320
+ }
238
321
  return true;
239
322
  }
240
323
  aiTranscriptionText(streamId) {
@@ -338,8 +421,9 @@ __decorate([
338
421
  __decorate([
339
422
  Mutation(() => String),
340
423
  __param(0, Arg("modelId")),
424
+ __param(1, Arg("params", () => VoiceActivityParamsInput, { nullable: true })),
341
425
  __metadata("design:type", Function),
342
- __metadata("design:paramtypes", [String]),
426
+ __metadata("design:paramtypes", [String, VoiceActivityParamsInput]),
343
427
  __metadata("design:returntype", String)
344
428
  ], AIResolver.prototype, "aiOpenTranscriptionStream", null);
345
429
  __decorate([
@@ -351,11 +435,11 @@ __decorate([
351
435
  ], AIResolver.prototype, "aiCloseTranscriptionStream", null);
352
436
  __decorate([
353
437
  Mutation(() => String),
354
- __param(0, Arg("streamId")),
438
+ __param(0, Arg("streamIds", type => [String])),
355
439
  __param(1, Arg("audio", () => [Float])),
356
440
  __param(2, PubSub()),
357
441
  __metadata("design:type", Function),
358
- __metadata("design:paramtypes", [String, Array, Object]),
442
+ __metadata("design:paramtypes", [Array, Array, Object]),
359
443
  __metadata("design:returntype", Boolean)
360
444
  ], AIResolver.prototype, "aiFeedTranscriptionStream", null);
361
445
  __decorate([
@@ -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';
package/lib/src/index.js 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';
@@ -148,6 +148,17 @@ export interface LinkSyncAdapter {
148
148
  addCallback(callback: PerspectiveDiffObserver): any;
149
149
  /** Add a sync state callback method */
150
150
  addSyncStateChangeCallback(callback: SyncStateChangeObserver): any;
151
+ /**
152
+ * Set the local agents (DIDs) that own this perspective/neighbourhood.
153
+ * This is used to determine which agents should be registered in the DHT.
154
+ * Optional - if not implemented, all local agents may be registered.
155
+ *
156
+ * This is a temporary hack to support multiple users on one node joining the same neighbourhood.
157
+ * Once we migrate the LanguageController to Rust and run Languages per user, each user will get their
158
+ * own language instance and we won't need to explicitly set local agents. This will provide better
159
+ * isolation and avoid the need to share language state between users.
160
+ */
161
+ setLocalAgents?(agents: DID[]): void;
151
162
  }
152
163
  export type MessageCallback = (message: PerspectiveExpression) => void;
153
164
  export type StatusCallback = (caller: DID) => Perspective;
@@ -185,7 +196,7 @@ export declare class OnlineAgent {
185
196
  did: DID;
186
197
  status: PerspectiveExpression;
187
198
  }
188
- export type TelepresenceSignalCallback = (payload: PerspectiveExpression) => void;
199
+ export type TelepresenceSignalCallback = (payload: PerspectiveExpression, recipientDid?: string) => void;
189
200
  export interface TelepresenceAdapter {
190
201
  setOnlineStatus(status: PerspectiveExpression): Promise<void>;
191
202
  getOnlineAgents(): Promise<OnlineAgent[]>;