@nimbus-sh/core 0.4.0 → 0.5.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 (121) hide show
  1. package/README.md +35 -7
  2. package/dist/_shared/error-text.d.ts +15 -0
  3. package/dist/_shared/error-text.d.ts.map +1 -0
  4. package/dist/_shared/error-text.js +21 -0
  5. package/dist/_shared/exports-resolver.d.ts +19 -7
  6. package/dist/_shared/exports-resolver.d.ts.map +1 -1
  7. package/dist/_shared/exports-resolver.js +1 -1
  8. package/dist/_shared/retry.d.ts.map +1 -1
  9. package/dist/_shared/retry.js +3 -1
  10. package/dist/_shared/w7-frame.js +2 -1
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +30 -16
  13. package/dist/observability/oom-classify.d.ts +1 -1
  14. package/dist/observability/oom-classify.d.ts.map +1 -1
  15. package/dist/observability/oom-classify.js +7 -0
  16. package/dist/observability/oom-discriminator.d.ts +1 -1
  17. package/dist/runtime/esbuild-service.d.ts +4 -3
  18. package/dist/runtime/esbuild-service.d.ts.map +1 -1
  19. package/dist/runtime/esbuild-service.js +9 -4
  20. package/dist/runtime/installed-runtimes.d.ts +4 -3
  21. package/dist/runtime/installed-runtimes.d.ts.map +1 -1
  22. package/dist/runtime/long-running-handle.d.ts +3 -3
  23. package/dist/runtime/long-running-handle.d.ts.map +1 -1
  24. package/dist/runtime/os-contracts.d.ts +7 -5
  25. package/dist/runtime/os-contracts.d.ts.map +1 -1
  26. package/dist/runtime/port-registry.d.ts +28 -0
  27. package/dist/runtime/port-registry.d.ts.map +1 -1
  28. package/dist/runtime/port-registry.js +79 -9
  29. package/dist/runtime/process-logs.d.ts +9 -1
  30. package/dist/runtime/process-logs.d.ts.map +1 -1
  31. package/dist/runtime/project-detect.d.ts +6 -1
  32. package/dist/runtime/project-detect.d.ts.map +1 -1
  33. package/dist/runtime/require-resolver.d.ts.map +1 -1
  34. package/dist/runtime/require-resolver.js +3 -4
  35. package/dist/runtime/runtime-registry.d.ts +4 -3
  36. package/dist/runtime/runtime-registry.d.ts.map +1 -1
  37. package/dist/runtime/runtime-registry.js +2 -1
  38. package/dist/runtime/sqlite-runtime-fs-bridge.js +1 -5
  39. package/dist/runtime/virtual-socket-kernel.d.ts.map +1 -1
  40. package/dist/runtime/virtual-socket-kernel.generated.d.ts +1 -1
  41. package/dist/runtime/virtual-socket-kernel.generated.d.ts.map +1 -1
  42. package/dist/runtime/virtual-socket-kernel.generated.js +2 -2
  43. package/dist/runtime/virtual-socket-kernel.js +10 -5
  44. package/dist/runtime/wasm-runner.d.ts.map +1 -1
  45. package/dist/runtime/wasm-runner.js +22 -14
  46. package/dist/shell/features.d.ts.map +1 -1
  47. package/dist/shell/features.js +5 -4
  48. package/dist/shell/unix-commands.d.ts +14 -1
  49. package/dist/shell/unix-commands.d.ts.map +1 -1
  50. package/dist/shell/unix-commands.js +115 -69
  51. package/dist/substrate/lifo/commands/net/ip.d.ts.map +1 -1
  52. package/dist/substrate/lifo/commands/system/ps.d.ts +2 -1
  53. package/dist/substrate/lifo/commands/system/ps.d.ts.map +1 -1
  54. package/dist/substrate/lifo/kernel/ServiceManager.d.ts.map +1 -1
  55. package/dist/substrate/lifo/kernel/ServiceManager.js +0 -2
  56. package/dist/substrate/lifo/kernel/network/NetworkStack.d.ts +22 -11
  57. package/dist/substrate/lifo/kernel/network/NetworkStack.d.ts.map +1 -1
  58. package/dist/substrate/lifo/kernel/network/NetworkStack.js +0 -2
  59. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.d.ts +2 -1
  60. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.d.ts.map +1 -1
  61. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.js +3 -4
  62. package/dist/substrate/lifo/kernel/vfs/VFS.d.ts +17 -0
  63. package/dist/substrate/lifo/kernel/vfs/VFS.d.ts.map +1 -1
  64. package/dist/substrate/lifo/kernel/vfs/VFS.js +33 -0
  65. package/dist/substrate/lifo/node-compat/esbuild.d.ts.map +1 -1
  66. package/dist/substrate/lifo/node-compat/esbuild.js +2 -4
  67. package/dist/substrate/lifo/node-compat/index.d.ts.map +1 -1
  68. package/dist/substrate/lifo/node-compat/index.js +3 -2
  69. package/dist/substrate/lifo/node-compat/loose-equality.d.ts +19 -0
  70. package/dist/substrate/lifo/node-compat/loose-equality.d.ts.map +1 -0
  71. package/dist/substrate/lifo/node-compat/loose-equality.js +91 -0
  72. package/dist/substrate/lifo/node-compat/process.d.ts.map +1 -1
  73. package/dist/substrate/lifo/node-compat/process.js +6 -3
  74. package/dist/substrate/lifo/shell/Shell.d.ts +19 -0
  75. package/dist/substrate/lifo/shell/Shell.d.ts.map +1 -1
  76. package/dist/substrate/lifo/shell/Shell.js +86 -75
  77. package/dist/substrate/lifo/shell/lexer.d.ts +9 -0
  78. package/dist/substrate/lifo/shell/lexer.d.ts.map +1 -1
  79. package/dist/substrate/lifo/shell/lexer.js +40 -0
  80. package/dist/vfs/seed-project.d.ts.map +1 -1
  81. package/dist/vfs/seed-project.js +8 -2
  82. package/dist/vfs/sqlite-vfs.d.ts +61 -1
  83. package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
  84. package/dist/vfs/sqlite-vfs.js +199 -35
  85. package/package.json +1 -1
  86. package/src/_shared/error-text.ts +21 -0
  87. package/src/_shared/exports-resolver.ts +24 -4
  88. package/src/_shared/retry.ts +4 -2
  89. package/src/_shared/w7-frame.ts +2 -1
  90. package/src/constants.ts +30 -16
  91. package/src/observability/oom-classify.ts +7 -0
  92. package/src/observability/oom-discriminator.ts +1 -1
  93. package/src/runtime/esbuild-service.ts +16 -11
  94. package/src/runtime/installed-runtimes.ts +4 -3
  95. package/src/runtime/long-running-handle.ts +3 -3
  96. package/src/runtime/os-contracts.ts +7 -5
  97. package/src/runtime/port-registry.ts +97 -9
  98. package/src/runtime/process-logs.ts +12 -3
  99. package/src/runtime/project-detect.ts +7 -1
  100. package/src/runtime/require-resolver.ts +7 -7
  101. package/src/runtime/runtime-registry.ts +9 -7
  102. package/src/runtime/sqlite-runtime-fs-bridge.ts +9 -6
  103. package/src/runtime/virtual-socket-kernel.generated.ts +2 -2
  104. package/src/runtime/virtual-socket-kernel.ts +10 -5
  105. package/src/runtime/wasm-runner.ts +55 -29
  106. package/src/shell/features.ts +5 -4
  107. package/src/shell/unix-commands.ts +273 -128
  108. package/src/substrate/lifo/commands/net/ip.ts +15 -15
  109. package/src/substrate/lifo/commands/system/ps.ts +2 -1
  110. package/src/substrate/lifo/kernel/ServiceManager.ts +0 -2
  111. package/src/substrate/lifo/kernel/network/NetworkStack.ts +24 -17
  112. package/src/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.ts +37 -12
  113. package/src/substrate/lifo/kernel/vfs/VFS.ts +34 -0
  114. package/src/substrate/lifo/node-compat/esbuild.ts +16 -8
  115. package/src/substrate/lifo/node-compat/index.ts +3 -2
  116. package/src/substrate/lifo/node-compat/loose-equality.ts +81 -0
  117. package/src/substrate/lifo/node-compat/process.ts +5 -2
  118. package/src/substrate/lifo/shell/Shell.ts +92 -70
  119. package/src/substrate/lifo/shell/lexer.ts +38 -0
  120. package/src/vfs/seed-project.ts +10 -3
  121. package/src/vfs/sqlite-vfs.ts +209 -36
@@ -99,7 +99,9 @@ function encodeHttpRequest(request, body) {
99
99
  headers.set('Content-Length', String(body.byteLength));
100
100
  }
101
101
  const lines = [`${request.method} ${path} HTTP/1.1`];
102
- headers.forEach((value, key) => lines.push(`${key}: ${value}`));
102
+ headers.forEach((value, key) => {
103
+ lines.push(`${key}: ${value}`);
104
+ });
103
105
  lines.push('', '');
104
106
  return concatBytes([new TextEncoder().encode(lines.join('\r\n')), body]);
105
107
  }
@@ -115,7 +117,9 @@ function encodeHttpRequest(request, body) {
115
117
  */
116
118
  function encodeHttpResponseHead(status, statusText, headers, chunkedBody) {
117
119
  const lines = [`HTTP/1.1 ${status} ${statusText}`];
118
- headers.forEach((value, key) => lines.push(`${key}: ${value}`));
120
+ headers.forEach((value, key) => {
121
+ lines.push(`${key}: ${value}`);
122
+ });
119
123
  if (chunkedBody)
120
124
  lines.push('Transfer-Encoding: chunked');
121
125
  lines.push('Connection: close');
@@ -647,8 +651,8 @@ class LoopbackClientConnection {
647
651
  throw new Error('Nimbus loopback socket: read before a complete HTTP request was written ' +
648
652
  '(loopback sockets carry HTTP requests, not arbitrary byte streams)');
649
653
  }
650
- const waiter = (this.readable ??= new Deferred());
651
- await waiter.promise;
654
+ this.readable ??= new Deferred();
655
+ await this.readable.promise;
652
656
  }
653
657
  }
654
658
  close() {
@@ -775,7 +779,8 @@ class LoopbackClientConnection {
775
779
  awaitDrain() {
776
780
  if (this.inbound.pendingBytes <= LOOPBACK_READ_HIGH_WATER_BYTES)
777
781
  return Promise.resolve();
778
- return (this.drained ??= new Deferred()).promise;
782
+ this.drained ??= new Deferred();
783
+ return this.drained.promise;
779
784
  }
780
785
  withTimeout(promise) {
781
786
  let timer = null;
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-runner.d.ts","sourceRoot":"","sources":["../../src/runtime/wasm-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EAAS,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAkDtD,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,gBAAgB,QAoCwC,CAAC;AAEtE,wBAAgB,wBAAwB,IAAI,MAAM,CASjD;AAyCD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,GAAG,EAAE,SAAS,CAAC;IACf,MAAM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AW,CAgBd"}
@@ -50,6 +50,7 @@ import { requireVfsCred, WASM32_WASI_NIMBUS_ABI } from './os-contracts.js';
50
50
  import { WASI_INSTANCE_PREAMBLE_SRC, WASI_IMPLEMENTED_FNS, WASI_ABI_NAMESPACE } from './wasi-instance.js';
51
51
  import { inspectWasmThreads, wasiThreadsLoadError } from './wasi-threads.js';
52
52
  import { withMemoryLimit, DEFAULT_WASM_PROCESS_LIMIT_BYTES } from './wasm-memory.js';
53
+ import { errorText } from '../_shared/error-text.js';
53
54
  export const WASM_RUNNER_VERSION = '0.3.0';
54
55
  export const WASM_RUNNER_HELP = 'Usage: wasm-runner [options] <file.wasm> [exportName] [int args...]\n' +
55
56
  ' wasm-runner --version\n' +
@@ -271,6 +272,12 @@ export function makeWasmRunner(deps) {
271
272
  // overly conservative; cast to ArrayBuffer is correct.
272
273
  const buf = limited.buffer.slice(limited.byteOffset, limited.byteOffset + limited.byteLength);
273
274
  const facetFn = async function wasmFacetCall(args, facetEnv) {
275
+ // This body is serialized into the facet isolate, where the supervisor's
276
+ // module graph — and so _shared/error-text.js — does not exist. Same
277
+ // fallback as errorText, spelled out locally.
278
+ const errText = (err) => typeof err === 'object' && err !== null && 'message' in err && err.message
279
+ ? String(err.message)
280
+ : String(err);
274
281
  const wasmTable = globalThis.__NIMBUS_WASM || {};
275
282
  const mod = wasmTable['user.wasm'];
276
283
  if (!mod) {
@@ -390,7 +397,7 @@ export function makeWasmRunner(deps) {
390
397
  mode: 'wasi',
391
398
  error: `wasi-threads: could not reserve the shared memory the module declares `
392
399
  + `(${args.threads.memory.initial}–${args.threads.memory.maximum} pages, `
393
- + `${(args.threads.memory.maximum * 64) / 1024} MiB): ${e?.message || e}. `
400
+ + `${(args.threads.memory.maximum * 64) / 1024} MiB): ${errText(e)}. `
394
401
  + 'A shared memory reserves its maximum immediately — lower --max-memory.',
395
402
  };
396
403
  }
@@ -414,11 +421,14 @@ export function makeWasmRunner(deps) {
414
421
  return {
415
422
  ok: false,
416
423
  mode: 'wasi',
417
- error: `instantiate failed: ${e?.message || e}`,
424
+ error: `instantiate failed: ${errText(e)}`,
418
425
  };
419
426
  }
420
- if (!memRef.mem)
421
- memRef.mem = inst.exports.memory;
427
+ if (!memRef.mem) {
428
+ const exported = inst.exports.memory;
429
+ if (exported instanceof WebAssembly.Memory)
430
+ memRef.mem = exported;
431
+ }
422
432
  if (!memRef.mem) {
423
433
  return {
424
434
  ok: false,
@@ -464,7 +474,7 @@ export function makeWasmRunner(deps) {
464
474
  return {
465
475
  ok: false,
466
476
  mode: 'direct',
467
- error: `instantiate failed: ${e?.message || e}`,
477
+ error: `instantiate failed: ${errText(e)}`,
468
478
  };
469
479
  }
470
480
  const exportNames = Object.keys(inst.exports);
@@ -487,7 +497,7 @@ export function makeWasmRunner(deps) {
487
497
  ok: false,
488
498
  mode: 'direct',
489
499
  exports: exportNames,
490
- error: `${args.exportName}(${(args.intArgs || []).join(', ')}) threw: ${e?.message || e}`,
500
+ error: `${args.exportName}(${(args.intArgs || []).join(', ')}) threw: ${errText(e)}`,
491
501
  };
492
502
  }
493
503
  // BigInt (i64) → string; everything else → as-is.
@@ -585,7 +595,7 @@ export function makeWasmRunner(deps) {
585
595
  }));
586
596
  }
587
597
  catch (e) {
588
- outcome = { ok: false, error: `dispatch failed: ${e?.message || e}` };
598
+ outcome = { ok: false, error: `dispatch failed: ${errorText(e)}` };
589
599
  }
590
600
  finally {
591
601
  facet?.dispose();
@@ -603,15 +613,13 @@ export function makeWasmRunner(deps) {
603
613
  // If runStart reported an `error` (wasm trapped, _start missing,
604
614
  // …), append it to stderr but still surface its exitCode (default
605
615
  // 1 from runStart on trap) so callers can distinguish.
606
- const wasiOut = outcome;
607
- // Either branch carries optional stdout/stderr/exitCode/error.
608
- stdout = wasiOut.stdout || '';
609
- stderr = wasiOut.stderr || '';
610
- if (wasiOut.error) {
616
+ stdout = outcome.stdout || '';
617
+ stderr = outcome.stderr || '';
618
+ if (outcome.error) {
611
619
  stderr = (stderr ? stderr : '') +
612
- `wasm-runner: wasi trap: ${wasiOut.error}\n`;
620
+ `wasm-runner: wasi trap: ${outcome.error}\n`;
613
621
  }
614
- exitCode = wasiOut.exitCode ?? (wasiOut.ok ? 0 : 1);
622
+ exitCode = outcome.exitCode ?? (outcome.ok ? 0 : 1);
615
623
  }
616
624
  else if (!outcome.ok) {
617
625
  // Direct-mode failure or pre-instantiate dispatch failure — shell
@@ -1 +1 @@
1
- {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/shell/features.ts"],"names":[],"mappings":"AAGA,UAAU,SAAS;IACjB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,WAAW,IAAI,IAAI,CAAC;IACpB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,IAAI,IAAI,CAAC;IACxB,UAAU,IAAI,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,YAAY;IACpB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAkB9D;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,mBAAmB,CAAk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AAmB,CAAyC;IAEpE,sFAAsF;IACtF,OAAO,CAAC,QAAQ,CAAc;IAE9B;0EACsE;IACtE,OAAO,CAAC,gBAAgB,CAAc;IACtC;uEACmE;IACnE,OAAO,CAAC,sBAAsB,CAAa;IAE3C,uCAAuC;IACvC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAM;IAC1B;8EAC0E;IAC1E,OAAO,CAAC,iBAAiB,CAAM;IAE/B,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,UAAU;gBAWb,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY;IAKpD,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,kBAAkB;IAM5E,OAAO,CAAC,MAAM;IA+Bd;;;OAGG;IACH,OAAO,CAAC,cAAc;IA2MtB,kEAAkE;IAClE,OAAO,CAAC,cAAc;IAStB,4DAA4D;IAC5D,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,kBAAkB;IAuB1B,OAAO,CAAC,YAAY;IAiCpB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc;IA0EtB,qEAAqE;IACrE,OAAO,CAAC,eAAe;IAavB,8DAA8D;IAC9D,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,oBAAoB;IAM5B,qCAAqC;IACrC,OAAO,CAAC,cAAc;IAWtB;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAWrB"}
@@ -121,7 +121,7 @@ export class HeredocHandler {
121
121
  }
122
122
  return;
123
123
  }
124
- return this._handleOriginalInput(data);
124
+ this._handleOriginalInput(data);
125
125
  };
126
126
  this.shell.executeLine = async (line) => {
127
127
  if (this.active) {
@@ -144,7 +144,7 @@ export class HeredocHandler {
144
144
  this._accumulateLine('');
145
145
  return;
146
146
  }
147
- return this._printPrompt();
147
+ this._printPrompt();
148
148
  };
149
149
  }
150
150
  _printPrompt() {
@@ -353,7 +353,8 @@ export class LineEditorExtender {
353
353
  // shell-prompt input. Process-stdin input has its own model
354
354
  // (terminalStdin / stdinLineBuffer) handled by the shell.
355
355
  if (this.shell.running) {
356
- return this.originalHandleInput(data);
356
+ this.originalHandleInput(data);
357
+ return;
357
358
  }
358
359
  // Reverse-i-search sub-mode owns ALL input until exited.
359
360
  if (this.rsearchActive) {
@@ -368,7 +369,7 @@ export class LineEditorExtender {
368
369
  // Try each binding. First-match wins; on no match fall through.
369
370
  if (this._handleBinding(data))
370
371
  return;
371
- return this.originalHandleInput(data);
372
+ this.originalHandleInput(data);
372
373
  };
373
374
  }
374
375
  /**
@@ -11,5 +11,18 @@
11
11
  * touch, stat, file, xxd, base64, sha256sum, id, hostname, realpath
12
12
  */
13
13
  import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
14
- export declare function registerUnixCommands(registry: any, sqliteVfs: SqliteVFS): void;
14
+ import type { Command } from '../substrate/lifo/commands/types.js';
15
+ /**
16
+ * The registry these commands dispatch through: registration, and name
17
+ * resolution for `which`, `type`, `command`, `find -exec` and `xargs`.
18
+ * `resolve` answers `unknown` because the registry holds whatever any module
19
+ * registered — and the worker's npm-bin fallback replaces the method outright
20
+ * — so what comes back is a command only once it has been checked.
21
+ */
22
+ type UnixCommandRegistry = {
23
+ register(name: string, handler: Command): void;
24
+ resolve(name: string): unknown;
25
+ };
26
+ export declare function registerUnixCommands(registry: UnixCommandRegistry, sqliteVfs: SqliteVFS): void;
27
+ export {};
15
28
  //# sourceMappingURL=unix-commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unix-commands.d.ts","sourceRoot":"","sources":["../../src/shell/unix-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA0jIvE,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,GAAG,EACb,SAAS,EAAE,SAAS,GACnB,IAAI,CAoKN"}
1
+ {"version":3,"file":"unix-commands.d.ts","sourceRoot":"","sources":["../../src/shell/unix-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAavE,OAAO,KAAK,EAAE,OAAO,EAAsB,MAAM,qCAAqC,CAAC;AAoFvF;;;;;;GAMG;AACH,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AAgmIF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,SAAS,GACnB,IAAI,CAoKN"}