feat(stdlib): add datetime and project-mode clock APIs

This commit is contained in:
Marqdo Agent committed 2026-11-21 08:36:40 +08:00
1 parent cffb6790be
commit ae69391bc0
15 files changed
+527 -11

No files matched your search

+5 -1
View File
@@ -205,6 +205,7 @@ resource.request("fs.list", [path]) -> {ok:true, value:List<Text>}
resource.request("fs.mkdir", [path]) -> {ok:true, value:None}
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}
```
* Arguments are `Text` paths only. `Memory`/`Resource` values are rejected.
@@ -223,6 +224,9 @@ resource.request("fs.rename", [from, to]) -> {ok:true, value:None}
* `remove` never recurses; `rename` never overwrites; `mkdir` is single-level.
* The operation never moves file bytes. Content still uses
`resource.open/read/write/close`.
* `clock.now` takes no arguments and returns UTC Unix milliseconds. It is
project-mode only like `fs.*`; a clock before the epoch is fatal host error
(ADR-0042).
## 4. Errors
@@ -318,7 +322,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; project-mode and grant-checked (ADR-0041) |
| `resource.request` | `(operation: Text, arguments: List) -> Result` | non-streaming `fs.*` operations (ADR-0041) and `clock.now` (ADR-0042); 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 |