@immediately-run/sdk 0.48.0 → 0.49.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.
@@ -0,0 +1,129 @@
1
+ // Types for the `fs` module as the immediately.run SANDBOX exposes it to apps: an
2
+ // ASYNC-ONLY filesystem (`fs.promises.*` + callback style), rooted at the
3
+ // project root. In the sandbox it is backed by ZenFS over a MessagePort; during
4
+ // local `vite dev` the @immediately-run/dev-fs bridge backs it with your real
5
+ // disk.
6
+ //
7
+ // MOVED HERE from `@immediately-run/dev-fs/fs` (R3-276b): the package that owns a
8
+ // surface should be the one that declares it. The dev-fs package — a Vite plugin
9
+ // that exists to *emulate* this surface on real disk during local dev — now
10
+ // re-references this declaration (`/// <reference types="@immediately-run/dev-fs/fs" />`
11
+ // keeps working as a deprecation-window alias), so there is exactly ONE copy and
12
+ // it lives with the platform.
13
+ //
14
+ // Activate via `/// <reference types="@immediately-run/sdk/ambient" />` (see
15
+ // ambient.d.ts). This lets app code import `fs` and type-check without pulling
16
+ // all of @types/node into the browser project. It intentionally only describes
17
+ // the supported async surface — there are no `*Sync` methods, and a
18
+ // re-declaration is where that constraint would quietly regress
19
+ // (check-ambient-types.mjs asserts both).
20
+ declare module 'fs' {
21
+ type Encoding =
22
+ | 'utf8'
23
+ | 'utf-8'
24
+ | 'ascii'
25
+ | 'base64'
26
+ | 'base64url'
27
+ | 'hex'
28
+ | 'latin1'
29
+ | 'binary'
30
+ | 'ucs2'
31
+ | 'ucs-2'
32
+ | 'utf16le';
33
+
34
+ type PathLike = string;
35
+ type WriteData = string | Uint8Array | ArrayBuffer | number[];
36
+ type WriteOptions = Encoding | { encoding?: Encoding; mode?: number; flag?: string };
37
+
38
+ export interface Stats {
39
+ size: number;
40
+ mode: number;
41
+ uid: number;
42
+ gid: number;
43
+ dev: number;
44
+ ino: number;
45
+ nlink: number;
46
+ rdev: number;
47
+ blksize: number;
48
+ blocks: number;
49
+ atimeMs: number;
50
+ mtimeMs: number;
51
+ ctimeMs: number;
52
+ birthtimeMs: number;
53
+ atime: Date;
54
+ mtime: Date;
55
+ ctime: Date;
56
+ birthtime: Date;
57
+ isFile(): boolean;
58
+ isDirectory(): boolean;
59
+ isSymbolicLink(): boolean;
60
+ isBlockDevice(): boolean;
61
+ isCharacterDevice(): boolean;
62
+ isFIFO(): boolean;
63
+ isSocket(): boolean;
64
+ }
65
+
66
+ export interface Dirent {
67
+ name: string;
68
+ isFile(): boolean;
69
+ isDirectory(): boolean;
70
+ isSymbolicLink(): boolean;
71
+ isBlockDevice(): boolean;
72
+ isCharacterDevice(): boolean;
73
+ isFIFO(): boolean;
74
+ isSocket(): boolean;
75
+ }
76
+
77
+ export interface WatchEvent {
78
+ eventType: 'rename' | 'change';
79
+ filename: string | null;
80
+ }
81
+
82
+ export interface WatchOptions {
83
+ recursive?: boolean;
84
+ signal?: AbortSignal;
85
+ }
86
+
87
+ export interface FsPromises {
88
+ readFile(path: PathLike, options: Encoding | { encoding: Encoding }): Promise<string>;
89
+ readFile(path: PathLike, options?: { encoding?: null }): Promise<Uint8Array>;
90
+ writeFile(path: PathLike, data: WriteData, options?: WriteOptions): Promise<void>;
91
+ appendFile(path: PathLike, data: WriteData, options?: WriteOptions): Promise<void>;
92
+ readdir(path: PathLike, options: { withFileTypes: true }): Promise<Dirent[]>;
93
+ readdir(path: PathLike, options?: { withFileTypes?: false } | Encoding): Promise<string[]>;
94
+ mkdir(path: PathLike, options?: { recursive?: boolean; mode?: number }): Promise<string | undefined>;
95
+ rm(path: PathLike, options?: { recursive?: boolean; force?: boolean }): Promise<void>;
96
+ rmdir(path: PathLike, options?: { recursive?: boolean }): Promise<void>;
97
+ unlink(path: PathLike): Promise<void>;
98
+ stat(path: PathLike): Promise<Stats>;
99
+ lstat(path: PathLike): Promise<Stats>;
100
+ access(path: PathLike, mode?: number): Promise<void>;
101
+ rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
102
+ copyFile(src: PathLike, dest: PathLike, mode?: number): Promise<void>;
103
+ realpath(path: PathLike): Promise<string>;
104
+ watch(path: PathLike, options?: WatchOptions): AsyncIterable<WatchEvent>;
105
+ }
106
+
107
+ export const promises: FsPromises;
108
+ export const constants: {
109
+ F_OK: number;
110
+ X_OK: number;
111
+ W_OK: number;
112
+ R_OK: number;
113
+ COPYFILE_EXCL: number;
114
+ };
115
+
116
+ interface DevFs {
117
+ promises: FsPromises;
118
+ constants: typeof constants;
119
+ }
120
+
121
+ const fs: DevFs;
122
+ export default fs;
123
+ }
124
+
125
+ declare module 'node:fs' {
126
+ import devFs from 'fs';
127
+ export * from 'fs';
128
+ export default devFs;
129
+ }
package/dist/ambient.d.ts CHANGED
@@ -9,14 +9,15 @@
9
9
  // This is types-only: nothing here is imported at runtime, so referencing it does
10
10
  // not pull the SDK's sandbox-adapter tier into the app's bundle graph.
11
11
  //
12
- // ── What is NOT here: the `fs` module ────────────────────────────────────────
13
- // The async-only `fs` surface the sandbox exposes is declared by
14
- // `@immediately-run/dev-fs/fs` (`/// <reference types="@immediately-run/dev-fs/fs" />`),
15
- // the package that also bridges it to real disk under `vite dev`. It is not
16
- // re-declared here: a second copy of a type declaration is the drift this whole
17
- // project is removing, and the copy would be the one apps hit first. Moving that
18
- // declaration's OWNERSHIP to the SDK (with dev-fs re-referencing it) is the right
19
- // long-run shape and needs a change in that repo — filed as R3-276b.
12
+ // ── The `fs` module ──────────────────────────────────────────────────────────
13
+ // The async-only `fs` surface the sandbox exposes is declared alongside this
14
+ // file in `ambient-fs.d.ts` (moved there from `@immediately-run/dev-fs` by
15
+ // R3-276b, so the package that owns the surface declares it). Nothing else is
16
+ // needed: this one reference is the whole ambient contract.
17
+ //
18
+ // `@immediately-run/dev-fs/fs` still works — it re-references this declaration
19
+ // for a deprecation window (`SDK_PACKAGING_SPEC` §9), because every app repo
20
+ // names that path in a `.d.ts` and moves on its own schedule.
20
21
  //
21
22
  // ── Host obligation: mount before boot ───────────────────────────────────────
22
23
  // The corpus a viewer reads must be MOUNTED before the app boots. The SDK offers no
@@ -26,6 +27,8 @@
26
27
  // that boots an app first and mounts second is breaking the contract, not exposing
27
28
  // a race the app should defend against.
28
29
 
30
+ /// <reference path="./ambient-fs.d.ts" />
31
+
29
32
  import type { EvaluationContext } from './sandboxTypes';
30
33
 
