Q+ 文档

Playground(本地)

English summary. Playground is a local Python stdlib HTTP service that compiles/runs Q+ code with per-run temp dirs, ulimit, timeout/output/concurrency limits and host-path scrubbing; async/thread examples are VM-only. It is not a security sandbox and is not a deployed public service in the release tree (deployment is a separate planning input).

Q+ Playground 是本地开发用的轻量 Web 运行环境:site/playground.py 提供编辑页面与 POST /api/run 接口,用发布树工具链(build/bqvm + build/qboot.qbc)在临时目录编译并执行 Q+ 源码,返回 stdout/stderr/退出码与耗时。

启动(Getting Started)

首次使用见 快速上手;本地服务/限制不变。

启动

python3 site/playground.py --host 127.0.0.1 --port 8787 --qplus-root .

部署包与安全边界(v1.7.0)

真实运行限额(site/playground.py 源码 + HTTP 实测)

项值实测/说明
源码200,000 B超限 413 source too large: ... (limit 200000 bytes)
请求体256,000 B超限 413 request body too large: ...
VM 运行超时3,000 ms(墙钟 +3 s 强杀)死循环 ok=false, stage=run, exit=1, error="execution timed out after 3000 ms"
编译超时15 sstage=compile/exit=124/compilation timed out
并发2MAX_CONCURRENT=2
输出上限64,000 字符尾部 ... [output truncated](实测 64,023 字符含标记)
资源编译 1 GiB/10 s CPU;运行 256 MiB/4 s CPU/1024 KB 文件每次独立临时目录 + 清理
禁用extern、裸 sys_*、use std.file/http/http_client/socket/env/process;400 source rejected: ...(alpha 守卫,非安全边界)
文件系统仅 per-run 临时目录(std.fs/std.io 文件函数可用)实测 true tmpfs;运行后清理,无持久化
网络无真实网络raw sys 禁用;真 loopback 未提供(std.net -8)

详见 docs/PLAYGROUND.md:完整限额、错误 JSON、stdlib 子集、 文件系统/网络边界与不得宣称项。编译/运行失败常返回 HTTP 200(ok=false + stage/exit/error), 仅请求级校验 400/413;非沙箱/不要公网暴露。

限制(本地工具,非公开服务)

相关文档

参见 PLAYGROUND_DEPLOY.md:本地/非公开/非安全边界,不得公网暴露;Docker 模板未生产验证。

← Q+ Hub