@openeryc/pi-coding-agent 0.75.58 → 0.75.59

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 (30) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/core/agent-session.d.ts +11 -1
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +32 -0
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/session-manager.d.ts +4 -0
  7. package/dist/core/session-manager.d.ts.map +1 -1
  8. package/dist/core/session-manager.js +19 -2
  9. package/dist/core/session-manager.js.map +1 -1
  10. package/dist/core/system-prompt.d.ts +2 -0
  11. package/dist/core/system-prompt.d.ts.map +1 -1
  12. package/dist/core/system-prompt.js +8 -1
  13. package/dist/core/system-prompt.js.map +1 -1
  14. package/dist/modes/interactive/goal-evaluator.d.ts +23 -0
  15. package/dist/modes/interactive/goal-evaluator.d.ts.map +1 -0
  16. package/dist/modes/interactive/goal-evaluator.js +68 -0
  17. package/dist/modes/interactive/goal-evaluator.js.map +1 -0
  18. package/dist/modes/interactive/interactive-mode.d.ts +6 -6
  19. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  20. package/dist/modes/interactive/interactive-mode.js +133 -79
  21. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  22. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  23. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  24. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  25. package/examples/extensions/sandbox/package-lock.json +2 -2
  26. package/examples/extensions/sandbox/package.json +1 -1
  27. package/examples/extensions/with-deps/package-lock.json +2 -2
  28. package/examples/extensions/with-deps/package.json +1 -1
  29. package/npm-shrinkwrap.json +12 -12
  30. package/package.json +4 -4
@@ -678,6 +678,7 @@ export class AgentSession {
678
678
  promptGuidelines,
679
679
  mcpTools: mcpTools.length > 0 ? mcpTools : undefined,
680
680
  memory: this._resourceLoader.getMemory(),
681
+ sessionGoal: this.sessionManager.getSessionGoal(),
681
682
  };
682
683
  return buildSystemPrompt(this._baseSystemPromptOptions);
683
684
  }
@@ -2226,9 +2227,24 @@ export class AgentSession {
2226
2227
  }
2227
2228
  /**
2228
2229
  * Set a goal for the current session.
2230
+ * Rebuilds system prompt so the goal is visible to the model.
2229
2231
  */
2230
2232
  setSessionGoal(goal) {
2231
2233
  this.sessionManager.appendSessionGoal(goal);
2234
+ // Rebuild system prompt so the goal becomes visible to the model immediately
2235
+ this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
2236
+ this.agent.state.systemPrompt = this._baseSystemPrompt;
2237
+ this._emit({ type: "session_info_changed", name: this.sessionManager.getSessionName() });
2238
+ }
2239
+ /**
2240
+ * Clear the current session goal.
2241
+ * Rebuilds system prompt to remove the goal from the model's context.
2242
+ */
2243
+ clearSessionGoal() {
2244
+ this.sessionManager.appendGoalCleared();
2245
+ // Rebuild system prompt without the goal
2246
+ this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
2247
+ this.agent.state.systemPrompt = this._baseSystemPrompt;
2232
2248
  this._emit({ type: "session_info_changed", name: this.sessionManager.getSessionName() });
2233
2249
  }
2234
2250
  // =========================================================================
@@ -2573,6 +2589,22 @@ export class AgentSession {
2573
2589
  // =========================================================================
2574
2590
  // Utilities
2575
2591
  // =========================================================================
2592
+ /**
2593
+ * Get the last assistant message with full content (including usage).
2594
+ */
2595
+ getLastAssistantMessage() {
2596
+ return this.messages
2597
+ .slice()
2598
+ .reverse()
2599
+ .find((m) => {
2600
+ if (m.role !== "assistant")
2601
+ return false;
2602
+ const msg = m;
2603
+ if (msg.stopReason === "aborted" && msg.content.length === 0)
2604
+ return false;
2605
+ return true;
2606
+ });
2607
+ }
2576
2608
  /**
2577
2609
  * Get text content of last assistant message.
2578
2610
  * Useful for /copy command.