fix: compile dist from source in Docker, fix ChatResult interface
- Dockerfile now runs tsc during build so committed dist/ is never stale - ChatResult interface was missing history[] and memoryUpdates[] fields - Re-add missing MemoryUpdate import in orchestrator.ts - Rebuild dist/ with all new fields included Made-with: Cursor
This commit is contained in:
38
dist/server.js
vendored
38
dist/server.js
vendored
@@ -46,8 +46,17 @@ const job_store_1 = require("./job-store");
|
||||
const agent_runner_1 = require("./agent-runner");
|
||||
const agents_1 = require("./agents");
|
||||
const orchestrator_1 = require("./orchestrator");
|
||||
// Protected Vibn platform repos — agents cannot clone or work in these workspaces
|
||||
const PROTECTED_GITEA_REPOS = new Set([
|
||||
'mark/vibn-frontend',
|
||||
'mark/theia-code-os',
|
||||
'mark/vibn-agent-runner',
|
||||
'mark/vibn-api',
|
||||
'mark/master-ai',
|
||||
]);
|
||||
const app = (0, express_1.default)();
|
||||
app.use((0, cors_1.default)());
|
||||
const startTime = new Date();
|
||||
// Raw body capture for webhook HMAC — must come before express.json()
|
||||
app.use('/webhook/gitea', express_1.default.raw({ type: '*/*' }));
|
||||
app.use(express_1.default.json());
|
||||
@@ -62,6 +71,10 @@ function ensureWorkspace(repo) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
return dir;
|
||||
}
|
||||
if (PROTECTED_GITEA_REPOS.has(repo)) {
|
||||
throw new Error(`SECURITY: Repo "${repo}" is a protected Vibn platform repo. ` +
|
||||
`Agents cannot clone or work in this workspace.`);
|
||||
}
|
||||
const dir = path.join(base, repo.replace('/', '_'));
|
||||
const gitea = {
|
||||
apiUrl: process.env.GITEA_API_URL || '',
|
||||
@@ -95,7 +108,8 @@ function buildContext(repo) {
|
||||
coolify: {
|
||||
apiUrl: process.env.COOLIFY_API_URL || '',
|
||||
apiToken: process.env.COOLIFY_API_TOKEN || ''
|
||||
}
|
||||
},
|
||||
memoryUpdates: []
|
||||
};
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -114,6 +128,28 @@ app.get('/api/agents', (_req, res) => {
|
||||
}));
|
||||
res.json(agents);
|
||||
});
|
||||
// Get server status and job statistics
|
||||
app.get('/api/status', (_req, res) => {
|
||||
const allJobs = (0, job_store_1.listJobs)(Infinity);
|
||||
const total_jobs = allJobs.length;
|
||||
const by_status = {
|
||||
queued: 0,
|
||||
running: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
};
|
||||
for (const job of allJobs) {
|
||||
by_status[job.status] = (by_status[job.status] || 0) + 1;
|
||||
}
|
||||
const uptime_seconds = Math.floor((new Date().getTime() - startTime.getTime()) / 1000);
|
||||
const agents = Object.values(agents_1.AGENTS).map(a => a.name);
|
||||
res.json({
|
||||
total_jobs,
|
||||
by_status,
|
||||
uptime_seconds,
|
||||
agents,
|
||||
});
|
||||
});
|
||||
// Submit a new job
|
||||
app.post('/api/agent/run', async (req, res) => {
|
||||
const { agent: agentName, task, repo } = req.body;
|
||||
|
||||
Reference in New Issue
Block a user