@oh-my-pi/pi-agent-core 13.9.14 → 13.9.16

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,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.9.16] - 2026-03-10
6
+ ### Added
7
+
8
+ - Added `onPayload` option to `AgentOptions` to inspect or replace provider payloads before they are sent
9
+
5
10
  ## [13.9.3] - 2026-03-07
6
11
 
7
12
  ### Added
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": "13.9.14",
4
+ "version": "13.9.16",
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",
@@ -31,8 +31,8 @@
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-ai": "13.9.14",
35
- "@oh-my-pi/pi-utils": "13.9.14"
34
+ "@oh-my-pi/pi-ai": "13.9.16",
35
+ "@oh-my-pi/pi-utils": "13.9.16"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@sinclair/typebox": "^0.34",
package/src/agent.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  type Model,
13
13
  type ProviderSessionState,
14
14
  type ServiceTier,
15
+ type SimpleStreamOptions,
15
16
  streamSimple,
16
17
  type TextContent,
17
18
  type ThinkingBudgets,
@@ -107,6 +108,11 @@ export interface AgentOptions {
107
108
  */
108
109
  getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
109
110
 
111
+ /**
112
+ * Inspect or replace provider payloads before they are sent.
113
+ */
114
+ onPayload?: SimpleStreamOptions["onPayload"];
115
+
110
116
  /**
111
117
  * Custom token budgets for thinking levels (token-based providers only).
112
118
  */
@@ -214,6 +220,7 @@ export class Agent {
214
220
  #transformToolCallArguments?: (args: Record<string, unknown>, toolName: string) => Record<string, unknown>;
215
221
  #intentTracing: boolean;
216
222
  #getToolChoice?: () => ToolChoice | undefined;
223
+ #onPayload?: SimpleStreamOptions["onPayload"];
217
224
 
218
225
  /** Buffered Cursor tool results with text length at time of call (for correct ordering) */
219
226
  #cursorToolResultBuffer: CursorToolResultEntry[] = [];
@@ -241,6 +248,7 @@ export class Agent {
241
248
  this.#serviceTier = opts.serviceTier;
242
249
  this.#maxRetryDelayMs = opts.maxRetryDelayMs;
243
250
  this.getApiKey = opts.getApiKey;
251
+ this.#onPayload = opts.onPayload;
244
252
  this.#getToolContext = opts.getToolContext;
245
253
  this.#cursorExecHandlers = opts.cursorExecHandlers;
246
254
  this.#cursorOnToolResult = opts.cursorOnToolResult;
@@ -719,6 +727,7 @@ export class Agent {
719
727
  toolChoice: options?.toolChoice,
720
728
  convertToLlm: this.#convertToLlm,
721
729
  transformContext: this.#transformContext,
730
+ onPayload: this.#onPayload,
722
731
  getApiKey: this.getApiKey,
723
732
  getToolContext: this.#getToolContext,
724
733
  cursorExecHandlers: this.#cursorExecHandlers,