MCPcopy Create free account
hub / github.com/electric-sql/electric / createMockAgentBootstrap

Function createMockAgentBootstrap

packages/agents-server/src/server.ts:107–139  ·  view source on GitHub ↗
(options: {
  agentServerUrl: string
  workingDirectory?: string
  streamFn: StreamFn
})

Source from the content-addressed store, hash-verified

105}
106
107function createMockAgentBootstrap(options: {
108 agentServerUrl: string
109 workingDirectory?: string
110 streamFn: StreamFn
111}): MockAgentBootstrap {
112 const registry = createEntityRegistry()
113
114 registry.define(`chat`, {
115 description: `Mock chat entity for conformance and end-to-end tests.`,
116 handler: async (ctx) => {
117 ctx.useAgent({
118 systemPrompt: `You are a concise test assistant.`,
119 model: MOCK_CHAT_MODEL,
120 tools: [],
121 streamFn: options.streamFn,
122 })
123 await ctx.agent.run()
124 },
125 })
126
127 const runtime = createRuntimeHandler({
128 baseUrl: options.agentServerUrl,
129 serveEndpoint: appendPathToUrl(
130 options.agentServerUrl,
131 MOCK_AGENT_HANDLER_PATH
132 ),
133 registry,
134 subscriptionPathForType: (name) => `/${name}/*/main`,
135 idleTimeout: 100,
136 })
137
138 return { runtime, registry }
139}
140
141function durableStreamTestServerBackendUrl(origin: string): string {
142 // DurableStreamTestServer.start() returns the HTTP origin, while the

Callers 1

startMethod · 0.85

Calls 5

createEntityRegistryFunction · 0.90
createRuntimeHandlerFunction · 0.90
appendPathToUrlFunction · 0.90
defineMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected