my-frontend-observer 0.5.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +56 -4
  3. package/dist/application/externalReferencePersistenceService.d.ts +75 -0
  4. package/dist/application/externalReferencePersistenceService.js +182 -0
  5. package/dist/application/externalReferencePersistenceService.js.map +1 -0
  6. package/dist/application/referenceFidelityEvaluationService.d.ts +28 -0
  7. package/dist/application/referenceFidelityEvaluationService.js +45 -0
  8. package/dist/application/referenceFidelityEvaluationService.js.map +1 -0
  9. package/dist/artifacts/externalReferenceArtifactReader.d.ts +18 -0
  10. package/dist/artifacts/externalReferenceArtifactReader.js +35 -0
  11. package/dist/artifacts/externalReferenceArtifactReader.js.map +1 -0
  12. package/dist/artifacts/externalReferenceArtifactWriter.d.ts +44 -0
  13. package/dist/artifacts/externalReferenceArtifactWriter.js +77 -0
  14. package/dist/artifacts/externalReferenceArtifactWriter.js.map +1 -0
  15. package/dist/cli.js +844 -0
  16. package/dist/cli.js.map +1 -1
  17. package/dist/domain/boundedAgentContext.d.ts +226 -0
  18. package/dist/domain/boundedAgentContext.js +355 -0
  19. package/dist/domain/boundedAgentContext.js.map +1 -0
  20. package/dist/domain/boundedAgentContextCorrelation.d.ts +74 -0
  21. package/dist/domain/boundedAgentContextCorrelation.js +441 -0
  22. package/dist/domain/boundedAgentContextCorrelation.js.map +1 -0
  23. package/dist/domain/boundedAgentContextIdentity.d.ts +26 -0
  24. package/dist/domain/boundedAgentContextIdentity.js +69 -0
  25. package/dist/domain/boundedAgentContextIdentity.js.map +1 -0
  26. package/dist/domain/boundedAgentContextProjection.d.ts +71 -0
  27. package/dist/domain/boundedAgentContextProjection.js +477 -0
  28. package/dist/domain/boundedAgentContextProjection.js.map +1 -0
  29. package/dist/domain/comparison.d.ts +23 -1
  30. package/dist/domain/comparison.js +27 -1
  31. package/dist/domain/comparison.js.map +1 -1
  32. package/dist/domain/comparisonEngine.d.ts +34 -6
  33. package/dist/domain/comparisonEngine.js +48 -8
  34. package/dist/domain/comparisonEngine.js.map +1 -1
  35. package/dist/domain/diagnostics.d.ts +1 -1
  36. package/dist/domain/diagnostics.js +16 -0
  37. package/dist/domain/diagnostics.js.map +1 -1
  38. package/dist/domain/explicitState.d.ts +40 -0
  39. package/dist/domain/explicitState.js +54 -0
  40. package/dist/domain/explicitState.js.map +1 -0
  41. package/dist/domain/externalReference.d.ts +158 -0
  42. package/dist/domain/externalReference.js +167 -0
  43. package/dist/domain/externalReference.js.map +1 -0
  44. package/dist/domain/externalReferenceApplicability.d.ts +43 -0
  45. package/dist/domain/externalReferenceApplicability.js +52 -0
  46. package/dist/domain/externalReferenceApplicability.js.map +1 -0
  47. package/dist/domain/externalReferenceCompatibility.d.ts +40 -0
  48. package/dist/domain/externalReferenceCompatibility.js +48 -0
  49. package/dist/domain/externalReferenceCompatibility.js.map +1 -0
  50. package/dist/domain/externalReferenceFidelity.d.ts +141 -0
  51. package/dist/domain/externalReferenceFidelity.js +413 -0
  52. package/dist/domain/externalReferenceFidelity.js.map +1 -0
  53. package/dist/domain/externalReferenceIdentity.d.ts +38 -0
  54. package/dist/domain/externalReferenceIdentity.js +70 -0
  55. package/dist/domain/externalReferenceIdentity.js.map +1 -0
  56. package/dist/domain/externalReferenceImage.d.ts +35 -0
  57. package/dist/domain/externalReferenceImage.js +160 -0
  58. package/dist/domain/externalReferenceImage.js.map +1 -0
  59. package/dist/domain/externalReferenceRegionRelationships.d.ts +63 -0
  60. package/dist/domain/externalReferenceRegionRelationships.js +98 -0
  61. package/dist/domain/externalReferenceRegionRelationships.js.map +1 -0
  62. package/dist/domain/externalReferenceRegions.d.ts +65 -0
  63. package/dist/domain/externalReferenceRegions.js +105 -0
  64. package/dist/domain/externalReferenceRegions.js.map +1 -0
  65. package/dist/domain/externalReferenceRequirementIdentity.d.ts +12 -0
  66. package/dist/domain/externalReferenceRequirementIdentity.js +35 -0
  67. package/dist/domain/externalReferenceRequirementIdentity.js.map +1 -0
  68. package/dist/domain/externalReferenceRequirements.d.ts +215 -0
  69. package/dist/domain/externalReferenceRequirements.js +401 -0
  70. package/dist/domain/externalReferenceRequirements.js.map +1 -0
  71. package/dist/domain/externalReferenceRuntimeBinding.d.ts +146 -0
  72. package/dist/domain/externalReferenceRuntimeBinding.js +183 -0
  73. package/dist/domain/externalReferenceRuntimeBinding.js.map +1 -0
  74. package/dist/domain/identity.d.ts +11 -8
  75. package/dist/domain/identity.js +12 -8
  76. package/dist/domain/identity.js.map +1 -1
  77. package/dist/domain/referenceCorrectionIdentity.d.ts +40 -0
  78. package/dist/domain/referenceCorrectionIdentity.js +77 -0
  79. package/dist/domain/referenceCorrectionIdentity.js.map +1 -0
  80. package/dist/domain/referenceCorrectionWorkflow.d.ts +160 -0
  81. package/dist/domain/referenceCorrectionWorkflow.js +165 -0
  82. package/dist/domain/referenceCorrectionWorkflow.js.map +1 -0
  83. package/dist/domain/referenceFidelityProjection.d.ts +65 -0
  84. package/dist/domain/referenceFidelityProjection.js +135 -0
  85. package/dist/domain/referenceFidelityProjection.js.map +1 -0
  86. package/dist/domain/relationships.d.ts +43 -1
  87. package/dist/domain/relationships.js +15 -6
  88. package/dist/domain/relationships.js.map +1 -1
  89. package/dist/domain/schema.js +6 -0
  90. package/dist/domain/schema.js.map +1 -1
  91. package/dist/index.d.ts +44 -2
  92. package/dist/index.js +24 -1
  93. package/dist/index.js.map +1 -1
  94. package/dist/request/request.d.ts +12 -0
  95. package/dist/request/request.js +12 -0
  96. package/dist/request/request.js.map +1 -1
  97. package/docs/ARCHITECTURE.md +341 -19
  98. package/docs/CI_CD.md +71 -0
  99. package/docs/COMMANDS.md +187 -0
  100. package/docs/CONTRACTS.md +1416 -13
  101. package/docs/CURRENT_STATE.md +508 -14
  102. package/docs/DEVELOPMENT.md +5 -3
  103. package/docs/DOCUMENTATION_PRESERVATION_POLICY.md +33 -33
  104. package/docs/PROJECT_DESCRIPTION.md +2195 -1770
  105. package/docs/PROJECT_MILESTONES.md +2526 -2073
  106. package/docs/PROJECT_OVERVIEW.md +63 -14
  107. package/docs/QUICKSTART.md +6 -0
  108. package/docs/RELEASE.md +28 -21
  109. package/docs/ROADMAP.md +241 -99
  110. package/docs/SECURITY.md +97 -4
  111. package/docs/WORKFLOWS.md +391 -24
  112. package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -0
  113. package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -0
  114. package/docs/reports/v0.7-pre-release-readiness.md +337 -0
  115. package/docs/reports/v0.7-reference-binding-prompt5.md +223 -0
  116. package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -0
  117. package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -0
  118. package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -0
  119. package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -0
  120. package/docs/reports/v0.7-reference-regions-prompt2.md +195 -0
  121. package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -0
  122. package/docs/reports/v0.7-release-prep.md +423 -0
  123. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ import type { ExternalReferenceArtifact } from '../domain/externalReference.js';
