feishu-codex-console 1.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.env.example +101 -0
  2. package/.feishu-codex-policy.example.json +11 -0
  3. package/.feishu-codex-runbooks.example.json +36 -0
  4. package/CHANGELOG.md +129 -0
  5. package/CODE_OF_CONDUCT.md +7 -0
  6. package/CONTRIBUTING.md +52 -0
  7. package/LICENSE +21 -0
  8. package/README.en.md +81 -0
  9. package/README.md +398 -0
  10. package/ROADMAP.md +40 -0
  11. package/SECURITY.md +53 -0
  12. package/dist/account-quota-card.js +233 -0
  13. package/dist/account-quota.js +125 -0
  14. package/dist/app-server-client.js +281 -0
  15. package/dist/card-session.js +166 -0
  16. package/dist/codex-events.js +1 -0
  17. package/dist/codex-runner.js +875 -0
  18. package/dist/config.js +198 -0
  19. package/dist/confirmation-card.js +135 -0
  20. package/dist/control-card.js +345 -0
  21. package/dist/conversation-turn-session.js +209 -0
  22. package/dist/data-maintenance.js +71 -0
  23. package/dist/device-card.js +460 -0
  24. package/dist/device-health.js +94 -0
  25. package/dist/diagnostics.js +253 -0
  26. package/dist/doctor.js +250 -0
  27. package/dist/fallback-card-session.js +37 -0
  28. package/dist/health-file.js +75 -0
  29. package/dist/index.js +4330 -0
  30. package/dist/lark-cli.js +558 -0
  31. package/dist/lark-retry.js +34 -0
  32. package/dist/maintenance.js +140 -0
  33. package/dist/model-capabilities.js +31 -0
  34. package/dist/onboarding-card.js +312 -0
  35. package/dist/permission-lease.js +22 -0
  36. package/dist/policy.js +506 -0
  37. package/dist/progress.js +267 -0
  38. package/dist/project-card.js +303 -0
  39. package/dist/project-overview-card.js +182 -0
  40. package/dist/project-overview.js +278 -0
  41. package/dist/project-policy.js +160 -0
  42. package/dist/project-registry.js +259 -0
  43. package/dist/project-status.js +45 -0
  44. package/dist/project-workspace.js +55 -0
  45. package/dist/quota-card.js +94 -0
  46. package/dist/recovery-policy.js +26 -0
  47. package/dist/redaction.js +67 -0
  48. package/dist/remote-ready.js +112 -0
  49. package/dist/response-card.js +139 -0
  50. package/dist/result-card.js +166 -0
  51. package/dist/review-card.js +452 -0
  52. package/dist/runbook-card.js +272 -0
  53. package/dist/runbooks.js +191 -0
  54. package/dist/runtime-card.js +337 -0
  55. package/dist/session-card.js +128 -0
  56. package/dist/session-naming.js +14 -0
  57. package/dist/smoke.js +28 -0
  58. package/dist/state-backup.js +302 -0
  59. package/dist/state-store.js +874 -0
  60. package/dist/task-card.js +640 -0
  61. package/dist/task-center-card.js +176 -0
  62. package/dist/task-failure.js +43 -0
  63. package/dist/task-intent.js +76 -0
  64. package/dist/task-queue.js +187 -0
  65. package/dist/task-reconciliation.js +80 -0
  66. package/dist/task-review.js +497 -0
  67. package/dist/team-card.js +275 -0
  68. package/dist/team-directory.js +54 -0
  69. package/dist/team-policy.js +93 -0
  70. package/dist/types.js +1 -0
  71. package/dist/version.js +9 -0
  72. package/dist/workspace-session.js +64 -0
  73. package/docs/ARCHITECTURE.md +54 -0
  74. package/docs/COMPATIBILITY.md +55 -0
  75. package/docs/CONFIGURATION.md +88 -0
  76. package/docs/DEMO.md +45 -0
  77. package/docs/GOOD_FIRST_ISSUES.md +23 -0
  78. package/docs/INSTALLATION.md +207 -0
  79. package/docs/OPEN_SOURCE_PRODUCT_PLAN.md +113 -0
  80. package/docs/PRODUCT_REQUIREMENTS_MAP.md +591 -0
  81. package/docs/RELEASE_CHECKLIST.md +65 -0
  82. package/docs/TEAM_DEPLOYMENT.md +35 -0
  83. package/docs/TROUBLESHOOTING.md +130 -0
  84. package/docs/V4_WORKSPACE_SESSION_FLOW.md +232 -0
  85. package/docs/requirements/D10_MAINTENANCE_AND_ECOSYSTEM.md +103 -0
  86. package/docs/requirements/D1_INSTALLATION_AND_FIRST_CONNECTION.md +479 -0
  87. package/docs/requirements/D2_DEVICE_AND_CONNECTIVITY.md +54 -0
  88. package/docs/requirements/D3_PROJECTS_AND_SESSIONS.md +107 -0
  89. package/docs/requirements/D4_REMOTE_TASK_EXECUTION.md +102 -0
  90. package/docs/requirements/D5_CODEX_NATIVE_INTERACTIONS.md +99 -0
  91. package/docs/requirements/D6_RESULTS_AND_CODE_REVIEW.md +100 -0
  92. package/docs/requirements/D7_SECURITY_GOVERNANCE.md +106 -0
  93. package/docs/requirements/D8_RELIABILITY_AND_RECOVERY.md +182 -0
  94. package/docs/requirements/D9_TEAM_COLLABORATION.md +129 -0
  95. package/package.json +76 -0
  96. package/scripts/capability-probe.mjs +113 -0
  97. package/scripts/cli.mjs +919 -0
  98. package/scripts/config-file.mjs +137 -0
  99. package/scripts/discovery-lib.mjs +78 -0
  100. package/scripts/install-card.mjs +37 -0
  101. package/scripts/install-detection.mjs +126 -0
  102. package/scripts/install-state.mjs +107 -0
  103. package/scripts/launchd.mjs +161 -0
  104. package/scripts/migrate-legacy.mjs +97 -0
  105. package/scripts/package-smoke.mjs +163 -0
  106. package/scripts/release-dist-tag.mjs +7 -0
  107. package/scripts/runbook-template.mjs +36 -0
  108. package/scripts/service-health.mjs +110 -0
  109. package/scripts/service.mjs +24 -0
  110. package/scripts/setup-lib.mjs +118 -0
  111. package/scripts/systemd.mjs +96 -0
  112. package/scripts/upgrade-lib.mjs +99 -0
  113. package/scripts/verify-release.mjs +37 -0
