Lines 1-23javascript
1// server.js — the authenticated local bridge server.
2// The document on disk is authoritative: the runner and direct-edit endpoints mutate it,
3// the watcher reports those mutations, and the browser never gets ahead of persisted bytes.
4import { createServer } from 'node:http';
5import {
LowWeak Crypto
Package source references weak cryptographic algorithms.
src/server.jsView on unpkg · L3 6 readFile, readFileSync, writeFileSync, watch as watchFiles, copyFileSync, mkdirSync,
7 existsSync, lstatSync, readdirSync, unlinkSync, realpathSync,
9import { join, dirname, basename, extname, sep, relative } from 'node:path';
10import { fileURLToPath } from 'node:url';
11import { randomUUID, randomBytes, createHash, timingSafeEqual } from 'node:crypto';
12import { runTurn } from './claude.js';
13import { replaceInner, removeElement, moveElement } from './edit.js';
14import { resolveRepositoryPath } from './path-policy.js';
16const HERE = dirname(fileURLToPath(import.meta.url));
17const PUBLIC = join(HERE, '..', 'public');
20 '.html': 'text/html; charset=utf-8', '.js': 'text/javascript', '.css': 'text/css',
21 '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif',
22 '.svg': 'image/svg+xml', '.webp': 'image/webp', '.json': 'application/json',