@coasys/ad4m 0.12.0-rc1-dev.2 → 0.12.0-rc1-dev.4

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 (153) hide show
  1. package/jest.config.js +10 -3
  2. package/lib/index.cjs +6893 -5884
  3. package/lib/index.js +6889 -5872
  4. package/lib/src/Ad4mClient.d.ts +9 -16
  5. package/lib/src/Ad4mClient.js +46 -25
  6. package/lib/src/Literal.d.ts +1 -2
  7. package/lib/src/Literal.js +38 -35
  8. package/lib/src/SmartLiteral.d.ts +1 -2
  9. package/lib/src/SmartLiteral.js +30 -15
  10. package/lib/src/agent/AgentClient.d.ts +1 -4
  11. package/lib/src/agent/AgentClient.js +79 -99
  12. package/lib/src/ai/AIClient.d.ts +1 -2
  13. package/lib/src/ai/AIClient.js +224 -220
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +73 -86
  16. package/lib/src/index.d.ts +1 -1
  17. package/lib/src/index.js +1 -1
  18. package/lib/src/language/LanguageClient.d.ts +1 -1
  19. package/lib/src/language/LanguageClient.js +52 -52
  20. package/lib/src/model/Ad4mModel.d.ts +1351 -144
  21. package/lib/src/model/Ad4mModel.js +3760 -228
  22. package/lib/src/model/Ad4mModel.test.js +522 -979
  23. package/lib/src/model/Subject.d.ts +3 -3
  24. package/lib/src/model/Subject.js +25 -25
  25. package/lib/src/model/decorators.d.ts +444 -100
  26. package/lib/src/model/decorators.js +686 -321
  27. package/lib/src/model/util.d.ts +6 -6
  28. package/lib/src/model/util.js +24 -24
  29. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
  30. package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
  31. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
  32. package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
  33. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
  34. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  35. package/lib/src/perspectives/PerspectiveClient.js +240 -316
  36. package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
  37. package/lib/src/perspectives/PerspectiveProxy.js +485 -832
  38. package/lib/src/runtime/RuntimeClient.d.ts +1 -5
  39. package/lib/src/runtime/RuntimeClient.js +238 -412
  40. package/lib/src/shacl/SHACLFlow.test.js +105 -164
  41. package/lib/src/shacl/SHACLShape.d.ts +12 -17
  42. package/lib/src/shacl/SHACLShape.js +115 -128
  43. package/lib/src/shacl/SHACLShape.test.js +176 -244
  44. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  45. package/lib/src/shims/type-graphql.d.ts +32 -0
  46. package/lib/src/src/Ad4mClient.d.ts +28 -0
  47. package/lib/src/src/Address.d.ts +1 -0
  48. package/lib/src/src/DID.d.ts +1 -0
  49. package/lib/src/src/Exception.d.ts +7 -0
  50. package/lib/src/src/Literal.d.ts +7 -0
  51. package/lib/src/src/PubSub.d.ts +17 -0
  52. package/lib/src/src/SmartLiteral.d.ts +12 -0
  53. package/lib/src/src/agent/Agent.d.ts +110 -0
  54. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  55. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  56. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  57. package/lib/src/src/ai/AIClient.d.ts +32 -0
  58. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  59. package/lib/src/src/ai/Tasks.d.ts +37 -0
  60. package/lib/src/src/buildSchema.d.ts +1 -0
  61. package/lib/src/src/expression/Expression.d.ts +28 -0
  62. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  63. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  64. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  65. package/lib/src/src/index.d.ts +35 -0
  66. package/lib/src/src/jestSetup.d.ts +1 -0
  67. package/lib/src/src/language/Icon.d.ts +4 -0
  68. package/lib/src/src/language/Language.d.ts +206 -0
  69. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  70. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  71. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  72. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  73. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  74. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  75. package/lib/src/src/links/Links.d.ts +39 -0
  76. package/lib/src/src/links/Links.test.d.ts +1 -0
  77. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  78. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  79. package/lib/src/src/model/Subject.d.ts +25 -0
  80. package/lib/src/src/model/decorators.d.ts +545 -0
  81. package/lib/src/src/model/util.d.ts +12 -0
  82. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  83. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  84. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  85. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  86. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  87. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  88. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  89. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  90. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  91. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  92. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  93. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  94. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  95. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  96. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  97. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  98. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  99. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  100. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  101. package/lib/src/src/typeDefs.d.ts +1 -0
  102. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  103. package/lib/src/src/utils.d.ts +25 -0
  104. package/lib/src/utils.d.ts +0 -8
  105. package/lib/src/utils.js +7 -21
  106. package/package.json +15 -14
  107. package/src/Ad4mClient.test.ts +1315 -1564
  108. package/src/Ad4mClient.ts +54 -55
  109. package/src/Literal.test.ts +26 -45
  110. package/src/Literal.ts +66 -82
  111. package/src/SmartLiteral.ts +58 -74
  112. package/src/agent/AgentClient.ts +99 -144
  113. package/src/ai/AIClient.ts +359 -409
  114. package/src/expression/ExpressionClient.ts +96 -142
  115. package/src/index.ts +1 -1
  116. package/src/language/LanguageClient.ts +113 -137
  117. package/src/model/Ad4mModel.test.ts +616 -1114
  118. package/src/model/Ad4mModel.ts +4386 -451
  119. package/src/model/Subject.ts +159 -0
  120. package/src/model/decorators.ts +1168 -667
  121. package/src/model/util.ts +54 -53
  122. package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
  123. package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
  124. package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
  125. package/src/perspectives/PerspectiveClient.ts +540 -779
  126. package/src/perspectives/PerspectiveProxy.ts +2067 -2860
  127. package/src/runtime/RuntimeClient.ts +476 -775
  128. package/src/shacl/SHACLFlow.test.ts +129 -196
  129. package/src/shacl/SHACLShape.test.ts +190 -284
  130. package/src/shacl/SHACLShape.ts +200 -224
  131. package/src/utils.ts +17 -31
  132. package/tsconfig.json +10 -9
  133. package/src/model/IMPROVEMENTS.md +0 -482
  134. package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
  135. package/src/model/README.md +0 -317
  136. package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
  137. package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
  138. package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
  139. package/src/model/mutation.ts +0 -461
  140. package/src/model/parentUtils.ts +0 -91
  141. package/src/model/prolog/generatePrologFacts.ts +0 -176
  142. package/src/model/prolog/index.ts +0 -1
  143. package/src/model/query/ModelQueryBuilder.ts +0 -173
  144. package/src/model/query/fetchInstance.ts +0 -181
  145. package/src/model/query/hydration.ts +0 -273
  146. package/src/model/query/operations.ts +0 -510
  147. package/src/model/query/snapshot.ts +0 -126
  148. package/src/model/query/surrealCompiler.ts +0 -376
  149. package/src/model/schema/fromJSONSchema.ts +0 -411
  150. package/src/model/schema/metadata.ts +0 -148
  151. package/src/model/subscription.ts +0 -307
  152. package/src/model/transaction.ts +0 -60
  153. package/src/model/types.ts +0 -207
