@dailephd/my-dev-kit-lab 0.4.2 → 0.4.4

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 (113) hide show
  1. package/README.md +28 -113
  2. package/benchmarks/contracts/todo-behavior.md +1 -1
  3. package/benchmarks/projects/task-analytics-large-mixed/README.md +2 -0
  4. package/benchmarks/projects/task-workflow-medium-ts/README.md +3 -1
  5. package/dist/src/evaluation/stageContextDeterminism/calculateStageContextDeterminism.js +52 -0
  6. package/dist/src/evaluation/stageContextDeterminism/canonicalizeStageContextRun.js +53 -0
  7. package/dist/src/evaluation/stageContextDeterminism/index.js +2 -0
  8. package/dist/src/evaluation/stageContextDeterminism/types.js +1 -0
  9. package/dist/src/evaluation/stageContextExpectations/index.js +2 -0
  10. package/dist/src/evaluation/stageContextExpectations/producerReadinessExpectationTypes.js +8 -0
  11. package/dist/src/evaluation/stageContextExpectations/readStageContextExpectationFixtureV1.js +50 -0
  12. package/dist/src/evaluation/stageContextExpectations/readTypes.js +1 -0
  13. package/dist/src/evaluation/stageContextExpectations/types.js +1 -0
  14. package/dist/src/evaluation/stageContextExpectations/validation.js +768 -0
  15. package/dist/src/evaluation/stageContextMetrics/calculateAllocationMetrics.js +96 -0
  16. package/dist/src/evaluation/stageContextMetrics/calculateArtifactStateMetrics.js +130 -0
  17. package/dist/src/evaluation/stageContextMetrics/calculateContextSizeMetrics.js +85 -0
  18. package/dist/src/evaluation/stageContextMetrics/calculateCriticalityMetrics.js +112 -0
  19. package/dist/src/evaluation/stageContextMetrics/calculateExpectationMetrics.js +103 -0
  20. package/dist/src/evaluation/stageContextMetrics/calculateOwnerMetrics.js +84 -0
  21. package/dist/src/evaluation/stageContextMetrics/calculateReadinessAgreement.js +152 -0
  22. package/dist/src/evaluation/stageContextMetrics/calculateResponsibilityMappingMetrics.js +36 -0
  23. package/dist/src/evaluation/stageContextMetrics/calculateSupplementalRawAgreement.js +50 -0
  24. package/dist/src/evaluation/stageContextMetrics/calculateTruncationClassification.js +44 -0
  25. package/dist/src/evaluation/stageContextMetrics/collectContextCapsuleEvidence.js +312 -0
  26. package/dist/src/evaluation/stageContextMetrics/collectRetrievalAuditEvidence.js +35 -0
  27. package/dist/src/evaluation/stageContextMetrics/collectWorkflowInstructionEvidence.js +137 -0
  28. package/dist/src/evaluation/stageContextMetrics/evaluateProducerReadinessBridge.js +127 -0
  29. package/dist/src/evaluation/stageContextMetrics/evaluateV043StageContextExecution.js +247 -0
  30. package/dist/src/evaluation/stageContextMetrics/index.js +17 -0
  31. package/dist/src/evaluation/stageContextMetrics/matchStageContextExpectations.js +38 -0
  32. package/dist/src/evaluation/stageContextMetrics/producerReadinessMetricTypes.js +1 -0
  33. package/dist/src/evaluation/stageContextMetrics/targetKeys.js +35 -0
  34. package/dist/src/evaluation/stageContextMetrics/types.js +1 -0
  35. package/dist/src/evaluation/stageContextSelectors/contextArtifactConsistency.js +89 -0
  36. package/dist/src/evaluation/stageContextSelectors/contextCapsuleSelectors.js +126 -0
  37. package/dist/src/evaluation/stageContextSelectors/index.js +4 -0
  38. package/dist/src/evaluation/stageContextSelectors/retrievalAuditRecordSelectors.js +54 -0
  39. package/dist/src/evaluation/stageContextSelectors/workflowInstructionPacketSelectors.js +51 -0
  40. package/dist/src/evaluation/targetImmutability/captureTargetSnapshot.js +208 -0
  41. package/dist/src/evaluation/targetImmutability/compareTargetSnapshots.js +56 -0
  42. package/dist/src/evaluation/targetImmutability/index.js +3 -0
  43. package/dist/src/evaluation/targetImmutability/types.js +1 -0
  44. package/dist/src/evaluation/targetImmutability/validateTargetImmutabilityConfig.js +130 -0
  45. package/dist/src/evaluation/upstreamArtifacts/artifactReadTypes.js +1 -0
  46. package/dist/src/evaluation/upstreamArtifacts/index.js +9 -0
  47. package/dist/src/evaluation/upstreamArtifacts/jsonTypes.js +1 -0
  48. package/dist/src/evaluation/upstreamArtifacts/myDevKitClassificationTypesV1.js +1 -0
  49. package/dist/src/evaluation/upstreamArtifacts/myDevKitContextArtifactsV1.js +1 -0
  50. package/dist/src/evaluation/upstreamArtifacts/myDevKitSemanticTypesV1.js +1 -0
  51. package/dist/src/evaluation/upstreamArtifacts/orchestratorContextReadinessResultV1.js +247 -0
  52. package/dist/src/evaluation/upstreamArtifacts/orchestratorWorkflowInstructionPacketV1.js +1 -0
  53. package/dist/src/evaluation/upstreamArtifacts/readImplementationContextPacketV1.js +9 -0
  54. package/dist/src/evaluation/upstreamArtifacts/readImplementationContextRetrievalReportV1.js +9 -0
  55. package/dist/src/evaluation/upstreamArtifacts/readJsonArtifact.js +53 -0
  56. package/dist/src/evaluation/upstreamArtifacts/readMyDevKitContextCapsuleV1.js +9 -0
  57. package/dist/src/evaluation/upstreamArtifacts/readMyDevKitRetrievalAuditRecordV1.js +9 -0
  58. package/dist/src/evaluation/upstreamArtifacts/readOrchestratorWorkflowInstructionPacketV1.js +9 -0
  59. package/dist/src/evaluation/upstreamArtifacts/readSupplementalContextTextFile.js +29 -0
  60. package/dist/src/evaluation/upstreamArtifacts/readTestContextPacketV1.js +9 -0
  61. package/dist/src/evaluation/upstreamArtifacts/readTestContextRetrievalReportV1.js +9 -0
  62. package/dist/src/evaluation/upstreamArtifacts/runtimeValidation.js +131 -0
  63. package/dist/src/evaluation/upstreamArtifacts/schemaVersion.js +32 -0
  64. package/dist/src/evaluation/upstreamArtifacts/supplementalContextTextParser.js +75 -0
  65. package/dist/src/evaluation/upstreamArtifacts/supplementalContextTypes.js +152 -0
  66. package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitContextCapsuleV1.js +1208 -0
  67. package/dist/src/evaluation/upstreamArtifacts/validateMyDevKitRetrievalAuditRecordV1.js +112 -0
  68. package/dist/src/evaluation/upstreamArtifacts/validateOrchestratorWorkflowInstructionPacketV1.js +235 -0
  69. package/dist/src/evaluation/upstreamArtifacts/validateSupplementalContextDocumentV1.js +148 -0
  70. package/dist/src/experiments/plugins/contextStrategyComparison/executeV043StageContextStrategy.js +46 -0
  71. package/dist/src/experiments/plugins/contextStrategyComparison/index.js +9 -0
  72. package/dist/src/experiments/plugins/contextStrategyComparison/loadV043StrategyArtifacts.js +397 -0
  73. package/dist/src/experiments/plugins/contextStrategyComparison/plugin.js +39 -1
  74. package/dist/src/experiments/plugins/contextStrategyComparison/readV043FullWorkflowLibraryFixture.js +162 -0
  75. package/dist/src/experiments/plugins/contextStrategyComparison/resolveV043StrategyInputs.js +43 -0
  76. package/dist/src/experiments/plugins/contextStrategyComparison/resultMapping.js +3 -0
  77. package/dist/src/experiments/plugins/contextStrategyComparison/runV043StageContextStrategyWithAssurance.js +205 -0
  78. package/dist/src/experiments/plugins/contextStrategyComparison/v043FullWorkflowLibraryFixture.js +1 -0
  79. package/dist/src/experiments/plugins/contextStrategyComparison/v043RunAssuranceTypes.js +1 -0
  80. package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyExecutionTypes.js +1 -0
  81. package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyIds.js +13 -0
  82. package/dist/src/experiments/plugins/contextStrategyComparison/v043StrategyInputContracts.js +1 -0
  83. package/dist/src/experiments/plugins/contextStrategyComparison/validateV043RunAssuranceConfig.js +59 -0
  84. package/dist/src/experiments/plugins/contextStrategyComparison/validateV043StrategyInput.js +266 -0
  85. package/dist/src/report/experiments/buildContextStrategyComparisonV043Report.js +520 -0
  86. package/dist/src/report/experiments/buildPluginExperimentReport.js +21 -6
  87. package/dist/src/report/experiments/contextStrategyComparisonV043ReportModel.js +1 -0
  88. package/dist/src/report/experiments/index.js +4 -0
  89. package/dist/src/report/experiments/renderContextStrategyComparisonV043Html.js +296 -0
  90. package/dist/src/report/experiments/renderPluginExperimentReportHtml.js +3 -0
  91. package/dist/src/report/experiments/renderPluginExperimentReportText.js +292 -0
  92. package/dist/src/report/experiments/writePluginExperimentReports.js +3 -0
  93. package/dist/src/securityValidation/attackScenarios/scenarios/secretLeakageScenario.js +215 -9
  94. package/docs/METRICS.md +84 -10
  95. package/package.json +2 -2
  96. package/tests/fixtures/full-workflow-library/complete-v1.0.0.json +24 -0
  97. package/tests/fixtures/full-workflow-library/future-minor-v1.1.0-additive.json +25 -0
  98. package/tests/fixtures/stage-context-expectations/complete-v1.0.0.json +230 -0
  99. package/tests/fixtures/stage-context-expectations/future-minor-v1.1.0-additive.json +232 -0
  100. package/tests/fixtures/stage-context-expectations/invalid/malformed-json.txt +1 -0
  101. package/tests/fixtures/stage-context-expectations/invalid/non-object-root.json +1 -0
  102. package/tests/fixtures/stage-context-expectations/minimal-v1.0.0.json +18 -0
  103. package/tests/fixtures/upstream-artifacts/invalid/malformed-json.txt +1 -0
  104. package/tests/fixtures/upstream-artifacts/invalid/non-object-root.json +1 -0
  105. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/complete-v1.0.0.json +504 -0
  106. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/context-capsule/future-minor-v1.1.0-additive.json +955 -0
  107. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/complete-v1.0.0.json +190 -0
  108. package/tests/fixtures/upstream-artifacts/my-dev-kit/1.10.2/retrieval-audit-record/future-minor-v1.1.0-additive.json +327 -0
  109. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/PROVENANCE.txt +13 -0
  110. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/context-capsule.json +7874 -0
  111. package/tests/fixtures/upstream-artifacts/my-dev-kit-1.10.2-identity/retrieval-audit-record.json +1076 -0
  112. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/complete-v1.0.0.json +160 -0
  113. package/tests/fixtures/upstream-artifacts/my-dev-kit-orchestrator/1.2.1/workflow-instruction-packet/future-minor-v1.1.0-additive.json +186 -0
