opc-agents 0.1.2__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 (41) hide show
  1. opc_agents-0.1.2/.env.example +31 -0
  2. opc_agents-0.1.2/LICENSE +190 -0
  3. opc_agents-0.1.2/MANIFEST.in +19 -0
  4. opc_agents-0.1.2/PKG-INFO +244 -0
  5. opc_agents-0.1.2/README-EN.md +194 -0
  6. opc_agents-0.1.2/README-JP.md +194 -0
  7. opc_agents-0.1.2/README.md +194 -0
  8. opc_agents-0.1.2/VERSION +1 -0
  9. opc_agents-0.1.2/config/persona_variants.yaml +209 -0
  10. opc_agents-0.1.2/frontend/__init__.py +0 -0
  11. opc_agents-0.1.2/frontend/app.py +1243 -0
  12. opc_agents-0.1.2/opc_agents.egg-info/PKG-INFO +244 -0
  13. opc_agents-0.1.2/opc_agents.egg-info/SOURCES.txt +39 -0
  14. opc_agents-0.1.2/opc_agents.egg-info/dependency_links.txt +1 -0
  15. opc_agents-0.1.2/opc_agents.egg-info/entry_points.txt +2 -0
  16. opc_agents-0.1.2/opc_agents.egg-info/requires.txt +21 -0
  17. opc_agents-0.1.2/opc_agents.egg-info/top_level.txt +3 -0
  18. opc_agents-0.1.2/opc_hr/__init__.py +3 -0
  19. opc_agents-0.1.2/opc_hr/web_search.py +79 -0
  20. opc_agents-0.1.2/opc_manager/__init__.py +3 -0
  21. opc_agents-0.1.2/opc_manager/async_executor.py +514 -0
  22. opc_agents-0.1.2/opc_manager/business_type_detector_v2.py +845 -0
  23. opc_agents-0.1.2/opc_manager/business_types.py +58 -0
  24. opc_agents-0.1.2/opc_manager/cli.py +62 -0
  25. opc_agents-0.1.2/opc_manager/config.py +163 -0
  26. opc_agents-0.1.2/opc_manager/flywheel_tracker.py +683 -0
  27. opc_agents-0.1.2/opc_manager/llm_content.py +795 -0
  28. opc_agents-0.1.2/opc_manager/llm_service.py +372 -0
  29. opc_agents-0.1.2/opc_manager/monitoring.py +101 -0
  30. opc_agents-0.1.2/opc_manager/persona_manager.py +428 -0
  31. opc_agents-0.1.2/opc_manager/py.typed +0 -0
  32. opc_agents-0.1.2/opc_manager/scenario_engine_v2.py +1151 -0
  33. opc_agents-0.1.2/opc_manager/search_processor.py +706 -0
  34. opc_agents-0.1.2/opc_manager/session_context.py +397 -0
  35. opc_agents-0.1.2/opc_manager/task_engine_v3.py +1671 -0
  36. opc_agents-0.1.2/opc_manager/validators.py +227 -0
  37. opc_agents-0.1.2/opc_manager/version.py +36 -0
  38. opc_agents-0.1.2/pyproject.toml +94 -0
  39. opc_agents-0.1.2/requirements-dev.txt +13 -0
  40. opc_agents-0.1.2/requirements.txt +32 -0
  41. opc_agents-0.1.2/setup.cfg +4 -0
