diff --git a/scripts/lib/module-layers.baseline.json b/scripts/lib/module-layers.baseline.json index 29967f7e09..2fb90e096e 100644 --- a/scripts/lib/module-layers.baseline.json +++ b/scripts/lib/module-layers.baseline.json @@ -1,10 +1,8 @@ { "upward": { - "artifacts -> application": 1, "dotnet -> application": 1 }, "cycles": [ - "application <-> artifacts", "artifacts <-> native", "cli <-> cli.ts", "cli <-> cliBrowserScenarioCommands.ts", diff --git a/src/application/CapabilityInventory.ts b/src/application/CapabilityInventory.ts index f2bc38f816..f4f5ded7f4 100644 --- a/src/application/CapabilityInventory.ts +++ b/src/application/CapabilityInventory.ts @@ -58,8 +58,8 @@ import { cleanupRetryRemediation, type AnalysisCleanupRetry, } from "../domain/analysisErrorRecovery.js"; -import { isBundleResourceOperation } from "./binary/BundleResourceSession.js"; import { offeredOperationAlternatives } from "./OperationAlternatives.js"; +import { isBundleResourceOperation } from "../ports/BundleResourceOperations.js"; const FRIDA_OPERATION_NAMES: ReadonlySet = new Set( FRIDA_TOOL_CONTRACTS.map(({ name }) => name), diff --git a/src/application/DirectAnalysis.ts b/src/application/DirectAnalysis.ts index aec6733895..c57244f8cb 100644 --- a/src/application/DirectAnalysis.ts +++ b/src/application/DirectAnalysis.ts @@ -95,7 +95,7 @@ import { withSessionCleanup, } from "./DirectAnalysisCleanup.js"; import { completeProviderEvidence } from "./ProviderOperationExecution.js"; -import { BUNDLE_RESOURCE_OPERATIONS } from "./binary/BundleResourceSession.js"; +import { BUNDLE_RESOURCE_OPERATIONS } from "../ports/BundleResourceOperations.js"; // These one-shot CLI questions require native utilities, not a deep engine. // Runtime observation retains the ordinary session and authority checks. diff --git a/src/application/binary/BinarySession.ts b/src/application/binary/BinarySession.ts index 7b48f3e7ce..f39b947902 100644 --- a/src/application/binary/BinarySession.ts +++ b/src/application/binary/BinarySession.ts @@ -99,11 +99,11 @@ import { } from "../BinaryTargetResolver.js"; import { resolveAppBundleResourceRoot } from "../AppBundleExecutable.js"; import type { ResolvedAppBundleResourceRoot } from "../../domain/apple/bundleResourceRoot.js"; -import { - BUNDLE_RESOURCE_OPERATIONS, - type ActiveBundleResourceSession, - type BundleResourceClientFactory, +import type { + ActiveBundleResourceSession, + BundleResourceClientFactory, } from "./BundleResourceSession.js"; +import { BUNDLE_RESOURCE_OPERATIONS } from "../../ports/BundleResourceOperations.js"; interface SessionRun { readonly client: AnalysisClient; diff --git a/src/application/binary/BundleResourceSession.ts b/src/application/binary/BundleResourceSession.ts index 6628acb4d8..f1f5ed95d2 100644 --- a/src/application/binary/BundleResourceSession.ts +++ b/src/application/binary/BundleResourceSession.ts @@ -8,28 +8,10 @@ import { analysisErrorWithCloseRejections } from "../../domain/analysisErrorClea import { err, ok } from "../../domain/result.js"; import type { ResolvedAppBundleResourceRoot } from "../../domain/apple/bundleResourceRoot.js"; import { closeAnalysisClient } from "../../providers/AnalysisClientCleanup.js"; - -export const BUNDLE_NATIVE_RESOURCE_OPERATIONS = new Set([ - "inspect_plist", -]); - -export const BUNDLE_ARTIFACT_RESOURCE_OPERATIONS = new Set([ - "decode_interface_builder", - "inspect_asset_catalog", - "inspect_keyed_archive", -]); - -export const BUNDLE_RESOURCE_OPERATIONS = new Set([ - ...BUNDLE_NATIVE_RESOURCE_OPERATIONS, - ...BUNDLE_ARTIFACT_RESOURCE_OPERATIONS, -]); - -/** Share the dispatch owner's resource-session operation policy with discovery. */ -export const isBundleResourceOperation = (name: string): boolean => { - for (const operation of BUNDLE_RESOURCE_OPERATIONS) - if (operation === name) return true; - return false; -}; +import { + BUNDLE_NATIVE_RESOURCE_OPERATIONS, + BUNDLE_RESOURCE_OPERATIONS, +} from "../../ports/BundleResourceOperations.js"; /** Provider-specific owner of the four read-only app-resource operations. */ export interface BundleResourceClientFactory { diff --git a/src/artifacts/ArtifactProvider.ts b/src/artifacts/ArtifactProvider.ts index 6b46e6cfe4..f75e5646a1 100644 --- a/src/artifacts/ArtifactProvider.ts +++ b/src/artifacts/ArtifactProvider.ts @@ -65,7 +65,7 @@ import type { ResolvedAppBundleResourceRoot, BundleResourceRoot, } from "../domain/apple/bundleResourceRoot.js"; -import { BUNDLE_ARTIFACT_RESOURCE_OPERATIONS } from "../application/binary/BundleResourceSession.js"; +import { BUNDLE_ARTIFACT_RESOURCE_OPERATIONS } from "../ports/BundleResourceOperations.js"; /** Read-only inventory and exclusively owned extraction provider. */ export class ArtifactProvider implements AnalysisProvider { diff --git a/src/composition/binary.ts b/src/composition/binary.ts index 5017b74aed..79d7754d9d 100644 --- a/src/composition/binary.ts +++ b/src/composition/binary.ts @@ -17,11 +17,11 @@ import { LINUX_HOPPER_LAUNCHER_VERIFICATION } from "../application/LinuxHopper.j import { LazyAnalysisProvider } from "../application/binary/LazyAnalysisProvider.js"; import { ManagedStaticProvider } from "../dotnet/ManagedStaticProvider.js"; import { HOST_PLATFORM } from "../platform/HostPlatform.js"; +import { combineBundleResourceClients } from "../application/binary/BundleResourceSession.js"; import { BUNDLE_ARTIFACT_RESOURCE_OPERATIONS, BUNDLE_NATIVE_RESOURCE_OPERATIONS, - combineBundleResourceClients, -} from "../application/binary/BundleResourceSession.js"; +} from "../ports/BundleResourceOperations.js"; /** * Compose the target-switching runtime shared directly by CLI and MCP adapters. diff --git a/src/ports/BundleResourceOperations.ts b/src/ports/BundleResourceOperations.ts new file mode 100644 index 0000000000..1bbde4ed1c --- /dev/null +++ b/src/ports/BundleResourceOperations.ts @@ -0,0 +1,29 @@ +import type { AnalysisOperation } from "./AnalysisProvider.js"; + +/** + * The read-only app-resource operations a bundle resource session serves, + * split by the provider that owns each format: native reads property lists, + * and artifacts reads Interface Builder files, asset catalogs and keyed + * archives. Sessions, discovery and the providers share this one policy. + */ +export const BUNDLE_NATIVE_RESOURCE_OPERATIONS = new Set([ + "inspect_plist", +]); + +export const BUNDLE_ARTIFACT_RESOURCE_OPERATIONS = new Set([ + "decode_interface_builder", + "inspect_asset_catalog", + "inspect_keyed_archive", +]); + +export const BUNDLE_RESOURCE_OPERATIONS = new Set([ + ...BUNDLE_NATIVE_RESOURCE_OPERATIONS, + ...BUNDLE_ARTIFACT_RESOURCE_OPERATIONS, +]); + +/** Share the dispatch owner's resource-session operation policy with discovery. */ +export const isBundleResourceOperation = (name: string): boolean => { + for (const operation of BUNDLE_RESOURCE_OPERATIONS) + if (operation === name) return true; + return false; +};