T-1.0: server refactor scaffold
- Move original server.ts → server/legacy-server.ts (with LEGACY comment)
- Create server/server.ts re-exporting legacy bootstrap (T-1.0 scaffold)
- Create server/routes/{stream,input,sessions,commands,side,health}.ts
as empty placeholders for T-1.5/T-1.6/T-1.7
- Create server/upgrade.ts as placeholder (T-1.5/T-1.6)
- Update index.ts to import from ./server/server.js
- Tag auth.ts, config.ts, messages.ts with LEGACY comments
- Update SYNC.md: claim removed, History entry added
This commit is contained in:
parent
bdadfd240e
commit
f70fd02f08
|
|
@ -167,6 +167,7 @@ yyyy-mm-dd @handle T-x.y what was done
|
|||
```
|
||||
|
||||
```
|
||||
2026-05-15 @jay T-1.0 Server refactor scaffold. server/ dir with legacy-server.ts, route placeholders, upgrade.ts. index.ts updated. Legacy files tagged.
|
||||
2026-05-15 @worker-phase0 T-0.* Phase 0 spike complete. tmux+pipe-pane PoC validated. GREEN LIGHT for Phase 1. Report: reference/PHASE-0-report.md. Branch: feat/spike-stream (kept for reference, not merged).
|
||||
2026-05-15 @worker-phase0.5 T-0.5 Phase 0.5 spike complete. tmux control mode validated. VERDICT: Path B recommended. Report: reference/PHASE-0.5-report.md. Branch: feat/spike-tmux-cc (kept for reference, not merged).
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// LEGACY: to be removed after auth/ refactor (T-1.3)
|
||||
/**
|
||||
* Authentication helpers for remote-control.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// LEGACY: to be replaced by T-1.7 config
|
||||
/**
|
||||
* Configuration management for remote-control.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// LEGACY: to be removed after Phase 2
|
||||
/**
|
||||
* Inline web UI for remote-control.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {
|
|||
readRemoteControlConfig,
|
||||
} from "./config.js";
|
||||
import { type RawMessage, serializeMessage } from "./messages.js";
|
||||
import { type RemoteServer, startServer } from "./server.js";
|
||||
import { type RemoteServer, startServer } from "./server/server.js";
|
||||
|
||||
// ── Extension entry point ────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// LEGACY: to be removed after Phase 2
|
||||
/**
|
||||
* Wire protocol types and message serialization for remote-control.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// LEGACY: to be removed after Phase 2 — replaced by server/server.ts + route modules
|
||||
/**
|
||||
* HTTP + WebSocket server for remote-control.
|
||||
*
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.6 (slash-command registry)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerCommandsRoutes(_app: Express): void {
|
||||
// TODO T-1.6: S-08 slash-command registry endpoint
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.7 (health endpoint)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerHealthRoutes(_app: Express): void {
|
||||
// TODO T-1.7: S-12 health endpoint
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.5 (input/send-keys route)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerInputRoutes(_app: Express): void {
|
||||
// TODO T-1.5: S-03 send-keys endpoint
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.6 (multi-session CRUD)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerSessionsRoutes(_app: Express): void {
|
||||
// TODO T-1.6: S-09 sessions lifecycle endpoint
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.6 (state side-channel)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerSideRoutes(_app: Express): void {
|
||||
// TODO T-1.6: S-07 state side-channel endpoint
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// LEGACY placeholder — to be filled in by T-1.5 (stream + binary stream + sequence)
|
||||
import type { Express } from "express";
|
||||
|
||||
export function registerStreamRoutes(_app: Express): void {
|
||||
// TODO T-1.5: S-02 binary stream, S-04 sequence resume, S-05 snapshot
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Server bootstrap — Phase 1 scaffold (T-1.0).
|
||||
*
|
||||
* Creates the HTTP + WebSocket server and wires up legacy routes.
|
||||
* Route placeholders will be populated by T-1.5 / T-1.6 / T-1.7.
|
||||
*/
|
||||
import type {
|
||||
ExtensionAPI,
|
||||
ExtensionContext,
|
||||
} from "@earendil-works/pi-coding-agent";
|
||||
import { startServer as startLegacyServer } from "./legacy-server.js";
|
||||
export type { RemoteServer } from "./legacy-server.js";
|
||||
|
||||
/**
|
||||
* Start the remote-control server.
|
||||
* Currently delegates to the legacy server; route modules will be
|
||||
* wired in during T-1.5 – T-1.7.
|
||||
*/
|
||||
export { startLegacyServer as startServer };
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// Legacy WebSocket upgrade routing — to be replaced in T-1.5/T-1.6.
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import type { Socket } from "node:net";
|
||||
|
||||
// Lightweight ws server interface (compatible with the ws package without types)
|
||||
interface WsServer {
|
||||
handleUpgrade(
|
||||
request: IncomingMessage,
|
||||
socket: Socket,
|
||||
head: Buffer,
|
||||
cb: (ws: unknown) => void,
|
||||
): void;
|
||||
emit(event: string, ...args: unknown[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route WebSocket upgrade requests to the legacy server.
|
||||
* In Phase 2 this will dispatch to topic/session-specific handlers.
|
||||
*/
|
||||
export function handleUpgrade(
|
||||
wss: WsServer,
|
||||
request: IncomingMessage,
|
||||
socket: Socket,
|
||||
head: Buffer,
|
||||
): void {
|
||||
// T-1.5/T-1.6: inspect URL to route to stream/input/session handlers.
|
||||
// For now, delegate everything to the legacy WebSocket server.
|
||||
wss.handleUpgrade(request, socket, head, (ws) => {
|
||||
wss.emit("connection", ws, request);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue