From c1a0561bf31bf5d8c4be6395290e1b986fee2a0c Mon Sep 17 00:00:00 2001
From: morluto <76467478+morluto@users.noreply.github.com>
Date: Thu, 22 Oct 2026 07:48:39 +0800
Subject: [PATCH] refactor(mobile): retain inventory sources at the projection
boundary
---
.../InventoryProjectionEvidence.ts | 24 +++++++++----
.../android/AndroidApplicationService.ts | 8 +++--
.../apple/AppleApplicationService.ts | 8 +++--
.../harmony/HarmonyApplicationService.ts | 8 +++--
.../ArtifactOccurrenceIdentity.test.ts | 2 +-
src/cli/applicationCommands.ts | 6 ++--
src/domain/android/androidApplication.ts | 14 +++++---
src/domain/apple/appleApplication.test.ts | 4 +--
src/domain/apple/appleApplication.ts | 14 +++++---
src/domain/harmony/harmonyApplication.ts | 14 +++++---
.../mobileApplicationGraphProjection.ts | 8 ++++-
.../projectMobileApplicationGraph.ts | 21 ++++-------
.../filesystem/android/application.test.ts | 4 +--
.../filesystem/appleApplication.test.ts | 7 ++--
.../mcp/mobileApplicationGraphMcp.test.ts | 36 ++++++++++++++++++-
tests/support/applicationSessionFixture.ts | 7 ++--
16 files changed, 124 insertions(+), 61 deletions(-)
diff --git a/src/application/InventoryProjectionEvidence.ts b/src/application/InventoryProjectionEvidence.ts
index eefc4a9d92..d027febb57 100644
--- a/src/application/InventoryProjectionEvidence.ts
+++ b/src/application/InventoryProjectionEvidence.ts
@@ -9,6 +9,7 @@ import {
type EvidenceSubjectTarget,
} from "../domain/evidence.js";
import { jsonValueSchema } from "../domain/jsonValue.js";
+import type { MobileApplicationProjectionWithSources } from "../domain/mobileApplicationGraphProjection.js";
import { err, ok, type Result } from "../domain/result.js";
import { requestInputError, workflowInputError } from "./workflowInputError.js";
@@ -23,13 +24,20 @@ interface InventoryProjectionResult {
readonly limitations: readonly string[];
}
+export interface InventoryProjectionEvidenceResult {
+ readonly evidence: Evidence;
+ readonly sources: readonly Evidence[];
+}
+
interface InventoryProjectionOptions<
Input extends InventoryProjectionInput,
Output extends InventoryProjectionResult,
> {
readonly rawInput: unknown;
readonly schema: z.ZodType;
- readonly project: (input: Input) => Output;
+ readonly project: (
+ input: Input,
+ ) => MobileApplicationProjectionWithSources