@@ -0,0 +1,88 @@
1
+ # Configuration reference
2
+
3
+ The recommended path is `feishu-codex-console init`. It writes a private `0600` env file and preserves unknown advanced keys when rerun. Start every managed file with `BRIDGE_CONFIG_VERSION=1`; a newer unknown contract fails closed instead of being guessed.
4
+
5
+ ## Identity and team access
6
+
7
+ | Key | Default | Purpose |
8
+ |---|---|---|
9
+ | `ALLOWED_FEISHU_OPEN_IDS` | required | Comma-separated operators allowed to start Codex work |
10
+ | `FEISHU_ADMIN_OPEN_IDS` | operators | Administrators; configure explicitly for a team |
11
+ | `FEISHU_VIEWER_OPEN_IDS` | empty | Read-only dashboard and status members |
12
+ | `FEISHU_MEMBER_LABELS_JSON` | empty | Product-facing labels; missing labels become anonymous member codes |
13
+ | `ALLOWED_FEISHU_CHAT_IDS` | private chats only | Optional chat allowlist; full-access groups require it |
14
+ | `FEISHU_GROUP_SESSION_SCOPE` | `member` | `member` isolates each group member; `chat` deliberately shares context |
15
+ | `FEISHU_PROJECT_ACL_JSON` | empty | Project selector to member-ID arrays; admins bypass ACLs |
16
+ | `FEISHU_BOT_MENTION_NAMES` | empty | Names stripped from leading group mentions |
17
+
18
+ ## Projects and Codex
19
+
20
+ | Key | Default | Purpose |
21
+ |---|---|---|
22
+ | `CODEX_WORKDIR` | required by installer | Default authorized project |
23
+ | `CODEX_PROJECT_ROOTS` | default project | Additional roots recursively scanned for Git repositories |
24
+ | `CODEX_PROJECT_SCAN_DEPTH` | `8` | Maximum discovery depth |
25
+ | `MAX_CODEX_PROJECTS` | `200` | Discovery result cap |
26
+ | `CODEX_SYNC_SAVED_PROJECTS` | `true` in generated config | Include projects saved by the local Codex app |
27
+ | `CODEX_PROJECT_STATE_FILE` | Codex home default | Optional saved-project state override |
28
+ | `CODEX_CLI_PATH` | bundled binary | Optional Codex executable override |
29
+ | `CODEX_MODEL` | native default | Deployment-level model default |
30
+ | `CODEX_REASONING_EFFORT` | native default | Deployment-level reasoning default |
31
+ | `CODEX_MULTI_AGENT_ENABLED` | `false` | Enable Codex subagent tools; keep off for predictable token use |
32
+ | `CODEX_TIMEOUT_MS` | `1200000` | Turn timeout |
33
+ | `CODEX_SKIP_GIT_REPO_CHECK` | `false` | Permit an authorized non-Git project |
34
+
35
+ ## Permission ceiling
36
+
37
+ | Key | Default | Purpose |
38
+ |---|---|---|
39
+ | `CODEX_SANDBOX_MODE` | `workspace-write` | Service/admin maximum |
40
+ | `CODEX_OPERATOR_SANDBOX_MODE` | safe service maximum | Ordinary operator maximum |
41
+ | `CODEX_NETWORK_ACCESS` | `false` | Network access passed to Codex |
42
+ | `CODEX_WEB_SEARCH_MODE` | `disabled` | `disabled`, `cached`, or `live` |
43
+ | `CODEX_ALLOWED_ENV_VARS` | empty | Explicit project variables copied into Codex’s minimized environment |
44
+ | `EXTERNAL_CONFIRMATION_TTL_MINUTES` | `10` | Commit/push/deploy/publish/PR confirmation lifetime |
45
+
46
+ `danger-full-access` is only a ceiling. A member still needs a temporary lease in the settings card, and external actions still require confirmation. A repository policy can reduce these limits further.
47
+
48
+ `CODEX_MULTI_AGENT_ENABLED=false` is the cost-safe default. Ultra reasoning can proactively delegate work, and every subagent has its own model/tool loop. When enabled, the bridge still asks Codex to delegate only after an explicit user request.
49
+
50
+ ## Capacity, files, and retention
51
+
52
+ | Key | Default | Purpose |
53
+ |---|---|---|
54
+ | `MAX_CONCURRENT_TASKS` | `2` | Global task concurrency |
55
+ | `MAX_QUEUED_PER_CONVERSATION` | `5` | Per-member conversation queue cap |
56
+ | `MAX_ATTACHMENT_BYTES` | `20971520` | Attachment download cap |
57
+ | `MAX_TEXT_ATTACHMENT_BYTES` | `131072` | Text decoded into a prompt |
58
+ | `ATTACHMENT_RETENTION_HOURS` | `72` | Local attachment retention |
59
+ | `MAX_REPLY_CHARS` | `12000` | Reliable text fallback cap |
60
+ | `MAX_SEEN_EVENTS` | `2000` | Event deduplication retention bound |
61
+ | `MAX_LOG_BYTES` | `10485760` | Per-log rotation threshold |
62
+ | `LOG_MESSAGE_CONTENT` | `false` | Content logging; keep disabled outside local debugging |
63
+
64
+ ## Instance and local data
65
+
66
+ | Key | Default | Purpose |
67
+ |---|---|---|
68
+ | `BRIDGE_INSTANCE_ID` | `default` | Stable service and data instance name |
69
+ | `BRIDGE_DATA_DIR` | package `var` or installer user-data path | SQLite, health, logs, attachments, and backups |
70
+ | `BRIDGE_DATABASE_FILE` | `<data>/state.sqlite` | Advanced database override |
71
+ | `BRIDGE_STATE_FILE` | `<data>/state.json` | One-time legacy JSON migration source |
72
+ | `FEISHU_COMPLETION_NOTIFICATIONS` | `false` | Optional compact completion notice after the original task card updates; failures always get a fallback |
73
+ | `FEISHU_AUTO_ONBOARDING` | `true` | One-time member onboarding card |
74
+
75
+ Do not place App Secret in this file. `lark-cli` owns the Bot identity in its user configuration. Do not commit the managed env file, runtime data, support bundles, or real member/chat IDs.
76
+
77
+ ## Repository-controlled files
78
+
79
+ - `.feishu-codex-policy.json`: schema v1 permission and external-action policy; can only tighten host limits.
80
+ - `.feishu-codex-runbooks.json`: schema v1 reviewed team prompts; cannot request full access or pre-authorize external mutations.
81
+
82
+ Create a safe runbook starter in any project with:
83
+
84
+ ```bash
85
+ feishu-codex-bridge init-runbooks --project /absolute/path/to/project
86
+ ```
87
+
88
+ The command never overwrites an existing catalog.
package/docs/DEMO.md ADDED
@@ -0,0 +1,45 @@
1
+ # Product demo
2
+
3
+ This is the repeatable five-minute demo for a release candidate. Use a disposable repository without customer data and a private Feishu chat.
4
+
5
+ ## Setup
6
+
7
+ 1. Install with the personal-safe preset and keep `workspace-write`, network off, and Web search disabled.
8
+ 2. Open a small Git repository with one intentionally failing test.
9
+ 3. In Feishu, send `新手引导`; verify the welcome card shows one clear primary action for the current device/project/role state.
10
+
11
+ ## Demo story
12
+
13
+ | Moment | Action | Product proof |
14
+ |---|---|---|
15
+ | 0:00 | Send `控制台` or `额度` | Device, consumers, Codex, independent native quota windows, reset times, project, queue, permission, and sampled time are clear |
16
+ | 0:30 | Send `项目` and select the demo repo | Path/branch/dirty state prevent wrong-project execution |
17
+ | 1:00 | Ask Codex to diagnose the failing test | A single live task card shows context, progress, model, reasoning, and permission |
18
+ | 2:00 | Send a follow-up requirement | The same turn records steering instead of silently creating a second task |
19
+ | 2:30 | Answer a non-secret question or one-shot approval | Native interaction resumes the same Codex task and expires safely |
20
+ | 3:15 | Open `查看验证`, inspect a Diff, then `返回结果` | The original task card switches surfaces without adding messages; tests, attribution, and paged diff remain visible |
21
+ | 4:00 | Send `任务`, then `团队` | Task history and privacy-preserving team aggregate use consistent product cards |
22
+ | 4:30 | Send `运行手册` | A reviewed repository task can run without raising the member’s permission |
23
+
24
+ ## Failure proof
25
+
26
+ Repeat one short task, then stop the bridge process while it is running. After the service restarts:
27
+
28
+ - the task is marked interrupted rather than replayed;
29
+ - already-written file changes remain reviewable;
30
+ - the card or reliable fallback gives a recovery action;
31
+ - a never-started queued task can resume safely.
32
+
33
+ ## Release evidence
34
+
35
+ Capture the same desktop width and Feishu theme for each release. Redact names, project paths, member IDs, tokens, prompts containing private code, and attachments. Keep these seven frames:
36
+
37
+ 1. installation success;
38
+ 2. device console;
39
+ 3. project selector;
40
+ 4. live task;
41
+ 5. question or approval;
42
+ 6. result review;
43
+ 7. recovery state.
44
+
45
+ The demo passes only when controls are usable, text is not clipped, every ordinary response uses the shared Card 2.0 shell, and no card claims success before the underlying state is verified.
@@ -0,0 +1,23 @@
1
+ # Good first issues
2
+
3
+ Starter issues should teach one product boundary without requiring a contributor to run a real Feishu tenant or expose local credentials. Maintainers can copy one of the following into a GitHub issue and add the `good first issue` label.
4
+
5
+ ## Ready-to-scope candidates
6
+
7
+ | Candidate | Primary files | Done when |
8
+ |---|---|---|
9
+ | Add another redaction fixture | `src/redaction.ts`, `test/redaction.test.ts` | A realistic secret shape is hidden without corrupting ordinary text |
10
+ | Improve one doctor remediation | `src/doctor.ts`, `test/diagnostics.test.ts` | A failed check prints one safe, executable next step |
11
+ | Add one Card 2.0 contract fixture | one card module, `test/card-contract.test.ts` | Element IDs and supported component shape pass the contract suite |
12
+ | Clarify one Linux troubleshooting path | `docs/TROUBLESHOOTING.md` | A clean systemd user install can follow the steps without source knowledge |
13
+ | Add a safe sample runbook | `.feishu-codex-runbooks.example.json`, runbook tests | The template parses, cannot elevate permissions, and contains no external action |
14
+
15
+ ## Maintainer checklist
16
+
17
+ - Explain the user-visible problem, not just the desired code change.
18
+ - Keep the expected change within one subsystem and avoid authentication or approval redesigns.
19
+ - List exact acceptance checks and a likely test file.
20
+ - State which credentials or live services are not required.
21
+ - Reserve cross-user authorization, migration, arbitrary command policy, and production release changes for experienced contributors.
22
+
23
+ Use the repository’s “Good first issue proposal” form for new candidates. The label means the issue is scoped and maintainer-approved; it does not mean unreviewed code can bypass security or migration checks.
@@ -0,0 +1,207 @@
1
+ # 安装 Feishu Codex Bridge
2
+
3
+ 这份文档面向第一次部署的个人和团队维护者。目标是在不开放公网端口的前提下,让本地 Codex 在飞书中可用。
4
+
5
+ ## 前置条件
6
+
7
+ - macOS 或带 systemd user service 的 Linux。
8
+ - Node.js 22 或更高版本。
9
+ - 本机安装 Codex,并已运行 `codex login`。
10
+ - 一个飞书自建应用,已启用机器人、长连接事件和 CardKit 权限。
11
+
12
+ 飞书应用至少需要:
13
+
14
+ - `im:message:readonly`
15
+ - `cardkit:card:write`
16
+ - `im.message.receive_v1`
17
+ - `card.action.trigger`
18
+
19
+ ## 推荐安装
20
+
21
+ ```bash
22
+ npx feishu-codex-console init
23
+ ```
24
+
25
+ 向导会依次检查运行环境、选择权限预设、选择项目、自动识别飞书成员和会话、写入私有配置并安装后台服务。服务管理器返回后,向导还会等待消息与卡片事件连接同时就绪,并核对后台进程实际读取的配置文件;任一项不一致都不会显示安装完成。
26
+
27
+ 默认配置位置:
28
+
29
+ ```text
30
+ ~/.config/feishu-codex-bridge/default.env
31
+ ```
32
+
33
+ 默认数据位置:
34
+
35
+ ```text
36
+ ~/.local/share/feishu-codex-bridge/default/
37
+ ```
38
+
39
+ 配置文件使用 `0600` 权限,数据目录使用 `0700` 权限。
40
+
41
+ 重新运行 `init` 时会识别已有安装、显示上次安全进度、备份旧配置并保留未知高级配置。只有显式使用 `--force-reset` 才会完整重建配置。
42
+
43
+ ## 配置飞书应用身份
44
+
45
+ 如果向导提示 Bot 身份不可用,运行:
46
+
47
+ ```bash
48
+ npx lark-cli config init --new
49
+ npx lark-cli whoami --as bot
50
+ ```
51
+
52
+ 已有应用时去掉 `--new`。App Secret 由 `lark-cli` 保存在用户配置目录,不应写进桥接服务的 `.env`。
53
+
54
+ ## 自动识别 open_id
55
+
56
+ 初始化向导会提示你给机器人发送一条消息,并从只读事件流中自动提取 `sender_id`、`chat_id` 和会话类型。也可以单独运行:
57
+
58
+ ```bash
59
+ feishu-codex-bridge discover
60
+ ```
61
+
62
+ 监听最多接收一个事件,并在两分钟后自动退出。自动识别失败时,向导会回退到手工输入。团队部署仍需分别记录管理员、操作者和只读成员;不要提交包含真实 ID 的输出。
63
+
64
+ ## 权限预设
65
+
66
+ ### 个人安全(推荐)
67
+
68
+ - 管理员和操作者都是当前用户。
69
+ - 最大权限为工作区写入。
70
+ - 网络和 Web 搜索默认关闭。
71
+
72
+ ### 团队安全
73
+
74
+ - 显式区分管理员、操作者和只读成员。
75
+ - 群聊按成员隔离项目、会话、设置和队列。
76
+ - 最大权限为工作区写入。
77
+
78
+ ### 高级模式
79
+
80
+ - 服务上限为完全访问。
81
+ - 普通操作者仍限制为工作区写入。
82
+ - 群聊未加入白名单时会被拒绝。
83
+ - 初始化时必须再次确认风险。
84
+
85
+ 非交互式安装高级模式必须显式传入 `--allow-full-access`。
86
+
87
+ 默认情况下,私聊身份发现会在服务健康后自动回复一张安装测试卡;群聊需要再次确认。自动化环境可以使用 `--no-test-card` 跳过,或使用 `--send-test-card` 明确允许群聊测试卡。
88
+
89
+ ## 非交互式安装
90
+
91
+ ```bash
92
+ npx feishu-codex-console init \
93
+ --yes \
94
+ --preset personal \
95
+ --open-id ou_replace_me \
96
+ --workdir /absolute/path/to/project
97
+ ```
98
+
99
+ 团队示例:
100
+
101
+ ```bash
102
+ npx feishu-codex-console init \
103
+ --yes \
104
+ --preset team \
105
+ --open-id ou_operator \
106
+ --admin-id ou_admin \
107
+ --viewer-id ou_viewer \
108
+ --workdir /srv/repos/frontend \
109
+ --project-roots /srv/repos
110
+ ```
111
+
112
+ 团队安装后建议在私有配置中补充卡片友好名称:
113
+
114
+ ```dotenv
115
+ FEISHU_MEMBER_LABELS_JSON={"ou_admin":"平台管理员","ou_operator":"前端同学","ou_viewer":"产品同学"}
116
+ ```
117
+
118
+ 名称只用于飞书卡片;SQLite 与审计仍保留真实身份 ID,数据目录和备份必须保持私有。要启用团队运行手册,在每个项目根目录生成并评审示例(不会覆盖已有文件):
119
+
120
+ ```bash
121
+ feishu-codex-bridge init-runbooks --project /absolute/path/to/project
122
+ ```
123
+
124
+ 完整交接、团队面板和模板安全规则见 [D9 团队协作](requirements/D9_TEAM_COLLABORATION.md)。
125
+
126
+ ## 诊断和服务管理
127
+
128
+ ```bash
129
+ feishu-codex-bridge doctor
130
+ feishu-codex-bridge doctor --fix
131
+ feishu-codex-bridge doctor --diagnostics /private/path/diagnostic.json
132
+ feishu-codex-bridge support-bundle
133
+ feishu-codex-bridge version
134
+ feishu-codex-bridge status
135
+ feishu-codex-bridge backup
136
+ feishu-codex-bridge uninstall
137
+ ```
138
+
139
+ `doctor --fix` 只修复运行目录/文件权限、失效健康标记和超限日志,不会修改成员、项目 ACL、sandbox 或用户代码。诊断包包含有界健康、数据库和日志摘要并统一脱敏,分享前仍应人工检查。
140
+
141
+ 升级前可以手动创建和列出 SQLite 一致性备份:
142
+
143
+ ```bash
144
+ feishu-codex-bridge backup --config /absolute/path/team.env
145
+ feishu-codex-bridge backups --config /absolute/path/team.env
146
+ ```
147
+
148
+ 数据库结构迁移也会自动备份并在失败时回滚。手动恢复需要先停止服务,运行 `rollback --backup <id> --yes`,再重新 `install`。
149
+
150
+ 更新 npm 包时先预览;没有 `--yes` 不会修改服务或数据:
151
+
152
+ ```bash
153
+ npx feishu-codex-console@latest upgrade --config /absolute/path/default.env
154
+ npx feishu-codex-console@latest upgrade --config /absolute/path/default.env --yes
155
+ ```
156
+
157
+ 升级会拒绝活动任务,创建一致性备份,用目标包自检,替换服务并验证产品版本、PID、配置路径、心跳和两个事件消费者。失败时会尝试恢复数据,并在旧包位置仍存在时恢复和验证旧服务。完整承诺见 [兼容与版本策略](COMPATIBILITY.md)。
158
+
159
+ 单独运行 `install` 也会执行同一套服务健康和配置一致性检查。慢速机器可以调整等待时间:
160
+
161
+ ```bash
162
+ feishu-codex-bridge install --health-timeout 60s
163
+ ```
164
+
165
+ 运行时健康信息保存在实例数据目录的 `bridge-health.json`,仅包含实例、PID、配置路径、事件消费者状态和时间戳,不包含飞书凭据或消息正文。
166
+
167
+ 使用非默认实例或自定义配置文件时:
168
+
169
+ ```bash
170
+ feishu-codex-bridge status --config /absolute/path/team.env
171
+ ```
172
+
173
+ 自检失败时不会安装后台服务。修复飞书 Bot、Codex 登录或项目目录后,再运行 `doctor` 和 `install`。
174
+
175
+ ## 从旧源码安装迁移
176
+
177
+ 如果以前通过克隆仓库、编辑仓库根目录 `.env` 并安装 LaunchAgent 的方式运行,可以迁移到用户级配置:
178
+
179
+ ```bash
180
+ npx feishu-codex-console migrate --from /absolute/path/to/old/feishu-codex-bridge
181
+ ```
182
+
183
+ 迁移器会复制并规范化旧配置,把相对路径转换为以旧源码目录为基准的绝对路径,继续使用原来的 SQLite/JSON 数据,然后运行 doctor。确认切换后,新服务必须通过健康和配置一致性检查才算迁移完成;旧 `.env` 和数据不会自动删除。非交互迁移使用 `--yes`,目标配置已存在时需显式添加 `--force`,迁移器会先备份再合并。
184
+
185
+ ## 安装完成
186
+
187
+ 在飞书中发送:
188
+
189
+ ```text
190
+ 新手引导
191
+ ```
192
+
193
+ 欢迎卡会根据当前状态直接给出下一步:设备离线时查看连接、没有项目时选择授权项目、准备完成时直接开始使用。卡片不会要求成员理解安装参数;团队或多项目并行时,只需记住一个项目建一个群,新事情发新消息,继续同一件事就在回复里说。之后可以直接提问、分析、写文件或执行一个安全的首次代码任务。
194
+
195
+ ## 维护者发布
196
+
197
+ 每次推送 `v<package version>` 标签时,Release workflow 会重新运行类型检查、测试、生产构建和 tarball 干净安装测试,然后使用 npm provenance 发布并创建 GitHub Release。
198
+
199
+ 仓库需要配置:
200
+
201
+ - GitHub Environment:`npm`,建议要求维护者审批。
202
+ - Environment secret:`NPM_TOKEN`。
203
+ - npm 账号开启双因素认证,并使用适合 CI 的 granular access token。
204
+
205
+ 标签必须与 `package.json` 完全一致,例如 `1.0.0-beta.4` 对应 `v1.0.0-beta.4`。
206
+
207
+ Ubuntu 与 macOS 的自动门禁、两端实机验证和飞书团队权限验收见 [发布检查清单](RELEASE_CHECKLIST.md)。安装异常见 [故障排查](TROUBLESHOOTING.md),所有环境变量见 [配置参考](CONFIGURATION.md)。
@@ -0,0 +1,113 @@
1
+ # Feishu Codex Bridge 开源产品升级计划
2
+
3
+ ## 产品承诺
4
+
5
+ > 10 分钟把本地 Codex 安全接入飞书,无需开放公网端口。
6
+
7
+ 首个公开版本只聚焦“飞书控制本地 Codex”。多 IM、多 Agent、托管云端和跨设备中继不进入当前主线,避免安装体验尚未稳定时扩大维护面。
8
+
9
+ ## 目标用户
10
+
11
+ 1. **个人开发者**:在外通过飞书查看并操作自己电脑上的 Codex。
12
+ 2. **小团队维护者**:部署一台共享开发机,为成员分配项目和权限。
13
+ 3. **开源贡献者**:能够在不阅读全部架构代码的情况下完成安装、诊断和提交修复。
14
+
15
+ ## 成功标准
16
+
17
+ - 从安装命令到收到第一张飞书控制卡不超过 10 分钟。
18
+ - 默认安装不启用完全访问、不启用网络、不允许未知用户执行任务。
19
+ - 配置文件权限为 `0600`,运行数据目录权限为 `0700`。
20
+ - 安装失败时给出下一条可执行命令,而不是只输出堆栈。
21
+ - 新成员在飞书完成第一个成功任务后,才视为激活完成。
22
+ - 服务升级不丢失 SQLite 会话、队列、审计和成员设置。
23
+
24
+ ## 三阶段路线
25
+
26
+ ### v0.1:别人能装上
27
+
28
+ - `npx feishu-codex-console init` 交互式初始化。
29
+ - 个人安全、团队安全、高级模式三档权限预设。
30
+ - Node、Codex 登录、飞书 Bot 身份、项目目录和服务状态检查。
31
+ - 配置写入用户配置目录,不把凭证或成员标识写进 Git 仓库。
32
+ - macOS LaunchAgent 与 Linux systemd 使用同一份显式配置文件。
33
+ - npm `bin`、发布文件白名单、`prepack` 构建和公开包元数据。
34
+ - README 首屏安装路径和独立安装文档。
35
+
36
+ ### v0.2:第一次就成功
37
+
38
+ - 唯一、可持续更新的“飞书主页卡”,旧卡只跳转到最新主页。
39
+ - 新手引导只要求项目和权限预设;模型与推理强度使用默认值。
40
+ - 项目卡或设置卡保存后自动继续引导,不要求用户滚回旧卡。
41
+ - 提供“只读扫描项目”“运行测试”“查看未提交改动”三个安全任务。
42
+ - 第一个任务成功后完成引导;失败时保留进度并提供修复入口。
43
+ - 激活数据只保存在本地 SQLite,默认不上传遥测。
44
+
45
+ ### v0.3:长期敢使用
46
+
47
+ - 完全访问按本次任务、当前会话或一小时临时提升并自动回退。
48
+ - `doctor --fix`、脱敏诊断包和一键复制支持信息。
49
+ - 数据库迁移前备份、升级检查和回滚命令。
50
+ - 服务启动、重连和持续离线通知。
51
+ - 在功能检测后实验性接入 Codex app-server remote-control 配对能力。
52
+
53
+ ### v1.0:别人能维护
54
+
55
+ - 配置、持久状态、SQLite、仓库策略和运行手册均使用显式版本契约。
56
+ - `version`、`support-bundle` 和安全 `upgrade` 形成发布、诊断、备份、验证与回退闭环。
57
+ - npm tarball 覆盖中断恢复、运行手册初始化和只读升级预览,而不依赖源码目录。
58
+ - 公开兼容矩阵、配置参考、演示脚本、Roadmap 和 Good First Issue 路径。
59
+ - 内部适配边界先稳定,不在 1.0 暴露安全关键插件 API,也不默认收集遥测。
60
+
61
+ ## v0.1 安装流程
62
+
63
+ ```text
64
+ 运行 init
65
+ → 检查 Node / Codex / 飞书 Bot
66
+ → 选择权限预设
67
+ → 选择默认项目和扫描根目录
68
+ → 填写操作者与管理员 open_id
69
+ → 写入私有配置文件
70
+ → 运行 doctor
71
+ → 安装后台服务
72
+ → 提示在飞书发送“新手引导”
73
+ ```
74
+
75
+ ### 权限预设
76
+
77
+ | 预设 | 服务上限 | 操作者上限 | 网络 | 群聊策略 | 适用场景 |
78
+ |---|---|---|---|---|---|
79
+ | 个人安全 | 工作区写入 | 工作区写入 | 关闭 | 按成员隔离 | 个人电脑,推荐默认值 |
80
+ | 团队安全 | 工作区写入 | 工作区写入 | 关闭 | 按成员隔离 | 共享开发机与小团队 |
81
+ | 高级模式 | 完全访问 | 工作区写入 | 关闭 | 必须配置群白名单后才能在群里用 | 管理员确实需要本机命令能力 |
82
+
83
+ 高级模式仍不自动放行提交、推送、发布、部署和 PR/MR 操作。普通操作者默认保持工作区写入;完全访问只授予管理员。
84
+
85
+ ## 配置与目录约定
86
+
87
+ ```text
88
+ ~/.config/feishu-codex-bridge/<instance>.env
89
+ ~/.local/share/feishu-codex-bridge/<instance>/
90
+ ```
91
+
92
+ macOS 也沿用相同路径,便于文档、迁移和诊断保持一致。可以通过 `--config` 和 `BRIDGE_DATA_DIR` 覆盖。
93
+
94
+ 配置分为两层:
95
+
96
+ - 初始化向导只生成身份、项目、权限、实例和数据目录等必要项。
97
+ - 队列、附件、超时、日志和模型覆盖继续使用现有环境变量,归入高级配置。
98
+
99
+ ## 发布检查清单
100
+
101
+ - [ ] 包不再标记为 private,并提供 `feishu-codex-bridge` CLI。
102
+ - [ ] `npm pack --dry-run` 只包含运行需要的文件。
103
+ - [ ] Linux 与 macOS 安装说明均经过一次干净环境验证。
104
+ - [ ] README 包含 30 秒演示、三条命令快速开始和安全边界。
105
+ - [ ] GitHub 仓库公开,默认分支包含 LICENSE、SECURITY、CONTRIBUTING 和 Issue 模板。
106
+ - [ ] 创建带校验和与变更说明的首个预发布版本。
107
+
108
+ ## 暂不进入主线
109
+
110
+ - Docker 默认部署:本产品需要访问本地 Codex 登录态、项目目录和桌面保存项目,容器会显著增加安装摩擦。
111
+ - 托管中继:当前长连接不需要开放公网入口,先保持本地优先。
112
+ - 多 IM 与插件市场:等飞书安装成功率和首任务成功率稳定后再评估。
113
+ - 自研远程协议:优先对齐 Codex app-server,并对实验能力做功能检测。