This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This interface describes an MCPAgent that extends the Agent class to function | |
* as both an MCP client and an MCP server. It can consume and produce MCP | |
* requests/notifications in adherence to the MCP specification. | |
* | |
* By handling both Client and Server message forms, this interface enables | |
* both connecting to MCP clients, and receiving connections from other MCP servers. | |
* Methods with a `handle...` prefix receive incoming requests/notifications, while methods with | |
* a `send...` prefix dispatch messages to a peer. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:workers'; | |
import { createWorkersAi } from 'workers-ai-provider'; | |
import { generateObject } from 'ai'; | |
import z from 'zod'; | |
type Env = { | |
AI: Ai; | |
MY_WORKFLOW: Workflow; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
type ComponentType, | |
type LazyExoticComponent, | |
type ReactElement, | |
Suspense, | |
} from "react"; | |
interface ComponentRoute { | |
component: LazyExoticComponent<ComponentType<any>>; | |
parent?: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { expect, test } from "bun:test"; | |
import { generateMachine } from "./fsm"; | |
test("happy path: simple transitions", async () => { | |
const config = { | |
init: "idle", | |
transitions: [ | |
{ action: "start", from: "idle", to: "running" }, | |
{ action: "finish", from: "running", to: "completed" }, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AbstractLevelDOWN } from "abstract-leveldown"; | |
import type { AsyncMap } from "../../../../packages/async-map/src/types.ts"; | |
type Callback<T = void> = (error?: Error | null, result?: T) => void; | |
/** | |
* A utility for enabling hook up between various "AsyncMap" storage mechanisms to PouchDB via the Level adapter | |
*/ | |
export class AsyncMapLevel extends AbstractLevelDOWN<string, string> { | |
#storage: AsyncMap<string, string>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compatibility_date": "2024-01-01", | |
"compatbility_flags": [ | |
"nodejs_compat" | |
], | |
"global": { | |
"TEST_AVATARS_CACHE": { | |
"type": "kv", | |
}, | |
"GAMES": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return { | |
"stevearc/conform.nvim", | |
event = { "BufReadPre", "BufNewFile", "BufEnter" }, | |
config = function() | |
local conform = require("conform") | |
-- Global variable to store the current formatter | |
vim.g.current_formatter = "None" | |
local formatters_by_ft = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WorkerRegistry.ts | |
import { spawn, ChildProcess } from 'child_process'; | |
import axios from 'axios'; | |
import { v4 as uuidv4 } from 'uuid'; | |
export class WorkerRegistry { | |
private serverProcess: ChildProcess | null = null; | |
private serverUrl: string = 'http://localhost:3000'; | |
private heartbeatInterval: NodeJS.Timeout | null = null; | |
private instanceId: string = uuidv4(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This Fetch API interface represents the response to a request. | |
* | |
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) | |
*/ | |
declare var Response: { | |
prototype: Response; | |
new (body?: BodyInit | null, init?: ResponseInit): Response; | |
redirect(url: string, status?: number): Response; | |
json(any: any, maybeInit?: ResponseInit | Response): Response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /packages/wrangler/versions/versions.test.ts | |
import { versions } from './versions'; | |
it("should output things", async () => { | |
const { completed, dir, logs, mock, seed, stop } = versions({ | |
fixture: "./tests/fixtures/", | |
env: { | |
/* extra environment variables */ | |
}, |
NewerOlder