@amritk/nish-x86_64-linux 0.20.0 → 0.21.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/INSTALL.md +22 -10
  2. package/bin/nish +0 -0
  3. package/docs/AI.md +2759 -0
  4. package/package.json +2 -1
  5. package/runtime/browser.d.ts +14 -0
  6. package/runtime/browser.mjs +88 -0
  7. package/runtime/core/arrays.d.ts +18 -0
  8. package/runtime/core/arrays.mjs +125 -0
  9. package/runtime/core/checks.mjs +20 -0
  10. package/runtime/core/host.d.ts +70 -0
  11. package/runtime/core/host.mjs +311 -0
  12. package/runtime/core/numbers.d.ts +53 -0
  13. package/runtime/core/numbers.mjs +316 -0
  14. package/runtime/core/result.d.ts +41 -0
  15. package/runtime/core/result.mjs +127 -0
  16. package/runtime/core/strings.d.ts +14 -0
  17. package/runtime/core/strings.mjs +169 -0
  18. package/runtime/core.d.ts +9 -0
  19. package/runtime/core.mjs +55 -0
  20. package/runtime/host.d.ts +6 -0
  21. package/runtime/nish.d.ts +44 -0
  22. package/runtime/nish.h +75 -2
  23. package/runtime/nish.mjs +23 -3
  24. package/runtime/node.mjs +383 -0
  25. package/runtime/runtime-bytes.c +401 -0
  26. package/runtime/runtime-cross.c +1 -1
  27. package/runtime/runtime-host.c +1 -1
  28. package/runtime/runtime-os.c +1 -1
  29. package/runtime/runtime-parallel.c +1 -1
  30. package/runtime/runtime-simd.c +231 -7
  31. package/runtime/runtime-term.c +504 -0
  32. package/runtime/runtime-wasm.c +0 -11
  33. package/runtime/runtime.c +190 -6
  34. package/runtime/shim.mjs +6 -985
  35. package/runtime/sqlite/LICENSE.md +85 -0
  36. package/runtime/sqlite/README.md +45 -0
  37. package/runtime/sqlite/nish-sqlite.c +359 -0
  38. package/runtime/sqlite/sqlite3.c +271131 -0
  39. package/runtime/sqlite/sqlite3.h +14447 -0
  40. package/scripts/build.sh +261 -53
  41. package/std/LICENSE-fast-float +23 -0
  42. package/std/LICENSE-fdlibm +8 -0
  43. package/std/README.md +31 -11
  44. package/std/base64.ts +116 -0
  45. package/std/bytes.ts +256 -0
  46. package/std/cli.ts +328 -0
  47. package/std/collections.ts +6 -5
  48. package/std/crypto/LICENSE-crypt_blowfish +26 -0
  49. package/std/crypto/base64url.ts +125 -0
  50. package/std/crypto/bcrypt.ts +760 -0
  51. package/std/crypto/hmac.ts +138 -2
  52. package/std/crypto/x509.ts +11 -122
  53. package/std/json-tokenizer.ts +2998 -57
  54. package/std/json-value.ts +22 -3
  55. package/std/json.ts +83 -1
  56. package/std/math.ts +608 -0
  57. package/std/net/http1-server.ts +85 -8
  58. package/std/net/http3-server.ts +50 -12
  59. package/std/net/postgres.ts +1875 -0
  60. package/std/net/quic-listener.ts +20 -4
  61. package/std/regex.ts +4274 -0
  62. package/std/sqlite.ts +391 -0
  63. package/std/term-io.ts +978 -0
  64. package/std/term-pixels.ts +874 -0
  65. package/std/term-probe.ts +459 -0
  66. package/std/term-rate.ts +993 -0
  67. package/std/term.ts +2453 -0
  68. package/std/text.ts +90 -7
  69. package/std/yaml-lines.ts +141 -0
  70. package/std/yaml.ts +4675 -0
package/INSTALL.md CHANGED
@@ -224,7 +224,7 @@ routes are
224
224
  # on the musl host, with its own clang and the runtime from this repository
225
225
  clang app.ll runtime/runtime.c runtime/runtime-os.c runtime/runtime-parallel.c \
226
226
  runtime/runtime-cross.c runtime/runtime-host.c runtime/runtime-net.c \
