pi-evals 0.0.0-stage → 0.1.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +106 -2
  4. package/dist/aggregate.js +113 -0
  5. package/dist/build.js +260 -0
  6. package/dist/changes.js +170 -0
  7. package/dist/cli.js +86 -0
  8. package/dist/coverage.js +34 -0
  9. package/dist/detectors.js +154 -0
  10. package/dist/extract/file.js +42 -0
  11. package/dist/extract/run.js +149 -0
  12. package/dist/extract/session.js +430 -0
  13. package/dist/extract/worker.js +12 -0
  14. package/dist/index.js +160 -0
  15. package/dist/meta.js +233 -0
  16. package/dist/model.js +317 -0
  17. package/dist/observer.js +240 -0
  18. package/dist/ops.js +93 -0
  19. package/dist/owners.js +97 -0
  20. package/dist/paths.js +76 -0
  21. package/dist/project.js +43 -0
  22. package/dist/query.js +92 -0
  23. package/dist/render.js +172 -0
  24. package/dist/schema.js +65 -0
  25. package/dist/skills.js +41 -0
  26. package/dist/store.js +51 -0
  27. package/docs/design.md +95 -0
  28. package/docs/schema.md +68 -0
  29. package/package.json +56 -4
  30. package/src/aggregate.ts +204 -0
  31. package/src/build.ts +257 -0
  32. package/src/changes.ts +178 -0
  33. package/src/cli.ts +89 -0
  34. package/src/coverage.ts +44 -0
  35. package/src/detectors.ts +182 -0
  36. package/src/extract/file.ts +46 -0
  37. package/src/extract/run.ts +198 -0
  38. package/src/extract/session.ts +430 -0
  39. package/src/extract/worker.ts +12 -0
  40. package/src/index.ts +155 -0
  41. package/src/meta.ts +259 -0
  42. package/src/model.ts +346 -0
  43. package/src/observer.ts +255 -0
  44. package/src/ops.ts +110 -0
  45. package/src/owners.ts +92 -0
  46. package/src/paths.ts +108 -0
  47. package/src/project.ts +43 -0
  48. package/src/query.ts +85 -0
  49. package/src/render.ts +189 -0
  50. package/src/schema.ts +84 -0
  51. package/src/skills.ts +46 -0
  52. package/src/store.ts +49 -0
