blun-king-cli 9.1.478 → 9.1.479
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.
|
@@ -4,6 +4,7 @@ import { createServer } from 'node:http';
|
|
|
4
4
|
const DEFAULT_HOST = '127.0.0.1';
|
|
5
5
|
const DEFAULT_MAX_BODY_BYTES = 1024 * 1024;
|
|
6
6
|
const INTERNAL_SECRET_HEADER = 'x-blun-agent-secret';
|
|
7
|
+
const INTERNAL_LIVE_PATH = '/internal/live';
|
|
7
8
|
const PRINCIPAL_HEADER = 'x-blun-principal-id';
|
|
8
9
|
const PRINCIPAL_PATTERN = /^[A-Za-z0-9._:-]{1,256}$/u;
|
|
9
10
|
const LOOPBACK_HOSTS = new Set(['127.0.0.1', '::1']);
|
|
@@ -193,6 +194,24 @@ function createAgentApiPrivateHttpServer(options = {}) {
|
|
|
193
194
|
request.resume();
|
|
194
195
|
throw serverError('AGENT_API_UNAUTHENTICATED', 'Agent API authentication failed.', 401);
|
|
195
196
|
}
|
|
197
|
+
if (request.url === INTERNAL_LIVE_PATH) {
|
|
198
|
+
request.resume();
|
|
199
|
+
if (request.method !== 'GET') {
|
|
200
|
+
writeJson(response, 404, {
|
|
201
|
+
error: {
|
|
202
|
+
type: 'invalid_request_error',
|
|
203
|
+
code: 'AGENT_API_ROUTE_NOT_FOUND',
|
|
204
|
+
message: 'Agent API route not found.',
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
writeJson(response, 200, {
|
|
210
|
+
status: 'ok',
|
|
211
|
+
service: 'king-agent-api',
|
|
212
|
+
});
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
196
215
|
const principalId = requirePrincipal(request.headers);
|
|
197
216
|
const body = await readJsonBody(request, maxBodyBytes);
|
|
198
217
|
const result = await adapter.handleRequest({
|
|
@@ -262,6 +281,7 @@ export {
|
|
|
262
281
|
AgentApiPrivateHttpServerError,
|
|
263
282
|
DEFAULT_HOST,
|
|
264
283
|
DEFAULT_MAX_BODY_BYTES,
|
|
284
|
+
INTERNAL_LIVE_PATH,
|
|
265
285
|
INTERNAL_SECRET_HEADER,
|
|
266
286
|
PRINCIPAL_HEADER,
|
|
267
287
|
createAgentApiPrivateHttpServer,
|