Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c4debfb
Add AgentService struct and its methods
fayeed Mar 5, 2024
11fce9e
Add PartialEq, Eq, and Hash traits to EntanglementProof struct
fayeed Mar 5, 2024
b3ad41b
Add entanglement_service module
fayeed Mar 5, 2024
14c8e09
Update delete_entanglement_proof function to accept multiple proofs
fayeed Mar 6, 2024
6c1ec84
Update entanglement proof service and query resolvers
fayeed Mar 6, 2024
4437ee7
Remove EntanglementProofController class
fayeed Mar 6, 2024
b3ddc5b
Fix cloning of agent's DID in entanglement_service and query_resolvers
fayeed Mar 7, 2024
91a7eed
Add agent extension methods for loading, unlocking, locking, and savi…
fayeed Mar 7, 2024
9109540
Fix function name in agent_extension.js
fayeed Mar 7, 2024
9d4068b
Update entanglement service extension to use generate_entanglement_proof
fayeed Mar 7, 2024
79a5703
Remove AgentService from HolochainService
fayeed Mar 7, 2024
011d33c
Fix RuntimeService class initialization and update getTrustedAgents m…
fayeed Mar 7, 2024
24e0107
Fix Perspective setupPendingDiffsPublishing() function
fayeed Mar 7, 2024
7d10cb2
removed AgentService
fayeed Mar 7, 2024
578e733
Refactor Ad4mCore class and remove unused code
fayeed Mar 7, 2024
c386ca2
Refactor AgentService class and update AGENT usage
fayeed Mar 7, 2024
bed8b8c
Merge branch 'dev' into agent-entanglement-rust
fayeed Mar 18, 2024
049cfd6
Commit forgotten merged files
fayeed Mar 18, 2024
f08abde
Merge branch 'dev' into agent-entanglement-rust
fayeed Mar 25, 2024
14586c2
Fix agent.me not sending valid & invalid proof
fayeed Mar 25, 2024
5c07da9
Add capability check for agent status
fayeed Mar 28, 2024
486b18d
Add Perspective struct to Agent and initialize it with an empty links…
fayeed Mar 28, 2024
fb3ba74
Fix agent link status deletion
fayeed Mar 28, 2024
629362d
Merge branch 'dev' into agent-entanglement-rust
fayeed Mar 30, 2024
322713a
Remove unused GraphQL resolvers
fayeed Mar 30, 2024
4ba9f75
Added new methods called with_global_instance & with_mutable_global_i…
fayeed Apr 6, 2024
27d11c9
Refactor agent-related query and mutation resolvers
fayeed Apr 6, 2024
445d846
Add entanglement proof table and related functions
fayeed Apr 6, 2024
d6b317a
Refactor entanglement service module
fayeed Apr 6, 2024
7d0bc93
Refactor AgentService initialization and add global instance support
fayeed Apr 6, 2024
5a16f11
Refactor RuntimeService to use a global instance
fayeed Apr 6, 2024
198e67c
Refactor runtime service and agent initialization
fayeed Apr 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bootstrap-languages/agent-language/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Sharing implements PublicSharing {

constructor(context: LanguageContext) {
this.#DNA = context.Holochain as HolochainLanguageDelegate;
this.#agent = context.agent;
this.#agent = context.agent;
}

async createPublic(content: Agent): Promise<Address> {
Expand All @@ -49,9 +49,11 @@ class Sharing implements PublicSharing {
agent.perspective!.links.forEach(link => {
delete link.proof.valid
delete link.proof.invalid
delete link.status
})

const expression = this.#agent.createSignedExpression(agent);

await this.#DNA.call(
DNA_NICK,
"agent_store",
Expand Down
9 changes: 9 additions & 0 deletions executor/src/agent_extension.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { AgentStatus } from "@coasys/ad4m";

export interface VerificationMethod {
id: string;
type: string;
Expand Down Expand Up @@ -50,6 +52,13 @@ declare global {
createSignedExpression: (data: any) => Expression;
sign: (payload: Uint8Array) => Uint8Array;
signStringHex: (payload: string) => string;
load: () => AgentStatus;
agent: () => Agent;
isInitialized: () => boolean;
isUnlocked: () => boolean;
unlock: (password: string) => boolean;
lock: () => void;
save_agent_profile: (agent: Agent) => void;
}

const AGENT: RustAgent;
Expand Down
26 changes: 6 additions & 20 deletions executor/src/core/Ad4mCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import LanguageController from './LanguageController'
import * as DIDs from './agent/DIDs'
import type { DIDResolver } from './agent/DIDs'
import * as PubSubDefinitions from './graphQL-interface/SubscriptionDefinitions'
import EntanglementProofController from './EntanglementProof'
import fs from 'node:fs'
import { AgentInfoResponse } from '@holochain/client'
import { v4 as uuidv4 } from 'uuid';
Expand Down Expand Up @@ -56,7 +55,6 @@ export default class Ad4mCore {

#languageController?: LanguageController

#entanglementProofController?: EntanglementProofController
#languagesReady: Promise<void>
#resolveLanguagesReady: (value: void) => void

Expand All @@ -66,7 +64,7 @@ export default class Ad4mCore {
this.#config = Config.init(config);

this.#agentService = new AgentService(this.#config.rootConfigPath, this.#config.adminCredential)
this.#agentService.load()
const agent = AGENT.load();
this.#db = Db.init(this.#config.dataPath)
this.#didResolver = DIDs.init(this.#config.dataPath)
const that = this
Expand Down Expand Up @@ -122,13 +120,6 @@ export default class Ad4mCore {
return this.#languageController!
}

get entanglementProofController(): EntanglementProofController {
if (!this.#entanglementProofController) {
this.#entanglementProofController = new EntanglementProofController(this.#config.rootConfigPath, this.#agentService);
}
return this.#entanglementProofController
}

async exit() {
console.log("Exiting gracefully...")
console.log("Stopping Holochain conductor")
Expand Down Expand Up @@ -161,17 +152,13 @@ export default class Ad4mCore {
hcBootstrapUrl: params.hcBootstrapUrl,
}

this.#holochain = new HolochainService(holochainConfig, this.#agentService, this.entanglementProofController)
this.#holochain = new HolochainService(holochainConfig)
await this.#holochain.run({
...holochainConfig,
passphrase: params.passphrase!
});
}

async waitForAgent(): Promise<void> {
return this.#agentService.ready
}

async waitForLanguages(): Promise<void> {
return this.#languagesReady
}
Expand All @@ -191,8 +178,6 @@ export default class Ad4mCore {
ad4mSignal: this.languageSignal,
config: this.#config,
}, { holochainService: this.#holochain!, db: this.#db } )

this.entanglementProofController
}

async initLanguages() {
Expand Down Expand Up @@ -256,14 +241,14 @@ export default class Ad4mCore {
console.log("wait for languages");
await this.waitForLanguages()
console.log("finished wait");
const agent = this.#agentService.agent!
const agent = AGENT.agent();
if(agent.directMessageLanguage) return
console.log("Agent doesn't have direct message language set yet. Creating from template...")

console.log("Cloning direct message language from template...");
const templateParams = {
uid: uuidv4(),
recipient_did: this.#agentService.agent?.did,
recipient_did: agent?.did,
recipient_hc_agent_pubkey: Buffer.from(await HOLOCHAIN_SERVICE.getAgentKey()).toString('hex')
}
console.debug("Now creating clone with parameters:", templateParams)
Expand Down Expand Up @@ -292,7 +277,8 @@ export default class Ad4mCore {
}

async myDirectMessageLanguage(): Promise<Language> {
const dmLang = this.#agentService.agent!.directMessageLanguage!
const agent = AGENT.agent();
const dmLang = agent!.directMessageLanguage!
return await this.#languageController!.languageByRef(new LanguageRef(dmLang))
}
}
Expand Down
55 changes: 0 additions & 55 deletions executor/src/core/EntanglementProof.ts

This file was deleted.

4 changes: 2 additions & 2 deletions executor/src/core/LanguageController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class LanguageController {
}
const agentLanguage = await this.installLanguage(this.#config.languageAliases[Config.agentLanguageAlias], null);
this.#agentLanguage = agentLanguage!;
((this.#context as LanguageContext).agent as AgentService).setAgentLanguage(agentLanguage!)
((this.#context as LanguageContext).agent as unknown as AgentService).setAgentLanguage(agentLanguage!)

//Install the neighbourhood language and set
if (this.#config.neighbourhoodLanguageSettings) {
Expand Down Expand Up @@ -517,7 +517,7 @@ export default class LanguageController {
const trustedAgents: string[] = await RUNTIME_SERVICE.getTrustedAgents();
const agentService = (this.#context as LanguageContext).agent as AgentService;
//Check if the author of the language is in the trusted agent list the current agent holds, if so then go ahead and install
if (trustedAgents.find((agent) => agent === languageAuthor) || agentService.agent! === languageAuthor) {
if (trustedAgents.find((agent) => agent === languageAuthor) || AGENT.did() === languageAuthor) {
//Get the language source so we can generate a hash and check against the hash given in the language meta information
const languageSource = await this.getLanguageSource(address);
if (!languageSource) {
Expand Down
Loading