@@ -0,0 +1,131 @@
1
+ export function joinFieldPath(parent, child) {
2
+ return parent.length === 0 ? child : `${parent}.${child}`;
3
+ }
4
+ export function arrayFieldPath(parent, index) {
5
+ return `${parent}[${index}]`;
6
+ }
7
+ export function makeFailure(artifactKind, sourcePath, code, message, fieldPath, expected, actual) {
8
+ return { ok: false, artifactKind, sourcePath, code, message, fieldPath, expected, actual };
9
+ }
10
+ export class ArtifactValidationError extends Error {
11
+ failure;
12
+ constructor(failure) {
13
+ super(failure.message);
14
+ this.failure = failure;
15
+ }
16
+ }
17
+ function fail(artifactKind, sourcePath, code, message, fieldPath, expected, actual) {
18
+ throw new ArtifactValidationError(makeFailure(artifactKind, sourcePath, code, message, fieldPath, expected, actual));
19
+ }
20
+ export function requiredField(ctx, obj, key, fieldPath) {
21
+ if (!(key in obj)) {
22
+ fail(ctx.artifactKind, ctx.sourcePath, "MISSING_REQUIRED_FIELD", `Artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" is missing required field "${fieldPath}".`, fieldPath, "present");
23
+ }
24
+ return obj[key];
25
+ }
26
+ export function optionalField(obj, key) {
27
+ return key in obj ? obj[key] : undefined;
28
+ }
29
+ export function requiredObject(ctx, value, fieldPath) {
30
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
31
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be an object.`, fieldPath, "object", value);
32
+ }
33
+ return value;
34
+ }
35
+ export function requiredString(ctx, value, fieldPath) {
36
+ if (typeof value !== "string") {
37
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a string.`, fieldPath, "string", value);
38
+ }
39
+ return value;
40
+ }
41
+ export function optionalString(ctx, value, fieldPath) {
42
+ if (value === undefined)
43
+ return undefined;
44
+ return requiredString(ctx, value, fieldPath);
45
+ }
46
+ export function requiredNullableString(ctx, value, fieldPath) {
47
+ if (value === null)
48
+ return null;
49
+ return requiredString(ctx, value, fieldPath);
50
+ }
51
+ export function optionalNullableString(ctx, value, fieldPath) {
52
+ if (value === undefined)
53
+ return undefined;
54
+ return requiredNullableString(ctx, value, fieldPath);
55
+ }
56
+ export function requiredBoolean(ctx, value, fieldPath) {
57
+ if (typeof value !== "boolean") {
58
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a boolean.`, fieldPath, "boolean", value);
59
+ }
60
+ return value;
61
+ }
62
+ export function optionalBoolean(ctx, value, fieldPath) {
63
+ if (value === undefined)
64
+ return undefined;
65
+ return requiredBoolean(ctx, value, fieldPath);
66
+ }
67
+ export function requiredNumber(ctx, value, fieldPath) {
68
+ if (typeof value !== "number" || !Number.isFinite(value)) {
69
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a finite number.`, fieldPath, "number", value);
70
+ }
71
+ return value;
72
+ }
73
+ export function optionalNumber(ctx, value, fieldPath) {
74
+ if (value === undefined)
75
+ return undefined;
76
+ return requiredNumber(ctx, value, fieldPath);
77
+ }
78
+ export function requiredNullableNumber(ctx, value, fieldPath) {
79
+ if (value === null)
80
+ return null;
81
+ return requiredNumber(ctx, value, fieldPath);
82
+ }
83
+ export function requiredNonnegativeInteger(ctx, value, fieldPath) {
84
+ const n = requiredNumber(ctx, value, fieldPath);
85
+ if (!Number.isInteger(n) || n < 0) {
86
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a nonnegative integer.`, fieldPath, "nonnegative integer", value);
87
+ }
88
+ return n;
89
+ }
90
+ export function requiredLiteral(ctx, value, fieldPath, allowed) {
91
+ const str = requiredString(ctx, value, fieldPath);
92
+ if (!allowed.includes(str)) {
93
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_LITERAL_VALUE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" has invalid value "${str}". Expected one of: ${allowed.join(", ")}.`, fieldPath, allowed.join(" | "), str);
94
+ }
95
+ return str;
96
+ }
97
+ export function optionalLiteral(ctx, value, fieldPath, allowed) {
98
+ if (value === undefined)
99
+ return undefined;
100
+ return requiredLiteral(ctx, value, fieldPath, allowed);
101
+ }
102
+ export function requiredNullableLiteral(ctx, value, fieldPath, allowed) {
103
+ if (value === null)
104
+ return null;
105
+ return requiredLiteral(ctx, value, fieldPath, allowed);
106
+ }
107
+ export function requiredArray(ctx, value, fieldPath) {
108
+ if (!Array.isArray(value)) {
109
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be an array.`, fieldPath, "array", value);
110
+ }
111
+ return value;
112
+ }
113
+ export function requiredStringArray(ctx, value, fieldPath) {
114
+ const arr = requiredArray(ctx, value, fieldPath);
115
+ return arr.map((item, index) => requiredString(ctx, item, arrayFieldPath(fieldPath, index)));
116
+ }
117
+ export function requiredRecord(ctx, value, fieldPath) {
118
+ return requiredObject(ctx, value, fieldPath);
119
+ }
120
+ export function requiredScalarLike(ctx, value, fieldPath) {
121
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
122
+ return value;
123
+ }
124
+ fail(ctx.artifactKind, ctx.sourcePath, "INVALID_FIELD_TYPE", `Field "${fieldPath}" in artifact "${ctx.artifactKind}" at "${ctx.sourcePath}" must be a string, number, boolean, or null.`, fieldPath, "string | number | boolean | null", value);
125
+ }
126
+ export function requiredScalarOrStringArrayLike(ctx, value, fieldPath) {
127
+ if (Array.isArray(value)) {
128
+ return value.map((item, index) => requiredString(ctx, item, arrayFieldPath(fieldPath, index)));
129
+ }
130
+ return requiredScalarLike(ctx, value, fieldPath);
131
+ }
@@ -0,0 +1,32 @@
1
+ const SCHEMA_VERSION_PATTERN = /^[0-9]+\.[0-9]+\.[0-9]+$/;
2
+ export function parseSupportedMajorOneSchemaVersion(value, artifactKind, sourcePath, fieldPath = "schemaVersion") {
3
+ if (typeof value !== "string" || !SCHEMA_VERSION_PATTERN.test(value)) {
4
+ return {
5
+ ok: false,
6
+ artifactKind,
7
+ sourcePath,
8
+ code: "INVALID_SCHEMA_VERSION",
9
+ message: `Artifact "${artifactKind}" at "${sourcePath}" has an invalid "${fieldPath}": expected strict "x.y.z" semantic version.`,
10
+ fieldPath,
11
+ expected: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
12
+ actual: value
13
+ };
14
+ }
15
+ const [majorText, minorText, patchText] = value.split(".");
16
+ const major = Number(majorText);
17
+ const minor = Number(minorText);
18
+ const patch = Number(patchText);
19
+ if (major !== 1) {
20
+ return {
21
+ ok: false,
22
+ artifactKind,
23
+ sourcePath,
24
+ code: "UNSUPPORTED_SCHEMA_MAJOR",
25
+ message: `Artifact "${artifactKind}" at "${sourcePath}" has unsupported schema major "${major}" in "${fieldPath}": supported major is 1.`,
26
+ fieldPath,
27
+ expected: "1",
28
+ actual: value
29
+ };
30
+ }
31
+ return { version: value, major: 1, minor, patch };
32
+ }
@@ -0,0 +1,75 @@
1
+ // Deterministic line-based parser for the frozen my-dev-kit-orchestrator supplemental
2
+ // repository-context document format (commit bc08a05d3b52a629e7e4504372af199c324c4ae4,
3
+ // src/instructions/supplementalContextParser.ts): "Key: value" metadata lines before the
4
+ // first "## " heading, then "## Heading" sections running to the next heading or EOF.
5
+ // Independently re-derived from the frozen contract for the lab's own read-only boundary;
6
+ // never imports orchestrator runtime code. Structural classification only -- never
7
+ // evaluates whether a declared value is true.
8
+ const METADATA_LINE_RE = /^([A-Za-z][A-Za-z0-9 -]*): (.*)$/;
9
+ const SECTION_HEADING_RE = /^## (.+)$/;
10
+ export function parseSupplementalContextText(text) {
11
+ const lines = text.split(/\r\n|\n/);
12
+ const metadata = {};
13
+ const metadataOrder = [];
14
+ const duplicateMetadataKeys = [];
15
+ const emptyMetadataKeys = [];
16
+ let i = 0;
17
+ for (; i < lines.length; i++) {
18
+ const line = lines[i];
19
+ if (SECTION_HEADING_RE.test(line))
20
+ break;
21
+ const match = line.match(METADATA_LINE_RE);
22
+ if (!match)
23
+ continue;
24
+ const key = match[1];
25
+ const value = match[2].trim();
26
+ if (Object.prototype.hasOwnProperty.call(metadata, key)) {
27
+ duplicateMetadataKeys.push(key);
28
+ continue;
29
+ }
30
+ if (value.length === 0) {
31
+ emptyMetadataKeys.push(key);
32
+ }
33
+ metadata[key] = value;
34
+ metadataOrder.push(key);
35
+ }
36
+ const sections = {};
37
+ const sectionOrder = [];
38
+ const duplicateSectionHeadings = [];
39
+ let currentHeading = null;
40
+ let currentLines = [];
41
+ const flush = () => {
42
+ if (currentHeading === null)
43
+ return;
44
+ const content = currentLines.join("\n").trim();
45
+ if (Object.prototype.hasOwnProperty.call(sections, currentHeading)) {
46
+ duplicateSectionHeadings.push(currentHeading);
47
+ }
48
+ else {
49
+ sections[currentHeading] = content;
50
+ sectionOrder.push(currentHeading);
51
+ }
52
+ };
53
+ for (; i < lines.length; i++) {
54
+ const line = lines[i];
55
+ const headingMatch = line.match(SECTION_HEADING_RE);
56
+ if (headingMatch) {
57
+ flush();
58
+ currentHeading = headingMatch[1].trim();
59
+ currentLines = [];
60
+ }
61
+ else if (currentHeading !== null) {
62
+ currentLines.push(line);
63
+ }
64
+ }
65
+ flush();
66
+ return {
67
+ metadata,
68
+ metadataOrder,
69
+ sections,
70
+ sectionOrder,
71
+ duplicateMetadataKeys,
72
+ emptyMetadataKeys,
73
+ duplicateSectionHeadings
74
+ };
75
+ }
@@ -0,0 +1,152 @@
1
+ // Lab-owned structural mirror of the frozen my-dev-kit-orchestrator supplemental
2
+ // repository-context document vocabulary (commit bc08a05d3b52a629e7e4504372af199c324c4ae4,
3
+ // src/instructions/supplementalContextTypes.ts). The lab never imports orchestrator
4
+ // runtime code; this file only restates the frozen vocabulary needed to validate and
5
+ // preserve documents the orchestrator already writes.
6
+ export const SUPPLEMENTAL_CONTEXT_PACKET_SCHEMA_SUPPORTED_MAJOR = 1;
7
+ export const SUPPLEMENTAL_CONTEXT_RETRIEVAL_REPORT_SCHEMA_SUPPORTED_MAJOR = 1;
8
+ export const ROLE_BY_DOCUMENT_KIND = {
9
+ "implementation-context-packet": "implementation",
10
+ "implementation-context-retrieval-report": "implementation",
11
+ "test-context-packet": "test-implementation",
12
+ "test-context-retrieval-report": "test-implementation"
13
+ };
14
+ export function isRetrievalReportKind(kind) {
15
+ return kind === "implementation-context-retrieval-report" || kind === "test-context-retrieval-report";
16
+ }
17
+ export function isTestKind(kind) {
18
+ return kind === "test-context-packet" || kind === "test-context-retrieval-report";
19
+ }
20
+ const COMMON_PACKET_METADATA = [
21
+ "Schema version",
22
+ "Document kind",
23
+ "Role",
24
+ "Status",
25
+ "Repository scope",
26
+ "Freshness",
27
+ "Adequacy",
28
+ "Required evidence truncated",
29
+ "Context capsule schema version",
30
+ "Retrieval audit schema version",
31
+ "Tool name",
32
+ "Tool version",
33
+ "Index identity"
34
+ ];
35
+ const COMMON_REPORT_METADATA = [
36
+ "Schema version",
37
+ "Document kind",
38
+ "Role",
39
+ "Status",
40
+ "Repository scope",
41
+ "Request schema version",
42
+ "Context capsule schema version",
43
+ "Retrieval audit schema version",
44
+ "Tool name",
45
+ "Tool version",
46
+ "Index identity",
47
+ "Freshness",
48
+ "Adequacy",
49
+ "Required evidence truncated",
50
+ "Full-file fallback used",
51
+ "Determinism checked"
52
+ ];
53
+ const TEST_ONLY_METADATA = ["Responsibility mappings truncated", "Critical responsibility mapping status"];
54
+ export const REQUIRED_METADATA_BY_DOCUMENT_KIND = {
55
+ "implementation-context-packet": COMMON_PACKET_METADATA,
56
+ "implementation-context-retrieval-report": COMMON_REPORT_METADATA,
57
+ "test-context-packet": [...COMMON_PACKET_METADATA, ...TEST_ONLY_METADATA],
58
+ "test-context-retrieval-report": [...COMMON_REPORT_METADATA, ...TEST_ONLY_METADATA]
59
+ };
60
+ export const REQUIRED_SECTIONS_BY_DOCUMENT_KIND = {
61
+ "implementation-context-packet": [
62
+ "Focus",
63
+ "Selected owners",
64
+ "Dependencies",
65
+ "Contracts",
66
+ "Validators",
67
+ "Constants",
68
+ "Errors",
69
+ "Schemas",
70
+ "Callers and callees",
71
+ "Closest tests",
72
+ "Test infrastructure",
73
+ "Test commands",
74
+ "Unresolved items",
75
+ "Budget and truncation",
76
+ "Full-file fallback",
77
+ "Provenance",
78
+ "Assumptions",
79
+ "Notes"
80
+ ],
81
+ "implementation-context-retrieval-report": [
82
+ "Retrieval request",
83
+ "Command record",
84
+ "Focus selection",
85
+ "Candidate and owner selection",
86
+ "Evidence groups",
87
+ "Unresolved evidence",
88
+ "Adequacy evaluation",
89
+ "Freshness classification",
90
+ "Budget",
91
+ "Truncation",
92
+ "Full-file fallback",
93
+ "Provenance",
94
+ "Warnings",
95
+ "Determinism",
96
+ "Assumptions",
97
+ "Notes"
98
+ ],
99
+ "test-context-packet": [
100
+ "Changed surface",
101
+ "Production owners",
102
+ "Production contracts",
103
+ "Validators",
104
+ "Constants",
105
+ "Errors",
106
+ "Schemas",
107
+ "Closest tests",
108
+ "Test infrastructure",
109
+ "Test commands",
110
+ "Test responsibilities",
111
+ "Responsibility mappings",
112
+ "Reusable test helpers",
113
+ "Oracle evidence",
114
+ "Unresolved items",
115
+ "Budget and truncation",
116
+ "Full-file fallback",
117
+ "Provenance",
118
+ "Assumptions",
119
+ "Notes"
120
+ ],
121
+ "test-context-retrieval-report": [
122
+ "Retrieval request",
123
+ "Command record",
124
+ "Changed-surface selection",
125
+ "Production-owner selection",
126
+ "Test-infrastructure discovery",
127
+ "Test-command discovery",
128
+ "Responsibility mapping",
129
+ "Criticality overlay",
130
+ "Adequacy evaluation",
131
+ "Freshness classification",
132
+ "Budget",
133
+ "Truncation",
134
+ "Full-file fallback",
135
+ "Provenance",
136
+ "Warnings",
137
+ "Determinism",
138
+ "Assumptions",
139
+ "Notes"
140
+ ]
141
+ };
142
+ export const VALID_REPOSITORY_SCOPES = ["single-repository", "source-target"];
143
+ export const VALID_DECLARED_STATUSES = ["template", "populated"];
144
+ export const VALID_FRESHNESS_VALUES = ["fresh", "stale", "unknown"];
145
+ export const VALID_ADEQUACY_VALUES = [
146
+ "sufficient",
147
+ "sufficient-with-assumptions",
148
+ "insufficient",
149
+ "conflict",
150
+ "unknown"
151
+ ];
152
+ export const VALID_TRUNCATION_VALUES = ["yes", "no", "unknown"];