MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / ownerOfPending

Method ownerOfPending

mcp/src/client.ts:301–314  ·  view source on GitHub ↗
(messageId: string)

Source from the content-addressed store, hash-verified

299 // only /v1/reviews/{id}, which 403s an agent-scoped credential. For a pinned
300 // session this is one list call.
301 private async ownerOfPending(messageId: string): Promise<string> {
302 const addresses = this.agentEmail
303 ? [this.agentEmail]
304 : (await this.listAgents()).map((a) => a.email);
305 for (const address of addresses) {
306 const rows = await this.sdk.messages
307 .list(address, { direction: "outbound" })
308 .toArray({ limit: DEFAULT_LIST_LIMIT });
309 if (rows.some((r) => r.messageId === messageId)) return address;
310 }
311 throw new Error(
312 `pending message ${messageId} not found on any owned agent (it may have already been approved, rejected, or expired).`,
313 );
314 }
315
316 async getPendingMessage(messageId: string): Promise<MessageView> {
317 // Runtime-tier (agent-visible): use the agent-reachable messages path, not

Callers 1

getPendingMessageMethod · 0.95

Calls 3

listAgentsMethod · 0.95
toArrayMethod · 0.80
listMethod · 0.45

Tested by

no test coverage detected