MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / flushPendingRestartNotifications

Function flushPendingRestartNotifications

src/cli.ts:867–900  ·  view source on GitHub ↗
({
  stateDir,
  platformPlugin,
}: {
  stateDir: string;
  platformPlugin: {
    start(): Promise<void>;
    sendText(params: { externalScopeId: string; content: string }): Promise<{
      success: boolean;
    } | null | undefined>;
  };
})

Source from the content-addressed store, hash-verified

865}
866
867async function flushPendingRestartNotifications({
868 stateDir,
869 platformPlugin,
870}: {
871 stateDir: string;
872 platformPlugin: {
873 start(): Promise<void>;
874 sendText(params: { externalScopeId: string; content: string }): Promise<{
875 success: boolean;
876 } | null | undefined>;
877 };
878}) {
879 const filePath = pendingRestartNotificationsFile(stateDir);
880 const queued = readPendingRestartNotifications(filePath);
881 if (queued.length === 0) {
882 return;
883 }
884 const remaining: PendingRestartNotification[] = [];
885 await platformPlugin.start();
886 for (const item of queued) {
887 try {
888 const result = await platformPlugin.sendText({
889 externalScopeId: item.externalScopeId,
890 content: item.content,
891 });
892 if (!result?.success) {
893 remaining.push(item);
894 }
895 } catch {
896 remaining.push(item);
897 }
898 }
899 writePendingRestartNotifications(filePath, remaining);
900}
901
902async function enqueuePendingRestartNotification({
903 stateDir,

Callers 2

cli.test.tsFile · 0.85
runWeixinServeFunction · 0.85

Calls 5

startMethod · 0.65
sendTextMethod · 0.65

Tested by

no test coverage detected