mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(ports): give the bundle resource operation policy a port owner (#11533)
This commit is contained in:
1 parent
54d55c7a23
commit
a0e89a8970
8 files changed
+42
-33
No files matched your search
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"upward": {
|
||||
"artifacts -> application": 1,
|
||||
"dotnet -> application": 1
|
||||
},
|
||||
"cycles": [
|
||||
"application <-> artifacts",
|
||||
"artifacts <-> native",
|
||||
"cli <-> cli.ts",
|
||||
"cli <-> cliBrowserScenarioCommands.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<string> = new Set(
|
||||
FRIDA_TOOL_CONTRACTS.map(({ name }) => name),
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<AnalysisOperation>([
|
||||
"inspect_plist",
|
||||
]);
|
||||
|
||||
export const BUNDLE_ARTIFACT_RESOURCE_OPERATIONS = new Set<AnalysisOperation>([
|
||||
"decode_interface_builder",
|
||||
"inspect_asset_catalog",
|
||||
"inspect_keyed_archive",
|
||||
]);
|
||||
|
||||
export const BUNDLE_RESOURCE_OPERATIONS = new Set<AnalysisOperation>([
|
||||
...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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<AnalysisOperation>([
|
||||
"inspect_plist",
|
||||
]);
|
||||
|
||||
export const BUNDLE_ARTIFACT_RESOURCE_OPERATIONS = new Set<AnalysisOperation>([
|
||||
"decode_interface_builder",
|
||||
"inspect_asset_catalog",
|
||||
"inspect_keyed_archive",
|
||||
]);
|
||||
|
||||
export const BUNDLE_RESOURCE_OPERATIONS = new Set<AnalysisOperation>([
|
||||
...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;
|
||||
};
|
||||
Reference in new issue
Block a user