Jeremy commited on
Commit ·
af89373
1
Parent(s): 278890e
fix: deploy real A2A Agent Server v3.0 with fleet awareness
Browse filesFiles changed (4)
- Dockerfile-13
- app.pyDeleted-1
- package.json+4-4
- server.js+53-24
1234567891011121314151617181920212223FROM node:22-slimWORKDIR /app# Install dependenciesCOPY package*.json ./RUN npm ci --omit=dev 2>/dev/null || npm install# Copy sourceCOPY . .# Build if neededRUN npm run build 2>/dev/null || true# Expose portEXPOSE 7860# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \CMD curl -f http://localhost:7860/health || exit 1# StartCMD ["node", "server.js"]12345678910FROM node:22-slimWORKDIR /appCOPY package*.json ./RUN npm ci --omit=dev 2>/dev/null || npm installCOPY . .RUN npm run build 2>/dev/null || trueEXPOSE 7860HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \CMD curl -f http://localhost:7860/health || exit 1CMD ["node", "server.js"]
1print("SIN A2A Agent running")12345673 unmodified lines11121314{"name": "a2a-sin-agent-base","version": "1.0.0","description": "SIN A2A Agent Base Server","main": "server.js","scripts": {"start": "node server.js",3 unmodified lines"dependencies": {"express": "^4.21.0"}}12345673 unmodified lines11121314{"name": "a2a-sin-agent","version": "3.0.0","description": "SIN A2A Agent with real agent logic","main": "server.js","scripts": {"start": "node server.js",3 unmodified lines"dependencies": {"express": "^4.21.0"}}
1 unmodified line2345678910111213141516171819202122232425261 unmodified line28293031323334353637383940414243444546474810 unmodified lines59606162636465666768697016 unmodified lines8788899091929394959697989916 unmodified lines11611711811912012112211 unmodified lines1341351361371381391401411421431441451463 unmodified lines1501511521531541551561571581591601611621631641651661671681691 unmodified lineconst { exec } = require('child_process');const path = require('path');const fs = require('fs');const app = express();const PORT = process.env.PORT || 7860;const AGENT_NAME = process.env.AGENT_NAME || 'SIN-Agent';const AGENT_DESCRIPTION = process.env.AGENT_DESCRIPTION || 'SIN A2A Agent';app.use(express.json());app.use(express.static(path.join(__dirname, 'public')));// Health endpointapp.get('/health', (req, res) => {res.json({status: 'ok',agent: AGENT_NAME,description: AGENT_DESCRIPTION,timestamp: new Date().toISOString(),uptime: process.uptime(),version: '2.0.0',capabilities: ['chat', 'task', 'help', 'status', 'execute']});});1 unmodified lineapp.get('/.well-known/agent-card.json', (req, res) => {const cardPath = path.join(__dirname, '.well-known', 'agent-card.json');if (fs.existsSync(cardPath)) {res.json(JSON.parse(fs.readFileSync(cardPath, 'utf8')));} else {res.json({name: AGENT_NAME,description: AGENT_DESCRIPTION,url: `https://${process.env.SPACE_HOST || 'localhost'}/a2a/v1`,protocol: 'A2A',version: '2.0.0',capabilities: ['chat', 'task', 'help', 'status', 'execute'],commands: [{ name: 'agent.help', description: 'Show available commands' },{ name: 'agent.health', description: 'Check agent health' },{ name: 'agent.status', description: 'Show agent status' },{ name: 'agent.execute', description: 'Execute a command' }],status: 'active'});}10 unmodified linesresult: {name: AGENT_NAME,description: AGENT_DESCRIPTION,version: '2.0.0',commands: [{ name: 'agent.help', description: 'Show available commands' },{ name: 'agent.health', description: 'Check agent health' },{ name: 'agent.status', description: 'Show agent status' },{ name: 'agent.execute', description: 'Execute a command', params: { command: 'string' } }]}});16 unmodified linesresult: {agent: AGENT_NAME,status: 'active',version: '2.0.0',capabilities: ['chat', 'task', 'help', 'status', 'execute'],uptime: process.uptime()}});break;case 'agent.execute':if (!params || !params.command) {res.json({ error: 'Missing command parameter', usage: 'agent.execute({ command: "ls -la" })' });16 unmodified linesresult: {message: `Unknown action: ${action}. Use 'agent.help' for available commands.`,agent: AGENT_NAME,available_actions: ['agent.help', 'agent.health', 'agent.status', 'agent.execute']}});}11 unmodified linesname: AGENT_NAME,description: AGENT_DESCRIPTION,protocol: 'A2A',version: '2.0.0',endpoints: {post: '/a2a/v1',card: '/.well-known/agent-card.json',health: '/health'},capabilities: ['chat', 'task', 'help', 'status', 'execute']});});3 unmodified linesname: AGENT_NAME,description: AGENT_DESCRIPTION,status: 'active',version: '2.0.0',endpoints: {health: '/health',a2a: '/a2a/v1',card: '/.well-known/agent-card.json'},capabilities: ['chat', 'task', 'help', 'status', 'execute']});});// Start serverapp.listen(PORT, '0.0.0.0', () => {console.log(`${AGENT_NAME} v2.0.0 listening on port ${PORT}`);console.log(`Health: http://localhost:${PORT}/health`);console.log(`A2A: http://localhost:${PORT}/a2a/v1`);console.log(`Capabilities: chat, task, help, status, execute`);});1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344451 unmodified line47484950515253545556575859606162636410 unmodified lines7576777879808182838485868716 unmodified lines10410510610710810911011111211311411511611711811912012112212312412512612712816 unmodified lines14514614714814915015111 unmodified lines1631641651661671681691701711721731741753 unmodified lines1791801811821831841851861871881891901911921931941951961971981 unmodified lineconst { exec } = require('child_process');const path = require('path');const fs = require('fs');const http = require('http');const app = express();const PORT = process.env.PORT || 7860;const AGENT_NAME = process.env.AGENT_NAME || process.env.SPACE_ID?.split('/')[1] || 'SIN-Agent';const AGENT_DESCRIPTION = process.env.AGENT_DESCRIPTION || `SIN A2A Agent: ${AGENT_NAME}`;app.use(express.json());app.use(express.static(path.join(__dirname, 'public')));// Agent registryconst agentRegistry = {'sin-coding-ceo': { role: 'Coding Team Lead', capabilities: ['code-review', 'task-delegation', 'architecture'] },'sin-hermes': { role: 'Dispatcher', capabilities: ['dispatch', 'routing', 'load-balancing'] },'sin-zeus': { role: 'Control Plane', capabilities: ['orchestration', 'monitoring', 'governance'] },'sin-simone-mcp': { role: 'MCP Server', capabilities: ['lsp', 'semantic-analysis', 'code-refactoring'] },'sin-authenticator': { role: 'Auth Manager', capabilities: ['oauth', 'token-rotation', 'session-management'] },'sin-google-apps': { role: 'Google Apps Integration', capabilities: ['docs', 'sheets', 'drive', 'gmail'] },'sin-supabase': { role: 'Database Manager', capabilities: ['queries', 'migrations', 'backups'] },'sin-server': { role: 'Backend Server', capabilities: ['api', 'websocket', 'middleware'] },'sin-passwordmanager': { role: 'Password Manager', capabilities: ['store', 'retrieve', 'rotate'] },'sin-team-coding': { role: 'Coding Team', capabilities: ['frontend', 'backend', 'testing'] },};// Health endpointapp.get('/health', (req, res) => {const agentInfo = agentRegistry[AGENT_NAME] || { role: 'A2A Agent', capabilities: ['chat', 'task'] };res.json({status: 'ok',agent: AGENT_NAME,role: agentInfo.role,description: AGENT_DESCRIPTION,timestamp: new Date().toISOString(),uptime: process.uptime(),version: '3.0.0',capabilities: agentInfo.capabilities,memory: process.memoryUsage(),pid: process.pid});});1 unmodified lineapp.get('/.well-known/agent-card.json', (req, res) => {const cardPath = path.join(__dirname, '.well-known', 'agent-card.json');if (fs.existsSync(cardPath)) {const card = JSON.parse(fs.readFileSync(cardPath, 'utf8'));card.version = '3.0.0';card.name = AGENT_NAME;res.json(card);} else {res.json({name: AGENT_NAME,description: AGENT_DESCRIPTION,url: `https://${process.env.SPACE_HOST || 'localhost'}/a2a/v1`,protocol: 'A2A',version: '3.0.0',capabilities: ['chat', 'task', 'help', 'status', 'execute', 'list'],status: 'active'});}10 unmodified linesresult: {name: AGENT_NAME,description: AGENT_DESCRIPTION,version: '3.0.0',commands: [{ name: 'agent.help', description: 'Show available commands' },{ name: 'agent.health', description: 'Check agent health' },{ name: 'agent.status', description: 'Show agent status' },{ name: 'agent.execute', description: 'Execute a command', params: { command: 'string' } },{ name: 'agent.list', description: 'List all agents in fleet' }]}});16 unmodified linesresult: {agent: AGENT_NAME,status: 'active',version: '3.0.0',capabilities: ['chat', 'task', 'help', 'status', 'execute', 'list'],uptime: process.uptime()}});break;case 'agent.list':res.json({result: {fleet: Object.keys(agentRegistry).map(name => ({name,...agentRegistry[name]})),total: Object.keys(agentRegistry).length}});break;case 'agent.execute':if (!params || !params.command) {res.json({ error: 'Missing command parameter', usage: 'agent.execute({ command: "ls -la" })' });16 unmodified linesresult: {message: `Unknown action: ${action}. Use 'agent.help' for available commands.`,agent: AGENT_NAME,available_actions: ['agent.help', 'agent.health', 'agent.status', 'agent.execute', 'agent.list']}});}11 unmodified linesname: AGENT_NAME,description: AGENT_DESCRIPTION,protocol: 'A2A',version: '3.0.0',endpoints: {post: '/a2a/v1',card: '/.well-known/agent-card.json',health: '/health'},capabilities: ['chat', 'task', 'help', 'status', 'execute', 'list']});});3 unmodified linesname: AGENT_NAME,description: AGENT_DESCRIPTION,status: 'active',version: '3.0.0',endpoints: {health: '/health',a2a: '/a2a/v1',card: '/.well-known/agent-card.json'},capabilities: ['chat', 'task', 'help', 'status', 'execute', 'list']});});// Start serverapp.listen(PORT, '0.0.0.0', () => {console.log(`${AGENT_NAME} v3.0.0 listening on port ${PORT}`);console.log(`Health: http://localhost:${PORT}/health`);console.log(`A2A: http://localhost:${PORT}/a2a/v1`);console.log(`Capabilities: chat, task, help, status, execute, list`);});
Dockerfile-13
app.pyDeleted-1
package.json+4-4
server.js+53-24