@reportforge/playwright-pdf 0.19.1 → 0.20.1

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/dist/index.d.mts CHANGED
@@ -204,6 +204,10 @@ interface ReporterOptions {
204
204
  * Offline failure root-cause analysis. Classifies failures into categories
205
205
  * using an embedded Naive Bayes model and renders a clustered breakdown in
206
206
  * the `detailed` PDF (one-liner in `executive`). No network calls at runtime.
207
+ * Optionally personalizes on YOUR machine: label collected failures
208
+ * (`label-feedback`), then `train-model` trains + evaluates a local layer that
209
+ * activates only when it measurably beats the base model. Training data, the
210
+ * trained model, and evaluation never leave the machine.
207
211
  * @example
208
212
  * failureAnalysis: { enabled: true, maxClusters: 5 }
209
213
  */
@@ -216,15 +220,35 @@ interface ReporterOptions {
216
220
  minStrength?: 'weak' | 'moderate' | 'strong';
217
221
  /** Max failures fed to the classifier; excess skipped, PDF notes it. Default: 500 */
218
222
  maxFailuresToAnalyse?: number;
219
- /** Collect unknown/low-confidence failures to a local per-project CSV (Plan 3). Default: true */
223
+ /** Collect unrecognized failures to a local per-project CSV (redacted + tokenized; the on-device trainer's input). Default: true */
220
224
  collectUnclassified?: boolean;
221
225
  /**
222
- * Auto-update the classifier model from the signed license-refresh channel
226
+ * What the collector stores while `collectUnclassified` is on:
227
+ * 'blind-spots' = unknown/low-confidence failures only; 'all' = every
228
+ * model-scored failure, so wrong-but-confident predictions can be corrected
229
+ * by labeling too (trades ring-buffer space). Default: 'blind-spots'
230
+ */
231
+ collectScope?: 'blind-spots' | 'all';
232
+ /**
233
+ * Auto-update the BASE classifier model from the signed license-refresh channel
223
234
  * (offline-tolerant; the bundled model is always the floor; the delivered model
224
235
  * is Ed25519-verified). Set false to pin the bundled model for reproducibility.
225
236
  * Default: true
226
237
  */
227
238
  autoUpdateModel?: boolean;
239
+ /**
240
+ * Use the on-device trained model (when present and it passed its local
241
+ * evaluation gate) ahead of the base model. Trained via the `train-model`
242
+ * CLI from feedback you labeled; never uploaded anywhere. Default: true
243
+ */
244
+ localModel?: boolean;
245
+ /**
246
+ * Path to a trained local model file (default: ~/.reportforge/model-local.json).
247
+ * Point this at a file committed to your repo (`train-model --out`) to share a
248
+ * team-trained model with ephemeral CI machines — the file contains only
249
+ * redacted token statistics, never raw failure text.
250
+ */
251
+ localModelPath?: string;
228
252
  };
229
253
  /**
230
254
  * Opt-in rich execution capture for the defect log. Reporter-side only — reads
@@ -463,6 +487,18 @@ declare class PdfReporter implements Reporter {
463
487
  * onBegin) and PDF generation (awaited in onEnd) — at most one network trip.
464
488
  */
465
489
  private license;
490
+ /**
491
+ * onEnd entry point for licensing: the memoized resolution can be as old as
492
+ * the whole run (it is shared with the live stream from onBegin), and a JWT
493
+ * issued near the subscription's period end can expire MID-RUN while the
494
+ * subscription itself renews and stays active — the exact case where the
495
+ * admin dashboard shows "active" but generateAll's expiry gate would throw.
496
+ * When the token is expired or about to be, re-resolve once: with < 24h TTL
497
+ * the client always takes the network path, and its token_expired recovery
498
+ * (clear cache → fresh activation) picks up the renewed period. A refresh
499
+ * failure downgrades to the normal warn-and-skip, never a hard ERROR.
500
+ */
501
+ private freshLicense;
466
502
  private resolveLicense;
467
503
  /**
468
504
  * Wires up live streaming: derives the run id (shared by all shards), kicks
package/dist/index.d.ts CHANGED
@@ -204,6 +204,10 @@ interface ReporterOptions {
204
204
  * Offline failure root-cause analysis. Classifies failures into categories
205
205
  * using an embedded Naive Bayes model and renders a clustered breakdown in
206
206
  * the `detailed` PDF (one-liner in `executive`). No network calls at runtime.
207
+ * Optionally personalizes on YOUR machine: label collected failures
208
+ * (`label-feedback`), then `train-model` trains + evaluates a local layer that
209
+ * activates only when it measurably beats the base model. Training data, the
210
+ * trained model, and evaluation never leave the machine.
207
211
  * @example
208
212
  * failureAnalysis: { enabled: true, maxClusters: 5 }
209
213
  */
@@ -216,15 +220,35 @@ interface ReporterOptions {
216
220
  minStrength?: 'weak' | 'moderate' | 'strong';
217
221
  /** Max failures fed to the classifier; excess skipped, PDF notes it. Default: 500 */
218
222
  maxFailuresToAnalyse?: number;
219
- /** Collect unknown/low-confidence failures to a local per-project CSV (Plan 3). Default: true */
223
+ /** Collect unrecognized failures to a local per-project CSV (redacted + tokenized; the on-device trainer's input). Default: true */
220
224
  collectUnclassified?: boolean;
221
225
  /**
222
- * Auto-update the classifier model from the signed license-refresh channel
226
+ * What the collector stores while `collectUnclassified` is on:
227
+ * 'blind-spots' = unknown/low-confidence failures only; 'all' = every
228
+ * model-scored failure, so wrong-but-confident predictions can be corrected
229
+ * by labeling too (trades ring-buffer space). Default: 'blind-spots'
230
+ */
231
+ collectScope?: 'blind-spots' | 'all';
232
+ /**
233
+ * Auto-update the BASE classifier model from the signed license-refresh channel
223
234
  * (offline-tolerant; the bundled model is always the floor; the delivered model
224
235
  * is Ed25519-verified). Set false to pin the bundled model for reproducibility.
225
236
  * Default: true
226
237
  */
227
238
  autoUpdateModel?: boolean;
239
+ /**
240
+ * Use the on-device trained model (when present and it passed its local
241
+ * evaluation gate) ahead of the base model. Trained via the `train-model`
242
+ * CLI from feedback you labeled; never uploaded anywhere. Default: true
243
+ */
244
+ localModel?: boolean;
245
+ /**
246
+ * Path to a trained local model file (default: ~/.reportforge/model-local.json).
247
+ * Point this at a file committed to your repo (`train-model --out`) to share a
248
+ * team-trained model with ephemeral CI machines — the file contains only
249
+ * redacted token statistics, never raw failure text.
250
+ */
251
+ localModelPath?: string;
228
252
  };
229
253
  /**
230
254
  * Opt-in rich execution capture for the defect log. Reporter-side only — reads
@@ -463,6 +487,18 @@ declare class PdfReporter implements Reporter {
463
487
  * onBegin) and PDF generation (awaited in onEnd) — at most one network trip.
464
488
  */
465
489
  private license;
490
+ /**
491
+ * onEnd entry point for licensing: the memoized resolution can be as old as
492
+ * the whole run (it is shared with the live stream from onBegin), and a JWT
493
+ * issued near the subscription's period end can expire MID-RUN while the
494
+ * subscription itself renews and stays active — the exact case where the
495
+ * admin dashboard shows "active" but generateAll's expiry gate would throw.
496
+ * When the token is expired or about to be, re-resolve once: with < 24h TTL
497
+ * the client always takes the network path, and its token_expired recovery
498
+ * (clear cache → fresh activation) picks up the renewed period. A refresh
499
+ * failure downgrades to the normal warn-and-skip, never a hard ERROR.
500
+ */
501
+ private freshLicense;
466
502
  private resolveLicense;
467
503
  /**
468
504
  * Wires up live streaming: derives the run id (shared by all shards), kicks