galaxy-opc-plugin 0.1.0
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.
- package/README.md +166 -0
- package/index.ts +145 -0
- package/openclaw.plugin.json +17 -0
- package/package.json +47 -0
- package/skills/basic-crm/SKILL.md +81 -0
- package/skills/basic-finance/SKILL.md +100 -0
- package/skills/business-monitoring/SKILL.md +120 -0
- package/skills/company-lifecycle/SKILL.md +99 -0
- package/skills/company-registration/SKILL.md +80 -0
- package/skills/finance-tax/SKILL.md +150 -0
- package/skills/hr-assistant/SKILL.md +127 -0
- package/skills/investment-management/SKILL.md +101 -0
- package/skills/legal-assistant/SKILL.md +113 -0
- package/skills/media-ops/SKILL.md +101 -0
- package/skills/procurement-management/SKILL.md +91 -0
- package/skills/project-management/SKILL.md +125 -0
- package/src/api/companies.ts +193 -0
- package/src/api/dashboard.ts +25 -0
- package/src/api/routes.ts +14 -0
- package/src/db/index.ts +63 -0
- package/src/db/migrations.ts +67 -0
- package/src/db/schema.ts +518 -0
- package/src/db/sqlite-adapter.ts +366 -0
- package/src/opc/company-manager.ts +82 -0
- package/src/opc/context-injector.ts +186 -0
- package/src/opc/reminder-service.ts +289 -0
- package/src/opc/types.ts +330 -0
- package/src/opc/workspace-factory.ts +189 -0
- package/src/tools/acquisition-tool.ts +150 -0
- package/src/tools/asset-package-tool.ts +283 -0
- package/src/tools/finance-tool.ts +244 -0
- package/src/tools/hr-tool.ts +211 -0
- package/src/tools/investment-tool.ts +201 -0
- package/src/tools/legal-tool.ts +191 -0
- package/src/tools/lifecycle-tool.ts +251 -0
- package/src/tools/media-tool.ts +174 -0
- package/src/tools/monitoring-tool.ts +207 -0
- package/src/tools/opb-tool.ts +193 -0
- package/src/tools/opc-tool.ts +206 -0
- package/src/tools/procurement-tool.ts +191 -0
- package/src/tools/project-tool.ts +203 -0
- package/src/tools/schemas.ts +163 -0
- package/src/tools/staff-tool.ts +211 -0
- package/src/utils/tool-helper.ts +16 -0
- package/src/web/config-ui.ts +3501 -0
- package/src/web/landing-page.ts +269 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 星环OPC中心 — 产品官网/文档页
|
|
3
|
+
*
|
|
4
|
+
* 路由: /opc/home/*
|
|
5
|
+
* 纯静态 HTML 单页,展示产品功能和安装指南
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ServerResponse } from "node:http";
|
|
9
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
10
|
+
|
|
11
|
+
function sendHtml(res: ServerResponse, html: string): void {
|
|
12
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
13
|
+
res.end(html);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const MODULES = [
|
|
17
|
+
{ icon: "🏢", name: "核心管理", tool: "opc_core", desc: "公司注册、AI员工创建、客户关系、交易记录", phase: 1 },
|
|
18
|
+
{ icon: "💰", name: "财税管理", tool: "opc_finance", desc: "发票管理、增值税/所得税计算、纳税申报、税务日历", phase: 2 },
|
|
19
|
+
{ icon: "⚖", name: "法务合同", tool: "opc_legal", desc: "合同全生命周期、风险评估、到期提醒", phase: 2 },
|
|
20
|
+
{ icon: "👥", name: "人力资源", tool: "opc_hr", desc: "员工档案、薪资核算、社保公积金、入离职管理", phase: 2 },
|
|
21
|
+
{ icon: "📷", name: "新媒体运营", tool: "opc_media", desc: "内容创建、多平台发布、排期管理、数据分析", phase: 2 },
|
|
22
|
+
{ icon: "📋", name: "项目管理", tool: "opc_project", desc: "项目规划、任务分配、进度追踪、预算管控", phase: 2 },
|
|
23
|
+
{ icon: "📈", name: "投融资", tool: "opc_investment", desc: "融资轮次、投资人管理、股权结构(Cap Table)、估值历史", phase: 3 },
|
|
24
|
+
{ icon: "🛒", name: "服务采购", tool: "opc_procurement", desc: "服务项目管理、采购订单、费用分类统计", phase: 3 },
|
|
25
|
+
{ icon: "🏆", name: "生命周期", tool: "opc_lifecycle", desc: "里程碑管理、大事记、时间线、公司综合报告", phase: 3 },
|
|
26
|
+
{ icon: "📊", name: "运营监控", tool: "opc_monitoring", desc: "指标记录、告警管理、KPI看板、跨表数据聚合", phase: 3 },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
function buildLandingHtml(): string {
|
|
30
|
+
const moduleCards = MODULES.map(m =>
|
|
31
|
+
`<div class="module-card">
|
|
32
|
+
<div class="module-icon">${m.icon}</div>
|
|
33
|
+
<h3>${m.name}</h3>
|
|
34
|
+
<p class="module-desc">${m.desc}</p>
|
|
35
|
+
<span class="module-phase">Phase ${m.phase}</span>
|
|
36
|
+
<code class="module-tool">${m.tool}</code>
|
|
37
|
+
</div>`
|
|
38
|
+
).join("\n");
|
|
39
|
+
|
|
40
|
+
return `<!DOCTYPE html>
|
|
41
|
+
<html lang="zh-CN">
|
|
42
|
+
<head>
|
|
43
|
+
<meta charset="UTF-8">
|
|
44
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
45
|
+
<title>星环OPC中心 — 一人公司 AI 管家</title>
|
|
46
|
+
<style>
|
|
47
|
+
:root {
|
|
48
|
+
--primary: #6366f1;
|
|
49
|
+
--primary-dark: #4338ca;
|
|
50
|
+
--text: #1e293b;
|
|
51
|
+
--text-light: #64748b;
|
|
52
|
+
--bg: #ffffff;
|
|
53
|
+
--bg-alt: #f8fafc;
|
|
54
|
+
--border: #e2e8f0;
|
|
55
|
+
--radius: 12px;
|
|
56
|
+
}
|
|
57
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
58
|
+
body {
|
|
59
|
+
font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
|
|
60
|
+
color: var(--text); line-height: 1.6;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Hero */
|
|
64
|
+
.hero {
|
|
65
|
+
background: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #6366f1 100%);
|
|
66
|
+
color: #fff; text-align: center; padding: 80px 24px 64px;
|
|
67
|
+
}
|
|
68
|
+
.hero h1 { font-size: 48px; font-weight: 800; margin-bottom: 12px; }
|
|
69
|
+
.hero .subtitle { font-size: 22px; opacity: 0.9; margin-bottom: 8px; }
|
|
70
|
+
.hero .tagline { font-size: 16px; opacity: 0.7; margin-bottom: 32px; }
|
|
71
|
+
.hero .cta {
|
|
72
|
+
display: inline-block; padding: 14px 36px; background: #fff; color: var(--primary-dark);
|
|
73
|
+
font-size: 16px; font-weight: 600; border-radius: 9999px; text-decoration: none;
|
|
74
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
75
|
+
}
|
|
76
|
+
.hero .cta:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.2); }
|
|
77
|
+
|
|
78
|
+
/* Section */
|
|
79
|
+
.section { max-width: 1100px; margin: 0 auto; padding: 64px 24px; }
|
|
80
|
+
.section h2 {
|
|
81
|
+
font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 12px;
|
|
82
|
+
}
|
|
83
|
+
.section .section-desc {
|
|
84
|
+
text-align: center; color: var(--text-light); font-size: 15px; margin-bottom: 40px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Modules Grid */
|
|
88
|
+
.modules-grid {
|
|
89
|
+
display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
90
|
+
gap: 20px;
|
|
91
|
+
}
|
|
92
|
+
.module-card {
|
|
93
|
+
background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
|
|
94
|
+
padding: 24px; transition: transform 0.2s, box-shadow 0.2s;
|
|
95
|
+
}
|
|
96
|
+
.module-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); }
|
|
97
|
+
.module-icon { font-size: 32px; margin-bottom: 12px; }
|
|
98
|
+
.module-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
|
|
99
|
+
.module-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; margin-bottom: 12px; }
|
|
100
|
+
.module-phase {
|
|
101
|
+
display: inline-block; padding: 2px 8px; border-radius: 9999px;
|
|
102
|
+
font-size: 11px; font-weight: 500; background: #ede9fe; color: #5b21b6;
|
|
103
|
+
}
|
|
104
|
+
.module-tool {
|
|
105
|
+
display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 4px;
|
|
106
|
+
font-size: 11px; background: #f1f5f9; color: var(--text-light);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Install */
|
|
110
|
+
.install-bg { background: var(--bg-alt); }
|
|
111
|
+
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
|
|
112
|
+
.step {
|
|
113
|
+
background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
|
|
114
|
+
}
|
|
115
|
+
.step-num {
|
|
116
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
117
|
+
width: 32px; height: 32px; background: var(--primary); color: #fff;
|
|
118
|
+
border-radius: 50%; font-size: 14px; font-weight: 700; margin-bottom: 12px;
|
|
119
|
+
}
|
|
120
|
+
.step h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
|
|
121
|
+
.step p { font-size: 13px; color: var(--text-light); }
|
|
122
|
+
.step pre {
|
|
123
|
+
background: #1e293b; color: #e2e8f0; padding: 12px; border-radius: 8px;
|
|
124
|
+
font-size: 12px; line-height: 1.6; overflow-x: auto; margin-top: 12px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Examples */
|
|
128
|
+
.examples { display: flex; flex-direction: column; gap: 16px; }
|
|
129
|
+
.example {
|
|
130
|
+
background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
|
|
131
|
+
padding: 20px;
|
|
132
|
+
}
|
|
133
|
+
.example .q {
|
|
134
|
+
font-weight: 600; font-size: 14px; color: var(--primary-dark); margin-bottom: 8px;
|
|
135
|
+
}
|
|
136
|
+
.example .a { font-size: 13px; color: var(--text-light); }
|
|
137
|
+
|
|
138
|
+
/* Footer */
|
|
139
|
+
.footer {
|
|
140
|
+
background: #1e293b; color: rgba(255,255,255,0.6); text-align: center;
|
|
141
|
+
padding: 32px 24px; font-size: 13px;
|
|
142
|
+
}
|
|
143
|
+
.footer strong { color: #fff; }
|
|
144
|
+
|
|
145
|
+
@media (max-width: 640px) {
|
|
146
|
+
.hero h1 { font-size: 32px; }
|
|
147
|
+
.hero .subtitle { font-size: 18px; }
|
|
148
|
+
.modules-grid { grid-template-columns: 1fr; }
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
151
|
+
</head>
|
|
152
|
+
<body>
|
|
153
|
+
|
|
154
|
+
<!-- Hero -->
|
|
155
|
+
<section class="hero">
|
|
156
|
+
<h1>星环OPC中心</h1>
|
|
157
|
+
<div class="subtitle">一人公司 AI 管家</div>
|
|
158
|
+
<div class="tagline">10 大 AI 工具模块 · 覆盖公司全生命周期 · 零代码接入</div>
|
|
159
|
+
<a class="cta" href="/opc/admin">进入管理后台</a>
|
|
160
|
+
</section>
|
|
161
|
+
|
|
162
|
+
<!-- Modules -->
|
|
163
|
+
<section class="section">
|
|
164
|
+
<h2>功能一览</h2>
|
|
165
|
+
<p class="section-desc">从公司注册到融资退出,AI 员工全程代办</p>
|
|
166
|
+
<div class="modules-grid">
|
|
167
|
+
${moduleCards}
|
|
168
|
+
</div>
|
|
169
|
+
</section>
|
|
170
|
+
|
|
171
|
+
<!-- Install -->
|
|
172
|
+
<section class="section install-bg">
|
|
173
|
+
<h2>快速开始</h2>
|
|
174
|
+
<p class="section-desc">三步接入,即刻拥有 AI 公司管家</p>
|
|
175
|
+
<div class="steps">
|
|
176
|
+
<div class="step">
|
|
177
|
+
<div class="step-num">1</div>
|
|
178
|
+
<h3>下载插件</h3>
|
|
179
|
+
<p>将 opc-platform 插件放入 extensions 目录</p>
|
|
180
|
+
<pre>extensions/
|
|
181
|
+
opc-platform/
|
|
182
|
+
index.ts
|
|
183
|
+
package.json
|
|
184
|
+
openclaw.plugin.json</pre>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="step">
|
|
187
|
+
<div class="step-num">2</div>
|
|
188
|
+
<h3>配置启用</h3>
|
|
189
|
+
<p>在 openclaw.json 中启用插件</p>
|
|
190
|
+
<pre>{
|
|
191
|
+
"plugins": {
|
|
192
|
+
"opc-platform": {
|
|
193
|
+
"enabled": true,
|
|
194
|
+
"config": {
|
|
195
|
+
"dbPath": "~/.openclaw/opc/opc.db"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}</pre>
|
|
200
|
+
</div>
|
|
201
|
+
<div class="step">
|
|
202
|
+
<div class="step-num">3</div>
|
|
203
|
+
<h3>启动使用</h3>
|
|
204
|
+
<p>启动 Gateway,通过对话即可使用全部功能</p>
|
|
205
|
+
<pre>pnpm build && pnpm start
|
|
206
|
+
|
|
207
|
+
# 访问管理后台
|
|
208
|
+
http://localhost:18789/opc/admin
|
|
209
|
+
|
|
210
|
+
# 访问产品官网
|
|
211
|
+
http://localhost:18789/opc/home</pre>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</section>
|
|
215
|
+
|
|
216
|
+
<!-- Examples -->
|
|
217
|
+
<section class="section">
|
|
218
|
+
<h2>使用示例</h2>
|
|
219
|
+
<p class="section-desc">自然语言驱动,像和助理对话一样管理公司</p>
|
|
220
|
+
<div class="examples">
|
|
221
|
+
<div class="example">
|
|
222
|
+
<div class="q">"帮我注册一家科技公司,注册资金10万"</div>
|
|
223
|
+
<div class="a">AI 调用 opc_core 创建公司记录,自动生成唯一 ID,设置行业和注册资本</div>
|
|
224
|
+
</div>
|
|
225
|
+
<div class="example">
|
|
226
|
+
<div class="q">"给客户A开一张5万元的服务费发票"</div>
|
|
227
|
+
<div class="a">AI 调用 opc_finance 创建销项发票,自动计算 6% 增值税,生成含税总额</div>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="example">
|
|
230
|
+
<div class="q">"查看当前股权结构"</div>
|
|
231
|
+
<div class="a">AI 调用 opc_investment cap_table,聚合所有投资人股权,计算创始人剩余比例</div>
|
|
232
|
+
</div>
|
|
233
|
+
<div class="example">
|
|
234
|
+
<div class="q">"生成公司综合报告"</div>
|
|
235
|
+
<div class="a">AI 调用 opc_lifecycle generate_report,聚合财务/团队/项目/合同/融资等全景数据</div>
|
|
236
|
+
</div>
|
|
237
|
+
<div class="example">
|
|
238
|
+
<div class="q">"查看这个月的KPI"</div>
|
|
239
|
+
<div class="a">AI 调用 opc_monitoring kpi_summary,跨表聚合收入/员工/项目/合同/告警数据</div>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
</section>
|
|
243
|
+
|
|
244
|
+
<!-- Footer -->
|
|
245
|
+
<footer class="footer">
|
|
246
|
+
<strong>星环OPC中心</strong> v0.3.0 — Phase 3 业务闭环
|
|
247
|
+
<br>基于 OpenClaw 插件架构 · 零核心代码修改
|
|
248
|
+
</footer>
|
|
249
|
+
|
|
250
|
+
</body>
|
|
251
|
+
</html>`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function registerLandingPage(api: OpenClawPluginApi): void {
|
|
255
|
+
api.registerHttpHandler(async (req, res) => {
|
|
256
|
+
const rawUrl = req.url ?? "";
|
|
257
|
+
const urlObj = new URL(rawUrl, "http://localhost");
|
|
258
|
+
const pathname = urlObj.pathname;
|
|
259
|
+
|
|
260
|
+
if (!pathname.startsWith("/opc/home")) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
sendHtml(res, buildLandingHtml());
|
|
265
|
+
return true;
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
api.logger.info("opc: 已注册产品官网 (/opc/home)");
|
|
269
|
+
}
|