package/dist/render.js ADDED
@@ -0,0 +1,172 @@
1
+ const esc = (v) => String(v ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
2
+ const pct = (r) => (r && r.value !== null ? `${(r.value * 100).toFixed(1)}%` : "—");
3
+ const nOf = (r) => (r ? r.n : 0);
4
+ const ms = (v) => {
5
+ if (v === null || v === undefined)
6
+ return "—";
7
+ if (v < 1000)
8
+ return `${v} ms`;
9
+ if (v < 60_000)
10
+ return `${(v / 1000).toFixed(1)} s`;
11
+ if (v < 3_600_000)
12
+ return `${(v / 60_000).toFixed(1)} min`;
13
+ return `${(v / 3_600_000).toFixed(1)} h`;
14
+ };
15
+ const usd = (v) => (v === null || v === undefined ? "—" : `$${v.toFixed(2)}`);
16
+ const num = (v) => v.toLocaleString("en-US");
17
+ function bars(rows, width = 560) {
18
+ if (!rows.length)
19
+ return `<p class="empty">—</p>`;
20
+ const max = Math.max(...rows.map((r) => r.value), 1);
21
+ const h = 18;
22
+ const labelW = 220;
23
+ const body = rows
24
+ .map((r, i) => {
25
+ const w = Math.max(1, Math.round(((width - labelW - 90) * r.value) / max));
26
+ const y = i * (h + 4);
27
+ return `<text x="0" y="${y + 13}" class="lbl">${esc(r.label.length > 34 ? `${r.label.slice(0, 33)}…` : r.label)}</text><rect x="${labelW}" y="${y}" width="${w}" height="${h}" class="bar"/><text x="${labelW + w + 6}" y="${y + 13}" class="val">${esc(r.note ?? num(r.value))}</text>`;
28
+ })
29
+ .join("");
30
+ return `<svg role="img" width="${width}" height="${rows.length * (h + 4)}" viewBox="0 0 ${width} ${rows.length * (h + 4)}">${body}</svg>`;
31
+ }
32
+ function columns(days, values, width = 720, height = 120) {
33
+ if (!days.length)
34
+ return `<p class="empty">—</p>`;
35
+ const max = Math.max(...values, 1);
36
+ const w = Math.max(2, Math.floor(width / days.length) - 1);
37
+ const body = values
38
+ .map((v, i) => {
39
+ const bh = Math.round(((height - 16) * v) / max);
40
+ return `<rect x="${i * (w + 1)}" y="${height - 14 - bh}" width="${w}" height="${bh}" class="bar"><title>${esc(days[i])}: ${esc(num(v))}</title></rect>`;
41
+ })
42
+ .join("");
43
+ const axis = `<text x="0" y="${height - 2}" class="val">${esc(days[0])}</text><text x="${width}" y="${height - 2}" class="val" text-anchor="end">${esc(days.at(-1))}</text>`;
44
+ return `<svg role="img" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">${body}${axis}</svg>`;
45
+ }
46
+ function table(head, rows) {
47
+ if (!rows.length)
48
+ return `<p class="empty">—</p>`;
49
+ return `<table><thead><tr>${head.map((h) => `<th>${esc(h)}</th>`).join("")}</tr></thead><tbody>${rows.map((r) => `<tr>${r.map((c) => `<td>${typeof c === "number" ? esc(num(c)) : c}</td>`).join("")}</tr>`).join("")}</tbody></table>`;
50
+ }
51
+ export function renderHtml(model, lang = "zh") {
52
+ const tx = (t) => esc(t ? t[lang] : "");
53
+ const m = model.meta.metrics;
54
+ const explain = (id) => {
55
+ const meta = m[id];
56
+ if (!meta)
57
+ return "";
58
+ const dir = meta.goodDirection === "higher" ? (lang === "zh" ? "越高越好" : "higher is better") : meta.goodDirection === "lower" ? (lang === "zh" ? "越低越好" : "lower is better") : "";
59
+ return `<p class="meaning"><b>${tx(meta.label)}</b>: ${tx(meta.meaning)}${dir ? ` <span class="dir">(${dir})</span>` : ""}<br><span class="how">${tx(meta.howComputed)}</span></p>`;
60
+ };
61
+ const L = (en, zh) => (lang === "zh" ? zh : en);
62
+ const sections = [];
63
+ const fresh = model.freshness;
64
+ sections.push(`<section><h2>${L("Overview", "總覽")}</h2>
65
+ <p>${L("Window", "期間")}: ${esc(model.window.since ?? "—")} → ${esc(model.window.until ?? "—")} (${model.window.days} ${L("days", "天")})${model.window.project ? ` · ${L("project", "專案")} ${esc(model.window.project)}` : ""}</p>
66
+ <p class="${fresh.stale ? "warn" : ""}">${L("Last extract", "上次抽取")}: ${esc(fresh.lastExtract ?? "—")}${fresh.stale ? ` — ${L("data is stale; run /evals extract", "資料過時,請執行 /evals extract")}` : ""}</p>
67
+ ${table([L("Number", "數字"), L("Value", "數值")], [
68
+ [tx(m.sessions.label), model.totals.sessions],
69
+ [tx(m.subagent_sessions.label), model.totals.subagentSessions],
70
+ [tx(m.prompts.label), model.totals.prompts],
71
+ [tx(m.tool_calls.label), model.totals.toolCalls],
72
+ [tx(m.tool_error_rate.label), `${pct(model.totals.toolErrorRate)} (n=${num(nOf(model.totals.toolErrorRate))})`],
73
+ [tx(m.cost.label), usd(model.totals.cost)],
74
+ ])}
75
+ ${explain("sessions")}
76
+ <h3>${L("Sessions per day", "每日工作階段")}</h3>${columns(model.series.days, model.series.sessions)}
77
+ <h3>${L("Cost per day (USD)", "每日費用(美元)")}</h3>${columns(model.series.days, model.series.cost)}</section>`);
78
+ const sk = model.skills;
79
+ sections.push(`<section><h2>${L("Skills", "技能")}</h2>${explain("skill_loads")}
80
+ <h3>${L("Loads per day", "每日載入")}</h3>${columns(model.series.days, model.series.skillLoads)}
81
+ <h3>${L("Most loaded", "最常載入")}</h3>${bars(sk.top.slice(0, 25).map((s) => ({ label: s.name, value: s.loads, note: `${num(s.loads)} · ${num(s.sessions)} ${L("sessions", "階段")}` })))}
82
+ ${explain("skill_sessions")}
83
+ <h3>${L("How skills were loaded", "載入方式")}</h3>${table([L("Way", "方式"), L("Loads", "次數")], Object.entries(sk.triggers).map(([k, v]) => [esc(k), v]))}
84
+ <h3>${L("By project (top 30)", "各專案(前 30)")}</h3>${table([L("Project", "專案"), L("Skill", "技能"), L("Loads", "次數")], sk.byProject.slice(0, 30).map((r) => [esc(r.project), esc(r.skill), r.loads]))}
85
+ <h3>${tx(m.never_loaded.label)} (${sk.neverLoaded.length} / ${sk.offered})</h3>${explain("never_loaded")}<p>${sk.neverLoaded.map(esc).join(", ") || "—"}</p></section>`);
86
+ sections.push(`<section><h2>${L("Packages", "套件")}</h2>${explain("package_calls")}${explain("tool_error_rate")}${explain("avg_duration_ms")}
87
+ ${table([L("Package", "套件"), L("Version", "版本"), L("Calls", "呼叫"), L("Errors", "錯誤"), tx(m.tool_error_rate.label), tx(m.avg_duration_ms.label)], model.packages.map((p) => [esc(p.owner), esc(p.version ?? "—"), p.calls, p.errors, pct(p.errorRate), ms(p.avgMs)]))}
88
+ <h3>${L("Tools (top 40)", "工具(前 40)")}</h3>${table([L("Tool", "工具"), L("Package", "套件"), L("Calls", "呼叫"), tx(m.tool_error_rate.label), tx(m.avg_duration_ms.label)], model.tools.slice(0, 40).map((t) => [esc(t.name), esc(t.owner), t.calls, pct(t.errorRate), ms(t.avgMs)]))}</section>`);
89
+ const ask = model.askUser;
90
+ const bucketLabel = (up, i, all) => (up === null ? `≥ ${ms(all[i - 1]?.upToMs ?? 0)}` : `< ${ms(up)}`);
91
+ sections.push(`<section><h2>${L("Questions to you", "問你的問題")}</h2>${explain("ask_calls")}${explain("ask_wait_ms")}${explain("ask_cancel_rate")}
92
+ ${table([L("Number", "數字"), L("Value", "數值")], [
93
+ [tx(m.ask_calls.label), ask.calls],
94
+ [tx(m.ask_wait_ms.label), `${ms(ask.avgWaitMs)} (n=${num(ask.waitN)})`],
95
+ [tx(m.ask_cancel_rate.label), `${pct(ask.cancelRate)} (n=${num(nOf(ask.cancelRate))})`],
96
+ ])}
97
+ <h3>${L("How long you took", "你花多久回答")}</h3>${bars(ask.buckets.map((b, i) => ({ label: bucketLabel(b.upToMs, i, ask.buckets), value: b.n })))}
98
+ <h3>${L("Where the answer came from", "回答來源")}</h3>${table([L("Source", "來源"), L("Questions", "題數")], Object.entries(ask.sources).map(([k, v]) => [esc(k), v]))}</section>`);
99
+ const mon = model.monitors;
100
+ sections.push(`<section><h2>${L("Background jobs", "背景工作")}</h2>${explain("monitor_outcomes")}${explain("monitor_duration_ms")}
101
+ <p>${L("Started", "啟動")}: ${num(mon.started)} · ${L("Ending recorded", "有結束紀錄")}: ${num(mon.finished)} · ${tx(m.monitor_duration_ms.label)}: ${ms(mon.avgMs)} (n=${num(mon.durationN)})</p>
102
+ ${bars(Object.entries(mon.statuses).map(([k, v]) => ({ label: k, value: v })))}</section>`);
103
+ const sub = model.subagents;
104
+ sections.push(`<section><h2>${L("Subagents", "子代理")}</h2>${explain("subagent_launches")}
105
+ ${table([L("Role", "角色"), L("Model", "模型"), L("Launches", "次數")], sub.launches.slice(0, 40).map((r) => [esc(r.role), esc(r.model), r.n]))}
106
+ ${explain("subagent_cost")}${bars(sub.costByRole.slice(0, 20).map((r) => ({ label: r.role, value: r.cost, note: usd(r.cost) })))}
107
+ <p>${L("Subagent sessions linked to a parent", "能對回母工作階段的子代理")}: ${num(sub.linked)} / ${num(sub.subagentTotal)}</p></section>`);
108
+ const proc = model.process;
109
+ const dm = model.meta.detectors;
110
+ sections.push(`<section><h2>${L("Process: does the work follow the anchorloop rules?", "流程:工作有沒有照 anchorloop 規則走?")}</h2>
111
+ <p>${L(`Only sessions from ${proc.eraStart} (anchorloop 3.0.0) on are judged; older ones are out of scope, not failures.`, `只評 ${proc.eraStart}(anchorloop 3.0.0)之後的工作階段;更早的不在範圍內,不算失敗。`)}</p>${explain("pass_rate")}
112
+ ${proc.detectors
113
+ .map((d) => {
114
+ const meta = dm[d.name];
115
+ const daily = d.perDay.map((x) => (x.pass + x.fail ? Math.round((100 * x.pass) / (x.pass + x.fail)) : 0));
116
+ return `<div class="detector"><h3>${tx(meta?.label)}: ${pct(d.passRate)} <small>(n=${num(nOf(d.passRate))}, ${L("not applicable", "不適用")} ${num(d.na)})</small></h3>
117
+ <p>${tx(meta?.meaning)}<br><span class="how">${tx(meta?.howComputed)}</span></p>
118
+ <p class="ex">✔ ${tx(meta?.example.pass)}<br>✘ ${tx(meta?.example.fail)}</p>
119
+ <h4>${L("Share followed per day (%)", "每日遵守比例(%)")}</h4>${columns(model.series.days, daily, 720, 80)}
120
+ ${table([L("anchorloop version", "anchorloop 版本"), L("Followed", "遵守"), L("Not followed", "未遵守"), tx(m.pass_rate.label)], d.byVersion.map((v) => [esc(v.version), v.pass, v.fail, pct(v.passRate)]))}</div>`;
121
+ })
122
+ .join("")}
123
+ <h3>${L("Close-guard reminders", "收尾提醒")}</h3>${table([L("Kind", "種類"), L("Count", "次數")], Object.entries(proc.notices).map(([k, v]) => [tx(model.meta.notices[k]) || esc(k), v]))}</section>`);
124
+ sections.push(`<section><h2>${L("Cost", "費用")}</h2>${explain("cost")}${explain("cost_per_session")}${explain("skill_cost")}
125
+ <p>${tx(m.cost_per_session.label)}: ${model.cost.perSession.value === null ? "—" : usd(model.cost.perSession.value)} (n=${num(model.cost.perSession.n)})</p>
126
+ <h3>${L("By skill loaded (top 25)", "依載入技能(前 25)")}</h3>${bars(model.cost.bySkill.map((r) => ({ label: r.skill, value: r.cost, note: `${usd(r.cost)} · ${num(r.sessions)}` })))}
127
+ <h3>${L("Model replies by model", "各模型回覆數")}</h3>${table([L("Model", "模型"), L("Replies", "回覆")], model.cost.byModel.slice(0, 20).map((r) => [esc(r.model), r.replies]))}</section>`);
128
+ const changes = model.changes.slice(-40).reverse();
129
+ const imp = (c) => {
130
+ if (!c.impact)
131
+ return L("no data before this change", "變更前沒有資料");
132
+ const i = c.impact;
133
+ const row = (key, label) => {
134
+ const b = i.before[key];
135
+ const a = i.after[key];
136
+ if (b === undefined || a === undefined)
137
+ return "";
138
+ const show = (x) => (typeof x === "number" ? num(x) : key === "cost_per_session" ? (x.value === null ? "—" : usd(x.value)) : key.endsWith("per_session") ? (x.value === null ? "—" : x.value.toFixed(2)) : pct(x));
139
+ return `<tr><td>${esc(label)}</td><td>${show(b)}</td><td>${show(a)}</td></tr>`;
140
+ };
141
+ const kinds = Object.entries(i.confounders)
142
+ .map(([k, v]) => `${tx(model.meta.changeKinds[k])} ${v}`)
143
+ .join(", ");
144
+ const flags = [
145
+ i.smallSample ? `<span class="warn">${tx(m.small_sample.label)}</span>` : "",
146
+ i.incomplete ? `<span class="warn">${tx(m.incomplete_window.label)} (${L("days with data", "有資料的天數")}: ${i.daysWithData.before} / ${i.daysWithData.after})</span>` : "",
147
+ i.confounded ? `<span class="warn">${tx(m.confounded.label)}: ${i.confounded} (${esc(kinds)})</span>` : "",
148
+ ]
149
+ .filter(Boolean)
150
+ .join(" · ");
151
+ return `<table><thead><tr><th></th><th>${L("before", "之前")}</th><th>${L("after", "之後")}</th></tr></thead><tbody>${row("sessions", tx(m.sessions.label))}${row("tool_error_rate", tx(m.tool_error_rate.label))}${row("package_error_rate", L("This package's error rate", "此套件出錯比例"))}${row("ask_cancel_rate", tx(m.ask_cancel_rate.label))}${row("cost_per_session", tx(m.cost_per_session.label))}${row("skill_loads_per_session", tx(m.skill_loads_per_session.label))}${row("notices_per_session", tx(m.notices_per_session.label))}${row("anchor_before_first_edit", tx(dm.anchor_before_first_edit.label))}${row("check_after_last_edit", tx(dm.check_after_last_edit.label))}</tbody></table>${flags}`;
152
+ };
153
+ sections.push(`<section><h2>${L("Your changes and what followed", "你的變更與之後的變化")}</h2>${explain("impact")}${explain("small_sample")}${explain("incomplete_window")}${explain("confounded")}
154
+ ${changes.map((c) => `<details><summary>${esc(c.at.slice(0, 10))} · ${tx(model.meta.changeKinds[c.kind])} · ${esc(c.package ? `${c.package} ${c.from ?? "∅"} → ${c.to ?? "∅"}` : c.subject)}${c.repo ? ` <small>${esc(c.repo)} ${esc(c.sha ?? "")}</small>` : ""}</summary><p>${esc(c.subject)}</p>${imp(c)}</details>`).join("") || `<p class="empty">—</p>`}</section>`);
155
+ const lab = model.labels;
156
+ sections.push(`<section><h2>${L("Your labels", "你的標記")}</h2>${explain("agreement")}
157
+ ${lab.present ? table([L("Check", "檢查"), L("Labelled", "已標記"), L("Agree", "一致"), tx(m.agreement.label)], lab.agreement.map((a) => [tx(dm[a.detector]?.label) || esc(a.detector), a.n, a.agree, pct(a.rate)])) : `<p class="empty">${L("No labels yet. Labelling sessions comes in a later phase.", "還沒有標記。標記工作階段會在之後的階段加入。")}</p>`}</section>`);
158
+ const cov = model.coverage;
159
+ if (cov)
160
+ sections.push(`<section><h2>${tx(m.coverage.label)}</h2>${explain("coverage")}
161
+ <p>${L(`Inactive more than ${cov.cutDays} days`, `閒置超過 ${cov.cutDays} 天`)}: ${num(cov.old.files)} ${L("files", "個檔案")} (${(cov.old.bytes / 1e9).toFixed(2)} GB) · ${L("indexed", "已建索引")} ${num(cov.indexed.files)} · ${L("not indexed", "未建索引")} ${num(cov.notIndexed.files)} (${(cov.notIndexed.bytes / 1e9).toFixed(2)} GB)</p></section>`);
162
+ return `<!doctype html><html lang="${lang === "zh" ? "zh-Hant-TW" : "en"}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>pi-evals report</title>
163
+ <style>
164
+ :root{color-scheme:light dark;--fg:#1d1d1f;--bg:#fff;--muted:#666;--bar:#4a7bd0;--line:#ddd;--warn:#b35c00}
165
+ @media (prefers-color-scheme:dark){:root{--fg:#e6e6e6;--bg:#151515;--muted:#9a9a9a;--bar:#7aa2f7;--line:#333;--warn:#f0a050}}
166
+ body{font:15px/1.55 system-ui,-apple-system,"PingFang TC","Noto Sans TC",sans-serif;color:var(--fg);background:var(--bg);max-width:980px;margin:2rem auto;padding:0 1rem}
167
+ section{border-top:1px solid var(--line);padding:1rem 0}h1{font-size:1.6rem}h2{font-size:1.3rem}h3{font-size:1.05rem;margin-top:1.2rem}
168
+ table{border-collapse:collapse;margin:.5rem 0}td,th{border-bottom:1px solid var(--line);padding:.25rem .6rem;text-align:left;vertical-align:top}
169
+ .bar{fill:var(--bar)}.lbl,.val{fill:var(--fg);font-size:12px}.meaning{color:var(--fg)}.how,.dir,small{color:var(--muted)}.warn{color:var(--warn)}.empty{color:var(--muted)}
170
+ .ex{color:var(--muted);font-size:.92em}details{margin:.3rem 0}summary{cursor:pointer}
171
+ </style></head><body><h1>pi-evals</h1><p class="how">${L("Generated", "產生時間")} ${esc(model.generated)} · ${L("numbers only: no transcript text is stored or shown", "只有數字:不儲存也不顯示對話內容")}</p>${sections.join("\n")}</body></html>`;
172
+ }
package/dist/schema.js ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The one record shape (docs/schema.md): one JSON object per line, OpenTelemetry GenAI names where they exist,
3
+ * `pi.*` for pi facts, `anchorloop.*` for process facts, `eval.*` for evaluation metadata.
4
+ *
5
+ * Privacy is enforced here: every string attribute must look like a name (no spaces, no newlines, bounded length).
6
+ * Anything else is replaced by "redacted", so free text from a transcript cannot reach a record by accident.
7
+ */
8
+ import { createHash } from "node:crypto";
9
+ export const SCHEMA_VERSION = 1;
10
+ const NAME = /^[\p{L}\p{N}_@./:+#=|-]{0,160}$/u;
11
+ /** A string attribute that passes the name check, else "redacted". */
12
+ export function safeName(value) {
13
+ if (typeof value !== "string")
14
+ return "unknown";
15
+ return NAME.test(value) ? value : "redacted";
16
+ }
17
+ function clean(attrs) {
18
+ const out = {};
19
+ for (const [key, value] of Object.entries(attrs)) {
20
+ if (value === undefined)
21
+ continue;
22
+ if (typeof value === "string")
23
+ out[key] = safeName(value);
24
+ else if (Array.isArray(value))
25
+ out[key] = value.slice(0, 200).map(safeName);
26
+ else if (typeof value === "number") {
27
+ if (Number.isFinite(value))
28
+ out[key] = value;
29
+ }
30
+ else
31
+ out[key] = value;
32
+ }
33
+ return out;
34
+ }
35
+ export function record(fields) {
36
+ const out = { schema_version: SCHEMA_VERSION, name: safeName(fields.name), kind: fields.kind, ts: fields.ts, source: fields.source, attrs: clean(fields.attrs) };
37
+ if (fields.end_ts)
38
+ out.end_ts = fields.end_ts;
39
+ if (typeof fields.duration_ms === "number" && Number.isFinite(fields.duration_ms))
40
+ out.duration_ms = Math.max(0, Math.round(fields.duration_ms));
41
+ if (fields.trace_id)
42
+ out.trace_id = fields.trace_id;
43
+ if (fields.span_id)
44
+ out.span_id = fields.span_id;
45
+ return out;
46
+ }
47
+ const hex = (text, length) => createHash("sha1").update(text).digest("hex").slice(0, length);
48
+ /** 32-hex trace id, stable for a session and the entry that opened the prompt. */
49
+ export const traceId = (sessionId, anchor) => hex(`trace:${sessionId}:${anchor}`, 32);
50
+ /** 16-hex span id, stable across re-extraction. */
51
+ export const spanId = (sessionId, anchor) => hex(`span:${sessionId}:${anchor}`, 16);
52
+ export const fileKey = (path) => hex(`file:${path}`, 20);
53
+ /** Record names this package writes. */
54
+ export const NAMES = {
55
+ session: "pi.session",
56
+ prompt: "invoke_agent",
57
+ tool: "execute_tool",
58
+ skill: "pi.skill.load",
59
+ monitor: "pi.monitor",
60
+ notice: "anchorloop.close_guard.notice",
61
+ evaluation: "gen_ai.evaluation.result",
62
+ tools: "pi.tools.snapshot",
63
+ skills: "pi.skills.available",
64
+ compaction: "pi.compaction",
65
+ };
package/dist/skills.js ADDED
@@ -0,0 +1,41 @@
1
+ /** Recognising skill loads, and listing the skills pi offers. */
2
+ import { posix } from "node:path";
3
+ const named = (name) => !!name && name !== "." && name !== "..";
4
+ /** A read of `<dir>/SKILL.md` loads skill `<dir>`; a read under `skills/<name>/` reads one of its resources. */
5
+ export function skillFromPath(path) {
6
+ if (typeof path !== "string" || !path)
7
+ return undefined;
8
+ const normal = posix.normalize(path.replace(/\\/g, "/"));
9
+ const load = normal.match(/(?:^|\/)([^/]+)\/SKILL\.md$/);
10
+ if (load)
11
+ return named(load[1]) ? { skill: load[1] } : undefined;
12
+ const resource = normal.match(/(?:^|\/)skills\/([^/]+)\/(.+)$/);
13
+ if (resource && named(resource[1]) && !resource[2].endsWith("/"))
14
+ return { skill: resource[1], resource: resource[2] };
15
+ return undefined;
16
+ }
17
+ /**
18
+ * The skill a shell command prints when the whole command is one read of one SKILL.md
19
+ * (`cat`, `head`, `bat`, `less`, `sed -n '…p'`, optionally after `cd <dir> &&`). Searches, edits, globs and
20
+ * bulk listings mention SKILL.md without loading it, so they do not count.
21
+ */
22
+ const PRINT = /^(?:cd\s+\S+\s*&&\s*)?(?:cat|bat|less|head(?:\s+-n)?(?:\s+-?\d+)?|sed\s+-n\s+'[\d,$]*p')\s+['"]?([^\s'";|&*?$]+)\/SKILL\.md['"]?\s*$/;
23
+ export function skillsFromCommand(command) {
24
+ if (typeof command !== "string" || !command.includes("SKILL.md"))
25
+ return [];
26
+ const m = command.trim().match(PRINT);
27
+ const name = m?.[1].split("/").at(-1);
28
+ return name && /^[A-Za-z0-9][\w.-]*$/.test(name) ? [name] : [];
29
+ }
30
+ /** Skill names in `<skill name="x" ...>` blocks (a `/skill:` expansion or a declared-skills message). */
31
+ export function skillsFromBlocks(text) {
32
+ if (typeof text !== "string" || !text.includes("<skill name="))
33
+ return [];
34
+ return [...text.matchAll(/<skill name="([^"]+)"/g)].map((m) => m[1]);
35
+ }
36
+ /** Names in the `<available_skills>` section of pi's system prompt. */
37
+ export function skillsFromCatalog(text) {
38
+ if (typeof text !== "string")
39
+ return [];
40
+ return [...text.matchAll(/<skill>\s*<name>([^<]+)<\/name>/g)].map((m) => m[1].trim());
41
+ }
package/dist/store.js ADDED
@@ -0,0 +1,51 @@
1
+ /** Appending live records, and reading record files back. */
2
+ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { dayOf } from "./paths.js";
5
+ /** An appender that swallows write failures after reporting the first one through `warn`. */
6
+ export function liveWriter(eventsDir, warn, now = Date.now) {
7
+ let warned = false;
8
+ let made = false;
9
+ return (records) => {
10
+ try {
11
+ if (!made) {
12
+ mkdirSync(eventsDir, { recursive: true });
13
+ made = true;
14
+ }
15
+ const list = Array.isArray(records) ? records : [records];
16
+ if (!list.length)
17
+ return;
18
+ appendFileSync(join(eventsDir, `${dayOf(now())}.jsonl`), list.map((r) => `${JSON.stringify(r)}\n`).join(""));
19
+ }
20
+ catch (error) {
21
+ if (!warned) {
22
+ warned = true;
23
+ warn(`pi-evals: cannot write records (${error instanceof Error ? error.message : String(error)}); later failures in this session stay silent.`);
24
+ }
25
+ }
26
+ };
27
+ }
28
+ /** Records in one JSONL file; malformed lines are skipped. */
29
+ export function readRecords(file) {
30
+ if (!existsSync(file))
31
+ return [];
32
+ const out = [];
33
+ for (const line of readFileSync(file, "utf8").split("\n")) {
34
+ if (!line)
35
+ continue;
36
+ try {
37
+ out.push(JSON.parse(line));
38
+ }
39
+ catch { }
40
+ }
41
+ return out;
42
+ }
43
+ /** Live record files, oldest first. */
44
+ export function liveFiles(eventsDir) {
45
+ if (!existsSync(eventsDir))
46
+ return [];
47
+ return readdirSync(eventsDir)
48
+ .filter((name) => /^\d{4}-\d{2}-\d{2}\.jsonl$/.test(name))
49
+ .sort()
50
+ .map((name) => join(eventsDir, name));
51
+ }
package/docs/design.md ADDED
@@ -0,0 +1,95 @@
1
+ # Design
2
+
3
+ pi-evals 0.1.0 is phase 1 of an evals effort for one person's pi setup: record how skills and packages are used and whether the work follows the anchorloop process, from past sessions and from now on, and show it in a report.
4
+ This file records the decisions and the words they came from.
5
+ The evidence came from four research notes written before the build (in the maintainer's agent-root repository, `scratch/evals/`): `instrumentation.md` (which pi seams carry which facts), `inventory.md` (anchorloop, pi-session-doctor and the session format on disk), `literature.md` (papers, OSS and the OTel conventions), and `research.md` (vendor guidance on agent and skill evals).
6
+
7
+ ## What the owner asked for
8
+
9
+ The request, 2026-11-25: 「我想要強化一下 ai evals(上網看看最佳實踐),這可以把 session doctor 移除,或是把 session doctor 升級成 evals 工具,包括可以從資料產出視圖」 (strengthen AI evals following best practice; remove pi-session-doctor or upgrade it into an evals tool, with views produced from the data).
10
+
11
+ Decisions on 2026-11-26, binding for this package:
12
+
13
+ | Words | Decision |
14
+ | --- | --- |
15
+ | 「新套件 pi-evals,移除 session doctor」 | A new package. pi-session-doctor profiles event-loop stalls and never reads transcripts (inventory §5), so nothing of it carries over; its removal happens in the setup repository, not here. |
16
+ | 「回頭抽取+小觀察器」 | A read-only back-fill over the session files, plus a small live observer only for what those files lack. |
17
+ | 「自己產出靜態網頁」 | Our own static HTML report, not a hosted or self-hosted trace server. |
18
+ | 「可能會需要重新撰寫我們自己的 ask user … or monitor 如果他們沒有提供能記錄蹤跡的接口」 | No rewrite. The ask-user tool's results already hold the questions' count, cancel flag and wait time, and its `rpiv:ask-user:*` events show where an answer came from; pi-loop-monitor emits `monitor:started/finished/done/error` on `pi.events` with everything a record needs (instrumentation §2, §5). The observer listens; both packages stay untouched. |
19
+ | 「用 pi command 操作,這樣 agent 也可以自己去看」 | `/evals` (status, extract, report, mark) is the main surface, and one tool, `evals_query`, lets an agent read bounded summaries. The CLI is a thin wrapper over the same functions. |
20
+ | 「報表的設計會很重要,要注重人類可讀性,最好是可以記錄我做出的架構調整所造成的影響」 | A change timeline (pins, model routing, rules, skills, agent roles, live version changes, manual marks) with the same numbers before and after each change. The data (ReportModel, `model.json`) is separate from the renderer; this release ships a plain renderer, and the designed one will replace it after a mockup round. |
21
+ | 「先索引,穩定後再開清理」 | No cleanup code. `/evals status` and `evals_query coverage` report how many session files older than the cut (default 60 days without changes) the index fully covers, by count and bytes: the gate before a retention tool may delete them. Extra session roots (a future trash dir) are a setting. |
22
+ | 「記得我對 evals 是門外漢,你的報表和標記網頁要讓我有辦法看懂」 | Every metric and detector in the ReportModel carries a label, one sentence of meaning, the better direction, one sentence on how it is computed, and for detectors a pass and a fail example, in English and Traditional Chinese. No unexplained statistics terms in what the reader sees. |
23
+
24
+ Later phases, not built here, each with a seam left open: human labels (phase 2; `labels.jsonl` is joined if present), with-and-without-skill A/B runs (phase 3), and session cleanup through a retention tool once the index covers old sessions (phase 4; `extraRoots` reads its trash dir).
25
+
26
+ ## Decisions
27
+
28
+ ### One record shape, OTel names
29
+
30
+ OpenTelemetry's GenAI conventions already name the facts asked for: `execute_tool` spans with an agent-skills refinement (`gen_ai.skill.name`, `gen_ai.skill.resource.name`), `invoke_agent`, usage tokens, and the `gen_ai.evaluation.result` event (literature §2).
31
+ pi-evals uses those names, `pi.*` for pi facts, `anchorloop.*` for process facts, and `eval.annotator_kind` / `eval.scope` from OpenInference's annotation model, since OTel has no evaluation scope yet.
32
+ The session is an attribute (`session.id`), not a span, as pi-otel argues; a trace is one user prompt (literature §2, §4).
33
+ Skill use is counted from tool calls and expansions, never from text mentions: cc-skill-usage measured a 212-fold overcount from grepping names (literature §2).
34
+ A shell command counts as a skill load only when the whole command prints one `SKILL.md`; on the real corpus a looser rule counted 6,560 "loads" that were mostly searches and edits of skill files, against 21 under the strict rule.
35
+
36
+ ### Privacy by construction
37
+
38
+ Sessions hold customer and ticket content and secrets (inventory, Gotchas; research §6).
39
+ Records hold derived facts only, and the guard is in the record builder: every string attribute must look like a name or it becomes `redacted`.
40
+ The summary keys (tool, skill, model and role names) pass the same check, because a model can choose a tool name or a path freely.
41
+ The privacy test was written first and failed on exactly that: a secret placed in a read path and a tool name reached `days.json` and the report through the summary keys while the records stayed clean.
42
+
43
+ ### Back-fill
44
+
45
+ The session files hold almost everything (instrumentation §5): tool calls with `durationMs` (from October on; older calls use the time between call and result), the ask-user results in both the current and the retired `pi-ask-user` shapes, the skill catalog pi offered (the system message's `skills` section), monitor endings delivered as `pi-loop-monitor` messages, and close-guard notices.
46
+ Extraction streams each file line by line on a pool of worker threads and writes one record file per session file atomically.
47
+ It is incremental by path, size and modification time, so a later extract reads only active sessions; an extractor version in the checkpoint forces a full re-read when extraction changes.
48
+ A subagent session is linked to its parent three ways: the parent's `subagent` result (`details.id`, the child's logical id), `~/.pi/agent/dispatch-ledger/<parent>.json`, and the artifacts path in the child's brief.
49
+ Live records and back-fill meet by session id: back-fill counts win, and live adds monitor lifecycles and answer sources.
50
+
51
+ ### Live observer
52
+
53
+ It registers handlers and nothing heavy: one tool-owner snapshot per session from `pi.getAllTools()` sourceInfo, the nearest `package.json` for name and version (instrumentation §1: "do not infer ownership from names"), a record per `tool_execution_end` (which also fires for blocked, aborted and invalid calls), skill loads from reads, `/skill:` input and declared-skills messages, `monitor:*` events, and `rpiv:ask-user:answer` to tag remote answers.
54
+ It appends to the state dir, never to the session file, and a failed write warns once per session and is otherwise ignored.
55
+
56
+ ### Process detectors
57
+
58
+ Four session-scoped checks, each a `gen_ai.evaluation.result` with `annotator_kind` CODE.
59
+ Anchor and change reading is ported from anchorloop's close guard (`pi/close-guard.ts` `read()`, 3.3.0), whose repository rules keep the guard small, so the evals live outside it (inventory §1).
60
+
61
+ - `anchor_before_first_edit`: an `Anchor:` line or todo anchor appears before the first successful `write` or `edit`. An anchor stated only in a subagent's brief is still a fail, named `anchor_only_in_brief`, so the report can tell the two apart.
62
+ - `check_after_last_edit`: every command of the anchor has a passing run after the last change.
63
+ - `todo_evidence`: completed tasks in the final todo list carry evidence; the value is the share that do.
64
+ - `close_guard_quiet`: an editing session got no close-guard reminder about a missing or failing check (an evidence hand-off reminder does not count).
65
+
66
+ Only sessions that started after anchorloop 3.0.0 reached this setup are judged: the pin commit in weihung-basic-agent, 2026-11-23T10:51:07Z. Older sessions are out of scope rather than failing (inventory, Gotchas), and they are left out of the "not applicable" counts.
67
+ Like the guard, an edit made through bash is not seen as a change.
68
+ These are process checks on observable events, which suits a process skill whose path is the product (research §1); they say how often the rules were followed, not whether the work was right.
69
+ A session's anchorloop version is the newest pin in the change timeline at or before the session's start, so a pin at 16:46 splits that day's sessions at 16:46.
70
+
71
+ ### Change impact
72
+
73
+ Each change gets the same handful of numbers for the sessions that started in the 7 days (by default) before the change's time and in the 7 days from it, with the session count on each side.
74
+ The split is by start time, not calendar day: an earlier version split by day and credited a pin's effect to the 588 sessions of that day that ran before the pin.
75
+ Three flags go with each comparison: a side with fewer than 20 sessions is too small to read; a window that reaches before the first session or past the last extract is incomplete, with the days that have data on each side; and other commits inside the windows are counted once each, by the kinds they changed.
76
+ The flags are shown, not hidden: these comparisons hint at an effect and prove none (research §1 on noise: single runs vary by several points).
77
+ With this setup's pace of change almost every comparison has other commits nearby, so the kinds matter more than the count.
78
+
79
+ ### Report
80
+
81
+ The ReportModel holds every number with its n and window, and the plain-language metadata; the renderer reads only it.
82
+ The HTML has no scripts, no network and no external assets, uses inline SVG, and follows the system's light or dark setting.
83
+ It renders in Traditional Chinese by default (`--lang en` for English).
84
+
85
+ ### Storage choices
86
+
87
+ JSON lines and JSON files, no database: the index is rebuilt from per-session summaries in about a second, and the reader needs no service (research §4: everything reduces to files plus one static page).
88
+ Back-filled records take about 0.7 GB for the 23.8 GB corpus; the per-day aggregates the report and the tool read take about 1.5 MB.
89
+
90
+ ## Measured on the maintainer's corpus (2026-11-26)
91
+
92
+ - 21,526 session files, 23.8 GB, read in 21 to 84 seconds with seven workers (285 to 1,130 MB/s over four runs, depending on the disk cache and machine load), peak memory 3.0 to 3.2 GB; with one worker, 129 seconds (185 MB/s) and 1.0 GB. `--workers` caps both. A later extract reads only the files that changed: 23 files in under 2 seconds.
93
+ - 1.40 million records: 1.14 million tool calls, 80,000 detector results, 29,000 prompts, 11,000 skill loads, 7,300 monitor endings.
94
+ - Cross-checks against the raw files: ask-user calls 5,101 by both counts; `SKILL.md` reads on 2026-11-24, 570 raw against 568 counted (the two missing reads failed); one session's 73 tool calls, 73 in its summary and 73 records.
95
+ - Sixty random text samples from transcripts (messages, thinking, tool arguments) appear in no file under the state dir.
package/docs/schema.md ADDED
@@ -0,0 +1,68 @@
1
+ # Record schema, version 1
2
+
3
+ Live records (`events/<YYYY-MM-DD>.jsonl`) and back-filled records (`index/records/<YYYY-MM>/<key>.jsonl`) share one shape: one JSON object per line.
4
+ Names follow the [OpenTelemetry GenAI semantic conventions](https://github.com/open-telemetry/semantic-conventions-genai) where they define one (status: Development); `pi.*` names pi facts, `anchorloop.*` names process facts, and `eval.*` names evaluation metadata that OTel does not define yet.
5
+ The envelope is shaped so a replay to an OTLP backend needs no renaming.
6
+
7
+ ## Envelope
8
+
9
+ | Field | Type | Meaning |
10
+ | --- | --- | --- |
11
+ | `schema_version` | number | `1`. Additive changes keep the version; a removed or renamed field raises it. |
12
+ | `name` | string | Span or event name, from the table below. |
13
+ | `kind` | `"span"` \| `"event"` | A span has a duration; an event is a point in time. |
14
+ | `ts` | ISO 8601 UTC | Start of a span, or the time of an event. |
15
+ | `end_ts`, `duration_ms` | ISO, number | End and length of a span, when known. |
16
+ | `trace_id` | 32 hex | One trace per user prompt: everything from one prompt to the next. Stable across re-extraction. |
17
+ | `span_id` | 16 hex | Stable id derived from the session id and the entry or tool call id. |
18
+ | `source` | `"backfill"` \| `"live"` | Which reader wrote it. |
19
+ | `attrs` | object | Attributes. Strings must look like names (letters, digits, `_@./:+#=\|-`, at most 160 characters); anything else is stored as `redacted`. |
20
+
21
+ Every record carries `session.id` (the pi session id from the session header) and `pi.project` (a short project key: the repository name for `~/projects/<repo>/…` and for Herdr worktrees, else the first path segment).
22
+
23
+ ## Records
24
+
25
+ | Name | Kind | Attributes |
26
+ | --- | --- | --- |
27
+ | `pi.session` | event | `pi.session.kind` (`interactive` \| `subagent`), `pi.subagent.logical_id`, `pi.session.parent_id`, `gen_ai.request.model` (last model), `pi.tool_calls`, `pi.usage.cost_usd`. Back-fill writes it when a session file ends (`ts` start, `end_ts` last entry); live writes it at session start. |
28
+ | `invoke_agent` | span | One per user prompt (the trace root). `gen_ai.operation.name` = `invoke_agent`, `gen_ai.agent.name` = `pi`, `pi.prompt.origin` (`user` \| `skill_command` \| `extension`), and in back-fill `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.usage.cache_read.input_tokens`, `gen_ai.usage.cache_write.input_tokens`, `pi.usage.cost_usd`, `pi.tool_calls` for the whole prompt. |
29
+ | `execute_tool` | span | One per finished tool call, including failed, blocked and aborted calls. `gen_ai.operation.name` = `execute_tool`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `error.type` (`tool_error` when the result is an error), `pi.duration.source` (`measured` \| `timestamps` \| `not_run`), `pi.tool.exit_code` (bash). Live adds `pi.tool.owner` and `pi.tool.owner_version` from `pi.getAllTools()` sourceInfo, and `pi.tool.parent_call` for nested calls. A read of a skill file adds `gen_ai.skill.name` and, for files other than `SKILL.md`, `gen_ai.skill.resource.name` (the OTel agent-skills refinement applied to pi's `read`). Ask-user calls add `pi.ask_user.questions`, `pi.ask_user.cancelled`, `pi.ask_user.source` (`terminal` \| `remote` \| `none` live; `unknown` in back-fill). Subagent launches add `gen_ai.agent.name` (role), `gen_ai.request.model`, `pi.subagent.logical_id`. |
30
+ | `pi.skill.load` | event | `gen_ai.skill.name`, `pi.skill.trigger` (`read` \| `slash` \| `declared` \| `bash`), `gen_ai.tool.call.id` when a tool call loaded it. Count skill use from these records only; the skill attributes on `execute_tool` describe the same read. |
31
+ | `pi.monitor` | span | `pi.monitor.id` (per session), `pi.monitor.status` (`completed` \| `error` \| `stopped` \| …), `pi.monitor.exit_code`, `pi.monitor.output_lines`, `pi.monitor.reported_status` (live). Back-fill sees only the endings pi-loop-monitor delivered to the session (about half); live sees every `monitor:*` event. |
32
+ | `anchorloop.close_guard.notice` | event | `anchorloop.notice.kind`: `no_anchor`, `no_passing_run`, `evidence_handoff`, `other`. |
33
+ | `gen_ai.evaluation.result` | event | One per process detector per session. `gen_ai.evaluation.name`, `gen_ai.evaluation.score.label` (`pass` \| `fail` \| `na`), `gen_ai.evaluation.score.value` (1, 0, or a share), `gen_ai.evaluation.explanation` (a fixed reason code), `eval.annotator_kind` = `CODE`, `eval.scope` = `session`, `eval.detector.version`. |
34
+ | `pi.compaction` | event | A compaction entry in the session. |
35
+ | `pi.tools.snapshot` | event | Live, once per session at the first prompt: `pi.tools`, a sorted list of `tool=owner@version`. |
36
+ | `pi.skills.available` | event | Live, once per session: `pi.skills`, the names of the skills pi offered. |
37
+
38
+ ### Process detectors
39
+
40
+ | `gen_ai.evaluation.name` | `pass` | `fail` explanations | `na` explanations |
41
+ | --- | --- | --- | --- |
42
+ | `anchor_before_first_edit` | `anchor_first` | `change_before_anchor`, `anchor_only_in_brief` | `no_edit` |
43
+ | `check_after_last_edit` | `anchor_green` | `no_passing_run_after_change` | `no_edit`, `no_anchor`, `anchor_without_command` |
44
+ | `todo_evidence` | `all_evidenced` | `completed_without_evidence` (value = share with evidence) | `no_completed_task` |
45
+ | `close_guard_quiet` | `no_notice` | the commonest notice kind | `no_edit` |
46
+
47
+ Sessions that started before 2026-11-23T10:51:07Z (the anchorloop 3.0.0 pin) get `na` with `out_of_scope_pre_3.0` for all four.
48
+
49
+ ## Labels (for a later phase)
50
+
51
+ `labels.jsonl` in the state dir, one human verdict per line:
52
+
53
+ ```json
54
+ { "session_id": "01a2…", "evaluation_name": "anchor_before_first_edit", "label": "fail", "at": "2026-12-01T09:00:00Z", "note": "optional" }
55
+ ```
56
+
57
+ The report joins these with `index/session-evals.json` (the code labels per session) and shows how often they agree.
58
+
59
+ ## Change timeline
60
+
61
+ `changes.jsonl`, rebuilt by every extract, one change per line:
62
+
63
+ ```json
64
+ { "at": "2026-11-25T08:12:00.000Z", "kind": "pin", "subject": "commit subject", "package": "pi-anchorloop", "from": "3.2.0", "to": "3.3.0", "sha": "7614445…", "repo": "weihung-basic-agent", "source": "git" }
65
+ ```
66
+
67
+ `kind` is `pin`, `model-routing`, `rule`, `skill`, `agent-role`, or `manual`; `source` is `git`, `live` (a version change between two live tool snapshots) or `mark` (`/evals mark`).
68
+ Unlike records, `subject` is free text: a commit subject or your own note.
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "pi-evals",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
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
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "wayne930242",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/wayne930242/pi-evals.git"
11
+ },
12
+ "homepage": "https://github.com/wayne930242/pi-evals#readme",
13
+ "keywords": [
14
+ "pi-package",
15
+ "pi",
16
+ "pi-coding-agent",
17
+ "extension",
18
+ "evals",
19
+ "telemetry",
20
+ "skills",
21
+ "opentelemetry"
22
+ ],
23
+ "bin": {
24
+ "pi-evals": "./dist/cli.js"
25
+ },
26
+ "files": [
27
+ "src",
28
+ "dist",
29
+ "docs",
30
+ "README.md",
31
+ "CHANGELOG.md",
32
+ "LICENSE"
33
+ ],
34
+ "pi": {
35
+ "extensions": [
36
+ "./src/index.ts"
37
+ ]
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.build.json",
41
+ "check": "tsc --noEmit",
42
+ "test": "npm run build && node --test --test-force-exit tests/*.test.ts",
43
+ "prepack": "npm run build"
44
+ },
45
+ "engines": {
46
+ "node": ">=22.18"
47
+ },
48
+ "peerDependencies": {
49
+ "@earendil-works/pi-coding-agent": "*",
50
+ "typebox": "*"
51
+ },
52
+ "devDependencies": {
53
+ "@earendil-works/pi-coding-agent": "1.6.1",
54
+ "@types/node": "26.6.10",
55
+ "typebox": "1.4.7",
56
+ "typescript": "7.0.2"
57
+ }
58
+ }