mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 21:03:46 +00:00
chore: recover bogota workspace state
This commit is contained in:
parent
5d65013aa5
commit
e08d1b4dca
436 changed files with 172093 additions and 455 deletions
60
factory/.context/vite-cache/deps/@react-grab_mcp_client.js
Normal file
60
factory/.context/vite-cache/deps/@react-grab_mcp_client.js
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import "./chunk-V4OQ3NZ2.js";
|
||||
|
||||
// ../../../node_modules/.pnpm/@react-grab+mcp@0.1.27_@types+react@18.3.27_react@19.2.4/node_modules/@react-grab/mcp/dist/client.js
|
||||
var DEFAULT_MCP_PORT = 4723;
|
||||
var sendContextToServer = async (contextUrl, content, prompt) => {
|
||||
await fetch(contextUrl, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ content, prompt })
|
||||
}).catch(() => {
|
||||
});
|
||||
};
|
||||
var createMcpPlugin = (options = {}) => {
|
||||
const port = options.port ?? DEFAULT_MCP_PORT;
|
||||
const contextUrl = `http://localhost:${port}/context`;
|
||||
return {
|
||||
name: "mcp",
|
||||
hooks: {
|
||||
onCopySuccess: (_elements, content) => {
|
||||
void sendContextToServer(contextUrl, [content]);
|
||||
},
|
||||
transformAgentContext: async (context) => {
|
||||
await sendContextToServer(contextUrl, context.content, context.prompt);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var isReactGrabApi = (value) => typeof value === "object" && value !== null && "registerPlugin" in value;
|
||||
var attachMcpPlugin = () => {
|
||||
if (typeof window === "undefined") return;
|
||||
const plugin = createMcpPlugin();
|
||||
const attach = (api) => {
|
||||
api.registerPlugin(plugin);
|
||||
};
|
||||
const existingApi = window.__REACT_GRAB__;
|
||||
if (isReactGrabApi(existingApi)) {
|
||||
attach(existingApi);
|
||||
return;
|
||||
}
|
||||
window.addEventListener(
|
||||
"react-grab:init",
|
||||
(event) => {
|
||||
if (!(event instanceof CustomEvent)) return;
|
||||
if (!isReactGrabApi(event.detail)) return;
|
||||
attach(event.detail);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
const apiAfterListener = window.__REACT_GRAB__;
|
||||
if (isReactGrabApi(apiAfterListener)) {
|
||||
attach(apiAfterListener);
|
||||
}
|
||||
};
|
||||
attachMcpPlugin();
|
||||
export {
|
||||
attachMcpPlugin,
|
||||
createMcpPlugin
|
||||
};
|
||||
//# sourceMappingURL=@react-grab_mcp_client.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue