@hassangameryt/freeflow 0.8.0 → 0.9.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 (290) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +3 -3
  5. package/.cursor-plugin/plugin.json +1 -1
  6. package/README.md +96 -149
  7. package/capabilities/cognitive-routing/SKILL.md +21 -129
  8. package/capabilities/cognitive-routing/references/coordinator.md +163 -0
  9. package/capabilities/cognitive-routing/references/worker.md +38 -0
  10. package/capabilities/compaction/SKILL.md +3 -3
  11. package/capabilities/compaction/references/summary-format.md +26 -15
  12. package/capabilities/messaging/SKILL.md +49 -0
  13. package/capabilities/task-memory/SKILL.md +87 -0
  14. package/command-surface.json +6 -54
  15. package/gemini-extension.json +1 -1
  16. package/hooks/claude/hooks.json +13 -3
  17. package/hooks/codex/hooks.json +2 -1
  18. package/hooks/shared/runtime-context.mjs +69 -77
  19. package/package.json +25 -8
  20. package/pi-extension/dist/ask-user/ask.js +108 -0
  21. package/pi-extension/dist/ask-user/form.js +250 -0
  22. package/pi-extension/dist/ask-user/questions.js +66 -0
  23. package/pi-extension/dist/ask-user/tool.js +124 -0
  24. package/pi-extension/dist/cognitive-routing/assembler.js +35 -11
  25. package/pi-extension/dist/cognitive-routing/bootstrap.js +90 -0
  26. package/pi-extension/dist/cognitive-routing/config.js +3 -4
  27. package/pi-extension/dist/cognitive-routing/event-store.js +4 -1
  28. package/pi-extension/dist/cognitive-routing/gate.js +20 -5
  29. package/pi-extension/dist/cognitive-routing/handlers.js +15 -13
  30. package/pi-extension/dist/cognitive-routing/model-control.js +17 -8
  31. package/pi-extension/dist/cognitive-routing/projection.js +23 -6
  32. package/pi-extension/dist/cognitive-routing/provenance.js +3 -1
  33. package/pi-extension/dist/cognitive-routing/render.js +15 -15
  34. package/pi-extension/dist/cognitive-routing/runtime.js +4 -2
  35. package/pi-extension/dist/cognitive-routing/schemas.js +4 -4
  36. package/pi-extension/dist/cognitive-routing/session.js +3 -1
  37. package/pi-extension/dist/cognitive-routing/sources.js +29 -4
  38. package/pi-extension/dist/cognitive-routing/state.js +18 -8
  39. package/pi-extension/dist/cognitive-routing/status.js +4 -3
  40. package/pi-extension/dist/cognitive-routing/tools.js +29 -15
  41. package/pi-extension/dist/cognitive-routing/types.js +10 -1
  42. package/pi-extension/dist/compaction/carry.js +36 -22
  43. package/pi-extension/dist/compaction/config.js +4 -2
  44. package/pi-extension/dist/compaction/controller.js +52 -29
  45. package/pi-extension/dist/compaction/harness.js +19 -3
  46. package/pi-extension/dist/compaction/results.js +14 -13
  47. package/pi-extension/dist/compaction/tool.js +6 -6
  48. package/pi-extension/dist/host/catalog.js +20 -35
  49. package/pi-extension/dist/host/config-validation.js +233 -0
  50. package/pi-extension/dist/host/config.js +78 -91
  51. package/pi-extension/dist/host/inbound.js +142 -0
  52. package/pi-extension/dist/host/projection-tags.js +1 -1
  53. package/pi-extension/dist/host/prompts.js +24 -13
  54. package/pi-extension/dist/host/read-only-session.js +6 -1
  55. package/pi-extension/dist/host/request-history.js +7 -3
  56. package/pi-extension/dist/host/rows.js +25 -0
  57. package/pi-extension/dist/host/runtime-state.js +17 -2
  58. package/pi-extension/dist/host/section-keeper.js +85 -0
  59. package/pi-extension/dist/host/settings/freeflow-command.js +846 -93
  60. package/pi-extension/dist/host/settings/settings-view.js +27 -8
  61. package/pi-extension/dist/host/status.js +19 -5
  62. package/pi-extension/dist/index.js +638 -72
  63. package/pi-extension/dist/messaging/config.js +27 -0
  64. package/pi-extension/dist/messaging/messaging.js +398 -0
  65. package/pi-extension/dist/messaging/registry.js +57 -0
  66. package/pi-extension/dist/messaging/render.js +90 -0
  67. package/pi-extension/dist/messaging/tools.js +109 -0
  68. package/pi-extension/dist/messaging/transport.js +101 -0
  69. package/pi-extension/dist/provider-support/cache/keepalive.js +16 -4
  70. package/pi-extension/dist/task-memory/config.js +49 -0
  71. package/pi-extension/dist/task-memory/registry.js +119 -0
  72. package/pi-extension/dist/task-memory/render.js +107 -0
  73. package/pi-extension/dist/task-memory/runtime.js +994 -0
  74. package/pi-extension/dist/task-memory/tool.js +233 -0
  75. package/pi-extension/dist/tool-execution/apply-patch/tool.js +1 -1
  76. package/pi-extension/dist/tool-execution/background.js +220 -28
  77. package/pi-extension/dist/tool-execution/config.js +14 -3
  78. package/pi-extension/dist/tool-execution/file-tracking.js +24 -4
  79. package/pi-extension/dist/tool-execution/guidance-notices.js +124 -0
  80. package/pi-extension/dist/tool-execution/skill-reads.js +143 -0
  81. package/pi-extension/dist/tool-execution/tools.js +2 -2
  82. package/runtime/prompts/cognitive-routing.md +4 -4
  83. package/runtime/prompts/core.md +24 -14
  84. package/runtime/prompts/interaction-contract.md +7 -4
  85. package/runtime/prompts/tool-execution.md +3 -16
  86. package/runtime/prompts/working-method.md +16 -99
  87. package/skills/deliver-work/SKILL.md +76 -0
  88. package/skills/deliver-work/references/branch-closeout.md +134 -0
  89. package/skills/deliver-work/references/commit.md +83 -0
  90. package/skills/deliver-work/references/launch.md +94 -0
  91. package/skills/deliver-work/references/release.md +85 -0
  92. package/skills/deliver-work/scripts/commit-state.mjs +139 -0
  93. package/skills/deliver-work/scripts/delivery-state.mjs +107 -0
  94. package/skills/deliver-work/scripts/lib/git-state.mjs +178 -0
  95. package/skills/deliver-work/scripts/push-route.mjs +122 -0
  96. package/skills/deliver-work/scripts/release-preflight.mjs +177 -0
  97. package/skills/discuss-work/SKILL.md +148 -0
  98. package/skills/{discuss → discuss-work}/references/discussion-continuity.md +10 -27
  99. package/skills/discuss-work/references/learning-action.md +36 -0
  100. package/skills/discuss-work/scripts/choices.mjs +101 -0
  101. package/skills/discuss-work/scripts/lib/choices.mjs +159 -0
  102. package/skills/evaluate-behavior/SKILL.md +107 -0
  103. package/skills/evaluate-behavior/references/authoring.md +381 -0
  104. package/skills/evaluate-behavior/references/coding-tasks.md +145 -0
  105. package/skills/evaluate-behavior/references/conversations-pipelines-judges.md +177 -0
  106. package/skills/evaluate-behavior/references/design-and-measurement.md +273 -0
  107. package/skills/evaluate-behavior/references/running-and-evidence.md +245 -0
  108. package/skills/evaluate-behavior/scripts/claude-guard.mjs +76 -0
  109. package/skills/evaluate-behavior/scripts/guard-rules.mjs +309 -0
  110. package/skills/evaluate-behavior/scripts/lib/agreement.mjs +90 -0
  111. package/skills/evaluate-behavior/scripts/lib/arms.mjs +55 -0
  112. package/skills/evaluate-behavior/scripts/lib/budget.mjs +87 -0
  113. package/skills/evaluate-behavior/scripts/lib/build-source.mjs +287 -0
  114. package/skills/evaluate-behavior/scripts/lib/clear.mjs +74 -0
  115. package/skills/evaluate-behavior/scripts/lib/container.mjs +395 -0
  116. package/skills/evaluate-behavior/scripts/lib/decision.mjs +418 -0
  117. package/skills/evaluate-behavior/scripts/lib/definitions.mjs +1072 -0
  118. package/skills/evaluate-behavior/scripts/lib/freeflow.mjs +103 -0
  119. package/skills/evaluate-behavior/scripts/lib/grade-command.mjs +591 -0
  120. package/skills/evaluate-behavior/scripts/lib/grade-comparison.mjs +90 -0
  121. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-interaction.mjs +19 -18
  122. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-support.mjs +32 -5
  123. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-workspace.mjs +28 -12
  124. package/skills/evaluate-behavior/scripts/lib/grade.mjs +101 -0
  125. package/skills/evaluate-behavior/scripts/lib/hooks.mjs +98 -0
  126. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/confinement.mjs +196 -0
  127. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/constraints.mjs +111 -0
  128. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/index.mjs +48 -0
  129. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/isolation.mjs +74 -0
  130. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/launch.mjs +123 -0
  131. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/model-call.mjs +73 -0
  132. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/recorder.mjs +178 -0
  133. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/session.mjs +494 -0
  134. package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/skills.mjs +81 -0
  135. package/skills/evaluate-behavior/scripts/lib/hosts/index.mjs +31 -0
  136. package/skills/evaluate-behavior/scripts/lib/hosts/names.mjs +3 -0
  137. package/skills/evaluate-behavior/scripts/lib/hosts/pi/confinement.mjs +173 -0
  138. package/skills/evaluate-behavior/scripts/lib/hosts/pi/host.mjs +148 -0
  139. package/skills/evaluate-behavior/scripts/lib/hosts/pi/index.mjs +70 -0
  140. package/skills/evaluate-behavior/scripts/lib/hosts/pi/isolation.mjs +81 -0
  141. package/skills/evaluate-behavior/scripts/lib/hosts/pi/model-call.mjs +79 -0
  142. package/skills/evaluate-behavior/scripts/lib/hosts/pi/process.mjs +241 -0
  143. package/skills/{evaluate-skill/scripts/lib → evaluate-behavior/scripts/lib/hosts/pi}/rpc.mjs +144 -26
  144. package/skills/evaluate-behavior/scripts/lib/identity.mjs +82 -0
  145. package/skills/evaluate-behavior/scripts/lib/judge.mjs +688 -0
  146. package/skills/evaluate-behavior/scripts/lib/metrics.mjs +332 -0
  147. package/skills/evaluate-behavior/scripts/lib/model-call.mjs +17 -0
  148. package/skills/evaluate-behavior/scripts/lib/participants.mjs +616 -0
  149. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/process.mjs +22 -0
  150. package/skills/evaluate-behavior/scripts/lib/queue.mjs +54 -0
  151. package/skills/evaluate-behavior/scripts/lib/reference.mjs +343 -0
  152. package/skills/evaluate-behavior/scripts/lib/reuse.mjs +277 -0
  153. package/skills/evaluate-behavior/scripts/lib/review.mjs +933 -0
  154. package/skills/evaluate-behavior/scripts/lib/runner.mjs +732 -0
  155. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/sandbox.mjs +119 -14
  156. package/skills/evaluate-behavior/scripts/lib/scan-shell.mjs +457 -0
  157. package/skills/evaluate-behavior/scripts/lib/scan.mjs +479 -0
  158. package/skills/evaluate-behavior/scripts/lib/seal.mjs +91 -0
  159. package/skills/evaluate-behavior/scripts/lib/shell.mjs +560 -0
  160. package/skills/evaluate-behavior/scripts/lib/source-override.mjs +64 -0
  161. package/skills/evaluate-behavior/scripts/lib/subject-file.mjs +88 -0
  162. package/skills/{evaluate-skill/scripts/lib/pi.mjs → evaluate-behavior/scripts/lib/subject.mjs} +235 -265
  163. package/skills/evaluate-behavior/scripts/lib/task-copy.mjs +124 -0
  164. package/skills/evaluate-behavior/scripts/lib/trials.mjs +524 -0
  165. package/skills/evaluate-behavior/scripts/lib/validity.mjs +68 -0
  166. package/skills/evaluate-behavior/scripts/lib/view-html.mjs +454 -0
  167. package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/view.mjs +159 -18
  168. package/skills/{evaluate-skill → evaluate-behavior}/scripts/pi-command-tool.mjs +21 -6
  169. package/skills/evaluate-behavior/scripts/pi-container-route.mjs +23 -0
  170. package/skills/evaluate-behavior/scripts/pi-guard.mjs +77 -0
  171. package/skills/evaluate-behavior/scripts/pi-login-refresh.mjs +31 -0
  172. package/skills/evaluate-behavior/scripts/skill-eval.mjs +586 -0
  173. package/skills/execute-work/SKILL.md +96 -104
  174. package/skills/execute-work/references/code-practices.md +27 -51
  175. package/skills/execute-work/references/design.md +271 -0
  176. package/skills/execute-work/references/diagnose.md +117 -0
  177. package/skills/execute-work/references/migration.md +108 -0
  178. package/skills/execute-work/references/simplify.md +65 -0
  179. package/skills/execute-work/scripts/self-review.mjs +422 -0
  180. package/skills/execute-work/scripts/touch-map.mjs +290 -0
  181. package/skills/review-work/SKILL.md +89 -65
  182. package/skills/review-work/references/adjudication.md +94 -0
  183. package/skills/review-work/references/artifact.md +198 -0
  184. package/skills/review-work/references/evals-and-judges.md +66 -0
  185. package/skills/review-work/references/work.md +177 -0
  186. package/skills/review-work/scripts/check-brief.mjs +128 -0
  187. package/skills/review-work/scripts/review-packet.mjs +233 -0
  188. package/skills/setup-freeflow/SKILL.md +68 -17
  189. package/skills/track-work/SKILL.md +52 -20
  190. package/skills/track-work/references/handoff.md +190 -0
  191. package/skills/track-work/references/projects.md +51 -0
  192. package/skills/track-work/references/working-record-format.md +36 -18
  193. package/skills/track-work/scripts/lib/document.mjs +17 -13
  194. package/skills/track-work/scripts/lib/format.mjs +2 -0
  195. package/skills/track-work/scripts/lib/recover.mjs +254 -0
  196. package/skills/track-work/scripts/lib/registry.mjs +656 -0
  197. package/skills/track-work/scripts/lib/search.mjs +40 -0
  198. package/skills/track-work/scripts/lib/store.mjs +46 -15
  199. package/skills/track-work/scripts/lib/views.mjs +50 -1
  200. package/skills/track-work/scripts/working-record.mjs +232 -13
  201. package/skills/verify-work/SKILL.md +45 -37
  202. package/skills/verify-work/references/feature-map.md +120 -0
  203. package/skills/verify-work/references/runtime-evidence.md +203 -0
  204. package/skills/verify-work/references/test-design.md +25 -6
  205. package/skills/verify-work/scripts/test-changes.mjs +246 -0
  206. package/skills/write-docs/SKILL.md +113 -25
  207. package/skills/write-docs/references/documentation-shapes.md +68 -3
  208. package/skills/write-docs/references/spec-and-plan-shapes.md +308 -0
  209. package/skills/write-docs/scripts/artifact-check.mjs +148 -0
  210. package/skills/write-docs/scripts/docs-check.mjs +96 -6
  211. package/skills/write-docs/scripts/plan-lint.mjs +123 -0
  212. package/skills/write-skill/SKILL.md +92 -52
  213. package/skills/write-skill/references/activation-and-wording.md +143 -0
  214. package/skills/write-skill/references/placement-and-dependencies.md +154 -0
  215. package/skills/write-skill/scripts/lib/compare.mjs +701 -0
  216. package/skills/write-skill/scripts/lib/skill-author.mjs +197 -3
  217. package/skills/write-skill/scripts/skill-author.mjs +51 -8
  218. package/capabilities/cognitive-routing/references/both-mode.md +0 -36
  219. package/capabilities/cognitive-routing/references/executor-mode.md +0 -48
  220. package/capabilities/cognitive-routing/references/helper-mode.md +0 -47
  221. package/plugin.json +0 -33
  222. package/skills/action-selection/SKILL.md +0 -92
  223. package/skills/action-selection/references/trajectory-stalls.md +0 -73
  224. package/skills/bypass/SKILL.md +0 -153
  225. package/skills/commit-work/SKILL.md +0 -93
  226. package/skills/commit-work/references/git-state-edges.md +0 -94
  227. package/skills/commit-work/references/simple-push.md +0 -94
  228. package/skills/commit-work/references/staging-decisions.md +0 -106
  229. package/skills/decision-gate/SKILL.md +0 -87
  230. package/skills/design-for-depth/SKILL.md +0 -108
  231. package/skills/design-for-depth/references/design-pressure-signals.md +0 -84
  232. package/skills/design-for-depth/references/implementation-decisions.md +0 -76
  233. package/skills/design-for-depth/references/interface-design-loop.md +0 -105
  234. package/skills/design-for-depth/references/module-and-dependency-design.md +0 -117
  235. package/skills/design-for-depth/references/state-and-failure-boundaries.md +0 -125
  236. package/skills/diagnose-failure/SKILL.md +0 -140
  237. package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +0 -50
  238. package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +0 -51
  239. package/skills/discuss/SKILL.md +0 -140
  240. package/skills/evaluate-skill/SKILL.md +0 -188
  241. package/skills/evaluate-skill/references/evaluation-definition-schema.md +0 -415
  242. package/skills/evaluate-skill/references/evaluation-design.md +0 -112
  243. package/skills/evaluate-skill/references/execution-and-evidence.md +0 -111
  244. package/skills/evaluate-skill/references/review-and-revision.md +0 -94
  245. package/skills/evaluate-skill/scripts/lib/definitions.mjs +0 -448
  246. package/skills/evaluate-skill/scripts/lib/grade-comparison.mjs +0 -60
  247. package/skills/evaluate-skill/scripts/lib/grade.mjs +0 -64
  248. package/skills/evaluate-skill/scripts/lib/review.mjs +0 -196
  249. package/skills/evaluate-skill/scripts/lib/runner.mjs +0 -405
  250. package/skills/evaluate-skill/scripts/lib/trials.mjs +0 -103
  251. package/skills/evaluate-skill/scripts/pi-guard.mjs +0 -181
  252. package/skills/evaluate-skill/scripts/skill-eval.mjs +0 -182
  253. package/skills/execute-work/references/execute-work-edges.md +0 -78
  254. package/skills/finish-branch/SKILL.md +0 -117
  255. package/skills/finish-branch/references/integration-options.md +0 -80
  256. package/skills/handoff/SKILL.md +0 -82
  257. package/skills/handoff/references/handoff-templates.md +0 -150
  258. package/skills/launch-work/SKILL.md +0 -116
  259. package/skills/launch-work/references/launch-readiness.md +0 -85
  260. package/skills/migration-work/SKILL.md +0 -115
  261. package/skills/migration-work/references/migration-lifecycle.md +0 -82
  262. package/skills/release-work/SKILL.md +0 -118
  263. package/skills/release-work/references/release-evidence.md +0 -78
  264. package/skills/review-artifact/SKILL.md +0 -143
  265. package/skills/review-artifact/references/adjudicate-artifact-review.md +0 -101
  266. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +0 -159
  267. package/skills/review-work/references/adjudicate-work-review.md +0 -97
  268. package/skills/review-work/references/independent-work-reviewer-contract.md +0 -139
  269. package/skills/review-work/references/security-risk-lens.md +0 -67
  270. package/skills/setup-freeflow/references/activation-contract.md +0 -103
  271. package/skills/setup-freeflow/references/host-setup.md +0 -67
  272. package/skills/simplify-code/SKILL.md +0 -85
  273. package/skills/simplify-code/references/simplification-patterns.md +0 -70
  274. package/skills/verify-work/references/browser-runtime-evidence.md +0 -51
  275. package/skills/verify-work/references/integration-evidence.md +0 -49
  276. package/skills/verify-work/references/performance-evidence.md +0 -59
  277. package/skills/workflow/SKILL.md +0 -171
  278. package/skills/workflow/references/domain-skill-composition.md +0 -45
  279. package/skills/write-plan/SKILL.md +0 -92
  280. package/skills/write-plan/references/plan-shapes.md +0 -156
  281. package/skills/write-skill/references/activation-boundaries.md +0 -106
  282. package/skills/write-skill/references/agent-first-instructions.md +0 -133
  283. package/skills/write-skill/references/progressive-disclosure.md +0 -129
  284. package/skills/write-skill/references/skill-dependency-graphs.md +0 -192
  285. package/skills/write-spec/SKILL.md +0 -85
  286. package/skills/write-spec/references/artifact-standards.md +0 -86
  287. package/skills/write-spec/references/decision-records.md +0 -80
  288. package/skills/write-spec/references/spec-shapes.md +0 -143
  289. /package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/evidence.mjs +0 -0
  290. /package/skills/{evaluate-skill → evaluate-behavior}/scripts/pi-observer.mjs +0 -0
