zames_pro 2.36.0 → 2.37.0
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/commands.js +8 -0
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/dist/commands.js
CHANGED
|
@@ -444,6 +444,14 @@ export function buildCompactCarryover(summary, task) {
|
|
|
444
444
|
export function ctrlCEscalation(sinceLastMs, windowMs = 2000) {
|
|
445
445
|
return sinceLastMs < windowMs ? 'run' : 'tool';
|
|
446
446
|
}
|
|
447
|
+
// True when a scheduled job already has a message waiting in the queue. The
|
|
448
|
+
// scheduler ticker uses this to avoid piling many copies of the SAME job while
|
|
449
|
+
// the agent is busy (a 1-minute loop would otherwise queue a task every minute
|
|
450
|
+
// during one long task, and they would all run back-to-back). Pure, so the
|
|
451
|
+
// guard is unit-tested without a live scheduler.
|
|
452
|
+
export function hasQueuedJob(queue, jobId) {
|
|
453
|
+
return queue.some((m) => m.jobId === jobId);
|
|
454
|
+
}
|
|
447
455
|
// True when the queued message is a slash-command. It must NOT be merged into
|
|
448
456
|
// a task: the main loop has to execute it (e.g. /compact, /new).
|
|
449
457
|
export function isSlashCommand(text) {
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { translate, normalizeLocale, localeDisplayName, isLocale, } from './i18n
|
|
|
16
16
|
import { Transcript } from './transcript.js';
|
|
17
17
|
import { UndoStore } from './undo.js';
|
|
18
18
|
import { selfReview, selfDiff, selfApply, selfList } from './self-review.js';
|
|
19
|
-
import { formatDiff, diffGitArgs, parseTranscript, summarizeTranscript, renderCost, formatExport, defaultExportPath, renderDoctor, renderPermissions, resolveExtraDir, buildReviewPrompt, formatDuration, trimRestoredMessages, RESTORED_HISTORY_LIMIT, mergeMessages, isSlashCommand, parseQueueCommand, parseLiveToggle, parseGoalCommand, isLiveConfigCommand, withGoal, formatQueueList, ctrlCEscalation, } from './commands.js';
|
|
19
|
+
import { formatDiff, diffGitArgs, parseTranscript, summarizeTranscript, renderCost, formatExport, defaultExportPath, renderDoctor, renderPermissions, resolveExtraDir, buildReviewPrompt, formatDuration, trimRestoredMessages, RESTORED_HISTORY_LIMIT, mergeMessages, hasQueuedJob, isSlashCommand, parseQueueCommand, parseLiveToggle, parseGoalCommand, isLiveConfigCommand, withGoal, formatQueueList, ctrlCEscalation, } from './commands.js';
|
|
20
20
|
import { performCompact } from './compact.js';
|
|
21
21
|
import { Scheduler, parseInterval, formatInterval, parseCron, } from './scheduler.js';
|
|
22
22
|
import { renderMarkdown } from './markdown.js';
|
|
@@ -1343,7 +1343,18 @@ async function main() {
|
|
|
1343
1343
|
scheduleTimer = setInterval(() => {
|
|
1344
1344
|
const due = scheduler.due(Date.now());
|
|
1345
1345
|
for (const job of due) {
|
|
1346
|
-
|
|
1346
|
+
// Do not pile MANY copies of the same job while the agent is busy: if
|
|
1347
|
+
// this job already has a pending message in the queue, skip this fire.
|
|
1348
|
+
// Otherwise a 1-minute loop would add a new task every minute while a
|
|
1349
|
+
// long task is in flight, and they would all run back-to-back.
|
|
1350
|
+
if (hasQueuedJob(pendingQueue, job.id)) {
|
|
1351
|
+
transcript.log('scheduled_skip_queued', {
|
|
1352
|
+
id: job.id,
|
|
1353
|
+
task: job.task,
|
|
1354
|
+
});
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
pendingQueue.push({ text: job.task, jobId: job.id });
|
|
1347
1358
|
transcript.log('scheduled_fire', { id: job.id, task: job.task });
|
|
1348
1359
|
if (editor) {
|
|
1349
1360
|
editor.printAbove(theme.system(t('sched.fired', { id: String(job.id), task: job.task })));
|