kebede-and-ben-testApp.tsx2 matches
16
17try {
18const response = await fetch('/api/game', {
19method: 'POST',
20headers: {
47const moveData: MoveRequest = { position };
48
49const response = await fetch(`/api/game/${game.id}/move`, {
50method: 'PUT',
51headers: {
kebede-and-ben-testindex.ts2 matches
14await runMigrations();
1516// API routes
17app.route("/api/game", gameRoutes);
1819// Serve static files
kebede-and-ben-testREADME.md6 matches
20โ โ โโโ queries.ts # Game queries
21โ โโโ routes/
22โ โโโ game.ts # Game API routes
23โโโ frontend/
24โ โโโ index.html # Main page
416. Click "New Game" to start over
4243## API Endpoints
4445- `GET /api/game/:gameId` - Get game state
46- `POST /api/game` - Create new game
47- `PUT /api/game/:gameId/move` - Make a move
48- `GET /api/games` - List recent games
5const PUSHOVER_USER_KEY = Deno.env.get("PUSHOVER_USER_KEY");
67// token, user, and other opts are as specified at https://pushover.net/api
8export async function pushover({ message, title }) {
9console.log("Input:", { message, title });
10console.log("Tokens:", { PUSHOVER_TOKEN, PUSHOVER_USER_KEY }); // Check if env vars are set
1112const response = await fetch("https://api.pushover.net/1/messages.json", {
13method: "POST",
14headers: {
385386const css = `
387@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
388389:root {
slimifygemini.tsx1 match
1import { GoogleGenAI, Type } from "npm:@google/genai";
23const ai = new GoogleGenAI({ apiKey: "AIzaSyDcuswpF8sAUBVTvrUlnpADXF4gHjTTAxA" });
45const _prompt =
1@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
23:root {
1516export interface AppConfig {
17anthropicApiKey: string;
18mcpServers: MCPServerConfig[];
19selectedModel: string;
40export default function App() {
41const [config, setConfig] = useState<AppConfig>({
42anthropicApiKey: "",
43mcpServers: [],
44selectedModel: "claude-3-5-sonnet-20241022",
55// Load config from localStorage on mount
56useEffect(() => {
57const savedApiKey = localStorage.getItem("anthropic_api_key");
58const savedMcpServers = localStorage.getItem("mcp_servers");
59const savedMessages = localStorage.getItem("chat_messages");
64let mcpServers = savedMcpServers ? JSON.parse(savedMcpServers) : DEFAULT_MCP_SERVERS;
65setConfig({
66anthropicApiKey: savedApiKey || "",
67mcpServers: mcpServers,
68selectedModel: savedModel || "claude-3-5-sonnet-20241022",
81}
8283// Show settings if no API key is configured
84if (!savedApiKey) {
85setShowSettings(true);
86}
89// Save config to localStorage when it changes
90useEffect(() => {
91if (config.anthropicApiKey) {
92localStorage.setItem("anthropic_api_key", config.anthropicApiKey);
93}
94localStorage.setItem("mcp_servers", config.mcpServers?.length ? JSON.stringify(config.mcpServers) : "");
ChatHTMLRenderer.tsx23 matches
9}
1011interface MCPContextAPI {
12// Tool operations
13listTools: () => Promise<any[]>;
37* - Renders HTML in a secure iframe
38* - Provides fullscreen enter/exit affordances
39* - Exposes MCP context API to iframe content
40* - Handles iframe communication via postMessage
41*/
47console.log("[MCP/Browser Renderer] HTMLRenderer: Rendering HTML:", { mcpClients });
4849// Create MCP context API that will be exposed to iframe
50const createMCPContext = useCallback((): MCPContextAPI => {
51const findClientByName = (serverName: string) => {
52console.log("[MCP/Browser Renderer] Finding client by name:", serverName, mcpClients);
177const { type, id, method, args } = event.data;
178179if (type !== "mcp-api-call") {
180return;
181}
186187if (typeof methodFunc !== "function") {
188throw new Error(`Unknown MCP API method: ${method}`);
189}
190192193iframe.contentWindow?.postMessage({
194type: "mcp-api-response",
195id,
196success: true,
199} catch (error) {
200iframe.contentWindow?.postMessage({
201type: "mcp-api-response",
202id,
203success: false,
222</script>
223<script>
224// MCP Context API for iframe content
225window.mcpContext = {
226// Async wrapper for postMessage communication
227async callAPI(method, ...args) {
228return new Promise((resolve, reject) => {
229const id = Math.random().toString(36).substr(2, 9);
230
231const handleResponse = (event) => {
232if (event.data.type === 'mcp-api-response' && event.data.id === id) {
233window.removeEventListener('message', handleResponse);
234if (event.data.success) {
243
244window.parent.postMessage({
245type: 'mcp-api-call',
246id,
247method,
252setTimeout(() => {
253window.removeEventListener('message', handleResponse);
254reject(new Error('MCP API call timeout'));
255}, 30000);
256});
258
259// Convenience methods
260async listTools() { return this.callAPI('listTools'); },
261async callTool(serverName, toolName, args) { return this.callAPI('callTool', serverName, toolName, args); },
262async listPrompts() { return this.callAPI('listPrompts'); },
263async getPrompt(serverName, promptName, args) { return this.callAPI('getPrompt', serverName, promptName, args); },
264async listResources() { return this.callAPI('listResources'); },
265async readResource(serverName, uri) { return this.callAPI('readResource', serverName, uri); },
266log(level, message, data) { this.callAPI('log', level, message, data); },
267requestFullscreen() { this.callAPI('requestFullscreen'); },
268exitFullscreen() { this.callAPI('exitFullscreen'); },
269async isFullscreen() { return this.callAPI('isFullscreen'); }
270};
271
stravachatsendDailyBrief.ts8 matches
9798export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99// Get API keys from environment
100const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
101const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
102106}
107108if (!apiKey) {
109console.error("Anthropic API key is not configured.");
110return;
111}
122123// Initialize Anthropic client
124const anthropic = new Anthropic({ apiKey });
125126// Initialize Telegram bot
162163// disabled title for now, it seemes unnecessary...
164// await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
165166// Then send the main content
169170if (content.length <= MAX_LENGTH) {
171await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
172// Store the briefing in chat history
173await storeChatMessage(
198// Send each chunk as a separate message and store in chat history
199for (const chunk of chunks) {
200await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
201// Store each chunk in chat history
202await storeChatMessage(