@pi-unipi/background-tasks 2.20.0 → 2.20.2
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 +2 -2
- package/src/index.ts +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/background-tasks",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.2",
|
|
4
4
|
"description": "Background tasks for UniPi — durable shell jobs and delegated background agents with a footer dock",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/pi-ai": "^0.84.0",
|
|
13
|
-
"@pi-unipi/core": "2.20.
|
|
13
|
+
"@pi-unipi/core": "2.20.2",
|
|
14
14
|
"turndown": "^7.2.4"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
13
|
-
import { createSpinnerLine } from "@pi-unipi/core";
|
|
13
|
+
import { createSpinnerLine, setHerdrWorking } from "@pi-unipi/core";
|
|
14
14
|
import { loadBackgroundTasksConfig } from "./config.js";
|
|
15
15
|
import { BackgroundTaskRegistry } from "./registry.js";
|
|
16
16
|
import {
|
|
@@ -134,9 +134,21 @@ export default function backgroundTasksExtension(pi: ExtensionAPI): void {
|
|
|
134
134
|
{ placement: "aboveEditor" },
|
|
135
135
|
);
|
|
136
136
|
wakeLineInstalled = true;
|
|
137
|
+
// The pane is not done: a running task will re-invoke the agent. Keep
|
|
138
|
+
// herdr at `working` instead of `idle` for exactly as long as the wake
|
|
139
|
+
// line is up (one claim transition per widget install, not per tick).
|
|
140
|
+
const wakeCount = registry
|
|
141
|
+
.allTasks()
|
|
142
|
+
.filter((task) => task.status === "running" && task.triggerOnCompletion).length;
|
|
143
|
+
setHerdrWorking(
|
|
144
|
+
pi,
|
|
145
|
+
"bg-wake",
|
|
146
|
+
`${wakeCount === 1 ? "1 bg task" : `${String(wakeCount)} bg tasks`} will resume agent`,
|
|
147
|
+
);
|
|
137
148
|
} else if (!wantWakeLine && wakeLineInstalled) {
|
|
138
149
|
target.ui.setWidget("background-tasks", undefined);
|
|
139
150
|
wakeLineInstalled = false;
|
|
151
|
+
setHerdrWorking(pi, "bg-wake", null);
|
|
140
152
|
}
|
|
141
153
|
if (running.length === 0 && unseenFinishedCount === 0) {
|
|
142
154
|
target.ui.setStatus("background-tasks", undefined);
|