feat(phase-2): Theia HTTP sync via sync-server on port 3001

- theia-exec.ts: primary path is now HTTP sync (syncRepoToTheia) via
  sync-server.js running inside Theia on port 3001 — no docker socket needed
- syncRepoToTheia(giteaRepo): POST /sync → Theia git-pulls latest committed code
- isTheiaSyncAvailable(): health check before attempting sync
- docker exec path preserved for future use when socket is mounted
- agent-session-runner: use syncRepoToTheia after auto-commit
- server.ts: log both docker exec + HTTP sync status at startup

Made-with: Cursor
This commit is contained in:
2026-03-07 13:38:07 -08:00
parent 7f10009b4f
commit b04d7b2e13
3 changed files with 100 additions and 80 deletions

View File

@@ -13,7 +13,7 @@ import { PROTECTED_GITEA_REPOS } from './tools/security';
import { orchestratorChat, listSessions, clearSession } from './orchestrator';
import { atlasChat, listAtlasSessions, clearAtlasSession } from './atlas';
import { LLMMessage, createLLM } from './llm';
import { getTheiaContainer } from './theia-exec';
import { getTheiaContainer, isTheiaSyncAvailable } from './theia-exec';
const app = express();
app.use(cors());
@@ -616,8 +616,11 @@ app.listen(PORT, () => {
// Theia bridge status
const theiaContainer = getTheiaContainer();
if (theiaContainer) {
console.log(`Theia bridge: active (container: ${theiaContainer})`);
console.log(`Theia docker exec: active (container: ${theiaContainer})`);
} else {
console.warn('Theia bridge: not available docker socket not mounted or container not found. Commands will run locally.');
console.log('Theia docker exec: not available (docker socket not mounted) — using HTTP sync instead');
}
isTheiaSyncAvailable().then(ok => {
console.log(`Theia HTTP sync: ${ok ? 'reachable at ' + (process.env.THEIA_SYNC_URL ?? 'http://theia-code-os:3001') : 'not reachable — sync will be skipped'}`);
});
});