fix(runtime): accept camelcase miniapp bridge methods

This commit is contained in:
2026-08-06 01:20:41 +08:00
parent c4613ce14e
commit c7c18168b6
3 changed files with 29 additions and 11 deletions
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { CachedVerifiedSurfaceDocumentResolver, parseReadyMessage, productionSurfaceDocument, surfaceDocument } from "@/runtime/surfaces/isolated-surface-host";
import { CachedVerifiedSurfaceDocumentResolver, parseBridgeMessage, parseReadyMessage, productionSurfaceDocument, surfaceDocument } from "@/runtime/surfaces/isolated-surface-host";
import { VerifiedSurfaceBundleCache, type SurfaceBundleDigest, type SurfaceManifestSignatureVerifier } from "@/runtime/surfaces/surface-bundle-cache";
describe("isolated Surface bridge contract", () => {
@@ -19,6 +19,10 @@ describe("isolated Surface bridge contract", () => {
expect(document).not.toContain("https://");
});
it("accepts the SDK camelCase reportProgress bridge method", () => {
expect(parseBridgeMessage({ v: 1, type: "lineup.miniapp.v1.request", instance_id: "task:001", request_id: "req_1", method: "tools.reportProgress", payload: { call_id: "call-1", progress: { percent: 10 } } })).toMatchObject({ method: "tools.reportProgress" });
});
it("wraps only an exact verified production bundle in the host default-deny CSP", async () => {
// Digest mismatch behavior belongs to the cache suite. This test isolates
// the resolver's exact-version lookup and Host-owned CSP wrapping.