# `code` 零件 —— 部署清單(過閘用;本輪不執行) > 封裝=A(quickjs-emscripten singlefile variant)。`code` 是**自足 Worker**,不走 > `deploy-logic-components.sh`(那條是 TinyGo-wasm 專用)。以下由 leo 過閘後執行。 ## 1. 部署 code Worker(wrangler,禁 acr update) ```bash cd registry/components/code npm install # 裝 hono + quickjs-emscripten-core + singlefile variant npm test # 12 測試須綠(部署前 gate) npx wrangler deploy # → arcrun-code,route code.arcrun.dev/* ``` - Worker 名:`arcrun-code`;route:`code.arcrun.dev/*`(見 `wrangler.toml`)。 - **無需注入任何 secret/env**:`code` 零件不碰網路/env,Worker 本身零 binding。 - 冷啟:quickjs wasm 內嵌 base64、同步 instantiate;首個請求 instantiate 一次後 module 快取。 ## 2. 註冊到 registry index ```bash REGISTRY_URL=https://registry.arcrun.dev bash registry/scripts/register-component.sh code ``` - contract 已過 zod schema 驗證(`stability: floating`、`category: logic`、 `io_model: stdin_stdout_json`、`gherkin_tests` ≥2)。 - `sandbox_limits` / `config_example` 為 yaml 內文件欄位,registry index 會 strip(不影響)。 ## 3. 冒煙驗證(部署後) ```bash # 基本 curl -s https://code.arcrun.dev/ | jq # {ok:true, component:"code"} curl -s -X POST https://code.arcrun.dev/ -H 'content-type: application/json' \ -d '{"code":"return {sum: input.a + input.b};","input":{"a":2,"b":40}}' | jq # → {"success":true,"data":{"sum":42}} # 隔離 curl -s -X POST https://code.arcrun.dev/ -H 'content-type: application/json' \ -d '{"code":"return typeof fetch;","input":{}}' | jq # → {"success":true,"data":"undefined"} ``` ## 4. 依賴的下游(Arcrun#8 workflow —— 另一分支) `code` 零件是 `km_wiki_ingest_drain` workflow 的前置。workflow 在 `feat/issue-8-mechanical-wiki-ingest` 分支,以 `component: code` 引用本零件(registry 解析), 不需本零件檔案同分支。issue-8 的部署與 notes 寫入量見該分支 `DEPLOY.md` / 本輪回報的「一次過閘清單」。