@innovatorved/code-lab 0.1.6 → 0.1.7

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.
@@ -17,6 +17,49 @@
17
17
  const PREVIEW_PREFIX = '/__preview/';
18
18
  const DISPATCH_TIMEOUT_MS = 15000;
19
19
 
20
+ // Content-Security-Policy applied to every HTML preview response.
21
+ //
22
+ // The preview is untrusted user code. Inline/eval are allowed because previews
23
+ // are built from arbitrary user source, but network access is restricted to
24
+ // the preview origin plus data:/blob: so a preview cannot exfiltrate host data
25
+ // to a third party. Keep this string in sync with PREVIEW_CSP in workbench.js.
26
+ const PREVIEW_CSP = [
27
+ "default-src 'self' data: blob:",
28
+ "base-uri 'self'",
29
+ "object-src 'none'",
30
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:",
31
+ "style-src 'self' 'unsafe-inline'",
32
+ "img-src 'self' data: blob:",
33
+ "font-src 'self' data:",
34
+ "connect-src 'self' data: blob:",
35
+ "media-src 'self' data: blob:",
36
+ "worker-src 'self' blob:",
37
+ "frame-src 'self' data: blob:",
38
+ "form-action 'self'",
39
+ "frame-ancestors 'self'"
40
+ ].join('; ');
41
+
42
+ function injectPreviewHead(html, port) {
43
+ const tags = [];
44
+ if (!/<meta[^>]+http-equiv=["']?content-security-policy/i.test(html)) {
45
+ tags.push(`<meta http-equiv="Content-Security-Policy" content="${PREVIEW_CSP}">`);
46
+ }
47
+ if (!/<base\b/i.test(html)) {
48
+ tags.push(`<base href="${PREVIEW_PREFIX}${port}/">`);
49
+ }
50
+ if (tags.length === 0) return html;
51
+
52
+ const injection = tags.join('');
53
+ if (/<head\b[^>]*>/i.test(html)) {
54
+ return html.replace(/<head\b[^>]*>/i, (match) => match + injection);
55
+ }
56
+ if (/<html\b[^>]*>/i.test(html)) {
57
+ return html.replace(/<html\b[^>]*>/i, (match) => `${match}<head>${injection}</head>`);
58
+ }
59
+ return `<head>${injection}</head>${html}`;
60
+ }
61
+
62
+
20
63
  self.addEventListener('install', () => {
21
64
  self.skipWaiting();
22
65
  });
@@ -32,12 +75,18 @@ function parsePreviewPath(pathname) {
32
75
  }
33
76
 
34
77
  function previewErrorResponse(status, title, message) {
35
- const body = `<!doctype html><meta charset="utf-8"><title>${title}</title>` +
78
+ const body = `<!doctype html><meta charset="utf-8">` +
79
+ `<meta http-equiv="Content-Security-Policy" content="${PREVIEW_CSP}">` +
80
+ `<title>${title}</title>` +
36
81
  `<body style="font-family:system-ui,-apple-system,sans-serif;padding:32px;color:#666;background:#0a0a0a">` +
37
82
  `<h1 style="color:#e5e5e5;font-size:18px">${title}</h1><p>${message}</p></body>`;
38
83
  return new Response(body, {
39
84
  status,
40
- headers: { 'Content-Type': 'text/html; charset=utf-8' }
85
+ headers: {
86
+ 'Content-Type': 'text/html; charset=utf-8',
87
+ 'Content-Security-Policy': PREVIEW_CSP,
88
+ 'X-Content-Type-Options': 'nosniff'
89
+ }
41
90
  });
42
91
  }
43
92
 
@@ -102,13 +151,12 @@ async function proxyVirtualRequest(event, port, targetPath) {
102
151
  const responseHeaders = new Headers((response && response.headers) || {});
103
152
  const contentType = responseHeaders.get('content-type') || '';
104
153
 
105
- // Inject a <base> so relative asset URLs in HTML responses resolve under the
106
- // `/__preview/:port/` namespace rather than the host document root.
154
+ // Inject a CSP and a <base> so relative asset URLs in HTML responses resolve
155
+ // under the `/__preview/:port/` namespace rather than the host document root.
107
156
  if (/text\/html/i.test(contentType) && typeof responseBody === 'string') {
108
- const baseTag = `<base href="${PREVIEW_PREFIX}${port}/">`;
109
- if (!/<base\b/i.test(responseBody) && /<head\b/i.test(responseBody)) {
110
- responseBody = responseBody.replace(/<head\b[^>]*>/i, (match) => match + baseTag);
111
- }
157
+ responseBody = injectPreviewHead(responseBody, port);
158
+ responseHeaders.set('Content-Security-Policy', PREVIEW_CSP);
159
+ responseHeaders.set('X-Content-Type-Options', 'nosniff');
112
160
  }
113
161
 
114
162
  return new Response(responseBody, {
package/dist/runtime.d.ts CHANGED
@@ -1,26 +1,4 @@
1
- declare const _hostRuntime: any;
2
- export interface RuntimeExecutionResult {
3
- ok: boolean;
4
- exitCode: number;
5
- durationMs: number;
6
- stdout: string;
7
- stderr: string;
8
- testResults: any[];
9
- fsSnapshot: any[];
10
- httpTrace: any[];
11
- error?: {
12
- message: string;
13
- stack?: string;
14
- };
15
- outputTruncated?: boolean;
16
- replValue?: any;
17
- cancelled?: boolean;
18
- testSummary?: {
19
- total: number;
20
- passed: number;
21
- failed: number;
22
- };
23
- }
1
+ declare const _runtimeApi: any;
24
2
  export declare const VirtualBuffer: any;
25
3
  export declare const VirtualCrypto: any;
26
4
  export declare const VirtualZlib: any;
@@ -42,8 +20,9 @@ export declare const transpileTS: (code: string, filename?: string) => string;
42
20
  export declare const transpileForBrowser: (source: string, filename?: string) => string;
43
21
  export declare const preloadNpmPackages: (files?: Record<string, any>, onProgressOrCache?: ((pkg: string) => void) | Map<string, string>, onProgress?: (pkg: string) => void) => Promise<Record<string, string>>;
44
22
  export declare const createVirtualPortTable: () => any;
45
- export declare const executeInVirtualRuntime: (options?: any) => Promise<RuntimeExecutionResult>;
46
- export declare const createWorkerRuntimeSource: () => string;
23
+ export declare const executeInVirtualRuntime: (options?: any) => Promise<any>;
24
+ declare const createWorkerRuntimeSourceExport: () => string;
25
+ export { createWorkerRuntimeSourceExport as createWorkerRuntimeSource };
47
26
  export declare const cancelWorkerExecution: (reason?: string, instanceId?: string) => boolean;
48
- export declare const executeInWorker: (options?: any) => Promise<RuntimeExecutionResult>;
49
- export default _hostRuntime;
27
+ export declare const executeInWorker: (options?: any) => Promise<any>;
28
+ export default _runtimeApi;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -16,6 +16,7 @@
16
16
  */
17
17
  const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {};
18
18
  (function () {
19
+ // @ts-nocheck
19
20
  'use strict';
20
21
  if (typeof globalThis !== 'undefined' && typeof globalThis.Bun === 'undefined') {
21
22
  globalThis.Bun = { version: '1.1.20' };
@@ -8246,6 +8247,7 @@ if (typeof module !== 'undefined' && module.exports) {
8246
8247
  }
8247
8248
 
8248
8249
 
8250
+
8249
8251
  })();
8250
8252
 
8251
8253
  const CodeLabRuntime = _root.CodeLabRuntime;
package/dist/runtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -17,6 +17,7 @@
17
17
  (function (root) {
18
18
  'use strict';
19
19
  (function () {
20
+ // @ts-nocheck
20
21
  'use strict';
21
22
  if (typeof globalThis !== 'undefined' && typeof globalThis.Bun === 'undefined') {
22
23
  globalThis.Bun = { version: '1.1.20' };
@@ -8247,6 +8248,7 @@ if (typeof module !== 'undefined' && module.exports) {
8247
8248
  }
8248
8249
 
8249
8250
 
8251
+
8250
8252
  })();
8251
8253
 
8252
8254
  if (typeof module !== 'undefined' && module.exports) {
package/dist/schemas.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Zod Schemas and Inferred TypeScript Types for code-lab v2.0.0
3
+ * Zod Schemas and Inferred TypeScript Types for code-lab v0.1.7
4
4
  */
5
5
  export declare const GuidedStepSchema: z.ZodObject<{
6
6
  id: z.ZodString;
@@ -369,6 +369,9 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
369
369
  testFile: z.ZodOptional<z.ZodString>;
370
370
  backLabel: z.ZodDefault<z.ZodString>;
371
371
  monacoUrl: z.ZodOptional<z.ZodString>;
372
+ previewOrigin: z.ZodOptional<z.ZodString>;
373
+ logger: z.ZodOptional<z.ZodAny>;
374
+ debug: z.ZodOptional<z.ZodBoolean>;
372
375
  onClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
373
376
  onRun: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
374
377
  onTestResult: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
@@ -459,6 +462,9 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
459
462
  testFile?: string;
460
463
  backLabel?: string;
461
464
  monacoUrl?: string;
465
+ previewOrigin?: string;
466
+ logger?: any;
467
+ debug?: boolean;
462
468
  onClose?: (...args: unknown[]) => void;
463
469
  onRun?: (args_0: any, ...args: unknown[]) => void;
464
470
  onCodeChange?: (args_0: string, args_1: string, ...args: unknown[]) => void;
@@ -505,6 +511,9 @@ export declare const WorkbenchOptionsSchema: z.ZodObject<{
505
511
  testFile?: string;
506
512
  backLabel?: string;
507
513
  monacoUrl?: string;
514
+ previewOrigin?: string;
515
+ logger?: any;
516
+ debug?: boolean;
508
517
  onClose?: (...args: unknown[]) => void;
509
518
  onRun?: (args_0: any, ...args: unknown[]) => void;
510
519
  onCodeChange?: (args_0: string, args_1: string, ...args: unknown[]) => void;
@@ -4157,6 +4157,9 @@ var WorkbenchOptionsSchema = external_exports.object({
4157
4157
  testFile: external_exports.string().optional(),
4158
4158
  backLabel: external_exports.string().default("Back"),
4159
4159
  monacoUrl: external_exports.string().optional(),
4160
+ previewOrigin: external_exports.string().optional(),
4161
+ logger: external_exports.any().optional(),
4162
+ debug: external_exports.boolean().optional(),
4160
4163
  onClose: external_exports.function().returns(external_exports.void()).optional(),
4161
4164
  onRun: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional(),
4162
4165
  onTestResult: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional(),
package/dist/schemas.js CHANGED
@@ -4184,6 +4184,9 @@ var WorkbenchOptionsSchema = external_exports.object({
4184
4184
  testFile: external_exports.string().optional(),
4185
4185
  backLabel: external_exports.string().default("Back"),
4186
4186
  monacoUrl: external_exports.string().optional(),
4187
+ previewOrigin: external_exports.string().optional(),
4188
+ logger: external_exports.any().optional(),
4189
+ debug: external_exports.boolean().optional(),
4187
4190
  onClose: external_exports.function().returns(external_exports.void()).optional(),
4188
4191
  onRun: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional(),
4189
4192
  onTestResult: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional(),
package/dist/shell.d.ts CHANGED
@@ -1,56 +1,27 @@
1
1
  /**
2
- * @innovatorved/code-lab - POSIX Shell Engine & UNIX Coreutils (TypeScript)
2
+ * @innovatorved/code-lab - POSIX Shell Engine & UNIX Coreutils
3
3
  *
4
4
  * Full-fidelity, CSP-safe POSIX shell AST interpreter and 35+ standard UNIX
5
5
  * coreutils operating directly on the in-memory virtual filesystem (VFS).
6
6
  *
7
+ * Capabilities:
8
+ * - Deterministic lexer and AST parser (zero dynamic eval, zero new Function)
9
+ * - Pipelines (cmd1 | cmd2 | cmd3) with streaming stdin/stdout chaining
10
+ * - Output redirection (>, >>, 1>, 2>, 2>&1, 1>&2, &>)
11
+ * - Input redirection (<, 0<)
12
+ * - Logical operators (&&, ||, ;)
13
+ * - Background job execution (cmd &) with job table & PID tracking
14
+ * - Variable expansion ($VAR, ${VAR}, ${VAR:-def}, $?, $PWD, $HOME, $USER)
15
+ * - Command substitution ($(cmd), `cmd`)
16
+ * - Glob expansion (*.js, src/**\/*.ts, [0-9]*.txt) against VFS
17
+ * - 40+ UNIX coreutils (ls, cd, pwd, cat, head, tail, grep, find, wc, sort, uniq,
18
+ * sed, awk, cut, tr, diff, tree, cp, mv, rm, mkdir, touch, chmod, stat, echo,
19
+ * printf, env, export, unset, which, whoami, uname, date, sleep, true, false,
20
+ * clear, history, ps, jobs, kill, git, help, dirname, basename, seq, tee)
21
+ * - Bidirectional VFS mutation bridge (touch, mkdir, rm, mv, cp, echo >, sed -i)
22
+ *
7
23
  * (C) 2026 InnovatorVed / CodeLab. MIT License.
8
24
  */
9
- import type { CloneProgressEvent, CloneProgressPhase, GitHubCloneOptions } from './schemas.js';
10
- export type { CloneProgressEvent, CloneProgressPhase, GitHubCloneOptions };
11
- export interface CloneResult {
12
- owner: string;
13
- repo: string;
14
- branch: string;
15
- url: string;
16
- targetDir: string;
17
- count: number;
18
- fileCount: number;
19
- filesWritten: number;
20
- totalBytes: number;
21
- commits: Array<{
22
- hash: string;
23
- author: string;
24
- date: string;
25
- message: string;
26
- }>;
27
- headSnapshot: Record<string, string>;
28
- }
29
- export interface ShellExecResult {
30
- code: number;
31
- exitCode?: number;
32
- ok?: boolean;
33
- stdout: string;
34
- stderr: string;
35
- controlFlow?: {
36
- type: string;
37
- count?: number;
38
- code?: number;
39
- };
40
- aborted?: boolean;
41
- }
42
- export interface ShellExecOptions {
43
- cwd?: string;
44
- env?: Record<string, string>;
45
- vfs?: any;
46
- portTable?: any;
47
- onStdout?: (chunk: string) => void;
48
- onStderr?: (chunk: string) => void;
49
- stdin?: string;
50
- fetchImpl?: any;
51
- onProgress?: (event: CloneProgressEvent) => void;
52
- signal?: AbortSignal;
53
- }
54
25
  declare const _hostShell: any;
55
26
  export declare const createPosixShell: (options?: any) => any;
56
27
  export declare const parseShellCommand: (cmd: string) => any;
@@ -61,6 +32,6 @@ export declare const PosixPath: any;
61
32
  export declare const expandGlob: (pattern: string, vfs: any, cwd?: string) => string[];
62
33
  export declare const createVirtualPortTable: () => any;
63
34
  export declare const parseGitHubRepoUrl: (input: string) => any;
64
- export declare const cloneGitHubRepository: (repoInput: string, vfs: any, options?: GitHubCloneOptions) => Promise<CloneResult>;
35
+ export declare const cloneGitHubRepository: (repoInput: string, vfs: any, options?: any) => Promise<any>;
65
36
  export declare const CodeLabShell: any;
66
37
  export default _hostShell;
package/dist/shell.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -16,6 +16,7 @@
16
16
  */
17
17
  const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {};
18
18
  (function () {
19
+ // @ts-nocheck
19
20
  /**
20
21
  * @innovatorved/code-lab - POSIX Shell Engine & UNIX Coreutils
21
22
  *
@@ -2003,7 +2004,7 @@ const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !==
2003
2004
  return 10 + depth * 0.1;
2004
2005
  }
2005
2006
 
2006
- async function cloneGitHubRepository(repoInput, vfs, options = {}) {
2007
+ async function _cloneGitHubRepository(repoInput, vfs, options = {}) {
2007
2008
  const onProgress = typeof options.onProgress === 'function' ? options.onProgress : null;
2008
2009
  if (onProgress) {
2009
2010
  onProgress({ phase: 'connecting', message: `Connecting to repository '${repoInput}'...` });
@@ -2293,6 +2294,23 @@ const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !==
2293
2294
  };
2294
2295
  }
2295
2296
 
2297
+ // Public wrapper: guarantee an `error` progress event when the clone fails
2298
+ // for any reason (invalid URL, missing vfs, fetch rejection, abort, ...).
2299
+ async function cloneGitHubRepository(repoInput, vfs, options = {}) {
2300
+ const onProgress = typeof options.onProgress === 'function' ? options.onProgress : null;
2301
+ try {
2302
+ return await _cloneGitHubRepository(repoInput, vfs, options);
2303
+ } catch (err) {
2304
+ if (onProgress) {
2305
+ onProgress({
2306
+ phase: 'error',
2307
+ message: err && err.message ? err.message : String(err)
2308
+ });
2309
+ }
2310
+ throw err;
2311
+ }
2312
+ }
2313
+
2296
2314
  // =========================================================================
2297
2315
  // Package Management Helpers (npm / bun virtual modules & scripts)
2298
2316
  // =========================================================================
@@ -7274,6 +7292,7 @@ const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !==
7274
7292
  };
7275
7293
  });
7276
7294
 
7295
+
7277
7296
  })();
7278
7297
 
7279
7298
  const CodeLabShell = _root.CodeLabShell;
package/dist/shell.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -17,6 +17,7 @@
17
17
  (function (root) {
18
18
  'use strict';
19
19
  (function () {
20
+ // @ts-nocheck
20
21
  /**
21
22
  * @innovatorved/code-lab - POSIX Shell Engine & UNIX Coreutils
22
23
  *
@@ -2004,7 +2005,7 @@
2004
2005
  return 10 + depth * 0.1;
2005
2006
  }
2006
2007
 
2007
- async function cloneGitHubRepository(repoInput, vfs, options = {}) {
2008
+ async function _cloneGitHubRepository(repoInput, vfs, options = {}) {
2008
2009
  const onProgress = typeof options.onProgress === 'function' ? options.onProgress : null;
2009
2010
  if (onProgress) {
2010
2011
  onProgress({ phase: 'connecting', message: `Connecting to repository '${repoInput}'...` });
@@ -2294,6 +2295,23 @@
2294
2295
  };
2295
2296
  }
2296
2297
 
2298
+ // Public wrapper: guarantee an `error` progress event when the clone fails
2299
+ // for any reason (invalid URL, missing vfs, fetch rejection, abort, ...).
2300
+ async function cloneGitHubRepository(repoInput, vfs, options = {}) {
2301
+ const onProgress = typeof options.onProgress === 'function' ? options.onProgress : null;
2302
+ try {
2303
+ return await _cloneGitHubRepository(repoInput, vfs, options);
2304
+ } catch (err) {
2305
+ if (onProgress) {
2306
+ onProgress({
2307
+ phase: 'error',
2308
+ message: err && err.message ? err.message : String(err)
2309
+ });
2310
+ }
2311
+ throw err;
2312
+ }
2313
+ }
2314
+
2297
2315
  // =========================================================================
2298
2316
  // Package Management Helpers (npm / bun virtual modules & scripts)
2299
2317
  // =========================================================================
@@ -7275,6 +7293,7 @@
7275
7293
  };
7276
7294
  });
7277
7295
 
7296
+
7278
7297
  })();
7279
7298
 
7280
7299
  if (typeof module !== 'undefined' && module.exports) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @innovatorved/code-lab - Pure-JS/TS PTY Terminal Emulator Component
2
+ * @innovatorved/code-lab - Pure-JS PTY Terminal Emulator Component
3
3
  *
4
4
  * High-fidelity, self-contained terminal emulator engine providing:
5
5
  * - Inline prompt with cwd awareness (codelab:${cwd}$ )
@@ -13,90 +13,14 @@
13
13
  *
14
14
  * (C) 2026 InnovatorVed / CodeLab. MIT License.
15
15
  */
16
- export interface TerminalLogItem {
17
- text: string;
18
- type?: string;
19
- }
20
- export interface CompletionResult {
21
- matches: string[];
22
- token: string;
23
- tokenStart: number;
24
- }
25
- export interface TerminalOptions {
26
- container?: any;
27
- logs?: TerminalLogItem[];
28
- cwd?: string;
29
- replMode?: boolean;
30
- prompt?: string | null;
31
- history?: string[];
32
- onCommand?: ((command: string) => void) | null;
33
- getCompletions?: ((buffer: string, cursor: number) => CompletionResult | null) | null;
34
- onKey?: ((event: any) => boolean | void) | null;
35
- onInterrupt?: (() => void) | null;
36
- }
16
+ declare const _hostTerminal: any;
37
17
  export declare const ANSI_CODE_MAP: Record<number, string>;
38
- export declare const ANSI_256_PALETTE: string[];
39
- export declare function ansi256ToColor(n: number | string): string | null;
40
- export declare function escapeHtml(str: any): string;
41
- export declare function resolveAnsiControlCodes(raw: any): string;
42
- export declare function ansiToHtml(str: any): string;
43
- export declare const parseAnsiToHtml: typeof ansiToHtml;
44
- export declare class PTYTerminalEngine {
45
- container: any;
46
- options: TerminalOptions;
47
- logs: TerminalLogItem[];
48
- cwd: string;
49
- replMode: boolean;
50
- promptOverride: string | null;
51
- history: string[];
52
- historyIdx: number;
53
- savedBuffer: string;
54
- buffer: string;
55
- cursor: number;
56
- searchMode: boolean;
57
- searchQuery: string;
58
- searchMatchIdx: number;
59
- _readLineQueue: Array<(line: string) => void>;
60
- onCommand: ((command: string) => void) | null;
61
- getCompletions: ((buffer: string, cursor: number) => CompletionResult | null) | null;
62
- onKey: ((event: any) => boolean | void) | null;
63
- onInterrupt: (() => void) | null;
64
- _activeLineCommitted: boolean;
65
- _cursorCol: number;
66
- _pendingEscape: string;
67
- _targetLineIdx: number;
68
- _needsRewrite: boolean;
69
- _activeLineEl: any;
70
- _mounted: boolean;
71
- _listeners: Array<any>;
72
- constructor(container?: any, options?: TerminalOptions);
73
- getPrompt(): string;
74
- setPrompt(p: string | null): void;
75
- setCwd(cwd: string): void;
76
- setReplMode(enabled: boolean): void;
77
- writeStreamChunk(data: any, type?: string): void;
78
- write(data: any, type?: string): void;
79
- writeln(data: any, type?: string): void;
80
- _getActiveLine(type: string): TerminalLogItem;
81
- _appendDomLine(line: TerminalLogItem): void;
82
- _updateActiveDomLine(): void;
83
- _getActiveLineSync(): TerminalLogItem | null;
84
- _scrollToBottom(): void;
85
- clear(): void;
86
- getHistory(): string[];
87
- readLine(promptText?: string): Promise<string>;
88
- focus(): void;
89
- mount(container: any): void;
90
- _cleanupListeners(): void;
91
- destroy(): void;
92
- _addListener(target: any, type: string, handler: any): void;
93
- _bindEvents(): void;
94
- _findReverseSearchMatch(query: string, startIdx?: number): number;
95
- handleKeyDown(e: any): void;
96
- autoComplete(): void;
97
- submitLine(): void;
98
- updateActiveLine(): void;
99
- render(): void;
100
- }
101
- export declare function createTerminal(container?: any, options?: TerminalOptions): PTYTerminalEngine;
102
- export declare const createPTYTerminalEngine: typeof createTerminal;
18
+ export declare const ansi256ToColor: (n: number | string) => string | null;
19
+ export declare const escapeHtml: (str: any) => string;
20
+ export declare const resolveAnsiControlCodes: (raw: any) => string;
21
+ export declare const ansiToHtml: (str: any) => string;
22
+ export declare const parseAnsiToHtml: (str: any) => string;
23
+ export declare const PTYTerminalEngine: any;
24
+ export declare const createTerminal: (container?: any, options?: any) => any;
25
+ export declare const createPTYTerminalEngine: (container?: any, options?: any) => any;
26
+ export default _hostTerminal;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -16,6 +16,7 @@
16
16
  */
17
17
  const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {};
18
18
  (function () {
19
+ // @ts-nocheck
19
20
  /**
20
21
  * @innovatorved/code-lab - Pure-JS PTY Terminal Emulator Component
21
22
  *
@@ -1063,6 +1064,7 @@ const _root = typeof globalThis !== 'undefined' ? globalThis : typeof window !==
1063
1064
  };
1064
1065
  });
1065
1066
 
1067
+
1066
1068
  })();
1067
1069
 
1068
1070
  const CodeLabTerminal = _root.CodeLabTerminal;
package/dist/terminal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v2.0.0 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.1.7 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -17,6 +17,7 @@
17
17
  (function (root) {
18
18
  'use strict';
19
19
  (function () {
20
+ // @ts-nocheck
20
21
  /**
21
22
  * @innovatorved/code-lab - Pure-JS PTY Terminal Emulator Component
22
23
  *
@@ -1064,6 +1065,7 @@
1064
1065
  };
1065
1066
  });
1066
1067
 
1068
+
1067
1069
  })();
1068
1070
 
1069
1071
  if (typeof module !== 'undefined' && module.exports) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovatorved/code-lab",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Standalone browser-native IDE Workbench, POSIX Shell & Coreutils, PTY Terminal, and Web Worker Node.js/Bun Virtual Runtime.",
5
5
  "main": "./dist/code-lab.js",
6
6
  "module": "./dist/code-lab.esm.js",
@@ -72,14 +72,20 @@
72
72
  "scripts": {
73
73
  "build": "bun run tools/bundle.js",
74
74
  "typecheck": "bun x tsc --noEmit",
75
- "test": "bun run tests/test-all-builds.js",
76
- "test:all": "bun run tools/bundle.js && bun run tests/test-all-builds.js && bun run tests/test-runtime-advanced.js && bun run tests/test-option1-shell-bun-http.js && bun run tests/test-frameworks.js && bun run tests/test-esm-exports.js && bun run tests/test-installer-integrity.js && bun run tests/test-coreutils-adversarial.js && bun run tests/test-stress-shell.js && bun run tests/test-workbench-ui.js && bun run tests/test-terminal-streaming.js && bun run tests/test-git-clone-streaming.js && bun run tests/test-m1-adversarial-challenger.js && bun run tests/test-m1-interruption-lifecycle-stress.js && bun run tests/test-gfm-markdown.js && bun run tests/test-m2-adversarial-syntax.js && bun run tests/test-m2-adversarial-interactive.js && bun run tests/test-web-preview.js && bun run tests/test-preview-sw.js",
75
+ "test": "bun run tools/bundle.js && bun run tests/run-all.js",
76
+ "test:all": "bun run test",
77
+ "test:unit": "bun run tests/run-all.js --filter=test-",
78
+ "test:e2e": "bun run tools/bundle.js && bun run tests/e2e/run-all-e2e.js",
79
+ "test:browser": "bunx playwright test --project=chromium",
80
+ "test:browser:all": "bunx playwright test",
81
+ "test:browser:install": "bunx playwright install --with-deps chromium firefox webkit",
77
82
  "pack:check": "bun pm pack --dry-run"
78
83
  },
79
84
  "dependencies": {
80
85
  "zod": "^3.23.8"
81
86
  },
82
87
  "devDependencies": {
88
+ "@playwright/test": "^1.64.1",
83
89
  "@types/node": "^22.7.5",
84
90
  "esbuild": "^0.24.0",
85
91
  "typescript": "^5.6.3"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @innovatorved/code-lab v2.0.0
2
+ * @innovatorved/code-lab v0.1.7
3
3
  * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, and Git Engine.
4
4
  */
5
5