@cloudflare/sandbox 1.0.0-rc.0 → 1.0.0-rc.1

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.
package/README.md CHANGED
@@ -64,17 +64,17 @@ The image needs the helper that `Files` runs, and the Worker needs `nodejs_compa
64
64
 
65
65
  | Goal | Guide | Example |
66
66
  | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
67
- | Run a script and read its output | [Execute commands](https://developers.cloudflare.com/sandbox/commands/execute-commands/) | [`workspace`](examples/workspace) |
67
+ | Run a script and read its output | [Execute commands](https://developers.cloudflare.com/containers/guides/execute-commands/) | [`workspace`](examples/workspace) |
68
68
  | Keep a server or build running | [Run background processes](https://developers.cloudflare.com/sandbox/commands/run-background-processes/) | [`process-workspace`](examples/process-workspace) |
69
69
  | Open a shell in the browser | [Open a terminal in the browser](https://developers.cloudflare.com/sandbox/commands/open-a-terminal-in-the-browser/) | [`terminal-workspace`](examples/terminal-workspace) |
70
70
  | Process files from a bucket | [Mount an R2 bucket](https://developers.cloudflare.com/sandbox/files/mount-an-r2-bucket/) | [`artifact-workspace`](examples/artifact-workspace) |
71
71
  | Save a workspace and resume it later | [Save and restore a sandbox](https://developers.cloudflare.com/sandbox/files/save-and-restore-a-workspace/) | [`checkpoint-workspace`](examples/checkpoint-workspace), [`backup-workspace`](examples/backup-workspace) |
72
- | Preview a web app while you edit it | [Preview a web application](https://developers.cloudflare.com/sandbox/previews/preview-a-web-application/) | [`preview-workspace`](examples/preview-workspace) |
72
+ | Preview a web app while you edit it | [Preview a web application](https://developers.cloudflare.com/sandbox/previews/) | [`preview-workspace`](examples/preview-workspace) |
73
73
  | Share a port on its own URL | [Serve previews on their own hostnames](https://developers.cloudflare.com/sandbox/previews/serve-previews-on-their-own-hostnames/) | [`share-workspace`](examples/share-workspace) |
74
74
  | Choose which hosts a sandbox can reach | [Control network access](https://developers.cloudflare.com/sandbox/network/) | [`outbound-workspace`](examples/outbound-workspace) |
75
75
  | Run a coding agent on a repository | [Coding agents](https://developers.cloudflare.com/sandbox/coding-agents/) | [`coding-agents`](examples/coding-agents), [`devin`](devin), [`openai/agents-api`](openai/agents-api) |
76
76
 
77
- To run JavaScript or Python without a Linux environment, use [Dynamic Workers](https://developers.cloudflare.com/sandbox/choose-an-environment/) instead.
77
+ To run JavaScript or Python without a Linux environment, use [Dynamic Workers](https://developers.cloudflare.com/sandbox/concepts/) instead.
78
78
 
79
79
  ## Coming from 0.x
80
80
 
package/dist/index.d.mts CHANGED
@@ -124,6 +124,15 @@ type DirectoryBackupContainer = Pick<Container, "exec" | "interceptOutboundHttp"
124
124
  declare class DirectoryBackups {
125
125
  #private;
126
126
  constructor(container: DirectoryBackupContainer, gateway: DirectoryBackupGatewayBinding, storage: DirectoryBackupStorage);
127
+ /**
128
+ * Routes the Container's backup traffic to `DirectoryBackupGateway`, which refuses every
129
+ * request until an operation starts. Backups and restores do this themselves; call it only
130
+ * when the Durable Object also registers `interceptAllOutboundHttp()`, which takes every
131
+ * hostname registered after it. Call it right after starting the Container and before the
132
+ * catch-all, never while an operation may be running: it would replace that operation's
133
+ * grant. It does not start the Container.
134
+ */
135
+ intercept(): Promise<void>;
127
136
  /**
128
137
  * Backs up `dir` and returns its record. Pause writers in `dir` first: files that change
129
138
  * while it's read are captured as they are at that moment.
@@ -141,8 +150,8 @@ declare class DirectoryBackups {
141
150
  * need not.
142
151
  *
143
152
  * @throws {SandboxFileError} The target's parent is missing (`ENOENT`), the target isn't a
144
- * directory (`ENOTDIR`) or is a mount point (`EBUSY`), the swap fails (for example `EXDEV`),
145
- * or the disk fills (`ENOSPC`).
153
+ * directory (`ENOTDIR`), is a mount point or has one inside it (`EBUSY`), the swap fails (for
154
+ * example `EXDEV`), or the disk fills (`ENOSPC`).
146
155
  * @throws {SandboxBackupError} `BACKUP_NOT_FOUND`, `BACKUP_INTEGRITY`, or `BACKUP_TRANSFER`.
147
156
  */
148
157
  restore(backup: DirectoryBackup, options?: DirectoryRestoreOptions): Promise<void>;
package/dist/index.mjs CHANGED
@@ -652,6 +652,17 @@ var DirectoryBackups = class {
652
652
  this.#prefix = prefix;
653
653
  }
654
654
  /**
655
+ * Routes the Container's backup traffic to `DirectoryBackupGateway`, which refuses every
656
+ * request until an operation starts. Backups and restores do this themselves; call it only
657
+ * when the Durable Object also registers `interceptAllOutboundHttp()`, which takes every
658
+ * hostname registered after it. Call it right after starting the Container and before the
659
+ * catch-all, never while an operation may be running: it would replace that operation's
660
+ * grant. It does not start the Container.
661
+ */
662
+ intercept() {
663
+ return this.#deny();
664
+ }
665
+ /**
655
666
  * Backs up `dir` and returns its record. Pause writers in `dir` first: files that change
656
667
  * while it's read are captured as they are at that moment.
657
668
  *
@@ -698,8 +709,8 @@ var DirectoryBackups = class {
698
709
  * need not.
699
710
  *
700
711
  * @throws {SandboxFileError} The target's parent is missing (`ENOENT`), the target isn't a
701
- * directory (`ENOTDIR`) or is a mount point (`EBUSY`), the swap fails (for example `EXDEV`),
702
- * or the disk fills (`ENOSPC`).
712
+ * directory (`ENOTDIR`), is a mount point or has one inside it (`EBUSY`), the swap fails (for
713
+ * example `EXDEV`), or the disk fills (`ENOSPC`).
703
714
  * @throws {SandboxBackupError} `BACKUP_NOT_FOUND`, `BACKUP_INTEGRITY`, or `BACKUP_TRANSFER`.
704
715
  */
705
716
  async restore(backup, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/sandbox",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "Structured workspace file operations for Cloudflare sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {