feat(code): Workers 就緒化(裁定 A)—— singlefile variant + 純 JS SHA-256 prelude

- 沙箱改用 quickjs-emscripten singlefile variant(wasm 內嵌 base64、同步載入),
  CF Workers 相容;sandbox.mjs 成 Node/Worker 共用 runtime-agnostic 核心。
- sha256 curated builtin 改「純 JS SHA-256 prelude 字串注入」,去掉 node:crypto /
  async Web Crypto host-call,Node/Worker 皆決定性(card content_hash 逐字等價)。
- index.ts 成可部署 Worker host(Hono,POST /→runCode),自足不走 TinyGo 模板流程。
- 補 wrangler.toml(arcrun-code / code.arcrun.dev)、tsconfig、DEPLOY.md。
- contract stability 修為 floating(過 registry zod schema 驗證)。
- 單測 12/12 全綠(含 card→envelope 與原模組 planCard 逐欄全等)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJiLCRUU2o3aSpPEzVCt2o
This commit is contained in:
Leo
2026-07-06 04:39:28 +00:00
parent 60f5f10ba5
commit efa0b0578c
8 changed files with 226 additions and 60 deletions
+7 -3
View File
@@ -3,14 +3,18 @@
"version": "0.1.0",
"private": true,
"type": "module",
"description": "arcrun code 零件 —— sandbox inline JSQuickJS-wasm",
"description": "arcrun code 零件 —— sandbox inline JSQuickJS-wasm, Workers-ready",
"main": "index.ts",
"scripts": {
"test": "vitest run --config vitest.config.mjs"
},
"dependencies": {
"quickjs-emscripten": "^0.31.0"
"hono": "^4.7.0",
"quickjs-emscripten-core": "^0.31.0",
"@jitl/quickjs-singlefile-mjs-release-sync": "^0.32.0"
},
"devDependencies": {
"vitest": "^3.1.0"
"vitest": "^3.1.0",
"wrangler": "^4.0.0"
}
}