@oh-my-pi/pi-agent-core 13.3.0 → 13.3.2

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
+ ## [13.3.1] - 2026-02-26
6
+ ### Added
7
+
8
+ - Added `topP`, `topK`, `minP`, `presencePenalty`, and `repetitionPenalty` options to `AgentOptions` for fine-grained sampling control
9
+ - Added getter and setter properties for sampling parameters on the `Agent` class to allow runtime configuration
10
+
5
11
  ## [13.1.0] - 2026-02-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": "13.3.0",
4
+ "version": "13.3.2",
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,9 +31,9 @@
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-ai": "13.3.0",
35
- "@oh-my-pi/pi-tui": "13.3.0",
36
- "@oh-my-pi/pi-utils": "13.3.0"
34
+ "@oh-my-pi/pi-ai": "13.3.2",
35
+ "@oh-my-pi/pi-tui": "13.3.2",
36
+ "@oh-my-pi/pi-utils": "13.3.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@sinclair/typebox": "^0.34",
package/src/agent.ts CHANGED
@@ -117,6 +117,13 @@ export interface AgentOptions {
117
117
  */
118
118
  temperature?: number;
119
119
 
120
+ /** Additional sampling controls for providers that support them. */
121
+ topP?: number;
122
+ topK?: number;
123
+ minP?: number;
124
+ presencePenalty?: number;
125
+ repetitionPenalty?: number;
126
+
120
127
  /**
121
128
  * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
122
129
  * If the server's requested delay exceeds this value, the request fails immediately,
@@ -187,6 +194,11 @@ export class Agent {
187
194
  #providerSessionState?: Map<string, ProviderSessionState>;
188
195
  #thinkingBudgets?: ThinkingBudgets;
189
196
  #temperature?: number;
197
+ #topP?: number;
198
+ #topK?: number;
199
+ #minP?: number;
200
+ #presencePenalty?: number;
201
+ #repetitionPenalty?: number;
190
202
  #maxRetryDelayMs?: number;
191
203
  #getToolContext?: (toolCall?: ToolCallContext) => AgentToolContext | undefined;
192
204
  #cursorExecHandlers?: CursorExecHandlers;
@@ -216,6 +228,11 @@ export class Agent {
216
228
  this.#providerSessionState = opts.providerSessionState;
217
229
  this.#thinkingBudgets = opts.thinkingBudgets;
218
230
  this.#temperature = opts.temperature;
231
+ this.#topP = opts.topP;
232
+ this.#topK = opts.topK;
233
+ this.#minP = opts.minP;
234
+ this.#presencePenalty = opts.presencePenalty;
235
+ this.#repetitionPenalty = opts.repetitionPenalty;
219
236
  this.#maxRetryDelayMs = opts.maxRetryDelayMs;
220
237
  this.getApiKey = opts.getApiKey;
221
238
  this.#getToolContext = opts.getToolContext;
@@ -284,6 +301,46 @@ export class Agent {
284
301
  this.#temperature = value;
285
302
  }
286
303
 
304
+ get topP(): number | undefined {
305
+ return this.#topP;
306
+ }
307
+
308
+ set topP(value: number | undefined) {
309
+ this.#topP = value;
310
+ }
311
+
312
+ get topK(): number | undefined {
313
+ return this.#topK;
314
+ }
315
+
316
+ set topK(value: number | undefined) {
317
+ this.#topK = value;
318
+ }
319
+
320
+ get minP(): number | undefined {
321
+ return this.#minP;
322
+ }
323
+
324
+ set minP(value: number | undefined) {
325
+ this.#minP = value;
326
+ }
327
+
328
+ get presencePenalty(): number | undefined {
329
+ return this.#presencePenalty;
330
+ }
331
+
332
+ set presencePenalty(value: number | undefined) {
333
+ this.#presencePenalty = value;
334
+ }
335
+
336
+ get repetitionPenalty(): number | undefined {
337
+ return this.#repetitionPenalty;
338
+ }
339
+
340
+ set repetitionPenalty(value: number | undefined) {
341
+ this.#repetitionPenalty = value;
342
+ }
343
+
287
344
  /**
288
345
  * Get the current max retry delay in milliseconds.
289
346
  */
@@ -631,6 +688,11 @@ export class Agent {
631
688
  model,
632
689
  reasoning,
633
690
  temperature: this.#temperature,
691
+ topP: this.#topP,
692
+ topK: this.#topK,
693
+ minP: this.#minP,
694
+ presencePenalty: this.#presencePenalty,
695
+ repetitionPenalty: this.#repetitionPenalty,
634
696
  interruptMode: this.#interruptMode,
635
697
  sessionId: this.#sessionId,
636
698
  providerSessionState: this.#providerSessionState,
package/src/proxy.ts CHANGED
@@ -127,6 +127,11 @@ export function streamProxy(model: Model, context: Context, options: ProxyStream
127
127
  context,
128
128
  options: {
129
129
  temperature: options.temperature,
130
+ topP: options.topP,
131
+ topK: options.topK,
132
+ minP: options.minP,
133
+ presencePenalty: options.presencePenalty,
134
+ repetitionPenalty: options.repetitionPenalty,
130
135
  maxTokens: options.maxTokens,
131
136
  reasoning: options.reasoning,
132
137
  },