mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
5f702dd6cc
Normalize parsed facts at their owning boundaries across PE exports and certificates, ELF section names, GPU bundles, IL2CPP generic types, dyld slice selection, source maps, environment replay, and JavaScript mapped arguments. Preserve partial facts and explicit unsupported cases; clarify the corresponding documentation. Validation: 831 affected tests passed with one existing skip across 23 files; build, typecheck/lint, documentation, formatting, and 2133-file test discovery passed. Format controls are synthetic; real Unity, GPU, and ARM-device execution is unverified. Fixes #6709 Fixes #6688 Fixes #6719 Fixes #6718 Fixes #6704 Fixes #6703 Fixes #6692 Fixes #6723 Fixes #6687 Fixes #6726 Fixes #6696 Fixes #6691 Fixes #6727
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
|
import type { Result } from "../../domain/result.js";
|
|
import {
|
|
replayEnvironmentTool,
|
|
type ReplayArguments,
|
|
type ReplayResult,
|
|
} from "./environmentReplay.js";
|
|
import type {
|
|
EnvironmentManifestTool,
|
|
EnvironmentSource,
|
|
} from "./environmentSource.js";
|
|
import { answerFromState } from "./environmentStateAnswer.js";
|
|
import type { EnvironmentStateStore } from "./environmentStateStore.js";
|
|
import { answerWrite } from "./environmentStateWriteAnswer.js";
|
|
|
|
/** How a served environment answers one tool call. */
|
|
export type EnvironmentToolAnswer = (
|
|
tool: EnvironmentManifestTool,
|
|
args: ReplayArguments,
|
|
observedQuery?: string | null,
|
|
) => Result<ReplayResult, AnalysisError>;
|
|
|
|
/** The answer a served environment gives: replay without a state store; with one, a served write applies to the live state and a read answers from it. */
|
|
export const environmentToolAnswer = (
|
|
source: EnvironmentSource,
|
|
store: EnvironmentStateStore | undefined,
|
|
): EnvironmentToolAnswer =>
|
|
store === undefined
|
|
? (tool, args, observedQuery) =>
|
|
replayEnvironmentTool(source, tool, args, observedQuery)
|
|
: (tool, args, observedQuery) => {
|
|
const plan = store.state.writes.get(tool.name);
|
|
return plan?.served === true
|
|
? answerWrite(
|
|
{ source, store },
|
|
{
|
|
tool,
|
|
plan,
|
|
args,
|
|
...(observedQuery === undefined ? {} : { observedQuery }),
|
|
},
|
|
)
|
|
: answerFromState({ source, store }, tool, args, observedQuery);
|
|
};
|