netizen-cli 0.10.0__tar.gz

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 (212) hide show
  1. netizen_cli-0.10.0/MANIFEST.in +5 -0
  2. netizen_cli-0.10.0/PKG-INFO +18 -0
  3. netizen_cli-0.10.0/README.md +221 -0
  4. netizen_cli-0.10.0/_build.py +28 -0
  5. netizen_cli-0.10.0/config.example.yaml +35 -0
  6. netizen_cli-0.10.0/netizen_cli/__init__.py +3 -0
  7. netizen_cli-0.10.0/netizen_cli/__main__.py +4 -0
  8. netizen_cli-0.10.0/netizen_cli/admin/__init__.py +1 -0
  9. netizen_cli-0.10.0/netizen_cli/admin/auth.py +928 -0
  10. netizen_cli-0.10.0/netizen_cli/admin/errors.py +9 -0
  11. netizen_cli-0.10.0/netizen_cli/admin/port_config.py +115 -0
  12. netizen_cli-0.10.0/netizen_cli/admin/presentation.py +257 -0
  13. netizen_cli-0.10.0/netizen_cli/admin/queries.py +337 -0
  14. netizen_cli-0.10.0/netizen_cli/admin/static/admin.css +260 -0
  15. netizen_cli-0.10.0/netizen_cli/admin/static/admin.js +2898 -0
  16. netizen_cli-0.10.0/netizen_cli/admin/static/index.html +327 -0
  17. netizen_cli-0.10.0/netizen_cli/admin/transport.py +935 -0
  18. netizen_cli-0.10.0/netizen_cli/admin/web.py +2717 -0
  19. netizen_cli-0.10.0/netizen_cli/bindings.py +3215 -0
  20. netizen_cli-0.10.0/netizen_cli/builtin_skills.py +93 -0
  21. netizen_cli-0.10.0/netizen_cli/cards/__init__.py +105 -0
  22. netizen_cli-0.10.0/netizen_cli/cards/callbacks.py +565 -0
  23. netizen_cli-0.10.0/netizen_cli/cards/controls.py +2273 -0
  24. netizen_cli-0.10.0/netizen_cli/cards/defaults.py +213 -0
  25. netizen_cli-0.10.0/netizen_cli/cards/model_info.py +80 -0
  26. netizen_cli-0.10.0/netizen_cli/cards/questions.py +220 -0
  27. netizen_cli-0.10.0/netizen_cli/cards/reply.py +2247 -0
  28. netizen_cli-0.10.0/netizen_cli/cards/scheduled.py +836 -0
  29. netizen_cli-0.10.0/netizen_cli/channel/__init__.py +1 -0
  30. netizen_cli-0.10.0/netizen_cli/channel/completion_mentions.py +60 -0
  31. netizen_cli-0.10.0/netizen_cli/channel/input_preparation.py +644 -0
  32. netizen_cli-0.10.0/netizen_cli/channel/messages.py +57 -0
  33. netizen_cli-0.10.0/netizen_cli/channel/ports.py +52 -0
  34. netizen_cli-0.10.0/netizen_cli/channel/question_inputs.py +51 -0
  35. netizen_cli-0.10.0/netizen_cli/channel/reactions.py +293 -0
  36. netizen_cli-0.10.0/netizen_cli/channel/reply_presenter.py +1505 -0
  37. netizen_cli-0.10.0/netizen_cli/channel/topics.py +70 -0
  38. netizen_cli-0.10.0/netizen_cli/channel_app.py +6593 -0
  39. netizen_cli-0.10.0/netizen_cli/cli.py +287 -0
  40. netizen_cli-0.10.0/netizen_cli/cli_data.py +536 -0
  41. netizen_cli-0.10.0/netizen_cli/cli_packages.py +526 -0
  42. netizen_cli-0.10.0/netizen_cli/cli_services.py +651 -0
  43. netizen_cli-0.10.0/netizen_cli/cli_setup.py +242 -0
  44. netizen_cli-0.10.0/netizen_cli/cli_update.py +303 -0
  45. netizen_cli-0.10.0/netizen_cli/cli_update_restore.py +53 -0
  46. netizen_cli-0.10.0/netizen_cli/cli_update_worker.py +333 -0
  47. netizen_cli-0.10.0/netizen_cli/codex_runtime.py +7125 -0
  48. netizen_cli-0.10.0/netizen_cli/completion_mention.py +16 -0
  49. netizen_cli-0.10.0/netizen_cli/database_migrations.py +218 -0
  50. netizen_cli-0.10.0/netizen_cli/defaults/__init__.py +5 -0
  51. netizen_cli-0.10.0/netizen_cli/defaults/models.py +39 -0
  52. netizen_cli-0.10.0/netizen_cli/defaults/service.py +232 -0
  53. netizen_cli-0.10.0/netizen_cli/defaults/store.py +260 -0
  54. netizen_cli-0.10.0/netizen_cli/deployment/__init__.py +1 -0
  55. netizen_cli-0.10.0/netizen_cli/deployment/restart_worker.py +134 -0
  56. netizen_cli-0.10.0/netizen_cli/deployment/update_executor.py +258 -0
  57. netizen_cli-0.10.0/netizen_cli/deployment/update_protocol.py +281 -0
  58. netizen_cli-0.10.0/netizen_cli/domain.py +416 -0
  59. netizen_cli-0.10.0/netizen_cli/error_messages.py +124 -0
  60. netizen_cli-0.10.0/netizen_cli/experience.py +531 -0
  61. netizen_cli-0.10.0/netizen_cli/feishu_app_onboarding.py +187 -0
  62. netizen_cli-0.10.0/netizen_cli/feishu_app_permissions.py +123 -0
  63. netizen_cli-0.10.0/netizen_cli/git_status.py +63 -0
  64. netizen_cli-0.10.0/netizen_cli/image_inputs.py +579 -0
  65. netizen_cli-0.10.0/netizen_cli/instance.py +84 -0
  66. netizen_cli-0.10.0/netizen_cli/lark_app.py +125 -0
  67. netizen_cli-0.10.0/netizen_cli/main.py +903 -0
  68. netizen_cli-0.10.0/netizen_cli/management/__init__.py +83 -0
  69. netizen_cli-0.10.0/netizen_cli/management/blocking_io.py +352 -0
  70. netizen_cli-0.10.0/netizen_cli/management/chat_labels.py +266 -0
  71. netizen_cli-0.10.0/netizen_cli/management/coordination.py +32 -0
  72. netizen_cli-0.10.0/netizen_cli/management/service.py +2187 -0
  73. netizen_cli-0.10.0/netizen_cli/management/updates.py +214 -0
  74. netizen_cli-0.10.0/netizen_cli/markdown_images.py +78 -0
  75. netizen_cli-0.10.0/netizen_cli/message_content.py +786 -0
  76. netizen_cli-0.10.0/netizen_cli/message_history.py +643 -0
  77. netizen_cli-0.10.0/netizen_cli/message_preparation.py +60 -0
  78. netizen_cli-0.10.0/netizen_cli/message_projection.py +923 -0
  79. netizen_cli-0.10.0/netizen_cli/migrations/__init__.py +1 -0
  80. netizen_cli-0.10.0/netizen_cli/migrations/schema.py +103 -0
  81. netizen_cli-0.10.0/netizen_cli/migrations/v14.py +438 -0
  82. netizen_cli-0.10.0/netizen_cli/model_settings.py +269 -0
  83. netizen_cli-0.10.0/netizen_cli/package_resources.py +22 -0
  84. netizen_cli-0.10.0/netizen_cli/projects.py +327 -0
  85. netizen_cli-0.10.0/netizen_cli/prompt_projection.py +327 -0
  86. netizen_cli-0.10.0/netizen_cli/quoted_context.py +312 -0
  87. netizen_cli-0.10.0/netizen_cli/result_images.py +123 -0
  88. netizen_cli-0.10.0/netizen_cli/runtime/__init__.py +1 -0
  89. netizen_cli-0.10.0/netizen_cli/runtime/contracts.py +792 -0
  90. netizen_cli-0.10.0/netizen_cli/runtime/name_writes.py +67 -0
  91. netizen_cli-0.10.0/netizen_cli/runtime/thread_naming.py +451 -0
  92. netizen_cli-0.10.0/netizen_cli/schedules/__init__.py +1 -0
  93. netizen_cli-0.10.0/netizen_cli/schedules/mcp.py +535 -0
  94. netizen_cli-0.10.0/netizen_cli/schedules/models.py +394 -0
  95. netizen_cli-0.10.0/netizen_cli/schedules/scheduler.py +374 -0
  96. netizen_cli-0.10.0/netizen_cli/schedules/service.py +766 -0
  97. netizen_cli-0.10.0/netizen_cli/schedules/store.py +771 -0
  98. netizen_cli-0.10.0/netizen_cli/sdk_gap_adapter.py +1151 -0
  99. netizen_cli-0.10.0/netizen_cli/service_launcher.py +583 -0
  100. netizen_cli-0.10.0/netizen_cli/session_settings.py +126 -0
  101. netizen_cli-0.10.0/netizen_cli/settings.py +216 -0
  102. netizen_cli-0.10.0/netizen_cli/skill_references.py +40 -0
  103. netizen_cli-0.10.0/netizen_cli/terminal_cleanup.py +155 -0
  104. netizen_cli-0.10.0/netizen_cli/turn_activity.py +688 -0
  105. netizen_cli-0.10.0/netizen_cli/turn_files.py +812 -0
  106. netizen_cli-0.10.0/netizen_cli/turn_patch_children.py +254 -0
  107. netizen_cli-0.10.0/netizen_cli/turn_plan_observer.py +315 -0
  108. netizen_cli-0.10.0/netizen_cli/user_questions.py +106 -0
  109. netizen_cli-0.10.0/netizen_cli.egg-info/PKG-INFO +18 -0
  110. netizen_cli-0.10.0/netizen_cli.egg-info/SOURCES.txt +210 -0
  111. netizen_cli-0.10.0/netizen_cli.egg-info/dependency_links.txt +1 -0
  112. netizen_cli-0.10.0/netizen_cli.egg-info/entry_points.txt +2 -0
  113. netizen_cli-0.10.0/netizen_cli.egg-info/requires.txt +15 -0
  114. netizen_cli-0.10.0/netizen_cli.egg-info/top_level.txt +1 -0
  115. netizen_cli-0.10.0/pyproject.toml +36 -0
  116. netizen_cli-0.10.0/setup.cfg +4 -0
  117. netizen_cli-0.10.0/skills/netizen-lark/SKILL.md +64 -0
  118. netizen_cli-0.10.0/skills/netizen-user-guide/SKILL.md +37 -0
  119. netizen_cli-0.10.0/skills/netizen-user-guide/references/user-guide.md +842 -0
  120. netizen_cli-0.10.0/tests/test_admin_update_executor_probe.py +126 -0
  121. netizen_cli-0.10.0/tests/test_binding_scheduled_channel.py +604 -0
  122. netizen_cli-0.10.0/tests/test_bindings.py +1883 -0
  123. netizen_cli-0.10.0/tests/test_cards.py +4118 -0
  124. netizen_cli-0.10.0/tests/test_channel_app.py +11949 -0
  125. netizen_cli-0.10.0/tests/test_channel_fixtures.py +59 -0
  126. netizen_cli-0.10.0/tests/test_channel_input_preparation.py +361 -0
  127. netizen_cli-0.10.0/tests/test_check_sdk.py +112 -0
  128. netizen_cli-0.10.0/tests/test_cli.py +175 -0
  129. netizen_cli-0.10.0/tests/test_cli_data.py +421 -0
  130. netizen_cli-0.10.0/tests/test_cli_distribution.py +274 -0
  131. netizen_cli-0.10.0/tests/test_cli_integration.py +354 -0
  132. netizen_cli-0.10.0/tests/test_cli_packages.py +628 -0
  133. netizen_cli-0.10.0/tests/test_cli_packaging.py +116 -0
  134. netizen_cli-0.10.0/tests/test_cli_services.py +659 -0
  135. netizen_cli-0.10.0/tests/test_cli_setup.py +205 -0
  136. netizen_cli-0.10.0/tests/test_cli_update.py +780 -0
  137. netizen_cli-0.10.0/tests/test_codex_runtime.py +9406 -0
  138. netizen_cli-0.10.0/tests/test_codex_sdk_capabilities.py +255 -0
  139. netizen_cli-0.10.0/tests/test_completion_mention_cards.py +260 -0
  140. netizen_cli-0.10.0/tests/test_completion_mentions.py +880 -0
  141. netizen_cli-0.10.0/tests/test_completion_topic_delivery.py +98 -0
  142. netizen_cli-0.10.0/tests/test_database_migrations.py +310 -0
  143. netizen_cli-0.10.0/tests/test_defaults_cards.py +227 -0
  144. netizen_cli-0.10.0/tests/test_defaults_channel.py +404 -0
  145. netizen_cli-0.10.0/tests/test_defaults_runtime.py +154 -0
  146. netizen_cli-0.10.0/tests/test_deployment.py +96 -0
  147. netizen_cli-0.10.0/tests/test_documentation_links.py +87 -0
  148. netizen_cli-0.10.0/tests/test_domain_experience.py +405 -0
  149. netizen_cli-0.10.0/tests/test_error_messages.py +180 -0
  150. netizen_cli-0.10.0/tests/test_feishu_app_onboarding.py +228 -0
  151. netizen_cli-0.10.0/tests/test_feishu_app_permissions.py +239 -0
  152. netizen_cli-0.10.0/tests/test_file_pagination.py +348 -0
  153. netizen_cli-0.10.0/tests/test_git_status.py +122 -0
  154. netizen_cli-0.10.0/tests/test_image_inputs.py +647 -0
  155. netizen_cli-0.10.0/tests/test_lark_app.py +100 -0
  156. netizen_cli-0.10.0/tests/test_lark_sdk_contract.py +1240 -0
  157. netizen_cli-0.10.0/tests/test_main.py +1543 -0
  158. netizen_cli-0.10.0/tests/test_markdown_images.py +192 -0
  159. netizen_cli-0.10.0/tests/test_message_content.py +500 -0
  160. netizen_cli-0.10.0/tests/test_message_history.py +774 -0
  161. netizen_cli-0.10.0/tests/test_message_material_inputs.py +960 -0
  162. netizen_cli-0.10.0/tests/test_message_preparation.py +136 -0
  163. netizen_cli-0.10.0/tests/test_migration_schema_validation.py +97 -0
  164. netizen_cli-0.10.0/tests/test_model_info_cards.py +125 -0
  165. netizen_cli-0.10.0/tests/test_model_settings.py +308 -0
  166. netizen_cli-0.10.0/tests/test_name_writes.py +261 -0
  167. netizen_cli-0.10.0/tests/test_probe_child_files.py +186 -0
  168. netizen_cli-0.10.0/tests/test_probe_feishu_completion_mention.py +263 -0
  169. netizen_cli-0.10.0/tests/test_probe_feishu_turn_file_card.py +48 -0
  170. netizen_cli-0.10.0/tests/test_probe_python_sdk.py +519 -0
  171. netizen_cli-0.10.0/tests/test_probe_scheduled_tasks.py +587 -0
  172. netizen_cli-0.10.0/tests/test_probe_sdk_completion_race.py +54 -0
  173. netizen_cli-0.10.0/tests/test_probe_thread_naming.py +116 -0
  174. netizen_cli-0.10.0/tests/test_project_delete_channel.py +114 -0
  175. netizen_cli-0.10.0/tests/test_project_delete_runtime.py +383 -0
  176. netizen_cli-0.10.0/tests/test_project_deletion_storage.py +336 -0
  177. netizen_cli-0.10.0/tests/test_prompt_projection.py +293 -0
  178. netizen_cli-0.10.0/tests/test_question_cards.py +216 -0
  179. netizen_cli-0.10.0/tests/test_question_channel.py +323 -0
  180. netizen_cli-0.10.0/tests/test_question_target_parity.py +412 -0
  181. netizen_cli-0.10.0/tests/test_quoted_context.py +1234 -0
  182. netizen_cli-0.10.0/tests/test_release_script.py +402 -0
  183. netizen_cli-0.10.0/tests/test_repository_hygiene.py +127 -0
  184. netizen_cli-0.10.0/tests/test_result_images.py +160 -0
  185. netizen_cli-0.10.0/tests/test_retired_deployment.py +37 -0
  186. netizen_cli-0.10.0/tests/test_runtime_thread_naming.py +465 -0
  187. netizen_cli-0.10.0/tests/test_schedule_card_retry.py +299 -0
  188. netizen_cli-0.10.0/tests/test_schedule_cards.py +886 -0
  189. netizen_cli-0.10.0/tests/test_schedule_mcp.py +501 -0
  190. netizen_cli-0.10.0/tests/test_schedule_run_now.py +188 -0
  191. netizen_cli-0.10.0/tests/test_schedule_scope_matrix.py +357 -0
  192. netizen_cli-0.10.0/tests/test_schedule_service.py +1009 -0
  193. netizen_cli-0.10.0/tests/test_scheduled_channel.py +1187 -0
  194. netizen_cli-0.10.0/tests/test_scheduled_runtime.py +528 -0
  195. netizen_cli-0.10.0/tests/test_scheduler.py +569 -0
  196. netizen_cli-0.10.0/tests/test_scheduler_presenter.py +232 -0
  197. netizen_cli-0.10.0/tests/test_schedules_storage.py +1245 -0
  198. netizen_cli-0.10.0/tests/test_sdk_gap_adapter.py +1137 -0
  199. netizen_cli-0.10.0/tests/test_service_launcher.py +637 -0
  200. netizen_cli-0.10.0/tests/test_session_defaults.py +333 -0
  201. netizen_cli-0.10.0/tests/test_session_settings.py +87 -0
  202. netizen_cli-0.10.0/tests/test_settings_projects.py +463 -0
  203. netizen_cli-0.10.0/tests/test_terminal_cleanup.py +198 -0
  204. netizen_cli-0.10.0/tests/test_thread_naming.py +721 -0
  205. netizen_cli-0.10.0/tests/test_turn_activity.py +816 -0
  206. netizen_cli-0.10.0/tests/test_turn_files.py +723 -0
  207. netizen_cli-0.10.0/tests/test_turn_patch_children.py +739 -0
  208. netizen_cli-0.10.0/tests/test_turn_patch_statistics.py +218 -0
  209. netizen_cli-0.10.0/tests/test_turn_plan_observer.py +456 -0
  210. netizen_cli-0.10.0/tests/test_update_executor.py +313 -0
  211. netizen_cli-0.10.0/tests/test_user_guide_skill.py +107 -0
  212. netizen_cli-0.10.0/tests/test_user_questions.py +99 -0
@@ -0,0 +1,5 @@
1
+ include _build.py
2
+ include config.example.yaml
3
+ recursive-include skills/netizen-lark *
4
+ recursive-include skills/netizen-user-guide *
5
+ global-exclude __pycache__ *.py[cod]
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: netizen-cli
3
+ Version: 0.10.0
4
+ Summary: Use native Codex threads through a Feishu Channel.
5
+ Requires-Python: <3.15,>=3.11
6
+ Requires-Dist: h11==0.16.0
7
+ Requires-Dist: lark-channel-sdk==1.4.0
8
+ Requires-Dist: lark-oapi==1.7.2
9
+ Requires-Dist: markdown-it-py==4.0.0
10
+ Requires-Dist: mdformat==1.0.0
11
+ Requires-Dist: mdformat-gfm==1.0.0
12
+ Requires-Dist: mcp==2.2.0
13
+ Requires-Dist: openai-codex==0.156.1
14
+ Requires-Dist: pydantic==2.13.4
15
+ Requires-Dist: PyYAML==6.0.3
16
+ Requires-Dist: qrcode==8.2
17
+ Requires-Dist: truststore==0.10.4; sys_platform == "darwin"
18
+ Requires-Dist: uvicorn==0.52.4
@@ -0,0 +1,221 @@
1
+ <p align="center">
2
+ <img src="docs/assets/netizen.svg" width="76" height="76" alt="Netizen">
3
+ </p>
4
+
5
+ <a id="netizen"></a>
6
+ <h1 align="center">Netizen</h1>
7
+
8
+ <p align="center"><strong>在飞书里使用 Codex。</strong></p>
9
+
10
+ <p align="center">
11
+ 在单聊、群聊和话题中发起任务、补充要求,接收结果与文件。<br>
12
+ 运行在自己的 Linux 或 macOS 主机上,复用 Codex 登录、原生会话、Skills 与 MCP。
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://github.com/lijingda/netizen/releases"><img src="https://img.shields.io/github/v/release/lijingda/netizen" alt="Latest release"></a>
17
+ <a href="https://github.com/lijingda/netizen/actions/workflows/ci.yml"><img src="https://github.com/lijingda/netizen/actions/workflows/ci.yml/badge.svg" alt="Main quality gate"></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="#快速开始">快速开始</a> ·
22
+ <a href="skills/netizen-user-guide/references/user-guide.md">使用指南</a> ·
23
+ <a href="docs/cli.md">CLI 安装与维护</a> ·
24
+ <a href="docs/CONTRIBUTING.md">参与贡献</a>
25
+ </p>
26
+
27
+ <picture>
28
+ <source media="(max-width: 600px)" srcset="docs/assets/workflow-mobile.svg">
29
+ <img src="docs/assets/workflow.svg" alt="交互示意:在飞书描述任务,执行中补充要求,完成后接收回答并按需发送文件。">
30
+ </picture>
31
+
32
+ <a id="pilot-形态"></a>
33
+
34
+ ## 你可以用它做什么
35
+
36
+ - **把任务交给 Codex。** 在飞书中阅读代码、修改项目、整理资料;任务由官方 Codex SDK
37
+ 管理的原生会话执行,沿用运行主机上的工具和工作目录。
38
+ - **边做边沟通。** 普通任务执行时继续发消息,可以补充条件或调整方向;也可以开启
39
+ [过程卡](skills/netizen-user-guide/references/user-guide.md#飞书中的运行反馈)查看进展。
40
+ - **带上图片与讨论背景。** 支持图片、逐条引用,以及可选的
41
+ [群聊上下文](skills/netizen-user-guide/references/user-guide.md#发送消息引用与图片)。
42
+ - **取回本轮文件。** 完成后从回复卡片中按需发送有原生执行记录的文件;发送的是点击时
43
+ 的当前内容,详见[文件说明](skills/netizen-user-guide/references/user-guide.md#查看和发送本轮文件)。
44
+ - **展开临时讨论,推进持续目标。** 用
45
+ [Side](skills/netizen-user-guide/references/user-guide.md#side-临时话题)另开临时话题,或用
46
+ [Goal](skills/netizen-user-guide/references/user-guide.md#goal)让 Codex 围绕目标持续推进。
47
+ - **让任务按时开始。** 用自然语言或 `/cron` 创建
48
+ [定时任务](skills/netizen-user-guide/references/user-guide.md#定时任务),可每次在独立话题执行,也可在原会话定时继续。
49
+
50
+ 普通会话的历史由 Codex 保存,可在 Codex App/CLI 中继续使用;App/CLI 中新增的消息不会
51
+ 自动回填飞书。多个会话可以并行,同一项目的文件目录共享,修改会相互可见。
52
+
53
+ <a id="安装升级与启停"></a>
54
+
55
+ ## 快速开始
56
+
57
+ ### 1. 准备运行主机
58
+
59
+ | 需要 | 说明 |
60
+ | --- | --- |
61
+ | Linux 或 macOS | Linux 使用 systemd user;macOS 14+ 支持 Apple Silicon 与 Intel,需已登录桌面 |
62
+ | Python 3.11–3.14 | 使用用户选定的环境,不捆绑 Python;生产运行不依赖 Node.js |
63
+ | 有效的 Codex 登录 | 先在运行服务的同一账号下通过 Codex CLI 或 App 登录;不要求全局安装 CLI |
64
+ | 飞书应用 | setup 引导创建或选择机器人应用;按租户要求完成授权、审批、发布和可用范围设置 |
65
+
66
+ Netizen 面向一台主机上的受信用户,使用服务账号的 Codex 状态与工具权限。
67
+ Linux 注销后常驻需要 linger;macOS 服务随桌面登录启动、注销停止。
68
+ [完整前置条件](docs/deployment.md#前置门禁)
69
+
70
+ ### 2. 安装 CLI 并创建实例
71
+
72
+ 此分支改为普通 Python CLI,尚未发布到 PyPI;以下为新版使用方式,不表示旧 Release
73
+ 已具备这些命令。开发安装见[贡献指南](docs/CONTRIBUTING.md)。发行后在选定环境安装:
74
+
75
+ ```sh
76
+ python -m pip install netizen-cli
77
+ # 也可使用 uv tool install netizen-cli
78
+ netizen setup
79
+ netizen start
80
+ netizen status
81
+ ```
82
+
83
+ setup 准备配置、飞书授权和实例数据并注册服务,不默认启动。首次缺凭据会输出浏览器
84
+ 验证链接;Agent 可运行 `netizen setup </dev/null`,转交链接并保留同一进程,确认后自动
85
+ 保存凭据。不要把 App Secret 发到聊天里。start 等待服务真正就绪,每次实际启动均检查
86
+ 数据格式并按需迁移。
87
+
88
+ 默认实例数据集中在 `~/.netizen`;程序位于选定 Python 环境。用 `--root` 或 NETIZEN_ROOT
89
+ 选择其他实例,例如 `netizen setup --root "$HOME/work/.netizen" --admin-port 8890`。
90
+ 各实例共享原生 Codex 状态;服务固定注册时的 Python,终端换 venv 不改变已有绑定。
91
+
92
+ 日常维护用 `netizen update` 更新当前环境并恢复原来运行的实例;它不接受 --root。
93
+ `netizen remove --root ...` 默认保留数据,--purge 才清理精确范围,-y 只省略确认。
94
+ 完整流程、失败边界、跨环境切换和卸载见 [CLI 安装与维护](docs/cli.md)。旧安装手工转换,
95
+ 不提供自动旧布局迁移,不要直接对现有旧实例执行新版清理命令。
96
+
97
+ ### 3. 在飞书开始第一次对话
98
+
99
+ 1. 打开机器人单聊;如需在群里使用,先将机器人加入目标群。
100
+ 2. 发送 `/settings`,创建或登记一个项目并启用。项目就是 Codex 实际工作的目录。
101
+ 3. 发送 `/new`,在卡片中选择项目。模型配置可选择“继承 Codex”;过程卡默认开启,可按需关闭。
102
+ 4. 直接发送任务,例如:**“梳理这个项目的结构,并生成一份入门说明。”**
103
+ 5. 收到回复后继续交流;如果出现“本轮文件”,点击“发送”取回需要的文件。
104
+
105
+ 不确定下一步时发送 `/help` 查看快速开始。通过 `/defaults` 或 Admin 配好
106
+ [会话默认配置](skills/netizen-user-guide/references/user-guide.md#默认会话配置与自动创建)后,
107
+ 没有当前会话时也可直接发送任务:机器人会在消息所在主线或话题创建会话并执行。
108
+ 没有可用默认配置时,机器人仍会提示准备步骤;被拦下的任务需在准备好后重新发送。
109
+
110
+ 群聊和群话题中的每条请求都需要重新 **@机器人**,包括命令。`/new` 只通过卡片创建会话,
111
+ 不接受参数。普通任务执行中发来的新消息用于调整当前任务,不会排队成下一个任务。
112
+
113
+ 安装遇到问题可从[部署文档](docs/deployment.md)继续;已能对话时,常见疑问见
114
+ [使用 FAQ](skills/netizen-user-guide/references/user-guide.md#常见问题)。
115
+
116
+ ## 命令
117
+
118
+ 日常使用可以从这些入口开始:
119
+
120
+ | 想做什么 | 入口 |
121
+ | --- | --- |
122
+ | 创建或登记项目工作目录 | `/settings` |
123
+ | 新建会话,选择项目 | `/new` |
124
+ | 查看、保存或删除当前聊天的会话默认配置 | `/defaults` |
125
+ | 查看并切换已有会话 | `/sessions` |
126
+ | 调整模型、思考强度和过程卡 | `/config`,当前会话空闲时使用 |
127
+ | 查看当前任务和上下文用量 | `/status` |
128
+ | 中断当前任务 | `/stop`;不保证前台工具进程退出,见[停止说明](skills/netizen-user-guide/references/user-guide.md#stop) |
129
+ | 查找当前机器人的管理入口 | `/admin`;返回实际管理 URL 和实例根目录,不返回登录凭据 |
130
+ | 管理定时任务 | `/cron`,也可以直接用自然语言描述计划 |
131
+ | 查看当前实例提供的命令 | `/help` |
132
+
133
+ 重命名、归档、恢复、删除等完整用法见[命令索引](skills/netizen-user-guide/references/user-guide.md#完整命令索引)。
134
+ 当前实例的命令开放情况以 `/help` 为准,任务状态以 `/status` 和卡片提示为准。
135
+
136
+ ### 两个常见场景
137
+
138
+ **另开一个临时讨论。** 当前会话已有对话后,发送:
139
+
140
+ ```text
141
+ /side 这个方案还有哪些边界情况需要考虑?
142
+ ```
143
+
144
+ Side 会在同一聊天中新建话题,可继续多轮讨论。它与原会话共享项目目录,空闲两小时或
145
+ 服务重启后过期;`/side close` 主动结束话题会话。Side 中不支持 Goal。
146
+
147
+ **每天回顾项目进展。** 在已经选择项目的普通会话中发送:
148
+
149
+ ```text
150
+ 每天北京时间九点,在当前群总结这个项目的进展。
151
+ ```
152
+
153
+ 计划每次创建独立执行话题;暂停计划不会停止已经触发的任务。
154
+ [定时任务用法](skills/netizen-user-guide/references/user-guide.md#定时任务)
155
+
156
+ <a id="admin-web"></a>
157
+
158
+ ## 管理与维护
159
+
160
+ 实例管理员可以通过 **Admin Web** 集中管理项目、会话、Side 话题、会话默认配置和定时任务,
161
+ 并在“系统维护”中检查正式更新或重启服务。发送 `/admin` 可获取当前实例的管理 URL
162
+ 和根目录,无需创建会话。未指定端口时首次从 `8787` 起分配并保存,各实例独立监听;
163
+ 管理页仍使用安装器生成的独立管理员凭据,命令不会返回凭据或免登录链接。
164
+ [访问方式](docs/deployment.md#配置与管理页访问)见部署文档。
165
+
166
+ 升级与重启都会影响正在执行的任务,重启后不会自动续跑。
167
+ [正式升级、启停与卸载](docs/deployment.md#升级启停和卸载) ·
168
+ [管理页升级](docs/deployment.md#从-admin-升级) · [管理页重启](docs/deployment.md#从-admin-重启)
169
+
170
+ ## 使用前了解
171
+
172
+ - **共享环境。** 飞书应用的可用范围和群成员关系控制谁能访问;同一实例复用服务账号,
173
+ 不提供按用户或项目隔离的权限体系。Admin Web 面向受信内网的单管理员。
174
+ - **输入与输出。** 支持文本、普通图片和富文本图片,也可提供飞书 2.0 卡片、合并转发与转发话题作为
175
+ [背景材料](skills/netizen-user-guide/references/user-guide.md#卡片合并转发与转发话题)。材料内部的媒体只提供未读附件描述;直接文件和音视频仍不支持。
176
+ 飞书 1.0 卡片明确不支持。
177
+ 输出文件按本轮原生记录发现,不扫描工作区补齐,也不自动上传。
178
+ - **Codex 能力有宿主差异。** 飞书复用原生会话和工具,但并非每个 App/CLI 控件都可用;
179
+ 新会话采用 `auto_review`,不能完整继承 App 的 Ask/Custom。
180
+ [完整差异与当前限制](skills/netizen-user-guide/references/user-guide.md#与-codex-appcli-的差异)
181
+
182
+ <a id="用户指南-skill"></a>
183
+
184
+ 也可以直接在飞书问 **“Netizen 怎么切换会话?”**。Python 安装包随版本提供
185
+ [用户指南 Skill](skills/netizen-user-guide/SKILL.md),支持自然语言咨询;
186
+ 需要显式调用时,发送 `$netizen-user-guide 你的问题`。内置 Skills 属于实例所绑定的
187
+ Python 安装,只为该实例的 Codex 进程加载,不覆盖用户的全局 Skills。
188
+
189
+ ### 按需读取飞书历史
190
+
191
+ Python 安装包同时提供 [netizen-lark Skill](skills/netizen-lark/SKILL.md)。Agent 可以从当前消息的
192
+ `message_id` 定位聊天/话题,再以 **本机 Netizen 的机器人身份**按需读取相关历史。
193
+ 例如:“看看这个话题之前的讨论,再回答我的问题。”已有逐条引用和 catch-up 不依赖此能力。
194
+
195
+ 要使用这项能力,推荐在运行 Netizen 的同一主机、同一账号下,按
196
+ [飞书 CLI 与 Skills 的官方安装说明](https://github.com/larksuite/cli)安装
197
+ `lark-cli` 及 `lark-im` / `lark-shared` Skills;已有安装可以复用。
198
+
199
+ `netizen-lark` 说明如何选择当前 `NETIZEN_ROOT/lark-app/config.json` 中的 `netizen` profile,
200
+ 由可选的 CLI 直接复用 Netizen 的应用凭据;查询与结果处理由 lark Skills 指导。
201
+ Skill 不带脚本,不需将凭据读入模型上下文,也不修改用户默认的 CLI 配置。
202
+ 运行上下文缺少 `NETIZEN_ROOT` 时明确报错,不猜测默认实例的机器人身份。
203
+ 机器人仍受已有权限和聊天可见性约束;历史只在任务需要时读取。
204
+ 其他场景(包括读取消息中的文档、妙记链接)沿用原有 lark Skills 与用户的 CLI 配置;
205
+ 失败后由 Agent 酌情判断是否尝试 Netizen 机器人凭证,具体见 Skill 的身份使用范围。
206
+
207
+ <a id="本地开发"></a>
208
+ <a id="开发与兼容性验证"></a>
209
+
210
+ ## 文档与贡献
211
+
212
+ | 你的任务 | 从这里开始 |
213
+ | --- | --- |
214
+ | 查命令、理解操作后果或排查使用问题 | [用户手册](skills/netizen-user-guide/references/user-guide.md) |
215
+ | 安装、配置应用权限、升级或恢复服务 | [部署文档](docs/deployment.md) |
216
+ | 准备开发环境、运行测试、提交改动 | [贡献指南](docs/CONTRIBUTING.md) |
217
+ | 理解系统与修改实现 | [工程设计](docs/design.md) · [领域词汇](CONTEXT.md) · [架构决策](docs/adr/) |
218
+
219
+ 欢迎通过 [Issues](https://github.com/lijingda/netizen/issues)反馈问题或提出建议,也欢迎
220
+ 提交代码与文档改进。开发当前工作区请按贡献指南安装 editable Python 包;
221
+ 正式发行使用上面的 CLI 安装流程。旧 shell 安装入口已退役,不会自动转换现有实例。
@@ -0,0 +1,28 @@
1
+ """Setuptools hook: ship canonical repository resources without a second copy."""
2
+
3
+ from pathlib import Path
4
+ import shutil
5
+
6
+ from setuptools.command.build_py import build_py
7
+
8
+
9
+ class BuildPy(build_py):
10
+ def run(self) -> None:
11
+ super().run()
12
+ source = Path(__file__).resolve().parent
13
+ destination = Path(self.build_lib).resolve() / "netizen_cli" / "resources"
14
+ if destination == source or destination.is_relative_to(source / "skills"):
15
+ raise ValueError("package resource output overlaps source resources")
16
+ # This is generated build output, never an instance root or user data.
17
+ if destination.exists():
18
+ shutil.rmtree(destination)
19
+ destination.mkdir(parents=True)
20
+ for name in ("netizen-lark", "netizen-user-guide"):
21
+ skill = source / "skills" / name
22
+ if not (skill / "SKILL.md").is_file():
23
+ raise ValueError(f"missing built-in Skill: {skill}")
24
+ for item in (skill, *skill.rglob("*")):
25
+ if item.is_symlink() or not (item.is_dir() or item.is_file()):
26
+ raise ValueError(f"unsupported built-in Skill resource: {item}")
27
+ shutil.copytree(skill, destination / "skills" / name)
28
+ shutil.copyfile(source / "config.example.yaml", destination / "config.example.yaml")
@@ -0,0 +1,35 @@
1
+ # Manual-development example. The managed installers do not copy this file: they generate
2
+ # <NETIZEN_ROOT>/config.yaml with account-specific absolute paths and `projects: {}`.
3
+ # Replace every /home/your-user path before running Netizen directly.
4
+ instance:
5
+ dataDir: /home/your-user/.netizen/state
6
+ # Empty Projects created from Feishu are confined below this directory.
7
+ projectRoot: /home/your-user/projects
8
+
9
+ # User and chat availability are configured in the Feishu app console. Netizen
10
+ # does not maintain a second allowlist.
11
+ projects:
12
+ # All native Codex Threads under this alias share the exact same cwd.
13
+ test: /home/your-user/projects/test
14
+
15
+ channel:
16
+ securityMode: audit
17
+
18
+ # Single-administrator management UI. It is enabled by default and listens on
19
+ # all interfaces for direct access inside the trusted private network.
20
+ adminWeb:
21
+ enabled: true
22
+ host: 0.0.0.0
23
+ # Omit port for first-start allocation from 8787 through 8886. Once bound,
24
+ # the selected port is written here and stays fixed on subsequent starts.
25
+ # port: 8787
26
+ # Optional advertised hostname or IP; no scheme, port, or path.
27
+ # accessHost: server.example.com
28
+
29
+ # The app ID and secret live together in the protected netizen profile at
30
+ # lark-app/config.json beside this YAML file (directory 0700, file 0600).
31
+ # The installer prepares this file; see docs/deployment.md for its JSON format.
32
+ # An explicit override must be an absolute path. Lark CLI is optional.
33
+ # NETIZEN_LARK_APP_CONFIG=/home/your-user/.netizen/lark-app/config.json
34
+ # Admin Web supports only a canonical 32-byte base64url credential file.
35
+ # NETIZEN_ADMIN_SECRET_FILE=/home/your-user/.netizen/credentials/admin-web-secret
@@ -0,0 +1,3 @@
1
+ """Netizen: a thin Feishu Channel for native Codex Threads."""
2
+
3
+ __version__ = "0.10.0"
@@ -0,0 +1,4 @@
1
+ """Run the same public CLI as the console entry point."""
2
+ from .cli import main
3
+
4
+ raise SystemExit(main())
@@ -0,0 +1 @@
1
+ """In-process Admin Web adapters for the Netizen management boundary."""