@innovatorved/code-lab 0.7.0 → 0.7.1

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 (129) hide show
  1. package/ARCHITECTURE.md +2 -2
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +2 -2
  4. package/dist/apps/web/src/index.d.ts +0 -9
  5. package/dist/code-lab-sql.esm.js +19 -19
  6. package/dist/code-lab-sql.umd.js +20 -20
  7. package/dist/code-lab.css +1 -1
  8. package/dist/code-lab.d.ts +1 -1
  9. package/dist/code-lab.esm.js +679 -1439
  10. package/dist/code-lab.js +678 -1438
  11. package/dist/extensions/cpp.esm.js +132 -8760
  12. package/dist/extensions/cpp.js +124 -8770
  13. package/dist/extensions/guided-lab.esm.js +33 -6836
  14. package/dist/extensions/guided-lab.js +33 -6854
  15. package/dist/extensions/javascript.esm.js +1 -36
  16. package/dist/extensions/javascript.js +1 -58
  17. package/dist/extensions/python.esm.js +79 -8118
  18. package/dist/extensions/python.js +79 -8136
  19. package/dist/extensions/typescript.esm.js +1 -55
  20. package/dist/extensions/typescript.js +1 -77
  21. package/dist/modular-kernel.d.ts +0 -4
  22. package/dist/preview-sw.js +1 -1
  23. package/dist/runtime.esm.js +77 -77
  24. package/dist/runtime.js +77 -77
  25. package/dist/schemas.d.ts +9 -0
  26. package/dist/schemas.esm.js +33 -6815
  27. package/dist/schemas.js +33 -6831
  28. package/dist/shell.esm.js +33 -33
  29. package/dist/shell.js +33 -33
  30. package/dist/terminal.esm.js +8 -6
  31. package/dist/terminal.js +6 -6
  32. package/dist/workbench/command-palette.d.ts +0 -4
  33. package/dist/workbench/index.d.ts +0 -20
  34. package/dist/workbench/intellisense.d.ts +1 -7
  35. package/package.json +3 -10
  36. package/src/code-lab.css +4 -502
  37. package/src/extensions/cpp.ts +11 -29
  38. package/src/extensions/guided-lab.ts +6 -2
  39. package/src/extensions/python.ts +9 -3
  40. package/src/modular-kernel.ts +0 -4
  41. package/src/runtime.ts +124 -39
  42. package/src/schemas.ts +2 -2
  43. package/src/shell.ts +3 -0
  44. package/src/terminal.ts +4 -2
  45. package/src/workbench/command-palette.ts +22 -302
  46. package/src/workbench/diff-editor.ts +2 -0
  47. package/src/workbench/icons.ts +1 -1
  48. package/src/workbench/index.ts +0 -15
  49. package/src/workbench/intellisense.ts +17 -4
  50. package/src/workbench.ts +68 -375
  51. package/dist/code-lab.umd.js +0 -6117
  52. package/dist/packages/editor/src/index.d.ts +0 -118
  53. package/dist/packages/preview/src/index.d.ts +0 -34
  54. package/dist/packages/runtime/src/index.d.ts +0 -47
  55. package/dist/packages/terminal/src/index.d.ts +0 -54
  56. package/dist/workbench/drawer.d.ts +0 -18
  57. package/dist/workbench/file-tree.d.ts +0 -11
  58. package/dist/workbench/guided-pane.d.ts +0 -11
  59. package/dist/workbench/styles.d.ts +0 -4
  60. package/dist/workbench/toolbar.d.ts +0 -17
  61. package/packages/commands/README.md +0 -7
  62. package/packages/commands/package.json +0 -16
  63. package/packages/commands/src/index.ts +0 -467
  64. package/packages/commands/tsconfig.json +0 -22
  65. package/packages/core/README.md +0 -12
  66. package/packages/core/package.json +0 -13
  67. package/packages/core/src/di.ts +0 -147
  68. package/packages/core/src/disposable.ts +0 -112
  69. package/packages/core/src/errors.ts +0 -205
  70. package/packages/core/src/events.ts +0 -157
  71. package/packages/core/src/index.ts +0 -49
  72. package/packages/core/src/path.ts +0 -118
  73. package/packages/core/src/registry.ts +0 -61
  74. package/packages/core/tsconfig.json +0 -19
  75. package/packages/editor/README.md +0 -9
  76. package/packages/editor/package.json +0 -18
  77. package/packages/editor/src/index.ts +0 -344
  78. package/packages/editor/tsconfig.json +0 -24
  79. package/packages/fs/README.md +0 -7
  80. package/packages/fs/package.json +0 -16
  81. package/packages/fs/src/backends.ts +0 -301
  82. package/packages/fs/src/index.ts +0 -18
  83. package/packages/fs/src/types.ts +0 -44
  84. package/packages/fs/src/vfs-service.ts +0 -257
  85. package/packages/fs/tsconfig.json +0 -22
  86. package/packages/preview/README.md +0 -3
  87. package/packages/preview/package.json +0 -16
  88. package/packages/preview/src/index.ts +0 -125
  89. package/packages/preview/tsconfig.json +0 -22
  90. package/packages/runtime/README.md +0 -3
  91. package/packages/runtime/package.json +0 -17
  92. package/packages/runtime/src/index.ts +0 -134
  93. package/packages/runtime/tsconfig.json +0 -23
  94. package/packages/settings/README.md +0 -7
  95. package/packages/settings/package.json +0 -16
  96. package/packages/settings/src/builtin-schemas.ts +0 -262
  97. package/packages/settings/src/configuration-service.ts +0 -609
  98. package/packages/settings/src/index.ts +0 -38
  99. package/packages/settings/src/jsonc.ts +0 -189
  100. package/packages/settings/src/schema.ts +0 -164
  101. package/packages/settings/tsconfig.json +0 -22
  102. package/packages/sql/README.md +0 -12
  103. package/packages/sql/package.json +0 -13
  104. package/packages/sql/src/completions.ts +0 -359
  105. package/packages/sql/src/diagnostics.ts +0 -200
  106. package/packages/sql/src/formatter.ts +0 -271
  107. package/packages/sql/src/index.ts +0 -54
  108. package/packages/sql/src/sql-editor.ts +0 -802
  109. package/packages/sql/src/styles.ts +0 -524
  110. package/packages/sql/src/tokenizer.ts +0 -457
  111. package/packages/sql/src/types.ts +0 -148
  112. package/packages/sql/tsconfig.json +0 -19
  113. package/packages/terminal/README.md +0 -3
  114. package/packages/terminal/package.json +0 -16
  115. package/packages/terminal/src/index.ts +0 -183
  116. package/packages/terminal/tsconfig.json +0 -22
  117. package/packages/ui/README.md +0 -8
  118. package/packages/ui/package.json +0 -18
  119. package/packages/ui/src/index.ts +0 -40
  120. package/packages/ui/src/observability.ts +0 -173
  121. package/packages/ui/src/plugin-registry.ts +0 -289
  122. package/packages/ui/src/settings-dialog.ts +0 -939
  123. package/packages/ui/src/themes.ts +0 -333
  124. package/packages/ui/tsconfig.json +0 -24
  125. package/src/workbench/drawer.ts +0 -157
  126. package/src/workbench/file-tree.ts +0 -51
  127. package/src/workbench/guided-pane.ts +0 -43
  128. package/src/workbench/styles.ts +0 -211
  129. package/src/workbench/toolbar.ts +0 -182
