pi-evals 0.5.1 → 0.5.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/CHANGELOG.md +4 -0
- package/dist/labels.js +14 -1
- package/docs/schema.md +2 -0
- package/package.json +1 -1
- package/src/labels.ts +19 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
- A later human label on the same session, rule and item replaces the earlier one in the report and agreement; `labels.jsonl` keeps both. New `source: "recheck"` for your second look at a label given after the fact (counted as 事後標). Each 「其他」 label stays its own event, and agent corrections are never replaced.
|
|
6
|
+
|
|
3
7
|
## 0.5.1
|
|
4
8
|
|
|
5
9
|
- The two anchor checks read the forms agents actually use, checked against 30 sessions you labelled by hand. An anchor counts when the agent or its brief names the check before the first edit: an `Anchor:` line, a `Gates:`, `Checks:`, `Verify:`, `Done when` or `驗證:` line, a todo anchor or sb check spec, or a check command named in the brief. It also counts when the first change is a test file (red first). A brief's anchor is no longer failed as `anchor_only_in_brief`.
|
package/dist/labels.js
CHANGED
|
@@ -45,8 +45,21 @@ function parse(file) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Rows in effect, in file order. A withdrawal cancels its session's latest live row still in effect before it, and a
|
|
50
|
+
* later human verdict on the same session, rule and item replaces an earlier one (the file keeps both). Each "other"
|
|
51
|
+
* label is its own event, and agent rows are never replaced.
|
|
52
|
+
*/
|
|
49
53
|
export function readLabels(file) {
|
|
54
|
+
const rows = withdrawn(file);
|
|
55
|
+
const latest = new Map();
|
|
56
|
+
rows.forEach((r, i) => {
|
|
57
|
+
if (r.annotator !== "agent" && r.evaluation_name !== "other")
|
|
58
|
+
latest.set(`${r.session_id}\u0000${r.evaluation_name}\u0000${r.item ?? ""}`, i);
|
|
59
|
+
});
|
|
60
|
+
return rows.filter((r, i) => r.annotator === "agent" || r.evaluation_name === "other" || latest.get(`${r.session_id}\u0000${r.evaluation_name}\u0000${r.item ?? ""}`) === i);
|
|
61
|
+
}
|
|
62
|
+
function withdrawn(file) {
|
|
50
63
|
const rows = parse(file);
|
|
51
64
|
const gone = new Set();
|
|
52
65
|
const live = new Map();
|
package/docs/schema.md
CHANGED
|
@@ -66,6 +66,8 @@ There are three kinds of rows:
|
|
|
66
66
|
- A row without `source` is a human verdict given after the fact (the report calls it 事後標, the code `batch`).
|
|
67
67
|
- `source: "live"` is a human verdict given in the moment with `/evals label`. `/evals label undo` appends `{ …, "source": "live", "undo": "<at of the withdrawn row>" }`, which withdraws the session's latest live row still in effect.
|
|
68
68
|
- `source: "live-prompt"` is a human verdict too: the user's words after `/evals label`, which the agent turned into rows with `evals_label` and `on_behalf: "user"` during the turn those words started. The note is the user's words, taken from the command, never from the agent.
|
|
69
|
+
- `source: "recheck"` is a human verdict given again after the fact; it replaces the earlier label.
|
|
70
|
+
- A later human row on the same `session_id`, `evaluation_name` and `item` replaces an earlier one (the file keeps both); each `other` row and every agent row stays its own.
|
|
69
71
|
- `source: "correction"` is an agent's `evals_label` call: `label` is always `fail`, and `type` is one of `no_check_stated`, `no_check_run`, `skipped_rule`, `wrong_order`, `unverified_claim`, `ignored_instruction`, `other`. The tool accepts no other field or value, and refuses `on_behalf` outside such a turn.
|
|
70
72
|
|
|
71
73
|
`evaluation_name` is a process check name or `other`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-evals",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Usage and process records for pi: how skills, packages, ask-user, monitors and subagents are used, back-filled from past sessions, with a static report and an evals_query tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/labels.ts
CHANGED
|
@@ -16,8 +16,11 @@ export const VERDICTS = ["pass", "fail", "unclear"] as const;
|
|
|
16
16
|
export type Verdict = (typeof VERDICTS)[number];
|
|
17
17
|
export const FAILURE_TYPES = ["no_check_stated", "no_check_run", "skipped_rule", "wrong_order", "unverified_claim", "ignored_instruction", "other"] as const;
|
|
18
18
|
export type FailureType = (typeof FAILURE_TYPES)[number];
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* `live-prompt`: the user's words after `/evals label`, which the agent turned into rows on the user's behalf.
|
|
21
|
+
* `recheck`: the user's later verdict on a label given after the fact; it replaces that label.
|
|
22
|
+
*/
|
|
23
|
+
export type LabelSource = "batch" | "live" | "live-prompt" | "correction" | "recheck";
|
|
21
24
|
export const NOTE_MAX = 500;
|
|
22
25
|
|
|
23
26
|
const t = (en: string, zh: string): Text => ({ en, zh });
|
|
@@ -71,8 +74,21 @@ function parse(file: string): LabelRow[] {
|
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Rows in effect, in file order. A withdrawal cancels its session's latest live row still in effect before it, and a
|
|
79
|
+
* later human verdict on the same session, rule and item replaces an earlier one (the file keeps both). Each "other"
|
|
80
|
+
* label is its own event, and agent rows are never replaced.
|
|
81
|
+
*/
|
|
75
82
|
export function readLabels(file: string): LabelRow[] {
|
|
83
|
+
const rows = withdrawn(file);
|
|
84
|
+
const latest = new Map<string, number>();
|
|
85
|
+
rows.forEach((r, i) => {
|
|
86
|
+
if (r.annotator !== "agent" && r.evaluation_name !== "other") latest.set(`${r.session_id}\u0000${r.evaluation_name}\u0000${r.item ?? ""}`, i);
|
|
87
|
+
});
|
|
88
|
+
return rows.filter((r, i) => r.annotator === "agent" || r.evaluation_name === "other" || latest.get(`${r.session_id}\u0000${r.evaluation_name}\u0000${r.item ?? ""}`) === i);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function withdrawn(file: string): LabelRow[] {
|
|
76
92
|
const rows = parse(file);
|
|
77
93
|
const gone = new Set<number>();
|
|
78
94
|
const live = new Map<string, number[]>();
|