pi-canary 1.0.0 → 1.0.2
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/.github/workflows/publish.yml +16 -0
- package/extensions/canary.ts +2 -2
- package/package.json +11 -2
- package/skills/canary-help/SKILL.md +54 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ['v*']
|
|
5
|
+
jobs:
|
|
6
|
+
publish:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
- uses: actions/setup-node@v4
|
|
11
|
+
with:
|
|
12
|
+
node-version: 20
|
|
13
|
+
registry-url: 'https://registry.npmjs.org'
|
|
14
|
+
- run: npm publish --access public
|
|
15
|
+
env:
|
|
16
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/extensions/canary.ts
CHANGED
|
@@ -25,8 +25,8 @@ const cfg = (() => {
|
|
|
25
25
|
FAIL_COMPACT: 0,
|
|
26
26
|
};
|
|
27
27
|
try {
|
|
28
|
-
const
|
|
29
|
-
return { ...defaults, ...JSON.parse((globalThis as any).Deno.readTextFileSync(
|
|
28
|
+
const url = new URL("canary.json", import.meta.url);
|
|
29
|
+
return { ...defaults, ...JSON.parse((globalThis as any).Deno.readTextFileSync(url)) };
|
|
30
30
|
} catch {
|
|
31
31
|
return defaults;
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-canary",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
7
|
+
"homepage": "https://github.com/sebaxzero/pi-canary",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sebaxzero/pi-canary.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/sebaxzero/pi-canary/issues"
|
|
14
|
+
},
|
|
7
15
|
"pi": {
|
|
8
|
-
"extensions": ["./extensions"]
|
|
16
|
+
"extensions": ["./extensions"],
|
|
17
|
+
"skills": ["./skills"]
|
|
9
18
|
}
|
|
10
19
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canary-help
|
|
3
|
+
description: "Reference for pi-canary: commands, config keys, and how to persistently edit canary.json."
|
|
4
|
+
homepage: https://github.com/sebaxzero/pi-canary
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Canary Help
|
|
9
|
+
|
|
10
|
+
pi-canary runs a hidden pre-turn where the agent must recall N secret tokens
|
|
11
|
+
injected into the conversation history. Passed = proceed; failed = warning.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
| Command | What it does |
|
|
16
|
+
|---------|-------------|
|
|
17
|
+
| `/canary` | Show current status and config |
|
|
18
|
+
| `/canary set KEY=VAL` | Change one or more keys for this session only |
|
|
19
|
+
|
|
20
|
+
## Config keys
|
|
21
|
+
|
|
22
|
+
| Key | Default | Valid values | What it controls |
|
|
23
|
+
|-----|---------|-------------|-----------------|
|
|
24
|
+
| `COUNT` | `3` | integer > 0 | Number of canary tokens per turn |
|
|
25
|
+
| `POSITION` | `end` | `start` \| `equidistant` \| `end` | Where tokens are injected in context |
|
|
26
|
+
| `VARIANT` | `fixed` | `fixed` \| `variant` | Fixed reuses same tokens (KV-cache friendly); variant regenerates each turn |
|
|
27
|
+
| `FAIL_COMPACT` | `0` | integer ≥ 0 | Trigger compaction after N consecutive failures (0 = disabled) |
|
|
28
|
+
|
|
29
|
+
## Changing config
|
|
30
|
+
|
|
31
|
+
**Session only** (lost on restart):
|
|
32
|
+
```
|
|
33
|
+
/canary set COUNT=2
|
|
34
|
+
/canary set COUNT=2 POSITION=start VARIANT=variant
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Persistent** (survives restarts): edit `canary.json` in the extensions directory.
|
|
38
|
+
|
|
39
|
+
Global git install path:
|
|
40
|
+
```
|
|
41
|
+
~/.pi/agent/git/github.com/sebaxzero/pi-canary/extensions/canary.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Example `canary.json`:
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"COUNT": 2,
|
|
48
|
+
"POSITION": "end",
|
|
49
|
+
"VARIANT": "fixed",
|
|
50
|
+
"FAIL_COMPACT": 0
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Only include the keys you want to override — missing keys use the defaults above.
|