@oh-my-pi/pi-agent-core 15.8.2 → 15.8.3

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
- export declare function isSkillReadToolResult({ toolResult, toolCall }: ProtectedToolContext): boolean;
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/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.8.2",
4
+ "version": "15.8.3",
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.8.2",
39
- "@oh-my-pi/pi-natives": "15.8.2",
40
- "@oh-my-pi/pi-utils": "15.8.2",
38
+ "@oh-my-pi/pi-ai": "15.8.3",
39
+ "@oh-my-pi/pi-natives": "15.8.3",
40
+ "@oh-my-pi/pi-utils": "15.8.3",
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
- export function isSkillReadToolResult({ toolResult, toolCall }: ProtectedToolContext): boolean {
28
- if (toolResult.toolName !== "read" || toolCall?.name !== "read") return false;
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" && path.startsWith(SKILL_INTERNAL_URL_PREFIX);
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(