perf(flutter): add opt-in retained AOT summary and string pages
Add explicit MCP Dart AOT summary delivery and exact retained string-pool pages while preserving complete defaults, CLI behavior, ABI selection, original Evidence identity, partial coverage and lower bounds. Real LocalSend SDK replies shrink 92.05% with approximately unchanged SDK time. Two actual Codex pairs preserve all selected facts and reduce total input 48.75% / 42.38%, uncached input 33.63% / 42.52%, and task time 23.95% / 30.30%; all client errors/repeated calls remain counted. Preserve old portable Evidence and the real CLI complete result after rebasing onto SAZ/qlog main. Curated results keep measured and integration runtime pins separate; raw artifacts stay outside Git. Refs #2016. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent
bb154d1067
commit
23de4f77c7
@@ -0,0 +1,40 @@
|
||||
import type { ExecutionOptions } from "../AnalysisProvider.js";
|
||||
import type { FlutterBuildAnalysisService } from "./FlutterBuildAnalysisService.js";
|
||||
import {
|
||||
requireAnalysisViewRetention,
|
||||
summarizeRetainedAnalysis,
|
||||
type AnalysisViewRetention,
|
||||
} from "../analysisView/AnalysisViewService.js";
|
||||
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
||||
import { AnalysisCancelledError } from "../../domain/analysisErrorCore.js";
|
||||
import { dartAotInspectionInputSchema } from "../../domain/flutter/flutterBuildAnalysis.js";
|
||||
import type { Evidence } from "../../domain/evidence.js";
|
||||
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
||||
import { err, type Result } from "../../domain/result.js";
|
||||
|
||||
/** Keep the caller's ABI choice and complete analysis; select only its delivery. */
|
||||
export const inspectDartAot = async (
|
||||
service: FlutterBuildAnalysisService,
|
||||
rawInput: unknown,
|
||||
retention: AnalysisViewRetention,
|
||||
options?: ExecutionOptions,
|
||||
): Promise<Result<Evidence, AnalysisError>> => {
|
||||
const operation = "inspect_dart_aot";
|
||||
if (options?.signal?.aborted === true)
|
||||
return err(new AnalysisCancelledError(operation));
|
||||
const parsed = dartAotInspectionInputSchema.safeParse(rawInput);
|
||||
if (!parsed.success)
|
||||
return err(
|
||||
analysisInputErrorFromIssues(operation, parsed.error.issues, rawInput, {
|
||||
cause: parsed.error,
|
||||
}),
|
||||
);
|
||||
if (parsed.data.detail === "summary") {
|
||||
const ready = requireAnalysisViewRetention(operation, retention);
|
||||
if (!ready.ok) return ready;
|
||||
}
|
||||
const { detail, ...providerInput } = parsed.data;
|
||||
const executed = await service.execute(operation, providerInput, options);
|
||||
if (!executed.ok || detail !== "summary") return executed;
|
||||
return summarizeRetainedAnalysis(executed.value, retention);
|
||||
};
|
||||
@@ -16,7 +16,7 @@ export const ANALYSIS_VIEW_TOOL_CONTRACTS = [
|
||||
...toolContractMetadata("inspect_analysis_view"),
|
||||
kind: "application",
|
||||
description:
|
||||
'Inspect selected views of completed binary-layout, JavaScript application, native analyze_function, inspect_artifact, inventory_artifact, inspect_wasm_artifact, inspect_evm_interface, inspect_managed_artifact, inspect_android_package or inspect_web_network_capture Evidence without repeating analysis. Historical capture summaries return identity and counts without bodies or archive inventories. Capture views page retained records: view {kind: "capture", detail: "preview" | "complete", offset: 0, limit: 20}; preview selects recorded headline fields and binary descriptors, complete returns exact records with all sidecars. Offsets follow the selected parent record order, preserving original producer ordinals. Paging never reopens the source or reruns the decoder. Qlog summaries keep profile/scope and counts; kind qlog pages traces, streams, loss-declarations, incomplete-records, contributions, ranges or final-sizes. Except traces, select trace_index; stream-specific facets also require exact stream_id and direction. Facts retain all-recorded-events-before-selection scope, and interval overlap or endpoint loss declarations do not prove retransmission or network loss. The api-surface view groups retained HAR requests by method, origin and format-rule path template; templated segments are inferences. It reads no headers or bodies and reports no query values. For a retained record use source: {kind: "retained-evidence", evidence_id: "<parent_evidence_id>"}. Use normalized_result.parent_evidence_id from a summary receipt. Source kind is required. Portable source uses {kind: "inline", evidence: <complete Evidence>}. For layout, JavaScript, native, inventory, WASM, EVM, managed artifact and Android package sources, request a summary with view: {kind: "summary"}; summary is a view kind and has no facet. The WASM summary gives validation, counts, WAT digest/length, tool profile and execution/network states without reading WAT text. Select a layout mitigations/linkage facet, one section/symbol/module, or a stable page. Module pages include assets, bundled and source modules; use node_id for ambiguous or unavailable paths. Inventory uses view: {kind: "inventory", collection: "occurrences", logical_paths: ["package.json"], offset: 0, limit: 64}. Inventory views page nodes, occurrences, edges or integrity contradictions; occurrence logical_paths matches exact recorded strings (omitted means all available, [] means none). source_complete distinguishes complete inventories from partial source records; page exhaustion does not prove absence in a partial source. WASM views use kind wasm and facet sections/imports/exports/candidates/glue/wat/headers/details/tool_profile; text facets use UTF-16 code units and source forms remain exact. EVM summary returns all inferred interface candidates, carrier/decoded identities and explicit unknowns without hex or duplicate stdout. EVM views use kind evm and facet functions/bytecode_hex/stdout/stderr; function pages preserve the original candidate rows, and text offsets/limits count UTF-16 code units (hex has two characters per decoded byte). Exhausting candidate pages does not establish global interface completeness. Managed artifact summaries preserve complete identity/classification, metadata status, module/MVID, frameworks, coverage and limitations without unrelated inventories. Managed pages use kind managed and collection references/resources/attributes, retaining source coverage and build-local token scope; page exhaustion does not establish complete metadata. Android package summaries retain all declarations, engine identity and counts without decoded manifest text. Android manifest pages use kind android, facet manifest, offset and limit in UTF-16 code units; source_status preserves partial decoded coverage even when the retained text page is exhausted. Native views select procedure, pseudocode, assembly, basic blocks, comments, callers/callees, references, unresolved calls, referenced strings/names, native API and high-pcode. Use nonnegative offset and a positive caller-selected limit (defaults 0 and 64); pseudocode uses UTF-16 code units, other native pages use rows. Returns artifact identity, parent Evidence ID, a distinct view digest, coverage, limitations and unknowns. Actual serialized size determines MCP transport admission; choose a smaller page or export the complete retained Evidence if needed.',
|
||||
'Inspect selected views of completed binary-layout, JavaScript application, native analyze_function, inspect_artifact, inventory_artifact, inspect_wasm_artifact, inspect_evm_interface, inspect_managed_artifact, inspect_android_package, inspect_dart_aot or inspect_web_network_capture Evidence without repeating analysis. Historical capture summaries return identity and counts without bodies or archive inventories. Capture views page retained records: view {kind: "capture", detail: "preview" | "complete", offset: 0, limit: 20}; preview selects recorded headline fields and binary descriptors, complete returns exact records with all sidecars. Offsets follow the selected parent record order, preserving original producer ordinals. Paging never reopens the source or reruns the decoder. Qlog summaries keep profile/scope and counts; kind qlog pages traces, streams, loss-declarations, incomplete-records, contributions, ranges or final-sizes. Except traces, select trace_index; stream-specific facets also require exact stream_id and direction. Facts retain all-recorded-events-before-selection scope, and interval overlap or endpoint loss declarations do not prove retransmission or network loss. The api-surface view groups retained HAR requests by method, origin and format-rule path template; templated segments are inferences. It reads no headers or bodies and reports no query values. For a retained record use source: {kind: "retained-evidence", evidence_id: "<parent_evidence_id>"}. Use normalized_result.parent_evidence_id from a summary receipt. Source kind is required. Portable source uses {kind: "inline", evidence: <complete Evidence>}. For layout, JavaScript, native, inventory, WASM, EVM, managed artifact, Android package and Dart AOT sources, request a summary with view: {kind: "summary"}; summary is a view kind and has no facet. The WASM summary gives validation, counts, WAT digest/length, tool profile and execution/network states without reading WAT text. Select a layout mitigations/linkage facet, one section/symbol/module, or a stable page. Module pages include assets, bundled and source modules; use node_id for ambiguous or unavailable paths. Inventory uses view: {kind: "inventory", collection: "occurrences", logical_paths: ["package.json"], offset: 0, limit: 64}. Inventory views page nodes, occurrences, edges or integrity contradictions; occurrence logical_paths matches exact recorded strings (omitted means all available, [] means none). source_complete distinguishes complete inventories from partial source records; page exhaustion does not prove absence in a partial source. WASM views use kind wasm and facet sections/imports/exports/candidates/glue/wat/headers/details/tool_profile; text facets use UTF-16 code units and source forms remain exact. EVM summary returns all inferred interface candidates, carrier/decoded identities and explicit unknowns without hex or duplicate stdout. EVM views use kind evm and facet functions/bytecode_hex/stdout/stderr; function pages preserve the original candidate rows, and text offsets/limits count UTF-16 code units (hex has two characters per decoded byte). Exhausting candidate pages does not establish global interface completeness. Managed artifact summaries preserve complete identity/classification, metadata status, module/MVID, frameworks, coverage and limitations without unrelated inventories. Managed pages use kind managed and collection references/resources/attributes, retaining source coverage and build-local token scope; page exhaustion does not establish complete metadata. Android package summaries retain all declarations, engine identity and counts without decoded manifest text. Android manifest pages use kind android, facet manifest, offset and limit in UTF-16 code units; source_status preserves partial decoded coverage even when the retained text page is exhausted. Dart AOT summary preserves target/ABI/library identity, snapshot headers and pool lower bounds. String pages use kind dart-aot, collection package_uris/dart_uris/class_like_tokens; source coverage remains partial when the producer says partial. Native views select procedure, pseudocode, assembly, basic blocks, comments, callers/callees, references, unresolved calls, referenced strings/names, native API and high-pcode. Use nonnegative offset and a positive caller-selected limit (defaults 0 and 64); pseudocode uses UTF-16 code units, other native pages use rows. Returns artifact identity, parent Evidence ID, a distinct view digest, coverage, limitations and unknowns. Actual serialized size determines MCP transport admission; choose a smaller page or export the complete retained Evidence if needed.',
|
||||
inputSchema: inspectAnalysisViewInputSchema,
|
||||
outputSchema: evidenceResultOf(analysisViewResultSchema),
|
||||
examples: [
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { z } from "zod";
|
||||
import {
|
||||
flutterInputSchemas,
|
||||
dartAotInspectionInputSchema,
|
||||
flutterResultSchemas,
|
||||
} from "../../domain/flutter/flutterBuildAnalysis.js";
|
||||
import { dartAotSummaryViewResultSchema } from "../../domain/analysisView/analysisView.js";
|
||||
import type { ToolContract } from "../toolContractTypes.js";
|
||||
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
|
||||
import { toolContractMetadata } from "../toolEffects.js";
|
||||
@@ -27,10 +30,15 @@ export const FLUTTER_TOOL_CONTRACTS = [
|
||||
name: "inspect_dart_aot",
|
||||
...toolContractMetadata("inspect_dart_aot"),
|
||||
description:
|
||||
"Inspect one ABI's Dart AOT snapshot inside an APK: the four snapshot symbols located through the ELF dynamic symbol table with their offsets, sizes, and section headers (magic, kind, length), the snapshot hash, and a bounded string-pool projection from the isolate data section (package: source URIs, dart: SDK URIs, identifier-like tokens) exposing the app's dependency structure. String-pool entries are byte-pattern observations, not deserialized cluster semantics; typed class and function recovery needs an SDK-specific parser. No engine, no execution.",
|
||||
"Inspect one ABI's Dart AOT snapshot inside an APK: the four snapshot symbols located through the ELF dynamic symbol table with their offsets, sizes, and section headers (magic, kind, length), the snapshot hash, and a bounded string-pool projection from the isolate data section (package: source URIs, dart: SDK URIs, identifier-like tokens) exposing the app's dependency structure. String-pool entries are byte-pattern observations, not deserialized cluster semantics; typed class and function recovery needs an SDK-specific parser. Omitted or complete detail returns the full observation. Select detail: \"summary\" for target/ABI/library identity, all snapshot headers, coverage and original lower-bound counts without string lists. The complete source stays retained; read returned strings via inspect_analysis_view with parent_evidence_id and kind dart-aot, collection package_uris/dart_uris/class_like_tokens, offset and limit. Exhausting pages does not imply complete pool coverage. No engine, no execution.",
|
||||
kind: "flutter-provider",
|
||||
inputSchema: flutterInputSchemas.inspect_dart_aot,
|
||||
outputSchema: evidenceResultOf(flutterResultSchemas.inspect_dart_aot),
|
||||
inputSchema: dartAotInspectionInputSchema,
|
||||
outputSchema: evidenceResultOf(
|
||||
z.union([
|
||||
flutterResultSchemas.inspect_dart_aot,
|
||||
dartAotSummaryViewResultSchema,
|
||||
]),
|
||||
),
|
||||
examples: [
|
||||
{
|
||||
title: "Inspect the preferred ABI's AOT snapshot",
|
||||
@@ -40,6 +48,10 @@ export const FLUTTER_TOOL_CONTRACTS = [
|
||||
title: "Inspect one ABI explicitly",
|
||||
input: { path: "/targets/Example.apk", abi: "arm64-v8a" },
|
||||
},
|
||||
{
|
||||
title: "Inspect snapshot identity with retained string lists",
|
||||
input: { path: "/targets/Example.apk", detail: "summary" },
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const satisfies readonly ToolContract[];
|
||||
|
||||
@@ -73,6 +73,12 @@ import {
|
||||
androidViewRequestSchema,
|
||||
androidManifestViewItemSchema,
|
||||
} from "./androidPackageView.js";
|
||||
import {
|
||||
projectDartAotView,
|
||||
dartAotSummarySchema,
|
||||
dartAotViewRequestSchema,
|
||||
dartAotViewContextSchema,
|
||||
} from "./dartAotView.js";
|
||||
|
||||
/** Public name of the selected-view workflow. */
|
||||
export const INSPECT_ANALYSIS_VIEW_OPERATION = "inspect_analysis_view" as const;
|
||||
@@ -190,6 +196,7 @@ export const analysisViewRequestSchema = z.discriminatedUnion("kind", [
|
||||
apiSurfaceViewSchema,
|
||||
captureViewRequestSchema,
|
||||
qlogViewRequestSchema,
|
||||
dartAotViewRequestSchema,
|
||||
]);
|
||||
|
||||
// The application owns admission and authenticated Evidence parsing. SDK and
|
||||
@@ -305,6 +312,7 @@ const viewResultBase = {
|
||||
"inspect_managed_artifact",
|
||||
"inspect_web_network_capture",
|
||||
"inspect_android_package",
|
||||
"inspect_dart_aot",
|
||||
]),
|
||||
parent_digest: digestSchema,
|
||||
view_digest: digestSchema,
|
||||
@@ -376,6 +384,13 @@ export const androidPackageSummaryViewResultSchema = z.strictObject({
|
||||
summary: androidPackageSummarySchema,
|
||||
});
|
||||
|
||||
/** Exact snapshot and pool-coverage carrier for selected AOT delivery. */
|
||||
export const dartAotSummaryViewResultSchema = z.strictObject({
|
||||
...summaryViewResultBase,
|
||||
parent_operation: z.literal("inspect_dart_aot"),
|
||||
summary: dartAotSummarySchema,
|
||||
});
|
||||
|
||||
/** Projected facts for one selected view of retained analysis Evidence. */
|
||||
export const analysisViewResultSchema = z.discriminatedUnion("kind", [
|
||||
z.strictObject({
|
||||
@@ -400,6 +415,7 @@ export const analysisViewResultSchema = z.discriminatedUnion("kind", [
|
||||
managedSummarySchema,
|
||||
captureSummarySchema,
|
||||
androidPackageSummarySchema,
|
||||
dartAotSummarySchema,
|
||||
]),
|
||||
}),
|
||||
z.strictObject({
|
||||
@@ -470,6 +486,14 @@ export const analysisViewResultSchema = z.discriminatedUnion("kind", [
|
||||
...viewResultBase,
|
||||
parent_operation: z.literal("inspect_android_package"),
|
||||
}),
|
||||
z.strictObject({
|
||||
kind: z.literal("dart-aot"),
|
||||
view: dartAotViewRequestSchema,
|
||||
items: z.array(z.string()),
|
||||
...viewResultBase,
|
||||
...dartAotViewContextSchema.shape,
|
||||
parent_operation: z.literal("inspect_dart_aot"),
|
||||
}),
|
||||
z.strictObject({
|
||||
kind: z.literal("inventory"),
|
||||
view: inventoryViewSchema,
|
||||
@@ -549,6 +573,10 @@ export type UnsignedAnalysisView =
|
||||
| Omit<
|
||||
Extract<AnalysisViewResult, { readonly kind: "android" }>,
|
||||
"view_digest"
|
||||
>
|
||||
| Omit<
|
||||
Extract<AnalysisViewResult, { readonly kind: "dart-aot" }>,
|
||||
"view_digest"
|
||||
>;
|
||||
|
||||
/** Attach the content digest that must change when projected bytes change. */
|
||||
@@ -594,7 +622,7 @@ const unsupportedParent = (
|
||||
new AnalysisUnsupportedTargetError(
|
||||
INSPECT_ANALYSIS_VIEW_OPERATION,
|
||||
parentArtifactPath(parent),
|
||||
`Parent Evidence operation ${JSON.stringify(parent.operation)} does not support analysis views. Use completed binary layout, JavaScript application, native function, artifact inventory/inspection, WASM, EVM, managed artifact, Android package, or web network capture Evidence.`,
|
||||
`Parent Evidence operation ${JSON.stringify(parent.operation)} does not support analysis views. Use completed binary layout, JavaScript application, native function, artifact inventory/inspection, WASM, EVM, managed artifact, Android package, Dart AOT, or web network capture Evidence.`,
|
||||
);
|
||||
|
||||
const parentArtifactPath = (parent: AnalysisViewParent): string => {
|
||||
@@ -624,6 +652,7 @@ const retainedViewProjectors = new Map<string, typeof projectWasmArtifactView>([
|
||||
["inspect_evm_interface", projectEvmInterfaceView],
|
||||
["inspect_managed_artifact", projectManagedArtifactView],
|
||||
["inspect_android_package", projectAndroidPackageView],
|
||||
["inspect_dart_aot", projectDartAotView],
|
||||
["inspect_artifact", projectArtifactInventoryView],
|
||||
["inventory_artifact", projectArtifactInventoryView],
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
import { z } from "zod";
|
||||
import type { AnalysisError } from "../analysisErrorBase.js";
|
||||
import { flutterResultSchemas } from "../flutter/flutterBuildAnalysis.js";
|
||||
import { analysisInputErrorFromIssues } from "../inputIssueProjection.js";
|
||||
import { err, ok, type Result } from "../result.js";
|
||||
import {
|
||||
analysisViewInputError,
|
||||
type AnalysisViewParent,
|
||||
type AnalysisViewRequest,
|
||||
type UnsignedAnalysisView,
|
||||
} from "./analysisView.js";
|
||||
import {
|
||||
completeWithinViewCoverage,
|
||||
pageViewCoverage,
|
||||
} from "./analysisViewCoverage.js";
|
||||
|
||||
const aotSchema = flutterResultSchemas.inspect_dart_aot;
|
||||
|
||||
/** Snapshot identity and original coverage, without unrelated string inventories. */
|
||||
export const dartAotSummarySchema = aotSchema.extend({
|
||||
string_pool: aotSchema.shape.string_pool
|
||||
.omit({ package_uris: true, dart_uris: true, class_like_tokens: true })
|
||||
.extend({
|
||||
returned_counts: z.strictObject({
|
||||
package_uris: z.number().int().nonnegative(),
|
||||
dart_uris: z.number().int().nonnegative(),
|
||||
class_like_tokens: z.number().int().nonnegative(),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
/** Pages of the producer-returned strings, preserving original order and scope. */
|
||||
export const dartAotViewRequestSchema = z.strictObject({
|
||||
kind: z.literal("dart-aot"),
|
||||
collection: z.enum(["package_uris", "dart_uris", "class_like_tokens"]),
|
||||
offset: z.number().int().nonnegative().default(0),
|
||||
limit: z.number().int().positive().default(64),
|
||||
});
|
||||
|
||||
export const dartAotViewContextSchema = z.strictObject({
|
||||
abi: aotSchema.shape.abi,
|
||||
libapp: aotSchema.shape.libapp,
|
||||
source_coverage: aotSchema.shape.coverage,
|
||||
string_pool: dartAotSummarySchema.shape.string_pool,
|
||||
});
|
||||
|
||||
/** Reuse authenticated AOT Evidence without opening the APK or rescanning its ELF. */
|
||||
export const projectDartAotView = (
|
||||
parent: AnalysisViewParent,
|
||||
view: AnalysisViewRequest,
|
||||
): Result<UnsignedAnalysisView, AnalysisError> => {
|
||||
if (view.kind !== "summary" && view.kind !== "dart-aot")
|
||||
return err(
|
||||
analysisViewInputError([
|
||||
{
|
||||
path: ["view"],
|
||||
reason: "invalid_value",
|
||||
message: "Dart AOT Evidence supports summary and string-pool pages.",
|
||||
},
|
||||
]),
|
||||
);
|
||||
const parsed = aotSchema.safeParse(parent.normalizedResult);
|
||||
if (!parsed.success)
|
||||
return err(
|
||||
analysisInputErrorFromIssues(
|
||||
"inspect_analysis_view",
|
||||
parsed.error.issues.map((issue) => ({
|
||||
...issue,
|
||||
path: ["source", "normalized_result", ...issue.path],
|
||||
})),
|
||||
{ source: { normalized_result: parent.normalizedResult } },
|
||||
{ cause: parsed.error },
|
||||
),
|
||||
);
|
||||
const report = parsed.data;
|
||||
const { package_uris, dart_uris, class_like_tokens, ...pool } =
|
||||
report.string_pool;
|
||||
const string_pool = {
|
||||
...pool,
|
||||
returned_counts: {
|
||||
package_uris: package_uris.length,
|
||||
dart_uris: dart_uris.length,
|
||||
class_like_tokens: class_like_tokens.length,
|
||||
},
|
||||
};
|
||||
const shared = {
|
||||
parent_evidence_id: parent.evidenceId,
|
||||
parent_operation: "inspect_dart_aot" as const,
|
||||
parent_digest: parent.evidenceId.slice(3),
|
||||
artifact: { path: report.target.path, sha256: report.target.sha256 },
|
||||
limitations: [...parent.limitations],
|
||||
unknowns: [
|
||||
"String-pool entries are byte-pattern observations, not recovered typed classes or functions.",
|
||||
"Counts ending in _at_least remain lower bounds; exhausting returned strings does not establish a complete snapshot inventory.",
|
||||
...(parent.subject == null
|
||||
? [
|
||||
"The parent has no recorded subject; its normalized target identity cannot be cross-checked against a subject digest.",
|
||||
]
|
||||
: []),
|
||||
],
|
||||
};
|
||||
if (view.kind === "summary")
|
||||
return ok({
|
||||
kind: "summary",
|
||||
view,
|
||||
...shared,
|
||||
summary: { ...report, string_pool },
|
||||
coverage: completeWithinViewCoverage(1, 1),
|
||||
});
|
||||
const collection = report.string_pool[view.collection];
|
||||
const items = collection.slice(view.offset, view.offset + view.limit);
|
||||
return ok({
|
||||
kind: "dart-aot",
|
||||
view,
|
||||
...shared,
|
||||
items,
|
||||
abi: report.abi,
|
||||
libapp: report.libapp,
|
||||
source_coverage: report.coverage,
|
||||
string_pool,
|
||||
coverage: pageViewCoverage(view.offset, items.length, collection.length),
|
||||
});
|
||||
};
|
||||
@@ -30,6 +30,12 @@ export const flutterInputSchemas = {
|
||||
}),
|
||||
} as const;
|
||||
|
||||
/** Retained delivery is selected independently of the provider's ABI request. */
|
||||
export const dartAotInspectionInputSchema =
|
||||
flutterInputSchemas.inspect_dart_aot.extend({
|
||||
detail: z.enum(["complete", "summary"]).optional(),
|
||||
});
|
||||
|
||||
/** Supported Flutter-backed operations. */
|
||||
export type FlutterOperation = keyof typeof flutterInputSchemas;
|
||||
/** Validated Flutter requests carry their selected operation. */
|
||||
|
||||
@@ -444,6 +444,7 @@ export const createServer = (
|
||||
toolLogger,
|
||||
recordEvidence,
|
||||
analysisAdmission,
|
||||
evidenceById,
|
||||
);
|
||||
registerApktoolTools(
|
||||
server,
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import type { EvidenceMcpServer } from "./EvidenceMcpServer.js";
|
||||
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
|
||||
import { FlutterBuildAnalysisService } from "../application/flutter/FlutterBuildAnalysisService.js";
|
||||
import { inspectDartAot } from "../application/flutter/DartAotInspection.js";
|
||||
import type { EvidenceLookup } from "../application/EvidenceInputResolver.js";
|
||||
import { toolContract } from "../contracts/toolContracts.js";
|
||||
import type { WithAdmittedAnalysis } from "./analysisAdmission.js";
|
||||
import type { Logger } from "pino";
|
||||
import { createContractToolHandler } from "./contractToolHandler.js";
|
||||
import {
|
||||
createContractToolHandler,
|
||||
type ContractToolService,
|
||||
} from "./contractToolHandler.js";
|
||||
import { toolRegistrationOptions } from "./toolRegistrationOptions.js";
|
||||
|
||||
/** Bind Flutter handlers to their exact named contracts through admission. */
|
||||
@@ -14,6 +19,7 @@ export const registerFlutterTools = (
|
||||
logger: Logger,
|
||||
recordEvidence?: EvidenceWriter["recordEvidence"],
|
||||
withAdmittedAnalysis?: WithAdmittedAnalysis,
|
||||
evidenceById?: EvidenceLookup,
|
||||
): void => {
|
||||
const handler = createContractToolHandler(
|
||||
server,
|
||||
@@ -22,14 +28,23 @@ export const registerFlutterTools = (
|
||||
recordEvidence,
|
||||
withAdmittedAnalysis,
|
||||
);
|
||||
for (const contract of [
|
||||
toolContract("identify_flutter_build"),
|
||||
toolContract("inspect_dart_aot"),
|
||||
] as const) {
|
||||
server.registerTool(
|
||||
contract.name,
|
||||
toolRegistrationOptions(contract),
|
||||
handler(contract),
|
||||
);
|
||||
}
|
||||
const identify = toolContract("identify_flutter_build");
|
||||
server.registerTool(
|
||||
identify.name,
|
||||
toolRegistrationOptions(identify),
|
||||
handler(identify),
|
||||
);
|
||||
const aotService: ContractToolService<"inspect_dart_aot"> = {
|
||||
execute: (_operation, input, options) =>
|
||||
inspectDartAot(service, input, { recordEvidence, evidenceById }, options),
|
||||
};
|
||||
const aotHandler = createContractToolHandler(
|
||||
server,
|
||||
aotService,
|
||||
logger,
|
||||
recordEvidence,
|
||||
withAdmittedAnalysis,
|
||||
);
|
||||
const aot = toolContract("inspect_dart_aot");
|
||||
server.registerTool(aot.name, toolRegistrationOptions(aot), aotHandler(aot));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user