@innovatorved/code-lab 0.2.0 → 0.3.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.
Files changed (70) hide show
  1. package/ARCHITECTURE.md +11 -6
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +18 -8
  4. package/dist/code-lab.css +198 -0
  5. package/dist/code-lab.d.ts +27 -9
  6. package/dist/code-lab.esm.js +8248 -83
  7. package/dist/code-lab.js +8246 -81
  8. package/dist/extensions/cpp.d.ts +32 -6
  9. package/dist/extensions/cpp.esm.js +745 -6
  10. package/dist/extensions/cpp.js +745 -6
  11. package/dist/extensions/guided-lab.esm.js +39 -1
  12. package/dist/extensions/guided-lab.js +39 -1
  13. package/dist/extensions/python.d.ts +92 -0
  14. package/dist/extensions/python.esm.js +5476 -0
  15. package/dist/extensions/python.js +5495 -0
  16. package/dist/index.d.ts +7 -4
  17. package/dist/preview-sw.js +1 -1
  18. package/dist/runtime/index.d.ts +4 -0
  19. package/dist/runtime/module-loader.d.ts +11 -0
  20. package/dist/runtime/test-harness.d.ts +24 -0
  21. package/dist/runtime/vfs.d.ts +31 -0
  22. package/dist/runtime/wasi-host.d.ts +33 -0
  23. package/dist/runtime.esm.js +36 -4
  24. package/dist/runtime.js +36 -4
  25. package/dist/schemas.d.ts +134 -21
  26. package/dist/schemas.esm.js +43 -1
  27. package/dist/schemas.js +43 -1
  28. package/dist/shell/coreutils/compilers-cli.d.ts +24 -0
  29. package/dist/shell/index.d.ts +4 -0
  30. package/dist/shell/lexer-parser.d.ts +26 -0
  31. package/dist/shell.esm.js +113 -1
  32. package/dist/shell.js +113 -1
  33. package/dist/terminal.esm.js +1 -1
  34. package/dist/terminal.js +1 -1
  35. package/dist/workbench/command-palette.d.ts +10 -0
  36. package/dist/workbench/diff-editor.d.ts +26 -0
  37. package/dist/workbench/drawer.d.ts +18 -0
  38. package/dist/workbench/editor.d.ts +11 -0
  39. package/dist/workbench/file-tree.d.ts +11 -0
  40. package/dist/workbench/guided-pane.d.ts +11 -0
  41. package/dist/workbench/icons.d.ts +5 -0
  42. package/dist/workbench/index.d.ts +39 -0
  43. package/dist/workbench/share.d.ts +21 -0
  44. package/dist/workbench/styles.d.ts +4 -0
  45. package/dist/workbench/toolbar.d.ts +17 -0
  46. package/dist/workbench.d.ts +6 -1
  47. package/package.json +8 -2
  48. package/src/code-lab.css +198 -0
  49. package/src/extensions/cpp.ts +710 -5
  50. package/src/extensions/python.ts +1293 -0
  51. package/src/index.ts +35 -3
  52. package/src/runtime/index.ts +5 -0
  53. package/src/runtime/test-harness.ts +57 -0
  54. package/src/runtime.ts +35 -3
  55. package/src/schemas.ts +46 -1
  56. package/src/shell/coreutils/compilers-cli.ts +103 -0
  57. package/src/shell/index.ts +5 -0
  58. package/src/shell.ts +112 -0
  59. package/src/workbench/command-palette.ts +140 -0
  60. package/src/workbench/diff-editor.ts +216 -0
  61. package/src/workbench/drawer.ts +148 -0
  62. package/src/workbench/editor.ts +49 -0
  63. package/src/workbench/file-tree.ts +51 -0
  64. package/src/workbench/guided-pane.ts +33 -0
  65. package/src/workbench/icons.ts +48 -0
  66. package/src/workbench/index.ts +38 -0
  67. package/src/workbench/share.ts +99 -0
  68. package/src/workbench/styles.ts +200 -0
  69. package/src/workbench/toolbar.ts +171 -0
  70. package/src/workbench.ts +755 -70
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @innovatorved/code-lab v0.2.0
3
- * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, WASI C++20 Toolchain, and Git Engine.
2
+ * @innovatorved/code-lab v0.3.0
3
+ * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, WASI C++20 Toolchain, Python 3.12 WebAssembly, and Git Engine.
4
4
  */
5
5
  export * from './schemas';
6
6
  export * from './logger';
