RuneAgentAtoryn Studio

直接运行在终端里的编程智能体。

RuneAgent 使用你接入的模型,在项目中制定计划、修改文件并执行命令。 每一步操作、文件改动和费用消耗都清晰可见,操作边界完全由你掌控。

curl -fsSL https://atoryn.com/Studio/install.sh | sh

版本 0.12.5,发布于 2026-11-15,适用于 Linux(x86_64 (glibc and static musl) 和 arm64 (glibc and static musl))。

curl -fsSL https://atoryn.com/Studio/install.sh | sh

版本 0.12.5,发布于 2026-11-15,适用于 macOS(Apple silicon 和 Intel)。 macOS 支持目前为 beta 阶段。

irm https://atoryn.com/Studio/install.ps1 | iex

版本 0.12.5,发布于 2026-11-15,适用于 Windows(x64 和 ARM64)。 Windows 支持目前为 beta 阶段。

从空文件夹到测试全部通过。

截取自一次真实会话的六个片段:RuneAgent 在 35m 36s 内构建了一个音乐播放器。每一步操作、文件改动和统计数据均来自真实记录;流式输出、阅读节奏与 Ask 确认弹窗为演示模拟,原会话在 Full 模式下运行。

交互式演示 · 展示 6 / 207 个录制步骤 · 流式输出与审批为模拟效果

Rune CLI 0.12.5

deepseek-v4.1-flash max · Ask

~/Project/Music

Quick: / commands · Tab complete · Esc cancel/stop · ? help

you · 10:37
Build a modern full-stack Music Player using Node.js for the backend and React for the frontend, with local disk storage and JSON-based metadata. Research current web references and best practices, then proceed directly with implementation using sound technical judgment. Click to open allClick to fold
Thought · 2001 words

Let me plan the architecture. I'll build:

Backend: Node.js + Express 5, music-metadata for parsing ID3 tags, multer for uploads, JSON storage (lowdb-style but hand-rolled atomic writes), streaming with Range requests, cover art extraction, scan library folder.

Frontend: React 19 + Vite 8, zustand for state, lucide-react icons, custom CSS (no Tailwind to avoid extra build complexity... though Tailwind v4 would be nice. Let me use plain CSS with a strong design system — more control, no dependency risk). Web Audio API for visualizer.

Features:

  • Library scan of local disk folder (music files), extract metadata (title, artist, album, duration, year, genre, cover art)
  • Upload files
  • Stream with range requests
  • Playlists CRUD (JSON)
  • Favorites
  • Search / filter / sort
  • Queue with shuffle, repeat
  • Now playing bar + full-screen immersive view
  • Audio visualizer
  • Keyboard shortcuts
  • Responsive design

Let me check if there are any music files available for testing.

Let me plan tasks.

Directory structure:

~/Project/Music
├── package.json (root, workspaces + scripts)
├── README.md
├── .gitignore
├── server/
│   ├── package.json
│   ├── src/
│   │   ├── index.js
│   │   ├── config.js
│   │   ├── db.js
│   │   ├── scanner.js
│   │   ├── metadata.js
│   │   ├── routes/
│   │   │   ├── tracks.js
│   │   │   ├── playlists.js
│   │   │   ├── stream.js
│   │   │   └── library.js
│   │   └── utils/
│   └── data/ (json + music)
└── web/
    ├── package.json
    ├── vite.config.js
    ├── index.html
    └── src/
        ├── main.jsx
        ├── App.jsx
        ├── styles/
        ├── store/
        ├── components/
        └── lib/

Let me start. First create package files and install dependencies in background while I write code.

Actually let me be efficient: write root package.json, server package.json, web package.json, then npm install in background.

Let me think about the design carefully. A "modern" music player. I want something visually striking — dark theme, warm amber/orange accent, glassmorphism, big typography, album art grid. Let me do a refined "editorial" aesthetic rather than generic Spotify clone: deep charcoal/ink background, warm cream text, accent color that adapts to album art dominant color.

Design system:

  • Background: #0a0a0b / #111113
  • Surface: rgba(255,255,255,0.04)
  • Text: #f5f3ef (warm white), muted #8a8783
  • Accent: dynamic from album art, fallback #f0a05a (warm amber)
  • Font: system UI + a display serif? Let me use "Instrument Serif" or "Fraunces" for headings via Google Fonts... but offline environment might not have internet at runtime for user. I'll include a font stack with fallbacks and try Google Fonts link. Actually better: use local system fonts with a nice stack, plus optional web font. I'll use Google Fonts link (Inter + Instrument Serif) — it degrades gracefully.

Layout:

  • Left sidebar (nav, playlists) 260px
  • Main content scroll area with top bar (search, view toggles)
  • Right panel: Now Playing / Queue (toggleable) 340px
  • Bottom player bar full width (except sidebar offset? no, full width)

Pages: Home (recently added, albums), Tracks (list), Albums (grid → detail), Artists, Playlists, Favorites, Search.

Let me keep it well-scoped but complete. I'll implement a client-side router with hash-free history? Simpler: use React Router 7? That's another dep. I'll implement a lightweight view state in zustand (view + params) — avoids router complexity and works well for an app-like SPA. But deep linking is nice. Let me use a minimal custom hash router... Actually let's just use react-router-dom v7, it's standard and reliable. Hmm, but with only a few routes, my own state-based nav is fine and less risk. I'll do a small history-based router with pushState to keep back button working.

Let me just do state-based views with a simple navigate() that pushes to history — clean.

Backend details:

config: MUSIC_DIR env, default server/data/library, DATA_DIR server/data. db.js: JSON file store with atomic write (write tmp + rename), debounced? No — synchronous-ish with queue to avoid corruption. Simple: load once at boot, save() serializes with a write queue.

…:

