@skydiveai/pi-extensions 0.1.0-beta.2628 → 0.1.0-beta.2630
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/index.mjs +5 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -544,7 +544,7 @@ const toolCallSummaryExtension = (pi) => {
|
|
|
544
544
|
* **ESM cache-busting.** `import(url)` in Node's ESM loader keys cached
|
|
545
545
|
* modules by URL. Re-importing the same path after editing the file gets
|
|
546
546
|
* the *original* module back. To force a fresh load on mtime change we
|
|
547
|
-
* append `?
|
|
547
|
+
* append `?mtime=<mtimeMs>` to the URL — different URL, fresh module
|
|
548
548
|
* evaluation. The old version stays in memory but is unreachable.
|
|
549
549
|
*
|
|
550
550
|
* Each `.ts`/`.mjs`/`.js` file's default export should be a `ToolDefinition`
|
|
@@ -627,7 +627,7 @@ async function listToolFiles(dir) {
|
|
|
627
627
|
return out;
|
|
628
628
|
}
|
|
629
629
|
async function importToolFile({ dir, file, mtimeMs }) {
|
|
630
|
-
const mod = await import(`${pathToFileURL(join(dir, file)).href}?
|
|
630
|
+
const mod = await import(`${pathToFileURL(join(dir, file)).href}?mtime=${mtimeMs}`);
|
|
631
631
|
const exported = mod.default ?? mod.tool ?? mod.tools;
|
|
632
632
|
const tools = [];
|
|
633
633
|
if (Array.isArray(exported)) {
|
|
@@ -4688,7 +4688,9 @@ function watchdogTick(now) {
|
|
|
4688
4688
|
}
|
|
4689
4689
|
if (now - lastKeepaliveAt >= KEEPALIVE_EVERY_MS) {
|
|
4690
4690
|
lastKeepaliveAt = now;
|
|
4691
|
-
|
|
4691
|
+
const messageIds = new Set(running.map((task) => task.messageId));
|
|
4692
|
+
if (messageIds.size === 0) postHeartbeat({ messageId: null });
|
|
4693
|
+
else for (const messageId of messageIds) postHeartbeat({ messageId });
|
|
4692
4694
|
}
|
|
4693
4695
|
}
|
|
4694
4696
|
function stopWatchdog() {
|