Files
Arcrun/.env.example
uncle6me-web 465c505000 fix(execution-truth): 修系統對 401 假綠根因 + acr run self-hosted + D1-in-update
Haiku 自主壓測(test_arcrun/5)暴露的真 bug,逐一修復:

1. 假綠根因:http_request host function 丟掉 HTTP status code(main.go:112 架構債)
   → 非 2xx(如 Notion 401)被判 success → 引擎自己對失敗報成功。
   修:host fn 非 2xx 回 {error,status,body} envelope,既有判定鏈正確識別。
   http_request/claude_api/kbdb_upsert_block/km_writer 已修(4 worker deploy);
   auth_service_account 自有 OAuth 判定不套。

2. acr run self-hosted:原一律走 /webhooks/<name>(需先 push)→ 沒 push 回 404 純文字
   → res.json() 爆假錯誤。修:本機有 YAML 走玩法一 /cypher/execute 直接執行(三模式一致)
   + res.ok 擋非 2xx + findWorkflowYaml 容忍 .yaml 副檔名。

3. D1-in-update:D1 只在 init 建一次,update 漏建 → token 補權限後無冪等補建路徑。
   修:update 也 ensureD1Database(已驗證 D1 建起 count:1)。

4. CF token 教學漏 D1:llms.txt/.env.example 加「Account/D1/Edit」必勾 + init/preflight
   訊息指明 token 缺 D1 權限的修法。

CLI 1.3.4 publish。Haiku 壓測結論:onboarding 治好(裝+init 沒跳過、建 recipe 不建零件),
但仍會假綠(curl 繞過/D1 沒建謊報)→ 印證執行真相要系統能驗、不信 AI 自報。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 22:12:09 +08:00

58 lines
3.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ───────────────────────────────────────────────────────────────────────────
# arcrun self-hosted .env 範本
#
# 用法(AI 操盤手會幫你做):把這個檔複製成 .env,然後照下面說明,
# 一格一格把「=」右邊填上。左邊的名稱(KEY)不要改。
# cp .env.example .env
#
# 這個 .env 只放在你自己電腦/專案,已被 .gitignore 排除,不會上傳。
# ───────────────────────────────────────────────────────────────────────────
# ── ① Cloudflare(最基礎,這兩格沒填,下面什麼都跑不了)────────────────────────
#
# arcrun 跑在「你自己的 Cloudflare」上(免費額度即可,不必綁信用卡)。
# 你要先有一個 Cloudflare 帳號,然後拿兩串東西貼回來:
#
# 1) 帳號代碼(Account ID):
# 登入 https://dash.cloudflare.com → 右側欄就有「Account ID」→ 複製貼到下面。
#
# 2) 金鑰(API Token):
# https://dash.cloudflare.com/profile/api-tokens → Create Custom Token →
# 勾三組權限(缺一不可):
# · Account / Workers Scripts / Edit
# · Account / Workers KV Storage / Edit
# · Account / D1 / Edit ← 必勾!arcrun 用 D1 存 workflow/recipe
# 漏勾會在 acr init 建 D1 時報 Authentication error
# → 建立後複製那串 token 貼到下面。(不需要 R2、不需要綁卡,D1 也在免費額度。)
#
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_API_TOKEN=
# ── ② 身份與加密(自架單人用,這兩格你自己決定/保管)──────────────────────────
#
# NAMESPACE:你的資料分區標籤。隨便取個英數小名即可(例:leo、myteam)。
# 這不是密碼,只是用來分隔你的資料。
#
# ENCRYPTION_KEY:你的 credential 加密金鑰,64 個以上的 hex 字元。你自己保管。
# 不會的話,AI 可以幫你產一串:
# node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# ⚠️ 這串忘了 = 你之前上傳加密的 credential 就解不開了,請留底。
# (安裝完還要把「同一串」設進你的 worker,acr init 會印確切指令給你跟著做。)
#
NAMESPACE=
ENCRYPTION_KEY=
# ── ③ 各服務的 token(要連哪個服務才填哪個;可之後再加)────────────────────────
#
# 連外部服務(Notion、Gmail、Telegram…)的 token 放這裡,給 AI 幫你
# 透過 `acr creds push` 加密上傳(不會明文留在雲端)。要連什麼就加一行。
#
# 例:連 Notion → 去 https://www.notion.com/my-integrations 建一個 integration、
# 拿它的 token(ntn_… 開頭),把你要讀的 database 分享給這個 integration
# 然後填在下面:
#
# NOTION_INTEGRATION_TOKEN=