{
  "version": 1,
  "tracks": [ { id, filename, title, artist, album, albumArtist, genre, year, track, disk, duration, bitrate, sampleRate, channels, codec, size, mtime, addedAt, coverId, favorite, playCount, lastPlayedAt } ],
  "playlists": [ { id, name, description, trackIds, createdAt, updatedAt } ],
  "settings": { ... }
}

Cover art: extract embedded picture on scan, save to data/covers/<albumKey>.<ext>, store coverUrl. Dedupe by album hash.

Scanning: walk directory recursively, filter extensions, parse metadata with music-metadata, upsert by relative path. Handle deletions (remove tracks whose file is gone). Progress reporting via SSE? Could be nice: POST /api/library/scan returns after done; frontend shows spinner. Keep simple with a scan status endpoint + polling. I'll do scan with a job state and SSE... maybe overkill. I'll do a synchronous scan endpoint that returns stats, with a scanning flag to prevent concurrent scans. For a few hundred files it's fine.

Upload: multer to temp then move into library dir, parse, upsert. Limit 100MB.

Streaming: /api/tracks/:id/stream with range support, content-type from codec, ETag, 206, 416, HEAD support.

Cover: /api/covers/:name with caching headers.

API:

  • GET /api/tracks?search=&sort=&album=&artist=&favorite=
  • GET /api/tracks/:id
  • PATCH /api/tracks/:id (favorite, playCount)
  • DELETE /api/tracks/:id
  • POST /api/tracks/upload
  • GET /api/tracks/:id/stream
  • GET /api/albums, /api/artists
  • GET/POST /api/playlists, GET/PATCH/DELETE /api/playlists/:id, POST /api/playlists/:id/tracks, DELETE ...
  • POST /api/library/scan, GET /api/library/stats
  • GET /api/health

Let me also add "delete track" removes file? Dangerous. I'll make it remove from library and optionally delete file with ?deleteFile=true. Keep default false.

Frontend audio engine: single <audio> element created once, exposed via context. Web Audio analyser for visualizer — requires CORS-clean source; same origin via Vite proxy, so fine.

State (zustand):

  • library: tracks, albums, artists, loading
  • player: queue, index, isPlaying, currentTime, duration, volume, muted, shuffle, repeat, playTrack(contextTracks, trackId)
  • ui: view, nowPlayingOpen, queueOpen, search

Persist volume, favorites server-side, queue maybe localStorage.

Let me write good code. Start with package.json files and install.

I'll use ESM everywhere ("type": "module").

Root package.json with npm workspaces:

{
  "name": "rune-music",
  ...
  "workspaces": ["server", "web"],
  "scripts": {
    "dev": "concurrently -n api,web -c yellow,cyan \"npm:dev:server\" \"npm:dev:web\"",
    "dev:server": "npm --workspace server run dev",
    "dev:web": "npm --workspace web run dev",
    "build": "npm --workspace web run build",
    "start": "npm --workspace server run start"
  }
}

Add concurrently dev dep at root.

Server deps: express, music-metadata, multer, cors (maybe not needed with proxy but useful), nanoid? Use crypto.randomUUID.

For production, server serves web/dist statically.

Let me write files now. I'll create the plan first.

Note tool call limit per response: 20. Fine.

Let me create the scaffolding.

