feat(process): add explicitly granted process API
This commit is contained in:
1 parent
9922bfae98
commit
3ef18fb496
17 files changed
+433
-15
No files matched your search
+7
-1
@@ -207,6 +207,7 @@ resource.request("fs.remove", [path]) -> {ok:true, value:None}
|
||||
resource.request("fs.rename", [from, to]) -> {ok:true, value:None}
|
||||
resource.request("clock.now", []) -> {ok:true, value:UnixMillis}
|
||||
resource.request("env.get", [name]) -> {ok:true, value:Text}
|
||||
resource.request("process.run", [program, args])-> {ok:true, value:{status, stdout, stderr}}
|
||||
```
|
||||
|
||||
* Arguments are `Text` paths only. `Memory`/`Resource` values are rejected.
|
||||
@@ -231,6 +232,11 @@ resource.request("env.get", [name]) -> {ok:true, value:Text}
|
||||
* `env.get` takes one exact variable name and requires an `--allow-env NAME`
|
||||
grant; un-granted names are `permission.denied`, missing names are recoverable
|
||||
`env.not_found` and non-UTF-8 values are `env.not_unicode` (ADR-0043).
|
||||
* `process.run` takes an exact program path and a List of Text arguments,
|
||||
requires an `--allow-process PROGRAM` grant, runs without a shell with a
|
||||
cleared environment in the project root, and enforces a 5 second timeout and
|
||||
1 MiB stdout/stderr caps. It is project-mode only and is **not** an OS
|
||||
sandbox (ADR-0044).
|
||||
|
||||
## 4. Errors
|
||||
|
||||
@@ -326,7 +332,7 @@ host boundary. Names are stable; adding one requires a spec update.
|
||||
| `resource.read` | `(handle, memory: Memory, offset: Int, max_bytes: Int) -> Result` | bounded chunk read into Memory; `{count,eof}` |
|
||||
| `resource.write` | `(handle, memory: Memory, offset: Int, length: Int) -> Result` | bounded byte write; `{count}` |
|
||||
| `resource.close` | `(handle) -> Result` | releases the host slot |
|
||||
| `resource.request` | `(operation: Text, arguments: List) -> Result` | non-streaming `fs.*` operations (ADR-0041) `clock.now` (ADR-0042) and `env.get` (ADR-0043); project-mode and grant-checked |
|
||||
| `resource.request` | `(operation: Text, arguments: List) -> Result` | non-streaming `fs.*` operations (ADR-0041) `clock.now` (ADR-0042), `env.get` (ADR-0043) and `process.run` (ADR-0044); project-mode and grant-checked |
|
||||
| `math.parse/eval/substitute` | see `spec/math.md` | P5; `math.simplify`/`math.differentiate` are declared but return `math.unsupported` in this build |
|
||||
| `foreign.run/call` | see `spec/foreign.md` | P5, capability-gated |
|
||||
| `fs.read/write` | see `spec/security.md` | capability-gated |
|
||||
|
||||
Reference in new issue
Block a user