@oh-my-pi/pi-agent-core 11.2.2 → 11.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-agent-core",
3
- "version": "11.2.2",
3
+ "version": "11.3.0",
4
4
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -24,9 +24,9 @@
24
24
  "test": "bun test"
25
25
  },
26
26
  "dependencies": {
27
- "@oh-my-pi/pi-ai": "11.2.2",
28
- "@oh-my-pi/pi-tui": "11.2.2",
29
- "@oh-my-pi/pi-utils": "11.2.2"
27
+ "@oh-my-pi/pi-ai": "11.3.0",
28
+ "@oh-my-pi/pi-tui": "11.3.0",
29
+ "@oh-my-pi/pi-utils": "11.3.0"
30
30
  },
31
31
  "keywords": [
32
32
  "ai",
package/src/agent.ts CHANGED
@@ -96,6 +96,14 @@ export interface AgentOptions {
96
96
  */
97
97
  thinkingBudgets?: ThinkingBudgets;
98
98
 
99
+ /**
100
+ * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
101
+ * If the server's requested delay exceeds this value, the request fails immediately,
102
+ * allowing higher-level retry logic to handle it with user visibility.
103
+ * Default: 60000 (60 seconds). Set to 0 to disable the cap.
104
+ */
105
+ maxRetryDelayMs?: number;
106
+
99
107
  /**
100
108
  * Provides tool execution context, resolved per tool call.
101
109
  * Use for late-bound UI or session state access.
@@ -148,6 +156,7 @@ export class Agent {
148
156
  public streamFn: StreamFn;
149
157
  private _sessionId?: string;
150
158
  private _thinkingBudgets?: ThinkingBudgets;
159
+ private _maxRetryDelayMs?: number;
151
160
  public getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
152
161
  private getToolContext?: (toolCall?: ToolCallContext) => AgentToolContext | undefined;
153
162
  private cursorExecHandlers?: CursorExecHandlers;
@@ -169,6 +178,7 @@ export class Agent {
169
178
  this.streamFn = opts.streamFn || streamSimple;
170
179
  this._sessionId = opts.sessionId;
171
180
  this._thinkingBudgets = opts.thinkingBudgets;
181
+ this._maxRetryDelayMs = opts.maxRetryDelayMs;
172
182
  this.getApiKey = opts.getApiKey;
173
183
  this.getToolContext = opts.getToolContext;
174
184
  this.cursorExecHandlers = opts.cursorExecHandlers;
@@ -205,6 +215,21 @@ export class Agent {
205
215
  this._thinkingBudgets = value;
206
216
  }
207
217
 
218
+ /**
219
+ * Get the current max retry delay in milliseconds.
220
+ */
221
+ get maxRetryDelayMs(): number | undefined {
222
+ return this._maxRetryDelayMs;
223
+ }
224
+
225
+ /**
226
+ * Set the maximum delay to wait for server-requested retries.
227
+ * Set to 0 to disable the cap.
228
+ */
229
+ set maxRetryDelayMs(value: number | undefined) {
230
+ this._maxRetryDelayMs = value;
231
+ }
232
+
208
233
  get state(): AgentState {
209
234
  return this._state;
210
235
  }
@@ -493,6 +518,7 @@ export class Agent {
493
518
  interruptMode: this.interruptMode,
494
519
  sessionId: this._sessionId,
495
520
  thinkingBudgets: this._thinkingBudgets,
521
+ maxRetryDelayMs: this._maxRetryDelayMs,
496
522
  kimiApiFormat: this.kimiApiFormat,
497
523
  toolChoice: options?.toolChoice,
498
524
  convertToLlm: this.convertToLlm,
package/src/types.ts CHANGED
@@ -121,7 +121,7 @@ export interface ToolCallContext {
121
121
 
122
122
  /**
123
123
  * Thinking/reasoning level for models that support it.
124
- * Note: "xhigh" is only supported by OpenAI gpt-5.1-codex-max, gpt-5.2, and gpt-5.2-codex models.
124
+ * Note: "xhigh" is only supported by OpenAI gpt-5.1-codex-max, gpt-5.2, gpt-5.2-codex, gpt-5.3, and gpt-5.3-codex models.
125
125
  */
126
126
  export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
127
127