mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(contracts): own CLI command names, catalog identity and schema presentation in contracts (#11425)
* refactor(contracts): move the CLI command name owner into src/contracts * refactor(contracts): own catalog identity in contracts and server identity in process (#11435) * refactor(contracts): move catalog identity into contracts and server identity into process * refactor(contracts): own the advertised MCP schema presentation in contracts * test(mcp): import the advertised presentation from contracts in toolSchemaValidity * test(release): expect the catalog identity at its contracts path in the canary * test(mcp): import the catalog identity from contracts in syntheticContractSurfaces * refactor(contracts): import CLI command names from contracts in the capability conformance test
This commit is contained in:
1 parent
204bd2bb49
commit
960a387731
94 files changed
+256
-246
No files matched your search
@@ -30,7 +30,7 @@ this process is using. A rejected Windows ChangeTime launch value does not
|
||||
establish an accepted configuration, so that failure omits `pending_restart`.
|
||||
The other values reported here are in force, so `pending_restart` is false. Prose that only says to
|
||||
restart REA is marked `prose`. `mcp_server_restart_required` is a
|
||||
server-identity alignment state in `src/serverIdentity.ts`, not a setting field.
|
||||
server-identity alignment state in `src/process/ServerIdentity.ts`, not a setting field.
|
||||
|
||||
Three numeric limits are absent from this tree and are being moved into the
|
||||
runtime system on their own PRs. This audit does not change them:
|
||||
|
||||
@@ -379,7 +379,7 @@ const PATH_SCOPES = {
|
||||
"src/server/toolRegistrationOptions*.ts",
|
||||
"src/server/createServer*.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/cliLogging.ts",
|
||||
"src/cli/commandCancellation.ts",
|
||||
"tests/boundary/sqlite/**",
|
||||
@@ -429,7 +429,7 @@ const PATH_SCOPES = {
|
||||
"src/cliBrowserScenarioCommands.ts",
|
||||
"src/cli/environmentCommands.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/contracts/toolEffects.ts",
|
||||
"src/cli/webScriptCommands.ts",
|
||||
],
|
||||
@@ -447,7 +447,7 @@ const PATH_SCOPES = {
|
||||
"src/server/createServer.ts",
|
||||
"src/cli/binaryDiagnosticsCommands.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/contracts/toolContracts.ts",
|
||||
"src/contracts/toolEffects.ts",
|
||||
"src/process/OwnedCommand.ts",
|
||||
@@ -474,7 +474,7 @@ const PATH_SCOPES = {
|
||||
"src/cli/evmCommands.ts",
|
||||
"src/server/createServer.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/contracts/toolContracts.ts",
|
||||
"src/contracts/toolEffects.ts",
|
||||
"src/process/OwnedCommand.ts",
|
||||
@@ -523,7 +523,7 @@ const PATH_SCOPES = {
|
||||
"src/server/sessionAvailabilityPolicy.ts",
|
||||
"src/application/CapabilityInventory.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/contracts/toolContracts.ts",
|
||||
"src/contracts/toolEffects.ts",
|
||||
"scripts/rea.mjs",
|
||||
@@ -553,7 +553,7 @@ const PATH_SCOPES = {
|
||||
"src/server/createServer.ts",
|
||||
"src/server/sessionAvailabilityPolicy.ts",
|
||||
"src/cli/binaryDiagnosticsCommands.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/process/**",
|
||||
"src/resources/readStableArtifact*.ts",
|
||||
"src/domain/analysisError*.ts",
|
||||
@@ -578,7 +578,7 @@ const PATH_SCOPES = {
|
||||
"src/server/createServer.ts",
|
||||
"src/server/toolRegistrationOptions.ts",
|
||||
"src/cli.ts",
|
||||
"src/cliCommandNames.ts",
|
||||
"src/contracts/cliCommandNames.ts",
|
||||
"src/contracts/toolContracts.ts",
|
||||
"src/contracts/toolEffects.ts",
|
||||
"src/process/OwnedCommand.ts",
|
||||
@@ -653,7 +653,7 @@ const PATH_SCOPES = {
|
||||
"src/process/RegularFileRead.ts",
|
||||
"src/cli/cliJsonInput.ts",
|
||||
"src/server/http/**",
|
||||
"src/{cli,cliCommandNames,cli/environmentCommands}.ts",
|
||||
"src/{cli,contracts/cliCommandNames,cli/environmentCommands}.ts",
|
||||
"src/config/{environmentName,mcpHttpEndpoint}.ts",
|
||||
"src/domain/analysisView/{environmentManifest*,EnvironmentManifest*,environmentState*,EnvironmentState*,recordedResponseBody,scenarioCaptureRecords,WebNetworkProjectionAccumulator,analysisViewDataAdmission}.ts",
|
||||
"src/process/{OwnedCommand,ProviderProcess,PrivateRuntimeRoot}.ts",
|
||||
|
||||
@@ -24,7 +24,7 @@ const current = (
|
||||
).replaceAll("\r\n", "\n");
|
||||
const cacheBust = String(Date.now());
|
||||
const { DEFAULT_CATALOG_IDENTITY } = await import(
|
||||
`${pathToFileURL(join(root, "dist/catalogIdentity.js")).href}?${cacheBust}`
|
||||
`${pathToFileURL(join(root, "dist/contracts/catalog/catalogIdentity.js")).href}?${cacheBust}`
|
||||
);
|
||||
const { PRODUCT_IDENTITY } = await import(
|
||||
`${pathToFileURL(join(root, "dist/identity.js")).href}?${cacheBust}`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { DISCOVER_TOOLS } from "../../dist/catalogDiscovery.js";
|
||||
import { DISCOVER_TOOLS } from "../../dist/contracts/catalog/catalogDiscovery.js";
|
||||
import { TOOL_CONTRACTS } from "../../dist/contracts/toolContracts.js";
|
||||
import { advertisedOutputJsonSchema } from "../../dist/contracts/toolSchemaMetadata.js";
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export const assertSameNames = (label, actual, expected) => {
|
||||
|
||||
const SOURCE_PATHS = {
|
||||
packageMetadata: "dist/generatedPackageMetadata.js",
|
||||
catalogIdentity: "dist/catalogIdentity.js",
|
||||
catalogIdentity: "dist/contracts/catalog/catalogIdentity.js",
|
||||
cli: "dist/cli.js",
|
||||
toolContracts: "dist/contracts/toolContracts.js",
|
||||
toolFamilies: "dist/contracts/toolFamilies.js",
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
{
|
||||
"upward": {
|
||||
"application -> catalogDiscovery.ts": 1,
|
||||
"application -> catalogIdentity.ts": 2,
|
||||
"application -> serverIdentity.ts": 1,
|
||||
"artifacts -> application": 1,
|
||||
"composition -> cliCommandNames.ts": 3,
|
||||
"dotnet -> application": 1
|
||||
},
|
||||
"cycles": [
|
||||
|
||||
@@ -95,12 +95,9 @@ export const UNIT_LAYERS = Object.freeze(
|
||||
"cli",
|
||||
"main",
|
||||
"server",
|
||||
"catalogDiscovery.ts",
|
||||
"catalogIdentity.ts",
|
||||
"cli.ts",
|
||||
"cliBrowserScenarioCommands.ts",
|
||||
"cliBuiltinArguments.ts",
|
||||
"cliCommandNames.ts",
|
||||
"cliConfiguration.ts",
|
||||
"cliEvidenceCommands.ts",
|
||||
"cliLogging.ts",
|
||||
@@ -110,10 +107,8 @@ export const UNIT_LAYERS = Object.freeze(
|
||||
"main.ts",
|
||||
"mcpDoctor.ts",
|
||||
"mcpDoctorOptions.ts",
|
||||
"recordedCatalogDigests.ts",
|
||||
"recordedCliCommandRegistrations.ts",
|
||||
"recordedMcpCatalog.ts",
|
||||
"serverIdentity.ts",
|
||||
]),
|
||||
]),
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { withVerifierCleanup } from "./verifier-cleanup.mjs";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../dist/catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../dist/contracts/catalog/catalogIdentity.js";
|
||||
import { verifyCompleteToolCatalog } from "./verify-package-core.mjs";
|
||||
|
||||
/** Install the selected archive or registry specifier with an owned ten-minute deadline. */
|
||||
|
||||
@@ -10,7 +10,7 @@ const compiledRoot = resolve(
|
||||
"../dist",
|
||||
);
|
||||
const { createCatalogDigestProfiles } = await import(
|
||||
pathToFileURL(join(compiledRoot, "catalogIdentity.js")).href
|
||||
pathToFileURL(join(compiledRoot, "contracts/catalog/catalogIdentity.js")).href
|
||||
);
|
||||
// Retain only hashes, with every shared record frozen. Schemas remain owned by
|
||||
// the compiled contracts and are converted once for both identities.
|
||||
@@ -21,7 +21,7 @@ const profiles = Object.entries(createCatalogDigestProfiles())
|
||||
)
|
||||
.join(",");
|
||||
await writeFile(
|
||||
join(compiledRoot, "recordedCatalogDigests.js"),
|
||||
join(compiledRoot, "contracts/catalog/recordedCatalogDigests.js"),
|
||||
`/** Recorded from compiled catalog profiles by scripts/record-catalog-digests.mjs; do not edit. */\nexport const RECORDED_CATALOG_DIGEST_PROFILES = Object.freeze({${profiles}});\n`,
|
||||
"utf8",
|
||||
);
|
||||
@@ -4,11 +4,8 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { isAbsolute, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import Ajv2020 from "ajv/dist/2020.js";
|
||||
import { createCatalogIdentity } from "../dist/catalogIdentity.js";
|
||||
import {
|
||||
parseMcpOutputSchemaProfile,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
} from "../dist/config/mcpOutputSchemaProfile.js";
|
||||
import { createCatalogIdentity } from "../dist/contracts/catalog/catalogIdentity.js";
|
||||
import { parseMcpOutputSchemaProfile } from "../dist/config/mcpOutputSchemaProfile.js";
|
||||
import {
|
||||
TOOL_CONTRACTS,
|
||||
toolContract,
|
||||
@@ -32,6 +29,7 @@ import {
|
||||
import { createVerifierRun, completeVerifierRun } from "./lib/verifier-run.mjs";
|
||||
import { createAnthropicModelFixture } from "./verify/clients/anthropic-model-fixture.mjs";
|
||||
import { VerifierFixture } from "./lib/verifier-fixture.mjs";
|
||||
import { resolveMcpOutputSchemaProfile } from "../dist/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
const repo = fileURLToPath(new URL("..", import.meta.url));
|
||||
const runtimeRoot = process.env.REA_VERIFY_RUNTIME_ROOT ?? repo;
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
} from "../dist/contracts/toolContracts.js";
|
||||
import { advertisedInputJsonSchema } from "../dist/contracts/toolSchemaMetadata.js";
|
||||
import { advertiseTool } from "../dist/contracts/advertisedTool.js";
|
||||
import { advertisedToolPresentation } from "../dist/config/mcpOutputSchemaProfile.js";
|
||||
import { isPathWithinRoot } from "../dist/domain/localPath.js";
|
||||
import { createVerifierCommands } from "./lib/verify-commands.mjs";
|
||||
import { withVerifierCleanup } from "./lib/verifier-cleanup.mjs";
|
||||
@@ -26,6 +25,7 @@ import {
|
||||
import { createVerifierRun, completeVerifierRun } from "./lib/verifier-run.mjs";
|
||||
import { createOpenAiModelFixture } from "./verify/clients/model-fixture.mjs";
|
||||
import { VerifierFixture } from "./lib/verifier-fixture.mjs";
|
||||
import { advertisedToolPresentation } from "../dist/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
assert(
|
||||
process.platform !== "win32",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { importVerifierSource } from "./lib/verifier-source-loader.mjs";
|
||||
|
||||
import { access, copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../dist/catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../dist/contracts/catalog/catalogIdentity.js";
|
||||
|
||||
import { parseTarListing } from "./lib/verify-package-listing.mjs";
|
||||
import { verifyPackedBridge } from "./verify-packed-bridge.mjs";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsonObjectSchema, type JsonValue } from "../domain/jsonValue.js";
|
||||
import { createServerIdentity } from "../serverIdentity.js";
|
||||
import { createServerIdentity } from "../process/ServerIdentity.js";
|
||||
import { silentLogger } from "../logger.js";
|
||||
import type { Logger } from "pino";
|
||||
import type { DirectAnalysisDependencies } from "./DirectAnalysisDependencies.js";
|
||||
@@ -7,16 +7,18 @@ import { providerCapabilitySet } from "../contracts/toolOutputSchemaPrimitives.j
|
||||
import { providerCapabilitySets } from "./binary/BinarySessionStatus.js";
|
||||
import { sqliteDatabaseCapability } from "./sqlite/SqliteDatabaseCapability.js";
|
||||
import { CURRENT_ENTRYPOINT_PATH } from "../process/CurrentEntrypointPath.js";
|
||||
import { catalogIdentityForToolFamilies } from "../catalogIdentity.js";
|
||||
import { progressiveCatalogIdentity } from "../catalogDiscovery.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../config/mcpInputSchemaProfile.js";
|
||||
import { resolveMcpOutputSchemaProfile } from "../config/mcpOutputSchemaProfile.js";
|
||||
import { catalogIdentityForToolFamilies } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { progressiveCatalogIdentity } from "../contracts/catalog/catalogDiscovery.js";
|
||||
import {
|
||||
directAnalysisCleanupFailure,
|
||||
projectInvocationFailure,
|
||||
withSessionCleanup,
|
||||
} from "./DirectAnalysisCleanup.js";
|
||||
import { ok } from "../domain/result.js";
|
||||
import {
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
} from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
/** Read target-free provider status and operation availability. */
|
||||
export const runSessionStatus = async (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
import { ok } from "../domain/result.js";
|
||||
import type { DoctorHost } from "./Doctor.js";
|
||||
|
||||
@@ -61,7 +61,7 @@ import {
|
||||
type InstalledSkillIdentity,
|
||||
type SkillPathIssue,
|
||||
} from "./SetupSkill.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../identity.js";
|
||||
import {
|
||||
readClientRegistrationStatuses,
|
||||
|
||||
@@ -19,7 +19,7 @@ import type {
|
||||
} from "../ports/DoctorProviderInspection.js";
|
||||
import type { LinuxDistribution } from "./LinuxHopper.js";
|
||||
import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../identity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../contracts/catalog/catalogIdentity.js";
|
||||
import type { ClientRegistrationStatus } from "./ClientRegistrationStatus.js";
|
||||
import { currentClientRegistrationCommand } from "./ClientRegistrationIdentity.js";
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ import {
|
||||
mapArtifactFileFailure,
|
||||
withArtifactRegularFile,
|
||||
type ArtifactResourceScope,
|
||||
readArtifactFileChunks,
|
||||
} from "../../resources/index.js";
|
||||
import type { ArtifactIntegrityCheck } from "../../domain/artifactOperationError.js";
|
||||
import { readArtifactFileChunks } from "../../resources/index.js";
|
||||
import { hasMachoMagic } from "../../domain/apple/machoContainer.js";
|
||||
import { readMachoImage } from "../../domain/apple/machoLoadCommandReader.js";
|
||||
import { readFileHandleRange } from "../../filesystem/readFileHandleRange.js";
|
||||
|
||||
@@ -20,14 +20,14 @@ import {
|
||||
isSourceLessAppKitAnnotationConnector,
|
||||
isUIKitRuntimeConnectionClass,
|
||||
} from "../../domain/apple/interfaceBuilderKeyedArchive.js";
|
||||
import { streamChunkToBuffer } from "../../resources/index.js";
|
||||
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
||||
import {
|
||||
streamChunkToBuffer,
|
||||
ArtifactResourceScope,
|
||||
ArtifactReaderFailure,
|
||||
type ArtifactEntry,
|
||||
type ArtifactReaderTraversal,
|
||||
} from "../../resources/index.js";
|
||||
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
||||
import { ArtifactTraversalObservation } from "../ArtifactTraversalObservation.js";
|
||||
import {
|
||||
projectPlistValue,
|
||||
|
||||
@@ -4,8 +4,8 @@ import { dirname, join } from "node:path";
|
||||
import {
|
||||
ArtifactReaderFailure,
|
||||
ArtifactResourceScope,
|
||||
normalizeArtifactPath,
|
||||
} from "../../resources/index.js";
|
||||
import { normalizeArtifactPath } from "../../resources/index.js";
|
||||
import type { WebScriptArtifactPort } from "../../ports/WebScriptArtifactPort.js";
|
||||
import type { ExecutionOptions } from "../../ports/AnalysisProvider.js";
|
||||
import {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AdbDeviceAnalysisService } from "../application/adb/AdbDeviceAnalysisSe
|
||||
import type { AdbDeviceAnalysisPort } from "../application/adb/AdbDeviceAnalysisPort.js";
|
||||
import { createAdbDeviceAnalysisProvider } from "../composition/adb.js";
|
||||
import { ADB_TOOL_CONTRACTS } from "../contracts/adb/adbToolContracts.js";
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
getEvidenceBundleInputSchema,
|
||||
importEvidenceBundleInputSchema,
|
||||
} from "../contracts/sessionToolSchemas.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import { parseCliJsonInput } from "./cliJsonInput.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { registerApiContractCommand } from "./apiContractCommand.js";
|
||||
import { registerNtfsJournalCommand } from "./ntfsJournalCommand.js";
|
||||
import { Cli } from "incur";
|
||||
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
|
||||
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
requiredSelectorGuidance,
|
||||
} from "./analysisSelector.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import type { Logger } from "pino";
|
||||
import { nativeTarget } from "./options.js";
|
||||
import type { CliInstance } from "./types.js";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
equalSelectorGuidance,
|
||||
} from "./analysisSelector.js";
|
||||
import type { DirectAnalysis } from "../composition/directAnalysis.js";
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
import type { Logger } from "pino";
|
||||
import { nativeTarget } from "./options.js";
|
||||
import type { CliInstance } from "./types.js";
|
||||
|
||||
@@ -23,7 +23,7 @@ import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
|
||||
import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js";
|
||||
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
||||
import { cliDecimalField } from "./options.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import {
|
||||
DESKTOP_CAPTURE_DEFAULTS,
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { Logger } from "pino";
|
||||
import {
|
||||
CLI_COMMANDS,
|
||||
DEFAULT_INFO_LOGGING_COMMANDS,
|
||||
} from "../cliCommandNames.js";
|
||||
} from "../contracts/cliCommandNames.js";
|
||||
import { parseCliJsonInput } from "./cliJsonInput.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { parseEnvironmentName } from "../config/environmentName.js";
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
searchGuidanceLimitSchema,
|
||||
searchGuidanceInputSchema,
|
||||
} from "../contracts/guidanceContracts.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import type { Logger } from "pino";
|
||||
|
||||
@@ -16,7 +16,7 @@ import { registerContractCommand } from "./contractCommand.js";
|
||||
import type { CliInstance } from "./types.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import type { Logger } from "pino";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
import { withCommandCancellation } from "./commandCancellation.js";
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { OBJDUMP_ARTIFACT_OPERATIONS } from "../domain/reverseEngineering.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import type { CliInstance } from "./types.js";
|
||||
import { withCommandCancellation } from "./commandCancellation.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import { REVERSE_ENGINEERING_TOOL_CONTRACTS } from "../contracts/reverseEngineeringToolContracts.js";
|
||||
import { contractNamed } from "./contractCliDescription.js";
|
||||
import {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
} from "./interactiveSetup.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../contracts/cliCommandNames.js";
|
||||
import type { Logger } from "pino";
|
||||
import type { CliInstance } from "./types.js";
|
||||
import { SUPPORTED_CLIENT_DEFINITIONS } from "../application/SupportedClients.js";
|
||||
|
||||
@@ -24,7 +24,7 @@ import { projectInputIssues } from "../domain/inputIssueProjection.js";
|
||||
import { safeParseJson } from "../domain/safeJson.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
import { isCliOperationFailure, logCliCommand } from "../cliLogging.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../cliCommandNames.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
import { localPathStringSchema } from "../domain/localPath.js";
|
||||
import type { Logger } from "pino";
|
||||
import type { CliInstance } from "./types.js";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { contractNamed } from "./cli/contractCliDescription.js";
|
||||
import { registerContractDocumentCommand } from "./cli/contractCommand.js";
|
||||
import { finishAnalysisCommand } from "./cli/finishAnalysisCommand.js";
|
||||
import type { CliInstance } from "./cli/types.js";
|
||||
import { CLI_COMMANDS } from "./cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "./contracts/cliCommandNames.js";
|
||||
import { BROWSER_SCENARIO_TOOL_CONTRACTS } from "./contracts/browserScenarioToolContracts.js";
|
||||
import { projectAnalysisError } from "./domain/analysisErrorProjection.js";
|
||||
import {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "./application/EvidenceBundleCommands.js";
|
||||
import { logCliCommand } from "./cliLogging.js";
|
||||
import type { Logger } from "pino";
|
||||
import { CLI_COMMANDS } from "./cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "./contracts/cliCommandNames.js";
|
||||
import type { JsonValue } from "./domain/jsonValue.js";
|
||||
import { projectAnalysisError } from "./domain/analysisErrorProjection.js";
|
||||
import type { AnalysisError } from "./domain/analysisErrorBase.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ApkSignatureService } from "../application/apkSignature/ApkSignatureService.js";
|
||||
import { ApkSignatureProvider } from "../apkSignature/ApkSignatureProvider.js";
|
||||
import { INSPECT_APK_SIGNATURE_CONTRACT } from "../contracts/apkSignature/apkSignatureToolContracts.js";
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
|
||||
/** Compose the in-process APK signature reader without acquisition or import-time I/O. */
|
||||
export const createApkSignatureService = (): ApkSignatureService =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EvmInterfaceService } from "../application/evm/EvmInterfaceService.js";
|
||||
import { EvmoleInterfaceProvider } from "../evm/EvmoleInterfaceProvider.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
import { HOST_PLATFORM, type HostPlatform } from "../platform/HostPlatform.js";
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { INSPECT_EVM_INTERFACE_CONTRACT } from "../contracts/evm/evmToolContracts.js";
|
||||
|
||||
/** Compose offline interface analysis without import-time I/O or dependency acquisition. */
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { AnalysisSettingsReader } from "../domain/analysisSettings.js";
|
||||
import { WasmArtifactService } from "../application/wasm/WasmArtifactService.js";
|
||||
import { WabtArtifactProvider } from "../wasm/WabtArtifactProvider.js";
|
||||
import { INSPECT_WASM_ARTIFACT_CONTRACT } from "../contracts/wasm/wasmToolContracts.js";
|
||||
import { cliCommandFor } from "../cliCommandNames.js";
|
||||
import { cliCommandFor } from "../contracts/cliCommandNames.js";
|
||||
/** Compose the caller-supplied offline toolchain without acquisition or import-time I/O. */
|
||||
export const createWasmArtifactService = (
|
||||
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
||||
|
||||
@@ -1,22 +1,8 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { ADVERTISED_INPUT_SCHEMA_MAX_BYTES } from "../contracts/advertisedDialect.js";
|
||||
import type { CompactInputSchemaPresentation } from "../contracts/compactInputSchema.js";
|
||||
import { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
|
||||
/** The compact presentation fits the portable dialect's per-tool size cap. */
|
||||
export const COMPACT_INPUT_SCHEMA_BUDGET_BYTES =
|
||||
ADVERTISED_INPUT_SCHEMA_MAX_BYTES;
|
||||
|
||||
/**
|
||||
* The one advertised input presentation. Every server, identity and recorded
|
||||
* catalog presents input schemas through it; canonical validators still
|
||||
* check every call.
|
||||
*/
|
||||
export const COMPACT_INPUT_SCHEMA_PRESENTATION: CompactInputSchemaPresentation =
|
||||
Object.freeze({ budgetBytes: COMPACT_INPUT_SCHEMA_BUDGET_BYTES });
|
||||
|
||||
const profileConstraint =
|
||||
'REA_MCP_INPUT_SCHEMA_PROFILE accepts only "compact", the default. The "full" input profile was removed: remove the setting from the client registration, or set it to "compact". Canonical server-side validation still checks every call.';
|
||||
|
||||
|
||||
@@ -1,62 +1,20 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { AdvertisedToolPresentation } from "../contracts/advertisedTool.js";
|
||||
import type { CompactInputSchemaPresentation } from "../contracts/compactInputSchema.js";
|
||||
import {
|
||||
MCP_OUTPUT_SCHEMA_PROFILES,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "../contracts/mcpSchemaPresentation.js";
|
||||
import { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "./mcpInputSchemaProfile.js";
|
||||
|
||||
/**
|
||||
* Per-schema budget for compact output advertisements. Output contracts are
|
||||
* larger than input contracts across the catalog, and the complete frame is
|
||||
* what a frame-capped host rejects. Measured on the complete contract catalog
|
||||
* with the default compact input profile, 4 KiB bounds the output
|
||||
* advertisement to ~276 KiB and the complete `tools/list` response to
|
||||
* ~577 KiB, leaving margin under the one-megabyte frame reported in #2512. A
|
||||
* larger budget admits substantially more full contracts; a much smaller one
|
||||
* drops first-level property guidance for nearly every tool.
|
||||
*/
|
||||
export const COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES = 4 * 1024;
|
||||
|
||||
const profileConstraint =
|
||||
'REA_MCP_OUTPUT_SCHEMA_PROFILE must be "off" (default) or "compact". The off profile omits output schemas; compact advertises every output schema within a 4,096-byte budget. The "full" output profile was removed: remove the setting or select "compact". Both keep canonical server-side validation and complete structured content.';
|
||||
|
||||
/** Select whether tools/list carries bounded output contracts. */
|
||||
export const mcpOutputSchemaProfileSchema = z.enum(["off", "compact"], {
|
||||
export const mcpOutputSchemaProfileSchema = z.enum(MCP_OUTPUT_SCHEMA_PROFILES, {
|
||||
error: profileConstraint,
|
||||
});
|
||||
|
||||
export type McpOutputSchemaProfile = z.infer<
|
||||
typeof mcpOutputSchemaProfileSchema
|
||||
>;
|
||||
|
||||
/**
|
||||
* Resolve the selected advertisement at the configuration boundary. No model
|
||||
* API reads an output schema; MCP client validators re-check what REA already
|
||||
* validates, and complete output schemas were about 92% of `tools/list`. They
|
||||
* are therefore omitted unless a caller selects `compact`.
|
||||
*/
|
||||
export const resolveMcpOutputSchemaProfile = (
|
||||
profile: McpOutputSchemaProfile | undefined,
|
||||
): McpOutputSchemaProfile => profile ?? "off";
|
||||
|
||||
/** The one bounded output advertisement, selected by `compact`. */
|
||||
export const COMPACT_OUTPUT_SCHEMA_PRESENTATION: {
|
||||
readonly budgetBytes: number;
|
||||
} = Object.freeze({ budgetBytes: COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES });
|
||||
|
||||
/** How REA's MCP catalog advertises its tools for a selected output profile. */
|
||||
export const advertisedToolPresentation = (
|
||||
outputSchemaProfile: McpOutputSchemaProfile,
|
||||
input: CompactInputSchemaPresentation = COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
): AdvertisedToolPresentation => ({
|
||||
input: { budgetBytes: input.budgetBytes },
|
||||
output:
|
||||
outputSchemaProfile === "compact"
|
||||
? COMPACT_OUTPUT_SCHEMA_PRESENTATION
|
||||
: undefined,
|
||||
});
|
||||
|
||||
/** Parse the output schema advertisement selection at server composition. */
|
||||
export const parseMcpOutputSchemaProfile = (
|
||||
value: string | undefined,
|
||||
|
||||
+1
-1
@@ -5,7 +5,6 @@ import type { ReferenceSourcePolicy } from "../domain/referenceSourcePolicy.js";
|
||||
import type { AnalysisProviderSelector } from "../domain/providerSelection.js";
|
||||
|
||||
import type { GhidraLanguageOverride } from "./ghidraLanguageOverride.js";
|
||||
import type { McpOutputSchemaProfile } from "./mcpOutputSchemaProfile.js";
|
||||
import type { McpToolCatalogProfile } from "./mcpToolCatalogProfile.js";
|
||||
import type { BridgeMaxRequestBytes } from "./bridgeMaxRequestBytes.js";
|
||||
import type { BridgeMaxReplyBytes } from "./bridgeMaxReplyBytes.js";
|
||||
@@ -14,6 +13,7 @@ import type { RegexWorkerHeapRequest } from "./regexWorkerHeapRequest.js";
|
||||
import type { HopperCallerScanBudget } from "./hopperCallerScanBudget.js";
|
||||
import type { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import type { AnalysisSettingId } from "../domain/analysisSettings.js";
|
||||
import type { McpOutputSchemaProfile } from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
export interface AppConfig {
|
||||
readonly mcpToolFamilies?: readonly McpToolFamilies[number][];
|
||||
|
||||
File renamed without changes.
@@ -2,34 +2,34 @@ import { createHash } from "node:crypto";
|
||||
|
||||
import canonicalize from "canonicalize";
|
||||
|
||||
import { contractsForToolFamilies } from "./contracts/toolFamilies.js";
|
||||
import { promptsForToolFamilies } from "./contracts/promptToolFamilyScope.js";
|
||||
import { PROMPT_CONTRACTS } from "./contracts/promptContracts.js";
|
||||
import type { PromptContract } from "./contracts/promptContracts.js";
|
||||
import { TOOL_CONTRACTS } from "./contracts/toolContracts.js";
|
||||
import type { ToolContract } from "./contracts/toolContractTypes.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "./cliCommandNames.js";
|
||||
import { compareUnicodeCodePoints } from "./domain/unicodeCodePointOrder.js";
|
||||
import { contractsForToolFamilies } from "../toolFamilies.js";
|
||||
import { promptsForToolFamilies } from "../promptToolFamilyScope.js";
|
||||
import { PROMPT_CONTRACTS } from "../promptContracts.js";
|
||||
import type { PromptContract } from "../promptContracts.js";
|
||||
import { TOOL_CONTRACTS } from "../toolContracts.js";
|
||||
import type { ToolContract } from "../toolContractTypes.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../cliCommandNames.js";
|
||||
import { compareUnicodeCodePoints } from "../../domain/unicodeCodePointOrder.js";
|
||||
import {
|
||||
advertisedInputJsonSchema,
|
||||
advertisedOutputJsonSchema,
|
||||
} from "./contracts/toolSchemaMetadata.js";
|
||||
import type { CompactInputSchemaPresentation } from "./contracts/compactInputSchema.js";
|
||||
} from "../toolSchemaMetadata.js";
|
||||
import type { CompactInputSchemaPresentation } from "../compactInputSchema.js";
|
||||
import {
|
||||
advertiseTool,
|
||||
type AdvertisedToolPresentation,
|
||||
} from "./contracts/advertisedTool.js";
|
||||
import {
|
||||
advertisedToolPresentation,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "./config/mcpOutputSchemaProfile.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "./config/mcpInputSchemaProfile.js";
|
||||
} from "../advertisedTool.js";
|
||||
import {
|
||||
RECORDED_CATALOG_DIGEST_PROFILES,
|
||||
type CatalogDigestProfiles,
|
||||
type CatalogDigests,
|
||||
} from "./recordedCatalogDigests.js";
|
||||
import {
|
||||
advertisedToolPresentation,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
} from "../mcpSchemaPresentation.js";
|
||||
|
||||
/**
|
||||
* Digested per-tool projection. Every contract field that changes what a
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { McpOutputSchemaProfile } from "./config/mcpOutputSchemaProfile.js";
|
||||
import type { McpOutputSchemaProfile } from "../mcpSchemaPresentation.js";
|
||||
|
||||
/** SHA-256 digests of one catalog profile, as `createCatalogIdentity` reports them. */
|
||||
export type CatalogDigests = {
|
||||
File renamed without changes.
@@ -0,0 +1,64 @@
|
||||
import { ADVERTISED_INPUT_SCHEMA_MAX_BYTES } from "./advertisedDialect.js";
|
||||
import type { AdvertisedToolPresentation } from "./advertisedTool.js";
|
||||
import type { CompactInputSchemaPresentation } from "./compactInputSchema.js";
|
||||
|
||||
// The presentations REA's MCP catalog advertises. Configuration parses the
|
||||
// caller's selection into these names; the catalog identity, servers and
|
||||
// client verifiers present schemas through them.
|
||||
|
||||
/** The compact presentation fits the portable dialect's per-tool size cap. */
|
||||
export const COMPACT_INPUT_SCHEMA_BUDGET_BYTES =
|
||||
ADVERTISED_INPUT_SCHEMA_MAX_BYTES;
|
||||
|
||||
/**
|
||||
* The one advertised input presentation. Every server, identity and recorded
|
||||
* catalog presents input schemas through it; canonical validators still
|
||||
* check every call.
|
||||
*/
|
||||
export const COMPACT_INPUT_SCHEMA_PRESENTATION: CompactInputSchemaPresentation =
|
||||
Object.freeze({ budgetBytes: COMPACT_INPUT_SCHEMA_BUDGET_BYTES });
|
||||
|
||||
/**
|
||||
* Per-schema budget for compact output advertisements. Output contracts are
|
||||
* larger than input contracts across the catalog, and the complete frame is
|
||||
* what a frame-capped host rejects. Measured on the complete contract catalog
|
||||
* with the default compact input profile, 4 KiB bounds the output
|
||||
* advertisement to ~276 KiB and the complete `tools/list` response to
|
||||
* ~577 KiB, leaving margin under the one-megabyte frame reported in #2512. A
|
||||
* larger budget admits substantially more full contracts; a much smaller one
|
||||
* drops first-level property guidance for nearly every tool.
|
||||
*/
|
||||
export const COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES = 4 * 1024;
|
||||
|
||||
/** The output schema advertisements a catalog can select. */
|
||||
export const MCP_OUTPUT_SCHEMA_PROFILES = ["off", "compact"] as const;
|
||||
|
||||
export type McpOutputSchemaProfile =
|
||||
(typeof MCP_OUTPUT_SCHEMA_PROFILES)[number];
|
||||
|
||||
/**
|
||||
* Resolve the selected advertisement. No model API reads an output schema;
|
||||
* MCP client validators re-check what REA already validates, and complete
|
||||
* output schemas were about 92% of `tools/list`. They are therefore omitted
|
||||
* unless a caller selects `compact`.
|
||||
*/
|
||||
export const resolveMcpOutputSchemaProfile = (
|
||||
profile: McpOutputSchemaProfile | undefined,
|
||||
): McpOutputSchemaProfile => profile ?? "off";
|
||||
|
||||
/** The one bounded output advertisement, selected by `compact`. */
|
||||
export const COMPACT_OUTPUT_SCHEMA_PRESENTATION: {
|
||||
readonly budgetBytes: number;
|
||||
} = Object.freeze({ budgetBytes: COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES });
|
||||
|
||||
/** How REA's MCP catalog advertises its tools for a selected output profile. */
|
||||
export const advertisedToolPresentation = (
|
||||
outputSchemaProfile: McpOutputSchemaProfile,
|
||||
input: CompactInputSchemaPresentation = COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
): AdvertisedToolPresentation => ({
|
||||
input: { budgetBytes: input.budgetBytes },
|
||||
output:
|
||||
outputSchemaProfile === "compact"
|
||||
? COMPACT_OUTPUT_SCHEMA_PRESENTATION
|
||||
: undefined,
|
||||
});
|
||||
@@ -16,8 +16,6 @@ import {
|
||||
AnalysisCleanupLease,
|
||||
ArtifactReaderFailure,
|
||||
artifactFileCancellationCause,
|
||||
} from "../../resources/index.js";
|
||||
import {
|
||||
SafeOutputTree,
|
||||
SafeOutputTreeCreationFailure,
|
||||
} from "../../resources/index.js";
|
||||
|
||||
@@ -9,8 +9,7 @@ import {
|
||||
type RecordedMcpCatalog,
|
||||
} from "../recordedMcpCatalog.js";
|
||||
import type { AppConfig } from "../config/types.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../config/mcpInputSchemaProfile.js";
|
||||
import { RECORDED_CATALOG_DIGEST_PROFILES } from "../recordedCatalogDigests.js";
|
||||
import { RECORDED_CATALOG_DIGEST_PROFILES } from "../contracts/catalog/recordedCatalogDigests.js";
|
||||
import { DeferredEvidenceMcpServer } from "../server/DeferredEvidenceMcpServer.js";
|
||||
import { ToolResultDelivery } from "../server/ToolResultDelivery.js";
|
||||
import { createLogger } from "../logger.js";
|
||||
@@ -19,6 +18,7 @@ import type { McpServerHandle, RuntimeDependencies } from "./types.js";
|
||||
import { SERVER_START_FAILED } from "./messages.js";
|
||||
import { reportMcpTransportError } from "./reportMcpTransportError.js";
|
||||
import { OwnedMcpServers } from "./OwnedMcpServers.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
/** Verify the build-owned artifact before trusting its exact typed projection. */
|
||||
const readCatalog = (): RecordedMcpCatalog => {
|
||||
|
||||
+4
-6
@@ -5,24 +5,21 @@ import { performance } from "node:perf_hooks";
|
||||
import { resolve } from "node:path";
|
||||
import { StringDecoder } from "node:string_decoder";
|
||||
|
||||
import { createCatalogIdentity } from "./catalogIdentity.js";
|
||||
import { createCatalogIdentity } from "./contracts/catalog/catalogIdentity.js";
|
||||
import { jsonLinesErrorRecord } from "./cli/jsonLines.js";
|
||||
import {
|
||||
CLI_DOCUMENT_OUTPUT_FORMATS,
|
||||
missingCliOutputValueMessage,
|
||||
renderCliDocument,
|
||||
} from "./cliOutput.js";
|
||||
import {
|
||||
parseMcpOutputSchemaProfile,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
} from "./config/mcpOutputSchemaProfile.js";
|
||||
import { parseMcpOutputSchemaProfile } from "./config/mcpOutputSchemaProfile.js";
|
||||
import { parseMcpToolFamilies } from "./config/mcpToolFamilies.js";
|
||||
import { parseMcpToolCatalogProfile } from "./config/mcpToolCatalogProfile.js";
|
||||
import {
|
||||
DISCOVER_TOOLS,
|
||||
HOT_TOOL_NAMES,
|
||||
progressiveCatalogIdentity,
|
||||
} from "./catalogDiscovery.js";
|
||||
} from "./contracts/catalog/catalogDiscovery.js";
|
||||
import { contractsForToolFamilies } from "./contracts/toolFamilies.js";
|
||||
import { toolContract } from "./contracts/toolContracts.js";
|
||||
import { advertisedOutputJsonSchema } from "./contracts/toolSchemaMetadata.js";
|
||||
@@ -41,6 +38,7 @@ import {
|
||||
import { MCP_DOCTOR_ALIAS, MCP_DOCTOR_OPTIONS } from "./mcpDoctorOptions.js";
|
||||
import { OwnedMcpStdioTransport } from "./process/OwnedMcpStdioTransport.js";
|
||||
import { isRecord } from "./domain/isRecord.js";
|
||||
import { resolveMcpOutputSchemaProfile } from "./contracts/mcpSchemaPresentation.js";
|
||||
|
||||
const OUTPUT_FORMATS = CLI_DOCUMENT_OUTPUT_FORMATS;
|
||||
type OutputFormat = (typeof OUTPUT_FORMATS)[number];
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { statSync } from "node:fs";
|
||||
import { dirname, basename, resolve } from "node:path";
|
||||
|
||||
import { HOST_PLATFORM } from "./platform/HostPlatform.js";
|
||||
import { HOST_PLATFORM } from "../platform/HostPlatform.js";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import {
|
||||
javaScriptRuntime,
|
||||
type JavaScriptRuntime,
|
||||
} from "./domain/runtimeVersion.js";
|
||||
import { normalizeEntrypointPath } from "./process/CurrentEntrypointPath.js";
|
||||
} from "../domain/runtimeVersion.js";
|
||||
import { normalizeEntrypointPath } from "./CurrentEntrypointPath.js";
|
||||
|
||||
import type { createCatalogIdentity } from "./catalogIdentity.js";
|
||||
import { PRODUCT_IDENTITY, SDK_IDENTITY } from "./identity.js";
|
||||
import type { createCatalogIdentity } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../identity.js";
|
||||
|
||||
/** Optional observations supplied by a client comparing its expected server. */
|
||||
export interface ExpectedServerIdentity {
|
||||
@@ -25,12 +25,13 @@ export interface ConnectedClientIdentity {
|
||||
readonly version: string;
|
||||
}
|
||||
|
||||
/** The package root above `src/`, `dist/` or `dist/src/`, found from this module's `config/` folder. */
|
||||
const packageRoot = (): string => {
|
||||
const moduleDirectory = dirname(fileURLToPath(import.meta.url));
|
||||
return basename(moduleDirectory) === "src" &&
|
||||
basename(dirname(moduleDirectory)) === "dist"
|
||||
? resolve(moduleDirectory, "../..")
|
||||
: resolve(moduleDirectory, "..");
|
||||
const sourceRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
return basename(sourceRoot) === "src" &&
|
||||
basename(dirname(sourceRoot)) === "dist"
|
||||
? resolve(sourceRoot, "../..")
|
||||
: resolve(sourceRoot, "..");
|
||||
};
|
||||
|
||||
const compareServerPaths = (
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
ServerCapabilities,
|
||||
Tool,
|
||||
} from "@modelcontextprotocol/server";
|
||||
import type { createCatalogIdentity } from "./catalogIdentity.js";
|
||||
import type { createCatalogIdentity } from "./contracts/catalog/catalogIdentity.js";
|
||||
import type { PromptArgumentContract } from "./contracts/promptContracts.js";
|
||||
|
||||
/** Build-owned discovery data; canonical validators remain the runtime authority. */
|
||||
|
||||
@@ -7,16 +7,16 @@ import type { EvidenceWriter } from "../application/investigation/InvestigationR
|
||||
import {
|
||||
catalogIdentityForToolFamilies,
|
||||
type createCatalogIdentity,
|
||||
} from "../catalogIdentity.js";
|
||||
} from "../contracts/catalog/catalogIdentity.js";
|
||||
import { toolFamilyId } from "../contracts/toolFamilies.js";
|
||||
import type { ToolResultDelivery } from "./ToolResultDelivery.js";
|
||||
import { EvidenceMcpServerCore } from "./EvidenceMcpServerCore.js";
|
||||
import type { CompactInputSchemaPresentation } from "../contracts/compactInputSchema.js";
|
||||
import {
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "../config/mcpOutputSchemaProfile.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../config/mcpInputSchemaProfile.js";
|
||||
import { EvidenceMcpServerCore } from "./EvidenceMcpServerCore.js";
|
||||
import type { CompactInputSchemaPresentation } from "../contracts/compactInputSchema.js";
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
} from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
/** Canonical composition retains the constructor's existing identity defaults. */
|
||||
export class EvidenceMcpServer extends EvidenceMcpServerCore {
|
||||
|
||||
@@ -35,13 +35,7 @@ import {
|
||||
advertiseToolOutput,
|
||||
type AdvertisedToolPresentation,
|
||||
} from "../contracts/advertisedTool.js";
|
||||
import {
|
||||
advertisedToolPresentation,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "../config/mcpOutputSchemaProfile.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../config/mcpInputSchemaProfile.js";
|
||||
import type { createCatalogIdentity } from "../catalogIdentity.js";
|
||||
import type { createCatalogIdentity } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { transformAdvertisedInputJsonSchema } from "../contracts/toolSchemaMetadata.js";
|
||||
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
|
||||
import {
|
||||
@@ -68,7 +62,7 @@ import {
|
||||
TARGET_CONTENT_RESULT_META,
|
||||
} from "./toolResultEncoding.js";
|
||||
import { RequestTrackingMcpServer } from "./RequestTrackingMcpServer.js";
|
||||
import { DISCOVER_TOOLS } from "../catalogDiscovery.js";
|
||||
import { DISCOVER_TOOLS } from "../contracts/catalog/catalogDiscovery.js";
|
||||
import { ProgressiveToolCatalog } from "./ProgressiveToolCatalog.js";
|
||||
import type { WithAdmittedAnalysis } from "./analysisAdmission.js";
|
||||
import { canReferenceInlineEvidence } from "./evidenceInputRegistration.js";
|
||||
@@ -280,6 +274,12 @@ export const forgetPendingMcpRequest = (
|
||||
};
|
||||
import type { PromptCompletionSource } from "./promptCompletion.js";
|
||||
import { isRecord } from "../domain/isRecord.js";
|
||||
import {
|
||||
advertisedToolPresentation,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
} from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
/** Standard-schema registration boundary shared with deferred SDK bindings. */
|
||||
export interface StandardToolRegistration {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
HOT_TOOL_NAMES,
|
||||
progressiveCatalogIdentity,
|
||||
type CatalogIdentity,
|
||||
} from "../catalogDiscovery.js";
|
||||
} from "../contracts/catalog/catalogDiscovery.js";
|
||||
|
||||
/** Per-connection visibility; canonical SDK handles retain validation and authority. */
|
||||
export class ProgressiveToolCatalog {
|
||||
|
||||
@@ -19,21 +19,14 @@ import { registerAnalysisViewTool } from "./registerAnalysisViewTool.js";
|
||||
import { registerBinaryDiagnosticsTools } from "./registerBinaryDiagnosticsTools.js";
|
||||
import { registerFridaTools } from "./registerFridaTools.js";
|
||||
import { EvidenceMcpServer } from "./EvidenceMcpServer.js";
|
||||
import { catalogIdentityForToolFamilies } from "../catalogIdentity.js";
|
||||
import { catalogIdentityForToolFamilies } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { parseMcpToolFamilies } from "../config/mcpToolFamilies.js";
|
||||
import { parseMcpToolCatalogProfile } from "../config/mcpToolCatalogProfile.js";
|
||||
import { createToolResultDelivery } from "./toolResult.js";
|
||||
import type { ToolResultDelivery } from "./ToolResultDelivery.js";
|
||||
import { parseMcpResponseBudget } from "../config/mcpResponseBudget.js";
|
||||
import {
|
||||
parseMcpOutputSchemaProfile,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "../config/mcpOutputSchemaProfile.js";
|
||||
import {
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
parseMcpInputSchemaProfile,
|
||||
} from "../config/mcpInputSchemaProfile.js";
|
||||
import { parseMcpOutputSchemaProfile } from "../config/mcpOutputSchemaProfile.js";
|
||||
import { parseMcpInputSchemaProfile } from "../config/mcpInputSchemaProfile.js";
|
||||
import type { CompactInputSchemaPresentation } from "../contracts/compactInputSchema.js";
|
||||
import type { BinarySessionPort } from "../application/binary/BinarySessionPort.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
@@ -69,6 +62,11 @@ import { registerReverseEngineeringTools } from "./registerReverseEngineeringToo
|
||||
import { registerCutterTools } from "./registerCutterTools.js";
|
||||
import { registerGdbTools } from "./registerGdbTools.js";
|
||||
import { registerRizinDebugTools } from "./registerRizinDebugTools.js";
|
||||
import {
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
COMPACT_INPUT_SCHEMA_PRESENTATION,
|
||||
} from "../contracts/mcpSchemaPresentation.js";
|
||||
|
||||
export interface CreateServerOptions extends CapabilityServiceOptions {
|
||||
readonly analysisSettings?: AnalysisSettings;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@modelcontextprotocol/server";
|
||||
|
||||
import type { ClientFeatureAvailability } from "../contracts/toolOutputSchemaPrimitives.js";
|
||||
import type { ConnectedClientIdentity } from "../serverIdentity.js";
|
||||
import type { ConnectedClientIdentity } from "../process/ServerIdentity.js";
|
||||
import { isRecord } from "../domain/isRecord.js";
|
||||
|
||||
/** Initialize-scoped client metadata the SDK keeps for a 2025-era connection. */
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type TestMcp,
|
||||
} from "../../tests/support/mcp/mcpFixture.js";
|
||||
import { PROMPT_CONTRACTS } from "../contracts/promptContracts.js";
|
||||
import { createCatalogDigests } from "../catalogIdentity.js";
|
||||
import { createCatalogDigests } from "../contracts/catalog/catalogIdentity.js";
|
||||
import { TOOL_CONTRACTS, toolContract } from "../contracts/toolContracts.js";
|
||||
import { EvidenceMcpServer } from "./EvidenceMcpServer.js";
|
||||
import { registerGuidedWorkflowTool } from "./registerGuidedWorkflowTool.js";
|
||||
|
||||
@@ -26,7 +26,7 @@ import type {
|
||||
ToolAvailability,
|
||||
} from "../contracts/toolOutputSchemaPrimitives.js";
|
||||
import { jsonObjectSchema, type JsonValue } from "../domain/jsonValue.js";
|
||||
import { createServerIdentity } from "../serverIdentity.js";
|
||||
import { createServerIdentity } from "../process/ServerIdentity.js";
|
||||
import { mcpClientMetadata } from "./mcpClientMetadata.js";
|
||||
import type { AvailabilityPolicy } from "../application/CapabilityInventory.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { afterAll, describe, expect, it } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../../src/catalogIdentity.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import {
|
||||
evidenceResultOf,
|
||||
|
||||
@@ -6,10 +6,9 @@ import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { expect } from "vitest";
|
||||
import { z } from "zod";
|
||||
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
for (const [setting, profile] of [
|
||||
["REA_MCP_INPUT_SCHEMA_PROFILE", ""],
|
||||
|
||||
@@ -7,7 +7,7 @@ import { expect, it, vi } from "vitest";
|
||||
import { inspectAnalysisView } from "../../../src/application/analysisView/AnalysisViewService.js";
|
||||
import { registerCoreBinaryCommands } from "../../../src/cli/coreBinaryCommands.js";
|
||||
import type { CliInstance } from "../../../src/cli/types.js";
|
||||
import { CLI_COMMANDS } from "../../../src/cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../../../src/contracts/cliCommandNames.js";
|
||||
import { createEvidence } from "../../../src/domain/evidence.js";
|
||||
import { functionDossierSchema } from "../../../src/domain/native/functionDossier.js";
|
||||
import { ghidraFunctionDossier } from "../../../src/domain/ghidraValues.fixture.js";
|
||||
|
||||
@@ -55,11 +55,11 @@ const DEFERRED_IMPORTS = [
|
||||
},
|
||||
{
|
||||
name: "catalog-identity",
|
||||
path: "/dist/catalogIdentity.js",
|
||||
path: "/dist/contracts/catalog/catalogIdentity.js",
|
||||
},
|
||||
{
|
||||
name: "server-identity",
|
||||
path: "/dist/serverIdentity.js",
|
||||
path: "/dist/process/ServerIdentity.js",
|
||||
},
|
||||
{
|
||||
name: "tool-contracts",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import {
|
||||
CLI_COMMAND_NAMES,
|
||||
cliCommandNames,
|
||||
} from "../../../src/catalogIdentity.js";
|
||||
} from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { describeContractCommand } from "../../../src/cli/contractCliDescription.js";
|
||||
|
||||
import { CLI_COMMAND_TOOL_ALIASES } from "./cliContractAliases.js";
|
||||
|
||||
@@ -6,7 +6,10 @@ import { join } from "node:path";
|
||||
import { expect, it, onTestFinished, vi } from "vitest";
|
||||
import { registerReverseEngineeringCommands } from "../../../src/cli/reverseEngineeringCommands.js";
|
||||
import type { CliInstance } from "../../../src/cli/types.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../../../src/cliCommandNames.js";
|
||||
import {
|
||||
CLI_COMMANDS,
|
||||
cliCommandFor,
|
||||
} from "../../../src/contracts/cliCommandNames.js";
|
||||
import {
|
||||
createEvidence,
|
||||
parseEvidence,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createCatalogIdentity } from "../../../src/catalogIdentity.js";
|
||||
import { createCatalogIdentity } from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { contractsForToolFamilies } from "../../../src/contracts/toolFamilies.js";
|
||||
import { promptsForToolFamilies } from "../../../src/contracts/promptToolFamilyScope.js";
|
||||
import { Cli } from "incur";
|
||||
|
||||
@@ -7,7 +7,7 @@ import { expect, it, vi } from "vitest";
|
||||
import { AnalysisOutputError } from "../../../src/domain/analysisErrorCore.js";
|
||||
import { err } from "../../../src/domain/result.js";
|
||||
import { registerReverseEngineeringCommands } from "../../../src/cli/reverseEngineeringCommands.js";
|
||||
import { CLI_COMMANDS } from "../../../src/cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../../../src/contracts/cliCommandNames.js";
|
||||
import type { CliInstance } from "../../../src/cli/types.js";
|
||||
import { GdbSessionManager } from "../../../src/gdb/GdbSessionManager.js";
|
||||
import { answerFakeGdbStartup } from "../providers/gdbTestHelpers.js";
|
||||
|
||||
@@ -4,7 +4,10 @@ import type { AnySchema } from "ajv";
|
||||
import { z } from "zod";
|
||||
|
||||
import { createCli } from "../../../src/cli.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../../../src/cliCommandNames.js";
|
||||
import {
|
||||
CLI_COMMANDS,
|
||||
cliCommandFor,
|
||||
} from "../../../src/contracts/cliCommandNames.js";
|
||||
import { artifactComparisonInputSchema } from "../../../src/contracts/artifactComparisonContracts.js";
|
||||
import {
|
||||
compareApplicationVersionsRequestSchema,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { createEvidenceBundle } from "../../../src/domain/evidenceBundle.js";
|
||||
import { parseEvidence, type Evidence } from "../../../src/domain/evidence.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
import { cliCommandFor } from "../../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../../src/contracts/cliCommandNames.js";
|
||||
|
||||
const reference = (evidence: Evidence) => ({
|
||||
kind: "retained-evidence" as const,
|
||||
|
||||
@@ -4,7 +4,10 @@ import { afterEach, expect, it, vi } from "vitest";
|
||||
import { rm } from "node:fs/promises";
|
||||
|
||||
import { registerReverseEngineeringCommands } from "../../../src/cli/reverseEngineeringCommands.js";
|
||||
import { CLI_COMMANDS, cliCommandFor } from "../../../src/cliCommandNames.js";
|
||||
import {
|
||||
CLI_COMMANDS,
|
||||
cliCommandFor,
|
||||
} from "../../../src/contracts/cliCommandNames.js";
|
||||
import {
|
||||
AnalysisCancelledError,
|
||||
AnalysisTimeoutError,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { expect, it, vi } from "vitest";
|
||||
|
||||
import { registerWebScriptCommands } from "../../../src/cli/webScriptCommands.js";
|
||||
import * as webScriptExport from "../../../src/application/WebScriptExportService.js";
|
||||
import { cliCommandFor } from "../../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../../src/contracts/cliCommandNames.js";
|
||||
import { AnalysisCancelledError } from "../../../src/domain/analysisErrorCore.js";
|
||||
import { err, ok } from "../../../src/domain/result.js";
|
||||
import { ArtifactResourceScope } from "../../../src/resources/ArtifactResourceScope.js";
|
||||
|
||||
@@ -237,7 +237,8 @@ const createBuildCacheFixture = async (): Promise<string> => {
|
||||
await writeFile("resource-controls.json", JSON.stringify(Object.fromEntries(["GOMAXPROCS", "GOMEMLIMIT", "UV_THREADPOOL_SIZE", "REA_TEST_UNLISTED_ENV"].map((name) => [name, process.env[name] ?? null]))));
|
||||
await mkdir("dist", { recursive: true });
|
||||
await writeFile("dist/cache-fixture.js", "built");
|
||||
await writeFile("dist/catalogIdentity.js", "export const DEFAULT_CATALOG_IDENTITY = { counts: { mcp_tools: 1 } };\\n");
|
||||
await mkdir("dist/contracts/catalog", { recursive: true });
|
||||
await writeFile("dist/contracts/catalog/catalogIdentity.js", "export const DEFAULT_CATALOG_IDENTITY = { counts: { mcp_tools: 1 } };\\n");
|
||||
await writeFile("dist/identity.js", ${JSON.stringify(`export const PRODUCT_IDENTITY = ${JSON.stringify({ packageSpecifier: `${packageJson.name}@latest`, registrationPackageSpecifier: `${packageJson.name}@${packageJson.version}` })};\n`)});
|
||||
`,
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ async function fixture(eol = "\n") {
|
||||
const sourceRoot = join(root, ".agents/skills/reverse-engineer-anything");
|
||||
const outputRoot = join(root, "skills/reverse-engineer-anything");
|
||||
await mkdir(join(sourceRoot, "references"), { recursive: true });
|
||||
await mkdir(join(root, "dist"));
|
||||
await mkdir(join(root, "dist/contracts/catalog"), { recursive: true });
|
||||
await writeFile(join(root, "package.json"), '{"type":"module"}\n');
|
||||
await writeFile(
|
||||
join(root, "dist/identity.js"),
|
||||
@@ -38,7 +38,7 @@ async function fixture(eol = "\n") {
|
||||
);
|
||||
const identity = async (count: number, digest: string) =>
|
||||
writeFile(
|
||||
join(root, "dist/catalogIdentity.js"),
|
||||
join(root, "dist/contracts/catalog/catalogIdentity.js"),
|
||||
`export const DEFAULT_CATALOG_IDENTITY = ${JSON.stringify({ counts: { mcp_tools: count }, digests: { combined_sha256: digest } })};\n`,
|
||||
);
|
||||
await identity(139, "a".repeat(64));
|
||||
|
||||
@@ -8,7 +8,7 @@ import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import { BYTE_ENTROPY_PROVIDER } from "../../../src/domain/investigationProviders.js";
|
||||
import { SUPPORTED_CLIENT_DEFINITIONS } from "../../../src/application/SupportedClients.js";
|
||||
import { CLI_COMMAND_NAMES } from "../../../src/catalogIdentity.js";
|
||||
import { CLI_COMMAND_NAMES } from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { createCli } from "../../../src/cli.js";
|
||||
import { FRIDA_PROVIDER_IDENTITY } from "../../../src/frida/FridaProviderIdentity.js";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
|
||||
@@ -10,18 +10,18 @@ import {
|
||||
import { PROMPT_CONTRACTS } from "../../../src/contracts/promptContracts.js";
|
||||
import { advertisedInputJsonSchema } from "../../../src/contracts/toolSchemaMetadata.js";
|
||||
import { advertiseTool } from "../../../src/contracts/advertisedTool.js";
|
||||
import { advertisedToolPresentation } from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { createCatalogDigests } from "../../../src/catalogIdentity.js";
|
||||
import {
|
||||
COMPACT_INPUT_SCHEMA_BUDGET_BYTES,
|
||||
parseMcpInputSchemaProfile,
|
||||
} from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
import { createCatalogDigests } from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { parseMcpInputSchemaProfile } from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
import { processScenarioSchema } from "../../../src/domain/process/processScenario.js";
|
||||
import { EvidenceMcpServer } from "../../../src/server/EvidenceMcpServer.js";
|
||||
import { createToolResultDelivery } from "../../../src/server/toolResult.js";
|
||||
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
|
||||
import { createTestMcp } from "../../support/mcp/mcpFixture.js";
|
||||
import { arrayItemSchemaError } from "../../fixtures/mcpClientSchemaConstraints.js";
|
||||
import {
|
||||
advertisedToolPresentation,
|
||||
COMPACT_INPUT_SCHEMA_BUDGET_BYTES,
|
||||
} from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
interface AdvertisedTool {
|
||||
readonly name: string;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { advertiseTool } from "../../../src/contracts/advertisedTool.js";
|
||||
import { advertisedToolPresentation } from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { isCallToolResult } from "@modelcontextprotocol/server";
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
runOwnedCommand,
|
||||
} from "../../../src/process/OwnedCommand.js";
|
||||
import { resolveSwiftcCompileTimeoutMs } from "../../../src/process/DarwinProcessRunTokenReader.js";
|
||||
import { advertisedToolPresentation } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
beforeAll(
|
||||
() => prepareOwnedCommand(),
|
||||
|
||||
@@ -21,7 +21,7 @@ import { TOOL_FAMILY_DEFINITIONS } from "../../../src/contracts/toolFamilies.js"
|
||||
import { evidenceSchema } from "../../../src/domain/evidence.js";
|
||||
import { analysisViewResultSchema } from "../../../src/domain/analysisView/analysisViewResult.js";
|
||||
import { SERVER_START_FAILED } from "../../../src/main/messages.js";
|
||||
import { HOT_TOOL_NAMES } from "../../../src/catalogDiscovery.js";
|
||||
import { HOT_TOOL_NAMES } from "../../../src/contracts/catalog/catalogDiscovery.js";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { Ajv2020 } from "ajv/dist/2020.js";
|
||||
import type { AnySchemaObject } from "ajv";
|
||||
|
||||
@@ -2,7 +2,6 @@ import { STDIO_DEFAULT_MAX_BUFFER_SIZE } from "@modelcontextprotocol/server";
|
||||
import { Ajv2020 } from "ajv/dist/2020.js";
|
||||
import { describe, expect, expectTypeOf, it } from "vitest";
|
||||
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
import { SESSION_TOOL_CONTRACTS } from "../../../src/contracts/sessionToolContracts.js";
|
||||
import { toolContract } from "../../../src/contracts/toolContracts.js";
|
||||
import { advertisedInputJsonSchema } from "../../../src/contracts/toolSchemaMetadata.js";
|
||||
@@ -11,6 +10,7 @@ import { createToolResultDelivery } from "../../../src/server/toolResult.js";
|
||||
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
|
||||
import { advertisedSchemaErrors } from "../../fixtures/mcpAdvertisedSchemaValidity.js";
|
||||
import { mcpTest } from "../../support/mcp/mcpFixture.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
describe("Evidence input SDK boundaries", () => {
|
||||
it("borrows SDK Evidence inputs while leaving ordinary request constraints active", async () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { contractsForToolFamilies } from "../../../src/contracts/toolFamilies.js
|
||||
import {
|
||||
HOT_TOOL_NAMES,
|
||||
progressiveCatalogIdentity,
|
||||
} from "../../../src/catalogDiscovery.js";
|
||||
} from "../../../src/contracts/catalog/catalogDiscovery.js";
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { execFile, spawn } from "node:child_process";
|
||||
@@ -25,8 +25,7 @@ import {
|
||||
DEFAULT_CATALOG_IDENTITY,
|
||||
catalogIdentityForToolFamilies,
|
||||
createCatalogIdentity,
|
||||
} from "../../../src/catalogIdentity.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
} from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { parseConfig } from "../../../src/config/parseConfig.js";
|
||||
import { runSessionStatus } from "../../../src/application/DirectAnalysisStatus.js";
|
||||
import { ok } from "../../../src/domain/result.js";
|
||||
@@ -40,6 +39,7 @@ import {
|
||||
} from "../../../src/config/mcpStartupPolicy.js";
|
||||
import { createMcpSchemaValidation } from "../../fixtures/mcpSchemaValidation.js";
|
||||
import { waitFor } from "../../support/testWait.js";
|
||||
import { COMPACT_INPUT_SCHEMA_PRESENTATION } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
// Compile SDK output validators for the tools a test calls, not the whole catalog.
|
||||
const schemaValidation = createMcpSchemaValidation();
|
||||
@@ -211,9 +211,9 @@ describe("production MCP doctor", () => {
|
||||
"--eval",
|
||||
`
|
||||
import assert from "node:assert/strict";
|
||||
import { createCatalogIdentity, createCatalogDigests } from "./dist/catalogIdentity.js";
|
||||
import { RECORDED_CATALOG_DIGEST_PROFILES as profiles } from "./dist/recordedCatalogDigests.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES as budgetBytes } from "./dist/config/mcpInputSchemaProfile.js";
|
||||
import { createCatalogIdentity, createCatalogDigests } from "./dist/contracts/catalog/catalogIdentity.js";
|
||||
import { RECORDED_CATALOG_DIGEST_PROFILES as profiles } from "./dist/contracts/catalog/recordedCatalogDigests.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES as budgetBytes } from "./dist/contracts/mcpSchemaPresentation.js";
|
||||
assert.ok(Object.isFrozen(profiles));
|
||||
assert.deepEqual(Object.keys(profiles).sort(), ["compact", "off"]);
|
||||
for (const output of ["compact", "off"]) {
|
||||
|
||||
@@ -7,10 +7,6 @@ import {
|
||||
TOOL_CONTRACTS,
|
||||
toolContract,
|
||||
} from "../../../src/contracts/toolContracts.js";
|
||||
import {
|
||||
COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
} from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { createServer as createProductionServer } from "../../../src/server/createServer.js";
|
||||
import { silentLogger } from "../../../src/logger.js";
|
||||
import { createTestBinarySession } from "../../fixtures/binarySession.js";
|
||||
@@ -18,9 +14,13 @@ import { EvidenceMcpServer } from "../../../src/server/EvidenceMcpServer.js";
|
||||
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
|
||||
import { createToolResultDelivery } from "../../../src/server/toolResult.js";
|
||||
import type { ToolContract } from "../../../src/contracts/toolContractTypes.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../../src/catalogIdentity.js";
|
||||
import type { McpOutputSchemaProfile } from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { DEFAULT_CATALOG_IDENTITY } from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { advertisedSchemaErrors } from "../../fixtures/mcpAdvertisedSchemaValidity.js";
|
||||
import {
|
||||
COMPACT_OUTPUT_SCHEMA_BUDGET_BYTES,
|
||||
resolveMcpOutputSchemaProfile,
|
||||
type McpOutputSchemaProfile,
|
||||
} from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
const createServer = (outputSchemaProfile: McpOutputSchemaProfile) =>
|
||||
new EvidenceMcpServer(
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { parseMcpToolError } from "../../fixtures/mcpToolError.js";
|
||||
import { ok as resultOk } from "../../../src/domain/result.js";
|
||||
import { mkdir, readFile, symlink, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
||||
import { describe, expect, it } from "vitest";
|
||||
@@ -16,8 +17,7 @@ import {
|
||||
createCatalogDigests,
|
||||
createCatalogIdentity,
|
||||
CLI_COMMAND_NAMES,
|
||||
} from "../../../src/catalogIdentity.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/config/mcpInputSchemaProfile.js";
|
||||
} from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { PACKAGE_METADATA } from "../../../src/generatedPackageMetadata.js";
|
||||
import { PRODUCT_IDENTITY, SDK_IDENTITY } from "../../../src/identity.js";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
@@ -26,7 +26,7 @@ import { expandToolAvailability } from "../../../src/contracts/toolOutputSchemaP
|
||||
import { sessionOutputSchemas } from "../../../src/contracts/toolOutputSchemaGroups.js";
|
||||
import { PROMPT_CONTRACTS } from "../../../src/contracts/promptContracts.js";
|
||||
import { createServer } from "../../../src/server/createServer.js";
|
||||
import { createServerIdentity } from "../../../src/serverIdentity.js";
|
||||
import { createServerIdentity } from "../../../src/process/ServerIdentity.js";
|
||||
import { normalizeEntrypointPath } from "../../../src/process/CurrentEntrypointPath.js";
|
||||
import { observed } from "../../fixtures/analysisExecution.js";
|
||||
import { buildCapabilityInventory } from "../../../src/application/CapabilityInventory.js";
|
||||
@@ -34,6 +34,7 @@ import type {
|
||||
AnalysisProvider,
|
||||
CapabilityDescriptor,
|
||||
} from "../../../src/ports/AnalysisProvider.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
const availabilityProvider = (
|
||||
operations: readonly CapabilityDescriptor["operation"][] = [
|
||||
@@ -181,6 +182,9 @@ describe("server and catalog identity", () => {
|
||||
});
|
||||
expect(unknown.alignment.state).toBe("unknown");
|
||||
expect(unknown.server.command_path).toBeNull();
|
||||
expect(unknown.package.root_path).toBe(
|
||||
resolve(fileURLToPath(import.meta.url), "../../../.."),
|
||||
);
|
||||
const aligned = createServerIdentity({
|
||||
catalog: DEFAULT_CATALOG_IDENTITY,
|
||||
startedAt: "2026-07-13T00:00:00.000Z",
|
||||
|
||||
@@ -15,7 +15,6 @@ import type {
|
||||
} from "../../../src/ports/AnalysisProvider.js";
|
||||
import { observed as ok } from "../../fixtures/analysisExecution.js";
|
||||
import { createServer } from "../../../src/server/createServer.js";
|
||||
import { advertisedToolPresentation } from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { advertiseTool } from "../../../src/contracts/advertisedTool.js";
|
||||
import { advertisedInputJsonSchema } from "../../../src/contracts/toolSchemaMetadata.js";
|
||||
import {
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
toolContract,
|
||||
} from "../../../src/contracts/toolContracts.js";
|
||||
import { expandToolAvailability } from "../../../src/contracts/toolOutputSchemaPrimitives.js";
|
||||
import { advertisedToolPresentation } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
const resources: Array<{ close(): Promise<void> }> = [];
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { buildCapabilityInventory } from "../../../src/application/CapabilityInv
|
||||
import {
|
||||
CLI_COMMAND_NAMES,
|
||||
cliCommandNames,
|
||||
} from "../../../src/catalogIdentity.js";
|
||||
} from "../../../src/contracts/catalog/catalogIdentity.js";
|
||||
import { registerContractCommand } from "../../../src/cli/contractCommand.js";
|
||||
import type { CliInstance } from "../../../src/cli/types.js";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
|
||||
@@ -8,6 +8,7 @@ import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import { EvidenceMcpServer } from "../../../src/server/EvidenceMcpServer.js";
|
||||
import { createToolResultDelivery } from "../../../src/server/toolResult.js";
|
||||
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
|
||||
import { COMPACT_INPUT_SCHEMA_BUDGET_BYTES } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
// The server advertises its one (compact) input presentation.
|
||||
const createServer = (): EvidenceMcpServer =>
|
||||
|
||||
@@ -7,7 +7,6 @@ import { z } from "zod";
|
||||
import { advertisedInputExamples } from "../../../src/contracts/advertisedInputExamples.js";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import { advertiseTool } from "../../../src/contracts/advertisedTool.js";
|
||||
import { advertisedToolPresentation } from "../../../src/config/mcpOutputSchemaProfile.js";
|
||||
import { emptyArraySchema } from "../../../src/domain/emptyArraySchema.js";
|
||||
import { processScenarioSchema } from "../../../src/domain/process/processScenario.js";
|
||||
import {
|
||||
@@ -30,6 +29,7 @@ import {
|
||||
FIRST_BOOK,
|
||||
THIRD_BOOK,
|
||||
} from "../../fixtures/environmentStateWrites.js";
|
||||
import { advertisedToolPresentation } from "../../../src/contracts/mcpSchemaPresentation.js";
|
||||
|
||||
interface ToolSchemas {
|
||||
readonly name: string;
|
||||
|
||||
@@ -141,7 +141,9 @@ if (process.argv[2] === "mcp") {
|
||||
const missing = await invoke();
|
||||
expect(missing.exitCode).toBe(1);
|
||||
expect(missing.stderr).toContain("ERR_MODULE_NOT_FOUND");
|
||||
expect(missing.stderr).toMatch(/dist[/\\]catalogIdentity\.js/u);
|
||||
expect(missing.stderr).toMatch(
|
||||
/dist[/\\]contracts[/\\]catalog[/\\]catalogIdentity\.js/u,
|
||||
);
|
||||
await symlink(
|
||||
resolve("dist"),
|
||||
join(controller, "dist"),
|
||||
|
||||
@@ -11,7 +11,7 @@ import { expect, it, onTestFinished } from "vitest";
|
||||
|
||||
import { registerReverseEngineeringCommands } from "../../../src/cli/reverseEngineeringCommands.js";
|
||||
import type { CliInstance } from "../../../src/cli/types.js";
|
||||
import { CLI_COMMANDS } from "../../../src/cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../../../src/contracts/cliCommandNames.js";
|
||||
import { toolContract } from "../../../src/contracts/toolContracts.js";
|
||||
import type { AnalysisError } from "../../../src/domain/analysisErrorBase.js";
|
||||
import type { Result } from "../../../src/domain/result.js";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { expect, expectTypeOf, it, vi } from "vitest";
|
||||
import { z } from "zod";
|
||||
import { evmInterfaceModule } from "../../src/composition/evm.js";
|
||||
import { wasmArtifactModule } from "../../src/composition/wasm.js";
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import { INSPECT_EVM_INTERFACE_CONTRACT } from "../../src/contracts/evm/evmToolContracts.js";
|
||||
|
||||
it("rejects incompatible static bindings through the complete project typecheck", () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import {
|
||||
CAPABILITY_DECLARATIONS,
|
||||
type CapabilityDeclaration,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { DISCOVER_TOOLS } from "../../src/catalogDiscovery.js";
|
||||
import { DISCOVER_TOOLS } from "../../src/contracts/catalog/catalogDiscovery.js";
|
||||
import { TOOL_CONTRACTS } from "../../src/contracts/toolContracts.js";
|
||||
import {
|
||||
advertisedInputJsonSchema,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { registerManagedCommands } from "../../src/cli/managedCommands.js";
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import { createDirectAnalysis } from "../../src/composition/directAnalysis.js";
|
||||
import type { DirectAnalysis } from "../../src/composition/directAnalysis.js";
|
||||
import { silentLogger } from "../../src/logger.js";
|
||||
|
||||
@@ -54,7 +54,7 @@ vi.mock("node:fs/promises", async (importOriginal) => {
|
||||
import { ApkSignatureProvider } from "../../src/apkSignature/ApkSignatureProvider.js";
|
||||
import { ArtifactResourceScope } from "../../src/resources/ArtifactResourceScope.js";
|
||||
import { createCli } from "../../src/cli.js";
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import { projectAnalysisError } from "../../src/domain/analysisErrorProjection.js";
|
||||
|
||||
let root = "";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
|
||||
import { createCli } from "../../src/cli.js";
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import * as composition from "../../src/composition/binaryDiagnostics.js";
|
||||
import { BinaryLayoutService } from "../../src/application/binaryDiagnostics/BinaryLayoutService.js";
|
||||
import { RecordedCrashService } from "../../src/application/binaryDiagnostics/RecordedCrashService.js";
|
||||
|
||||
@@ -35,7 +35,7 @@ vi.mock("node:fs/promises", async (importOriginal) => {
|
||||
});
|
||||
|
||||
import { createCli } from "../../src/cli.js";
|
||||
import { cliCommandFor } from "../../src/cliCommandNames.js";
|
||||
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
|
||||
import { BYTE_ENTROPY_PROVIDER } from "../../src/domain/investigationProviders.js";
|
||||
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
type UninstallHost,
|
||||
} from "../../src/application/Uninstall.js";
|
||||
import { isUninstallFailure } from "../../src/application/UninstallFailure.js";
|
||||
import { CLI_COMMANDS } from "../../src/cliCommandNames.js";
|
||||
import { CLI_COMMANDS } from "../../src/contracts/cliCommandNames.js";
|
||||
|
||||
const originalExitCode = process.exitCode;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
productionMcpDoctorArguments,
|
||||
splitIncurBuiltinArguments,
|
||||
} from "../../../src/cliBuiltinArguments.js";
|
||||
import { DEFAULT_INFO_LOGGING_COMMANDS } from "../../../src/cliCommandNames.js";
|
||||
import { DEFAULT_INFO_LOGGING_COMMANDS } from "../../../src/contracts/cliCommandNames.js";
|
||||
import { parseLogLevel } from "../../../src/config/processStart.js";
|
||||
import { INLINE_EVIDENCE_MCP_ENVIRONMENT } from "../../../scripts/lib/mcp-verification-environment.mjs";
|
||||
|
||||
|
||||
Reference in new issue
Block a user