Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): bound preview snapshot metadata #7408

Closeddevhims(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7408/headopened View on GitHub

Showing 2 changed files with 145 additions and 21 deletions.

x
0 of 2 viewed, 2 left
72 additions and 0 deletionsapps/server/src/mcp/McpHttpServer.test.tsModified
View file
@@ -4,6 +4,7 @@
import { EnvironmentId, PreviewTabId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
+import * as Schema from "effect/Schema";
import * as Stream from "effect/Stream";
import { McpProtocol, McpSchema, McpServer } from "effect/unstable/ai";
import { HttpBody, HttpClient, HttpRouter, HttpServerResponse } from "effect/unstable/http";
@@ -38,6 +39,17 @@
Layer.provideMerge(McpServer.McpServer.layer),
Layer.provideMerge(PreviewAutomationBroker.layer.pipe(Layer.provide(NodeServices.layer))),
);
+const BoundedSnapshotMetadata = Schema.Struct({
+ visibleText: Schema.String,
+ accessibilityTree: Schema.Struct({ truncated: Schema.Boolean }),
+ truncation: Schema.Struct({
+ truncated: Schema.Boolean,
+ reason: Schema.String,
+ }),
+});
+const decodeBoundedSnapshotMetadata = Schema.decodeUnknownSync(
+ Schema.fromJsonString(BoundedSnapshotMetadata),
+);
​
it("normalizes empty successful notification responses to accepted", () => {
const notificationResponse = McpHttpServer.normalizeMcpHttpResponse(
@@ -97,6 +109,66 @@
).pipe(Effect.provide(TestLayer)),