@chrisdudek/yg 5.0.0-alpha.3 → 5.0.0-alpha.5

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.
@@ -207,11 +207,6 @@ interface ArchitectureDef {
207
207
  }
208
208
  interface QualityConfig {
209
209
  max_direct_relations: number;
210
- /** Per-node character budget. A node whose mapped source files plus the
211
- * reference files of its effective aspects exceed this total is an
212
- * `oversized-node` error. Default 40000. Binary files do not count; a node
213
- * may opt out via `sizeExempt`. */
214
- max_node_chars?: number;
215
210
  }
216
211
  type RelationType = 'uses' | 'calls' | 'extends' | 'implements' | 'emits' | 'listens';
217
212
  /** Port on a target node — consumers must satisfy port's aspects */
@@ -234,13 +229,13 @@ interface LlmConfig {
234
229
  consensus: number;
235
230
  /** CLI providers: subprocess timeout in ms. Default: 120_000. */
236
231
  timeout?: number;
237
- /** Optional caps on reference files for aspects resolving to this tier. */
238
- references?: {
239
- /** Max bytes per single reference file. Default 65536 (64 KiB). */
240
- max_bytes_per_file?: number;
241
- /** Max sum of reference bytes per aspect. Default 262144 (256 KiB). */
242
- max_total_bytes_per_aspect?: number;
243
- };
232
+ /**
233
+ * Optional per-tier cap on assembled reviewer-prompt length in characters.
234
+ * Absent = unlimited. This is a GATE checked deterministically before the LLM
235
+ * call — it never participates in verdict identity or hash computation (excluded
236
+ * from canonicalTierJson like api_key and timeout).
237
+ */
238
+ max_prompt_chars?: number;
244
239
  }
245
240
  interface NodeMeta {
246
241
  name: string;
@@ -255,12 +250,6 @@ interface NodeMeta {
255
250
  relations?: Relation[];
256
251
  /** Flat list of file/directory paths relative to repo root */
257
252
  mapping?: string[];
258
- /** Documented opt-out from the per-node character budget (`oversized-node`).
259
- * Use ONLY for nodes mapping an unsplittable generated or binary artifact
260
- * (lockfile, append-only changelog, image). Requires a justification. */
261
- sizeExempt?: {
262
- reason: string;
263
- };
264
253
  }
265
254
  interface Relation {
266
255
  target: string;
@@ -305,6 +294,11 @@ interface AspectReviewerSpec {
305
294
  type AspectStatus = 'draft' | 'advisory' | 'enforced';
306
295
  /** Propagation modifier on implies edges. */
307
296
  type StatusInherit = 'strictest' | 'own-default';
297
+ /** Review scope of an aspect: whole-node or per-file, with an optional file filter. */
298
+ interface ScopeDef {
299
+ per: 'node' | 'file';
300
+ files?: FileWhenPredicate;
301
+ }
308
302
  interface AspectDef {
309
303
  name: string;
310
304
  id: string;
@@ -327,6 +321,15 @@ interface AspectDef {
327
321
  }>;
328
322
  /** Aspect-level default status. Absent → 'enforced'. Attach sites may override per the bump rule: bump up OK, downgrade is a validator error. */
329
323
  status?: AspectStatus;
324
+ /**
325
+ * Review scope: controls review granularity and the subject-file set.
326
+ * per: node (default) — one review over all subject files.
327
+ * per: file — one review per subject file.
328
+ * files: optional FileWhenPredicate filter; subject set = mapped files ∩ filter.
329
+ * Absent → undefined (semantically equivalent to { per: 'node' }).
330
+ * Forbidden on aggregate aspects (no rule source to scope).
331
+ */
332
+ scope?: ScopeDef;
330
333
  }
331
334
  interface FlowDef {
332
335
  /** Directory name under flows/, e.g. "checkout-flow" */
@@ -406,11 +409,30 @@ interface RunStructureAspectParams {
406
409
  graph: Graph;
407
410
  projectRoot: string;
408
411
  parseCache?: ParseCache;
412
+ /**
413
+ * Subject-scope override for a `per: file` deterministic pair (spec §1, B2
414
+ * contract #8). When present, it overrides BOTH `ctx.files` (the check sees
415
+ * only these subject files) AND the observation-EXCLUSION set (a read of any
416
+ * OTHER node file folds as a recorded `read:` observation, since it is no
417
+ * longer hashed as a subject input). Repo-relative POSIX paths.
418
+ *
419
+ * `ctx.node.files` and the allow-set stay NODE-scoped regardless — the check
420
+ * may still reach the rest of the node, but those reaches become observations.
421
+ *
422
+ * Absent → byte-identical legacy behavior (the whole node mapping is both the
423
+ * subject set and the exclusion set; `per: node` and `yg aspect-test` paths).
424
+ */
425
+ subjectScope?: string[];
409
426
  }
410
427
  interface RunStructureAspectResult {
411
428
  violations: Violation[];
412
429
  touchedFiles: string[];
413
430
  succeeded?: boolean;
431
+ /** Sorted [observationKey, observationHash] pairs recorded during this run. */
432
+ observations: Array<[string, string]>;
433
+ /** True when the same path was observed with different content during the run
434
+ * (file changed mid-run) — a tainted result must never be cached. */
435
+ observationsTainted: boolean;
414
436
  }
415
437
  declare class StructureRunnerError extends Error {
416
438
  readonly code: string;