feat(arcrun): implement arcrun MVP — open-source AI workflow engine
Phase 1-5 complete per .agents/specs/u6u-core-mvp/: **Phase 1 — Cherry-pick & cleanup** - Create arcrun/ from cypher-executor, credentials, builtins, registry - Remove 9 InkStone Service Bindings (KBDB, REGISTRY, CLINIC_*, AICEO, MINI_ME) - Rewrite component-loader: 3-layer (builtin → WASM_BUCKET R2 → error) - Remove autoPublishMissing.ts, proxy.ts (AICEO), execution-logger.ts (KBDB) - Clean all KV namespace IDs and InkStone internal URLs from config files **Phase 2 — contract.yaml completeness** - Add credentials_required to gmail, google_sheets, telegram, line_notify - Add config_example to all 21 components with annotated field descriptions **Phase 3 — Credential injection** - Add credential-injector.ts: AES-GCM decrypt from CREDENTIALS_KV - Integrate into GraphExecutor before WASM execution - Structured errors with repair instructions when credential missing **Phase 4 — CLI (acr)** - cli/package.json: arcrun package, bin: acr, deps: commander/js-yaml/chalk/ora - 8 commands: init, creds push, push, run, validate, parts, list, logs - Standard mode: writes directly to user's CF KV via CF REST API - acr init: interactive setup with arcrun.dev API Key registration **Phase 5 — Open source release prep** - README.md: 5-minute quickstart, component table, workflow YAML syntax - CONTRIBUTING.md: TinyGo dev env, component scaffolding, submission flow - Security audit: no InkStone internal URLs/IDs in committed files - .gitignore: exclude credentials.yaml, .wrangler, *.wasm https://claude.ai/code/session_01BnCdSLVH8tUed9VrrPavgT
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# validate_json
|
||||
|
||||
u6u 第一個 WASM 零件。驗證輸入字串是否為合法 JSON 格式。
|
||||
|
||||
## 編譯
|
||||
|
||||
需要安裝 [TinyGo](https://tinygo.org/getting-started/install/):
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
brew install tinygo
|
||||
|
||||
# 編譯為 WASM
|
||||
tinygo build -o validate_json.wasm -target=wasi .
|
||||
```
|
||||
|
||||
## 本地測試
|
||||
|
||||
```bash
|
||||
# 合法 JSON → {"valid":true}
|
||||
echo '{"json_string":"{\"key\":\"value\"}"}' | wasmtime validate_json.wasm
|
||||
|
||||
# 非法 JSON → {"valid":false,"error":"..."}
|
||||
echo '{"json_string":"not-json"}' | wasmtime validate_json.wasm
|
||||
|
||||
# 空字串 → {"valid":false,"error":"json_string is required"}
|
||||
echo '{"json_string":""}' | wasmtime validate_json.wasm
|
||||
```
|
||||
|
||||
## 提交至 Component Registry
|
||||
|
||||
```bash
|
||||
# 驗證合約格式
|
||||
curl -X POST https://component-registry.finally.click/components/validate-contract \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @component.contract.yaml
|
||||
|
||||
# 提交零件(multipart)
|
||||
curl -X POST https://component-registry.finally.click/components \
|
||||
-F "contract=@component.contract.yaml;type=application/yaml" \
|
||||
-F "wasm=@validate_json.wasm;type=application/wasm"
|
||||
```
|
||||
Reference in New Issue
Block a user