@oh-my-pi/pi-agent-core 14.5.8 → 14.5.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [14.5.10] - 2026-04-30
6
+
7
+ ### Added
8
+
9
+ - Added an `onResponse` stream option for observing provider response metadata after response headers arrive.
10
+
5
11
  ## [14.2.0] - 2026-04-23
6
12
 
7
13
  ### Changed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-agent-core",
4
- "version": "14.5.8",
4
+ "version": "14.5.10",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -35,9 +35,9 @@
35
35
  "fmt": "biome format --write ."
36
36
  },
37
37
  "dependencies": {
38
- "@oh-my-pi/pi-ai": "14.5.8",
39
- "@oh-my-pi/pi-natives": "14.5.8",
40
- "@oh-my-pi/pi-utils": "14.5.8"
38
+ "@oh-my-pi/pi-ai": "14.5.10",
39
+ "@oh-my-pi/pi-natives": "14.5.10",
40
+ "@oh-my-pi/pi-utils": "14.5.10"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@sinclair/typebox": "^0.34.49",
package/src/agent.ts CHANGED
@@ -131,6 +131,10 @@ export interface AgentOptions {
131
131
  * Inspect or replace provider payloads before they are sent.
132
132
  */
133
133
  onPayload?: SimpleStreamOptions["onPayload"];
134
+ /**
135
+ * Inspect provider response metadata after headers arrive and before streaming body consumption.
136
+ */
137
+ onResponse?: SimpleStreamOptions["onResponse"];
134
138
  /**
135
139
  * Inspect assistant streaming events before they are emitted to subscribers.
136
140
  * Use this when abort decisions must happen before buffered events continue flowing.
@@ -244,6 +248,7 @@ export class Agent {
244
248
  #intentTracing: boolean;
245
249
  #getToolChoice?: () => ToolChoice | undefined;
246
250
  #onPayload?: SimpleStreamOptions["onPayload"];
251
+ #onResponse?: SimpleStreamOptions["onResponse"];
247
252
  #onAssistantMessageEvent?: (message: AssistantMessage, event: AssistantMessageEvent) => void;
248
253
 
249
254
  /** Buffered Cursor tool results with text length at time of call (for correct ordering) */
@@ -273,6 +278,7 @@ export class Agent {
273
278
  this.#maxRetryDelayMs = opts.maxRetryDelayMs;
274
279
  this.getApiKey = opts.getApiKey;
275
280
  this.#onPayload = opts.onPayload;
281
+ this.#onResponse = opts.onResponse;
276
282
  this.#getToolContext = opts.getToolContext;
277
283
  this.#cursorExecHandlers = opts.cursorExecHandlers;
278
284
  this.#cursorOnToolResult = opts.cursorOnToolResult;
@@ -762,6 +768,7 @@ export class Agent {
762
768
  convertToLlm: this.#convertToLlm,
763
769
  transformContext: this.#transformContext,
764
770
  onPayload: this.#onPayload,
771
+ onResponse: this.#onResponse,
765
772
  getApiKey: this.getApiKey,
766
773
  getToolContext: this.#getToolContext,
767
774
  syncContextBeforeModelCall: async context => {