227
- runtime/runtime-simd.c runtime/runtime-aes.c -lm -o app
227
+ runtime/runtime-simd.c runtime/runtime-aes.c runtime/runtime-term.c runtime/runtime-bytes.c -lm -o app
228
228
  ```
229
229
 
230
230
  `--link`ing inside the container is the mistake to avoid: it shells out to the
@@ -360,22 +360,25 @@ it into `build/seed/`; `NISH_BOOTSTRAP=<path>` names one you already have and
360
360
  skips the download. §2a has what the build does with it.
361
361
 
362
362
  The published package ships `bin/` (the `nish` command, which is a launcher),
363
- `runtime/` (the C runtime — eight translation units, the wasm subset and their header),
364
- `scripts/build.sh` (the link pipeline) and `std/` (the standard library). The
363
+ `runtime/` (the C runtime — ten translation units, the wasm subset and their
364
+ header — and `runtime/sqlite/`, SQLite's vendored source),
365
+ `scripts/build.sh` (the link pipeline), `std/` (the standard library) and
366
+ `docs/AI.md` (the rules card). The
365
367
  compiler itself is not in it: it arrives as one prebuilt
366
368
  `@amritk/nish-<asset>` package per platform, and `bin/nish` hands over to
367
- whichever one npm installed. `nish` locates the runtime, the script and `std/`
369
+ whichever one npm installed. That package carries its own copy of all of
370
+ these, and its `docs/AI.md` is the one an agent's `nish --help` names. `nish` locates the runtime, the script and `std/`
368
371
  relative to its own install directory, so a global install works from any
369
372
  working directory — and the binary runs from inside its own platform package
370
373
  for exactly that reason.
371
374
 
372
375
  Building the IR yourself rather than through `--link` means naming the runtime
373
- on the `clang` line, and it is eight files:
376
+ on the `clang` line, and it is ten files:
374
377
 
375
378
  ```bash
376
379
  clang app.ll runtime/runtime.c runtime/runtime-os.c runtime/runtime-parallel.c \
377
380
  runtime/runtime-cross.c runtime/runtime-host.c runtime/runtime-net.c \
378
- runtime/runtime-simd.c runtime/runtime-aes.c -lm -o app
381
+ runtime/runtime-simd.c runtime/runtime-aes.c runtime/runtime-term.c runtime/runtime-bytes.c -lm -o app
379
382
  ```
380
383
 
381
384
  `runtime.c` is the part every program touches — the arena, strings, arrays,
@@ -387,15 +390,24 @@ needs `-DNISH_THREADS=1 -pthread` on the line), `runtime-cross.c` copies
387
390
  the strings and arrays a task answers, a channel sends or a `Mutex` keeps out
388
391
  of the arena they were made in, `runtime-host.c` holds the wall clock,
389
392
  entropy, file times and signals, `runtime-net.c` the sockets of `nish:net`,
390
- and `runtime-simd.c` and `runtime-aes.c` the vector text search and AES-GCM.
393
+ `runtime-simd.c` and `runtime-aes.c` the vector text search and AES-GCM,
394
+ `runtime-term.c` the stdin reads and terminal calls of `nish:term`, and
395
+ `runtime-bytes.c` the byte-class runs of `nish/bytes`, which `nish/json` steps
396
+ over.
391
397
  They are separate so that each carries its own measured size ceiling
392
398
  ([docs/wp7-runtime.md](wp7-runtime.md)); nothing in the core calls into the
393
399
  others, so a line that names only `runtime.c` and `runtime-os.c` still links a
394
- program that uses none of the other six. `scripts/build.sh` compiles the other
395
- seven beside any
400
+ program that uses none of the other eight. `scripts/build.sh` compiles the other
401
+ eight beside any
396
402
  `runtime.c` it is handed, so a build that goes through it — every `--link`,
397
403
  and every `--profile` recipe in these documents — needs to name only the one.
398
404
 
405
+ A program whose IR declares an `sqlite3_*` function also needs SQLite on a
406
+ hand-written line. `scripts/build.sh` adds it by itself; by hand, append
407
+ `runtime/sqlite/sqlite3.c` with the options `scripts/build.sh` lists under
408
+ "SQLite's compile-time options" (at least `-DSQLITE_THREADSAFE=0`, or `=2`
409
+ beside `-DNISH_THREADS=1`).
410
+
399
411
  ## 2a. What `npm run build` does
400
412
 
401
413
  `src/` is the compiler, written in Nish, and it compiles itself
@@ -506,7 +518,7 @@ Removing the directory is always safe.
506
518
  | 2 | usage error: unknown flag, missing argument, no input files |
507
519
  | 3 | toolchain error: `--link` found no `clang` (`CC` overrides), or `scripts/build.sh` failed (its output is shown; the `.ll` files are still written) — or the `nish` command found no prebuilt compiler for this platform, or one that would not start. Under `--json` all of these are one `NL0002` object |
508
520
  | | `nish run` answers these codes until the program starts, and the program's own exit status (`128 + n` for a signal) after that. With neither `HOME` nor `XDG_CACHE_HOME` set to an absolute path it answers 3 |
509
- | 70 | internal compiler error: an unexpected exception. Please report it at <https://github.com/amritk/nish/issues> with the input and command line; `NISH_DEBUG=1` prints the stack trace |
521
+ | 70 | internal compiler error: a broken invariant in the compiler. Please report it at <https://github.com/amritk/nish/issues> with the input and command line; the compiler is self-hosted and has no stack trace to print, so the message it prints is the whole report |
510
522
 
511
523
  ## Troubleshooting
512
524
 
package/bin/nish CHANGED
Binary file