@dougbots/avenor-pi 0.7.0 → 0.7.1
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.js +31 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -552,6 +552,19 @@ function formatRunLine(entry) {
|
|
|
552
552
|
const phase = entry.phaseLabel ? ` (${entry.phaseLabel})` : "";
|
|
553
553
|
return `${emoji} ${entry.label} (${entry.agent}) — ${entry.status}${phase}${perm}`;
|
|
554
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* decideCompletion determines whether to skip, defer, or send the completion
|
|
557
|
+
* steering message for a tracked run that has reached terminal status.
|
|
558
|
+
*
|
|
559
|
+
* The deferral prevents duplication when avenor_result consumes the result
|
|
560
|
+
* in the same turn: if the agent calls avenor_result between the defer and
|
|
561
|
+
* the next tick, the run is deleted from tracking and the send never fires.
|
|
562
|
+
*/
|
|
563
|
+
function decideCompletion(run) {
|
|
564
|
+
if (run.blocking) return "skip";
|
|
565
|
+
if (!run.completionPending) return "defer";
|
|
566
|
+
return "send";
|
|
567
|
+
}
|
|
555
568
|
//#endregion
|
|
556
569
|
//#region src/agent-profile.ts
|
|
557
570
|
const PROFILE_ENTRY_TYPE = "pi-agents:profile";
|
|
@@ -725,7 +738,8 @@ function createExtension(deps = defaultDeps) {
|
|
|
725
738
|
startTime: current?.startTime ?? Date.now(),
|
|
726
739
|
lastStatus: status ?? current?.lastStatus,
|
|
727
740
|
blocking: current?.blocking ?? blocking,
|
|
728
|
-
permissionNotified: current?.permissionNotified
|
|
741
|
+
permissionNotified: current?.permissionNotified,
|
|
742
|
+
completionPending: current?.completionPending
|
|
729
743
|
});
|
|
730
744
|
}
|
|
731
745
|
async function resolveFinalOutput(run, status) {
|
|
@@ -845,19 +859,22 @@ function createExtension(deps = defaultDeps) {
|
|
|
845
859
|
if (!run) continue;
|
|
846
860
|
if (isTerminalStatus(entry.status)) {
|
|
847
861
|
const prevStatus = prevStatuses.get(entry.runId);
|
|
848
|
-
if (!prevStatus
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
862
|
+
if (!(prevStatus && isTerminalStatus(prevStatus))) sessionCtx?.ui.notify(`Sub-agent "${entry.label}" finished: ${entry.status}`, entry.status === "done" ? "info" : "warning");
|
|
863
|
+
if (run.blocking) continue;
|
|
864
|
+
const action = decideCompletion(run);
|
|
865
|
+
if (action === "defer") {
|
|
866
|
+
run.completionPending = true;
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if (action === "skip") continue;
|
|
870
|
+
const finalOutput = await resolveFinalOutput(run, run.lastStatus);
|
|
871
|
+
try {
|
|
872
|
+
pi.sendUserMessage(buildCompletionText({
|
|
873
|
+
runId: run.runId,
|
|
874
|
+
label: run.label
|
|
875
|
+
}, run.lastStatus, finalOutput), { deliverAs: "followUp" });
|
|
876
|
+
} catch (err) {
|
|
877
|
+
console.error("avenor tick: sendUserMessage failed", err);
|
|
861
878
|
}
|
|
862
879
|
trackedRuns.delete(entry.runId);
|
|
863
880
|
} else if (entry.pendingPermission && !run.blocking && !run.permissionNotified) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougbots/avenor-pi",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dev": "tsdown --watch"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dougbots/avenor-core": "^0.7.
|
|
38
|
+
"@dougbots/avenor-core": "^0.7.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@earendil-works/pi-coding-agent": "*",
|