@oh-my-pi/pi-agent-core 16.4.0 → 16.4.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,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [16.4.2] - 2026-07-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed serialization of BigInt tool arguments to prevent data loss during remote compaction.
|
|
10
|
+
|
|
11
|
+
## [16.4.1] - 2026-07-10
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Enabled reasoning encryption content for all Responses Lite compaction requests
|
|
16
|
+
|
|
5
17
|
## [16.4.0] - 2026-07-10
|
|
6
18
|
|
|
7
19
|
### Added
|
|
@@ -40,6 +40,11 @@ export interface OpenAiRemoteCompactionRequest {
|
|
|
40
40
|
model: string;
|
|
41
41
|
input: Array<Record<string, unknown>>;
|
|
42
42
|
instructions: string;
|
|
43
|
+
reasoning?: {
|
|
44
|
+
context?: string;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
include?: string[];
|
|
43
48
|
}
|
|
44
49
|
export interface OpenAiRemoteCompactionResponse extends OpenAiRemoteCompactionPreserveData {
|
|
45
50
|
}
|
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": "16.4.
|
|
4
|
+
"version": "16.4.2",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oh-my-pi/pi-ai": "16.4.
|
|
39
|
-
"@oh-my-pi/pi-catalog": "16.4.
|
|
40
|
-
"@oh-my-pi/pi-natives": "16.4.
|
|
41
|
-
"@oh-my-pi/pi-utils": "16.4.
|
|
42
|
-
"@oh-my-pi/pi-wire": "16.4.
|
|
43
|
-
"@oh-my-pi/snapcompact": "16.4.
|
|
38
|
+
"@oh-my-pi/pi-ai": "16.4.2",
|
|
39
|
+
"@oh-my-pi/pi-catalog": "16.4.2",
|
|
40
|
+
"@oh-my-pi/pi-natives": "16.4.2",
|
|
41
|
+
"@oh-my-pi/pi-utils": "16.4.2",
|
|
42
|
+
"@oh-my-pi/pi-wire": "16.4.2",
|
|
43
|
+
"@oh-my-pi/snapcompact": "16.4.2",
|
|
44
44
|
"@opentelemetry/api": "^1.9.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
OPENAI_HEADER_VALUES,
|
|
28
28
|
OPENAI_HEADERS,
|
|
29
29
|
} from "@oh-my-pi/pi-catalog/wire/codex";
|
|
30
|
-
import { $env, logger } from "@oh-my-pi/pi-utils";
|
|
30
|
+
import { $env, logger, stringifyJson } from "@oh-my-pi/pi-utils";
|
|
31
31
|
|
|
32
32
|
// ============================================================================
|
|
33
33
|
// Types & Configuration
|
|
@@ -305,10 +305,12 @@ async function attemptCompactionV2Streaming(
|
|
|
305
305
|
instructions: request.instructions,
|
|
306
306
|
stream: true,
|
|
307
307
|
store: false,
|
|
308
|
-
...(request.reasoning
|
|
308
|
+
...(request.reasoning || model.useResponsesLite
|
|
309
309
|
? {
|
|
310
310
|
// Lite implies gpt-5.4+, where codex-rs sends `all_turns` replay.
|
|
311
|
-
reasoning: model.useResponsesLite
|
|
311
|
+
reasoning: model.useResponsesLite
|
|
312
|
+
? { ...(request.reasoning ?? {}), context: "all_turns" }
|
|
313
|
+
: request.reasoning,
|
|
312
314
|
include: ["reasoning.encrypted_content"],
|
|
313
315
|
}
|
|
314
316
|
: {}),
|
|
@@ -327,7 +329,7 @@ async function attemptCompactionV2Streaming(
|
|
|
327
329
|
const response = await fetchImpl(endpoint, {
|
|
328
330
|
method: "POST",
|
|
329
331
|
headers: buildCompactionV2Headers(model, apiKey, request, codexMetadata),
|
|
330
|
-
body:
|
|
332
|
+
body: stringifyJson(body),
|
|
331
333
|
signal,
|
|
332
334
|
});
|
|
333
335
|
|
|
@@ -28,7 +28,7 @@ import { convertTools } from "@oh-my-pi/pi-ai/providers/openai-responses";
|
|
|
28
28
|
import { buildResponsesInput, resolveOpenAICompatPolicy } from "@oh-my-pi/pi-ai/providers/openai-shared";
|
|
29
29
|
import { preferredDialect } from "@oh-my-pi/pi-catalog/identity";
|
|
30
30
|
import { clampThinkingLevelForModel } from "@oh-my-pi/pi-catalog/model-thinking";
|
|
31
|
-
import { logger, prompt } from "@oh-my-pi/pi-utils";
|
|
31
|
+
import { logger, prompt, stringifyJson } from "@oh-my-pi/pi-utils";
|
|
32
32
|
import * as snapcompact from "@oh-my-pi/snapcompact";
|
|
33
33
|
import { type AgentTelemetry, instrumentedCompleteSimple } from "../telemetry";
|
|
34
34
|
import { ThinkingLevel } from "../thinking";
|
|
@@ -406,7 +406,7 @@ export function estimateTokens(message: AgentMessage, options?: { excludeEncrypt
|
|
|
406
406
|
}
|
|
407
407
|
} else if (block.type === "toolCall") {
|
|
408
408
|
fragments.push(block.name);
|
|
409
|
-
fragments.push(
|
|
409
|
+
fragments.push(stringifyJson(block.arguments) ?? "null");
|
|
410
410
|
} else if (block.type === "redactedThinking") {
|
|
411
411
|
// Encrypted reasoning blob the provider still bills for on replay;
|
|
412
412
|
// excluded from the compaction floor for the same reason as above.
|
package/src/compaction/openai.ts
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
OPENAI_HEADER_VALUES,
|
|
44
44
|
OPENAI_HEADERS,
|
|
45
45
|
} from "@oh-my-pi/pi-catalog/wire/codex";
|
|
46
|
-
import { $env, logger } from "@oh-my-pi/pi-utils";
|
|
46
|
+
import { $env, logger, stringifyJson } from "@oh-my-pi/pi-utils";
|
|
47
47
|
|
|
48
48
|
export * from "./compaction-v2-streaming";
|
|
49
49
|
|
|
@@ -88,6 +88,11 @@ export interface OpenAiRemoteCompactionRequest {
|
|
|
88
88
|
model: string;
|
|
89
89
|
input: Array<Record<string, unknown>>;
|
|
90
90
|
instructions: string;
|
|
91
|
+
reasoning?: {
|
|
92
|
+
context?: string;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
};
|
|
95
|
+
include?: string[];
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
export interface OpenAiRemoteCompactionResponse extends OpenAiRemoteCompactionPreserveData {}
|
|
@@ -414,7 +419,7 @@ export function buildOpenAiNativeHistory(
|
|
|
414
419
|
id: itemId,
|
|
415
420
|
call_id: normalized.callId,
|
|
416
421
|
name: block.name,
|
|
417
|
-
arguments:
|
|
422
|
+
arguments: stringifyJson(block.arguments) ?? "null",
|
|
418
423
|
});
|
|
419
424
|
}
|
|
420
425
|
}
|
|
@@ -533,13 +538,18 @@ export async function requestOpenAiRemoteCompaction(
|
|
|
533
538
|
if (model.useResponsesLite) {
|
|
534
539
|
applyCodexResponsesLiteShape(request);
|
|
535
540
|
headers[OPENAI_HEADERS.RESPONSES_LITE] = "true";
|
|
541
|
+
request.reasoning = {
|
|
542
|
+
...request.reasoning,
|
|
543
|
+
context: "all_turns",
|
|
544
|
+
};
|
|
545
|
+
request.include = Array.from(new Set([...(request.include ?? []), "reasoning.encrypted_content"]));
|
|
536
546
|
}
|
|
537
547
|
}
|
|
538
548
|
|
|
539
549
|
const response = await (opts?.fetch ?? fetch)(endpoint, {
|
|
540
550
|
method: "POST",
|
|
541
551
|
headers,
|
|
542
|
-
body:
|
|
552
|
+
body: stringifyJson(request),
|
|
543
553
|
signal: withRequestTimeout(signal, opts?.timeoutMs ?? REMOTE_COMPACTION_TIMEOUT_MS),
|
|
544
554
|
});
|
|
545
555
|
|
|
@@ -636,7 +646,7 @@ export async function requestRemoteCompaction(
|
|
|
636
646
|
const response = await (opts?.fetch ?? fetch)(endpoint, {
|
|
637
647
|
method: "POST",
|
|
638
648
|
headers,
|
|
639
|
-
body:
|
|
649
|
+
body: stringifyJson(body),
|
|
640
650
|
signal: withRequestTimeout(signal, opts?.timeoutMs ?? REMOTE_COMPACTION_TIMEOUT_MS),
|
|
641
651
|
});
|
|
642
652
|
|
package/src/compaction/utils.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { Message, ToolCall } from "@oh-my-pi/pi-ai";
|
|
6
6
|
import { type Dialect, getDialectDefinition } from "@oh-my-pi/pi-ai/dialect";
|
|
7
|
-
import { formatGroupedPaths, prompt } from "@oh-my-pi/pi-utils";
|
|
7
|
+
import { formatGroupedPaths, prompt, stringifyJson } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import type { AgentMessage } from "../types";
|
|
9
9
|
import fileOperationsTemplate from "./prompts/file-operations.md" with { type: "text" };
|
|
10
10
|
import summarizationSystemPrompt from "./prompts/summarization-system.md" with { type: "text" };
|
|
@@ -309,7 +309,7 @@ function renderToolCalls(calls: ToolCall[]): string {
|
|
|
309
309
|
return calls
|
|
310
310
|
.map(call => {
|
|
311
311
|
const argsStr = Object.entries(call.arguments as Record<string, unknown>)
|
|
312
|
-
.map(([k, v]) => `${k}=${
|
|
312
|
+
.map(([k, v]) => `${k}=${stringifyJson(v) ?? "null"}`)
|
|
313
313
|
.join(", ");
|
|
314
314
|
return `${call.name}(${argsStr})`;
|
|
315
315
|
})
|