@@ -1,7 +1,13 @@
1
1
  import { readFile, realpath, stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
 
4
- const VARIANTS = ["baseline", "candidate"];
4
+ import { ARM_NAME, comparisonArms, storedArms } from "./arms.mjs";
5
+ import { renderClaim, trialCounts } from "./decision.mjs";
6
+ import { judgedAggregateLines, judgedLines } from "./judge.mjs";
7
+ import { aggregateMetricsLines, runMetricsLines } from "./metrics.mjs";
8
+ import { participantLines } from "./participants.mjs";
9
+ import { readClearances } from "./scan.mjs";
10
+
5
11
  const DEFAULT_SELECTORS = /** @type {{group: string | null, variant: string | null}} */ ({
6
12
  group: null,
7
13
  variant: null,
@@ -20,8 +26,12 @@ class ViewError extends Error {
20
26
  * @param {{root?: string}} [options]
21
27
  */
22
28
 
23
- export async function renderResult(target, selectors = DEFAULT_SELECTORS, { root = process.cwd() } = {}) {
24
- const resultDirectory = await resolveResult(target, root);
29
+ export async function renderResult(
30
+ target,
31
+ selectors = DEFAULT_SELECTORS,
32
+ { root = process.cwd(), results = null } = {},
33
+ ) {
34
+ const resultDirectory = await resolveResult(target, root, results);
25
35
  const aggregateFile = path.join(resultDirectory, "aggregate.json");
26
36
  if (await stat(aggregateFile).catch(() => null)) {
27
37
  if (selectors.group !== null || selectors.variant !== null) {
@@ -42,11 +52,31 @@ export async function renderResult(target, selectors = DEFAULT_SELECTORS, { root
42
52
  : groups.filter((group) => group.position === position);
43
53
  if (groups.length === 0) throw new ViewError(`Unknown group selector: ${selectors.group}`);
44
54
  }
45
- if (selectors.variant !== null && !VARIANTS.includes(selectors.variant)) {
46
- throw new ViewError("variant must be baseline or candidate");
55
+ if (selectors.variant !== null && !ARM_NAME.test(selectors.variant)) {
56
+ throw new ViewError("variant must be an arm name, such as baseline or candidate");
47
57
  }
48
58
 
49
59
  const lines = [`Result ${summary.id} [${summary.state}]`, `Path: ${escapeCell(resultDirectory)}`];
60
+ // This invocation's own spend; in a trial, the budget's total is the whole run's so far.
61
+ if (summary.cost) {
62
+ const unmeasured = summary.cost.unmeasured ? [`unmeasured=${summary.cost.unmeasured}`] : [];
63
+ lines.push(
64
+ compactRow("cost", [
65
+ `spent=${formatNumber(summary.cost.spent)}`,
66
+ `subjects=${summary.cost.subjects}`,
67
+ ...unmeasured,
68
+ ]),
69
+ );
70
+ }
71
+ if (summary.budget) {
72
+ lines.push(
73
+ compactRow("budget", [
74
+ `max-cost=${formatNumber(summary.budget.maxCost)}`,
75
+ `run-total=${formatNumber(summary.budget.runTotal ?? summary.budget.spent)}`,
76
+ `exhausted=${summary.budget.exhausted}`,
77
+ ]),
78
+ );
79
+ }
50
80
  for (const group of groups) {
51
81
  lines.push("", ...(await renderGroup(resultDirectory, group, selectors.variant)));
52
82
  }
@@ -58,12 +88,18 @@ async function renderGroup(resultDirectory, group, selectedVariant) {
58
88
  const definition = await readJson(path.join(groupDirectory, "definition.json"), `definition for ${group.id}`);
59
89
  const gradeFile = path.join(groupDirectory, group.artifacts?.grade ?? "deterministic-grade.json");
60
90
  const grade = await readJson(gradeFile, `grade for ${group.id}`);
61
- const variants = selectedVariant === null ? VARIANTS : [selectedVariant];
91
+ const arms = storedArms(group, definition);
92
+ if (selectedVariant !== null && !arms.includes(selectedVariant)) {
93
+ throw new ViewError(`variant ${selectedVariant} is not an arm of group ${group.id}`);
94
+ }
95
+ const variants = selectedVariant === null ? arms : [selectedVariant];
62
96
  const lines = [`Group ${group.id} [${group.state}] type=${definition.type}`];
63
97
 
64
98
  appendSharedEvidence(lines, definition);
65
99
  appendGradeEvidence(lines, grade, group, definition, selectedVariant);
66
- await appendAdvisoryReview(lines, groupDirectory, selectedVariant);
100
+ await appendAdvisoryReview(lines, groupDirectory, variants);
101
+ lines.push(...(await judgedLines(groupDirectory, variants)));
102
+ lines.push(...(await participantLines(groupDirectory, variants)));
67
103
  for (const variant of variants) {
68
104
  await appendVariantEvidence(lines, resultDirectory, groupDirectory, group.id, variant);
69
105
  }
@@ -130,13 +166,26 @@ function appendGradeEvidence(lines, grade, group, definition, selectedVariant) {
130
166
  if (selectedVariant === null && Array.isArray(grade.comparisons) && grade.comparisons.length > 0) {
131
167
  lines.push("Comparisons:");
132
168
  for (const comparison of grade.comparisons) {
169
+ if (comparison.arms === undefined) {
170
+ lines.push(
171
+ compactRow("comparison", [
172
+ comparison.id,
173
+ comparison.kind,
174
+ comparison.transition,
175
+ `baseline=${comparison.baseline.check}:${comparison.baseline.state}`,
176
+ `candidate=${comparison.candidate.check}:${comparison.candidate.state}`,
177
+ ]),
178
+ );
179
+ continue;
180
+ }
181
+ // Each non-reference arm's transition from the reference, then every arm's check and state.
182
+ const { arms, transitions } = comparisonArms(comparison);
133
183
  lines.push(
134
184
  compactRow("comparison", [
135
185
  comparison.id,
136
186
  comparison.kind,
137
- comparison.transition,
138
- `baseline=${comparison.baseline.check}:${comparison.baseline.state}`,
139
- `candidate=${comparison.candidate.check}:${comparison.candidate.state}`,
187
+ ...Object.entries(transitions).map(([arm, transition]) => `${arm}:${transition}`),
188
+ ...Object.entries(arms).map(([arm, outcome]) => `${arm}=${outcome?.check}:${outcome?.state}`),
140
189
  ]),
141
190
  );
142
191
  }
@@ -144,12 +193,11 @@ function appendGradeEvidence(lines, grade, group, definition, selectedVariant) {
144
193
  }
145
194
 
146
195
  // Advisory answers stay visually separate from deterministic grades; they are not canonical evidence.
147
- async function appendAdvisoryReview(lines, groupDirectory, selectedVariant) {
196
+ async function appendAdvisoryReview(lines, groupDirectory, variants) {
148
197
  const file = path.join(groupDirectory, "semantic-grade.json");
149
198
  if (!(await stat(file).catch(() => null))) return;
150
199
  const review = await readJson(file, "advisory review");
151
200
  lines.push(`Advisory review [${review.state}] model=${review.model} (not canonical evidence)`);
152
- const variants = selectedVariant === null ? VARIANTS : [selectedVariant];
153
201
  for (const [index, answer] of (review.answers ?? []).entries()) {
154
202
  lines.push(
155
203
  compactRow("review", [
@@ -159,12 +207,26 @@ async function appendAdvisoryReview(lines, groupDirectory, selectedVariant) {
159
207
  ]),
160
208
  );
161
209
  }
210
+ if (review.subject?.familyRelation) lines.push(compactRow("judge", [`family=${review.subject.familyRelation}`]));
211
+ if (review.swap?.agreement) {
212
+ const { agreed, questions } = review.swap.agreement;
213
+ lines.push(compactRow("judge", [`order swap agreed on ${agreed}/${questions}`]));
214
+ const byArm = Object.entries(review.swap.agreement.arms ?? {});
215
+ if (byArm.length > 0) {
216
+ lines.push(
217
+ compactRow("judge", [
218
+ `order swap agreed per arm: ${byArm.map(([arm, counts]) => `${arm}=${counts.agreed}/${counts.questions}`).join(" ")}`,
219
+ ]),
220
+ );
221
+ }
222
+ }
223
+ for (const gap of review.contractGaps ?? []) lines.push(compactRow("judge", [`contract gap: ${gap}`]));
162
224
  for (const error of review.errors ?? []) lines.push(compactRow("error", ["review", error]));
163
225
  }
164
226
 
165
227
  function renderAggregate(resultDirectory, aggregate) {
166
228
  const lines = [
167
- `Aggregate ${aggregate.id} [${aggregate.state}] trials=${aggregate.trials.length}/${aggregate.requestedTrials}`,
229
+ `Aggregate ${aggregate.id} [${aggregate.state}] trials=${trialCounts(aggregate)}`,
168
230
  `Path: ${escapeCell(resultDirectory)}`,
169
231
  ];
170
232
  if (aggregate.budget) {
@@ -176,10 +238,36 @@ function renderAggregate(resultDirectory, aggregate) {
176
238
  ]),
177
239
  );
178
240
  }
179
- for (const trial of aggregate.trials) lines.push(compactRow("trial", [trial.id, trial.state]));
241
+ for (const entry of aggregate.held ?? []) {
242
+ lines.push(compactRow("held", [entry.trial, entry.group, entry.arm, `flags=${entry.flags.join(",")}`]));
243
+ }
244
+ for (const trial of aggregate.trials) {
245
+ lines.push(
246
+ compactRow("trial", [
247
+ trial.id,
248
+ trial.state,
249
+ ...(trial.cost === undefined ? [] : [`cost=${formatNumber(trial.cost)}`]),
250
+ ]),
251
+ );
252
+ }
253
+ lines.push(...renderClaim(aggregate));
180
254
  for (const group of aggregate.groups) {
181
- lines.push("", `Group ${group.id} trials=${group.trials}`);
255
+ const unreadable = group.unreadableGrades ? ` unreadable-grades=${group.unreadableGrades}` : "";
256
+ const gradeErrors = group.gradeErrors ? ` grade-errors=${group.gradeErrors}` : "";
257
+ lines.push("", `Group ${group.id} trials=${group.trials}${unreadable}${gradeErrors}`);
258
+ for (const [variant, states] of Object.entries(group.runStates ?? {})) {
259
+ const notComplete = Object.entries(states).filter(([state]) => state !== "complete");
260
+ if (notComplete.length > 0) {
261
+ lines.push(
262
+ compactRow("runs", [variant, ...Object.entries(states).map(([state, count]) => `${state}=${count}`)]),
263
+ );
264
+ }
265
+ }
182
266
  for (const comparison of group.comparisons) {
267
+ if (comparison.arms !== undefined) {
268
+ appendArmComparison(lines, comparison);
269
+ continue;
270
+ }
183
271
  lines.push(
184
272
  compactRow("comparison", [
185
273
  comparison.id,
@@ -189,14 +277,56 @@ function renderAggregate(resultDirectory, aggregate) {
189
277
  ...Object.entries(comparison.transitions).map(([transition, count]) => `${transition}=${count}`),
190
278
  ]),
191
279
  );
280
+ if (comparison.pairs) {
281
+ const pairs = Object.entries(comparison.pairs).filter(([, count]) => count > 0);
282
+ lines.push(
283
+ compactRow("comparison", [
284
+ comparison.id,
285
+ `pairs: ${pairs.map(([pair, count]) => `${pair}=${count}`).join(" ")}`,
286
+ ]),
287
+ );
288
+ }
192
289
  }
193
290
  for (const check of group.checks) {
194
- lines.push(compactRow("check", [check.id, check.variant, check.kind, `pass=${passRate(check)}`]));
291
+ const counts =
292
+ typeof check.passAll === "boolean"
293
+ ? [
294
+ `pass=${passRate(check)}`,
295
+ `fail=${check.fail}`,
296
+ `unavailable=${check.unavailable}`,
297
+ `pass^${check.trials}=${check.passAll ? "yes" : "no"}`,
298
+ ]
299
+ : [`pass=${passRate(check)}`];
300
+ lines.push(compactRow("check", [check.id, check.variant, check.kind, ...counts]));
195
301
  }
302
+ lines.push(...aggregateMetricsLines(group.metrics));
303
+ lines.push(...judgedAggregateLines(group.judged));
196
304
  }
197
305
  return `${lines.join("\n")}\n`;
198
306
  }
199
307
 
308
+ /** An arm-keyed aggregate comparison: every arm's pass rate, then each arm's transitions and pairs against the reference. */
309
+ function appendArmComparison(lines, comparison) {
310
+ lines.push(
311
+ compactRow("comparison", [
312
+ comparison.id,
313
+ comparison.kind,
314
+ ...Object.entries(comparison.arms).map(([arm, counts]) => `${arm}=${passRate(counts)}`),
315
+ ]),
316
+ );
317
+ for (const [arm, versus] of Object.entries(comparison.outcomes ?? {})) {
318
+ const pairs = Object.entries(versus.pairs ?? {}).filter(([, count]) => count > 0);
319
+ lines.push(
320
+ compactRow("comparison", [
321
+ comparison.id,
322
+ `${arm} against ${comparison.reference}`,
323
+ ...Object.entries(versus.transitions ?? {}).map(([transition, count]) => `${transition}=${count}`),
324
+ `pairs: ${pairs.map(([pair, count]) => `${pair}=${count}`).join(" ")}`,
325
+ ]),
326
+ );
327
+ }
328
+ }
329
+
200
330
  function passRate(counts) {
201
331
  return `${counts.pass}/${counts.pass + counts.fail + counts.unavailable}`;
202
332
  }
@@ -231,6 +361,12 @@ async function appendVariantEvidence(lines, resultDirectory, groupDirectory, gro
231
361
  lines.push("", `${title(variant)} [${run.state}]`);
232
362
  appendRunEvidence(lines, run);
233
363
  const variantDirectory = path.dirname(runFile);
364
+ // Transcript-scan flags, each with whether a person cleared it and why; an uncleared one holds the run.
365
+ const cleared = new Map((await readClearances(variantDirectory)).map((entry) => [entry.flag, entry.reason]));
366
+ for (const flag of run.postRun?.scan?.flags ?? []) {
367
+ const status = cleared.has(flag.id) ? `cleared: ${cleared.get(flag.id)}` : "not cleared";
368
+ lines.push(compactRow(" flag", [flag.id, flag.detail, status]));
369
+ }
234
370
  const artifacts = [["run", relativeArtifact(resultDirectory, runFile)]];
235
371
  if (typeof run.workspace === "string") {
236
372
  artifacts.push(["workspace", relativeArtifact(resultDirectory, run.workspace)]);
@@ -251,9 +387,13 @@ async function appendVariantEvidence(lines, resultDirectory, groupDirectory, gro
251
387
  );
252
388
  }
253
389
 
254
- export async function resolveResult(target, root) {
390
+ /** A result or aggregate directory: an explicit path, or a stored ID under `results` (default `<root>/.skill-eval/runs`). */
391
+ export async function resolveResult(target, root, results = null) {
255
392
  const explicit = path.resolve(root, target);
256
- const stored = path.join(root, ".skill-eval", "runs", target);
393
+ const stored = path.join(
394
+ results === null ? path.join(root, ".skill-eval", "runs") : path.resolve(root, results),
395
+ target,
396
+ );
257
397
  const isPath = path.isAbsolute(target) || target.includes("/") || target.includes("\\") || target.startsWith(".");
258
398
  const candidates = isPath ? [explicit] : [stored, explicit];
259
399
  for (const candidate of candidates) {
@@ -325,6 +465,7 @@ function appendRunEvidence(lines, run) {
325
465
  if (typeof run.usage.cost?.total === "number") usage.push(`cost=${formatNumber(run.usage.cost.total)}`);
326
466
  lines.push(compactRow(" usage", usage));
327
467
  }
468
+ lines.push(...runMetricsLines(run));
328
469
  if (run.process?.assistantError) lines.push(` assistant-error: ${run.process.assistantError}`);
329
470
  if (run.process?.terminationReason) {
330
471
  lines.push(` termination: ${run.process.terminationReason}`);
@@ -1,6 +1,8 @@
1
1
  import { spawn } from "node:child_process";
2
2
 
3
+ import { containerExecArgv, dockerClientEnvironment, parseContainerTarget } from "./lib/container.mjs";
3
4
  import { COMMAND_TOOL } from "./lib/definitions.mjs";
5
+ import { LOGIN_VARIABLES } from "./lib/hosts/claude-code/isolation.mjs";
4
6
 
5
7
  const DEFAULT_TIMEOUT_MS = 120 * 1000;
6
8
  const OUTPUT_LIMIT_BYTES = 32 * 1024;
@@ -12,8 +14,16 @@ function parseCommands(value) {
12
14
  return parsed;
13
15
  }
14
16
 
17
+ // A declared command runs the workspace's own code, so it gets neither the evaluator's control variables nor a
18
+ // pointer to the login: Pi's agent directory, which holds the copied provider login, and any login variable. On the
19
+ // host this keeps the login out of easy reach, not out of reach (the run's network "host"); in a container the
20
+ // command gets none of this environment at all.
21
+ const WITHHELD = new Set(["PI_CODING_AGENT_DIR", ...LOGIN_VARIABLES]);
22
+
15
23
  function commandEnvironment() {
16
- return Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith("SKILL_EVAL_")));
24
+ return Object.fromEntries(
25
+ Object.entries(process.env).filter(([key]) => !key.startsWith("SKILL_EVAL_") && !WITHHELD.has(key)),
26
+ );
17
27
  }
18
28
 
19
29
  function captureStream(stream) {
@@ -44,13 +54,16 @@ function signalGroup(child, signal) {
44
54
  }
45
55
  }
46
56
 
47
- // Runs one author-declared argv in the workspace. A nonzero exit or timeout is ordinary evidence, not a tool error.
48
- function runCommand(command, cwd, signal) {
57
+ // Runs one author-declared argv in the workspace, or, in a container environment, through `docker exec` in the
58
+ // subject's container, where bash runs too, so both use the image's toolchain. A nonzero exit or timeout is
59
+ // ordinary evidence, not a tool error.
60
+ function runCommand(command, cwd, signal, container) {
49
61
  const timeoutMs = command.timeout_ms ?? DEFAULT_TIMEOUT_MS;
62
+ const argv = container === null ? command.argv : containerExecArgv(container, command.argv);
50
63
  return new Promise((resolve, reject) => {
51
- const child = spawn(command.argv[0], command.argv.slice(1), {
64
+ const child = spawn(argv[0], argv.slice(1), {
52
65
  cwd,
53
- env: commandEnvironment(),
66
+ env: container === null ? commandEnvironment() : dockerClientEnvironment(),
54
67
  shell: false,
55
68
  detached: process.platform !== "win32",
56
69
  stdio: ["ignore", "pipe", "pipe"],
@@ -94,6 +107,8 @@ export default function registerCommandTool(pi) {
94
107
  const workspace = process.env.SKILL_EVAL_WRITABLE_ROOT;
95
108
  if (!workspace) throw new Error("SKILL_EVAL_WRITABLE_ROOT is required");
96
109
  const byId = new Map(commands.map((command) => [command.id, command]));
110
+ // Set by the evaluator only for a container environment; the guard routes bash by the same value.
111
+ const container = parseContainerTarget(process.env.SKILL_EVAL_CONTAINER);
97
112
 
98
113
  pi.registerTool({
99
114
  name: COMMAND_TOOL,
@@ -113,7 +128,7 @@ export default function registerCommandTool(pi) {
113
128
  async execute(_toolCallId, input, signal) {
114
129
  const command = byId.get(input?.command);
115
130
  if (!command) throw new Error(`Command is not declared for this evaluation: ${String(input?.command)}`);
116
- const result = await runCommand(command, workspace, signal);
131
+ const result = await runCommand(command, workspace, signal, container);
117
132
  const status = result.timedOut
118
133
  ? `timed out after ${result.timeoutMs} ms`
119
134
  : `exit code: ${result.exitCode ?? `signal ${result.signal}`}`;
@@ -0,0 +1,23 @@
1
+ // Pi's last extension in a subject with a container environment: it moves each shell tool's command (bash, and
2
+ // Freeflow's bash_background and monitor) into the subject's container. The guard (pi-guard.mjs, loaded first) has
3
+ // already decided the call; this runs after every other extension's tool_call handler, so those handlers see the
4
+ // command the model wrote, and only then does it become the docker client command Pi's shell runs. Pi runs every
5
+ // handler in load order and stops only on a refusal, so a call that runs has passed through here. The guard refuses
6
+ // container shell calls when this extension is not loaded.
7
+
8
+ import { CONTAINER_ROUTE, decideToolCall, guardState, SHELL_TOOLS } from "./guard-rules.mjs";
9
+
10
+ export default function registerSkillEvalContainerRoute(pi) {
11
+ const state = guardState(process.env);
12
+ globalThis[CONTAINER_ROUTE] = true;
13
+ pi.on("tool_call", (event, ctx) => {
14
+ if (!SHELL_TOOLS.has(event.toolName)) return undefined;
15
+ const decision = decideToolCall(state, event.toolName, event.input, ctx.cwd, process.env);
16
+ if (decision?.block) return decision;
17
+ if (decision?.command === undefined) {
18
+ return { block: true, reason: `${event.toolName} has no container to run in for this evaluation` };
19
+ }
20
+ event.input.command = decision.command;
21
+ return undefined;
22
+ });
23
+ }
@@ -0,0 +1,77 @@
1
+ import {
2
+ CONTAINER_ROUTE,
3
+ decideToolCall,
4
+ escapeXml,
5
+ guardState,
6
+ loadDeclaredContext,
7
+ renderDeclaredContext,
8
+ } from "./guard-rules.mjs";
9
+
10
+ function buildSubjectSystemPrompt(options, declaredContext) {
11
+ const tools = options.selectedTools ?? [];
12
+ const toolLines = tools.map((tool) => `- ${tool}: ${options.toolSnippets?.[tool] ?? "Declared evaluation tool"}`);
13
+ const lines = [
14
+ "You are an expert coding assistant operating inside pi, a coding agent harness.",
15
+ "Help the user with the task using only the tools and resources listed below.",
16
+ "",
17
+ "Available tools:",
18
+ ...(toolLines.length > 0 ? toolLines : ["(none)"]),
19
+ "",
20
+ "Guidelines:",
21
+ "- Use read to load a skill's SKILL.md when the task matches its description.",
22
+ "- Resolve relative skill resources from the skill directory.",
23
+ "- Be concise in your response.",
24
+ ];
25
+ const skills = (options.skills ?? []).filter((skill) => !skill.disableModelInvocation);
26
+ if (skills.length > 0) {
27
+ lines.push("", "<available_skills>");
28
+ for (const skill of skills) {
29
+ lines.push(
30
+ " <skill>",
31
+ ` <name>${escapeXml(skill.name)}</name>`,
32
+ ` <description>${escapeXml(skill.description)}</description>`,
33
+ ` <location>${escapeXml(skill.filePath)}</location>`,
34
+ " </skill>",
35
+ );
36
+ }
37
+ lines.push("</available_skills>");
38
+ }
39
+ if (declaredContext.length > 0) lines.push("", renderDeclaredContext(declaredContext));
40
+ lines.push(`Current working directory: ${options.cwd}`);
41
+ return lines.join("\n");
42
+ }
43
+
44
+ // "isolated" replaces the host prompt with an evaluator-owned one; "host" keeps the host's own prompt
45
+ // (and anything declared extensions compose onto it) so evidence reflects the production prompt.
46
+ function beforeAgentStartHandler(promptMode, declaredContext) {
47
+ if (promptMode === "isolated") {
48
+ return (event) => ({ systemPrompt: buildSubjectSystemPrompt(event.systemPromptOptions, declaredContext) });
49
+ }
50
+ return (event) =>
51
+ declaredContext.length === 0
52
+ ? undefined
53
+ : { systemPrompt: `${event.systemPrompt}\n\n${renderDeclaredContext(declaredContext)}` };
54
+ }
55
+
56
+ export default function registerSkillEvalGuard(pi) {
57
+ const state = guardState(process.env);
58
+ const declaredContext = loadDeclaredContext(process.env.SKILL_EVAL_CONTEXT_MANIFEST);
59
+ const promptMode = process.env.SKILL_EVAL_PROMPT_MODE || "isolated";
60
+ if (promptMode !== "isolated" && promptMode !== "host") {
61
+ throw new Error(`SKILL_EVAL_PROMPT_MODE must be isolated or host: ${promptMode}`);
62
+ }
63
+
64
+ pi.on("before_agent_start", beforeAgentStartHandler(promptMode, declaredContext));
65
+
66
+ pi.on("tool_call", (event, ctx) => {
67
+ const decision = decideToolCall(state, event.toolName, event.input, ctx.cwd, process.env);
68
+ if (decision?.command === undefined) return decision;
69
+ // A shell tool's command runs in the subject's container. The route extension, loaded after every other one,
70
+ // rewrites it there, so extensions that read the command (Freeflow refuses a trailing `&` in bash) see the one
71
+ // the model wrote. Without the route nothing would move it into the container, so the call is refused.
72
+ if (globalThis[CONTAINER_ROUTE] !== true) {
73
+ return { block: true, reason: "the evaluator's container route is not loaded, so this command cannot run" };
74
+ }
75
+ return undefined;
76
+ });
77
+ }
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Asks the installed Pi to make one provider's stored OAuth login valid for at least the given minutes,
4
+ // refreshing it if needed. Pi does the refresh itself, under its own lock on auth.json, exactly as it does in
5
+ // ordinary use. Usage: pi-login-refresh.mjs <auth.json path> <provider> <minutes>
6
+ // Prints the login's new expiry as epoch milliseconds.
7
+
8
+ import { execFileSync } from "node:child_process";
9
+ import { realpathSync } from "node:fs";
10
+ import path from "node:path";
11
+ import { pathToFileURL } from "node:url";
12
+
13
+ const [authPath, provider, minutes] = process.argv.slice(2);
14
+ if (!authPath || !provider || !/^\d+$/.test(minutes ?? "")) {
15
+ process.stderr.write("usage: pi-login-refresh.mjs <auth.json path> <provider> <minutes>\n");
16
+ process.exit(2);
17
+ }
18
+
19
+ // The installed Pi's package root, found from the `pi` command so the refresh uses the same Pi the runs use.
20
+ const binary = realpathSync(execFileSync("which", ["pi"], { encoding: "utf8" }).trim());
21
+ let packageRoot = path.dirname(binary);
22
+ while (path.basename(packageRoot) !== "pi-coding-agent" && packageRoot !== path.dirname(packageRoot)) {
23
+ packageRoot = path.dirname(packageRoot);
24
+ }
25
+ const { ModelRuntime } = await import(pathToFileURL(path.join(packageRoot, "dist", "index.js")).href);
26
+ const runtime = await ModelRuntime.create({ authPath });
27
+ await runtime.getAuth(provider, { minOAuthValidityMs: Number(minutes) * 60_000 });
28
+
29
+ const { readFileSync } = await import("node:fs");
30
+ const stored = JSON.parse(readFileSync(authPath, "utf8"))[provider];
31
+ process.stdout.write(`${stored?.expires ?? ""}\n`);