@coasys/ad4m 0.10.1-dev-1 → 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.
package/lib/index.js CHANGED
@@ -4067,6 +4067,52 @@ AuthInfoInput = __decorate$b([
4067
4067
  InputType(),
4068
4068
  __metadata$b("design:paramtypes", [String, String, String, String, String, Array])
4069
4069
  ], AuthInfoInput);
4070
+ let User = class User {
4071
+ constructor(username, did, password) {
4072
+ this.username = username;
4073
+ this.did = did;
4074
+ this.password = password;
4075
+ }
4076
+ };
4077
+ __decorate$b([
4078
+ Field(),
4079
+ __metadata$b("design:type", String)
4080
+ ], User.prototype, "username", void 0);
4081
+ __decorate$b([
4082
+ Field(),
4083
+ __metadata$b("design:type", String)
4084
+ ], User.prototype, "did", void 0);
4085
+ __decorate$b([
4086
+ Field(),
4087
+ __metadata$b("design:type", String)
4088
+ ], User.prototype, "password", void 0);
4089
+ User = __decorate$b([
4090
+ ObjectType(),
4091
+ __metadata$b("design:paramtypes", [String, String, String])
4092
+ ], User);
4093
+ let UserCreationResult = class UserCreationResult {
4094
+ constructor(did, success, error) {
4095
+ this.did = did;
4096
+ this.success = success;
4097
+ this.error = error;
4098
+ }
4099
+ };
4100
+ __decorate$b([
4101
+ Field(),
4102
+ __metadata$b("design:type", String)
4103
+ ], UserCreationResult.prototype, "did", void 0);
4104
+ __decorate$b([
4105
+ Field(),
4106
+ __metadata$b("design:type", Boolean)
4107
+ ], UserCreationResult.prototype, "success", void 0);
4108
+ __decorate$b([
4109
+ Field(),
4110
+ __metadata$b("design:type", String)
4111
+ ], UserCreationResult.prototype, "error", void 0);
4112
+ UserCreationResult = __decorate$b([
4113
+ ObjectType(),
4114
+ __metadata$b("design:paramtypes", [String, Boolean, String])
4115
+ ], UserCreationResult);
4070
4116
 
4071
4117
  var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4072
4118
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -6666,6 +6712,29 @@ class AgentClient {
6666
6712
  }));
6667
6713
  return agentSignMessage;
6668
6714
  }
6715
+ // Multi-user methods
6716
+ async createUser(email, password) {
6717
+ const { runtimeCreateUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6718
+ mutation: gql `mutation runtimeCreateUser($email: String!, $password: String!) {
6719
+ runtimeCreateUser(email: $email, password: $password) {
6720
+ did
6721
+ success
6722
+ error
6723
+ }
6724
+ }`,
6725
+ variables: { email, password },
6726
+ }));
6727
+ return runtimeCreateUser;
6728
+ }
6729
+ async loginUser(email, password) {
6730
+ const { runtimeLoginUser } = unwrapApolloResult(await __classPrivateFieldGet$8(this, _AgentClient_apolloClient, "f").mutate({
6731
+ mutation: gql `mutation runtimeLoginUser($email: String!, $password: String!) {
6732
+ runtimeLoginUser(email: $email, password: $password)
6733
+ }`,
6734
+ variables: { email, password },
6735
+ }));
6736
+ return runtimeLoginUser;
6737
+ }
6669
6738
  }
6670
6739
  _AgentClient_apolloClient = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap();
6671
6740
 
@@ -7414,6 +7483,36 @@ class RuntimeClient {
7414
7483
  }));
7415
7484
  return runtimeImportPerspective;
7416
7485
  }