31
34
  declare global {
package/dist/version.cjs CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  SDK_VERSION: () => SDK_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const SDK_VERSION = "0.48.0";
24
+ const SDK_VERSION = "0.49.0";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  SDK_VERSION
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// GENERATED by scripts/gen-version.mjs from package.json — do not edit by hand.\n// Regenerated on every build (prebuild); kept honest by version.test.ts.\n\n/** This SDK's package version, baked from package.json at build (SP2-6). */\nexport const SDK_VERSION = '0.48.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// GENERATED by scripts/gen-version.mjs from package.json — do not edit by hand.\n// Regenerated on every build (prebuild); kept honest by version.test.ts.\n\n/** This SDK's package version, baked from package.json at build (SP2-6). */\nexport const SDK_VERSION = '0.49.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,cAAc;","names":[]}
@@ -1,4 +1,4 @@
1
1
  /** This SDK's package version, baked from package.json at build (SP2-6). */
2
- declare const SDK_VERSION = "0.48.0";
2
+ declare const SDK_VERSION = "0.49.0";
3
3
 
4
4
  export { SDK_VERSION };
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** This SDK's package version, baked from package.json at build (SP2-6). */
2
- declare const SDK_VERSION = "0.48.0";
2
+ declare const SDK_VERSION = "0.49.0";
3
3
 
4
4
  export { SDK_VERSION };
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk-VHAA22YE.js";
2
- const SDK_VERSION = "0.48.0";
2
+ const SDK_VERSION = "0.49.0";
3
3
  export {
4
4
  SDK_VERSION
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// GENERATED by scripts/gen-version.mjs from package.json — do not edit by hand.\n// Regenerated on every build (prebuild); kept honest by version.test.ts.\n\n/** This SDK's package version, baked from package.json at build (SP2-6). */\nexport const SDK_VERSION = '0.48.0';\n"],"mappings":";AAIO,MAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// GENERATED by scripts/gen-version.mjs from package.json — do not edit by hand.\n// Regenerated on every build (prebuild); kept honest by version.test.ts.\n\n/** This SDK's package version, baked from package.json at build (SP2-6). */\nexport const SDK_VERSION = '0.49.0';\n"],"mappings":";AAIO,MAAM,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immediately-run/sdk",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Runtime SDK for code executing inside an immediately.run sandbox.",
5
5
  "license": "MIT",
6
6
  "repository": "github:immediately-run/immediately-run-sdk",
@@ -36,7 +36,7 @@
36
36
  "protocol:check": "node scripts/check-protocol-snapshot.mjs",
37
37
  "verify:codegen-parity": "node scripts/codegen-prototype/verify-drift.mjs --self-test && node scripts/codegen-prototype/verify-drift.mjs && node scripts/codegen-prototype/verify.streams.mjs --self-test && node scripts/codegen-prototype/verify.streams.mjs",
38
38
  "api:update": "node scripts/check-api-stability.mjs --update",
39
- "verify": "npm run format:check && npm run check:circular && npm run build && npm test && npm run test:safe-content && npm run test:metadata-e2e && npm run api:check && npm run compat:selftest && npm run compat:previous && npm run protocol:check && npm run protocol:selftest && npm run check:selfhost:selftest && npm run check:selfhost && npm run verify:codegen-parity",
39
+ "verify": "npm run format:check && npm run check:circular && npm run build && npm test && npm run test:safe-content && npm run test:metadata-e2e && npm run api:check && npm run compat:selftest && npm run compat:previous && npm run protocol:check && npm run protocol:selftest && npm run check:ambient:selftest && npm run check:ambient && npm run check:selfhost:selftest && npm run check:selfhost && npm run verify:codegen-parity",
40
40
  "docs": "typedoc --json docs/api.json && node scripts/gen-llms.mjs",
41
41
  "prepublishOnly": "npm run check:circular && npm run build && npm run api:check",
42
42
  "test:safe-content": "node scripts/build-safecontent-e2e.mjs && node --test test/safeContent.e2e.mjs",
@@ -46,7 +46,9 @@
46
46
  "compat:selftest": "node scripts/check-previous-sdk-compat.mjs --self-test",
47
47
  "check:selfhost": "node scripts/build-selfhost.mjs .selfhost-check && node scripts/check-selfhost-resolvable.mjs --dir .selfhost-check",
48
48
  "check:selfhost:selftest": "node scripts/check-selfhost-resolvable.mjs --self-test",
49
- "prepare": "git config core.hooksPath .githooks || true"
49
+ "prepare": "git config core.hooksPath .githooks || true",
50
+ "check:ambient": "node scripts/check-ambient-types.mjs",
51
+ "check:ambient:selftest": "node scripts/check-ambient-types.mjs --self-test"
50
52
  },
51
53
  "peerDependencies": {
52
54
  "react": "^19.0.0",