7
- export { SafeHtml, isSafeHtml, raw, html } from './html';
7
+ export { type SafeHtml, isSafeHtml, raw, html } from './html';
8
8
  export * from './csp';
9
9
  export * from './zip';
10
10
  export { type StorageBackendType, type ProjectSummary, type WorkspaceStorageOptions, WorkspaceStorage, createWorkspaceStorage } from './storage';
@@ -14,9 +14,12 @@ export { type GitCommitRecord, type GitState, type GitStatusResult, computeShort
14
14
  export * from './runtime';
15
15
  export { createPosixShell, cloneGitHubRepository, parseGitHubRepoUrl, CodeLabShell } from './shell';
16
16
  export * from './terminal';
17
+ export { CodeLabWorkbench, Workbench, CodeLabElement, CodeLab } from './workbench';
18
+ export * from './workbench/index';
17
19
  export { guidedLabExtension } from './extensions/guided-lab';
18
20
  export { type JavaScriptExtensionOptions, javascriptExtension, createJavaScriptExtension } from './extensions/javascript';
19
21
  export { type TypeScriptExtensionOptions, typescriptExtension, createTypeScriptExtension } from './extensions/typescript';
20
- export { type CppCompileOptions, type CppCompileResult, type CppCompilerAdapter, DEFAULT_CPP_CDN_BASE_URL, BUILTIN_CPP_HEADERS, extractTarToVfs, createTarArchive, seedCppHeadersIntoVfs, parseCppCompilerFlags, CppToolchainManager, registerCppCompilerOnRuntime, cppExtension, createCppExtension } from './extensions/cpp';
22
+ export { type CppCompileOptions, type CppCompileResult, type CppCompilerAdapter, type CppSymbolDoc, DEFAULT_CPP_CDN_BASE_URL, BUILTIN_CPP_HEADERS, STANDARD_CPP20_HEADERS, CPP_COMPLETIONS_AND_HOVERS, extractTarToVfs, createTarArchive, seedCppHeadersIntoVfs, parseCppCompilerFlags, CppToolchainManager, registerCppCompilerOnRuntime, registerMonacoCppLanguageService, analyzeCppSource, applyClangStderrDiagnostics, cppExtension, createCppExtension } from './extensions/cpp';
23
+ export { type ExtendedPythonExtensionOptions, type PythonCompileResult, type PythonSymbolDoc, DEFAULT_PYTHON_CDN_BASE_URL, BUILTIN_PYTHON_MODULES, PYTHON_COMPLETIONS_AND_HOVERS, PythonToolchainManager, seedPythonModulesIntoVfs, registerPythonCompilerOnRuntime, registerMonacoPythonLanguageService, analyzePythonSource, applyPythonTracebackDiagnostics, formatPythonSource, pythonExtension, createPythonExtension } from './extensions/python';
21
24
  declare const _default: any;
22
25
  export default _default;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.2.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.3.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @innovatorved/code-lab — Runtime Subsystem Entrypoint
3
+ */
4
+ export * from './test-harness';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @innovatorved/code-lab — Module Loader, ESM Transformer & TypeScript Stripper
3
+ */
4
+ /**
5
+ * Fast TypeScript type-stripper for browser-native execution without external transpile overhead.
6
+ */
7
+ export declare function stripTypeScriptTypes(source: string): string;
8
+ /**
9
+ * Transforms ESM import/export statements into CommonJS require/exports.
10
+ */
11
+ export declare function transformEsmToCommonJs(source: string): string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @innovatorved/code-lab — Structured Test Harness & __CODELAB_TEST__: Telemetry Parser
3
+ * Normalizes test events from node:test, <codelab/test.hpp>, and codelab_test.py.
4
+ */
5
+ export interface TestResultItem {
6
+ index: number;
7
+ name: string;
8
+ status: 'pass' | 'fail';
9
+ passed: boolean;
10
+ durationMs: number;
11
+ error: {
12
+ name?: string;
13
+ message?: string;
14
+ stack?: string;
15
+ actual?: string;
16
+ expected?: string;
17
+ } | null;
18
+ }
19
+ export declare class CodeLabTestParser {
20
+ private count;
21
+ private onResult;
22
+ constructor(onResult?: (item: TestResultItem) => void);
23
+ parseLine(line: string): TestResultItem | null;
24
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @innovatorved/code-lab — In-Memory POSIX Virtual File System (VFS) Types & Utilities
3
+ */
4
+ export interface VfsStat {
5
+ dev: number;
6
+ ino: number;
7
+ mode: number;
8
+ nlink: number;
9
+ uid: number;
10
+ gid: number;
11
+ rdev: number;
12
+ size: number;
13
+ blksize: number;
14
+ blocks: number;
15
+ atimeMs: number;
16
+ mtimeMs: number;
17
+ ctimeMs: number;
18
+ birthtimeMs: number;
19
+ isDirectory(): boolean;
20
+ isFile(): boolean;
21
+ isSymbolicLink(): boolean;
22
+ }
23
+ export interface VfsSnapshotItem {
24
+ path: string;
25
+ size: number;
26
+ isDirectory: boolean;
27
+ mtimeMs: number;
28
+ preview?: string;
29
+ hexPreview?: string;
30
+ }
31
+ export declare function normalizeVfsPath(p: string, cwd?: string): string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @innovatorved/code-lab — WASI Preview 1 Host, Linear Memory Inspection & Execution Harness
3
+ */
4
+ export declare class WasiExitSignal extends Error {
5
+ code: number;
6
+ _isWasiExit: boolean;
7
+ constructor(code?: number);
8
+ }
9
+ export interface WasiExecutionOptions {
10
+ args?: string[];
11
+ argv?: string[];
12
+ env?: Record<string, string>;
13
+ preopens?: Record<string, string>;
14
+ vfs?: any;
15
+ files?: Record<string, string>;
16
+ stdin?: string;
17
+ imports?: Record<string, any>;
18
+ onStdout?: (text: string) => void;
19
+ onStderr?: (text: string) => void;
20
+ }
21
+ export interface WasiExecutionResult {
22
+ ok: boolean;
23
+ exitCode: number;
24
+ durationMs: number;
25
+ stdout: string;
26
+ stderr: string;
27
+ vfs: any;
28
+ peakMemoryBytes: number;
29
+ }
30
+ /**
31
+ * Calculates peak memory from a WebAssembly instance's exported linear memory.
32
+ */
33
+ export declare function getWasiPeakMemoryBytes(instance: any): number;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.2.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.3.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -8725,6 +8725,7 @@ function __initVirtualRuntime(rootScope) {
8725
8725
  if (vfs.existsSync(alt)) entryAbs = alt;
8726
8726
  }
8727
8727
  const isCppEntry = /\.(cpp|cc|cxx)$/i.test(entryAbs);
8728
+ const isPyEntry = /\.py$/i.test(entryAbs);
8728
8729
  const isWasmEntry = /\.wasm$/i.test(entryAbs) || Boolean(options.wasmBinary);
8729
8730
  if (isWasmEntry) {
8730
8731
  const wasmBytes = options.wasmBinary || vfs.readFileSync(entryAbs);
@@ -8774,6 +8775,36 @@ function __initVirtualRuntime(rootScope) {
8774
8775
  exitCode = compileRes.exitCode;
8775
8776
  hasExited = true;
8776
8777
  }
8778
+ } else if (isPyEntry) {
8779
+ const pyCompiler =
8780
+ options.pythonCompiler ||
8781
+ (typeof globalThis !== 'undefined' && globalThis.__codelabPythonCompiler) ||
8782
+ (rootScope && rootScope.__codelabPythonCompiler);
8783
+ if (typeof pyCompiler !== 'function') {
8784
+ throw new Error(
8785
+ 'Python WebAssembly toolchain is not registered. Enable pythonExtension from "@innovatorved/code-lab/extensions/python" to run Python files.'
8786
+ );
8787
+ }
8788
+ const pyRes = await pyCompiler({
8789
+ entry: entryAbs,
8790
+ vfs,
8791
+ files: typeof vfs.toSnapshot === 'function' ? vfs.toSnapshot('/workspace') : (files || {}),
8792
+ args: argv || [entryAbs],
8793
+ env: Object.assign({}, sandboxProcess.env, options.env || {}),
8794
+ stdin: options.stdin || '',
8795
+ testFilter,
8796
+ onStdout: emitStdout,
8797
+ onStderr: emitStderr
8798
+ });
8799
+ if (pyRes) {
8800
+ exitCode = typeof pyRes.exitCode === 'number' ? pyRes.exitCode : (pyRes.ok ? 0 : 1);
8801
+ if (pyRes.testResults && Array.isArray(pyRes.testResults)) {
8802
+ for (const tr of pyRes.testResults) {
8803
+ testResults.push(tr);
8804
+ }
8805
+ }
8806
+ }
8807
+ hasExited = true;
8777
8808
  } else {
8778
8809
  // Check if the file in VFS starts with WASM magic bytes (\0asm)
8779
8810
  let rawBuf = null;
@@ -9640,12 +9671,13 @@ _hostRuntime.cancelWorkerExecution = function cancelWorkerExecution(reason = 'Ex
9640
9671
  };
9641
9672
 
9642
9673
  _hostRuntime.executeInWorker = async function executeInWorker(options = {}) {
9643
- const isCppOrWasm =
9674
+ const isNonJs =
9644
9675
  Boolean(options.wasmBinary) ||
9645
9676
  Boolean(options.cppCompiler) ||
9646
- (typeof options.entry === 'string' && /\.(cpp|cc|cxx|wasm)$/i.test(options.entry));
9677
+ Boolean(options.pythonCompiler) ||
9678
+ (typeof options.entry === 'string' && /\.(cpp|cc|cxx|wasm|py)$/i.test(options.entry));
9647
9679
  if (
9648
- isCppOrWasm ||
9680
+ isNonJs ||
9649
9681
  typeof Worker === 'undefined' ||
9650
9682
  typeof Blob === 'undefined' ||
9651
9683
  typeof URL === 'undefined' ||
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.2.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.3.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -8726,6 +8726,7 @@ function __initVirtualRuntime(rootScope) {
8726
8726
  if (vfs.existsSync(alt)) entryAbs = alt;
8727
8727
  }
8728
8728
  const isCppEntry = /\.(cpp|cc|cxx)$/i.test(entryAbs);
8729
+ const isPyEntry = /\.py$/i.test(entryAbs);
8729
8730
  const isWasmEntry = /\.wasm$/i.test(entryAbs) || Boolean(options.wasmBinary);
8730
8731
  if (isWasmEntry) {
8731
8732
  const wasmBytes = options.wasmBinary || vfs.readFileSync(entryAbs);
@@ -8775,6 +8776,36 @@ function __initVirtualRuntime(rootScope) {
8775
8776
  exitCode = compileRes.exitCode;
8776
8777
  hasExited = true;
8777
8778
  }
8779
+ } else if (isPyEntry) {
8780
+ const pyCompiler =
8781
+ options.pythonCompiler ||
8782
+ (typeof globalThis !== 'undefined' && globalThis.__codelabPythonCompiler) ||
8783
+ (rootScope && rootScope.__codelabPythonCompiler);
8784
+ if (typeof pyCompiler !== 'function') {
8785
+ throw new Error(
8786
+ 'Python WebAssembly toolchain is not registered. Enable pythonExtension from "@innovatorved/code-lab/extensions/python" to run Python files.'
8787
+ );
8788
+ }
8789
+ const pyRes = await pyCompiler({
8790
+ entry: entryAbs,
8791
+ vfs,
8792
+ files: typeof vfs.toSnapshot === 'function' ? vfs.toSnapshot('/workspace') : (files || {}),
8793
+ args: argv || [entryAbs],
8794
+ env: Object.assign({}, sandboxProcess.env, options.env || {}),
8795
+ stdin: options.stdin || '',
8796
+ testFilter,
8797
+ onStdout: emitStdout,
8798
+ onStderr: emitStderr
8799
+ });
8800
+ if (pyRes) {
8801
+ exitCode = typeof pyRes.exitCode === 'number' ? pyRes.exitCode : (pyRes.ok ? 0 : 1);
8802
+ if (pyRes.testResults && Array.isArray(pyRes.testResults)) {
8803
+ for (const tr of pyRes.testResults) {
8804
+ testResults.push(tr);
8805
+ }
8806
+ }
8807
+ }
8808
+ hasExited = true;
8778
8809
  } else {
8779
8810
  // Check if the file in VFS starts with WASM magic bytes (\0asm)
8780
8811
  let rawBuf = null;
@@ -9641,12 +9672,13 @@ _hostRuntime.cancelWorkerExecution = function cancelWorkerExecution(reason = 'Ex
9641
9672
  };
9642
9673
 
9643
9674
  _hostRuntime.executeInWorker = async function executeInWorker(options = {}) {
9644
- const isCppOrWasm =
9675
+ const isNonJs =
9645
9676
  Boolean(options.wasmBinary) ||
9646
9677
  Boolean(options.cppCompiler) ||
9647
- (typeof options.entry === 'string' && /\.(cpp|cc|cxx|wasm)$/i.test(options.entry));
9678
+ Boolean(options.pythonCompiler) ||
9679
+ (typeof options.entry === 'string' && /\.(cpp|cc|cxx|wasm|py)$/i.test(options.entry));
9648
9680
  if (
9649
- isCppOrWasm ||
9681
+ isNonJs ||
9650
9682
  typeof Worker === 'undefined' ||
9651
9683
  typeof Blob === 'undefined' ||
9652
9684
  typeof URL === 'undefined' ||
package/dist/schemas.d.ts CHANGED
@@ -34,24 +34,25 @@ export declare const GuidedStepSchema: z.ZodObject<{
34
34
  testNames?: string[];
35
35
  }>;
36
36
  export type GuidedStep = z.infer<typeof GuidedStepSchema>;
37
- export declare const LanguageIdSchema: z.ZodEnum<["js", "ts", "cpp"]>;
37
+ export declare const LanguageIdSchema: z.ZodEnum<["js", "ts", "cpp", "py"]>;
38
38
  export type LanguageId = z.infer<typeof LanguageIdSchema>;
39
+ export declare const LanguageEnum: z.ZodEnum<["js", "ts", "cpp", "py"]>;
39
40
  export declare const LanguageBundleSchema: z.ZodObject<{
40
- language: z.ZodDefault<z.ZodEnum<["js", "ts", "cpp"]>>;
41
+ language: z.ZodDefault<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
41
42
  files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
42
43
  starterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
43
44
  solutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
44
45
  entry: z.ZodOptional<z.ZodString>;
45
46
  testEntry: z.ZodOptional<z.ZodString>;
46
47
  }, "strip", z.ZodTypeAny, {
47
- language?: "js" | "ts" | "cpp";
48
+ language?: "js" | "ts" | "cpp" | "py";
48
49
  files?: Record<string, string>;
49
50
  starterFiles?: Record<string, string>;
50
51
  solutionFiles?: Record<string, string>;
51
52
  entry?: string;
52
53
  testEntry?: string;
53
54
  }, {
54
- language?: "js" | "ts" | "cpp";
55
+ language?: "js" | "ts" | "cpp" | "py";
55
56
  files?: Record<string, string>;
56
57
  starterFiles?: Record<string, string>;
57
58
  solutionFiles?: Record<string, string>;
@@ -93,8 +94,8 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
93
94
  }>, "many">>;
94
95
  stepIndex: z.ZodDefault<z.ZodNumber>;
95
96
  mode: z.ZodDefault<z.ZodEnum<["guided", "sandbox"]>>;
96
- language: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp"]>>;
97
- lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp"]>>;
97
+ language: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
98
+ lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
98
99
  starterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
99
100
  solutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
100
101
  tsStarterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -103,6 +104,12 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
103
104
  cppStarterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
105
  cppSolutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
105
106
  cppFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
107
+ pyStarterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
108
+ pySolutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
109
+ pyFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
110
+ pyEntry: z.ZodOptional<z.ZodString>;
111
+ pyTestEntry: z.ZodOptional<z.ZodString>;
112
+ pyTestCode: z.ZodOptional<z.ZodString>;
106
113
  summary: z.ZodOptional<z.ZodString>;
107
114
  onStepComplete: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
108
115
  id: z.ZodString;
@@ -138,7 +145,7 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
138
145
  onLabComplete: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
139
146
  }, "strip", z.ZodTypeAny, {
140
147
  mode?: "guided" | "sandbox";
141
- language?: "js" | "ts" | "cpp";
148
+ language?: "js" | "ts" | "cpp" | "py";
142
149
  starterFiles?: Record<string, string>;
143
150
  solutionFiles?: Record<string, string>;
144
151
  steps?: {
@@ -153,13 +160,19 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
153
160
  testNames?: string[];
154
161
  }[];
155
162
  stepIndex?: number;
156
- lang?: "js" | "ts" | "cpp";
163
+ lang?: "js" | "ts" | "cpp" | "py";
157
164
  tsStarterFiles?: Record<string, string>;
158
165
  tsSolutionFiles?: Record<string, string>;
159
166
  tsFiles?: Record<string, string>;
160
167
  cppStarterFiles?: Record<string, string>;
161
168
  cppSolutionFiles?: Record<string, string>;
162
169
  cppFiles?: Record<string, string>;
170
+ pyStarterFiles?: Record<string, string>;
171
+ pySolutionFiles?: Record<string, string>;
172
+ pyFiles?: Record<string, string>;
173
+ pyEntry?: string;
174
+ pyTestEntry?: string;
175
+ pyTestCode?: string;
163
176
  summary?: string;
164
177
  onStepComplete?: (args_0: {
165
178
  symbol?: string;
@@ -175,7 +188,7 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
175
188
  onLabComplete?: (args_0: string, ...args: unknown[]) => void;
176
189
  }, {
177
190
  mode?: "guided" | "sandbox";
178
- language?: "js" | "ts" | "cpp";
191
+ language?: "js" | "ts" | "cpp" | "py";
179
192
  starterFiles?: Record<string, string>;
180
193
  solutionFiles?: Record<string, string>;
181
194
  steps?: {
@@ -190,13 +203,19 @@ export declare const GuidedLabExtensionOptionsSchema: z.ZodObject<{
190
203
  testNames?: string[];
191
204
  }[];
192
205
  stepIndex?: number;
193
- lang?: "js" | "ts" | "cpp";
206
+ lang?: "js" | "ts" | "cpp" | "py";
194
207
  tsStarterFiles?: Record<string, string>;
195
208
  tsSolutionFiles?: Record<string, string>;
196
209
  tsFiles?: Record<string, string>;
197
210
  cppStarterFiles?: Record<string, string>;
198
211
  cppSolutionFiles?: Record<string, string>;
199
212
  cppFiles?: Record<string, string>;
213
+ pyStarterFiles?: Record<string, string>;
214
+ pySolutionFiles?: Record<string, string>;
215
+ pyFiles?: Record<string, string>;
216
+ pyEntry?: string;
217
+ pyTestEntry?: string;
218
+ pyTestCode?: string;
200
219
  summary?: string;
201
220
  onStepComplete?: (args_0: {
202
221
  symbol?: string;
@@ -291,6 +310,76 @@ export declare const CppExtensionOptionsSchema: z.ZodObject<{
291
310
  onProgress?: (args_0: any, ...args: unknown[]) => void;
292
311
  }>;
293
312
  export type CppExtensionOptions = z.infer<typeof CppExtensionOptionsSchema>;
313
+ export declare const PythonToolchainProgressSchema: z.ZodObject<{
314
+ stage: z.ZodEnum<["downloading", "caching", "extracting", "initializing", "ready"]>;
315
+ loadedBytes: z.ZodOptional<z.ZodNumber>;
316
+ totalBytes: z.ZodOptional<z.ZodNumber>;
317
+ percent: z.ZodOptional<z.ZodNumber>;
318
+ message: z.ZodOptional<z.ZodString>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ message?: string;
321
+ stage?: "downloading" | "caching" | "extracting" | "ready" | "initializing";
322
+ loadedBytes?: number;
323
+ totalBytes?: number;
324
+ percent?: number;
325
+ }, {
326
+ message?: string;
327
+ stage?: "downloading" | "caching" | "extracting" | "ready" | "initializing";
328
+ loadedBytes?: number;
329
+ totalBytes?: number;
330
+ percent?: number;
331
+ }>;
332
+ export type PythonToolchainProgress = z.infer<typeof PythonToolchainProgressSchema>;
333
+ export declare const PythonExtensionOptionsSchema: z.ZodObject<{
334
+ cdnBaseUrl: z.ZodOptional<z.ZodString>;
335
+ indexUrl: z.ZodOptional<z.ZodString>;
336
+ pyodideIndexUrl: z.ZodOptional<z.ZodString>;
337
+ cacheInIndexedDB: z.ZodDefault<z.ZodBoolean>;
338
+ preload: z.ZodDefault<z.ZodBoolean>;
339
+ activate: z.ZodOptional<z.ZodBoolean>;
340
+ entry: z.ZodDefault<z.ZodString>;
341
+ testEntry: z.ZodDefault<z.ZodString>;
342
+ packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
343
+ preloadPackages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
344
+ compilerMemoryLimitMb: z.ZodOptional<z.ZodNumber>;
345
+ files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
346
+ starterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
347
+ solutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
348
+ onProgress: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ files?: Record<string, string>;
351
+ starterFiles?: Record<string, string>;
352
+ solutionFiles?: Record<string, string>;
353
+ entry?: string;
354
+ testEntry?: string;
355
+ cacheInIndexedDB?: boolean;
356
+ preload?: boolean;
357
+ onProgress?: (args_0: any, ...args: unknown[]) => void;
358
+ cdnBaseUrl?: string;
359
+ indexUrl?: string;
360
+ pyodideIndexUrl?: string;
361
+ activate?: boolean;
362
+ packages?: string[];
363
+ preloadPackages?: string[];
364
+ compilerMemoryLimitMb?: number;
365
+ }, {
366
+ files?: Record<string, string>;
367
+ starterFiles?: Record<string, string>;
368
+ solutionFiles?: Record<string, string>;
369
+ entry?: string;
370
+ testEntry?: string;
371
+ cacheInIndexedDB?: boolean;
372
+ preload?: boolean;
373
+ onProgress?: (args_0: any, ...args: unknown[]) => void;
374
+ cdnBaseUrl?: string;
375
+ indexUrl?: string;
376
+ pyodideIndexUrl?: string;
377
+ activate?: boolean;
378
+ packages?: string[];
379
+ preloadPackages?: string[];
380
+ compilerMemoryLimitMb?: number;
381
+ }>;
382
+ export type PythonExtensionOptions = z.infer<typeof PythonExtensionOptionsSchema>;
294
383
  export declare const CloneProgressPhaseSchema: z.ZodEnum<["connecting", "metadata", "downloading", "mounting", "ready", "error"]>;
295
384
  export type CloneProgressPhase = z.infer<typeof CloneProgressPhaseSchema>;
296
385
  export declare const CloneProgressEventSchema: z.ZodObject<{
@@ -371,6 +460,7 @@ export declare const RuntimeExecuteOptionsSchema: z.ZodObject<{
371
460
  mode?: "run" | "test" | "repl";
372
461
  files?: Record<string, string>;
373
462
  entry?: string;
463
+ packages?: Record<string, any>;
374
464
  replCode?: string;
375
465
  printReplResult?: boolean;
376
466
  testFilter?: string | string[];
@@ -384,7 +474,6 @@ export declare const RuntimeExecuteOptionsSchema: z.ZodObject<{
384
474
  isBackground?: boolean;
385
475
  vfs?: any;
386
476
  activePortTable?: any;
387
- packages?: Record<string, any>;
388
477
  npmModules?: Record<string, any>;
389
478
  onStdout?: (args_0: string, ...args: unknown[]) => void;
390
479
  onStderr?: (args_0: string, ...args: unknown[]) => void;
@@ -393,6 +482,7 @@ export declare const RuntimeExecuteOptionsSchema: z.ZodObject<{
393
482
  mode?: "run" | "test" | "repl";
394
483
  files?: Record<string, string>;
395
484
  entry?: string;
485
+ packages?: Record<string, any>;
396
486
  replCode?: string;
397
487
  printReplResult?: boolean;
398
488
  testFilter?: string | string[];
@@ -406,7 +496,6 @@ export declare const RuntimeExecuteOptionsSchema: z.ZodObject<{
406
496
  isBackground?: boolean;
407
497
  vfs?: any;
408
498
  activePortTable?: any;
409
- packages?: Record<string, any>;
410
499
  npmModules?: Record<string, any>;
411
500
  onStdout?: (args_0: string, ...args: unknown[]) => void;
412
501
  onStderr?: (args_0: string, ...args: unknown[]) => void;
@@ -420,12 +509,12 @@ export declare const WorkspaceSnapshotSchema: z.ZodObject<{
420
509
  openTabs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
421
510
  activeFile: z.ZodOptional<z.ZodNullable<z.ZodString>>;
422
511
  mode: z.ZodOptional<z.ZodEnum<["guided", "sandbox"]>>;
423
- lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp"]>>;
512
+ lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
424
513
  labId: z.ZodOptional<z.ZodString>;
425
514
  }, "strip", z.ZodTypeAny, {
426
515
  mode?: "guided" | "sandbox";
427
516
  files?: Record<string, string>;
428
- lang?: "js" | "ts" | "cpp";
517
+ lang?: "js" | "ts" | "cpp" | "py";
429
518
  version?: number;
430
519
  timestamp?: number;
431
520
  openTabs?: string[];
@@ -434,7 +523,7 @@ export declare const WorkspaceSnapshotSchema: z.ZodObject<{
434
523
  }, {
435
524
  mode?: "guided" | "sandbox";
436
525
  files?: Record<string, string>;
437
- lang?: "js" | "ts" | "cpp";
526
+ lang?: "js" | "ts" | "cpp" | "py";
438
527
  version?: number;
439
528
  timestamp?: number;
440
529
  openTabs?: string[];
@@ -507,10 +596,18 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
507
596
  cppFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
508
597
  cppStarterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
509
598
  cppSolutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
599
+ pyFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
600
+ pyStarterFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
601
+ pySolutionFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
602
+ pyEntry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
603
+ pyTestEntry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
604
+ pyTestCode: z.ZodOptional<z.ZodString>;
605
+ showWebPreview: z.ZodOptional<z.ZodBoolean>;
606
+ stdin: z.ZodOptional<z.ZodString>;
510
607
  guided: z.ZodOptional<z.ZodAny>;
511
608
  mode: z.ZodOptional<z.ZodEnum<["guided", "sandbox"]>>;
512
- language: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp"]>>;
513
- lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp"]>>;
609
+ language: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
610
+ lang: z.ZodOptional<z.ZodEnum<["js", "ts", "cpp", "py"]>>;
514
611
  stepIndex: z.ZodOptional<z.ZodNumber>;
515
612
  onStepComplete: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodNumber], z.ZodUnknown>, z.ZodVoid>>;
516
613
  onLabComplete: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
@@ -518,7 +615,7 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
518
615
  mode?: "guided" | "sandbox";
519
616
  id?: string;
520
617
  title?: string;
521
- language?: "js" | "ts" | "cpp";
618
+ language?: "js" | "ts" | "cpp" | "py";
522
619
  files?: Record<string, string>;
523
620
  starterFiles?: Record<string, string>;
524
621
  solutionFiles?: Record<string, string>;
@@ -537,13 +634,19 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
537
634
  }[];
538
635
  stepIndex?: number;
539
636
  guided?: any;
540
- lang?: "js" | "ts" | "cpp";
637
+ lang?: "js" | "ts" | "cpp" | "py";
541
638
  tsStarterFiles?: Record<string, string>;
542
639
  tsSolutionFiles?: Record<string, string>;
543
640
  tsFiles?: Record<string, string>;
544
641
  cppStarterFiles?: Record<string, string>;
545
642
  cppSolutionFiles?: Record<string, string>;
546
643
  cppFiles?: Record<string, string>;
644
+ pyStarterFiles?: Record<string, string>;
645
+ pySolutionFiles?: Record<string, string>;
646
+ pyFiles?: Record<string, string>;
647
+ pyEntry?: string;
648
+ pyTestEntry?: string;
649
+ pyTestCode?: string;
547
650
  summary?: string;
548
651
  onStepComplete?: (args_0: any, args_1: number, ...args: unknown[]) => void;
549
652
  onLabComplete?: (args_0: string, ...args: unknown[]) => void;
@@ -566,11 +669,13 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
566
669
  onCodeChange?: (args_0: string, args_1: string, ...args: unknown[]) => void;
567
670
  plugins?: any[];
568
671
  extensions?: any[];
672
+ showWebPreview?: boolean;
673
+ stdin?: string;
569
674
  }, {
570
675
  mode?: "guided" | "sandbox";
571
676
  id?: string;
572
677
  title?: string;
573
- language?: "js" | "ts" | "cpp";
678
+ language?: "js" | "ts" | "cpp" | "py";
574
679
  files?: Record<string, string>;
575
680
  starterFiles?: Record<string, string>;
576
681
  solutionFiles?: Record<string, string>;
@@ -589,13 +694,19 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
589
694
  }[];
590
695
  stepIndex?: number;
591
696
  guided?: any;
592
- lang?: "js" | "ts" | "cpp";
697
+ lang?: "js" | "ts" | "cpp" | "py";
593
698
  tsStarterFiles?: Record<string, string>;
594
699
  tsSolutionFiles?: Record<string, string>;
595
700
  tsFiles?: Record<string, string>;
596
701
  cppStarterFiles?: Record<string, string>;
597
702
  cppSolutionFiles?: Record<string, string>;
598
703
  cppFiles?: Record<string, string>;
704
+ pyStarterFiles?: Record<string, string>;
705
+ pySolutionFiles?: Record<string, string>;
706
+ pyFiles?: Record<string, string>;
707
+ pyEntry?: string;
708
+ pyTestEntry?: string;
709
+ pyTestCode?: string;
599
710
  summary?: string;
600
711
  onStepComplete?: (args_0: any, args_1: number, ...args: unknown[]) => void;
601
712
  onLabComplete?: (args_0: string, ...args: unknown[]) => void;
@@ -618,6 +729,8 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
618
729
  onCodeChange?: (args_0: string, args_1: string, ...args: unknown[]) => void;
619
730
  plugins?: any[];
620
731
  extensions?: any[];
732
+ showWebPreview?: boolean;
733
+ stdin?: string;
621
734
  }>;
622
735
  export type WorkbenchOptions = z.infer<typeof WorkbenchOptionsSchema>;
623
736
  export declare const SearchOptionsSchema: z.ZodObject<{