@@ -61,11 +61,10 @@ openshell sandbox create --name js-demo \
6161 --keep --no-tty --no-auto-providers -- /work/guest.js
6262```
6363
64- The bundled script prints a greeting, attempts a request, catches the
65- network-disabled error, and counts once per second for about 12 seconds.
66- Egress is disabled by the runtime's lack of network bindings; this example
67- does not relay requests to the supervisor for policy evaluation. No policy
68- file is needed.
64+ The bundled script prints a greeting, attempts a request, and catches the
65+ network-disabled error. Egress is disabled by the runtime's lack of network
66+ bindings; this example does not relay requests to the supervisor for policy
67+ evaluation. No policy file is needed.
6968
7069The create command prints the script's output and returns its exit code. The
7170sandbox becomes ` Completed ` on exit code 0 or ` Error ` on a nonzero exit code.
@@ -76,54 +75,6 @@ print an error and return exit code 1.
7675Add ` --detach ` to run without attaching; detached creation does not stream guest
7776output. Use ` openshell sandbox connect js-demo ` to attach afterward.
7877
79- ## Suspend and resume
80-
81- Suspension freezes the V8 isolate in place and the ` js-sbx serve ` process keeps
82- it in memory; resume continues the same isolate in a new runtime generation.
83- The default ` guest.js ` counts for about 12 seconds after its network check:
84-
85- ``` shell
86- ./start.sh
87- ```
88-
89- In another terminal, create the sandbox, then suspend and resume it while it
90- counts:
91-
92- ``` shell
93- openshell sandbox create --name js-demo \
94- --keep --no-tty --no-auto-providers --detach -- /work/guest.js
95- openshell sandbox suspend js-demo
96- openshell sandbox resume js-demo
97- ```
98-
99- To discard the retained state and start the script from the beginning:
100-
101- ``` shell
102- openshell sandbox stop js-demo
103- openshell sandbox start js-demo
104- ```
105-
106- ` backend.log ` shows the count continue from its value at suspension, and the
107- elapsed time includes the gap. The 15-second deadline counts only running time.
108-
109- The driver sends ` SIGUSR1 ` to the supervisor, which calls ` SuspendBoundary ` .
110- The backend retains the frozen isolate and privately persists its handle in
111- ` restore-reference ` before acknowledging suspension. The supervisor exits;
112- it does not write or read a reference file. On resume the driver provisions
113- the backend using ` launch.json ` , while the supervisor attaches through its
114- ordinary boundary-opening path. The shared ` boundary.json ` contains no
115- retention fields. The reference authenticates the sandbox with a key in
116- ` retention.key ` , so a restarted ` js-sbx serve ` can tell lost state from a forged
117- or superseded reference. If you restart ` js-sbx serve ` while the sandbox is suspended, resume
118- fails and the sandbox stays ` Suspended ` ; ` openshell sandbox start js-demo `
119- then runs the script from the beginning.
120- ` openshell sandbox start ` , ` stop ` , and ` delete ` discard the retained state.
121-
122- Restoration borrows the retained guest until the driver observes supervisor
123- readiness and consumes ` restore-reference ` . If startup fails or times out,
124- the driver stops the supervisor and waits for the backend to refreeze the guest
125- before reporting failure. The same reference remains available for a retry.
126-
12778## Inspect and stop
12879
12980``` shell
@@ -143,5 +94,5 @@ limits do not bound all native V8 resources. The V8 isolate confines JavaScript;
14394the host process does not run in a Linux namespace or container.
14495
14596The example has no HTTP relay or guest network implementation. ` fetch ` is only
146- a synchronous denial stub. Exec, PTY, providers, and supervisor recovery are
147- unsupported. Retained state lives only in the ` js-sbx serve ` process memory .
97+ a synchronous denial stub. Exec, PTY, providers, suspend/resume, and supervisor
98+ recovery are unsupported .
0 commit comments