@oh-my-pi/pi-agent-core 15.5.8 → 15.5.10

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.5.10] - 2026-05-28
6
+
7
+ ### Fixed
8
+
9
+ - Fixed compaction summarizer throws losing the provider's HTTP status. `generateSummary`, `generateHandoff`, `generateShortSummary`, and `generateTurnPrefixSummary` now route their `stopReason === "error"` throws through a `createSummarizationError` helper that copies `AssistantMessage.errorStatus` onto the thrown `Error` as `.status`, letting downstream consumers (e.g. `AgentSession.#isCompactionAuthFailure` in `@oh-my-pi/pi-coding-agent`) branch on real provider 401/403s without regex-scraping the message body.
10
+
5
11
  ## [15.5.0] - 2026-05-26
6
12
  ### Added
7
13
 
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.5.8",
4
+ "version": "15.5.10",
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.5.8",
39
- "@oh-my-pi/pi-natives": "15.5.8",
40
- "@oh-my-pi/pi-utils": "15.5.8",
38
+ "@oh-my-pi/pi-ai": "15.5.10",
39
+ "@oh-my-pi/pi-natives": "15.5.10",
40
+ "@oh-my-pi/pi-utils": "15.5.10",
41
41
  "@opentelemetry/api": "^1.9.0"
42
42
  },
43
43
  "devDependencies": {
@@ -550,6 +550,23 @@ function resolveCompactionEffort(model: Model, level: ThinkingLevel | undefined)
550
550
  return clampThinkingLevelForModel(model, requested);
551
551
  }
552
552
 
553
+ /**
554
+ * Build the error thrown when an LLM summarization call ends with
555
+ * `stopReason === "error"`. Carries the provider's HTTP `errorStatus`
556
+ * onto a top-level `.status` field so callers (notably
557
+ * `AgentSession.#isCompactionAuthFailure`) can branch on 401/403 without
558
+ * regex-scraping `error.message`. The `auth_unavailable` synthetic
559
+ * (pi-native gateway) does not populate `errorStatus`, hence the legacy
560
+ * message-based check is still required upstream — see issue #986.
561
+ */
562
+ function createSummarizationError(prefix: string, response: AssistantMessage): Error {
563
+ const error: Error & { status?: number } = new Error(`${prefix}: ${response.errorMessage || "Unknown error"}`);
564
+ if (response.errorStatus !== undefined) {
565
+ error.status = response.errorStatus;
566
+ }
567
+ return error;
568
+ }
569
+
553
570
  /**
554
571
  * Generate a summary of the conversation using the LLM.
555
572
  * If previousSummary is provided, uses the update prompt to merge.
@@ -649,7 +666,7 @@ export async function generateSummary(
649
666
  );
650
667
 
651
668
  if (response.stopReason === "error") {
652
- throw new Error(`Summarization failed: ${response.errorMessage || "Unknown error"}`);
669
+ throw createSummarizationError("Summarization failed", response);
653
670
  }
654
671
 
655
672
  const textContent = response.content
@@ -731,7 +748,7 @@ export async function generateHandoff(
731
748
  );
732
749
 
733
750
  if (response.stopReason === "error") {
734
- throw new Error(`Handoff generation failed: ${response.errorMessage || "Unknown error"}`);
751
+ throw createSummarizationError("Handoff generation failed", response);
735
752
  }
736
753
 
737
754
  return response.content
@@ -790,7 +807,7 @@ async function generateShortSummary(
790
807
  );
791
808
 
792
809
  if (response.stopReason === "error") {
793
- throw new Error(`Short summary failed: ${response.errorMessage || "Unknown error"}`);
810
+ throw createSummarizationError("Short summary failed", response);
794
811
  }
795
812
 
796
813
  return response.content
@@ -1128,7 +1145,7 @@ async function generateTurnPrefixSummary(
1128
1145
  );
1129
1146
 
1130
1147
  if (response.stopReason === "error") {
1131
- throw new Error(`Turn prefix summarization failed: ${response.errorMessage || "Unknown error"}`);
1148
+ throw createSummarizationError("Turn prefix summarization failed", response);
1132
1149
  }
1133
1150
 
1134
1151
  return response.content