refactor: group agent code by adapter#972
Conversation
|
Claude (@claude) review |
|
Greptile (@greptileai) review |
|
Claude finished Nikhil (@shadowfax92)'s task in 2m 2s —— View job Code Review
Overall this is a well-executed structural refactor. The layering goal is clear (adapter-specific code behind per-adapter barrels, shared runtime contracts kept common), and the execution is consistent across all four adapters. A few notes below. What's working wellStructural correctness. Old Import direction. Moving Consistency across adapters. All four adapters (claude, codex, hermes, openclaw) follow the same barrel pattern. The new acpx-agent-adapter.ts simplification ( Minor observations
// Re-export all public symbols from the openclaw adapter.
// When adding a new module under openclaw/, also update this barrel.
No issues foundThe compatibility-preserving claim holds: all consumers updated, tests pass per the PR's test plan, and |
✅ Tests passed — 1222/1226
|
Greptile SummaryThis is a compatibility-preserving file organization refactor that groups adapter-owned code under
Confidence Score: 5/5All import paths were correctly updated across source and test files; no stale references remain to the old api/services/openclaw or lib/agents/runtime adapter paths. The change is purely a file reorganization with no logic changes. Every call site was migrated to the new barrel imports, the runtime/index.ts was correctly trimmed to shared-only exports, all test files were updated and run as part of the test plan, and a grep sweep confirmed no leftover references to deleted paths. No files require special attention. The openclaw/index.ts barrel is large (111 lines, 13 re-export groups) but accurately reflects the breadth of the OpenClaw domain surface. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[main.ts] --> B[lib/agents/claude]
A --> C[lib/agents/codex]
A --> D[lib/agents/hermes]
A --> E[lib/agents/openclaw]
F[acpx-agent-adapter.ts] --> B
F --> C
F --> D
F --> E
G[acpx-runtime.ts] --> D
H[agent-harness-service.ts] --> D
H --> E
I[api/routes/agents.ts] --> E
J[api/routes/openclaw.ts] --> E
B --> B1[claude/runtime.ts]
C --> C1[codex/runtime.ts]
D --> D1[hermes/runtime.ts]
D --> D2[hermes/paths.ts]
D --> D3[hermes/provider-map.ts]
E --> E1[openclaw/openclaw-service.ts]
E --> E2[openclaw/container-runtime-factory.ts]
E --> E3[openclaw/prepare.ts]
E --> E4[...10 more modules]
K[lib/agents/runtime] --> L[Shared Primitives Only]
L --> L1[AgentRuntime interface]
L --> L2[ContainerAgentRuntime]
L --> L3[HostProcessAgentRuntime]
L --> L4[AgentRuntimeRegistry]
L --> L5[Errors + Types]
B1 --> K
C1 --> K
D1 --> K
Reviews (1): Last reviewed commit: "fix(openclaw): export produced file row ..." | Re-trigger Greptile |
Summary
apps/server/src/lib/agents/<adapter>/.apps/server/src/lib/agents/runtime/and leaves ACPX/store/container orchestration common.api/services/*into adapter folders behind barrels.Design
This is a compatibility-preserving file organization refactor. Adapter-specific runtimes, prepare functions, provider/path helpers, and OpenClaw domain services now live behind
lib/agents/{claude,codex,hermes,openclaw}.lib/agents/runtimenow exports only common runtime contracts, base classes, errors, registry, and shared types.Test plan
bun --env-file=apps/server/.env.development test apps/server/tests/lib/agents/claude/runtime.test.ts apps/server/tests/lib/agents/codex/runtime.test.ts apps/server/tests/lib/agents/acpx-agent-adapter.test.ts apps/server/tests/main.test.tsbun --env-file=apps/server/.env.development test apps/server/tests/lib/agents/hermes/runtime.test.ts apps/server/tests/lib/agents/hermes/paths.test.ts apps/server/tests/lib/agents/acpx-runtime.test.ts apps/server/tests/api/services/agents/agent-harness-service.test.ts apps/server/tests/main.test.tsbun --env-file=apps/server/.env.development test apps/server/tests/lib/agents/openclaw apps/server/tests/api/routes/openclaw.test.ts apps/server/tests/api/routes/agents.test.ts apps/server/tests/api/services/agents/agent-harness-service.test.ts apps/server/tests/main.test.tsbun --env-file=apps/server/.env.development test apps/server/tests/lib/agents/runtime apps/server/tests/lib/agents/acpx-runtime.test.ts apps/server/tests/lib/agents/acpx-agent-adapter.test.ts apps/server/tests/api/routes/agents.test.ts apps/server/tests/main.test.tsbun run --filter @browseros/server typecheckbun run --filter @browseros/server test:allrgchecks for deleted runtime/service paths