@opentrust/dashboard 7.3.28 → 7.3.29
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/routes/hosts.js +52 -52
- package/package.json +3 -3
package/dist/routes/hosts.js
CHANGED
|
@@ -67,55 +67,8 @@ hostsRouter.post("/:id/heartbeat", async (req, res, next) => {
|
|
|
67
67
|
next(err);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
// ─── Host
|
|
71
|
-
//
|
|
72
|
-
hostsRouter.get("/", async (_req, res, next) => {
|
|
73
|
-
try {
|
|
74
|
-
const tenantId = res.locals.tenantId;
|
|
75
|
-
const data = await hosts.findAll(tenantId);
|
|
76
|
-
res.json({ success: true, data: data.map(withOnlineStatus) });
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
next(err);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
// GET /api/hosts/:id
|
|
83
|
-
hostsRouter.get("/:id", async (req, res, next) => {
|
|
84
|
-
try {
|
|
85
|
-
const host = await hosts.findById(req.params.id);
|
|
86
|
-
if (!host) {
|
|
87
|
-
res.status(404).json({ success: false, error: "Host not found" });
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
res.json({ success: true, data: withOnlineStatus(host) });
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
next(err);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
// GET /api/hosts/:id/agents — list agents associated with this host
|
|
97
|
-
hostsRouter.get("/:id/agents", async (req, res, next) => {
|
|
98
|
-
try {
|
|
99
|
-
const tenantId = res.locals.tenantId;
|
|
100
|
-
const data = await agentsDb.findByHostId(req.params.id, tenantId);
|
|
101
|
-
res.json({ success: true, data });
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
next(err);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
// DELETE /api/hosts/:id
|
|
108
|
-
hostsRouter.delete("/:id", async (req, res, next) => {
|
|
109
|
-
try {
|
|
110
|
-
await hosts.remove(req.params.id);
|
|
111
|
-
res.json({ success: true });
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
next(err);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
// ─── Host Commands ──────────────────────────────────────────
|
|
118
|
-
// POST /api/host-commands
|
|
70
|
+
// ─── Host Commands (MUST be before /:id to avoid route conflict) ─
|
|
71
|
+
// POST /api/hosts/commands
|
|
119
72
|
hostsRouter.post("/commands", async (req, res, next) => {
|
|
120
73
|
try {
|
|
121
74
|
const tenantId = res.locals.tenantId;
|
|
@@ -138,7 +91,7 @@ hostsRouter.post("/commands", async (req, res, next) => {
|
|
|
138
91
|
next(err);
|
|
139
92
|
}
|
|
140
93
|
});
|
|
141
|
-
// GET /api/
|
|
94
|
+
// GET /api/hosts/commands?hostId=xxx
|
|
142
95
|
hostsRouter.get("/commands", async (req, res, next) => {
|
|
143
96
|
try {
|
|
144
97
|
const tenantId = res.locals.tenantId;
|
|
@@ -155,7 +108,7 @@ hostsRouter.get("/commands", async (req, res, next) => {
|
|
|
155
108
|
next(err);
|
|
156
109
|
}
|
|
157
110
|
});
|
|
158
|
-
// GET /api/
|
|
111
|
+
// GET /api/hosts/commands/pending?hostId=xxx (CLI polling)
|
|
159
112
|
hostsRouter.get("/commands/pending", async (req, res, next) => {
|
|
160
113
|
try {
|
|
161
114
|
const tenantId = res.locals.tenantId;
|
|
@@ -171,7 +124,7 @@ hostsRouter.get("/commands/pending", async (req, res, next) => {
|
|
|
171
124
|
next(err);
|
|
172
125
|
}
|
|
173
126
|
});
|
|
174
|
-
// PUT /api/
|
|
127
|
+
// PUT /api/hosts/commands/:id/ack (CLI callback)
|
|
175
128
|
hostsRouter.put("/commands/:id/ack", async (req, res, next) => {
|
|
176
129
|
try {
|
|
177
130
|
const { id } = req.params;
|
|
@@ -190,3 +143,50 @@ hostsRouter.put("/commands/:id/ack", async (req, res, next) => {
|
|
|
190
143
|
next(err);
|
|
191
144
|
}
|
|
192
145
|
});
|
|
146
|
+
// ─── Host Management (called by Dashboard UI) ──────────────
|
|
147
|
+
// GET /api/hosts
|
|
148
|
+
hostsRouter.get("/", async (_req, res, next) => {
|
|
149
|
+
try {
|
|
150
|
+
const tenantId = res.locals.tenantId;
|
|
151
|
+
const data = await hosts.findAll(tenantId);
|
|
152
|
+
res.json({ success: true, data: data.map(withOnlineStatus) });
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
next(err);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
// GET /api/hosts/:id
|
|
159
|
+
hostsRouter.get("/:id", async (req, res, next) => {
|
|
160
|
+
try {
|
|
161
|
+
const host = await hosts.findById(req.params.id);
|
|
162
|
+
if (!host) {
|
|
163
|
+
res.status(404).json({ success: false, error: "Host not found" });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
res.json({ success: true, data: withOnlineStatus(host) });
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
next(err);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// GET /api/hosts/:id/agents — list agents associated with this host
|
|
173
|
+
hostsRouter.get("/:id/agents", async (req, res, next) => {
|
|
174
|
+
try {
|
|
175
|
+
const tenantId = res.locals.tenantId;
|
|
176
|
+
const data = await agentsDb.findByHostId(req.params.id, tenantId);
|
|
177
|
+
res.json({ success: true, data });
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
next(err);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
// DELETE /api/hosts/:id
|
|
184
|
+
hostsRouter.delete("/:id", async (req, res, next) => {
|
|
185
|
+
try {
|
|
186
|
+
await hosts.remove(req.params.id);
|
|
187
|
+
res.json({ success: true });
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
next(err);
|
|
191
|
+
}
|
|
192
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentrust/dashboard",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTrust Dashboard — management panel for AI Agent security (API + embedded web)",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"morgan": "^1.10.0",
|
|
20
20
|
"nodemailer": "^8.0.1",
|
|
21
21
|
"zod": "^3.23.0",
|
|
22
|
-
"@opentrust/db": "7.3.
|
|
23
|
-
"@opentrust/shared": "7.3.
|
|
22
|
+
"@opentrust/db": "7.3.29",
|
|
23
|
+
"@opentrust/shared": "7.3.29"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/cors": "^2.8.17",
|