claudehq 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -25,6 +25,10 @@ const tasks = require('./data/tasks');
25
25
  const todos = require('./data/todos');
26
26
  const plans = require('./data/plans');
27
27
  const conversation = require('./data/conversation');
28
+ const orchestrationData = require('./data/orchestration');
29
+
30
+ // Orchestration
31
+ const orchestrationExecutor = require('./orchestration/executor');
28
32
 
29
33
  // Routes
30
34
  const { createRoutes } = require('./routes/api');
@@ -108,15 +112,12 @@ function registerAllHandlers() {
108
112
  }
109
113
 
110
114
  // =============================================================================
111
- // HTML Template - Loaded from legacy server.js or served inline
115
+ // HTML Template - Loaded from public/index.html
112
116
  // =============================================================================
113
117
 
114
- // For now, we'll read the HTML from the old server.js
115
- // In future iterations, this should be moved to a separate file
116
118
  let HTML = '';
117
119
 
118
120
  function loadHTML() {
119
- // Try to load from a separate HTML file first
120
121
  const htmlPath = path.join(__dirname, '..', 'public', 'index.html');
121
122
  if (fs.existsSync(htmlPath)) {
122
123
  HTML = fs.readFileSync(htmlPath, 'utf-8');
@@ -124,21 +125,8 @@ function loadHTML() {
124
125
  return;
125
126
  }
126
127
 
127
- // Fall back to extracting from old server.js
128
- const oldServerPath = path.join(__dirname, 'server.js');
129
- if (fs.existsSync(oldServerPath)) {
130
- const content = fs.readFileSync(oldServerPath, 'utf-8');
131
- const htmlStart = content.indexOf('const HTML = `<!DOCTYPE html>');
132
- const htmlEnd = content.indexOf('</html>`;', htmlStart);
133
- if (htmlStart !== -1 && htmlEnd !== -1) {
134
- HTML = content.substring(htmlStart + 14, htmlEnd + 7);
135
- console.log(` Extracted HTML template from legacy server.js`);
136
- return;
137
- }
138
- }
139
-
140
- // Minimal fallback HTML
141
- HTML = '<!DOCTYPE html><html><head><title>Claude Tasks Board</title></head><body><h1>Claude Tasks Board</h1><p>HTML template not found. Please check your installation.</p></body></html>';
128
+ // Fallback HTML if public/index.html is missing
129
+ HTML = '<!DOCTYPE html><html><head><title>Claude HQ</title></head><body><h1>Claude HQ</h1><p>HTML template not found. Please check your installation.</p></body></html>';
142
130
  console.log(' Warning: Using minimal fallback HTML template');
143
131
  }
144
132
 
@@ -186,6 +174,10 @@ const routes = createRoutes({
186
174
  updatePlan: plans.updatePlan,
187
175
  loadConversation: conversation.loadConversation,
188
176
 
177
+ // Orchestration
178
+ orchestrationData,
179
+ orchestrationExecutor,
180
+
189
181
  // Utils
190
182
  sendToTmux: sessionManager.sendToTmux
191
183
  });
@@ -338,6 +330,92 @@ const server = http.createServer((req, res) => {
338
330
  return routes.handleRenameSession(req, res, renameMatch[1]);
339
331
  }
340
332
 
333
+ // Orchestration routes
334
+ if (url.pathname === '/api/orchestrations' && req.method === 'GET') {
335
+ return routes.handleGetOrchestrations(req, res);
336
+ }
337
+ if (url.pathname === '/api/orchestrations' && req.method === 'POST') {
338
+ return routes.handleCreateOrchestration(req, res);
339
+ }
340
+
341
+ const orchestrationMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)$/);
342
+ if (orchestrationMatch && req.method === 'GET') {
343
+ return routes.handleGetOrchestration(req, res, orchestrationMatch[1]);
344
+ }
345
+ if (orchestrationMatch && req.method === 'PATCH') {
346
+ return routes.handleUpdateOrchestration(req, res, orchestrationMatch[1]);
347
+ }
348
+ if (orchestrationMatch && req.method === 'DELETE') {
349
+ return routes.handleDeleteOrchestration(req, res, orchestrationMatch[1]);
350
+ }
351
+
352
+ const orchestrationStartMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/start$/);
353
+ if (orchestrationStartMatch && req.method === 'POST') {
354
+ return routes.handleStartOrchestration(req, res, orchestrationStartMatch[1]);
355
+ }
356
+
357
+ const orchestrationStopMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/stop$/);
358
+ if (orchestrationStopMatch && req.method === 'POST') {
359
+ return routes.handleStopOrchestration(req, res, orchestrationStopMatch[1]);
360
+ }
361
+
362
+ // Agent routes
363
+ const agentsMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents$/);
364
+ if (agentsMatch && req.method === 'POST') {
365
+ return routes.handleAddAgent(req, res, agentsMatch[1]);
366
+ }
367
+
368
+ const agentMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)$/);
369
+ if (agentMatch && req.method === 'PATCH') {
370
+ return routes.handleUpdateAgent(req, res, agentMatch[1], agentMatch[2]);
371
+ }
372
+ if (agentMatch && req.method === 'DELETE') {
373
+ return routes.handleRemoveAgent(req, res, agentMatch[1], agentMatch[2]);
374
+ }
375
+
376
+ const agentSpawnMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/spawn$/);
377
+ if (agentSpawnMatch && req.method === 'POST') {
378
+ return routes.handleSpawnAgent(req, res, agentSpawnMatch[1], agentSpawnMatch[2]);
379
+ }
380
+
381
+ const agentKillMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/kill$/);
382
+ if (agentKillMatch && req.method === 'POST') {
383
+ return routes.handleKillAgent(req, res, agentKillMatch[1], agentKillMatch[2]);
384
+ }
385
+
386
+ const agentPromptMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/prompt$/);
387
+ if (agentPromptMatch && req.method === 'POST') {
388
+ return routes.handleSendPromptToAgent(req, res, agentPromptMatch[1], agentPromptMatch[2]);
389
+ }
390
+
391
+ const agentStatusMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/status$/);
392
+ if (agentStatusMatch && req.method === 'GET') {
393
+ return routes.handleGetAgentStatus(req, res, agentStatusMatch[1], agentStatusMatch[2]);
394
+ }
395
+
396
+ const agentDependencyMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/dependencies$/);
397
+ if (agentDependencyMatch && req.method === 'POST') {
398
+ return routes.handleAddAgentDependency(req, res, agentDependencyMatch[1], agentDependencyMatch[2]);
399
+ }
400
+
401
+ const agentDependencyRemoveMatch = url.pathname.match(/^\/api\/orchestrations\/([^/]+)\/agents\/([^/]+)\/dependencies\/([^/]+)$/);
402
+ if (agentDependencyRemoveMatch && req.method === 'DELETE') {
403
+ return routes.handleRemoveAgentDependency(req, res, agentDependencyRemoveMatch[1], agentDependencyRemoveMatch[2], agentDependencyRemoveMatch[3]);
404
+ }
405
+
406
+ // Orchestration template routes
407
+ if (url.pathname === '/api/orchestration-templates' && req.method === 'GET') {
408
+ return routes.handleGetTemplates(req, res);
409
+ }
410
+
411
+ const templateMatch = url.pathname.match(/^\/api\/orchestration-templates\/([^/]+)$/);
412
+ if (templateMatch && req.method === 'GET') {
413
+ return routes.handleGetTemplate(req, res, templateMatch[1]);
414
+ }
415
+ if (templateMatch && req.method === 'POST') {
416
+ return routes.handleCreateFromTemplate(req, res, templateMatch[1]);
417
+ }
418
+
341
419
  // Task routes
342
420
  const taskMatch = url.pathname.match(/^\/api\/tasks\/([^/]+)\/(\d+)$/);
343
421
  if (taskMatch && req.method === 'PATCH') {
@@ -381,6 +459,9 @@ function start() {
381
459
  // Initialize session manager
382
460
  sessionManager.init();
383
461
 
462
+ // Initialize orchestration executor
463
+ orchestrationExecutor.init();
464
+
384
465
  // Set up file watchers
385
466
  setupWatchers();
386
467