@gajae-code/agent-core 0.11.11 → 0.12.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/CHANGELOG.md +4 -0
- package/dist/types/compaction/openai.d.ts +2 -0
- package/package.json +4 -4
- package/src/agent.ts +3 -0
- package/src/compaction/openai.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.12.0] - 2026-07-28
|
|
6
|
+
|
|
5
7
|
## [0.11.11] - 2026-07-26
|
|
6
8
|
|
|
7
9
|
### Fixed
|
|
8
10
|
|
|
11
|
+
- Managed runs now release their logical-run ownership before terminal observers are notified, so terminal overflow recovery cannot leave a stale owner behind.
|
|
12
|
+
- The OpenAI remote-compaction endpoint is now resolved from trusted environment sources only. `OPENAI_BASE_URL` was read through the merged view that includes the caller's `cwd/.env`, so a repository could redirect compaction requests that carry the OpenAI credential; it now uses the non-project resolver, leaving shell and user-level configuration unchanged.
|
|
9
13
|
- Repeated malformed tool calls now get one tool-free recovery response, preventing argument-validation loops from ending without an answer while leaving ordinary execution-error retries unchanged. The recovery turn commits its assistant to the durable context, forces `toolChoice: "none"` alongside an empty tool list without consuming a queued tool choice, and never executes a tool call it did not advertise. Its recovery prompt is request-only, so append-only tool prefixes stay stable and the durable message log is unchanged.
|
|
10
14
|
- Argument-validation loops now reach a deterministic terminal state. If a model keeps emitting only malformed tool calls after the one-shot recovery turn, the run stops with an explanatory error instead of calling the provider indefinitely. The bound counts consecutive all-malformed turns rather than repeated argument signatures, so a model rotating invalid argument shapes is bounded too; any healthy tool turn resets it.
|
|
11
15
|
|
|
@@ -39,6 +39,8 @@ export interface RemoteCompactionResponse {
|
|
|
39
39
|
shortSummary?: string;
|
|
40
40
|
}
|
|
41
41
|
export declare function shouldUseOpenAiRemoteCompaction(model: Model): boolean;
|
|
42
|
+
/** Test seam: the compaction endpoint as resolved from trusted env. */
|
|
43
|
+
export declare function resolveOpenAiCompactEndpointForTest(model: Model, authCredentialType?: "api_key" | "oauth"): string;
|
|
42
44
|
export declare function getPreservedOpenAiRemoteCompactionData(preserveData: Record<string, unknown> | undefined): OpenAiRemoteCompactionPreserveData | undefined;
|
|
43
45
|
export declare function withOpenAiRemoteCompactionPreserveData(preserveData: Record<string, unknown> | undefined, remoteCompaction: OpenAiRemoteCompactionPreserveData | undefined): Record<string, unknown> | undefined;
|
|
44
46
|
export declare function estimateOpenAiCompactInputTokens(input: Array<Record<string, unknown>>, instructions: string): number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/agent-core",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://gajae-code.com",
|
|
7
7
|
"author": "Yeachan-Heo and Gajae Code Contributors",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"fmt": "biome format --write ."
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@gajae-code/ai": "0.
|
|
36
|
-
"@gajae-code/natives": "0.
|
|
37
|
-
"@gajae-code/utils": "0.
|
|
35
|
+
"@gajae-code/ai": "0.12.0",
|
|
36
|
+
"@gajae-code/natives": "0.12.0",
|
|
37
|
+
"@gajae-code/utils": "0.12.0",
|
|
38
38
|
"@opentelemetry/api": "^1.9.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
package/src/agent.ts
CHANGED
|
@@ -1196,6 +1196,9 @@ export class Agent {
|
|
|
1196
1196
|
*/
|
|
1197
1197
|
requestRunTerminal(logicalRunId: ManagedLogicalRunId, request: RunTerminalRequest): boolean {
|
|
1198
1198
|
if (this.#terminalizedLogicalRunIds.has(logicalRunId)) return false;
|
|
1199
|
+
if (this.#managedLogicalRunOwner === logicalRunId) {
|
|
1200
|
+
this.#managedLogicalRunOwner = undefined;
|
|
1201
|
+
}
|
|
1199
1202
|
this.#finalizeRun(
|
|
1200
1203
|
logicalRunId,
|
|
1201
1204
|
{
|
package/src/compaction/openai.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
neutralizeResponsesInputControlTokens,
|
|
29
29
|
normalizeResponsesToolCallId,
|
|
30
30
|
} from "@gajae-code/ai/utils";
|
|
31
|
-
import { $
|
|
31
|
+
import { $credentialEnv, logger } from "@gajae-code/utils";
|
|
32
32
|
|
|
33
33
|
const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
|
34
34
|
|
|
@@ -81,7 +81,8 @@ function resolveOpenAiCompactEndpoint(model: Model, authCredentialType?: "api_ke
|
|
|
81
81
|
return resolveOpenAiCodexCompactEndpoint(model.baseUrl);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
// Trusted sources only: the compaction endpoint carries the OpenAI credential.
|
|
85
|
+
const envBaseUrl = $credentialEnv("OPENAI_BASE_URL");
|
|
85
86
|
const configuredBaseUrl = model.baseUrl?.trim();
|
|
86
87
|
const rawBase =
|
|
87
88
|
authCredentialType === "oauth"
|
|
@@ -94,6 +95,11 @@ function resolveOpenAiCompactEndpoint(model: Model, authCredentialType?: "api_ke
|
|
|
94
95
|
return `${normalizedBase}/v1/responses/compact`;
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
/** Test seam: the compaction endpoint as resolved from trusted env. */
|
|
99
|
+
export function resolveOpenAiCompactEndpointForTest(model: Model, authCredentialType?: "api_key" | "oauth"): string {
|
|
100
|
+
return resolveOpenAiCompactEndpoint(model, authCredentialType);
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
function resolveOpenAiCodexCompactEndpoint(baseUrl: string | undefined): string {
|
|
98
104
|
const rawBase = baseUrl && baseUrl.length > 0 ? baseUrl : CODEX_BASE_URL;
|
|
99
105
|
const normalizedBase = rawBase.endsWith("/") ? rawBase.slice(0, -1) : rawBase;
|