@narumitw/pi-goal 0.18.0 → 0.20.0

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/goal.ts +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-goal",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Pi extension for autonomous /goal completion with opt-in experimental ordered queues.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@biomejs/biome": "2.5.3",
37
- "@earendil-works/pi-ai": "0.80.6",
38
- "@earendil-works/pi-coding-agent": "0.80.6",
39
- "typescript": "6.0.3"
37
+ "@earendil-works/pi-ai": "0.80.10",
38
+ "@earendil-works/pi-coding-agent": "0.80.10",
39
+ "typescript": "7.0.2"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",
package/src/goal.ts CHANGED
@@ -56,6 +56,16 @@ const EXPERIMENTAL_GOALS_WARNING =
56
56
  const MAX_BLOCKER_REASON_LENGTH = 1_000;
57
57
  const MAX_BLOCKER_EVIDENCE_LENGTH = 4_000;
58
58
 
59
+ type AgentSettledHandler = (event: unknown, ctx: StatusContext) => unknown;
60
+
61
+ function onAgentSettled(pi: ExtensionAPI, handler: AgentSettledHandler) {
62
+ (
63
+ pi as unknown as {
64
+ on(event: "agent_settled", callback: AgentSettledHandler): void;
65
+ }
66
+ ).on("agent_settled", handler);
67
+ }
68
+
59
69
  function registerGoalRuntime(pi: ExtensionAPI, options: GoalOptions = {}) {
60
70
  const runtime = new GoalRuntime(pi);
61
71
  const commands = new GoalCommandController(runtime);
@@ -857,7 +867,7 @@ function registerGoalRuntime(pi: ExtensionAPI, options: GoalOptions = {}) {
857
867
  requestContinuation(currentGoal);
858
868
  });
859
869
 
860
- pi.on("agent_settled", (_event, ctx) => {
870
+ onAgentSettled(pi, (_event, ctx) => {
861
871
  if (runtime.queueFrozen) return;
862
872
  if (!runtime.pendingQueueAction) {
863
873
  dispatchContinuationIfSettled(ctx);