pi-vision-guard 0.1.0 → 0.2.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 +4 -0
- package/README.md +1 -1
- package/extensions/vision-context-guard.ts +5 -10
- package/package.json +18 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- Ranking uses the first available registered classifier with no built-in model preference (previously preferred a local clef provider); fully backend-agnostic, pairs with `pi-local-classifier` for offline use.
|
|
6
|
+
|
|
3
7
|
## 0.1.0 — Initial release
|
|
4
8
|
|
|
5
9
|
- Cap image payloads per request (default 5, `/vision-guard 1..6`), dropping to 1 past 35% context usage.
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Three layers, all automatic:
|
|
|
32
32
|
|
|
33
33
|
## Classifier ranking
|
|
34
34
|
|
|
35
|
-
Ranking lights up automatically with
|
|
35
|
+
Ranking lights up automatically with the first available registered Pi classifier — no settings. The questions are plain keep/drop judgments, so any Jev-family decision model works. With no classifier present, the guard silently uses newest-first order. Pairs with `pi-local-classifier` for fully offline ranking with no API key.
|
|
36
36
|
|
|
37
37
|
## ⚠️ Cache-churn caveat
|
|
38
38
|
|
|
@@ -8,11 +8,8 @@ const MAX_EDGE = 1600;
|
|
|
8
8
|
const DEFAULT_RETAINED_IMAGES = 5;
|
|
9
9
|
const LONG_CONTEXT_FRACTION = 0.35;
|
|
10
10
|
const MAX_SOURCE_BYTES = 64 * 1024 * 1024;
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// available one. Recency fallback covers no-classifier setups.
|
|
14
|
-
const CLEF_PROVIDER = "clef-local";
|
|
15
|
-
const CLEF_MODEL = "clef-flash";
|
|
11
|
+
// Relevance ranking uses the first available registry classifier, if any.
|
|
12
|
+
// Recency fallback covers no-classifier setups.
|
|
16
13
|
const OMITTED_TEXT =
|
|
17
14
|
"[Older image omitted from this request by the local vision context guard. Use existing textual observations or reread one specific image if it is essential.]";
|
|
18
15
|
|
|
@@ -164,9 +161,7 @@ async function scoreKeepers(
|
|
|
164
161
|
taskHint: string,
|
|
165
162
|
ctx: ExtensionContext,
|
|
166
163
|
): Promise<number[] | undefined> {
|
|
167
|
-
const clf =
|
|
168
|
-
ctx.modelRegistry.findOfType("classifier", CLEF_PROVIDER, CLEF_MODEL) ??
|
|
169
|
-
ctx.modelRegistry.getModelsOfType("classifier")[0];
|
|
164
|
+
const clf = ctx.modelRegistry.getModelsOfType("classifier")[0];
|
|
170
165
|
if (!clf) return undefined;
|
|
171
166
|
const questions: Record<string, ClassifierQuestion> = {};
|
|
172
167
|
for (let i = 0; i < slots.length; i++) {
|
|
@@ -214,9 +209,9 @@ async function scoreKeepers(
|
|
|
214
209
|
|
|
215
210
|
/**
|
|
216
211
|
* Relevance-ranked prune within the same budget the recency guard used.
|
|
217
|
-
* Newest image is always kept; remaining slots go to the highest
|
|
212
|
+
* Newest image is always kept; remaining slots go to the highest classifier
|
|
218
213
|
* keep-scores, falling back to recency when there is no ranking signal
|
|
219
|
-
* (bare images) or the
|
|
214
|
+
* (bare images) or the classifier is unavailable.
|
|
220
215
|
*/
|
|
221
216
|
async function pruneRanked(
|
|
222
217
|
messages: any[],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-vision-guard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pi extension that caps, shrinks, and relevance-ranks image payloads so long vision sessions stop 413ing",
|
|
5
5
|
"author": "Jesse Wise",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,14 +12,28 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/jwise7/pi-vision-guard/issues"
|
|
14
14
|
},
|
|
15
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"pi-package",
|
|
17
|
+
"pi",
|
|
18
|
+
"vision",
|
|
19
|
+
"images",
|
|
20
|
+
"context",
|
|
21
|
+
"coding-agent"
|
|
22
|
+
],
|
|
16
23
|
"publishConfig": {
|
|
17
24
|
"access": "public"
|
|
18
25
|
},
|
|
19
26
|
"pi": {
|
|
20
|
-
"extensions": [
|
|
27
|
+
"extensions": [
|
|
28
|
+
"./extensions"
|
|
29
|
+
]
|
|
21
30
|
},
|
|
22
|
-
"files": [
|
|
31
|
+
"files": [
|
|
32
|
+
"extensions/",
|
|
33
|
+
"README.md",
|
|
34
|
+
"CHANGELOG.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
23
37
|
"scripts": {
|
|
24
38
|
"test": "node --test tests/vision-guard/scoping.test.mjs tests/vision-guard/ranking.test.mjs"
|
|
25
39
|
},
|