feat(coding-agent): remove the experimental server stack and the client, protocol, and server packages

Deletes packages/client, packages/protocol (CBOR codec), packages/server, coding-agent's
src/experimental (except source-resolver.ts, which source runs still preload), src/cli/experimental,
src/client, the example plugin, and their tests. coding-agent no longer depends on @earendil-works/chord.
The installer lock drops esbuild, so its platform-package sanity check goes too.
This commit is contained in:
Mario Zechner 2026-10-12 10:19:42 +00:00
parent 2ee5c1e56d
commit 7472cda0d6
161 changed files with 32 additions and 21561 deletions

View file

@ -7,8 +7,6 @@ import { installConsumer } from "./local-package-install.mjs";
import { produceArtifactSet } from "./package-artifacts.mjs";
import { codingAgentName, smokeTestCodingAgent } from "./coding-agent-smoke.mjs";
const devPackages = ["pi-client", "pi-protocol", "pi-server"].map((name) => `@earendil-works/${name}`);
function writePackage(directory, manifest, files) {
mkdirSync(directory, { recursive: true });
writeFileSync(join(directory, "package.json"), `${JSON.stringify(manifest, null, "\t")}\n`);
@ -18,86 +16,48 @@ function writePackage(directory, manifest, files) {
}
}
function createFixture(t, { importServer = false, declareServer = false } = {}) {
function createFixture(t, { importUndeclared = false } = {}) {
const temporaryRoot = mkdtempSync(join(tmpdir(), "pi-coding-agent-smoke-test-"));
t.after(() => rmSync(temporaryRoot, { recursive: true, force: true }));
const root = join(temporaryRoot, "fixture with spaces");
const repoRoot = join(root, "repo");
mkdirSync(repoRoot, { recursive: true });
writeFileSync(join(repoRoot, "package.json"), '{"name":"fixture","private":true}\n');
const packageNames = [codingAgentName, ...devPackages];
for (const name of packageNames) {
const isAgent = name === codingAgentName;
writePackage(
join(repoRoot, "packages", name.split("/")[1]),
{
name,
version: "1.0.0",
type: "module",
main: "./dist/index.js",
types: "./dist/index.d.ts",
exports: isAgent
? {
".": { types: "./dist/index.d.ts", import: "./dist/index.js" },
"./client": { source: "./src/client/index.ts" },
"./experimental/plugin": { source: "./src/experimental/plugin.ts" },
}
: { ".": { types: "./dist/index.d.ts", import: "./dist/index.js" } },
files: ["dist"],
...(isAgent
? {
bin: { pi: "dist/bundle/cli.js" },
...(declareServer ? { dependencies: { "@earendil-works/pi-server": "1.0.0" } } : {}),
devDependencies: Object.fromEntries(devPackages.map((packageName) => [packageName, "1.0.0"])),
}
: {}),
},
{
"dist/index.js": isAgent
? `${importServer ? 'import "@earendil-works/pi-server";' : ""}
writePackage(
join(repoRoot, "packages", codingAgentName.split("/")[1]),
{
name: codingAgentName,
version: "1.0.0",
type: "module",
main: "./dist/index.js",
types: "./dist/index.d.ts",
exports: { ".": { types: "./dist/index.d.ts", import: "./dist/index.js" } },
files: ["dist"],
bin: { pi: "dist/bundle/cli.js" },
},
{
"dist/index.js": `${importUndeclared ? 'import "@earendil-works/undeclared";' : ""}
export function createAgentSession() {}
export class SessionManager { static inMemory() {} }
export class ModelRuntime { static create() {} }
`
: "export {};\n",
"dist/index.d.ts": "export {};\n",
...(isAgent
? {
"dist/cli.js": 'console.log("1.0.0");\n',
"dist/bundle/cli.js": 'console.log("1.0.0");\n',
}
: {}),
},
);
}
`,
"dist/index.d.ts": "export {};\n",
"dist/cli.js": 'console.log("1.0.0");\n',
"dist/bundle/cli.js": 'console.log("1.0.0");\n',
},
);
const artifactSet = produceArtifactSet({ build: false, outDir: join(root, "artifacts"), repoRoot, source: null });
const directory = join(root, "consumer");
installConsumer({ artifactSet, directory, packageNames: [codingAgentName] });
return directory;
}
test("accepts a valid coding-agent package and rejects development-only packages and files", (t) => {
const directory = createFixture(t);
smokeTestCodingAgent(directory);
const nested = join(directory, "node_modules", codingAgentName, "node_modules/@earendil-works/pi-server");
mkdirSync(nested, { recursive: true });
writeFileSync(join(nested, "package.json"), JSON.stringify({ name: "@earendil-works/pi-server", version: "1.0.0" }));
assert.throws(() => smokeTestCodingAgent(directory), /pi-server must not be installed/);
rmSync(nested, { recursive: true });
const experimental = join(directory, "node_modules", codingAgentName, "dist/experimental");
mkdirSync(experimental);
assert.throws(() => smokeTestCodingAgent(directory), /contains development-only code/);
test("accepts a valid coding-agent package", (t) => {
smokeTestCodingAgent(createFixture(t));
});
// #9132: smoke-test the public SDK, not just a bundled CLI that hides missing imports.
test("fails when the SDK imports an undeclared server despite a working CLI", (t) => {
const directory = createFixture(t, { importServer: true });
assert.throws(() => smokeTestCodingAgent(directory), /Cannot find package '@earendil-works\/pi-server'/);
});
test("fails if a development-only dependency is added back to the published dependency tree", (t) => {
const directory = createFixture(t, { declareServer: true });
assert.throws(() => smokeTestCodingAgent(directory), /pi-server must not be installed/);
test("fails when the SDK imports an undeclared package despite a working CLI", (t) => {
const directory = createFixture(t, { importUndeclared: true });
assert.throws(() => smokeTestCodingAgent(directory), /Cannot find package '@earendil-works\/undeclared'/);
});