Skip to content

Commit ff4385f

Browse files
committed
feat(acp): stabilize builds and e2e
Added pnpm-managed dependencies (including @types/react), taught the ACP e2e script to build core/adapters before launching the server, fixed worker path resolution, updated Next.js/tsconfig settings, allowed in acp.config schema, and reintroduced proper tsconfig build settings with rootDir/paths overrides plus devDependencies for adapters so TypeScript can resolve core. After these fixes, npm run acp:e2e now succeeds.
1 parent 38ced2d commit ff4385f

File tree

15 files changed

+862
-58
lines changed

15 files changed

+862
-58
lines changed

packages/acp-server/acp.config.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"type": "object",
44
"required": ["enabledAgents", "defaults"],
55
"properties": {
6+
"$schema": { "type": "string" },
67
"enabledAgents": {
78
"type": "array",
89
"items": {

packages/acp-server/next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

packages/acp-server/next.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
output: 'standalone',
4-
experimental: {
5-
serverComponentsExternalPackages: ['@i-am-bee/acp-sdk'],
6-
},
4+
serverExternalPackages: ['@i-am-bee/acp-sdk'],
75
};
86

97
export default nextConfig;

packages/acp-server/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
"next": "^15.0.0",
1414
"react": "^18.3.1",
1515
"react-dom": "^18.3.1",
16-
"@i-am-bee/acp-sdk": "^0.3.0",
16+
"@i-am-bee/acp-sdk": "^0.0.6",
1717
"@headless-coder-sdk/core": "workspace:*",
1818
"@headless-coder-sdk/codex-adapter": "workspace:*",
1919
"@headless-coder-sdk/claude-adapter": "workspace:*",
2020
"@headless-coder-sdk/gemini-adapter": "workspace:*",
2121
"ajv": "^8.17.1"
2222
},
23+
"devDependencies": {
24+
"@types/react": "^18.3.3",
25+
"@types/react-dom": "^18.3.0"
26+
},
2327
"files": [
2428
"app",
2529
"client",

packages/acp-server/scripts/run-e2e.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ const SERVER_PORT = process.env.ACP_PORT ?? '8000';
88
const SERVER_URL = process.env.ACP_BASE_URL ?? `http://localhost:${SERVER_PORT}`;
99
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1010
const PACKAGE_ROOT = path.resolve(__dirname, '..');
11+
const WORKSPACE_DEPS = [
12+
'@headless-coder-sdk/core',
13+
'@headless-coder-sdk/codex-adapter',
14+
'@headless-coder-sdk/claude-adapter',
15+
'@headless-coder-sdk/gemini-adapter',
16+
];
1117

1218
function log(...args) {
1319
console.log('[acp-e2e]', ...args);
@@ -22,6 +28,26 @@ function startServer() {
2228
});
2329
}
2430

31+
async function runBuilds() {
32+
for (const workspace of WORKSPACE_DEPS) {
33+
log(`building ${workspace}...`);
34+
await new Promise((resolve, reject) => {
35+
const child = spawn(
36+
'npm',
37+
['run', 'build', '--workspace', workspace],
38+
{
39+
stdio: 'inherit',
40+
},
41+
);
42+
child.on('exit', code => {
43+
if (code === 0) resolve();
44+
else reject(new Error(`${workspace} build failed with code ${code}`));
45+
});
46+
child.on('error', reject);
47+
});
48+
}
49+
}
50+
2551
async function waitForServer(timeoutMs = 30000) {
2652
const start = Date.now();
2753
while (Date.now() - start < timeoutMs) {
@@ -56,6 +82,7 @@ async function runClient() {
5682
}
5783

5884
async function main() {
85+
await runBuilds();
5986
const server = startServer();
6087
const cleanup = () => {
6188
if (!server.killed) {

packages/acp-server/tsconfig.json

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
{
2-
"extends": "next/tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4+
"jsx": "preserve",
5+
"module": "esnext",
6+
"moduleResolution": "node",
7+
"allowJs": true,
8+
"esModuleInterop": true,
9+
"resolveJsonModule": true,
10+
"isolatedModules": true,
11+
"noEmit": true,
12+
"lib": [
13+
"dom",
14+
"dom.iterable",
15+
"esnext"
16+
],
417
"baseUrl": ".",
518
"paths": {
6-
"@/*": ["./src/*"]
7-
}
19+
"@/*": [
20+
"./src/*"
21+
]
22+
},
23+
"incremental": true,
24+
"plugins": [
25+
{
26+
"name": "next"
27+
}
28+
]
829
},
930
"include": [
10-
"next-env.d.ts",
1131
"**/*.ts",
12-
"**/*.tsx"
32+
"**/*.tsx",
33+
"next-env.d.ts",
34+
".next/types/**/*.ts"
1335
],
1436
"exclude": [
1537
"node_modules"

packages/claude-adapter/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@headless-coder-sdk/core": "^0.12.0"
1616
},
1717
"devDependencies": {
18-
"typescript": "^5.4.0"
18+
"typescript": "^5.4.0",
19+
"@headless-coder-sdk/core": "workspace:*"
1920
}
2021
}

packages/claude-adapter/tsconfig.build.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "dist",
5+
"rootDir": "src",
56
"declaration": true,
67
"emitDeclarationOnly": false,
7-
"sourceMap": false
8+
"sourceMap": false,
9+
"baseUrl": "src",
10+
"paths": {}
811
},
912
"include": ["src/**/*"],
1013
"exclude": ["node_modules", "dist", "tests"]

packages/codex-adapter/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@openai/codex-sdk": "*"
1616
},
1717
"devDependencies": {
18-
"typescript": "^5.4.0"
18+
"typescript": "^5.4.0",
19+
"@headless-coder-sdk/core": "workspace:*"
1920
}
2021
}

packages/codex-adapter/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { fork, ChildProcess } from 'node:child_process';
7+
import path from 'node:path';
78
import { fileURLToPath } from 'node:url';
89
import { now } from '@headless-coder-sdk/core';
910
import type {
@@ -19,7 +20,7 @@ import type {
1920
Provider,
2021
} from '@headless-coder-sdk/core';
2122

22-
const WORKER_PATH = fileURLToPath(new URL('./worker.js', import.meta.url));
23+
const WORKER_PATH = path.join(path.dirname(fileURLToPath(import.meta.url)), 'worker.js');
2324
const SOFT_KILL_DELAY_MS = 250;
2425
const HARD_KILL_DELAY_MS = 1500;
2526
const DONE = Symbol('stream-done');

0 commit comments

Comments
 (0)