my-frontend-observer 0.6.0 → 0.7.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.
- package/CHANGELOG.md +79 -0
- package/README.md +43 -4
- package/dist/application/externalReferencePersistenceService.d.ts +75 -0
- package/dist/application/externalReferencePersistenceService.js +182 -0
- package/dist/application/externalReferencePersistenceService.js.map +1 -0
- package/dist/application/referenceFidelityEvaluationService.d.ts +28 -0
- package/dist/application/referenceFidelityEvaluationService.js +45 -0
- package/dist/application/referenceFidelityEvaluationService.js.map +1 -0
- package/dist/artifacts/externalReferenceArtifactReader.d.ts +18 -0
- package/dist/artifacts/externalReferenceArtifactReader.js +35 -0
- package/dist/artifacts/externalReferenceArtifactReader.js.map +1 -0
- package/dist/artifacts/externalReferenceArtifactWriter.d.ts +44 -0
- package/dist/artifacts/externalReferenceArtifactWriter.js +77 -0
- package/dist/artifacts/externalReferenceArtifactWriter.js.map +1 -0
- package/dist/cli.js +844 -0
- package/dist/cli.js.map +1 -1
- package/dist/domain/boundedAgentContext.d.ts +52 -0
- package/dist/domain/boundedAgentContext.js +44 -1
- package/dist/domain/boundedAgentContext.js.map +1 -1
- package/dist/domain/boundedAgentContextIdentity.d.ts +16 -6
- package/dist/domain/boundedAgentContextIdentity.js +22 -6
- package/dist/domain/boundedAgentContextIdentity.js.map +1 -1
- package/dist/domain/boundedAgentContextProjection.d.ts +11 -0
- package/dist/domain/boundedAgentContextProjection.js +32 -4
- package/dist/domain/boundedAgentContextProjection.js.map +1 -1
- package/dist/domain/comparison.d.ts +23 -1
- package/dist/domain/comparison.js +27 -1
- package/dist/domain/comparison.js.map +1 -1
- package/dist/domain/comparisonEngine.d.ts +34 -6
- package/dist/domain/comparisonEngine.js +48 -8
- package/dist/domain/comparisonEngine.js.map +1 -1
- package/dist/domain/diagnostics.d.ts +1 -1
- package/dist/domain/diagnostics.js +16 -0
- package/dist/domain/diagnostics.js.map +1 -1
- package/dist/domain/explicitState.d.ts +40 -0
- package/dist/domain/explicitState.js +54 -0
- package/dist/domain/explicitState.js.map +1 -0
- package/dist/domain/externalReference.d.ts +158 -0
- package/dist/domain/externalReference.js +167 -0
- package/dist/domain/externalReference.js.map +1 -0
- package/dist/domain/externalReferenceApplicability.d.ts +43 -0
- package/dist/domain/externalReferenceApplicability.js +52 -0
- package/dist/domain/externalReferenceApplicability.js.map +1 -0
- package/dist/domain/externalReferenceCompatibility.d.ts +40 -0
- package/dist/domain/externalReferenceCompatibility.js +48 -0
- package/dist/domain/externalReferenceCompatibility.js.map +1 -0
- package/dist/domain/externalReferenceFidelity.d.ts +141 -0
- package/dist/domain/externalReferenceFidelity.js +413 -0
- package/dist/domain/externalReferenceFidelity.js.map +1 -0
- package/dist/domain/externalReferenceIdentity.d.ts +38 -0
- package/dist/domain/externalReferenceIdentity.js +70 -0
- package/dist/domain/externalReferenceIdentity.js.map +1 -0
- package/dist/domain/externalReferenceImage.d.ts +35 -0
- package/dist/domain/externalReferenceImage.js +160 -0
- package/dist/domain/externalReferenceImage.js.map +1 -0
- package/dist/domain/externalReferenceRegionRelationships.d.ts +63 -0
- package/dist/domain/externalReferenceRegionRelationships.js +98 -0
- package/dist/domain/externalReferenceRegionRelationships.js.map +1 -0
- package/dist/domain/externalReferenceRegions.d.ts +65 -0
- package/dist/domain/externalReferenceRegions.js +105 -0
- package/dist/domain/externalReferenceRegions.js.map +1 -0
- package/dist/domain/externalReferenceRequirementIdentity.d.ts +12 -0
- package/dist/domain/externalReferenceRequirementIdentity.js +35 -0
- package/dist/domain/externalReferenceRequirementIdentity.js.map +1 -0
- package/dist/domain/externalReferenceRequirements.d.ts +215 -0
- package/dist/domain/externalReferenceRequirements.js +401 -0
- package/dist/domain/externalReferenceRequirements.js.map +1 -0
- package/dist/domain/externalReferenceRuntimeBinding.d.ts +146 -0
- package/dist/domain/externalReferenceRuntimeBinding.js +183 -0
- package/dist/domain/externalReferenceRuntimeBinding.js.map +1 -0
- package/dist/domain/identity.d.ts +11 -8
- package/dist/domain/identity.js +12 -8
- package/dist/domain/identity.js.map +1 -1
- package/dist/domain/referenceCorrectionIdentity.d.ts +40 -0
- package/dist/domain/referenceCorrectionIdentity.js +77 -0
- package/dist/domain/referenceCorrectionIdentity.js.map +1 -0
- package/dist/domain/referenceCorrectionWorkflow.d.ts +160 -0
- package/dist/domain/referenceCorrectionWorkflow.js +165 -0
- package/dist/domain/referenceCorrectionWorkflow.js.map +1 -0
- package/dist/domain/referenceFidelityProjection.d.ts +65 -0
- package/dist/domain/referenceFidelityProjection.js +135 -0
- package/dist/domain/referenceFidelityProjection.js.map +1 -0
- package/dist/domain/relationships.d.ts +43 -1
- package/dist/domain/relationships.js +15 -6
- package/dist/domain/relationships.js.map +1 -1
- package/dist/domain/schema.js +6 -0
- package/dist/domain/schema.js.map +1 -1
- package/dist/index.d.ts +39 -4
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/request/request.d.ts +12 -0
- package/dist/request/request.js +12 -0
- package/dist/request/request.js.map +1 -1
- package/docs/ARCHITECTURE.md +271 -11
- package/docs/CI_CD.md +50 -0
- package/docs/COMMANDS.md +187 -0
- package/docs/CONTRACTS.md +1347 -12
- package/docs/CURRENT_STATE.md +451 -13
- package/docs/PROJECT_DESCRIPTION.md +513 -88
- package/docs/PROJECT_MILESTONES.md +550 -97
- package/docs/PROJECT_OVERVIEW.md +56 -14
- package/docs/QUICKSTART.md +6 -0
- package/docs/RELEASE.md +28 -21
- package/docs/ROADMAP.md +238 -99
- package/docs/SECURITY.md +80 -4
- package/docs/WORKFLOWS.md +358 -23
- package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -0
- package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -0
- package/docs/reports/v0.7-pre-release-readiness.md +337 -0
- package/docs/reports/v0.7-reference-binding-prompt5.md +223 -0
- package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -0
- package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -0
- package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -0
- package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -0
- package/docs/reports/v0.7-reference-regions-prompt2.md +195 -0
- package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -0
- package/docs/reports/v0.7-release-prep.md +423 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic identity of a single reference requirement's own semantic
|
|
3
|
+
* content - independent of authoring order or which reference it belongs to.
|
|
4
|
+
* Mirrors domain/frontendContractIdentity.ts#buildClauseIdentity exactly
|
|
5
|
+
* (same canonicalize+sha256 shape over {subject, tolerance}), extended with
|
|
6
|
+
* `category`/`expectedDependentMode` because - unlike a v0.5 baseline
|
|
7
|
+
* clause, whose identity is deliberately category-independent - two
|
|
8
|
+
* reference requirements with the same subject/tolerance but different
|
|
9
|
+
* authored category are semantically distinct authored intents (see
|
|
10
|
+
* docs/CONTRACTS.md "v0.7 Prompt 3").
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildReferenceRequirementIdentity(subject: unknown, category: string, tolerance: unknown, expectedDependentMode?: string): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* Deliberately duplicated from domain/identity.ts#canonicalize (itself
|
|
4
|
+
* duplicated across comparisonIdentity.ts/frontendContractIdentity.ts/
|
|
5
|
+
* externalReferenceIdentity.ts) rather than imported - each identity module
|
|
6
|
+
* owns its own private canonicalize per existing repository convention.
|
|
7
|
+
*/
|
|
8
|
+
function canonicalize(value) {
|
|
9
|
+
if (Array.isArray(value))
|
|
10
|
+
return value.map(canonicalize);
|
|
11
|
+
if (value !== null && typeof value === 'object') {
|
|
12
|
+
const entries = Object.entries(value)
|
|
13
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
14
|
+
.map(([key, entryValue]) => [key, canonicalize(entryValue)]);
|
|
15
|
+
return Object.fromEntries(entries);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Deterministic identity of a single reference requirement's own semantic
|
|
21
|
+
* content - independent of authoring order or which reference it belongs to.
|
|
22
|
+
* Mirrors domain/frontendContractIdentity.ts#buildClauseIdentity exactly
|
|
23
|
+
* (same canonicalize+sha256 shape over {subject, tolerance}), extended with
|
|
24
|
+
* `category`/`expectedDependentMode` because - unlike a v0.5 baseline
|
|
25
|
+
* clause, whose identity is deliberately category-independent - two
|
|
26
|
+
* reference requirements with the same subject/tolerance but different
|
|
27
|
+
* authored category are semantically distinct authored intents (see
|
|
28
|
+
* docs/CONTRACTS.md "v0.7 Prompt 3").
|
|
29
|
+
*/
|
|
30
|
+
export function buildReferenceRequirementIdentity(subject, category, tolerance, expectedDependentMode) {
|
|
31
|
+
const semanticView = { subject, category, expectedDependentMode: expectedDependentMode ?? null, tolerance: tolerance ?? null };
|
|
32
|
+
const serialized = JSON.stringify(canonicalize(semanticView));
|
|
33
|
+
return createHash('sha256').update(serialized).digest('hex');
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=externalReferenceRequirementIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalReferenceRequirementIdentity.js","sourceRoot":"","sources":["../../src/domain/externalReferenceRequirementIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;aAC7D,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAChD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,CAAC,CAAU,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAgB,EAChB,QAAgB,EAChB,SAAkB,EAClB,qBAA8B;IAE9B,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,qBAAqB,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS,IAAI,IAAI,EAAE,CAAC;IAC/H,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IAC9D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v0.7 Prompt 3 selected design requirements, tolerance semantics, and
|
|
3
|
+
* reference-evidence adequacy. Builds only on Prompt 2's `ReferenceRegion`/
|
|
4
|
+
* `ReferenceRegionGeometry`/relationship-derivation - it does not implement
|
|
5
|
+
* runtime-target binding, candidate comparison, or fidelity PASS/FAIL (those
|
|
6
|
+
* remain later v0.7 prompts).
|
|
7
|
+
*
|
|
8
|
+
* Central distinction (see docs/CONTRACTS.md "v0.7 Prompt 3"): a reference
|
|
9
|
+
* region's geometry is REFERENCE EVIDENCE - everything visibly/measurably
|
|
10
|
+
* present in the supplied image. A requirement is SELECTED DESIGN INTENT -
|
|
11
|
+
* only what the user/configuration explicitly authored as mattering for
|
|
12
|
+
* later candidate evaluation. This module never infers a requirement merely
|
|
13
|
+
* because a property or relationship exists.
|
|
14
|
+
*
|
|
15
|
+
* Requirement categories are the exact v0.5 `AuthoredChangeScopeCategory`
|
|
16
|
+
* vocabulary (`requested`/`expected-dependent`/`protected`/`preserved`),
|
|
17
|
+
* imported directly rather than reinvented as a "reference-only" taxonomy -
|
|
18
|
+
* that type carries no runtime-only coupling in its own definition. As in
|
|
19
|
+
* v0.5, `'unexpected'` remains impossible to author here: it is not a member
|
|
20
|
+
* of `AuthoredChangeScopeCategory` at all.
|
|
21
|
+
*/
|
|
22
|
+
import { AUTHORED_CHANGE_SCOPE_CATEGORIES, isAuthoredChangeScopeCategory, EXPECTED_DEPENDENT_MODES, isValidExpectedDependentMode } from './frontendContracts.js';
|
|
23
|
+
import type { AuthoredChangeScopeCategory, ExpectedDependentMode } from './frontendContracts.js';
|
|
24
|
+
import type { PairwiseRelationshipKind } from './relationships.js';
|
|
25
|
+
import type { ReferenceRegion, ReferenceRegionGeometry } from './externalReferenceRegions.js';
|
|
26
|
+
export { AUTHORED_CHANGE_SCOPE_CATEGORIES, isAuthoredChangeScopeCategory, EXPECTED_DEPENDENT_MODES, isValidExpectedDependentMode };
|
|
27
|
+
export type { AuthoredChangeScopeCategory, ExpectedDependentMode };
|
|
28
|
+
export declare const MAX_REFERENCE_REQUIREMENTS = 50;
|
|
29
|
+
/** Exactly the fields of ReferenceRegionGeometry - the smallest coherent vocabulary already available from Prompt 2, nothing invented (no separate "left"/"top" aliases - x/y already are the left/top edges of the canonical rectangle). */
|
|
30
|
+
export declare const REFERENCE_REQUIREMENT_REGION_PROPERTIES: readonly ["x", "y", "width", "height", "right", "bottom", "centerX", "centerY"];
|
|
31
|
+
export type ReferenceRequirementRegionProperty = (typeof REFERENCE_REQUIREMENT_REGION_PROPERTIES)[number];
|
|
32
|
+
export declare function isReferenceRequirementRegionProperty(value: unknown): value is ReferenceRequirementRegionProperty;
|
|
33
|
+
/** Smallest useful set of pure two-region derived measurements (request section 18) - not an unrestricted geometry expression language. */
|
|
34
|
+
export declare const REFERENCE_REQUIREMENT_MEASUREMENTS: readonly ["vertical-gap", "horizontal-gap", "center-x-delta", "center-y-delta", "left-edge-delta", "right-edge-delta"];
|
|
35
|
+
export type ReferenceRequirementMeasurement = (typeof REFERENCE_REQUIREMENT_MEASUREMENTS)[number];
|
|
36
|
+
export declare function isReferenceRequirementMeasurement(value: unknown): value is ReferenceRequirementMeasurement;
|
|
37
|
+
/**
|
|
38
|
+
* Pure derived two-region measurements. `vertical-gap`/`horizontal-gap`
|
|
39
|
+
* return `undefined` when the two regions overlap on that axis (the gap is
|
|
40
|
+
* geometrically undefined, never fabricated as 0 or negative) - direction is
|
|
41
|
+
* decided by actual geometry, mirroring relationships.ts's
|
|
42
|
+
* verticalSequenceOf/horizontalOrderOf convention. The delta measurements
|
|
43
|
+
* are always defined (a plain numeric distance, never negative).
|
|
44
|
+
*/
|
|
45
|
+
export declare function deriveReferenceRequirementMeasurement(kind: ReferenceRequirementMeasurement, a: ReferenceRegionGeometry, b: ReferenceRegionGeometry): number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Deliberately not a reuse of domain/frontendContracts.ts#ContractTolerance:
|
|
48
|
+
* that type's `'absolute-px'` member is implicitly runtime/CSS pixels
|
|
49
|
+
* (compared against `TargetGeometry` from a live ObservationArtifact).
|
|
50
|
+
* Reference-image pixels are a different, explicitly-labeled unit (see
|
|
51
|
+
* externalReferenceRegions.ts's coordinate-semantics doc comment) - Prompt 6
|
|
52
|
+
* will eventually need an explicit scale/compatibility mapping between the
|
|
53
|
+
* two; nothing here assumes 1 reference pixel = 1 CSS pixel. Numeric bounds
|
|
54
|
+
* intentionally mirror CONTRACT_TOLERANCE_ABSOLUTE_PX_MIN/MAX and
|
|
55
|
+
* CONTRACT_TOLERANCE_PERCENT_MIN/MAX (same values, independently owned
|
|
56
|
+
* constants) rather than importing them, for the same unit-labeling reason.
|
|
57
|
+
*/
|
|
58
|
+
export declare const REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MIN = 0;
|
|
59
|
+
export declare const REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MAX = 100;
|
|
60
|
+
export declare const REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MIN = 0;
|
|
61
|
+
export declare const REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MAX = 100;
|
|
62
|
+
export type ReferenceRequirementTolerance = {
|
|
63
|
+
kind: 'exact';
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'absolute-reference-px';
|
|
66
|
+
amount: number;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'percent';
|
|
69
|
+
amount: number;
|
|
70
|
+
};
|
|
71
|
+
export declare function isValidReferenceRequirementTolerance(value: unknown): value is ReferenceRequirementTolerance;
|
|
72
|
+
export interface RegionPropertyRequirementSubject {
|
|
73
|
+
kind: 'region-property';
|
|
74
|
+
region: string;
|
|
75
|
+
property: ReferenceRequirementRegionProperty;
|
|
76
|
+
}
|
|
77
|
+
export interface RegionRelationshipRequirementSubject {
|
|
78
|
+
kind: 'region-relationship';
|
|
79
|
+
subjectRegion: string;
|
|
80
|
+
relatedRegion: string;
|
|
81
|
+
relationship: PairwiseRelationshipKind;
|
|
82
|
+
}
|
|
83
|
+
export interface RegionMeasurementRequirementSubject {
|
|
84
|
+
kind: 'region-measurement';
|
|
85
|
+
subjectRegion: string;
|
|
86
|
+
relatedRegion: string;
|
|
87
|
+
measurement: ReferenceRequirementMeasurement;
|
|
88
|
+
}
|
|
89
|
+
export type ReferenceRequirementSubject = RegionPropertyRequirementSubject | RegionRelationshipRequirementSubject | RegionMeasurementRequirementSubject;
|
|
90
|
+
export declare function isValidReferenceRequirementSubjectShape(value: unknown): value is ReferenceRequirementSubject;
|
|
91
|
+
export interface ExternalReferenceRequirement {
|
|
92
|
+
/** Deterministic identity from {subject, category, expectedDependentMode, tolerance} only - see externalReferenceRequirementIdentity.ts. Never a timestamp or config path. */
|
|
93
|
+
requirementId: string;
|
|
94
|
+
category: AuthoredChangeScopeCategory;
|
|
95
|
+
expectedDependentMode?: ExpectedDependentMode;
|
|
96
|
+
subject: ReferenceRequirementSubject;
|
|
97
|
+
/** Required for region-property/region-measurement subjects (a numeric comparison needs a tolerance); must be absent for region-relationship subjects (a categorical fact - see docs/CONTRACTS.md). */
|
|
98
|
+
tolerance?: ReferenceRequirementTolerance;
|
|
99
|
+
}
|
|
100
|
+
export type ReferenceRequirementValidationResult = {
|
|
101
|
+
valid: true;
|
|
102
|
+
} | {
|
|
103
|
+
valid: false;
|
|
104
|
+
reason: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Raw authored input shape: exactly what a user/config supplies via
|
|
108
|
+
* `--requirements-file` - {category, expectedDependentMode?, subject,
|
|
109
|
+
* tolerance?}, deliberately with no `requirementId` field. Identity is
|
|
110
|
+
* always system-computed from this exact content (see
|
|
111
|
+
* buildReferenceRequirement below), never author-supplied - unlike v0.5's
|
|
112
|
+
* BaselineClause/PerChangeClause, which need an author-visible `clauseId` so
|
|
113
|
+
* separate documents can cross-reference it via `supersedesBaselineClauseIds`;
|
|
114
|
+
* Prompt 3 requirements have no cross-document reference need yet, so
|
|
115
|
+
* requiring (and trusting) an authored id would only invite drift between a
|
|
116
|
+
* user-typed id and the content it is supposed to identify.
|
|
117
|
+
*/
|
|
118
|
+
export interface RawReferenceRequirement {
|
|
119
|
+
category: AuthoredChangeScopeCategory;
|
|
120
|
+
expectedDependentMode?: ExpectedDependentMode;
|
|
121
|
+
subject: ReferenceRequirementSubject;
|
|
122
|
+
tolerance?: ReferenceRequirementTolerance;
|
|
123
|
+
}
|
|
124
|
+
/** Validates one raw, not-yet-identified authored requirement - the shape accepted from `--requirements-file`. */
|
|
125
|
+
export declare function isValidRawReferenceRequirement(value: unknown): ReferenceRequirementValidationResult;
|
|
126
|
+
/** Computes the deterministic requirementId and returns a complete ExternalReferenceRequirement. Callers must validate via isValidRawReferenceRequirement first. */
|
|
127
|
+
export declare function buildReferenceRequirement(raw: RawReferenceRequirement): ExternalReferenceRequirement;
|
|
128
|
+
/** Validates one already-identified, fully-constructed requirement's own shape (category/mode/subject/tolerance-applicability, plus requirementId presence) - never region existence, which needs the owning reference's `regions` (see isValidReferenceRequirements). Used to defensively re-validate a persisted/about-to-be-persisted ExternalReferenceRequirement, mirroring how every other artifact family's writer re-validates via the same gate it will later read with. */
|
|
129
|
+
export declare function isValidReferenceRequirementShape(value: unknown): ReferenceRequirementValidationResult;
|
|
130
|
+
/**
|
|
131
|
+
* Collection-level validation: bounded count, every subject's region id(s)
|
|
132
|
+
* must exist among the owning artifact's own already-validated `regions`
|
|
133
|
+
* (an authored requirement pointing at a nonexistent region is a structural
|
|
134
|
+
* validation failure, never merely "unavailable" evidence - see
|
|
135
|
+
* docs/CONTRACTS.md), and no two requirements may share the same structural
|
|
136
|
+
* subject (the chosen conflict-handling rule - see the same doc section for
|
|
137
|
+
* why v0.5's runtime-evidence conflict detector could not be reused here).
|
|
138
|
+
*/
|
|
139
|
+
export declare function isValidReferenceRequirements(value: unknown, regions: readonly ReferenceRegion[]): ReferenceRequirementValidationResult;
|
|
140
|
+
export type ReferenceRequirementExpectation = {
|
|
141
|
+
available: true;
|
|
142
|
+
kind: 'numeric';
|
|
143
|
+
value: number;
|
|
144
|
+
} | {
|
|
145
|
+
available: true;
|
|
146
|
+
kind: 'relationship';
|
|
147
|
+
matches: boolean;
|
|
148
|
+
} | {
|
|
149
|
+
available: false;
|
|
150
|
+
reason: string;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Derives what the reference itself shows for one requirement's subject,
|
|
154
|
+
* purely from the supplied regions - never stored on the requirement or the
|
|
155
|
+
* artifact (avoids the exact drift risk request section 14 warns about: a
|
|
156
|
+
* stored `width: 424` could silently disagree with the region's own
|
|
157
|
+
* rectangle after some future change). `geometryTolerancePx` is passed
|
|
158
|
+
* through to relationship derivation unchanged (Prompt 2's own default
|
|
159
|
+
* applies when omitted).
|
|
160
|
+
*/
|
|
161
|
+
export declare function deriveReferenceRequirementExpectation(subject: ReferenceRequirementSubject, regions: readonly ReferenceRegion[], options?: {
|
|
162
|
+
geometryTolerancePx?: number;
|
|
163
|
+
}): ReferenceRequirementExpectation;
|
|
164
|
+
export declare const REFERENCE_REQUIREMENT_ADEQUACY_STATES: readonly ["adequate", "partial", "inadequate"];
|
|
165
|
+
export type ReferenceRequirementAdequacyState = (typeof REFERENCE_REQUIREMENT_ADEQUACY_STATES)[number];
|
|
166
|
+
/**
|
|
167
|
+
* Deliberately its own small, reference-owned vocabulary - not a reuse of
|
|
168
|
+
* domain/boundedAgentContext.ts#ADEQUACY_REASON_CODES, which describes
|
|
169
|
+
* runtime-target/static-correlation concerns that do not exist yet at this
|
|
170
|
+
* stage (see docs/CONTRACTS.md "v0.7 Prompt 3" for the full precedent
|
|
171
|
+
* review). Only two codes exist because only two conditions can make an
|
|
172
|
+
* already-*structurally-valid* requirement collection reference-inadequate:
|
|
173
|
+
* authoring zero requirements at all, or a validly-shaped relationship/
|
|
174
|
+
* measurement requirement whose evidence cannot actually be derived from the
|
|
175
|
+
* reference geometry. An unknown-region or malformed requirement is a
|
|
176
|
+
* construction-time validation failure (isValidReferenceRequirements) and
|
|
177
|
+
* never reaches adequacy at all.
|
|
178
|
+
*/
|
|
179
|
+
export declare const REFERENCE_REQUIREMENT_ADEQUACY_REASON_CODES: readonly ["no-selected-requirements", "missing-reference-relationship-evidence"];
|
|
180
|
+
export type ReferenceRequirementAdequacyReasonCode = (typeof REFERENCE_REQUIREMENT_ADEQUACY_REASON_CODES)[number];
|
|
181
|
+
export interface ReferenceRequirementAdequacyReason {
|
|
182
|
+
code: ReferenceRequirementAdequacyReasonCode;
|
|
183
|
+
requirementId?: string;
|
|
184
|
+
detail?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface ReferenceRequirementAdequacy {
|
|
187
|
+
status: ReferenceRequirementAdequacyState;
|
|
188
|
+
totalRequirements: number;
|
|
189
|
+
evaluableRequirements: number;
|
|
190
|
+
unavailableRequirements: number;
|
|
191
|
+
reasons: ReferenceRequirementAdequacyReason[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* REFERENCE-SIDE adequacy only: does the reference definition itself contain
|
|
195
|
+
* enough evidence to understand every selected requirement? This never asks
|
|
196
|
+
* whether a runtime target/candidate exists (that is Prompt 4/5's
|
|
197
|
+
* responsibility). A reference with zero authored requirements is explicitly
|
|
198
|
+
* `inadequate` (request section 24F's documented decision: an
|
|
199
|
+
* externally-valid, region-rich reference is still not usable for a
|
|
200
|
+
* correction task until the user has actually selected what matters).
|
|
201
|
+
* Deterministic: reasons are ordered by authored requirement index, never by
|
|
202
|
+
* object-key iteration order.
|
|
203
|
+
*/
|
|
204
|
+
export declare function deriveReferenceRequirementAdequacy(regions: readonly ReferenceRegion[], requirements: readonly ExternalReferenceRequirement[], options?: {
|
|
205
|
+
geometryTolerancePx?: number;
|
|
206
|
+
}): ReferenceRequirementAdequacy;
|
|
207
|
+
/**
|
|
208
|
+
* v0.7 Prompt 7 addition (additive, previously no structural validator
|
|
209
|
+
* existed for this already-frozen Prompt 3 shape): a defense-in-depth
|
|
210
|
+
* structural check, reused by `boundedAgentContext.ts` when accepting an
|
|
211
|
+
* already-computed `ReferenceRequirementAdequacy` value as part of a bounded
|
|
212
|
+
* fidelity projection. No change to `deriveReferenceRequirementAdequacy`'s
|
|
213
|
+
* own logic or the `ReferenceRequirementAdequacy` contract itself.
|
|
214
|
+
*/
|
|
215
|
+
export declare function isValidReferenceRequirementAdequacy(value: unknown): value is ReferenceRequirementAdequacy;
|