refactor: use canonical implementations and types directly
Remove forwarding wrappers and shadow aliases, migrate callers and verification scripts to their owners, and share one exhaustive semantic resource-bound projection.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
||||
import { digestCanonicalValue } from "../domain/canonicalDigest.js";
|
||||
import { createEvidence } from "../domain/evidence.js";
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
|
||||
const inventory = (digit: string) => {
|
||||
const sha = digit.repeat(64);
|
||||
const artifactId = `art_${canonicalDigest({ sha256: sha }, "Artifact example")}`;
|
||||
const occurrenceId = `occ_${canonicalDigest({ root: artifactId }, "Artifact example")}`;
|
||||
const artifactId = `art_${digestCanonicalValue({ sha256: sha }, "Artifact example")}`;
|
||||
const occurrenceId = `occ_${digestCanonicalValue({ root: artifactId }, "Artifact example")}`;
|
||||
const nodes = [
|
||||
{
|
||||
artifact_id: artifactId,
|
||||
@@ -36,7 +36,7 @@ const inventory = (digit: string) => {
|
||||
limitations: [],
|
||||
},
|
||||
];
|
||||
const graphSha256 = canonicalDigest(
|
||||
const graphSha256 = digestCanonicalValue(
|
||||
{
|
||||
nodes,
|
||||
occurrences,
|
||||
@@ -47,7 +47,7 @@ const inventory = (digit: string) => {
|
||||
);
|
||||
return jsonValueSchema.parse({
|
||||
manifest: {
|
||||
manifest_id: `agm_${canonicalDigest(
|
||||
manifest_id: `agm_${digestCanonicalValue(
|
||||
{
|
||||
root_artifact_id: artifactId,
|
||||
graph_sha256: graphSha256,
|
||||
|
||||
@@ -110,7 +110,8 @@ const semanticGraph = createJavaScriptSemanticGraph({
|
||||
limitations: ["Semantic relations are unavailable in this minimal example."],
|
||||
});
|
||||
|
||||
const staticEvidence = createEvidence(
|
||||
/** Minimal valid static application Evidence for graph workflow examples. */
|
||||
export const JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE = createEvidence(
|
||||
{ path: inputPath, sha256: applicationSha256, format: "directory" },
|
||||
{
|
||||
id: "rea-javascript-application",
|
||||
@@ -171,9 +172,6 @@ const staticEvidence = createEvidence(
|
||||
},
|
||||
);
|
||||
|
||||
/** Minimal valid static application Evidence for graph workflow examples. */
|
||||
export const JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE = staticEvidence;
|
||||
|
||||
const runtimeEvidence = createEvidence(
|
||||
undefined,
|
||||
{
|
||||
@@ -238,7 +236,7 @@ const runtimeEvidence = createEvidence(
|
||||
|
||||
/** Compact valid Evidence pair used by the public reconciliation contract. */
|
||||
export const JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE = {
|
||||
static_layers: [{ analysis: staticEvidence }],
|
||||
static_layers: [{ analysis: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE }],
|
||||
runtime_observations: [runtimeEvidence],
|
||||
};
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
import { z } from "zod";
|
||||
import { isAbsolute } from "node:path";
|
||||
|
||||
import type { ToolContract } from "../toolContractTypes.js";
|
||||
import { managedOutputSchemas } from "../toolOutputSchemaGroups.js";
|
||||
import { toolContractMetadata } from "../toolEffects.js";
|
||||
import { requireOutputSchema } from "../toolOutputSchemaPrimitives.js";
|
||||
import {
|
||||
isAbsoluteLocalPath,
|
||||
localPathStringSchema,
|
||||
} from "../../domain/localPath.js";
|
||||
import { localPathStringSchema } from "../../domain/localPath.js";
|
||||
|
||||
/** Exact caller boundary for execution-free PE/CLI triage and identity. */
|
||||
export const managedTargetInputSchema = z.strictObject({
|
||||
path: localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"path must be an absolute local filesystem path (for example /tmp/Example.dll or C:\\Example.dll)",
|
||||
})
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { canonicalDigest } from "../domain/comparisonSemantics.js";
|
||||
import { digestCanonicalValue } from "../domain/canonicalDigest.js";
|
||||
import { createEvidence } from "../domain/evidence.js";
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
|
||||
const inventory = (format: "apk" | "ipa" | "directory", digit: string) => {
|
||||
const sha = digit.repeat(64);
|
||||
const artifactId = `art_${canonicalDigest({ sha256: sha }, "Artifact inventory")}`;
|
||||
const occurrenceId = `occ_${canonicalDigest(
|
||||
const artifactId = `art_${digestCanonicalValue({ sha256: sha }, "Artifact inventory")}`;
|
||||
const occurrenceId = `occ_${digestCanonicalValue(
|
||||
{ root: artifactId },
|
||||
"Artifact inventory",
|
||||
)}`;
|
||||
@@ -39,7 +39,7 @@ const inventory = (format: "apk" | "ipa" | "directory", digit: string) => {
|
||||
limitations: [],
|
||||
},
|
||||
];
|
||||
const graphSha256 = canonicalDigest(
|
||||
const graphSha256 = digestCanonicalValue(
|
||||
{
|
||||
nodes,
|
||||
occurrences,
|
||||
@@ -50,7 +50,7 @@ const inventory = (format: "apk" | "ipa" | "directory", digit: string) => {
|
||||
);
|
||||
return jsonValueSchema.parse({
|
||||
manifest: {
|
||||
manifest_id: `agm_${canonicalDigest(
|
||||
manifest_id: `agm_${digestCanonicalValue(
|
||||
{
|
||||
root_artifact_id: artifactId,
|
||||
graph_sha256: graphSha256,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { isAbsolute } from "node:path";
|
||||
import { executableFormatHintSchema } from "../domain/dosCom.js";
|
||||
import {
|
||||
isAbsoluteLocalPath,
|
||||
localPathStringSchema,
|
||||
} from "../domain/localPath.js";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
import { z } from "zod";
|
||||
import { analysisProviderSelectorSchema } from "./providerSelection.js";
|
||||
|
||||
/** Caller-supplied analysis snapshot path; must name its destination absolutely. */
|
||||
const snapshotPathSchema = localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"snapshot_path must be an absolute local filesystem path (for example /tmp/rea/analysis.json or C:\\rea\\analysis.json)",
|
||||
})
|
||||
@@ -18,7 +16,7 @@ const snapshotPathSchema = localPathStringSchema
|
||||
|
||||
/** Caller-supplied analysis target path; must name the target absolutely. */
|
||||
const binaryTargetPathSchema = localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"path must be an absolute local filesystem path (for example /tmp/fixture.bin or C:\\analysis\\fixture.bin)",
|
||||
})
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { isAbsolute } from "node:path";
|
||||
|
||||
import {
|
||||
isAbsoluteLocalPath,
|
||||
localPathStringSchema,
|
||||
} from "../domain/localPath.js";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
|
||||
/** Optional expectations used to compare the live session with its caller. */
|
||||
export const binarySessionInputSchema = z.strictObject({
|
||||
@@ -13,7 +11,7 @@ export const binarySessionInputSchema = z.strictObject({
|
||||
.regex(/^[a-f0-9]{64}$/u)
|
||||
.optional(),
|
||||
expected_server_path: localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"expected_server_path must be an absolute local filesystem path (for example /opt/rea/dist/main.js)",
|
||||
})
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import {
|
||||
isAbsoluteLocalPath,
|
||||
localPathStringSchema,
|
||||
} from "../domain/localPath.js";
|
||||
import { isAbsolute } from "node:path";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
||||
import { bundleComparisonInputSchema } from "../domain/bundleComparison.js";
|
||||
import { callPathInputSchema } from "../domain/callPathSchemas.js";
|
||||
@@ -57,7 +55,7 @@ const session = <
|
||||
/** Session-owned Evidence bundle export options. */
|
||||
export const exportEvidenceBundleInputSchema = z.strictObject({
|
||||
path: localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"path must be an absolute local filesystem path (for example /tmp/rea/evidence.json or C:\\rea\\evidence.json)",
|
||||
})
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { isAbsolute } from "node:path";
|
||||
|
||||
import {
|
||||
isAbsoluteLocalPath,
|
||||
localPathStringSchema,
|
||||
} from "../domain/localPath.js";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
|
||||
import { processTraceSpecificationSchema } from "../domain/process/processTraceSpecification.js";
|
||||
import { evidenceSchema } from "../domain/evidence.js";
|
||||
@@ -26,7 +24,7 @@ export const addressContextInputSchema = z.strictObject({
|
||||
/** Session-owned Evidence bundle import options. */
|
||||
export const importEvidenceBundleInputSchema = z.strictObject({
|
||||
path: localPathStringSchema
|
||||
.refine(isAbsoluteLocalPath, {
|
||||
.refine(isAbsolute, {
|
||||
message:
|
||||
"path must be an absolute local filesystem path (for example /tmp/evidence.json or C:\\rea\\evidence.json)",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user