MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / registerEmbeddedParentDisconnectShutdown

Function registerEmbeddedParentDisconnectShutdown

src/runtime/server.ts:33–52  ·  view source on GitHub ↗
({
  runtimeMode,
  hasIpcChannel,
  lifecycle,
  proc = process,
}: {
  runtimeMode: "standalone" | "embedded";
  hasIpcChannel: boolean;
  lifecycle: Pick<Lifecycle, "requestShutdown">;
  proc?: DisconnectEmitter;
})

Source from the content-addressed store, hash-verified

31};
32
33export function registerEmbeddedParentDisconnectShutdown({
34 runtimeMode,
35 hasIpcChannel,
36 lifecycle,
37 proc = process,
38}: {
39 runtimeMode: "standalone" | "embedded";
40 hasIpcChannel: boolean;
41 lifecycle: Pick<Lifecycle, "requestShutdown">;
42 proc?: DisconnectEmitter;
43}): void {
44 if (runtimeMode !== "embedded" || !hasIpcChannel) {
45 return;
46 }
47
48 proc.on("disconnect", () => {
49 console.warn("[Runtime] Parent IPC disconnected; shutting down embedded runtime.");
50 void lifecycle.requestShutdown("parent_disconnect");
51 });
52}
53
54/**
55 * Start the SkillPack runtime server.

Callers 2

startServerFunction · 0.85

Calls 2

onMethod · 0.65
requestShutdownMethod · 0.65

Tested by

no test coverage detected