Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Pi now sees screenshots returned by T3 MCP tools #15879

Closedanntnzrb(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/15879/headopened View on GitHub

Showing 2 changed files with 118 additions and 16 deletions.

x
0 of 2 viewed, 2 left
88 additions and 7 deletionsapps/server/src/orchestration-v2/Adapters/piT3McpExtensionSource.test.tsModified
View file
@@ -4,6 +4,14 @@
​
import { PI_T3_MCP_EXTENSION_SOURCE } from "./piT3McpExtensionSource.ts";
​
+// The shipped extension as a plain script. Tests supply Typebox through the VM context.
+const runnableSource = NodeModule.stripTypeScriptTypes(
+ PI_T3_MCP_EXTENSION_SOURCE.replace('import { Type } from "typebox";', "").replace(
+ "export default async function",
+ "async function",
+ ),
+);
+​
type RequestHook = (
event: { payload: unknown },
ctx: { model: { provider: string } },
@@ -12,13 +20,7 @@
async function loadRequestHook(): Promise<RequestHook> {
const handlers = new Map<string, RequestHook>();
// Execute the shipped extension with MCP disabled; this path needs no Typebox.
- const source = NodeModule.stripTypeScriptTypes(
- PI_T3_MCP_EXTENSION_SOURCE.replace('import { Type } from "typebox";', "").replace(
- "export default async function",
- "async function",
- ),
- );
- await NodeVM.runInNewContext(`${source}\nt3McpExtension(pi)`, {
+ await NodeVM.runInNewContext(`${runnableSource}\nt3McpExtension(pi)`, {
process: { env: {} },
pi: { on: (name: string, handler: RequestHook) => handlers.set(name, handler) },