@oh-my-pi/pi-agent-core 15.8.2 → 15.9.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
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [15.8.3] - 2026-06-03
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
- Added `getReadToolPath(context)` to `@oh-my-pi/pi-agent-core/compaction/tool-protection` to extract a paired `read` tool call's `path` for embedders building read-targeted protection matchers
|
|
9
|
+
- Added `getReadToolPath(context)` to `@oh-my-pi/pi-agent-core/compaction/tool-protection`: the shared primitive that extracts a paired `read` tool call's `path` argument, so embedders can build their own read-targeted compaction protection matchers (e.g. plan-file reads) the same way `isSkillReadToolResult` does.
|
|
10
|
+
|
|
5
11
|
## [15.8.2] - 2026-06-03
|
|
6
12
|
|
|
7
13
|
### Added
|
|
@@ -561,4 +567,4 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
|
|
|
561
567
|
|
|
562
568
|
- `Agent` constructor now has all options optional (empty options use defaults).
|
|
563
569
|
|
|
564
|
-
- `queueMessage()` is now synchronous (no longer returns a Promise).
|
|
570
|
+
- `queueMessage()` is now synchronous (no longer returns a Promise).
|
|
@@ -7,5 +7,11 @@ export interface ProtectedToolContext {
|
|
|
7
7
|
}
|
|
8
8
|
export type ProtectedToolMatcher = string | ((context: ProtectedToolContext) => boolean);
|
|
9
9
|
export declare function collectToolCallsById(entries: readonly SessionEntry[]): Map<string, AgentToolCall>;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Extract the `path` argument from a paired `read` tool call, when the result
|
|
12
|
+
* is a `read` result carrying a string path. Returns `undefined` otherwise.
|
|
13
|
+
* Shared primitive for read-targeted protection matchers (skills, plans, …).
|
|
14
|
+
*/
|
|
15
|
+
export declare function getReadToolPath({ toolResult, toolCall }: ProtectedToolContext): string | undefined;
|
|
16
|
+
export declare function isSkillReadToolResult(context: ProtectedToolContext): boolean;
|
|
11
17
|
export declare function isProtectedToolResult(toolResult: ToolResultMessage, toolCall: AgentToolCall | undefined, matchers: readonly ProtectedToolMatcher[]): boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -366,7 +366,7 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any
|
|
|
366
366
|
* Controls how the INTENT_FIELD (`_i`) is handled for this tool.
|
|
367
367
|
* - `"require"` (default): `_i` is injected and required in the parameter schema.
|
|
368
368
|
* - `"optional"`: `_i` is injected as an optional/nullable field.
|
|
369
|
-
* - `"omit"`: `_i` is NOT injected. Use for tools where intent is obvious (yield, resolve,
|
|
369
|
+
* - `"omit"`: `_i` is NOT injected. Use for tools where intent is obvious (yield, resolve, todo, …).
|
|
370
370
|
* - function: `_i` is NOT injected; intent is derived dynamically from (potentially partial / streaming) args.
|
|
371
371
|
*/
|
|
372
372
|
intent?: "omit" | "optional" | "require" | ((args: Partial<Static<TParameters>>) => string | undefined);
|
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": "15.
|
|
4
|
+
"version": "15.9.0",
|
|
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,9 +35,9 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oh-my-pi/pi-ai": "15.
|
|
39
|
-
"@oh-my-pi/pi-natives": "15.
|
|
40
|
-
"@oh-my-pi/pi-utils": "15.
|
|
38
|
+
"@oh-my-pi/pi-ai": "15.9.0",
|
|
39
|
+
"@oh-my-pi/pi-natives": "15.9.0",
|
|
40
|
+
"@oh-my-pi/pi-utils": "15.9.0",
|
|
41
41
|
"@opentelemetry/api": "^1.9.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -24,10 +24,19 @@ export function collectToolCallsById(entries: readonly SessionEntry[]): Map<stri
|
|
|
24
24
|
return toolCalls;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Extract the `path` argument from a paired `read` tool call, when the result
|
|
29
|
+
* is a `read` result carrying a string path. Returns `undefined` otherwise.
|
|
30
|
+
* Shared primitive for read-targeted protection matchers (skills, plans, …).
|
|
31
|
+
*/
|
|
32
|
+
export function getReadToolPath({ toolResult, toolCall }: ProtectedToolContext): string | undefined {
|
|
33
|
+
if (toolResult.toolName !== "read" || toolCall?.name !== "read") return undefined;
|
|
29
34
|
const path = (toolCall.arguments as Record<string, unknown>).path;
|
|
30
|
-
return typeof path === "string"
|
|
35
|
+
return typeof path === "string" ? path : undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function isSkillReadToolResult(context: ProtectedToolContext): boolean {
|
|
39
|
+
return getReadToolPath(context)?.startsWith(SKILL_INTERNAL_URL_PREFIX) ?? false;
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
export function isProtectedToolResult(
|
package/src/types.ts
CHANGED
|
@@ -436,7 +436,7 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any
|
|
|
436
436
|
* Controls how the INTENT_FIELD (`_i`) is handled for this tool.
|
|
437
437
|
* - `"require"` (default): `_i` is injected and required in the parameter schema.
|
|
438
438
|
* - `"optional"`: `_i` is injected as an optional/nullable field.
|
|
439
|
-
* - `"omit"`: `_i` is NOT injected. Use for tools where intent is obvious (yield, resolve,
|
|
439
|
+
* - `"omit"`: `_i` is NOT injected. Use for tools where intent is obvious (yield, resolve, todo, …).
|
|
440
440
|
* - function: `_i` is NOT injected; intent is derived dynamically from (potentially partial / streaming) args.
|
|
441
441
|
*/
|
|
442
442
|
intent?: "omit" | "optional" | "require" | ((args: Partial<Static<TParameters>>) => string | undefined);
|