@oh-my-pi/pi-agent-core 18.0.11 → 18.1.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 +12 -12
- package/src/agent-loop.ts +1 -1
- package/src/compaction/compaction-v2-streaming.ts +2 -4
- package/src/compaction/compaction.ts +1 -1
- package/src/compaction/openai.ts +3 -3
- package/src/compaction/pruning.ts +1 -0
- package/src/compaction/shake.ts +1 -0
- package/src/types.ts +5 -2
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": "18.0
|
|
4
|
+
"version": "18.1.0",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Stencil Labs, Inc.",
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
"main": "./src/index.ts",
|
|
28
28
|
"types": "./dist/types/index.d.ts",
|
|
29
29
|
"scripts": {
|
|
30
|
-
"check": "
|
|
30
|
+
"check": "oxlint . && oxfmt --check --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts' && bun run check:types",
|
|
31
31
|
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
32
|
-
"lint": "
|
|
32
|
+
"lint": "oxlint .",
|
|
33
33
|
"test": "bun test --parallel",
|
|
34
|
-
"fix": "
|
|
35
|
-
"fmt": "
|
|
34
|
+
"fix": "oxlint --fix --fix-suggestions . && bun run fmt",
|
|
35
|
+
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oh-my-pi/pi-ai": "18.0
|
|
39
|
-
"@oh-my-pi/pi-catalog": "18.0
|
|
40
|
-
"@oh-my-pi/pi-natives": "18.0
|
|
41
|
-
"@oh-my-pi/pi-utils": "18.0
|
|
42
|
-
"@oh-my-pi/pi-wire": "18.0
|
|
43
|
-
"@oh-my-pi/snapcompact": "18.0
|
|
38
|
+
"@oh-my-pi/pi-ai": "18.1.0",
|
|
39
|
+
"@oh-my-pi/pi-catalog": "18.1.0",
|
|
40
|
+
"@oh-my-pi/pi-natives": "18.1.0",
|
|
41
|
+
"@oh-my-pi/pi-utils": "18.1.0",
|
|
42
|
+
"@oh-my-pi/pi-wire": "18.1.0",
|
|
43
|
+
"@oh-my-pi/snapcompact": "18.1.0",
|
|
44
44
|
"@opentelemetry/api": "^1.9.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@oh-my-pi/omptype": "18.0
|
|
47
|
+
"@oh-my-pi/omptype": "18.1.0",
|
|
48
48
|
"@opentelemetry/context-async-hooks": "^2.9.0",
|
|
49
49
|
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
50
50
|
"@types/bun": "^1.3.14"
|
package/src/agent-loop.ts
CHANGED
|
@@ -768,7 +768,7 @@ function createDetailedCapture(config: AgentLoopConfig): {
|
|
|
768
768
|
const wired: AgentLoopConfig = {
|
|
769
769
|
...config,
|
|
770
770
|
telemetry: {
|
|
771
|
-
...
|
|
771
|
+
...config.telemetry,
|
|
772
772
|
onRunEnd: (summary, coverage) => {
|
|
773
773
|
captured = { summary, coverage };
|
|
774
774
|
userHook?.(summary, coverage);
|
|
@@ -324,9 +324,7 @@ async function attemptCompactionV2Streaming(
|
|
|
324
324
|
...(request.reasoning || model.useResponsesLite
|
|
325
325
|
? {
|
|
326
326
|
// Lite implies gpt-5.4+, where codex-rs sends `all_turns` replay.
|
|
327
|
-
reasoning: model.useResponsesLite
|
|
328
|
-
? { ...(request.reasoning ?? {}), context: "all_turns" }
|
|
329
|
-
: request.reasoning,
|
|
327
|
+
reasoning: model.useResponsesLite ? { ...request.reasoning, context: "all_turns" } : request.reasoning,
|
|
330
328
|
include: ["reasoning.encrypted_content"],
|
|
331
329
|
}
|
|
332
330
|
: {}),
|
|
@@ -403,7 +401,7 @@ function buildCompactionV2Headers(
|
|
|
403
401
|
? {
|
|
404
402
|
"content-type": "application/json",
|
|
405
403
|
"api-key": apiKey,
|
|
406
|
-
...
|
|
404
|
+
...model.headers,
|
|
407
405
|
}
|
|
408
406
|
: {
|
|
409
407
|
"content-type": "application/json",
|
|
@@ -1644,7 +1644,7 @@ export async function compact(
|
|
|
1644
1644
|
}),
|
|
1645
1645
|
{ signal },
|
|
1646
1646
|
);
|
|
1647
|
-
preserveData = { ...
|
|
1647
|
+
preserveData = { ...preserveData, ...storeCompactionV2PreserveData(remote, model) };
|
|
1648
1648
|
usedRemoteCompaction = true;
|
|
1649
1649
|
} catch (err) {
|
|
1650
1650
|
// A user/session abort is a cancellation, not a remote failure —
|
package/src/compaction/openai.ts
CHANGED
|
@@ -390,7 +390,7 @@ export function withOpenAiRemoteCompactionPreserveData(
|
|
|
390
390
|
): Record<string, unknown> | undefined {
|
|
391
391
|
if (remoteCompaction) {
|
|
392
392
|
return {
|
|
393
|
-
...
|
|
393
|
+
...preserveData,
|
|
394
394
|
[OPENAI_REMOTE_COMPACTION_PRESERVE_KEY]: remoteCompaction,
|
|
395
395
|
};
|
|
396
396
|
}
|
|
@@ -803,12 +803,12 @@ export async function requestOpenAiRemoteCompaction(
|
|
|
803
803
|
? {
|
|
804
804
|
"content-type": "application/json",
|
|
805
805
|
"api-key": apiKey,
|
|
806
|
-
...
|
|
806
|
+
...model.headers,
|
|
807
807
|
}
|
|
808
808
|
: {
|
|
809
809
|
"content-type": "application/json",
|
|
810
810
|
Authorization: `Bearer ${apiKey}`,
|
|
811
|
-
...
|
|
811
|
+
...model.headers,
|
|
812
812
|
};
|
|
813
813
|
|
|
814
814
|
// Codex endpoints require additional auth headers
|
|
@@ -141,6 +141,7 @@ function estimatePrunedSavings(tokens: number, notice: string): number {
|
|
|
141
141
|
* mutations inside the cheap-to-recache tail.
|
|
142
142
|
*/
|
|
143
143
|
function computeMessageSuffixTokens(entries: readonly SessionEntry[], tokenizer: Tokenizer): number[] {
|
|
144
|
+
// oxlint-disable-next-line unicorn/no-new-array -- length preallocation
|
|
144
145
|
const suffix = new Array<number>(entries.length);
|
|
145
146
|
let accumulated = 0;
|
|
146
147
|
for (let i = entries.length - 1; i >= 0; i--) {
|
package/src/compaction/shake.ts
CHANGED
|
@@ -318,6 +318,7 @@ export function collectShakeRegions(entries: SessionEntry[], tokenizer: Tokenize
|
|
|
318
318
|
if (n === 0) return [];
|
|
319
319
|
|
|
320
320
|
// Tokens of all entries strictly more recent than index i.
|
|
321
|
+
// oxlint-disable-next-line unicorn/no-new-array -- length preallocation
|
|
321
322
|
const accumulatedAfter = new Array<number>(n);
|
|
322
323
|
let acc = 0;
|
|
323
324
|
for (let i = n - 1; i >= 0; i--) {
|
package/src/types.ts
CHANGED
|
@@ -759,8 +759,11 @@ export type AgentToolExecFn<TParameters extends TSchema = TSchema, TDetails = an
|
|
|
759
759
|
) => Promise<AgentToolResult<TDetails, TParameters>>;
|
|
760
760
|
|
|
761
761
|
// AgentTool extends Tool but adds the execute function
|
|
762
|
-
export interface AgentTool<
|
|
763
|
-
extends
|
|
762
|
+
export interface AgentTool<
|
|
763
|
+
TParameters extends TSchema = TSchema,
|
|
764
|
+
TDetails = any,
|
|
765
|
+
TTheme = unknown,
|
|
766
|
+
> extends Tool<TParameters> {
|
|
764
767
|
// A human-readable label for the tool to be displayed in UI
|
|
765
768
|
label: string;
|
|
766
769
|
/** If true, tool is excluded unless explicitly listed in --tools or agent's tools field */
|