This commit is contained in:
Siddharth Ganesan
2026-02-09 11:24:23 -08:00
parent ed613c3a4f
commit 4698f731a9
12 changed files with 22 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpAuthorizationServerMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpAuthorizationServerMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpAuthorizationServerMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpProtectedResourceMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpProtectedResourceMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpAuthorizationServerMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,4 +1,4 @@
import { type NextRequest, NextResponse } from 'next/server'
import type { NextRequest, NextResponse } from 'next/server'
import { createMcpProtectedResourceMetadataResponse } from '@/lib/mcp/oauth-discovery'
export async function GET(request: NextRequest): Promise<NextResponse> {

View File

@@ -1,3 +1,4 @@
import { randomUUID } from 'node:crypto'
import { Server } from '@modelcontextprotocol/sdk/server/index.js'
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'
import {
@@ -5,15 +6,14 @@ import {
type CallToolResult,
ErrorCode,
type JSONRPCError,
type ListToolsResult,
ListToolsRequestSchema,
type ListToolsResult,
McpError,
type RequestId,
} from '@modelcontextprotocol/sdk/types.js'
import { db } from '@sim/db'
import { userStats } from '@sim/db/schema'
import { createLogger } from '@sim/logger'
import { randomUUID } from 'node:crypto'
import { eq, sql } from 'drizzle-orm'
import { type NextRequest, NextResponse } from 'next/server'
import { getHighestPrioritySubscription } from '@/lib/billing/core/subscription'
@@ -23,8 +23,6 @@ import {
SIM_AGENT_API_URL,
SIM_AGENT_VERSION,
} from '@/lib/copilot/constants'
import { RateLimiter } from '@/lib/core/rate-limiter'
import { env } from '@/lib/core/config/env'
import { orchestrateCopilotStream } from '@/lib/copilot/orchestrator'
import { orchestrateSubagentStream } from '@/lib/copilot/orchestrator/subagent'
import {
@@ -32,6 +30,8 @@ import {
prepareExecutionContext,
} from '@/lib/copilot/orchestrator/tool-executor'
import { DIRECT_TOOL_DEFS, SUBAGENT_TOOL_DEFS } from '@/lib/copilot/tools/mcp/definitions'
import { env } from '@/lib/core/config/env'
import { RateLimiter } from '@/lib/core/rate-limiter'
import { resolveWorkflowIdForUser } from '@/lib/workflows/utils'
const logger = createLogger('CopilotMcpAPI')
@@ -103,7 +103,8 @@ async function authenticateCopilotApiKey(apiKey: string): Promise<CopilotKeyAuth
logger.error('Copilot API key validation failed', { error })
return {
success: false,
error: 'Could not validate Copilot API key — the authentication service is temporarily unreachable. This is NOT a problem with the API key itself; please retry shortly.',
error:
'Could not validate Copilot API key — the authentication service is temporarily unreachable. This is NOT a problem with the API key itself; please retry shortly.',
}
}
}
@@ -444,7 +445,9 @@ function buildMcpServer(abortSignal?: AbortSignal): Server {
}
}
const params = request.params as { name?: string; arguments?: Record<string, unknown> } | undefined
const params = request.params as
| { name?: string; arguments?: Record<string, unknown> }
| undefined
if (!params?.name) {
throw new McpError(ErrorCode.InvalidParams, 'Tool name required')
}

View File

@@ -265,8 +265,7 @@ export async function markToolComplete(
clearTimeout(timeoutId)
}
} catch (error) {
const isTimeout =
error instanceof DOMException && error.name === 'AbortError'
const isTimeout = error instanceof DOMException && error.name === 'AbortError'
logger.error('Mark-complete call failed', {
toolCallId,
toolName,

View File

@@ -150,12 +150,7 @@ export function abortAllInProgressTools(set: StoreSet, get: () => CopilotStore)
toolCall: {
...prev,
state: resolved,
display: resolveToolDisplay(
prev?.name,
resolved,
prev?.id,
prev?.params
),
display: resolveToolDisplay(prev?.name, resolved, prev?.id, prev?.params),
},
}
}

View File

@@ -481,8 +481,7 @@ After sim_edit completes, you can test immediately with sim_test, or deploy with
},
plan: {
type: 'object',
description:
'The plan object from sim_plan. Pass it EXACTLY as returned, do not modify.',
description: 'The plan object from sim_plan. Pass it EXACTLY as returned, do not modify.',
},
context: {
type: 'object',

View File

@@ -1,7 +1,7 @@
/**
* Environment utility functions for consistent environment detection across the application
*/
import { env, getEnv, isFalsy, isTruthy } from './env'
import { env, isFalsy, isTruthy } from './env'
/**
* Is the application running in production mode
@@ -22,8 +22,8 @@ export const isTest = env.NODE_ENV === 'test'
* Is this the hosted version of the application
*/
export const isHosted = true
// getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
// getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
// getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
// getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
/**
* Is billing enforcement enabled