@narumitw/pi-goal 0.54.0 → 0.54.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/chunks/{chunk-XHEFHXTF.js → chunk-UC6U2RFG.js} +8 -2
- package/dist/chunks/{chunk-XHEFHXTF.js.map → chunk-UC6U2RFG.js.map} +2 -2
- package/dist/chunks/{menu-4GLAABLR.js → menu-R2B7UE3T.js} +2 -2
- package/dist/index.ts +6 -3
- package/dist/index.ts.map +2 -2
- package/package.json +2 -2
- package/src/lifecycle.ts +5 -0
- package/src/runtime.ts +9 -1
- package/src/tools.ts +1 -1
- /package/dist/chunks/{menu-4GLAABLR.js.map → menu-R2B7UE3T.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-goal",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.1",
|
|
4
4
|
"description": "Pi extension for autonomous single-objective /goal completion.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "7.0.2"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@narumitw/pi-tui-kit": "^0.58.
|
|
53
|
+
"@narumitw/pi-tui-kit": "^0.58.2"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
package/src/lifecycle.ts
CHANGED
|
@@ -483,6 +483,11 @@ export function registerGoalLifecycle(
|
|
|
483
483
|
|
|
484
484
|
pi.on("turn_end", (event, ctx) => {
|
|
485
485
|
runtime.recordAutomaticTurn(ctx, event.message);
|
|
486
|
+
// goal_complete clears state synchronously, but its inactive contract must wait
|
|
487
|
+
// until Pi has persisted the real tool result at this turn boundary.
|
|
488
|
+
if (runtime.activeGoal?.status !== "active") {
|
|
489
|
+
runtime.ensureInactiveGoalContextContract(ctx);
|
|
490
|
+
}
|
|
486
491
|
});
|
|
487
492
|
|
|
488
493
|
pi.on("agent_end", (event, ctx) => {
|
package/src/runtime.ts
CHANGED
|
@@ -1234,6 +1234,15 @@ export class GoalRuntime {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
1236
|
clearActiveGoal(ctx: StatusContext, reason = "goal cleared", releaseWorkflow = true) {
|
|
1237
|
+
this.clearActiveGoalState(ctx, reason, releaseWorkflow);
|
|
1238
|
+
this.ensureInactiveGoalContextContract(ctx);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
clearCompletedGoal(ctx: StatusContext) {
|
|
1242
|
+
this.clearActiveGoalState(ctx, "goal cleared", true);
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
private clearActiveGoalState(ctx: StatusContext, reason: string, releaseWorkflow: boolean) {
|
|
1237
1246
|
const clearedGoal = this.activeGoal;
|
|
1238
1247
|
this.clearGoalWaitTimer();
|
|
1239
1248
|
this.cancelContinuationWork();
|
|
@@ -1243,7 +1252,6 @@ export class GoalRuntime {
|
|
|
1243
1252
|
this.activeGoal = undefined;
|
|
1244
1253
|
this.legacyQueueState = undefined;
|
|
1245
1254
|
this.clearPersistedGoal(ctx.cwd, clearedGoal, reason);
|
|
1246
|
-
this.ensureInactiveGoalContextContract(ctx);
|
|
1247
1255
|
ctx.ui.setStatus(STATUS_KEY, undefined);
|
|
1248
1256
|
if (releaseWorkflow) this.releaseWorkflow();
|
|
1249
1257
|
}
|
package/src/tools.ts
CHANGED
|
@@ -164,7 +164,7 @@ export function registerGoalTools(pi: ExtensionAPI, runtime: GoalRuntime) {
|
|
|
164
164
|
runtime.persistGoal(runtime.activeGoal);
|
|
165
165
|
|
|
166
166
|
ctx.ui.setStatus(STATUS_KEY, formatStatus(runtime.activeGoal));
|
|
167
|
-
runtime.
|
|
167
|
+
runtime.clearCompletedGoal(ctx);
|
|
168
168
|
runtime.showCompletionStatus(ctx);
|
|
169
169
|
notifyTerminal(ctx.ui, `Goal complete: ${goal}`, "info");
|
|
170
170
|
|
|
File without changes
|