7486
+ async multiUserEnabled() {
7487
+ const { runtimeMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7488
+ query: gql `query runtimeMultiUserEnabled {
7489
+ runtimeMultiUserEnabled
7490
+ }`,
7491
+ }));
7492
+ return runtimeMultiUserEnabled;
7493
+ }
7494
+ async setMultiUserEnabled(enabled) {
7495
+ const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").mutate({
7496
+ mutation: gql `mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
7497
+ runtimeSetMultiUserEnabled(enabled: $enabled)
7498
+ }`,
7499
+ variables: { enabled }
7500
+ }));
7501
+ return runtimeSetMultiUserEnabled;
7502
+ }
7503
+ async listUsers() {
7504
+ const { runtimeListUsers } = unwrapApolloResult(await __classPrivateFieldGet$5(this, _RuntimeClient_apolloClient, "f").query({
7505
+ query: gql `query runtimeListUsers {
7506
+ runtimeListUsers {
7507
+ email
7508
+ did
7509
+ lastSeen
7510
+ perspectiveCount
7511
+ }
7512
+ }`
7513
+ }));
7514
+ return runtimeListUsers;
7515
+ }
7417
7516
  addNotificationTriggeredCallback(cb) {
7418
7517
  __classPrivateFieldGet$5(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
7419
7518
  }
@@ -16695,6 +16794,7 @@ type Mutation {
16695
16794
  runtimeRemoveNotification(id: String!): Boolean!
16696
16795
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
16697
16796
  runtimeRestartHolochain: Boolean!
16797
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
16698
16798
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
16699
16799
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
16700
16800
  }
@@ -16801,8 +16901,10 @@ type Query {
16801
16901
  runtimeHcAgentInfos: String!
16802
16902
  runtimeInfo: RuntimeInfo!
16803
16903
  runtimeKnownLinkLanguageTemplates: [String!]!
16904
+ runtimeListUsers: [UserStatistics!]!
16804
16905
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
16805
16906
  runtimeMessageOutbox(filter: String): [SentMessage!]!
16907
+ runtimeMultiUserEnabled: Boolean!
16806
16908
  runtimeNotifications: [Notification!]!
16807
16909
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
16808
16910
  }
@@ -16870,6 +16972,13 @@ type TriggeredNotification {
16870
16972
  triggerMatch: String!
16871
16973
  }
16872
16974
 
16975
+ type UserStatistics {
16976
+ did: String!
16977
+ email: String!
16978
+ lastSeen: String
16979
+ perspectiveCount: Int!
16980
+ }
16981
+
16873
16982
  input VoiceActivityParamsInput {
16874
16983
  endThreshold: Float
16875
16984
  endWindow: Float
@@ -17158,6 +17267,27 @@ __decorate([
17158
17267
  ImportResult = __decorate([
17159
17268
  ObjectType()
17160
17269
  ], ImportResult);
17270
+ let UserStatistics = class UserStatistics {
17271
+ };
17272
+ __decorate([
17273
+ Field(),
17274
+ __metadata("design:type", String)
17275
+ ], UserStatistics.prototype, "email", void 0);
17276
+ __decorate([
17277
+ Field(),
17278
+ __metadata("design:type", String)
17279
+ ], UserStatistics.prototype, "did", void 0);
17280
+ __decorate([
17281
+ Field(),
17282
+ __metadata("design:type", String)
17283
+ ], UserStatistics.prototype, "lastSeen", void 0);
17284
+ __decorate([
17285
+ Field(),
17286
+ __metadata("design:type", Number)
17287
+ ], UserStatistics.prototype, "perspectiveCount", void 0);
17288
+ UserStatistics = __decorate([
17289
+ ObjectType()
17290
+ ], UserStatistics);
17161
17291
  /**
17162
17292
  * Resolver classes are used here to define the GraphQL schema
17163
17293
  * (through the type-graphql annotations)
@@ -17307,6 +17437,20 @@ let RuntimeResolver = class RuntimeResolver {
17307
17437
  runtimeImportPerspective(filePath) {
17308
17438
  return true;
17309
17439
  }
17440
+ runtimeMultiUserEnabled() {
17441
+ return false;
17442
+ }
17443
+ runtimeSetMultiUserEnabled(enabled) {
17444
+ return enabled;
17445
+ }
17446
+ runtimeListUsers() {
17447
+ return [{
17448
+ email: "test@example.com",
17449
+ did: "did:key:test123",
17450
+ lastSeen: new Date().toISOString(),
17451
+ perspectiveCount: 5
17452
+ }];
17453
+ }
17310
17454
  };
17311
17455
  __decorate([
17312
17456
  Mutation(),
@@ -17540,6 +17684,25 @@ __decorate([
17540
17684
  __metadata("design:paramtypes", [String]),
17541
17685
  __metadata("design:returntype", Boolean)
17542
17686
  ], RuntimeResolver.prototype, "runtimeImportPerspective", null);
17687
+ __decorate([
17688
+ Query(),
17689
+ __metadata("design:type", Function),
17690
+ __metadata("design:paramtypes", []),
17691
+ __metadata("design:returntype", Boolean)
17692
+ ], RuntimeResolver.prototype, "runtimeMultiUserEnabled", null);
17693
+ __decorate([
17694
+ Mutation(),
17695
+ __param(0, Arg()),
17696
+ __metadata("design:type", Function),
17697
+ __metadata("design:paramtypes", [Boolean]),
17698
+ __metadata("design:returntype", Boolean)
17699
+ ], RuntimeResolver.prototype, "runtimeSetMultiUserEnabled", null);
17700
+ __decorate([
17701
+ Query(),
17702
+ __metadata("design:type", Function),
17703
+ __metadata("design:paramtypes", []),
17704
+ __metadata("design:returntype", Array)
17705
+ ], RuntimeResolver.prototype, "runtimeListUsers", null);
17543
17706
  RuntimeResolver = __decorate([
17544
17707
  Resolver()
17545
17708
  ], RuntimeResolver);
@@ -18314,287 +18477,6 @@ class Ad4mModel {
18314
18477
  static query(perspective, query) {
18315
18478
  return new ModelQueryBuilder(perspective, this, query);
18316
18479
  }
18317
- /**
18318
- * Creates an Ad4mModel class from a JSON Schema definition.
18319
- *
18320
- * @description
18321
- * This method dynamically generates an Ad4mModel subclass from a JSON Schema,
18322
- * enabling integration with systems that use JSON Schema for type definitions.
18323
- *
18324
- * The method follows a cascading approach for determining predicates:
18325
- * 1. Explicit configuration in options parameter (highest precedence)
18326
- * 2. x-ad4m metadata in the JSON Schema
18327
- * 3. Inference from schema title and property names
18328
- * 4. Error if no namespace can be determined
18329
- *
18330
- * @example
18331
- * ```typescript
18332
- * // With explicit configuration
18333
- * const PersonClass = Ad4mModel.fromJSONSchema(schema, {
18334
- * name: "Person",
18335
- * namespace: "person://",
18336
- * resolveLanguage: "literal"
18337
- * });
18338
- *
18339
- * // With property mapping
18340
- * const ContactClass = Ad4mModel.fromJSONSchema(schema, {
18341
- * name: "Contact",
18342
- * namespace: "contact://",
18343
- * propertyMapping: {
18344
- * "name": "foaf://name",
18345
- * "email": "foaf://mbox"
18346
- * }
18347
- * });
18348
- *
18349
- * // With x-ad4m metadata in schema
18350
- * const schema = {
18351
- * "title": "Product",
18352
- * "x-ad4m": { "namespace": "product://" },
18353
- * "properties": {
18354
- * "name": {
18355
- * "type": "string",
18356
- * "x-ad4m": { "through": "product://title" }
18357
- * }
18358
- * }
18359
- * };
18360
- * const ProductClass = Ad4mModel.fromJSONSchema(schema, { name: "Product" });
18361
- * ```
18362
- *
18363
- * @param schema - JSON Schema definition
18364
- * @param options - Configuration options
18365
- * @returns Generated Ad4mModel subclass
18366
- * @throws Error when namespace cannot be inferred
18367
- */
18368
- static fromJSONSchema(schema, options) {
18369
- // Disallow top-level "author" property since Ad4mModel provides it implicitly via link authorship
18370
- if (schema?.properties && Object.prototype.hasOwnProperty.call(schema.properties, "author")) {
18371
- throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');
18372
- }
18373
- // Determine namespace with cascading precedence
18374
- const namespace = this.determineNamespace(schema, options);
18375
- // Create the dynamic class
18376
- const DynamicModelClass = class extends Ad4mModel {
18377
- };
18378
- // Set up class metadata
18379
- Object.defineProperty(DynamicModelClass, 'name', { value: options.name });
18380
- DynamicModelClass.className = options.name;
18381
- DynamicModelClass.prototype.className = options.name;
18382
- // Generate properties and collections metadata
18383
- const properties = {};
18384
- const collections = {};
18385
- if (schema.properties) {
18386
- for (const [propertyName, propertySchema] of Object.entries(schema.properties)) {
18387
- const predicate = this.determinePredicate(schema, propertyName, propertySchema, namespace, options);
18388
- const isRequired = schema.required?.includes(propertyName) || false;
18389
- const isArray = propertySchema.type === 'array';
18390
- if (isArray) {
18391
- // Handle arrays as collections
18392
- // Store the singular form as the collection key since SDNA generation expects singular
18393
- collections[propertyName] = {
18394
- through: predicate,
18395
- local: this.getPropertyOption(propertyName, propertySchema, options, 'local')
18396
- };
18397
- // Define the property on prototype
18398
- Object.defineProperty(DynamicModelClass.prototype, propertyName, {
18399
- configurable: true,
18400
- writable: true,
18401
- value: []
18402
- });
18403
- // Add collection methods
18404
- const adderName = `add${capitalize(propertyName)}`;
18405
- const removerName = `remove${capitalize(propertyName)}`;
18406
- const setterName = `setCollection${capitalize(propertyName)}`;
18407
- DynamicModelClass.prototype[adderName] = function () {
18408
- // Placeholder function for SDNA generation
18409
- };
18410
- DynamicModelClass.prototype[removerName] = function () {
18411
- // Placeholder function for SDNA generation
18412
- };
18413
- DynamicModelClass.prototype[setterName] = function () {
18414
- // Placeholder function for SDNA generation
18415
- };
18416
- }
18417
- else {
18418
- // Handle regular properties
18419
- let resolveLanguage = this.getPropertyOption(propertyName, propertySchema, options, 'resolveLanguage');
18420
- // If no specific resolveLanguage for this property, use the global one
18421
- if (!resolveLanguage && options.resolveLanguage) {
18422
- resolveLanguage = options.resolveLanguage;
18423
- }
18424
- const local = this.getPropertyOption(propertyName, propertySchema, options, 'local');
18425
- const writable = this.getPropertyOption(propertyName, propertySchema, options, 'writable', true);
18426
- let initial = this.getPropertyOption(propertyName, propertySchema, options, 'initial');
18427
- // Handle nested objects by serializing to JSON
18428
- if (propertySchema.type === 'object' && !resolveLanguage) {
18429
- resolveLanguage = 'literal';
18430
- console.warn(`Property "${propertyName}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`);
18431
- }
18432
- // Ensure numeric properties use literal language for correct typing
18433
- if ((resolveLanguage === undefined || resolveLanguage === null) && (propertySchema.type === 'number' || propertySchema.type === 'integer')) {
18434
- resolveLanguage = 'literal';
18435
- }
18436
- // If property is required, ensure it has an initial value
18437
- if (isRequired && !initial) {
18438
- if (propertySchema.type === 'object') {
18439
- initial = 'literal://json:{}';
18440
- }
18441
- else {
18442
- initial = "ad4m://undefined";
18443
- }
18444
- }
18445
- properties[propertyName] = {
18446
- through: predicate,
18447
- required: isRequired,
18448
- writable: writable,
18449
- ...(resolveLanguage && { resolveLanguage }),
18450
- ...(local !== undefined && { local }),
18451
- ...(initial && { initial })
18452
- };
18453
- // Define the property on prototype
18454
- Object.defineProperty(DynamicModelClass.prototype, propertyName, {
18455
- configurable: true,
18456
- writable: true,
18457
- value: this.getDefaultValueForType(propertySchema.type)
18458
- });
18459
- // Add setter function if writable
18460
- if (writable) {
18461
- const setterName = propertyNameToSetterName(propertyName);
18462
- DynamicModelClass.prototype[setterName] = function () {
18463
- // This is a placeholder function that the SDNA generation looks for
18464
- // The actual setter logic is handled by the Ad4mModel base class
18465
- };
18466
- }
18467
- }
18468
- }
18469
- }
18470
- // Validate that at least one property has an initial value (needed for valid SDNA constructor)
18471
- // Collections don't create constructor actions, only properties with initial values do
18472
- const hasPropertyWithInitial = Object.values(properties).some((prop) => prop.initial);
18473
- if (!hasPropertyWithInitial) {
18474
- // If no properties have initial values, add a type identifier automatically
18475
- const typeProperty = `ad4m://type`;
18476
- const typeValue = `${namespace.replace('://', '')}://instance`;
18477
- properties['__ad4m_type'] = {
18478
- through: typeProperty,
18479
- required: true,
18480
- writable: false,
18481
- initial: typeValue,
18482
- flag: true
18483
- };
18484
- // Add the type property to the prototype
18485
- Object.defineProperty(DynamicModelClass.prototype, '__ad4m_type', {
18486
- configurable: true,
18487
- writable: false,
18488
- value: typeValue
18489
- });
18490
- console.warn(`No properties with initial values found. Added automatic type flag: ${typeProperty} = ${typeValue}`);
18491
- }
18492
- // Attach metadata to prototype
18493
- DynamicModelClass.prototype.__properties = properties;
18494
- DynamicModelClass.prototype.__collections = collections;
18495
- // Apply the ModelOptions decorator to set up the generateSDNA method
18496
- const ModelOptionsDecorator = ModelOptions({ name: options.name });
18497
- ModelOptionsDecorator(DynamicModelClass);
18498
- return DynamicModelClass;
18499
- }
18500
- /**
18501
- * Determines the namespace for predicates using cascading precedence
18502
- */
18503
- static determineNamespace(schema, options) {
18504
- // 1. Explicit namespace in options (highest precedence)
18505
- if (options.namespace) {
18506
- return options.namespace;
18507
- }
18508
- // 2. x-ad4m metadata in schema
18509
- if (schema["x-ad4m"]?.namespace) {
18510
- return schema["x-ad4m"].namespace;
18511
- }
18512
- // 3. Infer from schema title
18513
- if (schema.title) {
18514
- return `${schema.title.toLowerCase()}://`;
18515
- }
18516
- // 4. Try to extract from $id if it's a URL
18517
- if (schema.$id) {
18518
- try {
18519
- const url = new URL(schema.$id);
18520
- const pathParts = url.pathname.split('/').filter(p => p);
18521
- if (pathParts.length > 0) {
18522
- const lastPart = pathParts[pathParts.length - 1];
18523
- const baseName = lastPart.replace(/\.schema\.json$/, '').replace(/\.json$/, '');
18524
- return `${baseName.toLowerCase()}://`;
18525
- }
18526
- }
18527
- catch {
18528
- // If $id is not a valid URL, continue to error
18529
- }
18530
- }
18531
- // 5. Error if no namespace can be determined
18532
- throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
18533
- - options.namespace
18534
- - schema["x-ad4m"].namespace
18535
- - schema.title
18536
- - valid schema.$id`);
18537
- }
18538
- /**
18539
- * Determines the predicate for a specific property using cascading precedence
18540
- */
18541
- static determinePredicate(schema, propertyName, propertySchema, namespace, options) {
18542
- // 1. Explicit property mapping (highest precedence)
18543
- if (options.propertyMapping?.[propertyName]) {
18544
- return options.propertyMapping[propertyName];
18545
- }
18546
- // 2. x-ad4m metadata in property schema
18547
- if (propertySchema["x-ad4m"]?.through) {
18548
- return propertySchema["x-ad4m"].through;
18549
- }
18550
- // 3. Generate from namespace + property name
18551
- if (options.predicateTemplate) {
18552
- return options.predicateTemplate
18553
- .replace('${namespace}', namespace.replace('://', ''))
18554
- .replace('${title}', schema.title || '')
18555
- .replace('${property}', propertyName);
18556
- }
18557
- // 4. Custom predicate generator
18558
- if (options.predicateGenerator) {
18559
- return options.predicateGenerator(schema.title || '', propertyName);
18560
- }
18561
- // 5. Default: namespace + property name
18562
- const cleanNamespace = namespace.endsWith('://') ? namespace.slice(0, -3) : namespace;
18563
- return `${cleanNamespace}://${propertyName}`;
18564
- }
18565
- /**
18566
- * Gets property-specific options using cascading precedence
18567
- */
18568
- static getPropertyOption(propertyName, propertySchema, options, optionName, defaultValue) {
18569
- // 1. Property-specific options
18570
- if (options.propertyOptions?.[propertyName]?.[optionName] !== undefined) {
18571
- return options.propertyOptions[propertyName][optionName];
18572
- }
18573
- // 2. x-ad4m metadata in property
18574
- if (propertySchema["x-ad4m"]?.[optionName] !== undefined) {
18575
- return propertySchema["x-ad4m"][optionName];
18576
- }
18577
- // 3. Global option
18578
- if (options[optionName] !== undefined) {
18579
- return options[optionName];
18580
- }
18581
- // 4. Default value
18582
- return defaultValue;
18583
- }
18584
- /**
18585
- * Gets default value for a JSON Schema type
18586
- */
18587
- static getDefaultValueForType(type) {
18588
- switch (type) {
18589
- case 'string': return '';
18590
- case 'number': return 0;
18591
- case 'integer': return 0;
18592
- case 'boolean': return false;
18593
- case 'array': return [];
18594
- case 'object': return {};
18595
- default: return '';
18596
- }
18597
- }
18598
18480
  }
18599
18481
  _Ad4mModel_baseExpression = new WeakMap(), _Ad4mModel_subjectClassName = new WeakMap(), _Ad4mModel_source = new WeakMap(), _Ad4mModel_perspective = new WeakMap();
18600
18482
  Ad4mModel.classNamesByClass = new WeakMap();
@@ -18940,4 +18822,4 @@ class ModelQueryBuilder {
18940
18822
  }
18941
18823
  }
18942
18824
 
18943
- export { AIClient, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, Capability, CapabilityInput, Collection, Dna, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, Icon, ImportResult, ImportStats, InstanceQuery, InteractionCall, InteractionMeta, InteractionParameter, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, ModelOptions, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, OnlineAgent, Optional, Perspective, PerspectiveAction, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, ReadOnly, Resource, ResourceInput, RuntimeInfo, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, Subject, TriggeredNotification, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
18825
+ export { AIClient, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, Capability, CapabilityInput, Collection, Dna, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, Icon, ImportResult, ImportStats, InstanceQuery, InteractionCall, InteractionMeta, InteractionParameter, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, ModelOptions, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, OnlineAgent, Optional, Perspective, PerspectiveAction, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, ReadOnly, Resource, ResourceInput, RuntimeInfo, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, Subject, TriggeredNotification, User, UserCreationResult, UserStatistics, addLink, capSentence, exprRef2String, formatList, hasLink, isExpression, isLink, linkEqual, makeRandomPrologAtom, parseExprUrl, typeDefsString };
@@ -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();
@@ -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[]>;