heyio 0.1.25 → 0.1.26
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/dist/api/server.js +52 -0
- package/package.json +1 -1
package/dist/api/server.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import { config } from "../config.js";
|
|
3
|
+
import { listSkills } from "../copilot/skills.js";
|
|
4
|
+
import { listSquads, createSquad } from "../store/squads.js";
|
|
5
|
+
import { getAgentInfo } from "../copilot/agents.js";
|
|
3
6
|
import { IO_VERSION } from "../paths.js";
|
|
4
7
|
let messageHandler;
|
|
5
8
|
const sseConnections = new Set();
|
|
@@ -27,6 +30,55 @@ export async function startApiServer() {
|
|
|
27
30
|
app.get("/status", (_req, res) => {
|
|
28
31
|
res.json({ version: IO_VERSION, uptime: process.uptime() });
|
|
29
32
|
});
|
|
33
|
+
// Skills endpoints
|
|
34
|
+
app.get("/skills", (_req, res) => {
|
|
35
|
+
try {
|
|
36
|
+
const skills = listSkills();
|
|
37
|
+
res.json({ skills });
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error("Error listing skills:", e);
|
|
41
|
+
res.status(500).json({ error: "Failed to list skills" });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Squads endpoints
|
|
45
|
+
app.get("/squads", (_req, res) => {
|
|
46
|
+
try {
|
|
47
|
+
const squads = listSquads();
|
|
48
|
+
res.json({ squads });
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
console.error("Error listing squads:", e);
|
|
52
|
+
res.status(500).json({ error: "Failed to list squads" });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
app.post("/squads", (req, res) => {
|
|
56
|
+
try {
|
|
57
|
+
const { slug, name, projectPath } = req.body;
|
|
58
|
+
if (!slug || !name || !projectPath) {
|
|
59
|
+
res.status(400).json({ error: "Missing required fields: slug, name, projectPath" });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const squad = createSquad(slug, name, projectPath);
|
|
63
|
+
res.json({ squad });
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.error("Error creating squad:", e);
|
|
67
|
+
res.status(500).json({ error: "Failed to create squad" });
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
// Agents endpoints
|
|
71
|
+
app.get("/agents", (_req, res) => {
|
|
72
|
+
try {
|
|
73
|
+
const agents = getAgentInfo();
|
|
74
|
+
res.json({ agents });
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.error("Error listing agents:", e);
|
|
78
|
+
res.status(500).json({ error: "Failed to list agents" });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// Chat endpoints
|
|
30
82
|
app.post("/message", async (req, res) => {
|
|
31
83
|
const { text } = req.body;
|
|
32
84
|
if (!text) {
|