MCPcopy Create free account
hub / github.com/cloudflare/computer / #shellFor

Method #shellFor

packages/computer/src/workspace.ts:922–937  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

920 // always paired with the live handle for that id at the moment
921 // of the lookup.
922 async #shellFor(id: string): Promise<{ shell: WorkspaceShell; handle: BackendHandle }> {
923 const handle = await this.#handleFor(id);
924 const cached = this.#shells.get(id);
925 if (cached !== undefined) return { shell: cached, handle };
926 const shell = new WorkspaceShell(
927 handle.rpc.shell,
928 {
929 push: () => this.push(id),
930 pull: () => this.pull(id),
931 onPullPending: () => this.#schedulePendingSync(id),
932 },
933 this.#observer,
934 );
935 this.#shells.set(id, shell);
936 return { shell, handle };
937 }
938
939 // Routed shell facade. Each method picks the right backend per
940 // call (default, or the one named through ExecOptions.backend)

Callers 5

#routedShellMethod · 0.95
execMethod · 0.80
getMethod · 0.80
killMethod · 0.80
disposeMethod · 0.80

Calls 6

#handleForMethod · 0.95
pushMethod · 0.95
pullMethod · 0.95
#schedulePendingSyncMethod · 0.95
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected