rednode API - v0.50.0
    Preparing search index...

    Variable adminConst

    admin: {
        endTask(id: string): Promise<void>;
        restartTask(id: string): Promise<void>;
        setTool(
            what: "tool" | "group" | "new-off",
            id: string | null,
            on: boolean,
        ): Promise<ToolList>;
        tasks(): Promise<TaskList>;
        tools(): Promise<ToolList>;
    } = ...

    REDnode's admin calls. Needs the admin permission, allowed by the player.

    Type Declaration

    • endTask: function
      • Stops a package now, even one stuck in an endless loop: its mod stops (its process ends if it does not stop within 2 s) and its windows close. It stays switched on, so the next start of the game brings it back; admin.restartTask brings it back now. REDnode's own apps are refused.

        Parameters

        • id: string

        Returns Promise<void>

    • restartTask: function
      • Starts a package's mod again, and opens its window if the player had it open.

        Parameters

        • id: string

        Returns Promise<void>

    • setTool: function
      • Switches a tool on or off for every assistant, kept across starts. Answers the new list.

        Parameters

        • what: "tool" | "group" | "new-off"

          "tool" (id is a ToolInfo.key), "group" (a package id, or "rednode" for REDnode's own tools), or "new-off" (id null: new packages' tools start off).

        • id: string | null
        • on: boolean

        Returns Promise<ToolList>

        await admin.setTool("tool", "counter-service:reset", false);
        
    • tasks: function
      • Every running package with what it costs now. Rates are over the last 5 seconds.

        Returns Promise<TaskList>

    • tools: function
      • Every tool an assistant can see through REDnode's MCP server, with the player's switches.

        Returns Promise<ToolList>

    // rednode-app.json: "permissions": ["admin"]
    import { admin } from "rednode";

    const { rows } = await admin.tasks();
    const stuck = rows.find((r) => r.mod?.status === "not-responding");
    if (stuck) await admin.endTask(stuck.id);