metame-cli 1.5.24 → 1.5.25
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/package.json
CHANGED
|
@@ -431,7 +431,8 @@ function createCommandRouter(deps) {
|
|
|
431
431
|
!!curHasEngine &&
|
|
432
432
|
cur.cwd !== projCwd &&
|
|
433
433
|
!rawHasEngine;
|
|
434
|
-
|
|
434
|
+
const _isControlCmd = text && /^\/(stop|quit)$/.test(text.trim());
|
|
435
|
+
if (!_isControlCmd && (!cur || !curHasEngine || shouldReattachForCwdChange)) {
|
|
435
436
|
const initReason = !cur ? 'no-session' : (!curHasEngine ? 'engine-missing' : 'cwd-changed');
|
|
436
437
|
log('INFO', `SESSION-INIT [${String(sessionChatId).slice(-32)}] ${initReason}`);
|
|
437
438
|
attachOrCreateSession(sessionChatId, projCwd, proj.name || mappedKey, targetEngine);
|
|
@@ -4,6 +4,7 @@ const { classifyTaskUsage } = require('./usage-classifier');
|
|
|
4
4
|
const { normalizeModel } = require('./daemon-task-scheduler');
|
|
5
5
|
const { resolveEngineModel } = require('./daemon-engine-runtime');
|
|
6
6
|
const { createCommandSessionResolver } = require('./daemon-command-session-route');
|
|
7
|
+
const { isThreadChatId: _isThreadChatId, rawChatId: _rawThreadChatId } = require('./core/thread-chat-id');
|
|
7
8
|
|
|
8
9
|
function createExecCommandHandler(deps) {
|
|
9
10
|
const {
|
|
@@ -218,7 +219,12 @@ function createExecCommandHandler(deps) {
|
|
|
218
219
|
const _pl = pipeline && pipeline.current;
|
|
219
220
|
if (_pl) {
|
|
220
221
|
_pl.clearQueue(chatId);
|
|
221
|
-
|
|
222
|
+
let stopped = _pl.interruptActive(chatId);
|
|
223
|
+
if (!stopped && _isThreadChatId(chatId)) {
|
|
224
|
+
// Thread-scoped /stop: fall back to raw chatId (task may be keyed at group level).
|
|
225
|
+
// Do NOT clearQueue(_raw) — that would discard queued tasks from other threads.
|
|
226
|
+
stopped = _pl.interruptActive(_rawThreadChatId(chatId));
|
|
227
|
+
}
|
|
222
228
|
if (stopped) {
|
|
223
229
|
await bot.sendMessage(chatId, '⏹ Stopping current engine task...');
|
|
224
230
|
} else {
|
|
@@ -226,7 +232,8 @@ function createExecCommandHandler(deps) {
|
|
|
226
232
|
}
|
|
227
233
|
} else {
|
|
228
234
|
// Fallback: direct activeProcesses manipulation (pipeline not yet initialized)
|
|
229
|
-
const
|
|
235
|
+
const _raw = _isThreadChatId(chatId) ? _rawThreadChatId(chatId) : null;
|
|
236
|
+
const proc = activeProcesses.get(chatId) || (_raw && activeProcesses.get(_raw));
|
|
230
237
|
if (proc && proc.child) {
|
|
231
238
|
proc.aborted = true;
|
|
232
239
|
const signal = proc.killSignal || 'SIGTERM';
|
|
@@ -248,9 +255,12 @@ function createExecCommandHandler(deps) {
|
|
|
248
255
|
const _pl = pipeline && pipeline.current;
|
|
249
256
|
if (_pl) {
|
|
250
257
|
_pl.clearQueue(chatId);
|
|
251
|
-
_pl.interruptActive(chatId)
|
|
258
|
+
if (!_pl.interruptActive(chatId) && _isThreadChatId(chatId)) {
|
|
259
|
+
_pl.interruptActive(_rawThreadChatId(chatId));
|
|
260
|
+
}
|
|
252
261
|
} else {
|
|
253
|
-
const
|
|
262
|
+
const _raw = _isThreadChatId(chatId) ? _rawThreadChatId(chatId) : null;
|
|
263
|
+
const proc = activeProcesses.get(chatId) || (_raw && activeProcesses.get(_raw));
|
|
254
264
|
if (proc && proc.child) {
|
|
255
265
|
proc.aborted = true;
|
|
256
266
|
const signal = proc.killSignal || 'SIGTERM';
|