pi-canary 1.2.1 → 1.3.1

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.
@@ -73,19 +73,14 @@ function positionLabel(index: number, total: number): string {
73
73
  }
74
74
 
75
75
  function buildAnchorContent(token: string, index: number, total: number): string {
76
- return `[CANARY — TOKEN_${index + 1} of ${total} — ${positionLabel(index, total)}]\n${token}`;
76
+ return `[marker ${index + 1}/${total} — ${positionLabel(index, total)}]\n${token}`;
77
77
  }
78
78
 
79
79
  function buildVerificationInstruction(count: number): string {
80
- const formatLines = Array.from({ length: count }, (_, i) => `TOKEN_${i + 1}: <value>`);
80
+ const formatLines = Array.from({ length: count }, (_, i) => `marker-${i + 1}: <value>`);
81
81
  return [
82
- "═══════════════════════════════════════════════════════════",
83
- "⚠️ CANARY CHECK ⚠️",
84
- "═══════════════════════════════════════════════════════════",
85
- "",
86
- `Return ONLY the ${count} canary token${count === 1 ? "" : "s"} below. Do not say anything else.`,
82
+ `Recall check — list the ${count} marker${count === 1 ? "" : "s"} from this conversation:`,
87
83
  ...formatLines,
88
- "═══════════════════════════════════════════════════════════",
89
84
  ].join("\n");
90
85
  }
91
86
 
@@ -152,9 +147,9 @@ export default function (pi: ExtensionAPI) {
152
147
  .join("\n")
153
148
  : null;
154
149
  if (typeof lastMsg.content === "string") {
155
- lastMsg.content = "Please return the canary tokens.";
150
+ lastMsg.content = "List the session markers from this conversation.";
156
151
  } else if (Array.isArray(lastMsg.content) && lastMsg.content.length > 0) {
157
- lastMsg.content = [{ type: "text", text: "Please return the canary tokens." }];
152
+ lastMsg.content = [{ type: "text", text: "List the session markers from this conversation." }];
158
153
  }
159
154
  }
160
155
 
@@ -208,7 +203,7 @@ export default function (pi: ExtensionAPI) {
208
203
  (messages[messages.length - 1] as any).role === "user"
209
204
  ) {
210
205
  const lastMsg = messages[messages.length - 1] as any;
211
- const canaryPrompt = "Please return the canary tokens.";
206
+ const canaryPrompt = "List the session markers from this conversation.";
212
207
  const lastContent = typeof lastMsg.content === "string" ? lastMsg.content : "";
213
208
  if (lastContent === canaryPrompt) {
214
209
  lastMsg.content = originalUserMessage;
@@ -0,0 +1 @@
1
+ export { default } from "./canary.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-canary",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Pi extension: silently verifies agent context awareness every turn using hidden canary tokens. KV-cache friendly.",
5
5
  "keywords": ["pi-package", "pi", "pi-coding-agent", "extension", "context-awareness", "canary", "safety", "verification", "local-llm"],
6
6
  "license": "MIT",