@tsconfigdotjson/vibe-os 0.0.0-stage → 0.1.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +928 -2
  3. package/THIRD_PARTY_NOTICES.md +2467 -0
  4. package/bin/vibe-os.mjs +13 -0
  5. package/dist/web/apple-touch-icon.png +0 -0
  6. package/dist/web/assets/index-B77Qk8B5.js +35 -0
  7. package/dist/web/assets/index-B77Qk8B5.js.br +0 -0
  8. package/dist/web/assets/index-B77Qk8B5.js.gz +0 -0
  9. package/dist/web/assets/index-CH5Em-Mo.css +1 -0
  10. package/dist/web/assets/index-CH5Em-Mo.css.br +0 -0
  11. package/dist/web/assets/index-CH5Em-Mo.css.gz +0 -0
  12. package/dist/web/icon-192.png +0 -0
  13. package/dist/web/icon-512.png +0 -0
  14. package/dist/web/icon-app.svg +19 -0
  15. package/dist/web/icon-maskable-512.png +0 -0
  16. package/dist/web/icon-maskable.svg +13 -0
  17. package/dist/web/icon.svg +15 -0
  18. package/dist/web/index.html +36 -0
  19. package/dist/web/ssh.wasm +0 -0
  20. package/dist/web/ssh.wasm.br +0 -0
  21. package/dist/web/ssh.wasm.gz +0 -0
  22. package/dist/web/sw.js +29 -0
  23. package/dist/web/wasm_exec.js +575 -0
  24. package/dist/web/wasm_exec.js.br +0 -0
  25. package/dist/web/wasm_exec.js.gz +0 -0
  26. package/package.json +82 -4
  27. package/scripts/compile.ts +62 -0
  28. package/scripts/compress.mjs +54 -0
  29. package/scripts/fetch-wasm.mjs +242 -0
  30. package/scripts/gen-assets.ts +76 -0
  31. package/scripts/lib/walk.ts +18 -0
  32. package/scripts/notices.ts +189 -0
  33. package/server/acme.ts +182 -0
  34. package/server/api.ts +515 -0
  35. package/server/assets.generated.ts +53 -0
  36. package/server/attach.ts +524 -0
  37. package/server/auth.ts +194 -0
  38. package/server/bridge.ts +145 -0
  39. package/server/browser.ts +519 -0
  40. package/server/cli.ts +843 -0
  41. package/server/config.ts +362 -0
  42. package/server/db.ts +262 -0
  43. package/server/doctor.ts +966 -0
  44. package/server/fsx.ts +88 -0
  45. package/server/harness.ts +654 -0
  46. package/server/http.ts +53 -0
  47. package/server/index.ts +469 -0
  48. package/server/log.ts +40 -0
  49. package/server/main.ts +7 -0
  50. package/server/mcp.ts +291 -0
  51. package/server/preflight.ts +87 -0
  52. package/server/profiles.ts +238 -0
  53. package/server/projects.ts +721 -0
  54. package/server/reaper.ts +303 -0
  55. package/server/runtime.ts +64 -0
  56. package/server/session.ts +330 -0
  57. package/server/ssh-ca.ts +368 -0
  58. package/server/static.ts +147 -0
  59. package/server/wallpapers.ts +248 -0
  60. package/server/windows.ts +237 -0
  61. package/shared/args.ts +91 -0
  62. package/shared/grid.ts +32 -0
  63. package/shared/wire.ts +226 -0
package/server/fsx.ts ADDED
@@ -0,0 +1,88 @@
1
+ // Filesystem helpers that more than one module needs to get right.
2
+
3
+ import {
4
+ access,
5
+ chmod,
6
+ constants,
7
+ rename,
8
+ stat,
9
+ writeFile,
10
+ } from "node:fs/promises";
11
+
12
+ /**
13
+ * Write-then-rename, so an interrupted write cannot be observed.
14
+ *
15
+ * Two separate reasons this is not just `writeFile`:
16
+ *
17
+ * - `rename` is atomic within a filesystem, so a reader either sees the whole
18
+ * old file or the whole new one. A crash partway through leaves the temp file
19
+ * behind and the real one untouched, rather than a truncated JSON blob or a
20
+ * private key with no matching certificate.
21
+ * - `writeFile`'s `mode` is only honoured when it *creates* the file. Writing
22
+ * over an existing path silently keeps whatever permissions were already
23
+ * there, which reads as if the mode were enforced on every write when it is
24
+ * not — hence the explicit `chmod` before the rename.
25
+ */
26
+ export async function writeAtomic(
27
+ target: string,
28
+ contents: string | Uint8Array,
29
+ mode: number,
30
+ ): Promise<void> {
31
+ const tmp = `${target}.tmp`;
32
+ await writeFile(tmp, contents, { mode });
33
+ await chmod(tmp, mode);
34
+ await rename(tmp, target);
35
+ }
36
+
37
+ /**
38
+ * Serialises async work onto a single chain.
39
+ *
40
+ * For read-modify-write on a file with no locking: without this, two callers
41
+ * both read the old contents and the second write silently discards the first's
42
+ * change. Each returned function queues behind the previous one.
43
+ */
44
+ export function serialise(): <T>(job: () => Promise<T>) => Promise<T> {
45
+ let tail: Promise<unknown> = Promise.resolve();
46
+ return <T>(job: () => Promise<T>): Promise<T> => {
47
+ const next = tail.then(job, job);
48
+ // Keep the chain alive even when a job rejects; the caller still sees it.
49
+ tail = next.catch(() => {});
50
+ return next;
51
+ };
52
+ }
53
+
54
+ /**
55
+ * Does this path exist at all, of any kind?
56
+ *
57
+ * These three predicates answer genuinely different questions, which is why
58
+ * they are three named functions rather than one `exists` whose meaning depends
59
+ * on the caller: the CA cares whether a key file is there, preflight cares that
60
+ * the wasm is a file and not a directory, and the project scanner cares about
61
+ * directories only. They were previously reimplemented once per module.
62
+ */
63
+ export async function pathExists(p: string): Promise<boolean> {
64
+ try {
65
+ await access(p, constants.F_OK);
66
+ return true;
67
+ } catch {
68
+ return false;
69
+ }
70
+ }
71
+
72
+ /** Is this path a regular file? */
73
+ export async function isFile(p: string): Promise<boolean> {
74
+ try {
75
+ return (await stat(p)).isFile();
76
+ } catch {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ /** Is this path a directory? */
82
+ export async function isDirectory(p: string): Promise<boolean> {
83
+ try {
84
+ return (await stat(p)).isDirectory();
85
+ } catch {
86
+ return false;
87
+ }
88
+ }