mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-03 13:17:07 +00:00
fix(agentstack): require agent DIDs for registration (#85)
This commit is contained in:
parent
41ab662afa
commit
895bb9989e
2 changed files with 7 additions and 5 deletions
|
|
@ -76,11 +76,12 @@ export class AgentStack {
|
|||
return `${prefix}_${this.seq}`;
|
||||
}
|
||||
|
||||
registerAgent(agent: AgentProfile): AgentProfile {
|
||||
if (!parseDid(agent.did)) {
|
||||
throw new Error(`Invalid agent DID: ${agent.did}`);
|
||||
}
|
||||
this.agents.set(agent.did, agent);
|
||||
registerAgent(agent: AgentProfile): AgentProfile {
|
||||
const parsed = parseDid(agent.did);
|
||||
if (!parsed || parsed.kind !== "agent") {
|
||||
throw new Error(`Invalid agent DID: ${agent.did}`);
|
||||
}
|
||||
this.agents.set(agent.did, agent);
|
||||
this.emit({ type: "agent.registered", agent });
|
||||
return agent;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue