    if (cmd === "playlist_import_track_links") {
        const links = String(args?.text || "").split(/\r?\n/).map((l) => l.trim())
            .filter((l) => /^https?:\/\//.test(l) || /^spotify:track:/.test(l));
        if (!links.length) return Promise.reject(new Error("Nothing to import in that paste."));
        /* one row per link, in the paste's order — the lines a real lookup
           would have read off each track's own public page. A page each is
           slow, and the pace here is slow on purpose: the walk's still takes
           long enough to miss a wait card that closes inside a second. */
        const named = ["Aphex Twin - Track 1", "Daft Punk - One More Time", "Bicep - Glue", "Four Tet - Track 2"];
        const entries = impParse(links.map((_, i) => named[i % named.length]).join("\n"));
        return new Promise((r) => {
            let done = 0;
            const tick = setInterval(() => {
                done++;
                mockEmit("playlist:link-progress", { done, total: links.length, waiting: false });
                if (done >= links.length) {
                    clearInterval(tick);
                    setTimeout(() => r(impDraft(entries, args?.name || "Pasted track links", "links", args?.name ?? null, {
                        warnings: [entries.length + " track" + (entries.length === 1 ? "" : "s") + " read from " + links.length + " pasted link" + (links.length === 1 ? "" : "s") + "."],
                    })), 250);
                }
            }, 600);
        });
    }
    if (cmd === "playlist_import_folder") {
        const root = String(args?.path || "");
        if (!root) return Promise.resolve(null);   /* the desktop's dialog, dismissed */
        const name = root.split(/[\\/]/).filter(Boolean).pop() || "Folder";
        /* four files off a record the library already holds, as the backend's
           walk hands them over: every row local, matched by path */
        const own = albums[0];
        const entries = tracksFor(own.id).slice(0, 4).map((t, i) => ({
            ordinal: i, title: t.title, artist: own.artist, album: own.title,
            duration_secs: t.duration_secs, start_ms: null, raw: t.path,
            resolution: "local", matched_by: "path", path: t.path, art_path: own.art_path,
            track_id: null, art_url: null, isrc: null,
        }));
        return new Promise((r) => setTimeout(() => r(impDraft(entries, name, "folder", name)), 500));
    }
