diff --git a/package-lock.json b/package-lock.json index f48b50c97..05fb673cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5715,12 +5715,8 @@ "license": "MIT", "dependencies": { "@earendil-works/pi-ai": "^0.83.0", - "@earendil-works/pi-coding-agent": "^0.83.0", "@earendil-works/pi-protocol": "^0.83.0" }, - "bin": { - "server": "dist/legacy/cli.js" - }, "devDependencies": { "shx": "0.4.0", "vitest": "4.1.9" diff --git a/package.json b/package.json index d63205796..53958623c 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ ], "scripts": { "clean": "npm run clean --workspaces", - "build": "cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../storage/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../coding-agent && npm run build && cd ../server && npm run build", - "build:offline": "cd packages/tui && npm run build && cd ../ai && npm run build:offline && cd ../agent && npm run build && cd ../storage/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../coding-agent && npm run build && cd ../server && npm run build", + "build": "cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../storage/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../server && npm run build && cd ../coding-agent && npm run build", + "build:offline": "cd packages/tui && npm run build && cd ../ai && npm run build:offline && cd ../agent && npm run build && cd ../storage/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../server && npm run build && cd ../coding-agent && npm run build", "check": "biome check --write --error-on-warnings . && npm run check:pinned-deps && npm run check:ts-imports && npm run check:shrinkwrap && npm run check:install-lock:coding-agent && tsgo --noEmit && npm run check:browser-smoke", "check:browser-smoke": "node scripts/check-browser-smoke.mjs", "check:pinned-deps": "node scripts/check-pinned-deps.mjs", diff --git a/packages/server/README.md b/packages/server/README.md index 3fa91e395..05539dd39 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -1,18 +1,12 @@ # @earendil-works/pi-server -Experimental. This package is under active development and may change or be removed without notice. Its CLI, APIs, and behavior are not yet stable. +Experimental. This package is under active development and may change or be removed without notice. Its APIs and behavior are not yet stable. Server package for pi. -## CLI - -```bash -server --help -``` - ## Session server core -The package also exports the new `PiServer` session server. This API is additive while the legacy child-process supervisor and `server` CLI are migrated. +The package exports the `PiServer` session server. ```ts import type { PiSessionBackend } from "@earendil-works/pi-server"; @@ -39,7 +33,9 @@ const server = createUnixServer(backend, { await server.start(); ``` -`PiServer` composes transport listeners through the `PiServerListener` interface. Each listener must complete any transport-specific authentication and authorization before passing a connection to `PiServer`. For example, a WebSocket listener can validate credentials during the HTTP upgrade, while the Unix listener relies on socket filesystem permissions. The Unix submodule exports the `createUnixListener()` building block and `createUnixServer()` preset, keeping the common case concise without coupling the primary server to Unix sockets. The listener uses length-prefixed CBOR messages from `@earendil-works/pi-protocol`. It does not yet replace the legacy JSONL IPC control plane, child-process supervisor, standalone `server` CLI, or Radius presence integration. +`PiServer` composes transport listeners through the `PiServerListener` interface. Each listener must complete any transport-specific authentication and authorization before passing a connection to `PiServer`. For example, a WebSocket listener can validate credentials during the HTTP upgrade, while the Unix listener relies on socket filesystem permissions. The Unix submodule exports the `createUnixListener()` building block and `createUnixServer()` preset, keeping the common case concise without coupling the primary server to Unix sockets. The listener uses length-prefixed CBOR messages from `@earendil-works/pi-protocol`. + +This package does not provide a standalone CLI or coding-agent backend. Applications supply the `PiSessionBackend` implementation. ## Transport testing @@ -50,7 +46,3 @@ Custom transports can use `@earendil-works/pi-server/testing` for deterministic `@earendil-works/pi-ai` domain objects and `@earendil-works/pi-protocol` wire DTOs remain independent. This package owns their boundary and exports `toProtocolModelMetadata()`, `toProtocolAssistantMessage()`, `toProtocolUserMessage()`, and `toProtocolToolResultMessage()`. The adapters reject invalid tool inputs, identifiers, timestamps, and mismatched tool results; `toProtocolToolResultMessage()` requires the original `ToolCall` so it can verify the association and convert its arguments itself. Diagnostic details are explicitly sanitized. Closed `pi-ai` unions are mapped exhaustively, and compile-time field manifests enumerate current `pi-ai` properties so additions require an explicit review. The protocol mirrors `pi-ai` vocabulary such as `toolCall` and `toolUse` where the semantics are identical. Protocol schemas enforce consistent lifecycle states, and tests encode adapter output through the runtime schemas so incompatible changes fail in the bridging package. - -## Legacy server migration - -The existing IPC, supervisor, process management, persistence, and Radius modules remain available during migration. The new Unix session protocol supersedes the legacy socket framing and RPC proxy only after the coding-agent backend and CLI replacement have landed. Radius is presence and registration infrastructure, not a transport, and requires a separate integration with the new server lifecycle before the legacy supervisor can be removed. diff --git a/packages/server/package.json b/packages/server/package.json index a619eec3c..eb8caf5a5 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -17,15 +17,8 @@ "./unix": { "types": "./dist/transports/unix/index.d.ts", "import": "./dist/transports/unix/index.js" - }, - "./legacy": { - "types": "./dist/legacy/index.d.ts", - "import": "./dist/legacy/index.js" } }, - "bin": { - "server": "./dist/legacy/cli.js" - }, "files": [ "dist", "README.md", @@ -34,7 +27,7 @@ "scripts": { "clean": "shx rm -rf dist", "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput", - "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/legacy/cli.js", + "build": "tsgo -p tsconfig.build.json", "test": "vitest --run", "typecheck": "tsgo -p tsconfig.test.json", "prepublishOnly": "npm run clean && npm run build" @@ -55,7 +48,6 @@ }, "dependencies": { "@earendil-works/pi-ai": "^0.83.0", - "@earendil-works/pi-coding-agent": "^0.83.0", "@earendil-works/pi-protocol": "^0.83.0" }, "devDependencies": { diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 46625268a..de4b0d895 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1,5 +1,4 @@ export * from "./errors.ts"; -export * from "./legacy/index.ts"; export * from "./listener.ts"; export * from "./protocol.ts"; export * from "./server.ts"; diff --git a/packages/server/src/legacy/cli.ts b/packages/server/src/legacy/cli.ts deleted file mode 100644 index 738d416ed..000000000 --- a/packages/server/src/legacy/cli.ts +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env node -import { readFileSync } from "node:fs"; -import { createConnection } from "node:net"; -import { dirname, join } from "node:path"; -import { cwd } from "node:process"; -import { fileURLToPath } from "node:url"; -import type { RpcCommand, RpcExtensionUIResponse } from "@earendil-works/pi-coding-agent"; -import { getSocketPath } from "./config.ts"; -import { sendIpcRequest } from "./ipc/client.ts"; -import { encodeMessage } from "./ipc/protocol.ts"; -import { serve } from "./serve.ts"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); -const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8")) as { - version: string; -}; - -function printHelp(): void { - console.log( - `server v${packageJson.version}\n\nUsage:\n server serve\n server list\n server spawn [--cwd ] [--label