feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)

* fix(hopper): normalize string-backed addresses and update verification

* feat(native): add inspection primitives, dispatch traces and approved UI observation

* test: prioritize real artifact E2E and captured golden regressions

* fix(process): queue observed output before reactive rendering actions

* test: prune redundant cases and strengthen boundary assertions

* fix(cli): route native value tracing through shared workflows

* test: replace synthetic success with real workflows and captured data

* fix(catalog): separate portable metadata from native host availability
This commit is contained in:
morluto
2026-10-04 16:02:36 +08:00
committed by GitHub
parent 0356f7677f
commit 4fbc501121
205 changed files with 8136 additions and 1816 deletions
@@ -21,6 +21,7 @@ const probeResultSchema = z.strictObject({
}),
current_document: z.literal("fixture"),
current_address: z.literal("0x401000"),
strings: z.strictObject({ "0x401234": z.literal("fixture string") }),
session_document_reused: z.literal(true),
shared_document_shutdown: z.strictObject({
shutdown: z.literal(true),
@@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url";
import { afterEach, describe, expect, it } from "vitest";
import { OFFICIAL_TOOL_CONTRACTS } from "../../../../src/contracts/toolContracts.js";
import { HOPPER_PROVIDER_TOOL_CONTRACTS } from "../../../../src/hopper/HopperProvider.js";
import { ok } from "../../../../src/domain/result.js";
import type {
BridgeLauncher,
@@ -123,9 +123,11 @@ describe("HopperClient protocol", () => {
it("routes every established operation through the authenticated bridge", async () => {
const client = await startClient();
const results = await Promise.all(
OFFICIAL_TOOL_CONTRACTS.map(({ name }) => client.callTool(name, {})),
HOPPER_PROVIDER_TOOL_CONTRACTS.map(({ name }) =>
client.callTool(name, {}),
),
);
expect(results).toHaveLength(36);
expect(results).toHaveLength(HOPPER_PROVIDER_TOOL_CONTRACTS.length);
expect(results.every((result) => result.ok)).toBe(true);
});
@@ -12,12 +12,10 @@ import {
describe("native DMG artifact reader", () => {
it("uses plist attachment metadata and detaches returned devices", async () => {
const calls: string[][] = [];
const commandOptions: unknown[] = [];
const host: NativeDmgHost = {
async run(arguments_, _signal, options) {
async run(arguments_) {
const args = [...arguments_];
calls.push(args);
commandOptions.push(options);
if (args[0] !== "attach") return { stdout: "", exitCode: 0 };
const mountRoot = args[args.indexOf("-mountroot") + 1];
if (mountRoot === undefined) throw new Error("missing mount root");
@@ -43,15 +41,13 @@ describe("native DMG artifact reader", () => {
for await (const entry of reader.entries()) entries.push(entry.path);
expect(entries).toContain("image.dmg/Fixture/hello.txt");
const provenance = reader.provenance();
if (provenance[0] !== undefined)
Reflect.set(provenance[0], "tool", "forged");
const first = provenance[0];
if (first === undefined) throw new Error("expected attachment provenance");
Reflect.set(first, "tool", "forged");
expect(reader.provenance()[0]?.tool).toBe("/usr/bin/hdiutil");
await reader.close();
expect(calls).toContainEqual(["verify", "/tmp/image.dmg"]);
expect(calls).toContainEqual(["detach", "/dev/disk-fixture"]);
expect(commandOptions[0]).toBeUndefined();
expect(commandOptions[1]).toBeUndefined();
expect(commandOptions[2]).toEqual({ timeoutMs: 120_000 });
});
it("rejects non-zero results and surfaces detach failure during attach cleanup", async () => {