@tracecode/harness 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -0
- package/LICENSE +674 -0
- package/README.md +266 -0
- package/dist/browser.cjs +1352 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +49 -0
- package/dist/browser.d.ts +49 -0
- package/dist/browser.js +1317 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.cjs +70 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +70 -0
- package/dist/cli.js.map +1 -0
- package/dist/core.cjs +286 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +69 -0
- package/dist/core.d.ts +69 -0
- package/dist/core.js +254 -0
- package/dist/core.js.map +1 -0
- package/dist/index.cjs +2603 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2538 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/browser.cjs +647 -0
- package/dist/internal/browser.cjs.map +1 -0
- package/dist/internal/browser.d.cts +143 -0
- package/dist/internal/browser.d.ts +143 -0
- package/dist/internal/browser.js +617 -0
- package/dist/internal/browser.js.map +1 -0
- package/dist/javascript.cjs +549 -0
- package/dist/javascript.cjs.map +1 -0
- package/dist/javascript.d.cts +11 -0
- package/dist/javascript.d.ts +11 -0
- package/dist/javascript.js +518 -0
- package/dist/javascript.js.map +1 -0
- package/dist/python.cjs +744 -0
- package/dist/python.cjs.map +1 -0
- package/dist/python.d.cts +97 -0
- package/dist/python.d.ts +97 -0
- package/dist/python.js +698 -0
- package/dist/python.js.map +1 -0
- package/dist/runtime-types-C7d1LFbx.d.ts +85 -0
- package/dist/runtime-types-Dvgn07z9.d.cts +85 -0
- package/dist/types-Bzr1Ohcf.d.cts +96 -0
- package/dist/types-Bzr1Ohcf.d.ts +96 -0
- package/package.json +89 -0
- package/workers/javascript/javascript-worker.js +2918 -0
- package/workers/python/generated-python-harness-snippets.js +20 -0
- package/workers/python/pyodide-worker.js +1197 -0
- package/workers/python/runtime-core.js +1529 -0
- package/workers/vendor/typescript.js +200276 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../packages/harness-browser/src/internal.ts","../../packages/harness-browser/src/pyodide-worker-client.ts","../../packages/harness-browser/src/javascript-worker-client.ts"],"sourcesContent":["export * from './pyodide-worker-client';\nexport * from './javascript-worker-client';\n","/**\n * Pyodide Worker Client\n * \n * TypeScript client for communicating with the Pyodide Web Worker.\n * Provides a promise-based API for executing Python code off the main thread.\n */\n\nimport type { CodeExecutionResult, ExecutionResult } from '../../harness-core/src/types';\n\ntype MessageId = string;\nexport type ExecutionStyle = 'function' | 'solution-method' | 'ops-class';\n\nexport interface PyodideWorkerClientOptions {\n workerUrl: string;\n debug?: boolean;\n}\n\ninterface PendingMessage {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n timeoutId?: ReturnType<typeof globalThis.setTimeout>;\n}\n\ninterface WorkerMessage {\n id?: MessageId;\n type: string;\n payload?: unknown;\n}\n\ninterface InitResult {\n success: boolean;\n loadTimeMs: number;\n}\n\ninterface StatusResult {\n isReady: boolean;\n isLoading: boolean;\n}\n\n// Execution timeout in milliseconds for simple code execution (10 seconds)\nconst EXECUTION_TIMEOUT_MS = 10000;\n\n// Interview mode timeout - shorter, no detailed error info (5 seconds)\nconst INTERVIEW_MODE_TIMEOUT_MS = 5000;\n\n// Tracing timeout - longer because Python heuristic detection handles infinite loops\n// This is just a safety net for truly stuck executions\nconst TRACING_TIMEOUT_MS = 30000;\n\n// Initial Pyodide load timeout can be significantly higher on first boot/network-constrained setups\nconst INIT_TIMEOUT_MS = 120000;\n\n// Message timeout for non-execution operations (20 seconds)\nconst MESSAGE_TIMEOUT_MS = 20000;\n// Worker bootstrap timeout - prevents deadlock when worker never emits \"worker-ready\"\nconst WORKER_READY_TIMEOUT_MS = 10000;\n\nexport class PyodideWorkerClient {\n private worker: Worker | null = null;\n private pendingMessages = new Map<MessageId, PendingMessage>();\n private messageId = 0;\n private isInitializing = false;\n private initPromise: Promise<InitResult> | null = null;\n private workerReadyPromise: Promise<void> | null = null;\n private workerReadyResolve: (() => void) | null = null;\n private workerReadyReject: ((error: Error) => void) | null = null;\n private readonly debug: boolean;\n\n constructor(private readonly options: PyodideWorkerClientOptions) {\n this.debug = options.debug ?? process.env.NODE_ENV === 'development';\n }\n\n /**\n * Check if Web Workers are supported\n */\n isSupported(): boolean {\n return typeof Worker !== 'undefined';\n }\n\n /**\n * Get or create the worker instance\n */\n private getWorker(): Worker {\n if (this.worker) return this.worker;\n\n if (!this.isSupported()) {\n throw new Error('Web Workers are not supported in this environment');\n }\n\n // Create promise that resolves when worker signals it's ready\n this.workerReadyPromise = new Promise((resolve, reject) => {\n this.workerReadyResolve = resolve;\n this.workerReadyReject = (error: Error) => reject(error);\n });\n\n const workerUrl =\n this.debug && !this.options.workerUrl.includes('?')\n ? `${this.options.workerUrl}?dev=${Date.now()}`\n : this.options.workerUrl;\n this.worker = new Worker(workerUrl);\n \n this.worker.onmessage = (event: MessageEvent<WorkerMessage>) => {\n const { id, type, payload } = event.data;\n\n // Handle worker-ready signal\n if (type === 'worker-ready') {\n this.workerReadyResolve?.();\n this.workerReadyResolve = null;\n this.workerReadyReject = null;\n if (this.debug) console.log('[PyodideWorkerClient] worker-ready');\n return;\n }\n\n if (this.debug && !id) {\n console.log('[PyodideWorkerClient] event', { type, payload });\n }\n\n // Handle responses to our messages\n if (id) {\n const pending = this.pendingMessages.get(id);\n if (pending) {\n this.pendingMessages.delete(id);\n if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);\n \n if (type === 'error') {\n pending.reject(new Error((payload as { error: string }).error));\n } else {\n if (this.debug) console.log('[PyodideWorkerClient] recv', { id, type });\n pending.resolve(payload);\n }\n }\n }\n };\n\n this.worker.onerror = (error) => {\n console.error('[PyodideWorkerClient] Worker error:', error);\n const workerError = new Error('Worker error');\n this.workerReadyReject?.(workerError);\n this.workerReadyResolve = null;\n this.workerReadyReject = null;\n // Reject all pending messages and clear their timeouts\n for (const [id, pending] of this.pendingMessages) {\n if (pending.timeoutId) {\n globalThis.clearTimeout(pending.timeoutId);\n }\n pending.reject(workerError);\n this.pendingMessages.delete(id);\n }\n };\n\n return this.worker;\n }\n\n /**\n * Wait for worker bootstrap signal with timeout.\n * Guards against deadlocks when the worker script fails before posting \"worker-ready\".\n */\n private async waitForWorkerReady(): Promise<void> {\n const readyPromise = this.workerReadyPromise;\n if (!readyPromise) return;\n\n await new Promise<void>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = globalThis.setTimeout(() => {\n if (settled) return;\n settled = true;\n const timeoutError = new Error(\n `Python worker failed to initialize in time (${Math.round(WORKER_READY_TIMEOUT_MS / 1000)}s)`\n );\n if (this.debug) {\n console.warn('[PyodideWorkerClient] worker-ready timeout', { timeoutMs: WORKER_READY_TIMEOUT_MS });\n }\n this.terminateAndReset(timeoutError);\n reject(timeoutError);\n }, WORKER_READY_TIMEOUT_MS);\n\n readyPromise\n .then(() => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n resolve();\n })\n .catch((error) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n reject(error instanceof Error ? error : new Error(String(error)));\n });\n });\n }\n\n /**\n * Send a message to the worker and wait for a response\n */\n private async sendMessage<T>(type: string, payload?: unknown, timeoutMs: number = MESSAGE_TIMEOUT_MS): Promise<T> {\n const worker = this.getWorker();\n \n // Wait for worker to be ready before sending messages\n await this.waitForWorkerReady();\n \n const id = String(++this.messageId);\n\n return new Promise<T>((resolve, reject) => {\n this.pendingMessages.set(id, {\n resolve: resolve as (value: unknown) => void,\n reject,\n });\n\n if (this.debug) console.log('[PyodideWorkerClient] send', { id, type });\n\n const timeoutId = globalThis.setTimeout(() => {\n const pending = this.pendingMessages.get(id);\n if (!pending) return;\n this.pendingMessages.delete(id);\n if (this.debug) console.warn('[PyodideWorkerClient] timeout', { id, type });\n pending.reject(new Error(`Worker request timed out: ${type}`));\n }, timeoutMs);\n\n const pending = this.pendingMessages.get(id);\n if (pending) pending.timeoutId = timeoutId;\n\n worker.postMessage({ id, type, payload });\n });\n }\n\n /**\n * Execute code with a timeout - terminates worker if execution takes too long\n */\n private async executeWithTimeout<T>(\n executor: () => Promise<T>,\n timeoutMs: number = EXECUTION_TIMEOUT_MS\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n let settled = false;\n \n const timeoutId = globalThis.setTimeout(() => {\n if (settled) return;\n settled = true;\n \n // Terminate the stuck worker and clear state\n if (this.debug) {\n console.warn('[PyodideWorkerClient] Execution timeout - terminating worker');\n }\n this.terminateAndReset();\n \n const seconds = Math.round(timeoutMs / 1000);\n reject(new Error(`Execution timed out (possible infinite loop). Code execution was stopped after ${seconds} seconds.`));\n }, timeoutMs);\n \n executor()\n .then((result) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n resolve(result);\n })\n .catch((error) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n reject(error);\n });\n });\n }\n\n /**\n * Terminate the worker and reset state for recreation\n */\n private terminateAndReset(reason: Error = new Error('Worker was terminated')): void {\n this.workerReadyReject?.(reason);\n if (this.worker) {\n this.worker.terminate();\n this.worker = null;\n }\n this.initPromise = null;\n this.isInitializing = false;\n this.workerReadyPromise = null;\n this.workerReadyResolve = null;\n \n // Reject all pending messages\n for (const [, pending] of this.pendingMessages) {\n if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);\n pending.reject(reason);\n }\n this.pendingMessages.clear();\n }\n\n /**\n * Initialize Pyodide in the worker\n */\n async init(): Promise<InitResult> {\n // Return existing promise if already initializing\n if (this.initPromise) {\n return this.initPromise;\n }\n\n if (this.isInitializing) {\n // Wait for existing init to complete\n await new Promise((resolve) => setTimeout(resolve, 100));\n return this.init();\n }\n\n this.isInitializing = true;\n\n this.initPromise = (async () => {\n try {\n return await this.sendMessage<InitResult>('init', undefined, INIT_TIMEOUT_MS);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n const shouldRetry =\n message.includes('Worker request timed out: init') ||\n message.includes('Worker was terminated') ||\n message.includes('Worker error') ||\n message.includes('failed to initialize in time');\n\n if (!shouldRetry) {\n throw error;\n }\n\n if (this.debug) {\n console.warn('[PyodideWorkerClient] init failed, resetting worker and retrying once', { message });\n }\n\n this.terminateAndReset();\n return this.sendMessage<InitResult>('init', undefined, INIT_TIMEOUT_MS);\n }\n })();\n \n try {\n const result = await this.initPromise;\n return result;\n } catch (error) {\n this.initPromise = null;\n throw error;\n } finally {\n this.isInitializing = false;\n }\n }\n\n /**\n * Execute Python code with tracing for step-by-step visualization\n * @param options.maxLineEvents - Max line events before abort (for complexity analysis, use higher values)\n */\n async executeWithTracing(\n code: string,\n functionName: string | null,\n inputs: Record<string, unknown>,\n options?: {\n maxTraceSteps?: number;\n maxLineEvents?: number;\n maxSingleLineHits?: number;\n minimalTrace?: boolean;\n },\n executionStyle: ExecutionStyle = 'function'\n ): Promise<ExecutionResult> {\n // Ensure Pyodide is initialized\n await this.init();\n \n // Use longer timeout for tracing - Python heuristic detection handles infinite loops\n try {\n return await this.executeWithTimeout(\n () => this.sendMessage<ExecutionResult>('execute-with-tracing', {\n code,\n functionName,\n inputs,\n executionStyle,\n options,\n }, TRACING_TIMEOUT_MS + 5000), // Message timeout slightly longer than execution timeout\n TRACING_TIMEOUT_MS\n );\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n const isClientTimeout =\n errorMessage.includes('Execution timed out') ||\n errorMessage.includes('possible infinite loop');\n\n if (isClientTimeout) {\n return {\n success: false,\n error: errorMessage,\n trace: [],\n executionTimeMs: TRACING_TIMEOUT_MS,\n consoleOutput: [],\n traceLimitExceeded: true,\n timeoutReason: 'client-timeout',\n lineEventCount: 0,\n traceStepCount: 0,\n };\n }\n\n throw error;\n }\n }\n\n /**\n * Execute Python code without tracing (for running tests)\n */\n async executeCode(\n code: string,\n functionName: string,\n inputs: Record<string, unknown>,\n executionStyle: ExecutionStyle = 'function'\n ): Promise<CodeExecutionResult> {\n // Ensure Pyodide is initialized\n await this.init();\n \n return this.executeWithTimeout(\n () => this.sendMessage<CodeExecutionResult>('execute-code', {\n code,\n functionName,\n inputs,\n executionStyle,\n }, EXECUTION_TIMEOUT_MS + 5000),\n EXECUTION_TIMEOUT_MS\n );\n }\n\n /**\n * Execute Python code in interview mode - 5 second timeout, generic error messages\n * Does not reveal which line caused the timeout\n */\n async executeCodeInterviewMode(\n code: string,\n functionName: string,\n inputs: Record<string, unknown>,\n executionStyle: ExecutionStyle = 'function'\n ): Promise<CodeExecutionResult> {\n // Ensure Pyodide is initialized\n await this.init();\n \n try {\n const result = await this.executeWithTimeout(\n () => this.sendMessage<CodeExecutionResult>('execute-code-interview', {\n code,\n functionName,\n inputs,\n executionStyle,\n }, INTERVIEW_MODE_TIMEOUT_MS + 2000),\n INTERVIEW_MODE_TIMEOUT_MS\n );\n \n // Sanitize error messages in interview mode - don't reveal line numbers for timeouts\n if (!result.success && result.error) {\n // Keep basic error types but remove line-specific info for timeouts\n const normalizedError = result.error.toLowerCase();\n const isTimeoutOrResourceLimit =\n normalizedError.includes('timed out') ||\n normalizedError.includes('execution timeout') ||\n normalizedError.includes('infinite loop') ||\n normalizedError.includes('interview_guard_triggered') ||\n normalizedError.includes('memory-limit') ||\n normalizedError.includes('line-limit') ||\n normalizedError.includes('single-line-limit') ||\n normalizedError.includes('recursion-limit');\n\n if (isTimeoutOrResourceLimit) {\n return {\n success: false,\n output: null,\n error: 'Time Limit Exceeded',\n consoleOutput: result.consoleOutput ?? [],\n };\n }\n }\n \n return result;\n } catch (error) {\n // Handle timeout from executeWithTimeout\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg.includes('timed out') || errorMsg.includes('Execution timeout')) {\n return {\n success: false,\n output: null,\n error: 'Time Limit Exceeded',\n consoleOutput: [],\n };\n }\n return {\n success: false,\n output: null,\n error: errorMsg,\n consoleOutput: [],\n };\n }\n }\n\n /**\n * Check the status of the worker\n */\n async getStatus(): Promise<StatusResult> {\n return this.sendMessage<StatusResult>('status');\n }\n\n /**\n * Analyze Python code using AST (off main thread)\n * Returns CodeFacts with semantic information about the code\n */\n async analyzeCode(code: string): Promise<unknown> {\n // Ensure Pyodide is initialized\n await this.init();\n \n // Use a shorter timeout for analysis (5 seconds should be plenty)\n return this.sendMessage<unknown>('analyze-code', { code }, 5000);\n }\n\n /**\n * Terminate the worker and clean up resources\n */\n terminate(): void {\n this.terminateAndReset();\n }\n}\n\n/**\n * Check if the worker client is supported\n */\nexport function isWorkerSupported(): boolean {\n return typeof Worker !== 'undefined';\n}\n","import type { CodeExecutionResult, ExecutionResult } from '../../harness-core/src/types';\n\ntype MessageId = string;\nexport type JavaScriptExecutionStyle = 'function' | 'solution-method' | 'ops-class';\nexport type JavaScriptWorkerLanguage = 'javascript' | 'typescript';\n\nexport interface JavaScriptWorkerClientOptions {\n workerUrl: string;\n debug?: boolean;\n}\n\ninterface PendingMessage {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n timeoutId?: ReturnType<typeof setTimeout>;\n}\n\ninterface WorkerMessage {\n id?: MessageId;\n type: string;\n payload?: unknown;\n}\n\ninterface InitResult {\n success: boolean;\n loadTimeMs: number;\n}\n\nconst EXECUTION_TIMEOUT_MS = 7000;\nconst INTERVIEW_MODE_TIMEOUT_MS = 5000;\nconst TRACING_TIMEOUT_MS = 7000;\nconst INIT_TIMEOUT_MS = 10000;\nconst MESSAGE_TIMEOUT_MS = 12000;\nconst WORKER_READY_TIMEOUT_MS = 10000;\n\nexport class JavaScriptWorkerClient {\n private worker: Worker | null = null;\n private pendingMessages = new Map<MessageId, PendingMessage>();\n private messageId = 0;\n private isInitializing = false;\n private initPromise: Promise<InitResult> | null = null;\n private workerReadyPromise: Promise<void> | null = null;\n private workerReadyResolve: (() => void) | null = null;\n private workerReadyReject: ((error: Error) => void) | null = null;\n private readonly debug: boolean;\n\n constructor(private readonly options: JavaScriptWorkerClientOptions) {\n this.debug = options.debug ?? process.env.NODE_ENV === 'development';\n }\n\n isSupported(): boolean {\n return typeof Worker !== 'undefined';\n }\n\n private getWorker(): Worker {\n if (this.worker) return this.worker;\n\n if (!this.isSupported()) {\n throw new Error('Web Workers are not supported in this environment');\n }\n\n this.workerReadyPromise = new Promise((resolve, reject) => {\n this.workerReadyResolve = resolve;\n this.workerReadyReject = (error: Error) => reject(error);\n });\n\n const workerUrl =\n this.debug && !this.options.workerUrl.includes('?')\n ? `${this.options.workerUrl}?dev=${Date.now()}`\n : this.options.workerUrl;\n this.worker = new Worker(workerUrl);\n\n this.worker.onmessage = (event: MessageEvent<WorkerMessage>) => {\n const { id, type, payload } = event.data;\n\n if (type === 'worker-ready') {\n this.workerReadyResolve?.();\n this.workerReadyResolve = null;\n this.workerReadyReject = null;\n if (this.debug) console.log('[JavaScriptWorkerClient] worker-ready');\n return;\n }\n\n if (id) {\n const pending = this.pendingMessages.get(id);\n if (!pending) return;\n\n this.pendingMessages.delete(id);\n if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);\n\n if (type === 'error') {\n pending.reject(new Error((payload as { error: string }).error));\n return;\n }\n\n pending.resolve(payload);\n }\n };\n\n this.worker.onerror = (error) => {\n console.error('[JavaScriptWorkerClient] Worker error:', error);\n const workerError = new Error('Worker error');\n this.workerReadyReject?.(workerError);\n this.workerReadyResolve = null;\n this.workerReadyReject = null;\n\n for (const [id, pending] of this.pendingMessages) {\n if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);\n pending.reject(workerError);\n this.pendingMessages.delete(id);\n }\n };\n\n return this.worker;\n }\n\n private async waitForWorkerReady(): Promise<void> {\n const readyPromise = this.workerReadyPromise;\n if (!readyPromise) return;\n\n await new Promise<void>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = globalThis.setTimeout(() => {\n if (settled) return;\n settled = true;\n const timeoutError = new Error(\n `JavaScript worker failed to initialize in time (${Math.round(WORKER_READY_TIMEOUT_MS / 1000)}s)`\n );\n this.terminateAndReset(timeoutError);\n reject(timeoutError);\n }, WORKER_READY_TIMEOUT_MS);\n\n readyPromise\n .then(() => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n resolve();\n })\n .catch((error) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n reject(error instanceof Error ? error : new Error(String(error)));\n });\n });\n }\n\n private async sendMessage<T>(\n type: string,\n payload?: unknown,\n timeoutMs: number = MESSAGE_TIMEOUT_MS\n ): Promise<T> {\n const worker = this.getWorker();\n await this.waitForWorkerReady();\n const id = String(++this.messageId);\n\n return new Promise<T>((resolve, reject) => {\n this.pendingMessages.set(id, {\n resolve: resolve as (value: unknown) => void,\n reject,\n });\n\n const timeoutId = globalThis.setTimeout(() => {\n const pending = this.pendingMessages.get(id);\n if (!pending) return;\n this.pendingMessages.delete(id);\n pending.reject(new Error(`Worker request timed out: ${type}`));\n }, timeoutMs);\n\n const pending = this.pendingMessages.get(id);\n if (pending) pending.timeoutId = timeoutId;\n\n worker.postMessage({ id, type, payload });\n });\n }\n\n private async executeWithTimeout<T>(executor: () => Promise<T>, timeoutMs: number): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = globalThis.setTimeout(() => {\n if (settled) return;\n settled = true;\n this.terminateAndReset();\n reject(\n new Error(\n `Execution timed out (possible infinite loop). Code execution was stopped after ${Math.round(timeoutMs / 1000)} seconds.`\n )\n );\n }, timeoutMs);\n\n executor()\n .then((result) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n resolve(result);\n })\n .catch((error) => {\n if (settled) return;\n settled = true;\n globalThis.clearTimeout(timeoutId);\n reject(error);\n });\n });\n }\n\n private terminateAndReset(reason: Error = new Error('Worker was terminated')): void {\n this.workerReadyReject?.(reason);\n if (this.worker) {\n this.worker.terminate();\n this.worker = null;\n }\n this.initPromise = null;\n this.isInitializing = false;\n this.workerReadyPromise = null;\n this.workerReadyResolve = null;\n this.workerReadyReject = null;\n\n for (const [, pending] of this.pendingMessages) {\n if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);\n pending.reject(reason);\n }\n this.pendingMessages.clear();\n }\n\n async init(): Promise<InitResult> {\n if (this.initPromise) return this.initPromise;\n\n if (this.isInitializing) {\n await new Promise((resolve) => globalThis.setTimeout(resolve, 100));\n return this.init();\n }\n\n this.isInitializing = true;\n this.initPromise = this.sendMessage<InitResult>('init', undefined, INIT_TIMEOUT_MS);\n\n try {\n return await this.initPromise;\n } catch (error) {\n this.initPromise = null;\n throw error;\n } finally {\n this.isInitializing = false;\n }\n }\n\n async executeWithTracing(\n code: string,\n functionName: string | null,\n inputs: Record<string, unknown>,\n options?: {\n maxTraceSteps?: number;\n maxLineEvents?: number;\n maxSingleLineHits?: number;\n minimalTrace?: boolean;\n },\n executionStyle: JavaScriptExecutionStyle = 'function',\n language: JavaScriptWorkerLanguage = 'javascript'\n ): Promise<ExecutionResult> {\n await this.init();\n return this.executeWithTimeout(\n () =>\n this.sendMessage<ExecutionResult>(\n 'execute-with-tracing',\n {\n code,\n functionName,\n inputs,\n options,\n executionStyle,\n language,\n },\n TRACING_TIMEOUT_MS + 2000\n ),\n TRACING_TIMEOUT_MS\n );\n }\n\n async executeCode(\n code: string,\n functionName: string,\n inputs: Record<string, unknown>,\n executionStyle: JavaScriptExecutionStyle = 'function',\n language: JavaScriptWorkerLanguage = 'javascript'\n ): Promise<CodeExecutionResult> {\n await this.init();\n return this.executeWithTimeout(\n () =>\n this.sendMessage<CodeExecutionResult>(\n 'execute-code',\n {\n code,\n functionName,\n inputs,\n executionStyle,\n language,\n },\n EXECUTION_TIMEOUT_MS + 2000\n ),\n EXECUTION_TIMEOUT_MS\n );\n }\n\n async executeCodeInterviewMode(\n code: string,\n functionName: string,\n inputs: Record<string, unknown>,\n executionStyle: JavaScriptExecutionStyle = 'function',\n language: JavaScriptWorkerLanguage = 'javascript'\n ): Promise<CodeExecutionResult> {\n await this.init();\n\n try {\n const result = await this.executeWithTimeout(\n () =>\n this.sendMessage<CodeExecutionResult>(\n 'execute-code-interview',\n {\n code,\n functionName,\n inputs,\n executionStyle,\n language,\n },\n INTERVIEW_MODE_TIMEOUT_MS + 2000\n ),\n INTERVIEW_MODE_TIMEOUT_MS\n );\n\n if (!result.success && result.error) {\n const normalized = result.error.toLowerCase();\n const isTimeoutOrResourceLimit =\n normalized.includes('timed out') ||\n normalized.includes('infinite loop') ||\n normalized.includes('line-limit') ||\n normalized.includes('single-line-limit') ||\n normalized.includes('recursion-limit') ||\n normalized.includes('trace-limit') ||\n normalized.includes('line events') ||\n normalized.includes('trace steps') ||\n normalized.includes('call depth');\n if (isTimeoutOrResourceLimit) {\n return {\n success: false,\n output: null,\n error: 'Time Limit Exceeded',\n consoleOutput: result.consoleOutput ?? [],\n };\n }\n }\n\n return result;\n } catch {\n return {\n success: false,\n output: null,\n error: 'Time Limit Exceeded',\n consoleOutput: [],\n };\n }\n }\n\n terminate(): void {\n this.terminateAndReset();\n }\n}\n\nexport function isJavaScriptWorkerSupported(): boolean {\n return typeof Worker !== 'undefined';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACwCA,IAAM,uBAAuB;AAG7B,IAAM,4BAA4B;AAIlC,IAAM,qBAAqB;AAG3B,IAAM,kBAAkB;AAGxB,IAAM,qBAAqB;AAE3B,IAAM,0BAA0B;AAEzB,IAAM,sBAAN,MAA0B;AAAA,EAW/B,YAA6B,SAAqC;AAArC;AAC3B,SAAK,QAAQ,QAAQ,SAAS,QAAQ,IAAI,aAAa;AAAA,EACzD;AAAA,EAZQ,SAAwB;AAAA,EACxB,kBAAkB,oBAAI,IAA+B;AAAA,EACrD,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,cAA0C;AA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,cAAM,2BACJ,WAAW,SAAS,WAAW,KAC/B,WAAW,SAAS,eAAe,KACnC,WAAW,SAAS,YAAY,KAChC,WAAW,SAAS,mBAAmB,KACvC,WAAW,SAAS,iBAAiB,KACrC,WAAW,SAAS,aAAa,KACjC,WAAW,SAAS,aAAa,KACjC,WAAW,SAAS,aAAa,KACjC,WAAW,SAAS,YAAY;AAClC,YAAI,0BAA0B;AAC5B,iBAAO;AAAA,YACL,SAAS;AAAA,YACT,QAAQ;AAAA,YACR,OAAO;AAAA,YACP,eAAe,OAAO,iBAAiB,CAAC;AAAA,UAC1C;AAAA,QACF;AAAA,MACF;AAEA,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAe,CAAC;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,YAAkB;AAChB,SAAK,kBAAkB;AAAA,EACzB;AACF;AAEO,SAAS,8BAAuC;AACrD,SAAO,OAAO,WAAW;AAC3B;","names":["pending","EXECUTION_TIMEOUT_MS","INTERVIEW_MODE_TIMEOUT_MS","TRACING_TIMEOUT_MS","INIT_TIMEOUT_MS","MESSAGE_TIMEOUT_MS","WORKER_READY_TIMEOUT_MS","pending"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { E as ExecutionResult, a as CodeExecutionResult } from '../types-Bzr1Ohcf.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pyodide Worker Client
|
|
5
|
+
*
|
|
6
|
+
* TypeScript client for communicating with the Pyodide Web Worker.
|
|
7
|
+
* Provides a promise-based API for executing Python code off the main thread.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type ExecutionStyle = 'function' | 'solution-method' | 'ops-class';
|
|
11
|
+
interface PyodideWorkerClientOptions {
|
|
12
|
+
workerUrl: string;
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface InitResult$1 {
|
|
16
|
+
success: boolean;
|
|
17
|
+
loadTimeMs: number;
|
|
18
|
+
}
|
|
19
|
+
interface StatusResult {
|
|
20
|
+
isReady: boolean;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare class PyodideWorkerClient {
|
|
24
|
+
private readonly options;
|
|
25
|
+
private worker;
|
|
26
|
+
private pendingMessages;
|
|
27
|
+
private messageId;
|
|
28
|
+
private isInitializing;
|
|
29
|
+
private initPromise;
|
|
30
|
+
private workerReadyPromise;
|
|
31
|
+
private workerReadyResolve;
|
|
32
|
+
private workerReadyReject;
|
|
33
|
+
private readonly debug;
|
|
34
|
+
constructor(options: PyodideWorkerClientOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Check if Web Workers are supported
|
|
37
|
+
*/
|
|
38
|
+
isSupported(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get or create the worker instance
|
|
41
|
+
*/
|
|
42
|
+
private getWorker;
|
|
43
|
+
/**
|
|
44
|
+
* Wait for worker bootstrap signal with timeout.
|
|
45
|
+
* Guards against deadlocks when the worker script fails before posting "worker-ready".
|
|
46
|
+
*/
|
|
47
|
+
private waitForWorkerReady;
|
|
48
|
+
/**
|
|
49
|
+
* Send a message to the worker and wait for a response
|
|
50
|
+
*/
|
|
51
|
+
private sendMessage;
|
|
52
|
+
/**
|
|
53
|
+
* Execute code with a timeout - terminates worker if execution takes too long
|
|
54
|
+
*/
|
|
55
|
+
private executeWithTimeout;
|
|
56
|
+
/**
|
|
57
|
+
* Terminate the worker and reset state for recreation
|
|
58
|
+
*/
|
|
59
|
+
private terminateAndReset;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize Pyodide in the worker
|
|
62
|
+
*/
|
|
63
|
+
init(): Promise<InitResult$1>;
|
|
64
|
+
/**
|
|
65
|
+
* Execute Python code with tracing for step-by-step visualization
|
|
66
|
+
* @param options.maxLineEvents - Max line events before abort (for complexity analysis, use higher values)
|
|
67
|
+
*/
|
|
68
|
+
executeWithTracing(code: string, functionName: string | null, inputs: Record<string, unknown>, options?: {
|
|
69
|
+
maxTraceSteps?: number;
|
|
70
|
+
maxLineEvents?: number;
|
|
71
|
+
maxSingleLineHits?: number;
|
|
72
|
+
minimalTrace?: boolean;
|
|
73
|
+
}, executionStyle?: ExecutionStyle): Promise<ExecutionResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Execute Python code without tracing (for running tests)
|
|
76
|
+
*/
|
|
77
|
+
executeCode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: ExecutionStyle): Promise<CodeExecutionResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Execute Python code in interview mode - 5 second timeout, generic error messages
|
|
80
|
+
* Does not reveal which line caused the timeout
|
|
81
|
+
*/
|
|
82
|
+
executeCodeInterviewMode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: ExecutionStyle): Promise<CodeExecutionResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Check the status of the worker
|
|
85
|
+
*/
|
|
86
|
+
getStatus(): Promise<StatusResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Analyze Python code using AST (off main thread)
|
|
89
|
+
* Returns CodeFacts with semantic information about the code
|
|
90
|
+
*/
|
|
91
|
+
analyzeCode(code: string): Promise<unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Terminate the worker and clean up resources
|
|
94
|
+
*/
|
|
95
|
+
terminate(): void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Check if the worker client is supported
|
|
99
|
+
*/
|
|
100
|
+
declare function isWorkerSupported(): boolean;
|
|
101
|
+
|
|
102
|
+
type JavaScriptExecutionStyle = 'function' | 'solution-method' | 'ops-class';
|
|
103
|
+
type JavaScriptWorkerLanguage = 'javascript' | 'typescript';
|
|
104
|
+
interface JavaScriptWorkerClientOptions {
|
|
105
|
+
workerUrl: string;
|
|
106
|
+
debug?: boolean;
|
|
107
|
+
}
|
|
108
|
+
interface InitResult {
|
|
109
|
+
success: boolean;
|
|
110
|
+
loadTimeMs: number;
|
|
111
|
+
}
|
|
112
|
+
declare class JavaScriptWorkerClient {
|
|
113
|
+
private readonly options;
|
|
114
|
+
private worker;
|
|
115
|
+
private pendingMessages;
|
|
116
|
+
private messageId;
|
|
117
|
+
private isInitializing;
|
|
118
|
+
private initPromise;
|
|
119
|
+
private workerReadyPromise;
|
|
120
|
+
private workerReadyResolve;
|
|
121
|
+
private workerReadyReject;
|
|
122
|
+
private readonly debug;
|
|
123
|
+
constructor(options: JavaScriptWorkerClientOptions);
|
|
124
|
+
isSupported(): boolean;
|
|
125
|
+
private getWorker;
|
|
126
|
+
private waitForWorkerReady;
|
|
127
|
+
private sendMessage;
|
|
128
|
+
private executeWithTimeout;
|
|
129
|
+
private terminateAndReset;
|
|
130
|
+
init(): Promise<InitResult>;
|
|
131
|
+
executeWithTracing(code: string, functionName: string | null, inputs: Record<string, unknown>, options?: {
|
|
132
|
+
maxTraceSteps?: number;
|
|
133
|
+
maxLineEvents?: number;
|
|
134
|
+
maxSingleLineHits?: number;
|
|
135
|
+
minimalTrace?: boolean;
|
|
136
|
+
}, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<ExecutionResult>;
|
|
137
|
+
executeCode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<CodeExecutionResult>;
|
|
138
|
+
executeCodeInterviewMode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<CodeExecutionResult>;
|
|
139
|
+
terminate(): void;
|
|
140
|
+
}
|
|
141
|
+
declare function isJavaScriptWorkerSupported(): boolean;
|
|
142
|
+
|
|
143
|
+
export { type ExecutionStyle, type JavaScriptExecutionStyle, JavaScriptWorkerClient, type JavaScriptWorkerClientOptions, type JavaScriptWorkerLanguage, PyodideWorkerClient, type PyodideWorkerClientOptions, isJavaScriptWorkerSupported, isWorkerSupported };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { E as ExecutionResult, a as CodeExecutionResult } from '../types-Bzr1Ohcf.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pyodide Worker Client
|
|
5
|
+
*
|
|
6
|
+
* TypeScript client for communicating with the Pyodide Web Worker.
|
|
7
|
+
* Provides a promise-based API for executing Python code off the main thread.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type ExecutionStyle = 'function' | 'solution-method' | 'ops-class';
|
|
11
|
+
interface PyodideWorkerClientOptions {
|
|
12
|
+
workerUrl: string;
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface InitResult$1 {
|
|
16
|
+
success: boolean;
|
|
17
|
+
loadTimeMs: number;
|
|
18
|
+
}
|
|
19
|
+
interface StatusResult {
|
|
20
|
+
isReady: boolean;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare class PyodideWorkerClient {
|
|
24
|
+
private readonly options;
|
|
25
|
+
private worker;
|
|
26
|
+
private pendingMessages;
|
|
27
|
+
private messageId;
|
|
28
|
+
private isInitializing;
|
|
29
|
+
private initPromise;
|
|
30
|
+
private workerReadyPromise;
|
|
31
|
+
private workerReadyResolve;
|
|
32
|
+
private workerReadyReject;
|
|
33
|
+
private readonly debug;
|
|
34
|
+
constructor(options: PyodideWorkerClientOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Check if Web Workers are supported
|
|
37
|
+
*/
|
|
38
|
+
isSupported(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get or create the worker instance
|
|
41
|
+
*/
|
|
42
|
+
private getWorker;
|
|
43
|
+
/**
|
|
44
|
+
* Wait for worker bootstrap signal with timeout.
|
|
45
|
+
* Guards against deadlocks when the worker script fails before posting "worker-ready".
|
|
46
|
+
*/
|
|
47
|
+
private waitForWorkerReady;
|
|
48
|
+
/**
|
|
49
|
+
* Send a message to the worker and wait for a response
|
|
50
|
+
*/
|
|
51
|
+
private sendMessage;
|
|
52
|
+
/**
|
|
53
|
+
* Execute code with a timeout - terminates worker if execution takes too long
|
|
54
|
+
*/
|
|
55
|
+
private executeWithTimeout;
|
|
56
|
+
/**
|
|
57
|
+
* Terminate the worker and reset state for recreation
|
|
58
|
+
*/
|
|
59
|
+
private terminateAndReset;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize Pyodide in the worker
|
|
62
|
+
*/
|
|
63
|
+
init(): Promise<InitResult$1>;
|
|
64
|
+
/**
|
|
65
|
+
* Execute Python code with tracing for step-by-step visualization
|
|
66
|
+
* @param options.maxLineEvents - Max line events before abort (for complexity analysis, use higher values)
|
|
67
|
+
*/
|
|
68
|
+
executeWithTracing(code: string, functionName: string | null, inputs: Record<string, unknown>, options?: {
|
|
69
|
+
maxTraceSteps?: number;
|
|
70
|
+
maxLineEvents?: number;
|
|
71
|
+
maxSingleLineHits?: number;
|
|
72
|
+
minimalTrace?: boolean;
|
|
73
|
+
}, executionStyle?: ExecutionStyle): Promise<ExecutionResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Execute Python code without tracing (for running tests)
|
|
76
|
+
*/
|
|
77
|
+
executeCode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: ExecutionStyle): Promise<CodeExecutionResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Execute Python code in interview mode - 5 second timeout, generic error messages
|
|
80
|
+
* Does not reveal which line caused the timeout
|
|
81
|
+
*/
|
|
82
|
+
executeCodeInterviewMode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: ExecutionStyle): Promise<CodeExecutionResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Check the status of the worker
|
|
85
|
+
*/
|
|
86
|
+
getStatus(): Promise<StatusResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Analyze Python code using AST (off main thread)
|
|
89
|
+
* Returns CodeFacts with semantic information about the code
|
|
90
|
+
*/
|
|
91
|
+
analyzeCode(code: string): Promise<unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Terminate the worker and clean up resources
|
|
94
|
+
*/
|
|
95
|
+
terminate(): void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Check if the worker client is supported
|
|
99
|
+
*/
|
|
100
|
+
declare function isWorkerSupported(): boolean;
|
|
101
|
+
|
|
102
|
+
type JavaScriptExecutionStyle = 'function' | 'solution-method' | 'ops-class';
|
|
103
|
+
type JavaScriptWorkerLanguage = 'javascript' | 'typescript';
|
|
104
|
+
interface JavaScriptWorkerClientOptions {
|
|
105
|
+
workerUrl: string;
|
|
106
|
+
debug?: boolean;
|
|
107
|
+
}
|
|
108
|
+
interface InitResult {
|
|
109
|
+
success: boolean;
|
|
110
|
+
loadTimeMs: number;
|
|
111
|
+
}
|
|
112
|
+
declare class JavaScriptWorkerClient {
|
|
113
|
+
private readonly options;
|
|
114
|
+
private worker;
|
|
115
|
+
private pendingMessages;
|
|
116
|
+
private messageId;
|
|
117
|
+
private isInitializing;
|
|
118
|
+
private initPromise;
|
|
119
|
+
private workerReadyPromise;
|
|
120
|
+
private workerReadyResolve;
|
|
121
|
+
private workerReadyReject;
|
|
122
|
+
private readonly debug;
|
|
123
|
+
constructor(options: JavaScriptWorkerClientOptions);
|
|
124
|
+
isSupported(): boolean;
|
|
125
|
+
private getWorker;
|
|
126
|
+
private waitForWorkerReady;
|
|
127
|
+
private sendMessage;
|
|
128
|
+
private executeWithTimeout;
|
|
129
|
+
private terminateAndReset;
|
|
130
|
+
init(): Promise<InitResult>;
|
|
131
|
+
executeWithTracing(code: string, functionName: string | null, inputs: Record<string, unknown>, options?: {
|
|
132
|
+
maxTraceSteps?: number;
|
|
133
|
+
maxLineEvents?: number;
|
|
134
|
+
maxSingleLineHits?: number;
|
|
135
|
+
minimalTrace?: boolean;
|
|
136
|
+
}, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<ExecutionResult>;
|
|
137
|
+
executeCode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<CodeExecutionResult>;
|
|
138
|
+
executeCodeInterviewMode(code: string, functionName: string, inputs: Record<string, unknown>, executionStyle?: JavaScriptExecutionStyle, language?: JavaScriptWorkerLanguage): Promise<CodeExecutionResult>;
|
|
139
|
+
terminate(): void;
|
|
140
|
+
}
|
|
141
|
+
declare function isJavaScriptWorkerSupported(): boolean;
|
|
142
|
+
|
|
143
|
+
export { type ExecutionStyle, type JavaScriptExecutionStyle, JavaScriptWorkerClient, type JavaScriptWorkerClientOptions, type JavaScriptWorkerLanguage, PyodideWorkerClient, type PyodideWorkerClientOptions, isJavaScriptWorkerSupported, isWorkerSupported };
|