@oh-my-pi/pi-agent-core 17.4.1 → 18.0.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
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## [18.0.0] - 2026-08-22
4
+
5
+ ### Fixed
6
+
7
+ - Fixed Anthropic Claude tool calls containing provider-visible private-use icon glyphs by reversibly tokenizing glyphs at the wire boundary and rejecting model-invented or unresolved glyph tokens before execution.
8
+ - Fixed agent identity confusion after session handoffs by clarifying context framing and ensuring successor instances seamlessly resume existing execution plans.
4
9
 
5
10
  ## [17.4.1] - 2026-08-21
6
11
 
@@ -11,7 +11,7 @@
11
11
  */
12
12
  export declare class CompactionCancelledError extends Error {
13
13
  readonly name: "CompactionCancelledError";
14
- constructor(message?: string);
14
+ constructor(message?: string, options?: ErrorOptions);
15
15
  }
16
16
  /**
17
17
  * A provider-native compaction request failed after every native protocol
@@ -59,6 +59,14 @@ declare module "../types.js" {
59
59
  export type ConvertToLlm = (messages: AgentMessage[]) => Message[];
60
60
  export declare function renderBranchSummaryContext(summary: string): string;
61
61
  export declare function renderCompactionSummaryContext(summary: string): string;
62
+ /**
63
+ * Wrap a handoff document for injection into the successor context. Unlike the
64
+ * generic compaction wrapper, this names the mechanism and pins authorship —
65
+ * the document was written by a prior instance in its own voice, so without
66
+ * this framing the successor misreads first-person "Next Steps" as fresh user
67
+ * instructions (or tries to write the handoff again).
68
+ */
69
+ export declare function renderHandoffSummaryContext(summary: string): string;
62
70
  export declare function createBranchSummaryMessage(summary: string, fromId: string, timestamp: string): BranchSummaryMessage;
63
71
  /** Optional metadata for {@link createCompactionSummaryMessage}. */
64
72
  export interface CompactionSummaryMessageOptions {
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": "17.4.1",
4
+ "version": "18.0.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.",
@@ -35,16 +35,16 @@
35
35
  "fmt": "biome format --write ."
36
36
  },
37
37
  "dependencies": {
38
- "@oh-my-pi/pi-ai": "17.4.1",
39
- "@oh-my-pi/pi-catalog": "17.4.1",
40
- "@oh-my-pi/pi-natives": "17.4.1",
41
- "@oh-my-pi/pi-utils": "17.4.1",
42
- "@oh-my-pi/pi-wire": "17.4.1",
43
- "@oh-my-pi/snapcompact": "17.4.1",
38
+ "@oh-my-pi/pi-ai": "18.0.0",
39
+ "@oh-my-pi/pi-catalog": "18.0.0",
40
+ "@oh-my-pi/pi-natives": "18.0.0",
41
+ "@oh-my-pi/pi-utils": "18.0.0",
42
+ "@oh-my-pi/pi-wire": "18.0.0",
43
+ "@oh-my-pi/snapcompact": "18.0.0",
44
44
  "@opentelemetry/api": "^1.9.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@oh-my-pi/omptype": "17.4.1",
47
+ "@oh-my-pi/omptype": "18.0.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"
@@ -13,8 +13,8 @@
13
13
  export class CompactionCancelledError extends Error {
14
14
  override readonly name = "CompactionCancelledError" as const;
15
15
 
16
- constructor(message = "Compaction cancelled") {
17
- super(message);
16
+ constructor(message = "Compaction cancelled", options?: ErrorOptions) {
17
+ super(message, options);
18
18
  }
19
19
  }
20
20
 
@@ -10,8 +10,10 @@ import { prompt } from "@oh-my-pi/pi-utils";
10
10
  import type { AgentMessage } from "../types";
11
11
  import branchSummaryContextPrompt from "./prompts/branch-summary-context.md" with { type: "text" };
12
12
  import compactionSummaryContextPrompt from "./prompts/compaction-summary-context.md" with { type: "text" };
13
+ import handoffSummaryContextPrompt from "./prompts/handoff-summary-context.md" with { type: "text" };
13
14
 
14
15
  const COMPACTION_SUMMARY_TEMPLATE = compactionSummaryContextPrompt;
16
+ const HANDOFF_SUMMARY_TEMPLATE = handoffSummaryContextPrompt;
15
17
  const BRANCH_SUMMARY_TEMPLATE = branchSummaryContextPrompt;
16
18
 
17
19
  export interface CustomMessage<T = unknown> {
@@ -93,6 +95,16 @@ export function renderBranchSummaryContext(summary: string): string {
93
95
  export function renderCompactionSummaryContext(summary: string): string {
94
96
  return prompt.render(COMPACTION_SUMMARY_TEMPLATE, { summary });
95
97
  }
98
+ /**
99
+ * Wrap a handoff document for injection into the successor context. Unlike the
100
+ * generic compaction wrapper, this names the mechanism and pins authorship —
101
+ * the document was written by a prior instance in its own voice, so without
102
+ * this framing the successor misreads first-person "Next Steps" as fresh user
103
+ * instructions (or tries to write the handoff again).
104
+ */
105
+ export function renderHandoffSummaryContext(summary: string): string {
106
+ return prompt.render(HANDOFF_SUMMARY_TEMPLATE, { summary });
107
+ }
96
108
 
97
109
  export function createBranchSummaryMessage(summary: string, fromId: string, timestamp: string): BranchSummaryMessage {
98
110
  return {
@@ -216,7 +228,10 @@ export function convertMessageToLlm(message: AgentMessage): Message | undefined
216
228
  : [
217
229
  {
218
230
  type: "text" as const,
219
- text: renderCompactionSummaryContext(message.summary),
231
+ text:
232
+ message.method === "handoff"
233
+ ? renderHandoffSummaryContext(message.summary)
234
+ : renderCompactionSummaryContext(message.summary),
220
235
  },
221
236
  ...(message.images ?? []),
222
237
  ],
@@ -10,6 +10,8 @@ Capture exact technical state, not abstractions.
10
10
  - Test results, observed failures
11
11
  - Decisions made
12
12
  - Partial work affecting the next step
13
+ Register: address the successor directly in the imperative ("Fix X", "Run Y") — never first person ("I need to…", "my attempt…").
14
+ The handoff mechanism is invisible to the document: NEVER list writing, generating, or delivering a handoff/summary/context document as progress or a next step. Progress and Next Steps cover the user's task only.
13
15
  </instruction>
14
16
 
15
17
  <output>
@@ -0,0 +1,9 @@
1
+ Context replaced. The <handoff> below is a handoff document a prior instance of you wrote from the full conversation. It is your own working memory, not user input.
2
+ - First person inside it refers to you (the prior instance).
3
+ - "Next Steps" is your own resumed plan; re-check it against the latest user message before acting.
4
+ - The handoff already exists and is complete: NEVER write another handoff document unless the user explicitly asks.
5
+ MUST build on prior work; NEVER duplicate prior work.
6
+
7
+ <handoff>
8
+ {{summary}}
9
+ </handoff>