Files
streamline/.env.example
T
2026-11-16 17:26:44 -08:00

316 lines
17 KiB
Bash
Raw 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.
# Backend HTTP port (frontend dev proxy points here)
PORT=5173
HOST=127.0.0.1
# Control-plane metadata database (required; PostgreSQL only).
# The local setup in README creates this development-only role and database.
# Never point a local development server at the production database.
DATABASE_URL=postgresql://streamline:streamline@127.0.0.1:5432/streamline_dev
# --- Cluster -------------------------------------------------------------
# Shared secret between the control plane and every satellite. Leave empty on a
# trusted single box; set the same non-empty value on both sides otherwise.
CLUSTER_SECRET=
# RSI 自动实验回路的机器令牌(control-server/src/routes_rsi_loop.ts)。不填 = 回路关闭:
# /api/rsi-loop/* 返回 503,判定任务照常采集指标但不会有实验进来。卫星上填同一个值
# 才会开放原生会话记录接口(/sat/transcripts,决策点重放用);只给作为数据源的节点填。
RSI_LOOP_TOKEN=
# Control plane: how long without a heartbeat before a node is marked offline.
CLUSTER_NODE_TIMEOUT_MS=30000
# Control plane: bytedcli path for reading Bits test plans (用例验证). Default: PATH,
# then /opt/homebrew/bin, /usr/local/bin, /usr/bin, ~/.npm-global/bin, ~/.local/bin.
# Per-user credentials live in this machine's bytedcli profiles. See docs/verify.md.
# BYTEDCLI_BIN=
# Control plane: decrypting ticket ALog attachments through Slardar (control-server/src/alog_decode.ts).
# Uses one shared bytedcli profile, authorised once on this machine as the service user:
# sudo -u jiaopengwen -i bytedcli --profile streamline-alog auth login --qr-image
# Refreshed every 12h (`auth status --force-refresh`); GET /api/alog/auth-status shows expiry + whether it slides.
# STREAMLINE_ALOG_BYTEDCLI_PROFILE=streamline-alog
# STREAMLINE_ALOG_BYTEDCLI_SITE= # empty = bytedcli default (cn)
# STREAMLINE_ALOG_SLARDAR_ORIGIN= # empty = https://slardar.bytedance.net
# STREAMLINE_ALOG_SLARDAR_REGION= # empty = cn
# STREAMLINE_ALOG_AID=1233 # fallback when the zip member names carry no aid
# --- 节点健康 (control plane) --------------------------------------------
# Thresholds for the health panel + Lark alerts. Every rule fires high and
# clears low; the gap is what keeps a node sitting on the line from flapping.
# HEALTH_DISK_FIRE_PCT=90
# HEALTH_DISK_CLEAR_PCT=85
# Per-node override, e.g. a node with a legitimately small volume. The suffix is
# the node id upper-cased with non-alphanumerics turned into underscores:
# HEALTH_DISK_FIRE_PCT_FEI_IOS_01_SHIRO0_ICU=95
#
# How long a condition must hold before it PAGES. It shows on the panel
# immediately either way — this only debounces the Lark push.
# HEALTH_SUSTAIN_MS=120000
# Minimum gap between two pushes for the same (node, rule).
# HEALTH_COOLDOWN_MS=1800000
# Metrics older than this mean the node heartbeats but stopped sampling.
# HEALTH_METRICS_STALE_MS=180000
# How long per-minute history is kept. This is what caps node_metrics at a
# constant size (~10k rows/day for 7 nodes ⇒ ~300k rows at 30 days).
# HEALTH_RETENTION_MS=2592000000
# How often nodes are judged + history is pruned.
# HEALTH_SWEEP_MS=30000
# Who gets node-health alerts. Comma-separated emails; Lark delivers by email so
# no open_id lookup is needed. Deliberately NOT the LARK_NOTIFY_CHAT_ID group —
# "磁盘 92%" is noise to everyone in it except whoever can SSH into the box.
# Unset ⇒ the first super admin (admin_db.SUPER_ADMINS).
# Set-but-EMPTY ⇒ nobody. That is how alerts are muted.
# HEALTH_ALERT_EMAILS=
# --- 节点健康 (satellite sampler) ----------------------------------------
# The sampler is deliberately independent of the heartbeat: the heartbeat only
# reads its cached snapshot, so a slow or wedged sample can never delay a beat
# and get a healthy node reaped as offline. Tune with that in mind.
# Fast tier (loadavg / CPU delta / statfs — pure syscalls, ~6µs).
# METRICS_SAMPLE_MS=15000
# Run the slow tier (vm_stat / sysctl / claude auth status) every Nth fast tick.
# METRICS_SLOW_EVERY=4
# Hard ceiling on one slow sample; past it the previous values are kept and
# flagged stale rather than replaced with zeroes.
# METRICS_SLOW_TIMEOUT_MS=3000
# Per-subprocess ceiling inside a slow sample.
# METRICS_PROBE_TIMEOUT_MS=2500
# Volume to report. Defaults to BUG_WORKSPACE_ROOT, then the home directory.
# METRICS_DISK_PATH=
# --- Satellite (executor) — only read by `bun run start:satellite` -------
# This node's stable id == its DDNS host. This box is the first satellite:
AGENT_HOST=fei-android-01.bytedance.net
# Platform this machine services: android | ios
AGENT_PLATFORM=android
# Port the satellite HTTP service binds.
AGENT_PORT=5180
# Base URL the control plane dials for this node. Defaults to http://$AGENT_HOST:$AGENT_PORT.
# For a pure-local test (no DNS) use the loopback form:
# AGENT_BASE_URL=http://127.0.0.1:5180
# Where the satellite reaches the control plane's internal API.
CONTROL_PLANE_URL=http://127.0.0.1:5173
# Concurrent evaluations this node runs (its eval-pool size + advertised capacity).
EVAL_PARALLEL=3
# Optional phase selection: run = all Run task types; evaluate = all Evaluate
# task types. Unset keeps both loops. This does not filter by task type.
# Security Evaluate always uses a runner-owned, task-private shallow checkout and
# only runs on nodes whose AI_WORKSPACE has no TikTok. A node with the shared
# AI_WORKSPACE/TikTok checkout starts in any mode, still evaluates bugs and
# features, and tells the control plane not to send it security evaluations.
SATELLITE_WORK_MODE=
# Set true to make this satellite evaluate-only. It advertises zero Run capacity
# and does not start the Bugfix/Feature/Security/Prototype/Verify scheduler.
# Legacy phase-only switch. Do not pair it with SATELLITE_WORK_MODE=run.
DISABLE_RUN=false
# Where the TikTok repo lives — required for the runner
TIKTOK_REPO=/Users/fei/workspace/TikTok
# Base branch the runner resets to before checking out a bugfix branch
BASE_BRANCH=develop
# 代码仓注册表(shared/src/repos.ts)的可覆盖项。三个仓的值都有内置默认,通常不用填。
#
# tt_im_monorepo(IM 的 Lynx 前端)不走 `/openapi/merge_request/create`:TikTok-IM-FE
# 是 space,不是 host group。人在面板点「创建开发任务」后,控制面用下面的「需求研发
# 流程」创建 Bits 开发任务,由任务自动生成 Codebase MR;Streamline 直接回填任务链接。
# 该分支仍刻意不自动触发,由负责人在人工复核时点一下。
# BITS_PROJECT_GITLAB_ID_TT_IM_MONOREPO=753114
# BITS_SPACE_ID_TT_IM_MONOREPO=39151416834
# BITS_DEV_TASK_TEAM_FLOW_ID_TT_IM_MONOREPO=424599259394
# BITS_DEV_TASK_WORKFLOW_ID_TT_IM_MONOREPO=25538
# 应用名 / SCM / projectUniqueId 每次从 tt_im_monorepo 的 projects-meta + package
# + Eden 元数据解析。控制面只拿这些字段拼 OpenAPI create,不再查 AppCenter。
# BITS_DEV_TASK_REPO_PATH_TT_IM_MONOREPO=tiktok/tt_im_monorepo
# --- Bits 合码通道认证 ----------------------------------------------------
# Bits OpenAPI 的服务号 Bearer。**必须填**:源码里那个内置默认值已经过期,不填的话
# 每个不带用户身份的 Bits 调用都会拿到 HTTP 200 + body `code:403 Invalid token`。
# 受影响的是没有登录用户可借的后台路径——控制面自动建 MR、以及 satellite 上报 MR
# 链接时的认领核对。这些路径只用服务号 + `x-bits-user`,不会降级去用任务负责人的
# 个人 Token。只读路径(mr_sync、mr_auto_confirm、拉 MR 评论)走 BITS_FIXED_OPERATOR
# 在面板上绑定的个人 Token。人点出来的写操作(创建 MR)仍优先用该点击者的个人 Token
# (/api/me/bits-token),这里只是兜底。
BITS_TOKEN=
# 默认操作人 + 恒定 RD reviewer + bits-user 兜底(Android / iOS 同一人)。
# BITS_FIXED_OPERATOR=jiaopengwen
# BITS_API_BASE=https://bits.bytedance.net
# --- code.byted.org MR 通道 ----------------------------------------------
# 给不走 Bits 合码的仓建 MR 用(control-server/src/gitlab_mr.ts)。2026-11 起
# tt_im_monorepo 走这条:控制面在 code.byted.org 上直接建一条指向 master 的 MR。
# 实现是 Codebase OpenAPI(CreateMergeRequest),不是 GitLab v4 —— 后者已下线。
# 不设则复用下面的 CODEBASE_PAT。MR 的作者就是这个令牌的主人,它需要能在目标仓建 MR。
# 两个都没有时,面板上会明确说缺令牌并给出手动建 MR 的直达链接,而不是静默失败。
# (旧的 CODE_BYTED_TOKEN 是 GitLab v4 时代的令牌,已不再读取。)
# CODEBASE_MR_TOKEN=
# CODE_BYTED_BASE=https://code.byted.org # 只用来拼 MR 链接(回包里没给时)
# CODE_BYTED_TIMEOUT_MS=20000
# Headless Agent CLI. Claude Code uses the default below. Cursor CLI may use
# CLAUDE_BIN=agent; Streamline detects that name and routes the whole pipeline
# through its Cursor stream-json compatibility wrapper automatically.
CLAUDE_BIN=claude
# Optional explicit engine selection: print | pty | cursor | codex
# STREAMLINE_AGENT_MODE=pty
# Optional per-phase override: pins the EVALUATE stage (bug / feature / security
# / adhoc evaluators) to a specific engine while the run and asking stages keep
# obeying STREAMLINE_AGENT_MODE. Unset (default) means "same as global".
# Bin resolution is shared (a value of `cursor` still uses CURSOR_BIN, `codex`
# still uses CODEX_BIN); no separate EVALUATE_CLAUDE_BIN.
# STREAMLINE_EVALUATE_AGENT_MODE=codex
# Cursor binary when using explicit cursor mode (default: cursor-agent)
# CURSOR_BIN=agent
# Codex binary and optional model/sandbox when using codex mode.
# CODEX_BIN=codex
# STREAMLINE_CODEX_MODEL=
# STREAMLINE_CODEX_SANDBOX=workspace-write
# KB pasted-text / Lark-doc bulk-import atomization timeout (default: 8 minutes)
# KB_IMPORT_ATOMIZE_TIMEOUT_MS=480000
# Per-task log directory root
BBBBBBUG_LOG_ROOT=/Users/fei/taskLog
# Hard cap on fix/verify rounds before marking unfixable
MAX_ROUNDS=5
# Fix-Critic: independent read-only grader of each FIXED run before manual review.
# FORCE-DISABLED in code as of 2026-08-19 (satellite/src/runner.ts) — it has never
# produced a verdict; this value is ignored until FIX_CRITIC_FORCE=1 is also set.
FIX_CRITIC=1
# How many non-root-cause verdicts auto-open the next fix round before escalating
# to a human. Defaults to MAX_ROUNDS so the critic keeps re-opening on its own.
# FIX_CRITIC_MAX_AUTOBOUNCE=5
# Meego access via the plugin Open API (no MCP).
MEEGO_HOST=meego.feishu.cn
MEEGO_TOKEN=
MEEGO_PLUGIN_ID=
MEEGO_PLUGIN_SECRET=
MEEGO_USER_KEY=
# 0 = production plugin token (p-…), required for an installed plugin; 1 = virtual (dev debug only).
MEEGO_TOKEN_TYPE=0
# Review-approved → Meego "→ RESOLVED" transition (plugin workflow/node/state_change).
# Match the resolved target state by name (case-insensitive substring), or pin a
# transition id to skip the lookup.
MEEGO_RESOLVE_STATE_NAMES=resolved,已解决,已修复,修复完成,解决,fixed
# MEEGO_RESOLVE_TRANSITION_ID=
# Resolution field presets (tenant-specific; defaults match the tiktok/issue project):
# MEEGO_RESOLUTION_FIX_VALUE=1 # bug_resolution = 本人已修复 (Fixed)
# MEEGO_INTRODUCE_ANALYZE_VALUE=ud4ql49k_ # field_ad1c23 = 历史遗留问题 (legacy bug)
# MEEGO_REOPEN_ANALYZE_VALUE=auto fix # rdreopen_reason
# MEEGO_VERSION_PREFIX=TikTok-M- # eligible resolve-version name prefix
# Company email domain for watchers added by prefix in the UI.
WATCHER_EMAIL_DOMAIN=bytedance.com
# Set to 1 to skip all git/claude side effects (useful for UI dev)
BBBBBBUG_DRY_RUN=0
# --- Lark / Feishu messaging ---------------------------------------------
# App credentials (from the Lark/Feishu developer console). Leave empty to
# disable the bot + notifications (the tool still runs).
LARK_APP_ID=
LARK_APP_SECRET=
# Open-platform domain: https://open.feishu.cn (Feishu) or https://open.larksuite.com (Lark intl)
LARK_DOMAIN=https://open.feishu.cn
# How often the control plane refreshes every authorised person's Lark user token (ms).
# Satellites fetch the current access token when they claim a task and inject it
# as LARKSUITE_CLI_USER_ACCESS_TOKEN. Default 40 minutes — well inside the ~2h
# access lifetime, frequent enough that the 7-day refresh window keeps sliding.
# LARK_USER_TOKEN_REFRESH_MS=2400000
# Optional: absolute path to lark-cli on the control plane.
# LARK_CLI_BIN=
# Group chat that receives every status-change notification
LARK_NOTIFY_CHAT_ID=oc_91dcbdb498fd9e70ab23f8f7727ac44e
# Wishes from the rail ghost's easter egg (POST /api/wishes) are appended, one
# JSON line each, to this file on the control plane (owner-only). Default:
# ~/.streamline/wishes.jsonl under the account the server runs as.
# WISH_LOG_PATH=
# Optional: also post each wish to this Lark group (best-effort; the file is the record).
# WISH_LARK_CHAT_ID=
# Public URL of the web UI; notification cards deep-link here with ?task_id=<id>
APP_BASE_URL=https://streamline.bytedance.net
# --- ByteDance internal SSO (inspireCloud @byted/inspirecloud) -----------
# Frontend Vite vars (web build reads these). Service id backing getUserInfo.
VITE_SSO_SERVICE_ID=ttuae2
# Optional: override the inspireCloud gateway base; leave unset to use the SDK default.
# VITE_SSO_BASE_URL=
# --- Codebase API (MR review comments) -----------------------------------
# Personal access token (code_pat_…) from code.byted.org. Read-only use: when a
# reviewer rejects with 「带上 MR Review 评论」, the control plane walks
# bits mr_id → codebase repo/change → live threads and feeds the unresolved
# comments into that round's feedback. Leave empty to disable the toggle.
CODEBASE_PAT=
# Optional overrides:
# CODEBASE_API_BASE=https://codebase-api.byted.org
# CODEBASE_TIMEOUT_MS=8000 # inline in the reject path — keep it short
# MR_COMMENTS_MAX=40 # comments carried into one rejection
# MR_COMMENT_BODY_MAX=1200 # per-comment body cap (chars)
# --- TOS image host (drag-drop uploads) ----------------------------------
# Drag-dropped images (creation dialogs + plan/TestSpec editor) are PUT to this
# bucket under img_upload/ and loaded by the browser + satellite via the key-free
# voffline download URL. The access key stays server-side (never sent to the
# frontend). Download base lives in shared/protocol.ts (TOS_IMAGE_BASE).
TOS_ACCESS_KEY=
# Optional: override the PUT endpoint (default targets the streamline bucket).
# TOS_ENDPOINT=https://streamline.tos-cn-north.byted.org
# --- TOS S3 protocol (SigV4) ---------------------------------------------
# Uploads go to the S3-compatible endpoint using path-style addressing
# (/<bucket>/<key>) signed with AWS SigV4. TOS_ACCESS_KEY above is the AK.
TOS_S3_ENDPOINT=https://tos-s3-cn-north.byted.org
TOS_BUCKET=streamline
TOS_REGION=cn-north-1
TOS_SECRET_KEY=
# Optional: in-flight PUT cap (default 4, matches the 50 QPS PutObject quota)
# and attempts per upload before giving up (default 4, absorbs 429 bursts).
# TOS_MAX_CONCURRENCY=4
# TOS_MAX_ATTEMPTS=4
# --- Feature → Eddy temporary baseline export ----------------------------
# Control plane: apply drizzle/0033_eddy_feature_exports.sql before enabling.
EDDY_EXPORT_ENABLED=0
# Storage reuses the TOS_* settings above; exports live under the eddy/task-exports/
# prefix and no storage credentials ever reach a satellite.
# Satellite: no per-node config. An Apple Silicon node with `airb` on PATH and DeviceSim's
# airbuild skill (the same ones its fix/verify agents build with) takes the exports of the
# features it implemented. The build is an agent following that skill.
# EDDY_EXPORT_ROOT=/Users/runner/.streamline/eddy-exports
# EDDY_EXPORT_PYTHON=/usr/bin/python3
# --- Deploy (local machine only; read by .claude/skills/streamline-deploy) ---
# Corp (SSO) password. The deploy devbox only accepts Kerberos/GSSAPI SSH, and the
# ticket expires daily; when it has, deploy.sh runs kinit with this value (fed over
# stdin, never echoed). Leave unset to keep running `kinit` by hand. Single-quote it
# if it contains spaces, $, # or quotes. Update it whenever the SSO password rotates.
# KINIT_PASSWORD=
# Eddy ingestion: retained logical bytes (UTF-8 JSON + envelope metadata), not PG physical disk size.
# Required for each channel: set positive whole-byte GLOBAL_BYTES budgets after checking DB headroom.
# Unset/zero/invalid global budget => 503 eddy_ingestion_unconfigured; local Eddy remains usable.
# Examples ONLY (not capacity recommendations):
# EDDY_CONVERSATION_GLOBAL_BYTES=10737418240
# EDDY_USAGE_GLOBAL_BYTES=1073741824
# Defaults below can be changed on deployment/restart without schema changes.
# EDDY_CONVERSATION_GLOBAL_ROWS=10000000
# EDDY_CONVERSATION_OWNER_BYTES=2147483648
# EDDY_CONVERSATION_OWNER_ROWS=2000000
# EDDY_CONVERSATION_DAILY_BYTES=268435456
# EDDY_CONVERSATION_DAILY_ROWS=250000
# EDDY_CONVERSATION_OWNER_RPM=60
# EDDY_CONVERSATION_OWNER_BURST=8
# EDDY_CONVERSATION_GLOBAL_RPM=600
# EDDY_CONVERSATION_GLOBAL_BURST=32
# EDDY_CONVERSATION_RETENTION_DAYS=90
# Usage has independent budgets: OWNER_BYTES=268435456, OWNER_ROWS=1000000,
# DAILY_BYTES=16777216, DAILY_ROWS=100000, GLOBAL_ROWS=10000000,
# OWNER_RPM=60, OWNER_BURST=8, GLOBAL_RPM=600, GLOBAL_BURST=32.
# All use EDDY_USAGE_ prefix. Raw fixed-schema usage retention stays 90 days.
# Uploads without a sign-in (schema 2) share ONE budget, whatever device id they carry:
# EDDY_USAGE_ANONYMOUS_BYTES=1073741824 and _ROWS=4000000 (each capped at half the global budget),
# _DAILY_BYTES=67108864, _DAILY_ROWS=400000, _RPM=300 and _BURST=16 (capped at half the global rate).