@gajae-code/agent-core 0.2.3 → 0.2.5
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 +6 -0
- package/dist/types/agent.d.ts +8 -0
- package/package.json +4 -4
- package/src/agent.ts +27 -1
- package/src/harmony-leak.ts +1 -1
package/CHANGELOG.md
CHANGED
package/dist/types/agent.d.ts
CHANGED
|
@@ -110,6 +110,10 @@ export interface AgentOptions {
|
|
|
110
110
|
* Default: 60000 (60 seconds). Set to 0 to disable the cap.
|
|
111
111
|
*/
|
|
112
112
|
maxRetryDelayMs?: number;
|
|
113
|
+
/** Provider request retry budget. Counts retries, not the initial attempt. */
|
|
114
|
+
requestMaxRetries?: number;
|
|
115
|
+
/** Provider stream replay retry budget. Counts retries, not the initial attempt. */
|
|
116
|
+
streamMaxRetries?: number;
|
|
113
117
|
/**
|
|
114
118
|
* Provides tool execution context, resolved per tool call.
|
|
115
119
|
* Use for late-bound UI or session state access.
|
|
@@ -273,6 +277,10 @@ export declare class Agent {
|
|
|
273
277
|
* Set to 0 to disable the cap.
|
|
274
278
|
*/
|
|
275
279
|
set maxRetryDelayMs(value: number | undefined);
|
|
280
|
+
get requestMaxRetries(): number | undefined;
|
|
281
|
+
set requestMaxRetries(value: number | undefined);
|
|
282
|
+
get streamMaxRetries(): number | undefined;
|
|
283
|
+
set streamMaxRetries(value: number | undefined);
|
|
276
284
|
get state(): AgentState;
|
|
277
285
|
get appendOnlyContext(): AppendOnlyContextManager | undefined;
|
|
278
286
|
setAppendOnlyContext(manager?: AppendOnlyContextManager): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/agent-core",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://gaebal-gajae.dev",
|
|
7
7
|
"author": "Yeachan-Heo",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@gajae-code/ai": "0.2.
|
|
39
|
-
"@gajae-code/natives": "0.2.
|
|
40
|
-
"@gajae-code/utils": "0.2.
|
|
38
|
+
"@gajae-code/ai": "0.2.5",
|
|
39
|
+
"@gajae-code/natives": "0.2.5",
|
|
40
|
+
"@gajae-code/utils": "0.2.5",
|
|
41
41
|
"@opentelemetry/api": "^1.9.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/src/agent.ts
CHANGED
|
@@ -185,6 +185,10 @@ export interface AgentOptions {
|
|
|
185
185
|
* Default: 60000 (60 seconds). Set to 0 to disable the cap.
|
|
186
186
|
*/
|
|
187
187
|
maxRetryDelayMs?: number;
|
|
188
|
+
/** Provider request retry budget. Counts retries, not the initial attempt. */
|
|
189
|
+
requestMaxRetries?: number;
|
|
190
|
+
/** Provider stream replay retry budget. Counts retries, not the initial attempt. */
|
|
191
|
+
streamMaxRetries?: number;
|
|
188
192
|
|
|
189
193
|
/**
|
|
190
194
|
* Provides tool execution context, resolved per tool call.
|
|
@@ -285,6 +289,8 @@ export class Agent {
|
|
|
285
289
|
#serviceTier?: ServiceTier;
|
|
286
290
|
#hideThinkingSummary?: boolean;
|
|
287
291
|
#maxRetryDelayMs?: number;
|
|
292
|
+
#requestMaxRetries?: number;
|
|
293
|
+
#streamMaxRetries?: number;
|
|
288
294
|
#getToolContext?: (toolCall?: ToolCallContext) => AgentToolContext | undefined;
|
|
289
295
|
#cursorExecHandlers?: CursorExecHandlers;
|
|
290
296
|
#cursorOnToolResult?: CursorToolResultHandler;
|
|
@@ -348,6 +354,8 @@ export class Agent {
|
|
|
348
354
|
this.#serviceTier = opts.serviceTier;
|
|
349
355
|
this.#hideThinkingSummary = opts.hideThinkingSummary;
|
|
350
356
|
this.#maxRetryDelayMs = opts.maxRetryDelayMs;
|
|
357
|
+
this.#requestMaxRetries = opts.requestMaxRetries;
|
|
358
|
+
this.#streamMaxRetries = opts.streamMaxRetries;
|
|
351
359
|
this.getApiKey = opts.getApiKey;
|
|
352
360
|
this.getAuthCredentialType = opts.getAuthCredentialType;
|
|
353
361
|
this.#onPayload = opts.onPayload;
|
|
@@ -566,6 +574,22 @@ export class Agent {
|
|
|
566
574
|
this.#maxRetryDelayMs = value;
|
|
567
575
|
}
|
|
568
576
|
|
|
577
|
+
get requestMaxRetries(): number | undefined {
|
|
578
|
+
return this.#requestMaxRetries;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
set requestMaxRetries(value: number | undefined) {
|
|
582
|
+
this.#requestMaxRetries = value;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
get streamMaxRetries(): number | undefined {
|
|
586
|
+
return this.#streamMaxRetries;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
set streamMaxRetries(value: number | undefined) {
|
|
590
|
+
this.#streamMaxRetries = value;
|
|
591
|
+
}
|
|
592
|
+
|
|
569
593
|
get state(): AgentState {
|
|
570
594
|
return this.#state;
|
|
571
595
|
}
|
|
@@ -1092,6 +1116,8 @@ export class Agent {
|
|
|
1092
1116
|
providerSessionState: this.#providerSessionState,
|
|
1093
1117
|
thinkingBudgets: this.#thinkingBudgets,
|
|
1094
1118
|
maxRetryDelayMs: this.#maxRetryDelayMs,
|
|
1119
|
+
requestMaxRetries: this.#requestMaxRetries,
|
|
1120
|
+
streamMaxRetries: this.#streamMaxRetries,
|
|
1095
1121
|
kimiApiFormat: this.#kimiApiFormat,
|
|
1096
1122
|
preferWebsockets: this.#preferWebsockets,
|
|
1097
1123
|
convertToLlm: this.#convertToLlm,
|
|
@@ -1308,7 +1334,7 @@ export class Agent {
|
|
|
1308
1334
|
|
|
1309
1335
|
/** Calculate total text length from an assistant message's content blocks */
|
|
1310
1336
|
#getAssistantTextLength(message: AgentMessage | null): number {
|
|
1311
|
-
if (
|
|
1337
|
+
if (message?.role !== "assistant" || !Array.isArray(message.content)) {
|
|
1312
1338
|
return 0;
|
|
1313
1339
|
}
|
|
1314
1340
|
let length = 0;
|
package/src/harmony-leak.ts
CHANGED
|
@@ -230,7 +230,7 @@ export function recoverHarmonyToolCall(
|
|
|
230
230
|
): HarmonyRecoveredToolCall | undefined {
|
|
231
231
|
if (detection.surface !== "tool_arg" || detection.contentIndex === undefined) return undefined;
|
|
232
232
|
const block = message.content[detection.contentIndex];
|
|
233
|
-
if (
|
|
233
|
+
if (block?.type !== "toolCall") return undefined;
|
|
234
234
|
|
|
235
235
|
const config = RECOVERY_REGISTRY[block.name];
|
|
236
236
|
if (!config) return undefined;
|