package/src/runtime.ts CHANGED
@@ -6593,7 +6593,9 @@ function __initVirtualRuntime(rootScope) {
6593
6593
  },
6594
6594
  ref() {
6595
6595
  this._ref = true;
6596
- resourceTracker.activeTimers.add(rawId);
6596
+ if (resourceTracker.allTimers.has(rawId)) {
6597
+ resourceTracker.activeTimers.add(rawId);
6598
+ }
6597
6599
  return this;
6598
6600
  },
6599
6601
  hasRef() {
@@ -8970,6 +8972,7 @@ function __initVirtualRuntime(rootScope) {
8970
8972
  'Python WebAssembly toolchain is not registered. Enable pythonExtension from "@innovatorved/code-lab/extensions/python" to run Python files.'
8971
8973
  );
8972
8974
  }
8975
+ const pyTestResultsBefore = testResults.length;
8973
8976
  const pyRes = await pyCompiler({
8974
8977
  entry: entryAbs,
8975
8978
  vfs,
@@ -8977,13 +8980,14 @@ function __initVirtualRuntime(rootScope) {
8977
8980
  args: argv || [entryAbs],
8978
8981
  env: Object.assign({}, sandboxProcess.env, options.env || {}),
8979
8982
  stdin: options.stdin || '',
8983
+ onRequestStdin: options.onRequestStdin,
8980
8984
  testFilter,
8981
8985
  onStdout: emitStdout,
8982
8986
  onStderr: emitStderr
8983
8987
  });
8984
8988
  if (pyRes) {
8985
8989
  exitCode = typeof pyRes.exitCode === 'number' ? pyRes.exitCode : (pyRes.ok ? 0 : 1);
8986
- if (pyRes.testResults && Array.isArray(pyRes.testResults)) {
8990
+ if (testResults.length === pyTestResultsBefore && pyRes.testResults && Array.isArray(pyRes.testResults)) {
8987
8991
  for (const tr of pyRes.testResults) {
8988
8992
  testResults.push(tr);
8989
8993
  }
@@ -9505,7 +9509,7 @@ function __initVirtualRuntime(rootScope) {
9505
9509
  const andParts = whereClause.split(/\s+AND\s+/i);
9506
9510
  for (const part of andParts) {
9507
9511
  const trimmed = part.trim();
9508
- const isNullMatch = trimmed.match(/^([a-zA-Z0-9_]+)\s+IS\s+(NOT\s+)?NULL$/i);
9512
+ const isNullMatch = trimmed.match(/^([a-zA-Z0-9_.]+)\s+IS\s+(NOT\s+)?NULL$/i);
9509
9513
  if (isNullMatch) {
9510
9514
  const col = isNullMatch[1];
9511
9515
  const isNot = Boolean(isNullMatch[2]);
@@ -9513,7 +9517,7 @@ function __initVirtualRuntime(rootScope) {
9513
9517
  if (isNot ? isNull : !isNull) return false;
9514
9518
  continue;
9515
9519
  }
9516
- const likeMatch = trimmed.match(/^([a-zA-Z0-9_]+)\s+LIKE\s+(.+)$/i);
9520
+ const likeMatch = trimmed.match(/^([a-zA-Z0-9_.]+)\s+LIKE\s+(.+)$/i);
9517
9521
  if (likeMatch) {
9518
9522
  const col = likeMatch[1];
9519
9523
  let pat = likeMatch[2].trim();
@@ -9523,7 +9527,7 @@ function __initVirtualRuntime(rootScope) {
9523
9527
  if (!re.test(String(row[col] ?? ''))) return false;
9524
9528
  continue;
9525
9529
  }
9526
- const eqMatch = trimmed.match(/^([a-zA-Z0-9_]+)\s*(=|!=|<>|>=|<=|>|<)\s*(.*)$/);
9530
+ const eqMatch = trimmed.match(/^([a-zA-Z0-9_.]+)\s*(=|!=|<>|>=|<=|>|<)\s*(.*)$/);
9527
9531
  if (eqMatch) {
9528
9532
  const col = eqMatch[1].trim();
9529
9533
  const op = eqMatch[2];
@@ -9670,6 +9674,37 @@ function __initVirtualRuntime(rootScope) {
9670
9674
  return null;
9671
9675
  }
9672
9676
 
9677
+ _evalSelectExpr(expr, rows, fallbackRow) {
9678
+ const trimmed = expr.trim();
9679
+ const roundMatch = trimmed.match(/^ROUND\s*\(([\s\S]+),\s*(\d+)\s*\)$/i);
9680
+ if (roundMatch) {
9681
+ const innerVal = Number(this._evalSelectExpr(roundMatch[1], rows, fallbackRow));
9682
+ const decimals = Number(roundMatch[2]);
9683
+ const factor = Math.pow(10, decimals);
9684
+ return Number.isFinite(innerVal) ? Math.round(innerVal * factor) / factor : null;
9685
+ }
9686
+ const arithMatch = trimmed.match(/^((?:AVG|SUM|COUNT|MIN|MAX)\s*\([^)]+\))\s*([/*+-])\s*([0-9.]+)$/i);
9687
+ if (arithMatch) {
9688
+ const base = Number(this._evalSelectExpr(arithMatch[1], rows, fallbackRow));
9689
+ const rhs = Number(arithMatch[3]);
9690
+ if (arithMatch[2] === '/') return rhs !== 0 ? base / rhs : null;
9691
+ if (arithMatch[2] === '*') return base * rhs;
9692
+ if (arithMatch[2] === '+') return base + rhs;
9693
+ if (arithMatch[2] === '-') return base - rhs;
9694
+ }
9695
+ const aggMatch = trimmed.match(/^(AVG|SUM|COUNT|MIN|MAX)\s*\(([^)]+)\)$/i);
9696
+ if (aggMatch) {
9697
+ return this._evalAggregate(aggMatch[1].toUpperCase(), aggMatch[2].trim(), rows);
9698
+ }
9699
+ if (fallbackRow && Object.prototype.hasOwnProperty.call(fallbackRow, trimmed)) {
9700
+ return fallbackRow[trimmed];
9701
+ }
9702
+ if (rows[0] && Object.prototype.hasOwnProperty.call(rows[0], trimmed)) {
9703
+ return rows[0][trimmed];
9704
+ }
9705
+ return null;
9706
+ }
9707
+
9673
9708
  _executeSelect(sql, params = []) {
9674
9709
  const s = stripSqlComments(sql).replace(/;$/, '').trim();
9675
9710
  if (!s) return [];
@@ -9733,7 +9768,7 @@ function __initVirtualRuntime(rootScope) {
9733
9768
  return [];
9734
9769
  }
9735
9770
 
9736
- const match = s.match(/^SELECT\s+(?:DISTINCT\s+)?([\s\S]*?)\s+FROM\s+([a-zA-Z0-9_]+)(?:\s+WHERE\s+([\s\S]*?))?(?:\s+GROUP\s+BY\s+([\s\S]*?))?(?:\s+ORDER\s+BY\s+([\s\S]*?))?(?:\s+LIMIT\s+(\d+|\?)(?:\s+OFFSET\s+(\d+|\?))?)?$/i);
9771
+ const match = s.match(/^SELECT\s+(?:DISTINCT\s+)?([\s\S]*?)\s+FROM\s+([a-zA-Z0-9_]+)(?:\s+(?:AS\s+)?(?!WHERE\b|JOIN\b|INNER\b|LEFT\b|RIGHT\b|FULL\b|CROSS\b|GROUP\b|ORDER\b|LIMIT\b)([a-zA-Z0-9_]+))?((?:\s+(?:(?:INNER|LEFT(?:\s+OUTER)?)\s+)?JOIN\s+[a-zA-Z0-9_]+(?:\s+(?:AS\s+)?(?!ON\b)[a-zA-Z0-9_]+)?\s+ON\s+[a-zA-Z0-9_.]+\s*=\s*[a-zA-Z0-9_.]+)*)(?:\s+WHERE\s+([\s\S]*?))?(?:\s+GROUP\s+BY\s+([\s\S]*?))?(?:\s+ORDER\s+BY\s+([\s\S]*?))?(?:\s+LIMIT\s+(\d+|\?)(?:\s+OFFSET\s+(\d+|\?))?)?$/i);
9737
9772
  if (!match) {
9738
9773
  const noFromMatch = s.match(/^SELECT\s+([\s\S]+)$/i);
9739
9774
  if (noFromMatch) {
@@ -9754,17 +9789,69 @@ function __initVirtualRuntime(rootScope) {
9754
9789
  }
9755
9790
  const selectColsRaw = match[1].trim();
9756
9791
  const tableName = match[2].trim();
9757
- const whereClause = match[3] ? match[3].trim() : null;
9758
- const groupByClause = match[4] ? match[4].trim() : null;
9759
- const orderByClause = match[5] ? match[5].trim() : null;
9760
- const limitRaw = match[6] ? match[6].trim() : null;
9761
- const offsetRaw = match[7] ? match[7].trim() : null;
9792
+ const tableAlias = (match[3] || tableName).trim();
9793
+ const joinsRaw = (match[4] || '').trim();
9794
+ const whereClause = match[5] ? match[5].trim() : null;
9795
+ const groupByClause = match[6] ? match[6].trim() : null;
9796
+ const orderByClause = match[7] ? match[7].trim() : null;
9797
+ const limitRaw = match[8] ? match[8].trim() : null;
9798
+ const offsetRaw = match[9] ? match[9].trim() : null;
9762
9799
 
9763
9800
  const table = this.tables.get(tableName);
9764
9801
  if (!table) return [];
9765
9802
 
9803
+ const qualifyRow = (rawRow, tblName, aliasName) => {
9804
+ const out = Object.assign({}, rawRow);
9805
+ for (const [k, v] of Object.entries(rawRow)) {
9806
+ out[`${tblName}.${k}`] = v;
9807
+ if (aliasName && aliasName !== tblName) out[`${aliasName}.${k}`] = v;
9808
+ }
9809
+ return out;
9810
+ };
9811
+
9812
+ let workingRows = table.rows.map((r) => qualifyRow(r, tableName, tableAlias));
9813
+ if (joinsRaw) {
9814
+ const joinRe = /(?:(INNER|LEFT(?:\s+OUTER)?)\s+)?JOIN\s+([a-zA-Z0-9_]+)(?:\s+(?:AS\s+)?(?!ON\b)([a-zA-Z0-9_]+))?\s+ON\s+([a-zA-Z0-9_.]+)\s*=\s*([a-zA-Z0-9_.]+)/gi;
9815
+ let jm;
9816
+ while ((jm = joinRe.exec(joinsRaw)) !== null) {
9817
+ const isLeft = Boolean(jm[1] && /^LEFT/i.test(jm[1]));
9818
+ const joinTblName = jm[2];
9819
+ const joinAlias = jm[3] || joinTblName;
9820
+ const leftKey = jm[4];
9821
+ const rightKey = jm[5];
9822
+ const joinTbl = this.tables.get(joinTblName);
9823
+ if (!joinTbl) {
9824
+ workingRows = [];
9825
+ break;
9826
+ }
9827
+ const nextRows = [];
9828
+ for (const baseRow of workingRows) {
9829
+ let matchedAny = false;
9830
+ for (const jr of joinTbl.rows) {
9831
+ const qJr = qualifyRow(jr, joinTblName, joinAlias);
9832
+ const merged = Object.assign({}, baseRow, qJr);
9833
+ const lv = Object.prototype.hasOwnProperty.call(baseRow, leftKey) ? baseRow[leftKey] : qJr[leftKey];
9834
+ const rv = Object.prototype.hasOwnProperty.call(qJr, rightKey) ? qJr[rightKey] : baseRow[rightKey];
9835
+ if (lv !== undefined && rv !== undefined && String(lv) === String(rv)) {
9836
+ nextRows.push(merged);
9837
+ matchedAny = true;
9838
+ }
9839
+ }
9840
+ if (!matchedAny && isLeft) {
9841
+ const nullPad = Object.assign({}, baseRow);
9842
+ for (const colDef of joinTbl.columns) {
9843
+ nullPad[`${joinTblName}.${colDef.name}`] = null;
9844
+ if (joinAlias !== joinTblName) nullPad[`${joinAlias}.${colDef.name}`] = null;
9845
+ }
9846
+ nextRows.push(nullPad);
9847
+ }
9848
+ }
9849
+ workingRows = nextRows;
9850
+ }
9851
+ }
9852
+
9766
9853
  const pList = Array.isArray(params) ? [...params] : [params];
9767
- const filteredRows = table.rows.filter((row) => {
9854
+ const filteredRows = workingRows.filter((row) => {
9768
9855
  const rowParams = [...pList];
9769
9856
  return this._matchWhere(row, whereClause, rowParams);
9770
9857
  });
@@ -9778,12 +9865,17 @@ function __initVirtualRuntime(rootScope) {
9778
9865
  if (selectColsRaw !== '*') {
9779
9866
  const parts = splitCsvRespectingQuotes(selectColsRaw);
9780
9867
  for (const p of parts) {
9781
- const asMatch = p.match(/^([\s\S]*?)\s+(?:AS\s+)?([a-zA-Z0-9_]+)$/i);
9782
- const isFuncWithSpace = /^(AVG|SUM|COUNT|MIN|MAX)\s*\([^)]+\)$/i.test(p.trim());
9783
- const spec = (asMatch && !isFuncWithSpace)
9784
- ? { expr: asMatch[1].trim(), alias: asMatch[2].trim() }
9785
- : { expr: p.trim(), alias: p.trim() };
9786
- if (/^(AVG|SUM|COUNT|MIN|MAX)\s*\(([^)]+)\)$/i.test(spec.expr)) {
9868
+ const asMatch = p.match(/^([\s\S]*?)\s+AS\s+([a-zA-Z0-9_]+)$/i) ||
9869
+ (!/\)/.test(p.trim()) ? p.match(/^([a-zA-Z0-9_.]+)\s+([a-zA-Z0-9_]+)$/) : null);
9870
+ const rawExpr = (asMatch ? asMatch[1] : p).trim();
9871
+ const defaultAlias = rawExpr.includes('.') && !/[()\s]/.test(rawExpr)
9872
+ ? rawExpr.split('.').pop()
9873
+ : rawExpr;
9874
+ const spec = {
9875
+ expr: rawExpr,
9876
+ alias: asMatch ? asMatch[2].trim() : defaultAlias
9877
+ };
9878
+ if (/\b(AVG|SUM|COUNT|MIN|MAX)\s*\(/i.test(spec.expr)) {
9787
9879
  hasAggregate = true;
9788
9880
  }
9789
9881
  colSpecs.push(spec);
@@ -9792,49 +9884,41 @@ function __initVirtualRuntime(rootScope) {
9792
9884
 
9793
9885
  let outputRows = [];
9794
9886
  if (groupByClause) {
9795
- const groupCol = groupByClause.trim();
9887
+ const groupCols = groupByClause.split(',').map((c) => c.trim()).filter(Boolean);
9796
9888
  const groups = new Map();
9797
9889
  for (const row of filteredRows) {
9798
- const key = row[groupCol];
9890
+ const key = groupCols.length === 1
9891
+ ? row[groupCols[0]]
9892
+ : JSON.stringify(groupCols.map((gc) => row[gc]));
9799
9893
  if (!groups.has(key)) groups.set(key, []);
9800
9894
  groups.get(key).push(row);
9801
9895
  }
9802
9896
 
9803
- for (const [key, rows] of groups.entries()) {
9897
+ for (const [, rows] of groups.entries()) {
9804
9898
  const outRow = {};
9805
9899
  for (const col of colSpecs) {
9806
- const expr = col.expr;
9807
- const alias = col.alias;
9808
- const aggMatch = expr.match(/^(AVG|SUM|COUNT|MIN|MAX)\s*\(([^)]+)\)$/i);
9809
- if (aggMatch) {
9810
- outRow[alias] = this._evalAggregate(aggMatch[1].toUpperCase(), aggMatch[2].trim(), rows);
9811
- } else if (expr === groupCol) {
9812
- outRow[alias] = key;
9813
- } else {
9814
- outRow[alias] = rows[0] ? rows[0][expr] : null;
9815
- }
9900
+ outRow[col.alias] = this._evalSelectExpr(col.expr, rows, rows[0]);
9816
9901
  }
9817
9902
  outputRows.push(outRow);
9818
9903
  }
9819
9904
  } else if (hasAggregate) {
9820
9905
  const outRow = {};
9821
9906
  for (const col of colSpecs) {
9822
- const aggMatch = col.expr.match(/^(AVG|SUM|COUNT|MIN|MAX)\s*\(([^)]+)\)$/i);
9823
- if (aggMatch) {
9824
- outRow[col.alias] = this._evalAggregate(aggMatch[1].toUpperCase(), aggMatch[2].trim(), filteredRows);
9825
- } else {
9826
- outRow[col.alias] = filteredRows[0] ? filteredRows[0][col.expr] : null;
9827
- }
9907
+ outRow[col.alias] = this._evalSelectExpr(col.expr, filteredRows, filteredRows[0]);
9828
9908
  }
9829
9909
  outputRows.push(outRow);
9830
9910
  } else {
9831
9911
  for (const row of filteredRows) {
9832
9912
  if (selectColsRaw === '*') {
9833
- outputRows.push(Object.assign({}, row));
9913
+ const clean = {};
9914
+ for (const [k, v] of Object.entries(row)) {
9915
+ if (!k.includes('.')) clean[k] = v;
9916
+ }
9917
+ outputRows.push(clean);
9834
9918
  } else {
9835
9919
  const outRow = {};
9836
9920
  for (const col of colSpecs) {
9837
- outRow[col.alias] = row[col.expr];
9921
+ outRow[col.alias] = this._evalSelectExpr(col.expr, [row], row);
9838
9922
  }
9839
9923
  outputRows.push(outRow);
9840
9924
  }
@@ -10283,6 +10367,7 @@ _hostRuntime.executeInWorker = async function executeInWorker(options = {}) {
10283
10367
  if (options.signal.aborted) {
10284
10368
  const job = _activeWorkerJobs.get(requestId);
10285
10369
  if (job) job.cancel('SIGINT: Interrupted by user (Ctrl+C)');
10370
+ return;
10286
10371
  } else {
10287
10372
  abortListener = () => {
10288
10373
  const job = _activeWorkerJobs.get(requestId);
package/src/schemas.ts CHANGED
@@ -22,7 +22,7 @@ export type GuidedStep = z.infer<typeof GuidedStepSchema>;
22
22
 
23
23
  // ── 2. Language Bundle ──────────────────────────────────────────────────────
24
24
 
25
- export const LanguageIdSchema = z.enum(['js', 'ts', 'cpp', 'py']);
25
+ export const LanguageIdSchema = z.enum(['js', 'ts', 'cpp', 'py', 'sql']);
26
26
  export type LanguageId = z.infer<typeof LanguageIdSchema>;
27
27
  export const LanguageEnum = LanguageIdSchema;
28
28
 
@@ -100,7 +100,7 @@ export const CppExtensionOptionsSchema = z.object({
100
100
  export type CppExtensionOptions = z.input<typeof CppExtensionOptionsSchema>;
101
101
 
102
102
  export const PythonToolchainProgressSchema = z.object({
103
- stage: z.enum(['downloading', 'caching', 'extracting', 'initializing', 'ready']),
103
+ stage: z.enum(['downloading', 'caching', 'extracting', 'initializing', 'ready', 'error']),
104
104
  loadedBytes: z.number().optional(),
105
105
  totalBytes: z.number().optional(),
106
106
  percent: z.number().optional(),
package/src/shell.ts CHANGED
@@ -10504,6 +10504,8 @@
10504
10504
  vfs: this.vfs,
10505
10505
  portTable: this.portTable,
10506
10506
  gitState: this.gitState,
10507
+ _initialBootRoot: this._initialBootRoot,
10508
+ _initialBootSnapshot: this._initialBootSnapshot,
10507
10509
  env: Object.assign({}, this.env, innerCtx.env || {})
10508
10510
  });
10509
10511
  subShell.cwd = innerCtx.cwd || this.cwd;
@@ -10826,6 +10828,7 @@
10826
10828
  res = await this.commands[cmdName](args, cmdCtx);
10827
10829
  if (cmdName === 'export' || cmdName === 'unset' || cmdName === 'cd' || cmdName === 'read') {
10828
10830
  for (const k of Object.keys(context.env)) {
10831
+ if (/^(\d+|#|@|\*)$/.test(k)) continue;
10829
10832
  if (!(k in this.env)) delete context.env[k];
10830
10833
  }
10831
10834
  Object.assign(context.env, this.env);
package/src/terminal.ts CHANGED
@@ -1008,7 +1008,7 @@
1008
1008
  return;
1009
1009
  }
1010
1010
 
1011
- if (key === 'Home' || (isCtrl && (key === 'a' || key === 'A'))) {
1011
+ if (key === 'Home' || (e.ctrlKey && !e.metaKey && (key === 'a' || key === 'A'))) {
1012
1012
  if (e.preventDefault) e.preventDefault();
1013
1013
  this.cursor = 0;
1014
1014
  this.updateActiveLine();
@@ -1141,9 +1141,10 @@
1141
1141
  this.buffer = this.buffer.slice(0, this.cursor) + seg + this.buffer.slice(this.cursor);
1142
1142
  this.cursor = this.buffer.length;
1143
1143
  this.submitLine();
1144
- while (this.isCommandRunning()) {
1144
+ while (this._mounted && this.isCommandRunning()) {
1145
1145
  await new Promise((r) => setTimeout(r, 10));
1146
1146
  }
1147
+ if (!this._mounted) return;
1147
1148
  } else if (seg.length > 0) {
1148
1149
  this.buffer = seg;
1149
1150
  this.cursor = seg.length;
@@ -1379,6 +1380,7 @@
1379
1380
  parseAnsiToHtml,
1380
1381
  escapeHtml,
1381
1382
  ANSI_CODE_MAP,
1383
+ ansi256ToColor,
1382
1384
  resolveAnsiControlCodes
1383
1385
  };
1384
1386
  });