2
+ import type { Diagnostic } from '../domain/diagnostics.js';
3
+ export declare const EXTERNAL_REFERENCE_MANIFEST_FILENAME = "manifest.json";
4
+ /**
5
+ * Observer-owned result of persisting one ExternalReferenceArtifact. Mirrors
6
+ * PersistedObservationResult/PersistedComparisonResult's shape but is its own
7
+ * type: an 'imported' artifact's directory has one owned image file; an
8
+ * 'approved' artifact's directory has only manifest.json.
9
+ */
10
+ export type PersistedExternalReferenceResult = {
11
+ ok: true;
12
+ artifactRoot: string;
13
+ manifestPath: string;
14
+ imagePath?: string;
15
+ } | {
16
+ ok: false;
17
+ diagnostics: Diagnostic[];
18
+ };
19
+ export interface WriteExternalReferenceArtifactOptions {
20
+ /** Base directory that `outputLocation` is resolved against. Defaults to `process.cwd()`. */
21
+ cwd?: string;
22
+ }
23
+ /**
24
+ * Persists one already-assembled, already-validated ExternalReferenceArtifact
25
+ * as one portable artifact directory: `<outputLocation>/<referenceId>/`.
26
+ * For an 'imported' artifact (which owns its reference image), `imageBytes`
27
+ * is required and is written before manifest.json, mirroring
28
+ * `artifacts/artifactWriter.ts#writeObservationArtifact`'s media-before-manifest
29
+ * discipline. For an 'approved' artifact (which only ever carries a
30
+ * `sourceReference` back to the imported artifact that owns the image - see
31
+ * `domain/externalReference.ts`), no image bytes are written at all, mirroring
32
+ * `artifacts/comparisonArtifactWriter.ts#writeComparisonArtifact`'s
33
+ * manifest-only, no-media-copy persistence.
34
+ *
35
+ * `referenceId` is guaranteed fresh per persisted instance (see
36
+ * `domain/externalReferenceIdentity.ts#buildExternalReferenceInstanceIdentity`'s
37
+ * "never collides" contract), so each write targets its own unique
38
+ * subdirectory; an existing directory at that path is treated as a genuine
39
+ * collision and rejected rather than overwritten - no persisted evidence,
40
+ * imported or approved, is ever destructively replaced. Writing happens in a
41
+ * sibling temporary directory first, and the whole temporary directory is
42
+ * only exposed under its real name via one atomic rename.
43
+ */
44
+ export declare function writeExternalReferenceArtifact(artifact: ExternalReferenceArtifact, imageBytes: Uint8Array | undefined, outputLocation: string, options?: WriteExternalReferenceArtifactOptions): Promise<PersistedExternalReferenceResult>;
@@ -0,0 +1,77 @@
1
+ import { mkdir, writeFile, rename, rm, access } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { isValidExternalReferenceArtifact, isImportedExternalReferenceArtifact } from '../domain/externalReference.js';
4
+ import { DIAGNOSTIC_SEVERITY } from '../domain/diagnostics.js';
5
+ export const EXTERNAL_REFERENCE_MANIFEST_FILENAME = 'manifest.json';
6
+ function writeFailure(message, details) {
7
+ const diagnostic = {
8
+ code: 'artifact-write-failure',
9
+ severity: DIAGNOSTIC_SEVERITY['artifact-write-failure'],
10
+ message,
11
+ ...(details === undefined ? {} : { details }),
12
+ };
13
+ return { ok: false, diagnostics: [diagnostic] };
14
+ }
15
+ async function pathExists(candidate) {
16
+ return access(candidate).then(() => true, () => false);
17
+ }
18
+ /**
19
+ * Persists one already-assembled, already-validated ExternalReferenceArtifact
20
+ * as one portable artifact directory: `<outputLocation>/<referenceId>/`.
21
+ * For an 'imported' artifact (which owns its reference image), `imageBytes`
22
+ * is required and is written before manifest.json, mirroring
23
+ * `artifacts/artifactWriter.ts#writeObservationArtifact`'s media-before-manifest
24
+ * discipline. For an 'approved' artifact (which only ever carries a
25
+ * `sourceReference` back to the imported artifact that owns the image - see
26
+ * `domain/externalReference.ts`), no image bytes are written at all, mirroring
27
+ * `artifacts/comparisonArtifactWriter.ts#writeComparisonArtifact`'s
28
+ * manifest-only, no-media-copy persistence.
29
+ *
30
+ * `referenceId` is guaranteed fresh per persisted instance (see
31
+ * `domain/externalReferenceIdentity.ts#buildExternalReferenceInstanceIdentity`'s
32
+ * "never collides" contract), so each write targets its own unique
33
+ * subdirectory; an existing directory at that path is treated as a genuine
34
+ * collision and rejected rather than overwritten - no persisted evidence,
35
+ * imported or approved, is ever destructively replaced. Writing happens in a
36
+ * sibling temporary directory first, and the whole temporary directory is
37
+ * only exposed under its real name via one atomic rename.
38
+ */
39
+ export async function writeExternalReferenceArtifact(artifact, imageBytes, outputLocation, options = {}) {
40
+ const validation = isValidExternalReferenceArtifact(artifact);
41
+ if (!validation.valid) {
42
+ return writeFailure(`refusing to persist an invalid ExternalReferenceArtifact: ${validation.reason}`);
43
+ }
44
+ if (artifact.lifecycle.state === 'imported' && imageBytes === undefined) {
45
+ return writeFailure('refusing to persist an "imported" ExternalReferenceArtifact without its image bytes');
46
+ }
47
+ const cwd = options.cwd ?? process.cwd();
48
+ const outputRoot = path.resolve(cwd, outputLocation);
49
+ const finalRoot = path.join(outputRoot, artifact.referenceId);
50
+ const tempRoot = path.join(outputRoot, `.tmp-${artifact.referenceId}`);
51
+ if (await pathExists(finalRoot)) {
52
+ return writeFailure(`an external-reference artifact already exists at "${artifact.referenceId}"; refusing to overwrite it`, {
53
+ artifactRoot: finalRoot,
54
+ });
55
+ }
56
+ try {
57
+ await rm(tempRoot, { recursive: true, force: true });
58
+ await mkdir(tempRoot, { recursive: true });
59
+ if (isImportedExternalReferenceArtifact(artifact)) {
60
+ await writeFile(path.join(tempRoot, artifact.image.path), imageBytes);
61
+ }
62
+ await writeFile(path.join(tempRoot, EXTERNAL_REFERENCE_MANIFEST_FILENAME), JSON.stringify(artifact, null, 2), 'utf8');
63
+ await rename(tempRoot, finalRoot);
64
+ return {
65
+ ok: true,
66
+ artifactRoot: finalRoot,
67
+ manifestPath: path.join(finalRoot, EXTERNAL_REFERENCE_MANIFEST_FILENAME),
68
+ ...(isImportedExternalReferenceArtifact(artifact) ? { imagePath: path.join(finalRoot, artifact.image.path) } : {}),
69
+ };
70
+ }
71
+ catch (err) {
72
+ await rm(tempRoot, { recursive: true, force: true }).catch(() => undefined);
73
+ const message = err instanceof Error ? err.message : String(err);
74
+ return writeFailure(`failed to persist external-reference artifact: ${message}`);
75
+ }
76
+ }
77
+ //# sourceMappingURL=externalReferenceArtifactWriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalReferenceArtifactWriter.js","sourceRoot":"","sources":["../../src/artifacts/externalReferenceArtifactWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,gCAAgC,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAEvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,MAAM,oCAAoC,GAAG,eAAe,CAAC;AAoBpE,SAAS,YAAY,CAAC,OAAe,EAAE,OAAiC;IACtE,MAAM,UAAU,GAAe;QAC7B,IAAI,EAAE,wBAAwB;QAC9B,QAAQ,EAAE,mBAAmB,CAAC,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