MCPcopy Create free account
hub / github.com/apache/maka / resolveShellRunOwner

Method resolveShellRunOwner

packages/runtime/src/session-manager.ts:5097–5124  ·  view source on GitHub ↗
(
    firstParentSessionId: string,
    ref: string,
  )

Source from the content-addressed store, hash-verified

5095 }
5096
5097 private async resolveShellRunOwner(
5098 firstParentSessionId: string,
5099 ref: string,
5100 ): Promise<{ sessionId: string; result: ShellRunUpdate['result'] } | undefined> {
5101 const shellRuns = this.deps.shellRuns;
5102 if (!shellRuns) return undefined;
5103 let ownerSessionId: string | undefined = firstParentSessionId;
5104 const visited = new Set<string>();
5105 while (ownerSessionId && !visited.has(ownerSessionId)) {
5106 visited.add(ownerSessionId);
5107 try {
5108 return {
5109 sessionId: ownerSessionId,
5110 result: await shellRuns.inspectResource(ownerSessionId, ref),
5111 };
5112 } catch (error) {
5113 if (!isNotFoundError(error)) throw error;
5114 try {
5115 const ownerHeader = await this.deps.store.readHeader(ownerSessionId);
5116 ownerSessionId = ownerHeader.revisionParentSessionId ?? ownerHeader.parentSessionId;
5117 } catch (headerError) {
5118 if (isNotFoundError(headerError)) return undefined;
5119 throw headerError;
5120 }
5121 }
5122 }
5123 return undefined;
5124 }
5125
5126 private async readShellRunProjectionMessages(sessionId: string): Promise<StoredMessage[] | null> {
5127 try {

Callers 2

listShellRunUpdatesMethod · 0.95
getShellRunUpdateMethod · 0.95

Calls 5

isNotFoundErrorFunction · 0.70
hasMethod · 0.65
addMethod · 0.65
inspectResourceMethod · 0.65
readHeaderMethod · 0.65

Tested by

no test coverage detected