BP reference update#413
Conversation
Co-authored-by: Copilot <copilot@github.com>
Deploying labs-browserpod-previews with
|
| Latest commit: |
0ea495b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0c8205d9.labs-browserpod-previews.pages.dev |
| Branch Preview URL: | https://browserpod-reference-updates.labs-browserpod-previews.pages.dev |
GabrielaReyna
left a comment
There was a problem hiding this comment.
Good job documenting these!
In addition to my comments on the code, I will add some bullet points as to-do's:
- Please document
TerminalandProcess, even if they are opaque or minimalistic. Please sync with Yuri and Alessandro for any questions. These are first-class, so they go at the same level asBinaryFile,TextFileetc. - Please add links where
TerminalandProcessare mentioned in the text, referring to their documented page. - There is a nice explanatory page for
BinaryFile, this is a good chance to do something similar forBrowserPodin the reference, given an instance of BrowserPod we call it a "Pod" and it can be confusing for some users. This is an opportunity to link to this page when we call it like so.
62acc57 to
99d3aa7
Compare
…dle and process, and tightened langauge, sorted reference below demos
99d3aa7 to
0ea495b
Compare
| - **nodeVersion (`string`, _optional_)** - The version of Node.js to use. Currently only "22" is allowed. | ||
| - **storageKey (`string`, _optional_)** - An arbitrary string used to support multiple pods on the same origin or multiple tabs in parallel. For example, `boot({ apiKey: "...", storageKey: "vite" })` and `boot({ apiKey: "...", storageKey: "app-12345" })` allocate two completely independent disks. | ||
| - **userImage (`string`, _optional_)** - A URL pointing to a custom WebAssembly binary to load into the pod environment. When specified, this WebAssembly module will be loaded and made available within the pod instead of using the default environment. | ||
| - **storageKey (`string`, _optional_)** - An arbitrary string that identifies the pod's storage. Rebooting with the same key **resumes the same disk**, making the filesystem persistent across sessions. Using different keys gives each pod its own independent disk. For example, `boot({ apiKey: "...", storageKey: "my-project" })` always resumes the same environment, while `boot({ apiKey: "...", storageKey: "app-12345" })` uses a separate one. |
There was a problem hiding this comment.
The explanation does not clarify much. Both my-project and app-12345 would "resume from the same environment". This also does not explain properly our recent changes about "ephemeral" mode, which happens when no "storageKey" is passed.
| - **storageKey (`string`, _optional_)** - An arbitrary string used to support multiple pods on the same origin or multiple tabs in parallel. For example, `boot({ apiKey: "...", storageKey: "vite" })` and `boot({ apiKey: "...", storageKey: "app-12345" })` allocate two completely independent disks. | ||
| - **userImage (`string`, _optional_)** - A URL pointing to a custom WebAssembly binary to load into the pod environment. When specified, this WebAssembly module will be loaded and made available within the pod instead of using the default environment. | ||
| - **storageKey (`string`, _optional_)** - An arbitrary string that identifies the pod's storage. Rebooting with the same key **resumes the same disk**, making the filesystem persistent across sessions. Using different keys gives each pod its own independent disk. For example, `boot({ apiKey: "...", storageKey: "my-project" })` always resumes the same environment, while `boot({ apiKey: "...", storageKey: "app-12345" })` uses a separate one. | ||
| - **userImage (`string`, _optional_)** - A URL pointing to a custom ext2 filesystem image to use as the pod's root filesystem. When specified, the pod's home directory will point to the `/home` directory within this image. |
There was a problem hiding this comment.
No, this is incorrect. The image is not the root. It's mounted directly on /home
| - **cols (`number`, _optional_)** - The number of columns (width) for the terminal display. If not specified, a default width will be used. | ||
| - **rows (`number`, _optional_)** - The number of rows (height) for the terminal display. If not specified, a default height will be used. | ||
| - **onOutput** (`function(buffer: Uint8Array | ArrayBuffer, vt?: unknown) => void`) - Callback function invoked whenever the terminal produces output. The buffer contains the raw terminal data, and vt contains optional VT escape sequence information. | ||
| - **onOutput (`function(buffer: Uint8Array | ArrayBuffer, vt?: unknown) => void`)** - Callback function invoked whenever the terminal produces output. The buffer contains the raw terminal data, and vt contains optional VT escape sequence information. |
There was a problem hiding this comment.
Wait, why would we send either Uint8Arrays or ArrayBuffer. We certainly send only one of these. Check the code please.
|
|
||
| ## Notes | ||
|
|
||
| `onOpen` maps to use of the [`xdg-open`](https://linux.die.net/man/1/xdg-open) utility. |
There was a problem hiding this comment.
Maybe "intercepts the use of" rather than "maps to use of"
| ## Returns | ||
|
|
||
| `createFile` returns a [Promise] which is resolved when the operation has succeded. The promise resolves to a `BinaryFile` object if `mode="binary"`, and to a `TextFile` object if `mode="utf-8"`. If the file could not be created, the [Promise] will be rejected. | ||
| `createFile` returns a [Promise] which resolves to a [BinaryFile] object if `mode="binary"`, and to a [TextFile] object if `mode="utf-8"`. If the file could not be created, the [Promise] will be rejected. |
There was a problem hiding this comment.
We should also specify that if the file exist it will be truncated to 0 length
|
|
||
| **"Isolated"** means each Pod is self-contained: | ||
|
|
||
| - Files don't persist between Pods by default |
There was a problem hiding this comment.
Let's clarify here, it seems to conflate isolation between pods and persistence of the disk
|
|
||
| - Files don't persist between Pods by default | ||
| - Processes in one Pod cannot access another | ||
| - Nothing runs on a separate server, it's all client-side |
There was a problem hiding this comment.
Let's flip this, everything runs client-side, there is no server-side execution...
|
|
||
| A Pod is created with [`BrowserPod.boot`](./boot) and exists for the lifetime of the browser session. By default, Pods are **ephemeral** — closing the tab starts a fresh environment. | ||
|
|
||
| To persist the filesystem across sessions, pass a `storageKey` to [`boot`](./boot). Rebooting with the same key resumes the same disk: |
There was a problem hiding this comment.
This is correct, but should be reflected in the storageKey docs
Feedback implemented!
For consideration
Is this correct? Or does the pod's home directory point to the root of the image instead?
changes