I need to be careful with Express 5: wildcard route syntax changed (* → /*splat). I'll use app.use fallback or app.get('/{*splat}', ...). Express 5 supports /{*splat}.

Also multer 2.5.0 API same.

music-metadata v12 is ESM-only, parseFile from 'music-metadata'. Good.

Let me write.

First: package.jsons + install in background.

For cover extraction: metadata.common.picture array of {format, data}. Write buffer.

Dominant color: compute on the client from image via canvas. Good — dynamic theming.

Let's create files.

Server code:

config.js:

import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const ROOT = path.resolve(__dirname, '..');
export const DATA_DIR = process.env.DATA_DIR ? path.resolve(process.env.DATA_DIR) : path.join(ROOT, 'data');
export const MUSIC_DIR = process.env.MUSIC_DIR ? path.resolve(process.env.MUSIC_DIR) : path.join(DATA_DIR, 'library');
export const COVERS_DIR = path.join(DATA_DIR, 'covers');
export const DB_FILE = path.join(DATA_DIR, 'db.json');
export const PORT = Number(process.env.PORT || 4000);
export const AUDIO_EXTENSIONS = new Set(['.mp3',...]);
export const MAX_UPLOAD = 200*1024*1024;

db.js:

class Database { data; #queue; ... }

Implement with async write chain and fs.promises.

import fs from 'node:fs/promises';
import path from 'node:path';
import { DB_FILE, DATA_DIR } from './config.js';

const DEFAULT = { version: 1, tracks: [], playlists: [], createdAt: ... };

let state = null;
let writeChain = Promise.resolve();

export async function initDb() { ... mkdir, read or create }
export function db() { return state }
export function save() { const snapshot = JSON.stringify(state,null,2); writeChain = writeChain.then(()=>atomicWrite(DB_FILE, snapshot)).catch(...); return writeChain; }

Need to be careful: writing snapshot each save is fine.

Atomic write: write to ${file}.tmp-${random} then rename.

Add debounce? Saves are infrequent. Fine.

scanner.js:

  • walk dir
  • for each audio file, parse metadata
  • compute id from relative path (stable): sha1(relPath).slice(0,16)? But renaming creates new id. Use stable hash of relPath; upsert by relPath. Keep existing id if found.
  • store file = relative path, mtimeMs, size.
  • Skip unchanged files (same mtime+size) unless force.
  • Cover: hash of album+artist for dedupe; write covers/<hash>.<ext>; store cover filename.
  • duration, bitrate, codec, sampleRate, channels, lossless, year, genre[], trackNo, diskNo.
  • Also compute addedAt.

Return {added, updated, removed, skipped, total, durationMs}.

metadata.js: parse with music-metadata, produce normalized object.

cover.js: handle picture write, ext from format ('image/jpeg' → .jpg).

Let me write the code now. I'll aim for high quality but manageable size.

Frontend components:

  • App.jsx — layout shell
  • Sidebar.jsx
  • TopBar.jsx
  • PlayerBar.jsx
  • NowPlaying.jsx (immersive panel, full screen overlay)
  • QueuePanel.jsx
  • TrackRow.jsx
  • AlbumCard.jsx
  • Views: HomeView, TracksView, AlbumsView, AlbumView, ArtistsView, ArtistView, PlaylistsView, PlaylistView, FavoritesView, SearchView
  • Icons from lucide-react
  • hooks: useAudioEngine, useDominantColor, useKeyboardShortcuts
  • store/player.js, store/library.js, store/ui.js
  • lib/api.js, lib/format.js, lib/color.js

That's a lot of files. Let me consolidate views into fewer files to keep it tractable: views/LibraryViews.jsx containing Home, Tracks, Albums, Artists, Favorites, Search; views/DetailViews.jsx for Album/Artist/Playlist. Or one views/index.jsx. I'll do:

  • views/HomeView.jsx
  • views/TracksView.jsx (also used for favorites/search results with props)
  • views/CollectionView.jsx (album/artist/playlist detail)
  • views/BrowseView.jsx (albums grid, artists grid)
  • views/PlaylistsView.jsx

Hmm. Let me structure cleanly:

  • views/HomeView.jsx
  • views/SongsView.jsx
  • views/AlbumsView.jsx
  • views/ArtistsView.jsx
  • views/AlbumDetail.jsx
  • views/ArtistDetail.jsx
  • views/PlaylistDetail.jsx
  • views/PlaylistsView.jsx
  • views/SearchView.jsx

That's 9 files, each small. OK.

CSS: single styles.css (~1000 lines) with design tokens, layout, components. That's fine and easier to keep coherent than CSS modules.

Let me start writing. First package.json files + install.

Vite 8 requires Node 20.19+ / 22.12+ — we have 25. Good.

React 19.3.1.

Let me use @vitejs/plugin-react latest.

Check plugin version quickly? I'll just use ^6 maybe. Let me install @vitejs/plugin-react latest via npm without version pin and let npm resolve.

Let me write root package.json with workspaces, then server & web package.json, then npm install.

Actually with workspaces, npm install at root installs all.

Let me do it.

For the audio visualizer I'll use Web Audio API with an AnalyserNode, and render bars on canvas with requestAnimationFrame. Need to create MediaElementSource once. Volume controlled via audio element (GainNode not needed).

Cross-origin: same origin through Vite proxy → no CORS taint. Good.

Let me now write all backend files.

Careful about express 5 async error handling: Express 5 handles rejected promises from async handlers automatically.

Range streaming implementation:

router.get('/:id/stream', async (req,res) => {
  const track = db().tracks.find(t=>t.id===req.params.id);
  if (!track) return res.status(404).json({error:'Track not found'});
  const abs = safeJoin(MUSIC_DIR, track.file);
  let stat; try { stat = await fs.stat(abs) } catch { return 404 }
  const total = stat.size;
  const mime = track.mime || mimeFromExt;
  res.setHeader('Accept-Ranges','bytes');
  res.setHeader('Content-Type', mime);
  res.setHeader('Cache-Control','public, max-age=3600');
  const etag = `"${track.id}-${Math.floor(stat.mtimeMs)}"`;
  if (req.headers['if-none-match']===etag) return res.status(304).end();
  res.setHeader('ETag', etag);
  const range = req.headers.range;
  if (!range) { res.setHeader('Content-Length', total); return pipeline(createReadStream(abs), res) }
  const m = /^bytes=(\d*)-(\d*)$/.exec(range.trim());
  if (!m) { res.status(416).setHeader('Content-Range',`bytes */${total}`); return res.end() }
  let start, end;
  if (m[1]==='') { const suffix = Number(m[2]); if(!suffix) 416; start = Math.max(total-suffix,0); end = total-1 }
  else { start = Number(m[1]); end = m[2]===''? total-1 : Math.min(Number(m[2]), total-1) }
  if (start>end || start>=total) 416
  res.status(206);
  res.setHeader('Content-Range', `bytes ${start}-${end}/${total}`);
  res.setHeader('Content-Length', end-start+1);
  const stream = createReadStream(abs,{start,end});
  stream.on('error', ...); res.on('close', ()=>stream.destroy());
  stream.pipe(res);
});

Use pipeline from stream/promises for no-range. For range, manual pipe with close handler.

HEAD is auto-handled by Express for GET routes.

safeJoin: resolve and ensure startsWith(MUSIC_DIR + sep).

Uploads: multer diskStorage into temp dir, then move to MUSIC_DIR with sanitized unique filename, then parse & add. Use file.originalname sanitized: replace non-alnum. Keep extension validated.

Also allow scanning external MUSIC_DIR.

Playlists: add/remove/reorder tracks.

Let me write now. I'll create files in batches with create_file (multiple calls per response allowed, up to 20).

Batch 1: root package.json, .gitignore, server/package.json, web/package.json, then install.

Let me be careful with concurrently version ^9.

Let me write.

Response

Environment is clean with Node 25 available. Let me set up the project plan and scaffold the workspace.

Create the implementation plan

◐Scaffold workspace, install dependencies○Build backend: JSON store, metadata scanner, streaming, REST API○Build frontend state layer, audio engine, API client○Build UI: shell, sidebar, player bar, now playing, queue○Build views: home, songs, albums, artists, playlists, search○Design system CSS, responsive layout, polish○Seed test audio, verify API + build, write READMEClick to open allClick to fold
Thought · 1742 words

Dependencies installed. ffmpeg available — great for seeding realistic test audio with metadata.

Now let's architect the backend.

Architecture:

server/
  src/
    index.js          — app bootstrap, static serving, graceful shutdown
    config.js         — env config, paths
    lib/
      json-store.js   — atomic JSON persistence with write queue
      scanner.js      — music-metadata based library scanner
      ids.js          — stable ids (hash of relative path)
      art.js          — embedded artwork extraction & caching
    routes/
      tracks.js
      albums.js
      artists.js
      playlists.js
      search.js
      stream.js
      upload.js
    middleware/
      errors.js
      validate.js

Data model:

{
  "version": 1,
  "tracks": [
    {
      "id": "trk_...",
      "title": "",
      "artist": "",
      "artistId": "art_...",
      "album": "",
      "albumId": "alb_...",
      "albumArtist": "",
      "genre": "",
      "year": 2024,
      "track": 1,
      "disc": 1,
      "duration": 245.2,
      "bitrate": 320000,
      "sampleRate": 44100,
      "channels": 2,
      "codec": "MPEG 1 Layer 3",
      "format": "mp3",
      "size": 123,
      "mtimeMs": 123,
      "path": "relative/path.mp3",
      "hasArt": true,
      "artColor": "#...",
      "addedAt": "...",
      "playCount": 0,
      "lastPlayedAt": null,
      "favorite": false
    }
  ],
  "playlists": [
    { "id": "pl_...", "name": "", "description": "", "trackIds": [], "createdAt": "", "updatedAt": "", "cover": null }
  ],
  "settings": { "libraryVersion": 1 }
}

Album/artist derived on the fly from tracks (no separate storage to avoid drift). Stable IDs from normalized name hashing. That's sound.

Streaming: proper range handling with multi-range rejection, HEAD support, ETag/If-None-Match, Accept-Ranges, 416 handling, client disconnect cleanup, throttling optional. Also artwork endpoint with caching.

Uploads: multer disk storage into music dir, then scan that file, add to library. Validate extension + size. Streamed.

Frontend:

  • Vite + React 19, zustand for state, lucide icons.
  • Audio engine as a singleton HTMLAudioElement with Web Audio analyser for visualizer. Need to be careful with CORS — same origin in prod; in dev use Vite proxy so it's same origin. Good.
  • State: library store (tracks, albums, artists, playlists, loading), player store (queue, index, isPlaying, shuffle, repeat, volume, progress), UI store (view, queue open, now playing open, search).
  • Views via simple hash-free client router? Use react-router-dom? Not installed. I could add it, but a simple state-based router is fine and keeps bundle lean. However deep links are nice. Let me use a lightweight hash router of my own (~30 lines) — reliable with static serving. Actually a path-based router needs server fallback; I'll add the fallback anyway. Hash routing avoids edge cases. Hmm, modern apps use path routing. I'll implement path-based routing with history.pushState plus server SPA fallback, and support browser back/forward. That's straightforward and modern. Let me write a tiny router.

Design direction: "Sonora" — warm dark, editorial, amber/copper accent, grain texture, large serif display headings (e.g., 'Instrument Serif' via Google Fonts? Offline concerns — no network at runtime maybe. Better use system font stack with a nice serif fallback like Georgia/'Iowan Old Style'. I can embed fonts? Avoid external deps. Use ui-serif, Georgia for display and system-ui for text. That gives a distinctive editorial look without network.)

Let me do: deep charcoal #0c0b0f base, warm ivory text, copper/amber accent #e8a33d, album art color extraction to tint ambient background. Rounded 16px cards, subtle 1px borders rgba(255,255,255,.07), soft shadows. Bottom player bar with glass blur. Full-screen now playing view with blurred art backdrop and a canvas visualizer.

Features:

  • Library scan endpoint + UI button, progress via simple polling or just POST returns summary.
  • Search across tracks/albums/artists with debounce.
  • Playlists CRUD, add/remove tracks, drag reorder maybe (HTML5 DnD in playlist detail).
  • Queue panel with reorder, remove, clear, "play next".
  • Shuffle, repeat one/all, volume, mute, seek with hover tooltip, keyboard shortcuts (space, arrows, m, s, r, q, /).
  • Favorites (liked songs).
  • Sort tracks, filter by genre maybe.
  • Recently added, most played on home.
  • Album art endpoint with placeholder gradient generated from title hash.
  • Responsive: collapse sidebar, mobile nav.
  • Media Session API integration for OS controls — nice modern touch.
  • Persist volume/queue to localStorage.

Let me now write backend files.

Config: MUSIC_DIR env default ./music at project root; DATA_DIR default ./server/data; PORT 3001.

json-store: load once, atomic writes via tmp + rename, serialized writes (promise chain), debounced? Keep immediate but queued.

scanner: walk directory recursively, skip hidden, allowed extensions. Use parseFile with { duration: true, skipCovers: false }. Extract common picture, cache to art dir as <trackId>.<ext>; compute a dominant color cheaply? Without sharp, I can't decode JPEG easily. Instead, derive color deterministically from a hash of album name — a curated palette. That's a pragmatic and attractive approach. I'll call it "accent" and store it. Honest and avoids extra native deps.

Actually I could decode art with ffmpeg but that's heavy per track. Hash palette it is.

Scanner must be incremental: use mtime+size to skip unchanged, remove missing tracks, keep user data (favorite, playCount) by id. ID = sha1 of relative path (12 chars). Good.

Artwork: save embedded picture to data/art/<id>.<ext>, serve at /api/art/:id with ETag + long cache. For albums without art, frontend renders gradient.

Now write code. Keep it clean and well-structured.

Range handling details:

  • Parse single range only; if multiple, respond 200 full (or first range). Standard: can ignore Range. I'll implement robust single-range parsing, support bytes=-500 suffix.
  • If-Range handling maybe overkill. Include ETag check for full GET.
  • HEAD support via app.head route.

Let me write stream.js helper.

Uploads: multer with limits 100MB, fileFilter allowed audio ext, destination music dir root (or uploads subdir), sanitize filename, unique suffix. After upload, scan that single file and insert. Need scanner function scanFile(absPath, relPath).

Express 5: async errors are forwarded automatically. Good.

Validation middleware: small helpers.

Let me write the files now. I'll aim for quality and completeness.

File: server/src/config.js

import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const ROOT = path.resolve(__dirname, '../..'); // project root
export const SERVER_ROOT = path.resolve(__dirname, '..');
export const PORT = Number(process.env.PORT ?? 3001);
export const MUSIC_DIR = path.resolve(process.env.MUSIC_DIR ?? path.join(ROOT, 'music'));
export const DATA_DIR = path.resolve(process.env.DATA_DIR ?? path.join(SERVER_ROOT, 'data'));
export const ART_DIR = path.join(DATA_DIR, 'art');
export const DB_FILE = path.join(DATA_DIR, 'library.json');
export const WEB_DIST = path.join(ROOT, 'web', 'dist');
export const AUDIO_EXTENSIONS = new Set(['.mp3','.flac','.m4a','.aac','.ogg','.oga','.opus','.wav','.wma','.aiff','.aif','.alac','.mp4']);
export const MIME = {...}

MIME mapping by extension.

json-store.js:

import fs from 'node:fs/promises';
import path from 'node:path';

export class JsonStore {
  constructor(file, defaults) {...}
  async load() { try read parse; merge defaults } 
  get data() { return this._data }
  async update(fn) { const result = fn(this._data); this._queue = this._queue.then(() => this.#flush()); await this._queue; return result }
  #flush() { write tmp then rename }
}

Careful: multiple updates may coalesce; fine.

Need write queue robust:

save() {
  this._pending = this._pending.then(() => this.#write());
  return this._pending;
}

But if a write fails, chain rejects forever. Add catch to reset. Use:

this._chain = this._chain.catch(()=>{}).then(()=>this.#write());
return this._chain;

ids.js: stableId(prefix, value) using createHash sha1, slice 10, base36? hex is fine.

palette: array of 12 hues, pick by hash. Return hsl string. Frontend can use it directly. Nice.

scanner.js:

import { parseFile } from 'music-metadata';

music-metadata v12 API: parseFile(filePath, options) returns {common, format}. In v11+, named export parseFile. Common fields: title, artist, artists, albumartist, album, genre (array), year, track {no, of}, disk {no, of}, picture [{format, data}].

Need duration, bitrate, sampleRate, numberOfChannels, codec, container, lossless.

Fallback title from filename; artist "Unknown Artist"; album "Unknown Album".

Album ID: stableId('al', ${albumArtist||artist}::${album}.toLowerCase()) — group by album + album artist. Artist ID: stableId('ar', artist.toLowerCase()).

Art extraction: if picture, write file with ext from format (image/jpeg -> jpg, image/png -> png, else bin). Keep hasArt true. On rescan unchanged, keep existing art.

Scan should also write art even if changed.

Delete missing: iterate existing tracks, if id not in seen -> remove and unlink art.

Progress reporting: scanner accepts onProgress callback. Endpoint POST /api/library/scan responds after completion with summary; frontend shows spinner. Good enough. Also GET /api/library/stats.

Let me write the scanner to collect tracks in memory then update store once.

For performance, parse sequentially with concurrency 4. Implement a small pool.

Then index.js routes.

API design:

  • GET /api/health
  • GET /api/library → { tracks, albums, artists, playlists, stats }

Might be big but fine for local. Better: GET /api/tracks, /api/albums, /api/artists, /api/playlists. Frontend loads all in parallel. Home needs aggregate stats.

  • POST /api/library/scan
  • GET /api/tracks/:id
  • PATCH /api/tracks/:id { favorite, playCount increment? }
  • POST /api/tracks/:id/played → increments playCount, lastPlayedAt
  • GET /api/albums, GET /api/albums/:id
  • GET /api/artists, GET /api/artists/:id
  • GET /api/playlists, POST, PATCH /:id, DELETE, POST /:id/tracks {trackIds}, DELETE /:id/tracks/:trackId, PUT /:id/tracks (reorder)
  • GET /api/search?q=
  • GET /api/stream/:id (range)
  • GET /api/art/:id
  • POST /api/upload (multer single 'file'), also bulk? single is fine, multiple via repeated.
  • GET /api/genres maybe derived client-side.

Sorting: albums sorted by title; artists by name; tracks by addedAt desc for library? Provide query sort param for tracks: title|artist|album|addedAt|duration with order. Frontend can sort client-side since library is local; simpler and instant. I'll return unsorted raw and let client derive. But server-side derived albums/artists are useful.

Let me include a single GET /api/library returning everything plus derived collections — simplest for a local-first app, one round trip, instant client-side search/sort. With thousands of tracks JSON is still OK. I'll also keep granular endpoints for playlists mutations and stats. Actually granular GETs for albums/artists are unnecessary if the client has everything. Keep API lean:

  • GET /api/library
  • POST /api/library/scan
  • PATCH /api/tracks/:id
  • POST /api/tracks/:id/played
  • POST /api/playlists, PATCH /api/playlists/:id, DELETE, POST /:id/tracks, DELETE /:id/tracks/:trackId, PUT /:id/tracks
  • POST /api/upload
  • stream + art
  • GET /api/search (optional, client has data) — skip, but include for completeness? Client-side search is better UX (instant). Skip server search. Hmm "full-stack" — fine.

I'll add /api/health and /api/stats maybe not needed.

Now derived collections helper derive.js: build albums and artists from tracks, with counts, duration, year, artTrackId, trackIds sorted by disc/track.

Album cover: choose first track with hasArt. Serve /api/art/:trackId. Good.

Let's write.

For express 5 static + SPA fallback: app.use(express.static(WEB_DIST)); app.get(/.*/, ...) — Express 5 changed wildcard syntax; regex works. Use app.use((req,res,next)=>{ if (req.method==='GET' && !req.path.startsWith('/api')) res.sendFile(index) else next() }) after static. Need fs.existsSync check.

Also add compression? Not installed; skip. Set Cache-Control on art. For stream, set no-store? Range responses can be cached; set Cache-Control: public, max-age=3600 plus ETag.

Security: path traversal prevented by using stored track path resolved within MUSIC_DIR and verifying startsWith. IDs are looked up in DB only.

Upload filename sanitize: strip path separators, keep unicode letters, replace spaces, add timestamp.

Let me now write all backend files in a few calls.

Also add server/src/lib/logger.js? Simple console with timestamps. Keep minimal.

Write config.

Response

Dependencies are in and ffmpeg is available for realistic seed tracks. Now the backend foundation — config, atomic JSON store, and utilities.

Create atomic JSON store

Writeserver/src/lib/json-store.js+62

js
import fs from 'node:fs/promises';import path from 'node:path';/** * Tiny JSON document store with serialized, atomic writes. * Writes go to a temp file in the same directory and are renamed into place, * so a crash mid-write can never leave a half-written library behind. */export class JsonStore { #file; #data; #defaults; #chain = Promise.resolve(); constructor(file, defaults = {}) { this.#file = file; this.#defaults = structuredClone(defaults); this.#data = structuredClone(defaults); } async load() { await fs.mkdir(path.dirname(this.#file), { recursive: true }); try { const raw = await fs.readFile(this.#file, 'utf8'); const parsed = JSON.parse(raw); this.#data = { ...structuredClone(this.#defaults), ...parsed }; } catch (err) { if (err.code !== 'ENOENT') { // A corrupt file should be preserved for inspection, not silently lost. const backup = `${this.#file}.corrupt-${Date.now()}`; await fs.rename(this.#file, backup).catch(() => {}); console.warn(`[store] unreadable library.json moved to ${backup}`); } await this.#write(); } return this.#data; } get data() { return this.#data; } /** Mutate the document, then persist it. Returns the callback's value. */ async update(mutator) { const result = mutator(this.#data); this.#chain = this.#chain.catch(() => {}).then(() => this.#write()); await this.#chain; return result; } /** Persist without mutating (useful after direct edits to `data`). */ async save() { this.#chain = this.#chain.catch(() => {}).then(() => this.#write()); await this.#chain; } async #write() { const tmp = `${this.#file}.${process.pid}.tmp`; await fs.writeFile(tmp, JSON.stringify(this.#data, null, 2), 'utf8'); await fs.rename(tmp, this.#file); }} Click to open all Click to fold

Rebuild and run end-to-end tests 36s

Bash
$ npm run build >/dev/null 2>&1 && node scripts/e2e.mjs 2>&1 | tail -30
✓ library renders all tracks ✓ playing a track starts audio ✗ pause and resume work button should offer Play when paused'Pause' !== 'Play' ✓ seeking jumps the playhead ✓ next and previous navigate the queue ✓ favourite persists to the server ✓ queue drawer lists upcoming tracks ✓ creating a playlist works ✓ adding a track to the playlist works ✓ search filters results ✓ deleting the playlist cleans up ✗ no console errors during the run h is not a function1 !== 010/12 checks passed. Click to open all Click to fold
Thought · 135 words

So … is not a function. That means toggle from usePlayer() is undefined! Because usePlayer() without selector returns the whole state, and toggle should exist... wait, in PlayerBar I destructure from usePlayer(). Hmm, but toggle is defined in the store. Let me check: in the store, I return an object with engine, playQueue, playTrack... but did I include toggle? Let me look. The store returns:

queue, index, current, order, shuffle, repeat, contextLabel, playing, buffering, position, duration, volume, muted, error, needsGesture, engine, playQueue, playTrack, addToQueue, playNext, removeFromQueue, clearQueue, next, previous, toggleShuffle, cycleRepeat, toggleFavorite, syncTrack, resumeSession.

I never defined toggle, play, pause, seek, setVolume, setMuted on the store! They're only on engine. That's the bug — PlayerBar destructures them and gets undefined. So clicking play/pause/seek/volume does nothing.

Let me add those as store actions delegating to engine.

Response

Found it — toggle, seek, setVolume, setMuted, play, pause exist only on engine, not on the store. The UI destructures them from the store, so they're undefined.

Expose playback controls as store actions

Editweb/src/store/player.js−3 +11

diff
engine, + /** Transport controls delegate to the audio engine. */+ play: () => engine.play(),+ pause: () => engine.pause(),+ toggle: () => engine.toggle(),+ seek: (seconds) => engine.seek(seconds),+ setVolume: (value) => engine.setVolume(value),+ setMuted: (muted) => engine.setMuted(muted),+ /** Play a list of tracks starting at `startIndex`. */ Click to open all Click to fold

Response

The home page is now well-balanced with a strong editorial feel. Let me run the final full verification.

Final verification of all tests 29s

Bash
$ node scripts/test-queue.mjs 2>&1 | tail -2 && node scripts/e2e.mjs 2>&1 | tail -3 && echo "=== BUILD ===" && npm run build 2>&1 | tail -4
13/13 checks passed. ✓ no console errors during the run12/12 checks passed.=== BUILD ===dist/assets/index-DA0VyFGr.css 47.43 kB │ gzip: 9.67 kBdist/assets/index-CF-34hq8.js 355.83 kB │ gzip: 107.29 kB✓ built in 3.52s Click to open all Click to fold

Mark all tasks complete

●Scaffold workspace, install dependencies●Build backend: JSON store, metadata scanner, streaming, REST API●Build frontend state layer, audio engine, API client●Build UI: shell, sidebar, player bar, now playing, queue●Build views: home, songs, albums, artists, playlists, search●Design system CSS, responsive layout, polish●Seed test audio, verify API + build, write READMEClick to open allClick to fold

Built Sonora, a complete self-hosted music player. Everything is verified working.

What's there

Backend (Express 5, Node 25)

  • Atomic JSON store (temp file + rename, serialized writes) — no database to administer
  • Recursive scanner that skips unchanged files by size+mtime, with bounded concurrency
  • Tag reading across MP3/FLAC/M4A/OGG/WAV/AIFF; cover art extracted once, content-addressed so albums share one file
  • RFC 9110 range streaming: open-ended, suffix, multi-range, 416 with Content-Range, plus ETag/304 revalidation
  • Full REST surface + SSE for cross-tab sync, uploads, playlists with reorder

Frontend (React 19, Vite 8, zustand 5)

  • Persistent queue with order-preserving shuffle, repeat modes, session restore
  • Immersive Now Playing with artwork-derived glow, queue drawer, context menus, toasts with undo
  • Home / Songs / Albums / Artists / Playlists / Liked / Search, plus full keyboard control
  • Responsive down to 320px, prefers-reduced-motion respected

Verification

Rather than assume it worked, I drove it in real Chrome:

  • 13/13 queue invariants — including a shuffle playNext bug where a play-order position was used as a queue index
  • 12/12 end-to-end checks — playback, seek, favourites, playlist CRUD, search
  • Screenshots of every route, desktop and mobile

Two bugs the tests caught that reading alone would have missed:

  • Every transport control was a silent no-op. toggle, seek, setVolume existed only on the engine object, but the UI destructured them from the store — so they were undefined. Audio played but could never be paused.
  • albumCount rendered as undefined — a spread order bug in the artist reducer.

I also fixed the mobile player bar overflowing the viewport and the album column stretching awkwardly on wide screens.

Run it

npm run dev     # API :…, Vite :…

A 14-track demo library is already seeded and indexed. For production: npm run build && npm start.

Two notes worth flagging: the demo covers are ffmpeg gradients, not real album art, so they read as abstract colour fields — that's the seed data, not the UI. And I left puppeteer-core as a dev dependency for the test scripts; drop it if you don't want the browser tooling.

[ deepseek-v4.1-flash max · Ask ]

› ask, or / for commands

~/Project/Music│[Ask] asks before actions run; classifier is inactive in ask mode0.12.5

Built Sonora, a complete self-hosted music player. Everything is verified working.

What's there

Backend (Express 5, Node 25)

  • Atomic JSON store (temp file + rename, serialized writes) — no database to administer
  • Recursive scanner that skips unchanged files by size+mtime, with bounded concurrency
  • Tag reading across MP3/FLAC/M4A/OGG/WAV/AIFF; cover art extracted once, content-addressed so albums share one file
  • RFC 9110 range streaming: open-ended, suffix, multi-range, 416 with Content-Range, plus ETag/304 revalidation
  • Full REST surface + SSE for cross-tab sync, uploads, playlists with reorder

Frontend (React 19, Vite 8, zustand 5)

  • Persistent queue with order-preserving shuffle, repeat modes, session restore
  • Immersive Now Playing with artwork-derived glow, queue drawer, context menus, toasts with undo
  • Home / Songs / Albums / Artists / Playlists / Liked / Search, plus full keyboard control
  • Responsive down to 320px, prefers-reduced-motion respected

Verification

Rather than assume it worked, I drove it in real Chrome:

  • 13/13 queue invariants — including a shuffle playNext bug where a play-order position was used as a queue index
  • 12/12 end-to-end checks — playback, seek, favourites, playlist CRUD, search
  • Screenshots of every route, desktop and mobile

Two bugs the tests caught that reading alone would have missed:

  • Every transport control was a silent no-op. toggle, seek, setVolume existed only on the engine object, but the UI destructured them from the store — so they were undefined. Audio played but could never be paused.
  • albumCount rendered as undefined — a spread order bug in the artist reducer.

I also fixed the mobile player bar overflowing the viewport and the album column stretching awkwardly on wide screens.

Run it

npm run dev     # API :…, Vite :…

A 14-track demo library is already seeded and indexed. For production: npm run build && npm start.

Two notes worth flagging: the demo covers are ffmpeg gradients, not real album art, so they read as abstract colour fields — that's the seed data, not the UI. And I left puppeteer-core as a dev dependency for the test scripts; drop it if you don't want the browser tooling.

展开完整报告收起

原会话生成的最终报告,未经改动。在更宽的屏幕上可观看交互式回放。

每一步操作都透明可见。

模型负责提出方案,RuneAgent 负责展示执行的命令、修改的文件与产生的费用,并把关键决定权交还给你。

权限边界由你决定。

每个会话都在以下三种模式之一中运行。可通过 /mode 切换;RuneAgent 默认以 Ask 模式启动。

同一条命令在不同模式下的真实终端表现。在 Ask 模式下,确认框会暂时替换输入框,且终端命令绝不提供“始终允许”选项。

Rebuild and run end-to-end tests

Bash

$ npm run build >/dev/null 2>&1 && node scripts/e2e.mjs 2>&1 | tail -30

✓ library renders all tracks

✓ playing a track starts audio

✗ pause and resume work

button should offer Play when paused

Bash

$ npm run build >/dev/null 2>&1 && node scripts/e2e.mjs 2>&1 | tail -30

Allow onceRefuse

[ deepseek-v4.1-flash max · AutoFull ]

› ask, or / for commands

[Ask] asks before actions run; classifier is inactive in ask mode[Auto] works freely inside workspace; classifier is inactive because no policy file was found[Full] unconfined system access; classifier is inactive because no policy file was found

每一次修改都有据可查。

侧边栏会随任务推进实时列出当前会话修改过的每个文件,以及新增和删除的行数。/undo 可将符合条件的文件恢复到本次会话前的状态;其他情况请配合 Git 和常规备份使用。

取自录制会话的真实 CLI 侧边栏画面。

64 FILES CHANGED · +10708

● server/package.json+17

● web/package.json+21

● server/src/config.js+49

● server/src/lib/json-store.js+62

● server/src/lib/identity.js+41

● server/src/lib/metadata.js+134

● server/src/lib/scanner.js+48

● server/src/lib/streamer.js+116

你的模型,你的账户。

从已配置提供商返回的模型列表中选择,或直接输入准确的模型 ID。RuneAgent 会在运行过程中实时统计上下文、token 用量和花费。应用不绑定任何预置 API 额度。

取自录制会话的真实 CLI 侧边栏画面。

SESSIONS

Title
Build Full-Stack Music Player
Started
10:37
Activity
35m 36s · 207 steps · 1 turn
Context Window
152,211 / 1,000,000
TokIn
14,939,074
TokOut
169,221
CacheIn
14,235,392
Spend
$0.4996

一条命令安装,进入你的工作区。

先审阅安装脚本并确认系统环境,然后接入你准备使用的模型账户。

01

检查系统环境

安装脚本会自动检测你的操作系统和处理器架构,在 Linux 上还会检测 C 标准库(glibc 或 musl),并仅安装对应平台已签名的官方发行包。每条安装命令下方的说明列出了 0.12.5 版本支持的平台。

Linux 和 macOS 需要 curl、tar、gzip 和 openssl(macOS 已自带);Windows 仅需 PowerShell。支持 macOS 11 及以上版本、Windows 10 版本 1809 及以上版本(目前均为公测版)。在 Linux 和 macOS 上请以普通用户身份运行安装脚本,切勿使用 root;在 Windows 上无需管理员权限。

02

安装前自动校验

上方的安装命令会在替换可执行文件前自动校验数字签名与归档校验和。

运行前可先审阅安装脚本源码:install.sh 或 install.ps1。若需离线审阅,请先保存脚本并检查内容,随后执行 sh install.sh,或在 PowerShell 中执行 .\install.ps1。

03

在项目中启动

cd path/to/your-workspace
rune

在 Settings → Connections 中接入你的模型账户,随后在 Models 中选定模型。建议从 Ask 模式开始,逐一审阅每条命令和每次编辑。

体验你的第一次会话

已发布的构建包

更倾向于直接下载?选择对应系统的归档包,并在使用前完成校验。

每个版本均提供适用于 Linux(glibc 和静态 musl)、macOS 及 Windows 的独立二进制文件。离线包包含用于隔离环境的自包含安装脚本。

校验和签名文件公钥

文件平台大小下载
rune-0.12.5-linux-x86_64-gnu.tar.gzLinux · x86_64 · glibc11.3 MiB下载
rune-0.12.5-linux-x86_64-gnu-package.zipLinux · x86_64 · glibc · offline package11.3 MiB下载
rune-0.12.5-linux-x86_64-musl.tar.gzLinux · x86_64 · static musl11.5 MiB下载
rune-0.12.5-linux-x86_64-musl-package.zipLinux · x86_64 · static musl · offline package11.6 MiB下载
rune-0.12.5-linux-aarch64-gnu.tar.gzLinux · aarch64 · glibc10.5 MiB下载
rune-0.12.5-linux-aarch64-gnu-package.zipLinux · aarch64 · glibc · offline package10.5 MiB下载
rune-0.12.5-linux-aarch64-musl.tar.gzLinux · aarch64 · static musl10.6 MiB下载
rune-0.12.5-linux-aarch64-musl-package.zipLinux · aarch64 · static musl · offline package10.6 MiB下载
rune-0.12.5-macos-aarch64.tar.gzmacOS · Apple silicon10.1 MiB下载
rune-0.12.5-macos-aarch64-package.zipmacOS · Apple silicon · offline package10.1 MiB下载
rune-0.12.5-macos-x86_64.tar.gzmacOS · Intel10.9 MiB下载
rune-0.12.5-macos-x86_64-package.zipmacOS · Intel · offline package11.0 MiB下载
rune-0.12.5-windows-x86_64.zipWindows · x6411.7 MiB下载
rune-0.12.5-windows-x86_64-package.zipWindows · x64 · offline package11.7 MiB下载
rune-0.12.5-windows-aarch64.zipWindows · ARM6410.9 MiB下载
rune-0.12.5-windows-aarch64-package.zipWindows · ARM64 · offline package10.9 MiB下载
安装脚本选项

安装脚本会输出它使用的安装目录,且绝不修改 shell 配置文件。在你已打开的窗口中运行下面这一行,rune 便能立即使用,无需新开终端。若希望之后打开的终端也能使用,请自行把同一行加入 ~/.bashrc 或 ~/.zshrc:

export PATH="$HOME/.local/bin:$PATH"

在 fish 中,只需运行一次 fish_add_path ~/.local/bin。在 Windows 上,安装与更新中给出了 PowerShell 命令;安装脚本已为你添加该目录,新窗口可直接找到 rune。

卸载 Rune

完成或停止手头任务并关闭所有 Rune 窗口,然后删除程序文件及其许可证声明。若此前自定义了安装目录,请将 ~/.local/bin 替换为你的实际目录。

rm ~/.local/bin/rune
rm -r ~/.local/share/runeagent

在 Windows 上,请参阅安装与更新中的 PowerShell 卸载步骤(包括收回 Rune 命令沙盒的访问权限)。你的设置、会话记录、加密密钥及还原点数据会保留在 Rune 数据目录中,直到你手动删除。运行 rune -config 输出的第一行即为该目录路径,请在删除程序前查看。删除数据目录会清除历史记录和还原点,仅卸载程序时无需删除它。

你的终端,你的模型,
由你做主。

从小任务开始,明确边界,审阅每一处改动。

安装 RuneAgent版本 0.12.5 · 2026-11-15