@promptbook/cli 0.112.0-70 → 0.112.0-71
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/esm/index.es.js +32 -6
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/main/shouldRunPeriodicTask.d.ts +7 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +32 -6
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/main/shouldRunPeriodicTask.d.ts +7 -0
- package/umd/src/version.d.ts +1 -1
package/esm/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-70`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* @generated
|
|
61
61
|
* @see https://github.com/webgptorg/promptbook
|
|
62
62
|
*/
|
|
63
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
63
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-71';
|
|
64
64
|
/**
|
|
65
65
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
66
66
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -52846,6 +52846,17 @@
|
|
|
52846
52846
|
return new Error(rawMessage.split(token).join('***').split(encodedToken).join('***'));
|
|
52847
52847
|
}
|
|
52848
52848
|
|
|
52849
|
+
/**
|
|
52850
|
+
* Returns true when one periodic background task should run now.
|
|
52851
|
+
*/
|
|
52852
|
+
function shouldRunPeriodicTask(options) {
|
|
52853
|
+
const { lastRunTimestamp, intervalMs } = options;
|
|
52854
|
+
if (lastRunTimestamp === undefined) {
|
|
52855
|
+
return true;
|
|
52856
|
+
}
|
|
52857
|
+
return Date.now() - lastRunTimestamp >= intervalMs;
|
|
52858
|
+
}
|
|
52859
|
+
|
|
52849
52860
|
/**
|
|
52850
52861
|
* Git commands used to list changed and untracked files in the working tree.
|
|
52851
52862
|
*/
|
|
@@ -56467,6 +56478,10 @@
|
|
|
56467
56478
|
* Delay between GitHub owner synchronization rounds while the multi-agent runner stays active.
|
|
56468
56479
|
*/
|
|
56469
56480
|
const MULTI_AGENT_GITHUB_SYNC_INTERVAL_MS = 30000;
|
|
56481
|
+
/**
|
|
56482
|
+
* Delay between GitHub owner synchronization rounds while no local repositories exist yet.
|
|
56483
|
+
*/
|
|
56484
|
+
const MULTI_AGENT_EMPTY_DIRECTORY_GITHUB_SYNC_INTERVAL_MS = MULTI_AGENT_QUEUE_POLL_INTERVAL_MS;
|
|
56470
56485
|
/**
|
|
56471
56486
|
* Watches all direct child agent repositories from the current directory in one shared session.
|
|
56472
56487
|
*/
|
|
@@ -56477,6 +56492,7 @@
|
|
|
56477
56492
|
const shouldContinue = controls.shouldContinue || (() => just(true));
|
|
56478
56493
|
const uiHandle = await initializeMultipleAgentRunUi(options);
|
|
56479
56494
|
let githubSynchronizationTimestamp;
|
|
56495
|
+
let lastObservedProjectCount = 0;
|
|
56480
56496
|
if (!uiHandle) {
|
|
56481
56497
|
console.info(colors__default["default"].green('Watching direct child agent repositories for queued messages.'));
|
|
56482
56498
|
}
|
|
@@ -56485,8 +56501,10 @@
|
|
|
56485
56501
|
rootPath,
|
|
56486
56502
|
uiHandle,
|
|
56487
56503
|
lastSynchronizationTimestamp: githubSynchronizationTimestamp,
|
|
56504
|
+
lastObservedProjectCount,
|
|
56488
56505
|
});
|
|
56489
56506
|
const projectSummaries = await loadLocalAgentRunnerProjectSummaries(rootPath);
|
|
56507
|
+
lastObservedProjectCount = projectSummaries.length;
|
|
56490
56508
|
const nextQueuedProject = projectSummaries.find((projectSummary) => projectSummary.queuedMessageCount > 0);
|
|
56491
56509
|
if (!nextQueuedProject) {
|
|
56492
56510
|
updateMultipleAgentRunUiForWatching(uiHandle, options, rootPath, projectSummaries);
|
|
@@ -56525,9 +56543,14 @@
|
|
|
56525
56543
|
*/
|
|
56526
56544
|
async function synchronizeGithubAgentRunnerRepositoriesIfNeeded(options) {
|
|
56527
56545
|
var _a;
|
|
56528
|
-
const { rootPath, uiHandle, lastSynchronizationTimestamp } = options;
|
|
56529
|
-
|
|
56530
|
-
|
|
56546
|
+
const { rootPath, uiHandle, lastSynchronizationTimestamp, lastObservedProjectCount } = options;
|
|
56547
|
+
const synchronizationIntervalMs = lastObservedProjectCount === 0
|
|
56548
|
+
? MULTI_AGENT_EMPTY_DIRECTORY_GITHUB_SYNC_INTERVAL_MS
|
|
56549
|
+
: MULTI_AGENT_GITHUB_SYNC_INTERVAL_MS;
|
|
56550
|
+
if (!shouldRunPeriodicTask({
|
|
56551
|
+
lastRunTimestamp: lastSynchronizationTimestamp,
|
|
56552
|
+
intervalMs: synchronizationIntervalMs,
|
|
56553
|
+
})) {
|
|
56531
56554
|
return lastSynchronizationTimestamp;
|
|
56532
56555
|
}
|
|
56533
56556
|
if (uiHandle) {
|
|
@@ -56698,10 +56721,13 @@
|
|
|
56698
56721
|
* Decides whether the empty queue has been idle long enough for another auto-pull.
|
|
56699
56722
|
*/
|
|
56700
56723
|
function shouldAutoPullWhileIdle(options, autoPullTimestamp) {
|
|
56701
|
-
if (!options.autoPull
|
|
56724
|
+
if (!options.autoPull) {
|
|
56702
56725
|
return false;
|
|
56703
56726
|
}
|
|
56704
|
-
return
|
|
56727
|
+
return shouldRunPeriodicTask({
|
|
56728
|
+
lastRunTimestamp: autoPullTimestamp,
|
|
56729
|
+
intervalMs: AGENT_IDLE_AUTO_PULL_INTERVAL_MS,
|
|
56730
|
+
});
|
|
56705
56731
|
}
|
|
56706
56732
|
/**
|
|
56707
56733
|
* Waits for the given number of milliseconds.
|