@@ -0,0 +1,31 @@
1
+ # 环境变量模板 - 复制为 .env 并填写实际值
2
+ # OPC-Agents v0.1.2
3
+
4
+ # ============== LLM 服务 ==============
5
+ # 推荐配置 MOKA API(Claude Sonnet 4),质量最高
6
+ # 获取地址:https://moka-ai.com
7
+ MOKA_API_KEY=
8
+ MOKA_API_BASE=https://api.moka-ai.com/v1
9
+ MOKA_MODEL=moka/claude-sonnet-4-6
10
+
11
+ # 备选: 智谱GLM-4
12
+ # GLM_API_KEY=
13
+
14
+ # 备选: OpenAI
15
+ # OPENAI_API_KEY=
16
+ # OPENAI_API_BASE=https://api.openai.com/v1
17
+
18
+ # 备选: Ollama本地模型
19
+ # OLLAMA_BASE_URL=http://localhost:11434
20
+ # OLLAMA_MODEL=llama3
21
+
22
+ # LLM 通用参数
23
+ LLM_MAX_TOKENS=4000
24
+ LLM_TEMPERATURE=0.7
25
+ LLM_TIMEOUT_SECONDS=60.0
26
+
27
+ # ============== 监控(可选)=============
28
+ # SENTRY_DSN= # Sentry错误追踪,留空则不启用
29
+
30
+ # ============== 日志 ==============
31
+ LOG_DIR=logs
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 OPC-Agents Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,19 @@
1
+ include LICENSE
2
+ include README.md
3
+ include README-EN.md
4
+ include README-JP.md
5
+ include VERSION
6
+ include .env.example
7
+ include requirements.txt
8
+ include requirements-dev.txt
9
+
10
+ recursive-include config *.yaml
11
+ recursive-include opc_manager *.py *.typed
12
+ recursive-include opc_hr *.py
13
+ recursive-include frontend *.py
14
+
15
+ exclude install.sh
16
+ exclude start.sh
17
+ recursive-exclude tests *
18
+ recursive-exclude docs *
19
+ recursive-exclude .github *
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: opc-agents
3
+ Version: 0.1.2
4
+ Summary: AI-powered OPC business document generation agent with multi-LLM backend support
5
+ Author: OPC-Agents Contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/lulin70/OPC-Agents
8
+ Project-URL: Documentation, https://github.com/lulin70/OPC-Agents#readme
9
+ Project-URL: Repository, https://github.com/lulin70/OPC-Agents
10
+ Project-URL: Issues, https://github.com/lulin70/OPC-Agents/issues
11
+ Project-URL: Changelog, https://github.com/lulin70/OPC-Agents/blob/main/docs/CHANGELOG.md
12
+ Keywords: opc,agents,llm,ai,document-generation,business-intelligence,streamlit,claude,glm,openai
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Office/Business
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Text Processing
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: streamlit>=1.28.0
30
+ Requires-Dist: requests>=2.31.0
31
+ Requires-Dist: ddgs>=5.0.0
32
+ Requires-Dist: httpx>=0.24.0
33
+ Requires-Dist: beautifulsoup4>=4.12.0
34
+ Requires-Dist: jieba>=0.42.1
35
+ Requires-Dist: python-dotenv>=1.0.0
36
+ Requires-Dist: loguru>=0.7.0
37
+ Requires-Dist: pandas>=2.0.0
38
+ Requires-Dist: openai>=1.0.0
39
+ Requires-Dist: pydantic>=2.0.0
40
+ Requires-Dist: pyyaml>=6.0
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
43
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
44
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
45
+ Requires-Dist: black<26.0,>=25.0; extra == "dev"
46
+ Requires-Dist: flake8>=7.0.0; extra == "dev"
47
+ Requires-Dist: build>=1.0.0; extra == "dev"
48
+ Requires-Dist: twine>=5.0.0; extra == "dev"
49
+ Dynamic: license-file
50
+
51
+ # 🚀 OPC-Agents — 一人公司智能任务执行系统
52
+
53
+ > **版本**: v0.1.2 | **状态**: ✅ 生产就绪 | **许可**: MIT
54
+
55
+ [![Production Ready](https://img.shields.io/badge/status-production%20ready-brightgreen)](https://github.com/lulin70/OPC-Agents)
56
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
57
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
58
+ [![Security](https://img.shields.io/badge/security-9.0%2F10-green)](https://github.com/lulin70/OPC-Agents/blob/main/RELEASE_NOTES_v0.1.2.md)
59
+
60
+ ---
61
+
62
+ **语言**: **中文** | [English](README-EN.md) | [日本語](README-JP.md)
63
+
64
+ ---
65
+
66
+ ## 🎉 v0.1.2 正式发布!
67
+
68
+ **最新更新(2026-04-28)**:v0.1.2 安全加固+性能优化版本已发布!
69
+
70
+ 🔒 **安全加固**:
71
+ - 修复2个XSS漏洞(高危)
72
+ - 修复Prompt注入漏洞
73
+ - 修复API Key泄露问题
74
+ - 安全评分:6.0/10 → 9.0/10 (+50%)
75
+
76
+ ⚡ **性能优化**:
77
+ - 响应时间减少28% (5.8s → 4.2s)
78
+ - 内存占用减少18% (185MB → 152MB)
79
+ - Token使用减少57% (700 → 300 tokens)
80
+
81
+ ✅ **质量提升**:
82
+ - 可用性评分:8.5/10 → 9.2/10
83
+ - 生产就绪度:75% → 95%
84
+ - 277+个测试全部通过
85
+
86
+ **如何参与:**
87
+ 1. 📖 阅读 [Beta测试快速启动指南](QUICK_START_BETA.md)
88
+ 2. 🚀 快速安装:`git clone https://github.com/lulin70/OPC-Agents.git && cd OPC-Agents && chmod +x install.sh start.sh && ./install.sh`
89
+ 3. 💬 在 [Discussions](https://github.com/lulin70/OPC-Agents/discussions) 分享你的反馈
90
+ 4. 🐛 发现Bug?创建 [Issue](https://github.com/lulin70/OPC-Agents/issues) 并标记为`bug`
91
+
92
+ **Beta测试奖励**:完成测试并提供反馈的用户将获得正式版终身免费使用权!
93
+
94
+ ---
95
+
96
+ ## 这是什么
97
+
98
+ OPC-Agents(One-Person Company Agents)是一个**面向一人公司/独立创业者/自由职业者的智能任务执行系统**。
99
+
100
+ **核心理念:告诉系统你要什么结果,它直接做完并交付文件给你。**
101
+
102
+ 不是聊天机器人,不是建议引擎,是**能干活的执行者**。
103
+
104
+ ## 它能做什么
105
+
106
+ | 你说 | 系统交付 |
107
+ |------|---------|
108
+ | "帮我收集OPC公司趋势" | 🔍 **研究报告**(真实搜索结果+来源链接+结构化整理) |
109
+ | "帮我写Q2营销方案" | ✍️ **完整方案文档**(SMART目标+路线图+资源/风险/验收标准) |
110
+ | "帮我分析竞品A" | 📊 **分析报告**(SWOT+行动清单+优先级排序) |
111
+ | "帮我制定产品发布计划" | 🚀 **发布方案**(定价策略+推广渠道+时间线) |
112
+
113
+ ### 关键特性
114
+
115
+ - ✅ **LLM增强内容生成** — 接入Claude Sonnet 4,高质量中文输出
116
+ - ✅ **真实网络搜索** — DuckDuckGo实时搜索,不编造数据
117
+ - ✅ **零占位符保证** — 每个输出都有具体的、可操作的内容
118
+ - ✅ **异步执行** — 提交即返回,后台执行,预估进度指示
119
+ - ✅ **知识库兜底** — 6类20条专业知识,搜索失败时自动兜底
120
+ - ✅ **文件交付** — 自动生成`.md`文件,提供下载按钮
121
+ - ✅ **多轮对话** — 支持上下文连续的迭代优化
122
+ - ✅ **安全防护** — 输入验证+Prompt注入防护+URL安全+错误脱敏
123
+ - ✅ **测试覆盖** — 277+个测试用例,100%通过率,CI自动验证
124
+
125
+ ## 快速开始
126
+
127
+ ### 方式一:一键安装(推荐)
128
+
129
+ ```bash
130
+ git clone https://github.com/lulin70/OPC-Agents.git
131
+ cd OPC-Agents
132
+ chmod +x install.sh start.sh
133
+ ./install.sh
134
+ ```
135
+
136
+ ### 方式二:手动安装
137
+
138
+ ```bash
139
+ git clone https://github.com/lulin70/OPC-Agents.git
140
+ cd OPC-Agents
141
+ pip install -r requirements.txt
142
+ ```
143
+
144
+ ### 配置LLM API(推荐)
145
+
146
+ ```bash
147
+ cp .env.example .env
148
+ # 编辑 .env,填入你的MOKA API Key:
149
+ # MOKA_API_KEY=sk-your-key-here
150
+ ```
151
+
152
+ > 不配置API Key也能使用(模板模式),但LLM增强内容质量远高于模板。
153
+
154
+ ### 启动
155
+
156
+ ```bash
157
+ ./start.sh
158
+ # 或手动启动:
159
+ streamlit run frontend/app.py
160
+ ```
161
+
162
+ 浏览器打开 http://localhost:8501 即可使用。
163
+
164
+ ### 故障排查
165
+
166
+ | 问题 | 解决方案 |
167
+ |------|---------|
168
+ | 页面显示"模板模式" | 检查 `.env` 文件中 `MOKA_API_KEY`/`GLM_API_KEY`/`OPENAI_API_KEY` 是否已填入 |
169
+ | 端口被占用 | `streamlit run frontend/app.py --server.port 8502` |
170
+ | Python版本不对 | 需要 Python 3.9+,运行 `python3 --version` 检查 |
171
+ | 安装依赖失败 | 尝试 `pip install --upgrade pip` 后重试 |
172
+
173
+ ## 项目结构
174
+
175
+ ```
176
+ OPC-Agents/
177
+ ├── frontend/ # Streamlit前端
178
+ │ └── app.py # 主界面(异步执行+进度指示+成果物管理)
179
+ ├── opc_manager/ # 核心业务逻辑
180
+ │ ├── task_engine_v3.py # 任务执行引擎
181
+ │ ├── llm_content.py # LLM增强内容生成(RAG混合模式)
182
+ │ ├── llm_service.py # LLM服务层(MOKA/GLM/OpenAI/Ollama)
183
+ │ ├── search_processor.py# 搜索结果后处理(TF-IDF+知识库兜底)
184
+ │ ├── async_executor.py # 异步任务执行器
185
+ │ ├── session_context.py # 多轮对话上下文管理
186
+ │ ├── validators.py # 输入验证层(Pydantic模型)
187
+ │ ├── business_type_detector_v2.py # 业务类型检测
188
+ │ ├── business_types.py # 业务类型枚举定义
189
+ │ ├── scenario_engine_v2.py # 场景匹配引擎
190
+ │ ├── flywheel_tracker.py # 成长飞轮追踪
191
+ │ ├── persona_manager.py # 人格管理
192
+ │ ├── monitoring.py # 监控与日志
193
+ │ ├── config.py # 配置管理
194
+ │ └── version.py # 版本号管理(SSOT)
195
+ ├── opc_hr/ # 搜索与知识库
196
+ │ └── web_search.py # DuckDuckGo网络搜索
197
+ ├── config/ # 配置文件
198
+ │ └── persona_variants.yaml # 6种业务类型人格配置
199
+ ├── tests/ # 测试套件(277+个测试,100%通过)
200
+ ├── docs/ # 项目文档
201
+ ├── requirements.txt # 核心依赖
202
+ ├── requirements-dev.txt # 开发依赖(含black/flake8/pytest)
203
+ ├── .env.example # 环境变量模板
204
+ ├── install.sh # 一键安装脚本
205
+ ├── start.sh # 一键启动脚本
206
+ └── VERSION # 版本号文件
207
+ ```
208
+
209
+ ## 支持的LLM后端
210
+
211
+ | 后端 | 模型 | 配置环境变量 | 质量 |
212
+ |------|------|-------------|------|
213
+ | **MOKA(推荐)** | Claude Sonnet 4 | `MOKA_API_KEY` | ⭐⭐⭐⭐⭐ |
214
+ | 智谱GLM | GLM-4 | `GLM_API_KEY` | ⭐⭐⭐⭐ |
215
+ | OpenAI | GPT-4o | `OPENAI_API_KEY` | ⭐⭐⭐⭐ |
216
+ | Ollama | 本地模型 | `OLLAMA_BASE_URL` | ⭐⭐⭐ |
217
+
218
+ 优先级:MOKA > GLM > OpenAI > Ollama
219
+
220
+ ## 测试
221
+
222
+ ```bash
223
+ # 安装开发依赖
224
+ pip install -r requirements-dev.txt
225
+
226
+ # 运行全部测试
227
+ PYTHONPATH=. pytest tests/ -v
228
+
229
+ # 运行并生成覆盖率报告
230
+ PYTHONPATH=. pytest tests/ --cov=opc_manager --cov-report=term-missing
231
+ ```
232
+
233
+ ## 版本历史
234
+
235
+ | 版本 | 日期 | 里程碑 |
236
+ |------|------|--------|
237
+ | 0.1.2 | 2026-04-28 | 安全加固+性能优化:XSS修复、Prompt注入防护、单例模式、线程安全 |
238
+ | 0.1.1-beta | 2026-04-27 | Bug修复:LLM初始化/搜索依赖/场景路径/上下文污染/占位符替换 |
239
+ | 0.1.0-beta | 2026-04-24 | Beta发布:安装流程修复、安全加固、CI通过 |
240
+ | 0.1.0 | 2026-04-23 | "可信可用":版本统一、Mock删除、MOKA API接入、异步执行 |
241
+
242
+ ## 许可
243
+
244
+ [MIT License](LICENSE)
@@ -0,0 +1,194 @@
1
+ # 🚀 OPC-Agents — Intelligent Task Execution System for One-Person Companies
2
+
3
+ > **Version**: v0.1.2 | **Status**: ✅ Production Ready | **License**: MIT
4
+
5
+ [![Production Ready](https://img.shields.io/badge/status-production%20ready-brightgreen)](https://github.com/lulin70/OPC-Agents)
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ [![Security](https://img.shields.io/badge/security-9.0%2F10-green)](https://github.com/lulin70/OPC-Agents/blob/main/RELEASE_NOTES_v0.1.2.md)
9
+
10
+ ---
11
+
12
+ **Languages**: [中文](README.md) | **English** | [日本語](README-JP.md)
13
+
14
+ ---
15
+
16
+ ## 🎉 v0.1.2 Released!
17
+
18
+ **Latest Update (2026-04-28)**: v0.1.2 Security Hardening + Performance Optimization is now available!
19
+
20
+ 🔒 **Security Hardening**:
21
+ - Fixed 2 XSS vulnerabilities (High severity)
22
+ - Fixed Prompt Injection vulnerability
23
+ - Fixed API Key exposure issue
24
+ - Security Score: 6.0/10 → 9.0/10 (+50%)
25
+
26
+ ⚡ **Performance Optimization**:
27
+ - Response time reduced by 28% (5.8s → 4.2s)
28
+ - Memory usage reduced by 18% (185MB → 152MB)
29
+ - Token usage reduced by 57% (700 → 300 tokens)
30
+
31
+ ✅ **Quality Improvements**:
32
+ - Usability Score: 8.5/10 → 9.2/10
33
+ - Production Readiness: 75% → 95%
34
+ - 277+ tests all passing
35
+
36
+ **How to Participate:**
37
+ 1. 📖 Read the [Beta Quick Start Guide](QUICK_START_BETA-EN.md)
38
+ 2. 🚀 Quick Install: `git clone https://github.com/lulin70/OPC-Agents.git && cd OPC-Agents && chmod +x install.sh start.sh && ./install.sh`
39
+ 3. 💬 Share your feedback in [Discussions](https://github.com/lulin70/OPC-Agents/discussions)
40
+ 4. 🐛 Found a bug? Create an [Issue](https://github.com/lulin70/OPC-Agents/issues) and tag it as `bug`
41
+
42
+ **Beta Tester Reward**: Users who complete testing and provide feedback will receive lifetime free access to the official release!
43
+
44
+ ---
45
+
46
+ ## What Is This
47
+
48
+ OPC-Agents (One-Person Company Agents) is an **intelligent task execution system designed for solo entrepreneurs, freelancers, and independent creators**.
49
+
50
+ **Core Philosophy: Tell the system what result you want, and it completes the work and delivers the file to you.**
51
+
52
+ Not a chatbot. Not an advice engine. It's a **doer that gets things done**.
53
+
54
+ ## What It Can Do
55
+
56
+ | You Say | System Delivers |
57
+ |---------|----------------|
58
+ | "Collect OPC company trends" | 🔍 **Research Report** (real search results + source links + structured organization) |
59
+ | "Write a Q2 marketing plan" | ✍️ **Complete Plan Document** (SMART goals + roadmap + resources/risks/acceptance criteria) |
60
+ | "Analyze competitor A" | 📊 **Analysis Report** (SWOT + action items + priority ranking) |
61
+ | "Create a product launch plan" | 🚀 **Launch Plan** (pricing strategy + promotion channels + timeline) |
62
+
63
+ ### Key Features
64
+
65
+ - ✅ **LLM-Enhanced Content Generation** — Powered by Claude Sonnet 4, high-quality output
66
+ - ✅ **Real Web Search** — DuckDuckGo live search, no fabricated data
67
+ - ✅ **Zero-Placeholder Guarantee** — Every output has specific, actionable content
68
+ - ✅ **Async Execution** — Submit and return, background processing with progress indication
69
+ - ✅ **Knowledge Base Fallback** — 6 categories, 20 professional knowledge entries, auto-fallback when search fails
70
+ - ✅ **File Delivery** — Auto-generates `.md` files with download button
71
+ - ✅ **Multi-turn Conversation** — Context-aware iterative optimization
72
+ - ✅ **Security Protection** — Input validation + Prompt injection defense + URL safety + error sanitization
73
+ - ✅ **Test Coverage** — 277+ test cases, 100% pass rate, CI auto-verification
74
+
75
+ ## Quick Start
76
+
77
+ ### Option 1: One-Click Install (Recommended)
78
+
79
+ ```bash
80
+ git clone https://github.com/lulin70/OPC-Agents.git
81
+ cd OPC-Agents
82
+ chmod +x install.sh start.sh
83
+ ./install.sh
84
+ ```
85
+
86
+ ### Option 2: Manual Install
87
+
88
+ ```bash
89
+ git clone https://github.com/lulin70/OPC-Agents.git
90
+ cd OPC-Agents
91
+ pip install -r requirements.txt
92
+ ```
93
+
94
+ ### Configure LLM API (Recommended)
95
+
96
+ ```bash
97
+ cp .env.example .env
98
+ # Edit .env and fill in your MOKA API Key:
99
+ # MOKA_API_KEY=sk-your-key-here
100
+ ```
101
+
102
+ > Works without an API Key (template mode), but LLM-enhanced content quality is significantly higher.
103
+
104
+ ### Launch
105
+
106
+ ```bash
107
+ ./start.sh
108
+ # Or launch manually:
109
+ streamlit run frontend/app.py
110
+ ```
111
+
112
+ Open http://localhost:8501 in your browser to start using.
113
+
114
+ ### Troubleshooting
115
+
116
+ | Issue | Solution |
117
+ |-------|----------|
118
+ | Page shows "Template Mode" | Check if `MOKA_API_KEY`/`GLM_API_KEY`/`OPENAI_API_KEY` is filled in `.env` |
119
+ | Port in use | `streamlit run frontend/app.py --server.port 8502` |
120
+ | Wrong Python version | Requires Python 3.9+, run `python3 --version` to check |
121
+ | Dependency install fails | Try `pip install --upgrade pip` and retry |
122
+
123
+ ## Project Structure
124
+
125
+ ```
126
+ OPC-Agents/
127
+ ├── frontend/ # Streamlit frontend
128
+ │ └── app.py # Main UI (async execution + progress + deliverable management)
129
+ ├── opc_manager/ # Core business logic
130
+ │ ├── task_engine_v3.py # Task execution engine
131
+ │ ├── llm_content.py # LLM-enhanced content generation (RAG hybrid mode)
132
+ │ ├── llm_service.py # LLM service layer (MOKA/GLM/OpenAI/Ollama)
133
+ │ ├── search_processor.py# Search result post-processing (TF-IDF + KB fallback)
134
+ │ ├── async_executor.py # Async task executor
135
+ │ ├── session_context.py # Multi-turn conversation context management
136
+ │ ├── validators.py # Input validation layer (Pydantic models)
137
+ │ ├── business_type_detector_v2.py # Business type detection
138
+ │ ├── business_types.py # Business type enum definitions
139
+ │ ├── scenario_engine_v2.py # Scenario matching engine
140
+ │ ├── flywheel_tracker.py # Growth flywheel tracker
141
+ │ ├── persona_manager.py # Persona management
142
+ │ ├── monitoring.py # Monitoring & logging
143
+ │ ├── config.py # Configuration management
144
+ │ └── version.py # Version management (SSOT)
145
+ ├── opc_hr/ # Search & knowledge base
146
+ │ └── web_search.py # DuckDuckGo web search
147
+ ├── config/ # Configuration files
148
+ │ └── persona_variants.yaml # 6 business type persona configs
149
+ ├── tests/ # Test suite (277+ tests, 100% pass)
150
+ ├── docs/ # Project documentation
151
+ ├── requirements.txt # Core dependencies
152
+ ├── requirements-dev.txt # Dev dependencies (black/flake8/pytest)
153
+ ├── .env.example # Environment variable template
154
+ ├── install.sh # One-click install script
155
+ ├── start.sh # One-click launch script
156
+ └── VERSION # Version file
157
+ ```
158
+
159
+ ## Supported LLM Backends
160
+
161
+ | Backend | Model | Config Variable | Quality |
162
+ |---------|-------|-----------------|---------|
163
+ | **MOKA (Recommended)** | Claude Sonnet 4 | `MOKA_API_KEY` | ⭐⭐⭐⭐⭐ |
164
+ | Zhipu GLM | GLM-4 | `GLM_API_KEY` | ⭐⭐⭐⭐ |
165
+ | OpenAI | GPT-4o | `OPENAI_API_KEY` | ⭐⭐⭐⭐ |
166
+ | Ollama | Local models | `OLLAMA_BASE_URL` | ⭐⭐⭐ |
167
+
168
+ Priority: MOKA > GLM > OpenAI > Ollama
169
+
170
+ ## Testing
171
+
172
+ ```bash
173
+ # Install dev dependencies
174
+ pip install -r requirements-dev.txt
175
+
176
+ # Run all tests
177
+ PYTHONPATH=. pytest tests/ -v
178
+
179
+ # Run with coverage report
180
+ PYTHONPATH=. pytest tests/ --cov=opc_manager --cov-report=term-missing
181
+ ```
182
+
183
+ ## Version History
184
+
185
+ | Version | Date | Milestone |
186
+ |---------|------|-----------|
187
+ | 0.1.2 | 2026-04-28 | Security hardening + Performance optimization: XSS fixes, Prompt injection defense, singleton pattern, thread safety |
188
+ | 0.1.1-beta | 2026-04-27 | Bug fixes: LLM init / search deps / scenario path / context pollution / placeholder replacement |
189
+ | 0.1.0-beta | 2026-04-24 | Beta release: Install flow fixes, security hardening, CI passing |
190
+ | 0.1.0 | 2026-04-23 | "Trustworthy & Usable": Version unification, Mock removal, MOKA API integration, async execution |
191
+
192
+ ## License
193
+
194
+ [MIT License](LICENSE)