blun-king-cli 9.1.477 → 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,
|
|
@@ -165,10 +165,16 @@ function createDirectFocusController(options = {}) {
|
|
|
165
165
|
savedCheckpoint = { ...initialCheckpoint, chatId };
|
|
166
166
|
conversations.set(chatId, conversation);
|
|
167
167
|
const resumeAfterMs = Date.parse(String(initialCheckpoint.resumeAfterAt ?? ''));
|
|
168
|
-
if (!explicitPause
|
|
168
|
+
if (!explicitPause) {
|
|
169
|
+
const pausedAtMs = Date.parse(String(initialCheckpoint.pausedAt ?? ''));
|
|
170
|
+
const resumeDeadlineMs = Number.isFinite(resumeAfterMs)
|
|
171
|
+
? resumeAfterMs
|
|
172
|
+
: Number.isFinite(pausedAtMs)
|
|
173
|
+
? pausedAtMs + silenceMs
|
|
174
|
+
: now();
|
|
169
175
|
conversation.timer = setTimer(
|
|
170
176
|
() => finishConversation(chatId, conversation),
|
|
171
|
-
Math.max(0,
|
|
177
|
+
Math.max(0, resumeDeadlineMs - now()),
|
|
172
178
|
);
|
|
173
179
|
}
|
|
174
180
|
}
|
package/blun.mjs
CHANGED
|
@@ -516807,6 +516807,7 @@ var BlunTUI = class {
|
|
|
516807
516807
|
this.track("telegram_direct_checkpoint_failed", { error_type: error?.code ?? error?.name ?? "Error" });
|
|
516808
516808
|
}
|
|
516809
516809
|
this.track("telegram_direct_resume_granted");
|
|
516810
|
+
this.channelQueueDeadline.requestDeliveryNow();
|
|
516810
516811
|
this.scheduleQueueDrain();
|
|
516811
516812
|
}
|
|
516812
516813
|
});
|