@@ -0,0 +1,28 @@
1
+ import { ApolloClient } from '@apollo/client/core';
2
+ import { AgentClient } from './agent/AgentClient';
3
+ import { LanguageClient } from './language/LanguageClient';
4
+ import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
5
+ import { PerspectiveClient } from './perspectives/PerspectiveClient';
6
+ import { RuntimeClient } from './runtime/RuntimeClient';
7
+ import { ExpressionClient } from './expression/ExpressionClient';
8
+ import { AIClient } from './ai/AIClient';
9
+ /**
10
+ * Client for the Ad4m interface wrapping GraphQL queryies
11
+ * for convenient use in user facing code.
12
+ *
13
+ * Aggregates the six sub-clients:
14
+ * AgentClient, ExpressionClient, LanguageClient,
15
+ * NeighbourhoodClient, PerspectiveClient and RuntimeClient
16
+ * for the respective functionality.
17
+ */
18
+ export declare class Ad4mClient {
19
+ #private;
20
+ constructor(client: ApolloClient<any>, subscribe?: boolean);
21
+ get agent(): AgentClient;
22
+ get expression(): ExpressionClient;
23
+ get languages(): LanguageClient;
24
+ get neighbourhood(): NeighbourhoodClient;
25
+ get perspective(): PerspectiveClient;
26
+ get runtime(): RuntimeClient;
27
+ get ai(): AIClient;
28
+ }
@@ -0,0 +1 @@
1
+ export type Address = string;
@@ -0,0 +1 @@
1
+ export type DID = string;
@@ -0,0 +1,7 @@
1
+ export declare enum ExceptionType {
2
+ LanguageIsNotLoaded = "LANGUAGE_IS_NOT_LOADED",
3
+ ExpressionIsNotVerified = "EXPRESSION_IS_NOT_VERIFIED",
4
+ AgentIsUntrusted = "AGENT_IS_UNTRUSTED",
5
+ CapabilityRequested = "CAPABILITY_REQUESTED",
6
+ InstallNotificationRequest = "INSTALL_NOTIFICATION_REQUEST"
7
+ }
@@ -0,0 +1,7 @@
1
+ export declare class Literal {
2
+ #private;
3
+ static fromUrl(url: string): Literal;
4
+ static from(literal: any): Literal;
5
+ toUrl(): string;
6
+ get(): any;
7
+ }
@@ -0,0 +1,17 @@
1
+ export declare const AGENT_UPDATED = "agent-updated-topic";
2
+ export declare const AGENT_STATUS_CHANGED = "agent-status-changed-topic";
3
+ export declare const RUNTIME_MESSAGED_RECEIVED_TOPIC = "runtime-messaged-received-topic";
4
+ export declare const PERSPECTIVE_ADDED_TOPIC = "perspective-added-topic";
5
+ export declare const PERSPECTIVE_UPDATED_TOPIC = "perspective-updated-topic";
6
+ export declare const PERSPECTIVE_REMOVED_TOPIC = "perspective-removed-topic";
7
+ export declare const LINK_ADDED_TOPIC = "link-added-topic";
8
+ export declare const LINK_REMOVED_TOPIC = "link-removed-topic";
9
+ export declare const LINK_UDATED_TOPIC = "link-updated-topic";
10
+ export declare const SIGNAL = "signal";
11
+ export declare const EXCEPTION_OCCURRED_TOPIC = "exception-occurred-topic";
12
+ export declare const RUNTIME_NOTIFICATION_REQUESTED_TOPIC = "runtime-notification-requested-topic";
13
+ export declare const RUNTIME_NOTIFICATION_TRIGGERED_TOPIC = "runtime-notification-triggered-topic";
14
+ export declare const NEIGHBOURHOOD_SIGNAL_RECEIVED_TOPIC = "neighbourhood-signal-received-topic";
15
+ export declare const PERSPECTIVE_SYNC_STATE_CHANGE = "perspective-sync-state-change";
16
+ export declare const APPS_CHANGED = "apps-changed";
17
+ export declare const AI_TRANSCRIPTION_TEXT_TOPIC = "ai-transcription-text-topic";
@@ -0,0 +1,12 @@
1
+ import { PerspectiveProxy } from "./perspectives/PerspectiveProxy";
2
+ export declare const SMART_LITERAL_CONTENT_PREDICATE = "smart_literal://content";
3
+ export declare class SmartLiteral {
4
+ #private;
5
+ constructor(perspective: PerspectiveProxy, base: string);
6
+ get base(): string;
7
+ static create(perspective: PerspectiveProxy, literal: any): Promise<SmartLiteral>;
8
+ static isSmartLiteralBase(perspective: PerspectiveProxy, base: string): Promise<boolean>;
9
+ static getAllSmartLiterals(perspective: PerspectiveProxy): Promise<SmartLiteral[]>;
10
+ get(): Promise<any>;
11
+ set(content: any): Promise<void>;
12
+ }
@@ -0,0 +1,110 @@
1
+ import { Perspective } from "../perspectives/Perspective";
2
+ /** AD4M's representation of an Agent
3
+ *
4
+ * AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
5
+ * Conceptually, an Agent is regarded as something that can speak and that can listen.
6
+ *
7
+ * Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
8
+ * And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
9
+ * They listen (can receive messages) through their "direct message Language".
10
+ *
11
+ * These three aspects are represented by the three fields of this class.
12
+ *
13
+ * This class is used as format for the Expressions in the Agent language.
14
+ * Since AD4M treats DID URIs as addresses for the Agent Language,
15
+ * DIDs are resolved to Expressions that are objects of this class.
16
+ * Thus, this is how agents see (other) agents.
17
+ */
18
+ export declare class Agent {
19
+ /** The DID of the Agent
20
+ * All epxressions authored by them are signed with the keys mentioned
21
+ * in the DID document behind this DID URI.
22
+ */
23
+ did: string;
24
+ /** The Perspective that holds the public-facing semantics/statements of the Agent
25
+ * Holds and shares a Perspective that links all information
26
+ * this agent wants to offer as public-facing semantics.
27
+ * This should be used for any kind of user profile information.
28
+ */
29
+ perspective?: Perspective;
30
+ /** Address of the Language by which the Agent will receive DMs */
31
+ directMessageLanguage?: string;
32
+ constructor(did: string, perspective?: Perspective);
33
+ }
34
+ declare const AgentExpression_base: any;
35
+ export declare class AgentExpression extends AgentExpression_base {
36
+ }
37
+ export declare class EntanglementProof {
38
+ did: string;
39
+ didSigningKeyId: string;
40
+ deviceKeyType: string;
41
+ deviceKey: string;
42
+ deviceKeySignedByDid: string;
43
+ didSignedByDeviceKey?: string;
44
+ constructor(did: string, didSigningKeyId: string, deviceKeyType: string, deviceKey: string, deviceKeySignedByDid: string, didSignedByDeviceKey?: string);
45
+ }
46
+ export declare class EntanglementProofInput {
47
+ did: string;
48
+ didSigningKeyId: string;
49
+ deviceKeyType: string;
50
+ deviceKey: string;
51
+ deviceKeySignedByDid: string;
52
+ didSignedByDeviceKey: string;
53
+ constructor(did: string, didSigningKeyId: string, deviceKeyType: string, deviceKey: string, deviceKeySignedByDid: string, didSignedByDeviceKey: string);
54
+ }
55
+ export declare class AgentSignature {
56
+ signature: string;
57
+ publicKey: string;
58
+ constructor(signature: string, publicKey: string);
59
+ }
60
+ export declare class Resource {
61
+ domain: string;
62
+ pointers: string[];
63
+ constructor(domain: string, pointers: string[]);
64
+ }
65
+ export declare class Capability {
66
+ with: Resource;
67
+ can: string[];
68
+ constructor(withF: Resource, can: string[]);
69
+ }
70
+ export declare class AuthInfo {
71
+ appName: string;
72
+ appDesc: string;
73
+ appUrl: string;
74
+ appIconPath?: string;
75
+ capabilities: Capability[];
76
+ constructor(appName: string, appDesc: string, appUrl: string, capabilities: Capability[], appIconPath?: string);
77
+ }
78
+ export declare class Apps {
79
+ requestId: string;
80
+ token: string;
81
+ revoked?: boolean;
82
+ auth: AuthInfo;
83
+ constructor(requestId: string, auth: AuthInfo, token: string, revoked?: boolean);
84
+ }
85
+ export declare class ResourceInput {
86
+ domain: string;
87
+ pointers: string[];
88
+ constructor(domain: string, pointers: string[]);
89
+ }
90
+ export declare class CapabilityInput {
91
+ with: ResourceInput;
92
+ can: string[];
93
+ constructor(withF: ResourceInput, can: string[]);
94
+ }
95
+ export declare class AuthInfoInput {
96
+ appName: string;
97
+ appDesc: string;
98
+ appDomain: string;
99
+ appUrl?: string;
100
+ appIconPath?: string;
101
+ capabilities?: CapabilityInput[];
102
+ constructor(appName: string, appDesc: string, appDomain: string, appUrl?: string, appIconPath?: string, capabilities?: CapabilityInput[]);
103
+ }
104
+ export declare class UserCreationResult {
105
+ did: string;
106
+ success: boolean;
107
+ error?: string;
108
+ constructor(did: string, success: boolean, error?: string);
109
+ }
110
+ export {};
@@ -0,0 +1,62 @@
1
+ import { ApolloClient } from "@apollo/client/core";
2
+ import { PerspectiveInput } from "../perspectives/Perspective";
3
+ import { Agent, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, UserCreationResult } from "./Agent";
4
+ import { AgentStatus } from "./AgentStatus";
5
+ import { LinkMutations } from "../links/Links";
6
+ import { VerificationRequestResult } from "../runtime/RuntimeResolver";
7
+ export interface InitializeArgs {
8
+ did: string;
9
+ didDocument: string;
10
+ keystore: string;
11
+ passphrase: string;
12
+ }
13
+ export type AgentUpdatedCallback = (agent: Agent) => null;
14
+ export type AgentStatusChangedCallback = (agent: Agent) => null;
15
+ export type AgentAppsUpdatedCallback = () => null;
16
+ /**
17
+ * Provides access to all functions regarding the local agent,
18
+ * such as generating, locking, unlocking, importing the DID keystore,
19
+ * as well as updating the publicly shared Agent expression.
20
+ */
21
+ export declare class AgentClient {
22
+ #private;
23
+ constructor(client: ApolloClient<any>, subscribe?: boolean);
24
+ /**
25
+ * Returns the Agent expression of the local agent as it is shared
26
+ * publicly via the AgentLanguage.
27
+ *
28
+ * I.e. this is the users profile.
29
+ */
30
+ me(): Promise<Agent>;
31
+ status(): Promise<AgentStatus>;
32
+ generate(passphrase: string): Promise<AgentStatus>;
33
+ import(args: InitializeArgs): Promise<AgentStatus>;
34
+ lock(passphrase: string): Promise<AgentStatus>;
35
+ unlock(passphrase: string, holochain?: boolean): Promise<AgentStatus>;
36
+ byDID(did: string): Promise<Agent>;
37
+ updatePublicPerspective(perspective: PerspectiveInput): Promise<Agent>;
38
+ mutatePublicPerspective(mutations: LinkMutations): Promise<Agent>;
39
+ updateDirectMessageLanguage(directMessageLanguage: string): Promise<Agent>;
40
+ addEntanglementProofs(proofs: EntanglementProofInput[]): Promise<EntanglementProof[]>;
41
+ deleteEntanglementProofs(proofs: EntanglementProofInput[]): Promise<EntanglementProof[]>;
42
+ getEntanglementProofs(): Promise<string[]>;
43
+ entanglementProofPreFlight(deviceKey: string, deviceKeyType: string): Promise<EntanglementProof>;
44
+ addUpdatedListener(listener: any): void;
45
+ addAppChangedListener(listener: any): void;
46
+ subscribeAgentUpdated(): void;
47
+ subscribeAppsChanged(): void;
48
+ addAgentStatusChangedListener(listener: any): void;
49
+ subscribeAgentStatusChanged(): void;
50
+ requestCapability(authInfo: AuthInfoInput): Promise<string>;
51
+ permitCapability(auth: string): Promise<string>;
52
+ generateJwt(requestId: string, rand: string): Promise<string>;
53
+ getApps(): Promise<Apps[]>;
54
+ removeApp(requestId: string): Promise<Apps[]>;
55
+ revokeToken(requestId: string): Promise<Apps[]>;
56
+ isLocked(): Promise<boolean>;
57
+ signMessage(message: string): Promise<string>;
58
+ createUser(email: string, password: string, appInfo?: AuthInfoInput): Promise<UserCreationResult>;
59
+ loginUser(email: string, password: string): Promise<string>;
60
+ requestLoginVerification(email: string, appInfo?: AuthInfoInput): Promise<VerificationRequestResult>;
61
+ verifyEmailCode(email: string, code: string, verificationType: string): Promise<string>;
62
+ }
@@ -0,0 +1,30 @@
1
+ import { PerspectiveInput } from "../perspectives/Perspective";
2
+ import { Agent, AgentSignature, AuthInfoInput, EntanglementProof, EntanglementProofInput } from "./Agent";
3
+ import { AgentStatus } from "./AgentStatus";
4
+ export declare const TEST_AGENT_DID = "did:ad4m:test";
5
+ export default class AgentResolver {
6
+ agent(): Agent;
7
+ agentStatus(): AgentStatus;
8
+ agentGenerate(passphrase: string, pubSub: any): AgentStatus;
9
+ agentImport(did: string, didDocument: string, keystore: string, passphrase: string): AgentStatus;
10
+ agentLock(passphrase: string, pubSub: any): AgentStatus;
11
+ agentUnlock(passphrase: string, holochain: boolean, pubSub: any): AgentStatus;
12
+ agentByDID(did: string): Agent;
13
+ agentUpdatePublicPerspective(perspective: PerspectiveInput, pubSub: any): Agent;
14
+ agentUpdateDirectMessageLanguage(directMessageLanguage: string, pubSub: any): Agent;
15
+ agentUpdated(): Agent;
16
+ agentStatusChanged(): AgentStatus;
17
+ agentAddEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[];
18
+ agentDeleteEntanglementProofs(proofs: EntanglementProofInput[]): EntanglementProof[];
19
+ agentGetEntanglementProofs(): EntanglementProof[];
20
+ agentEntanglementProofPreFlight(deviceKey: string, deviceKeyType: string): EntanglementProof;
21
+ agentRequestCapability(authInfo: AuthInfoInput): String;
22
+ agentPermitCapability(auth: string): String;
23
+ agentGenerateJwt(requestId: string, rand: string): String;
24
+ agentIsLocked(): Boolean;
25
+ agentGetApps(): [];
26
+ agentAppsChanged(): null;
27
+ agentRemoveApp(requestId: string, pubSub: any): [];
28
+ agentRevokeToken(requestId: string): any[];
29
+ agentSignMessage(message: string): AgentSignature;
30
+ }
@@ -0,0 +1,8 @@
1
+ export declare class AgentStatus {
2
+ isInitialized: Boolean;
3
+ isUnlocked: Boolean;
4
+ did?: string;
5
+ didDocument?: string;
6
+ error?: string;
7
+ constructor(obj?: object);
8
+ }
@@ -0,0 +1,32 @@
1
+ import { ApolloClient } from "@apollo/client";
2
+ import { AIModelLoadingStatus, AITask } from "./Tasks";
3
+ import { ModelInput, Model, ModelType } from "./AIResolver";
4
+ export declare class AIClient {
5
+ #private;
6
+ constructor(apolloClient: ApolloClient<any>, subscribe?: boolean);
7
+ getModels(): Promise<Model[]>;
8
+ addModel(model: ModelInput): Promise<string>;
9
+ updateModel(modelId: string, model: ModelInput): Promise<boolean>;
10
+ removeModel(modelId: string): Promise<boolean>;
11
+ setDefaultModel(modelType: ModelType, modelId: string): Promise<boolean>;
12
+ getDefaultModel(modelType: ModelType): Promise<Model>;
13
+ tasks(): Promise<AITask[]>;
14
+ addTask(name: string, modelId: string, systemPrompt: string, promptExamples: {
15
+ input: string;
16
+ output: string;
17
+ }[], metaData?: string): Promise<AITask>;
18
+ removeTask(taskId: string): Promise<AITask>;
19
+ updateTask(taskId: string, task: AITask): Promise<AITask>;
20
+ modelLoadingStatus(model: string): Promise<AIModelLoadingStatus>;
21
+ prompt(taskId: string, prompt: string): Promise<string>;
22
+ embed(modelId: string, text: string): Promise<Array<number>>;
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>;
30
+ closeTranscriptionStream(streamId: string): Promise<void>;
31
+ feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void>;
32
+ }
@@ -0,0 +1,75 @@
1
+ import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
2
+ export declare class ModelApi {
3
+ baseUrl: string;
4
+ apiKey: string;
5
+ model: string;
6
+ apiType: String;
7
+ }
8
+ export declare class TokenizerSource {
9
+ repo: string;
10
+ revision: string;
11
+ fileName: string;
12
+ }
13
+ export declare class LocalModel {
14
+ fileName: string;
15
+ tokenizerSource?: TokenizerSource;
16
+ huggingfaceRepo?: string;
17
+ revision?: string;
18
+ }
19
+ export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
20
+ export declare class Model {
21
+ id: string;
22
+ name: string;
23
+ api?: ModelApi;
24
+ local?: LocalModel;
25
+ modelType: ModelType;
26
+ }
27
+ export declare class ModelApiInput {
28
+ baseUrl: string;
29
+ apiKey: string;
30
+ model: string;
31
+ apiType: string;
32
+ }
33
+ export declare class TokenizerSourceInput {
34
+ repo: string;
35
+ revision: string;
36
+ fileName: string;
37
+ }
38
+ export declare class LocalModelInput {
39
+ fileName: string;
40
+ tokenizerSource?: TokenizerSourceInput;
41
+ huggingfaceRepo?: string;
42
+ revision?: string;
43
+ }
44
+ export declare class ModelInput {
45
+ name: string;
46
+ api?: ModelApiInput;
47
+ local?: LocalModelInput;
48
+ modelType: ModelType;
49
+ }
50
+ export declare class VoiceActivityParamsInput {
51
+ startThreshold?: number;
52
+ startWindow?: number;
53
+ endThreshold?: number;
54
+ endWindow?: number;
55
+ timeBeforeSpeech?: number;
56
+ }
57
+ export default class AIResolver {
58
+ aiGetModels(): Model[];
59
+ aiAddModel(model: ModelInput): string;
60
+ aiUpdateModel(modelId: string, model: ModelInput): boolean;
61
+ aiRemoveModel(modelId: string): boolean;
62
+ aiSetDefaultModel(modelType: ModelType, modelId: string): boolean;
63
+ aiGetDefaultModel(modelType: ModelType): Model;
64
+ aiTasks(): AITask[];
65
+ aiAddTask(task: AITaskInput): AITask;
66
+ aiRemoveTask(taskId: string): AITask;
67
+ aiUpdateTask(taskId: string, task: AITaskInput): AITask;
68
+ aiModelLoadingStatus(model: string): AIModelLoadingStatus;
69
+ aiPrompt(taskId: string, input: string): string;
70
+ aiEmbed(modelId: string, text: string): string;
71
+ aiOpenTranscriptionStream(modelId: string, params?: VoiceActivityParamsInput): string;
72
+ aiCloseTranscriptionStream(streamId: string): boolean;
73
+ aiFeedTranscriptionStream(streamIds: string[], audio: number[], pubSub: any): boolean;
74
+ aiTranscriptionText(streamId: string): string;
75
+ }
@@ -0,0 +1,37 @@
1
+ export declare class AIPromptExamplesInput {
2
+ input: string;
3
+ output: string;
4
+ constructor(input: string, output: string);
5
+ }
6
+ export declare class AIPromptExamples {
7
+ input: string;
8
+ output: string;
9
+ constructor(input: string, output: string);
10
+ }
11
+ export declare class AITaskInput {
12
+ name: string;
13
+ modelId: string;
14
+ systemPrompt: string;
15
+ promptExamples: AIPromptExamplesInput[];
16
+ metaData: string;
17
+ constructor(name: string, model_id: string, system_prompt: string, prompt_examples: AIPromptExamplesInput[], metaData?: string);
18
+ }
19
+ export declare class AITask {
20
+ name: string;
21
+ modelId: string;
22
+ taskId: string;
23
+ systemPrompt: string;
24
+ promptExamples: AIPromptExamples[];
25
+ metaData?: string;
26
+ createdAt: string;
27
+ updatedAt: string;
28
+ constructor(name: string, model_id: string, task_id: string, system_prompt: string, prompt_examples: AIPromptExamples[], metaData?: string, created_at?: string, updated_at?: string);
29
+ }
30
+ export declare class AIModelLoadingStatus {
31
+ model: string;
32
+ status: string;
33
+ progress: number;
34
+ downloaded: boolean;
35
+ loaded: boolean;
36
+ constructor(model: string, status: string, progress: number, downloaded: boolean, loaded: boolean);
37
+ }
@@ -0,0 +1 @@
1
+ import "reflect-metadata";
@@ -0,0 +1,28 @@
1
+ import { ClassType } from "type-graphql";
2
+ import { Icon } from "../language/Icon";
3
+ import { LanguageRef } from "../language/LanguageRef";
4
+ export declare class ExpressionProof {
5
+ signature: string;
6
+ key: string;
7
+ valid?: boolean;
8
+ invalid?: boolean;
9
+ constructor(sig: string, k: string);
10
+ }
11
+ export declare class ExpressionProofInput {
12
+ signature: string;
13
+ key: string;
14
+ valid?: boolean;
15
+ invalid?: boolean;
16
+ }
17
+ export declare function ExpressionGeneric<DataType>(DataTypeClass: ClassType<DataType>): any;
18
+ export declare function ExpressionGenericInput<DataType>(DataTypeClass: ClassType<DataType>): any;
19
+ declare const Expression_base: any;
20
+ export declare class Expression extends Expression_base {
21
+ }
22
+ declare const ExpressionRendered_base: any;
23
+ export declare class ExpressionRendered extends ExpressionRendered_base {
24
+ language: LanguageRef;
25
+ icon: Icon;
26
+ }
27
+ export declare function isExpression(e: any): boolean;
28
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ApolloClient } from "@apollo/client/core";
2
+ import { InteractionCall, InteractionMeta } from "../language/Language";
3
+ import { ExpressionRendered } from "./Expression";
4
+ export declare class ExpressionClient {
5
+ #private;
6
+ constructor(client: ApolloClient<any>);
7
+ get(url: string, alwaysGet?: boolean): Promise<ExpressionRendered>;
8
+ getMany(urls: string[]): Promise<ExpressionRendered[]>;
9
+ getRaw(url: string): Promise<string>;
10
+ create(content: any, languageAddress: string): Promise<string>;
11
+ interactions(url: string): Promise<InteractionMeta[]>;
12
+ interact(url: string, interactionCall: InteractionCall): Promise<string | null>;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { Address } from '../Address';
2
+ import { LanguageRef } from '../language/LanguageRef';
3
+ export declare class ExpressionRef {
4
+ language: LanguageRef;
5
+ expression: Address;
6
+ constructor(lang: LanguageRef, expr: Address);
7
+ }
8
+ export declare function exprRef2String(ref: ExpressionRef): string;
9
+ export declare function parseExprUrl(url: string): ExpressionRef;
@@ -0,0 +1,10 @@
1
+ import { ExpressionRendered } from "./Expression";
2
+ import { InteractionCall, InteractionMeta } from "../language/Language";
3
+ export default class ExpressionResolver {
4
+ expression(url: string): ExpressionRendered;
5
+ expressionMany(urls: string[]): (ExpressionRendered | null)[];
6
+ expressionRaw(url: string): string;
7
+ expressionCreate(content: string, languageAddress: string): string;
8
+ expressionInteractions(url: string): InteractionMeta[];
9
+ expressionInteract(url: string, interactionCall: InteractionCall): string | null;
10
+ }
@@ -0,0 +1,35 @@
1
+ export * from "./Ad4mClient";
2
+ export * from "./Address";
3
+ export * from "./agent/Agent";
4
+ export * from "./agent/AgentStatus";
5
+ export * from "./Exception";
6
+ export * from "./expression/Expression";
7
+ export * from "./expression/ExpressionRef";
8
+ export * from "./language/Icon";
9
+ export * from "./language/Language";
10
+ export * from "./language/LanguageRef";
11
+ export * from "./language/LanguageContext";
12
+ export * from "./language/LanguageHandle";
13
+ export * from "./language/LanguageMeta";
14
+ export * from "./links/Links";
15
+ export * from "./Literal";
16
+ export * from "./perspectives/Perspective";
17
+ export * from "./perspectives/PerspectiveHandle";
18
+ export * from "./perspectives/PerspectiveProxy";
19
+ export * from "./perspectives/PerspectiveDiff";
20
+ export * from "./perspectives/LinkQuery";
21
+ export * from "./SmartLiteral";
22
+ export * from "./model/decorators";
23
+ export * from "./model/Subject";
24
+ export * from "./neighbourhood/Neighbourhood";
25
+ export * from "./neighbourhood/NeighbourhoodProxy";
26
+ export * from "./typeDefs";
27
+ export * from "./DID";
28
+ export * from "./utils";
29
+ export * from "./agent/AgentClient";
30
+ export * from "./ai/AIClient";
31
+ export * from "./ai/Tasks";
32
+ export * from "./runtime/RuntimeResolver";
33
+ export * from './model/Ad4mModel';
34
+ export * from './shacl/SHACLShape';
35
+ export { SHACLFlow, FlowState, FlowTransition, LinkPattern, FlowableCondition } from './shacl/SHACLFlow';
@@ -0,0 +1 @@
1
+ import 'reflect-metadata';
@@ -0,0 +1,4 @@
1
+ export declare class Icon {
2
+ code: string;
3
+ constructor(code: string);
4
+ }