@peninsula-med/beisen-ehr-plugin 1.0.1 → 1.0.3

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 CHANGED
@@ -3,28 +3,42 @@
3
3
  北森 EHR 系统的 OpenClaw 插件,支持加班申请、考勤查询、假期余额等功能。
4
4
 
5
5
  > **开发:** 龙二 (Long Er) 🐉
6
- > **版本:** 1.0.0
6
+ > **版本:** 1.0.1
7
7
 
8
8
  ---
9
9
 
10
10
  ## 快速安装
11
11
 
12
+ ### 1️⃣ 安装插件
13
+
14
+ ```bash
15
+ openclaw plugins install @peninsula-med/beisen-ehr-plugin
16
+ ```
17
+
18
+ ### 2️⃣ 配置凭证(3 种方式)
19
+
20
+ **方式 A:使用配置向导(推荐 ⭐)**
21
+
12
22
  ```bash
13
- openclaw plugins install @beisen/beisen-ehr-plugin
23
+ node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js
14
24
  ```
15
25
 
16
- 安装后配置:
26
+ 按提示输入北森凭证即可,自动完成配置!
27
+
28
+ **方式 B:运行配置脚本**
17
29
 
18
30
  ```bash
19
- openclaw plugins config beisen-ehr-plugin
31
+ node node_modules/@peninsula-med/beisen-ehr-plugin/scripts/configure.js
20
32
  ```
21
33
 
22
- 或编辑 `~/.openclaw/config.json`:
34
+ **方式 C:手动编辑配置文件**
35
+
36
+ 编辑 `~/.openclaw/config.json`:
23
37
 
24
38
  ```json
25
39
  {
26
40
  "plugins": {
27
- "beisen-ehr-plugin": {
41
+ "@peninsula-med/beisen-ehr-plugin": {
28
42
  "enabled": true,
29
43
  "config": {
30
44
  "apiUrl": "https://openapi.italent.cn",
@@ -39,10 +53,16 @@ openclaw plugins config beisen-ehr-plugin
39
53
  }
40
54
  ```
41
55
 
42
- 重启 OpenClaw
56
+ ### 3️⃣ 重启 OpenClaw
43
57
 
44
58
  ```bash
45
- openclaw gateway restart
59
+ openclaw restart
60
+ ```
61
+
62
+ ### 4️⃣ 测试
63
+
64
+ ```
65
+ 帮我提交一个加班申请
46
66
  ```
47
67
 
48
68
  ---
@@ -108,31 +128,21 @@ openclaw gateway restart
108
128
 
109
129
  ---
110
130
 
111
- ## 开发
112
-
113
- ### 安装依赖
114
-
115
- ```bash
116
- npm install
117
- ```
118
-
119
- ### 开发模式
120
-
121
- ```bash
122
- npm run dev
123
- ```
131
+ ## 配置向导
124
132
 
125
- ### 构建
133
+ 运行配置向导,按提示输入凭证:
126
134
 
127
135
  ```bash
128
- npm run build
136
+ npx @peninsula-med/beisen-ehr-configure
129
137
  ```
130
138
 
131
- ### 发布
132
-
133
- ```bash
134
- npm run publish:release
135
- ```
139
+ 向导会:
140
+ 1. ✅ 提示输入必要凭证
141
+ 2. ✅ 自动验证格式
142
+ 3. 备份现有配置
143
+ 4. ✅ 写入配置文件
144
+ 5. ✅ 显示配置摘要
145
+ 6. ✅ 提供下一步指引
136
146
 
137
147
  ---
138
148
 
@@ -142,13 +152,14 @@ npm run publish:release
142
152
 
143
153
  ```bash
144
154
  openclaw plugins list
145
- openclaw plugins info beisen-ehr-plugin
155
+ openclaw plugins info @peninsula-med/beisen-ehr-plugin
146
156
  ```
147
157
 
148
158
  ### 配置错误
149
159
 
160
+ 重新运行配置向导:
150
161
  ```bash
151
- openclaw plugins config beisen-ehr-plugin
162
+ npx @peninsula-med/beisen-ehr-configure
152
163
  ```
153
164
 
154
165
  ### 查看日志
@@ -157,6 +168,27 @@ openclaw plugins config beisen-ehr-plugin
157
168
  openclaw gateway logs | grep beisen
158
169
  ```
159
170
 
171
+ ### 卸载
172
+
173
+ ```bash
174
+ openclaw plugins uninstall @peninsula-med/beisen-ehr-plugin
175
+ ```
176
+
177
+ ---
178
+
179
+ ## 更新日志
180
+
181
+ ### v1.0.1 (2026-03-11)
182
+ - ✅ 添加配置向导脚本
183
+ - ✅ 支持 npx 一键配置
184
+
185
+ ### v1.0.0 (2026-03-11)
186
+ - ✅ 初始版本
187
+ - ✅ 提交加班申请
188
+ - ✅ 查询考勤记录
189
+ - ✅ 查询审批状态
190
+ - ✅ 查询假期余额
191
+
160
192
  ---
161
193
 
162
194
  ## License
package/dist/index.cjs.js CHANGED
@@ -24,12 +24,23 @@ const defaultConfig = {
24
24
  */
25
25
  async function activate(runtime, config) {
26
26
  console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);
27
+ // 处理空配置情况
28
+ if (!config) {
29
+ console.error('⚠️ 插件已安装,但未配置凭证');
30
+ console.error('📝 请运行配置向导完成配置:');
31
+ console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');
32
+ console.error('');
33
+ console.error('Windows 用户:');
34
+ console.error(' node %USERPROFILE%\\.openclaw\\extensions\\beisen-ehr-plugin\\scripts\\configure.js');
35
+ return;
36
+ }
27
37
  // 验证必要配置
28
38
  const requiredFields = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];
29
39
  const missingFields = requiredFields.filter(field => !config[field]);
30
40
  if (missingFields.length > 0) {
31
41
  console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);
32
- console.error('请在 OpenClaw 配置中补充这些字段');
42
+ console.error('📝 请运行配置向导完成配置:');
43
+ console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');
33
44
  return;
34
45
  }
35
46
  // MCP 服务器配置会自动从 openclaw.plugin.json 加载
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * 北森 EHR OpenClaw Plugin\n * 🐉 龙二 开发\n * \n * 功能:加班申请、考勤查询、假期余额、审批状态查询\n */\n\nimport type { OpenClawPlugin } from 'openclaw/plugin-sdk';\n\n// 插件元数据\nexport const pluginId = 'beisen-ehr-plugin';\nexport const pluginVersion = '1.0.0';\n\n/**\n * 北森 EHR 插件配置接口\n */\nexport interface BeisenEHRConfig {\n /** 北森 API 地址 */\n apiUrl?: string;\n /** App Key */\n appKey: string;\n /** App Secret */\n appSecret: string;\n /** 员工 ID */\n staffId: string;\n /** 企业租户 ID */\n tenantId: string;\n /** 企业邮箱 */\n email: string;\n}\n\n/**\n * 默认配置\n */\nexport const defaultConfig: Partial<BeisenEHRConfig> = {\n apiUrl: 'https://openapi.italent.cn',\n};\n\n/**\n * 插件激活函数\n * \n * 当插件被激活时,自动配置 MCP 服务器\n */\nexport async function activate(runtime: any, config: BeisenEHRConfig) {\n console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);\n \n // 验证必要配置\n const requiredFields: (keyof BeisenEHRConfig)[] = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];\n const missingFields = requiredFields.filter(field => !config[field]);\n \n if (missingFields.length > 0) {\n console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);\n console.error('请在 OpenClaw 配置中补充这些字段');\n return;\n }\n \n // MCP 服务器配置会自动从 openclaw.plugin.json 加载\n // 这里只需要验证配置即可\n console.error('✅ 北森 EHR 配置验证通过');\n console.error(`📡 API: ${config.apiUrl || defaultConfig.apiUrl}`);\n console.error(`👤 员工:${config.staffId}`);\n console.error(`🏢 企业:${config.tenantId}`);\n}\n\n/**\n * 插件停用函数\n */\nexport async function deactivate() {\n console.error('🏢 北森 EHR 插件已停用');\n}\n\n/**\n * 配置变更回调\n */\nexport async function onConfigChange(config: BeisenEHRConfig) {\n console.error('🔄 北森 EHR 配置已更新');\n await activate(undefined as any, config);\n}\n\n// 导出插件入口\nconst plugin: OpenClawPlugin = {\n id: pluginId,\n version: pluginVersion,\n activate,\n deactivate,\n onConfigChange,\n};\n\nexport default plugin;\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAIH;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,aAAa,GAAG;AAoB7B;;AAEG;AACI,MAAM,aAAa,GAA6B;AACrD,IAAA,MAAM,EAAE,4BAA4B;;AAGtC;;;;AAIG;AACI,eAAe,QAAQ,CAAC,OAAY,EAAE,MAAuB,EAAA;AAClE,IAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,aAAa,CAAA,CAAE,CAAC;;AAGlD,IAAA,MAAM,cAAc,GAA8B,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;AACzG,IAAA,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEpE,IAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,SAAA,EAAY,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AACrD,QAAA,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACtC;IACF;;;AAIA,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,OAAO,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAA,CAAE,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,OAAO,CAAA,CAAE,CAAC;IACxC,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;AAC3C;AAEA;;AAEG;AACI,eAAe,UAAU,GAAA;AAC9B,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAClC;AAEA;;AAEG;AACI,eAAe,cAAc,CAAC,MAAuB,EAAA;AAC1D,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,MAAM,QAAQ,CAAC,SAAgB,EAAE,MAAM,CAAC;AAC1C;AAEA;AACA,MAAM,MAAM,GAAmB;AAC7B,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,OAAO,EAAE,aAAa;IACtB,QAAQ;IACR,UAAU;IACV,cAAc;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * 北森 EHR OpenClaw Plugin\n * 🐉 龙二 开发\n * \n * 功能:加班申请、考勤查询、假期余额、审批状态查询\n */\n\nimport type { OpenClawPlugin } from 'openclaw/plugin-sdk';\n\n// 插件元数据\nexport const pluginId = 'beisen-ehr-plugin';\nexport const pluginVersion = '1.0.0';\n\n/**\n * 北森 EHR 插件配置接口\n */\nexport interface BeisenEHRConfig {\n /** 北森 API 地址 */\n apiUrl?: string;\n /** App Key */\n appKey: string;\n /** App Secret */\n appSecret: string;\n /** 员工 ID */\n staffId: string;\n /** 企业租户 ID */\n tenantId: string;\n /** 企业邮箱 */\n email: string;\n}\n\n/**\n * 默认配置\n */\nexport const defaultConfig: Partial<BeisenEHRConfig> = {\n apiUrl: 'https://openapi.italent.cn',\n};\n\n/**\n * 插件激活函数\n * \n * 当插件被激活时,自动配置 MCP 服务器\n */\nexport async function activate(runtime: any, config?: BeisenEHRConfig) {\n console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);\n \n // 处理空配置情况\n if (!config) {\n console.error('⚠️ 插件已安装,但未配置凭证');\n console.error('📝 请运行配置向导完成配置:');\n console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');\n console.error('');\n console.error('Windows 用户:');\n console.error(' node %USERPROFILE%\\\\.openclaw\\\\extensions\\\\beisen-ehr-plugin\\\\scripts\\\\configure.js');\n return;\n }\n \n // 验证必要配置\n const requiredFields: (keyof BeisenEHRConfig)[] = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];\n const missingFields = requiredFields.filter(field => !config[field]);\n \n if (missingFields.length > 0) {\n console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);\n console.error('📝 请运行配置向导完成配置:');\n console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');\n return;\n }\n \n // MCP 服务器配置会自动从 openclaw.plugin.json 加载\n // 这里只需要验证配置即可\n console.error('✅ 北森 EHR 配置验证通过');\n console.error(`📡 API: ${config.apiUrl || defaultConfig.apiUrl}`);\n console.error(`👤 员工:${config.staffId}`);\n console.error(`🏢 企业:${config.tenantId}`);\n}\n\n/**\n * 插件停用函数\n */\nexport async function deactivate() {\n console.error('🏢 北森 EHR 插件已停用');\n}\n\n/**\n * 配置变更回调\n */\nexport async function onConfigChange(config: BeisenEHRConfig) {\n console.error('🔄 北森 EHR 配置已更新');\n await activate(undefined as any, config);\n}\n\n// 导出插件入口\nconst plugin: OpenClawPlugin = {\n id: pluginId,\n version: pluginVersion,\n activate,\n deactivate,\n onConfigChange,\n};\n\nexport default plugin;\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAIH;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,aAAa,GAAG;AAoB7B;;AAEG;AACI,MAAM,aAAa,GAA6B;AACrD,IAAA,MAAM,EAAE,4BAA4B;;AAGtC;;;;AAIG;AACI,eAAe,QAAQ,CAAC,OAAY,EAAE,MAAwB,EAAA;AACnE,IAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,aAAa,CAAA,CAAE,CAAC;;IAGlD,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC;AACjC,QAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,QAAA,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC;AACtF,QAAA,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AACjB,QAAA,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,wFAAwF,CAAC;QACvG;IACF;;AAGA,IAAA,MAAM,cAAc,GAA8B,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;AACzG,IAAA,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEpE,IAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,SAAA,EAAY,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AACrD,QAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,QAAA,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC;QACtF;IACF;;;AAIA,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,OAAO,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAA,CAAE,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,OAAO,CAAA,CAAE,CAAC;IACxC,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;AAC3C;AAEA;;AAEG;AACI,eAAe,UAAU,GAAA;AAC9B,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAClC;AAEA;;AAEG;AACI,eAAe,cAAc,CAAC,MAAuB,EAAA;AAC1D,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,MAAM,QAAQ,CAAC,SAAgB,EAAE,MAAM,CAAC;AAC1C;AAEA;AACA,MAAM,MAAM,GAAmB;AAC7B,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,OAAO,EAAE,aAAa;IACtB,QAAQ;IACR,UAAU;IACV,cAAc;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -35,7 +35,7 @@ declare const defaultConfig: Partial<BeisenEHRConfig>;
35
35
  *
36
36
  * 当插件被激活时,自动配置 MCP 服务器
37
37
  */
38
- declare function activate(runtime: any, config: BeisenEHRConfig): Promise<void>;
38
+ declare function activate(runtime: any, config?: BeisenEHRConfig): Promise<void>;
39
39
  /**
40
40
  * 插件停用函数
41
41
  */
package/dist/index.esm.js CHANGED
@@ -20,12 +20,23 @@ const defaultConfig = {
20
20
  */
21
21
  async function activate(runtime, config) {
22
22
  console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);
23
+ // 处理空配置情况
24
+ if (!config) {
25
+ console.error('⚠️ 插件已安装,但未配置凭证');
26
+ console.error('📝 请运行配置向导完成配置:');
27
+ console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');
28
+ console.error('');
29
+ console.error('Windows 用户:');
30
+ console.error(' node %USERPROFILE%\\.openclaw\\extensions\\beisen-ehr-plugin\\scripts\\configure.js');
31
+ return;
32
+ }
23
33
  // 验证必要配置
24
34
  const requiredFields = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];
25
35
  const missingFields = requiredFields.filter(field => !config[field]);
26
36
  if (missingFields.length > 0) {
27
37
  console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);
28
- console.error('请在 OpenClaw 配置中补充这些字段');
38
+ console.error('📝 请运行配置向导完成配置:');
39
+ console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');
29
40
  return;
30
41
  }
31
42
  // MCP 服务器配置会自动从 openclaw.plugin.json 加载
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * 北森 EHR OpenClaw Plugin\n * 🐉 龙二 开发\n * \n * 功能:加班申请、考勤查询、假期余额、审批状态查询\n */\n\nimport type { OpenClawPlugin } from 'openclaw/plugin-sdk';\n\n// 插件元数据\nexport const pluginId = 'beisen-ehr-plugin';\nexport const pluginVersion = '1.0.0';\n\n/**\n * 北森 EHR 插件配置接口\n */\nexport interface BeisenEHRConfig {\n /** 北森 API 地址 */\n apiUrl?: string;\n /** App Key */\n appKey: string;\n /** App Secret */\n appSecret: string;\n /** 员工 ID */\n staffId: string;\n /** 企业租户 ID */\n tenantId: string;\n /** 企业邮箱 */\n email: string;\n}\n\n/**\n * 默认配置\n */\nexport const defaultConfig: Partial<BeisenEHRConfig> = {\n apiUrl: 'https://openapi.italent.cn',\n};\n\n/**\n * 插件激活函数\n * \n * 当插件被激活时,自动配置 MCP 服务器\n */\nexport async function activate(runtime: any, config: BeisenEHRConfig) {\n console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);\n \n // 验证必要配置\n const requiredFields: (keyof BeisenEHRConfig)[] = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];\n const missingFields = requiredFields.filter(field => !config[field]);\n \n if (missingFields.length > 0) {\n console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);\n console.error('请在 OpenClaw 配置中补充这些字段');\n return;\n }\n \n // MCP 服务器配置会自动从 openclaw.plugin.json 加载\n // 这里只需要验证配置即可\n console.error('✅ 北森 EHR 配置验证通过');\n console.error(`📡 API: ${config.apiUrl || defaultConfig.apiUrl}`);\n console.error(`👤 员工:${config.staffId}`);\n console.error(`🏢 企业:${config.tenantId}`);\n}\n\n/**\n * 插件停用函数\n */\nexport async function deactivate() {\n console.error('🏢 北森 EHR 插件已停用');\n}\n\n/**\n * 配置变更回调\n */\nexport async function onConfigChange(config: BeisenEHRConfig) {\n console.error('🔄 北森 EHR 配置已更新');\n await activate(undefined as any, config);\n}\n\n// 导出插件入口\nconst plugin: OpenClawPlugin = {\n id: pluginId,\n version: pluginVersion,\n activate,\n deactivate,\n onConfigChange,\n};\n\nexport default plugin;\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AAIH;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,aAAa,GAAG;AAoB7B;;AAEG;AACI,MAAM,aAAa,GAA6B;AACrD,IAAA,MAAM,EAAE,4BAA4B;;AAGtC;;;;AAIG;AACI,eAAe,QAAQ,CAAC,OAAY,EAAE,MAAuB,EAAA;AAClE,IAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,aAAa,CAAA,CAAE,CAAC;;AAGlD,IAAA,MAAM,cAAc,GAA8B,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;AACzG,IAAA,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEpE,IAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,SAAA,EAAY,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AACrD,QAAA,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACtC;IACF;;;AAIA,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,OAAO,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAA,CAAE,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,OAAO,CAAA,CAAE,CAAC;IACxC,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;AAC3C;AAEA;;AAEG;AACI,eAAe,UAAU,GAAA;AAC9B,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAClC;AAEA;;AAEG;AACI,eAAe,cAAc,CAAC,MAAuB,EAAA;AAC1D,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,MAAM,QAAQ,CAAC,SAAgB,EAAE,MAAM,CAAC;AAC1C;AAEA;AACA,MAAM,MAAM,GAAmB;AAC7B,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,OAAO,EAAE,aAAa;IACtB,QAAQ;IACR,UAAU;IACV,cAAc;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * 北森 EHR OpenClaw Plugin\n * 🐉 龙二 开发\n * \n * 功能:加班申请、考勤查询、假期余额、审批状态查询\n */\n\nimport type { OpenClawPlugin } from 'openclaw/plugin-sdk';\n\n// 插件元数据\nexport const pluginId = 'beisen-ehr-plugin';\nexport const pluginVersion = '1.0.0';\n\n/**\n * 北森 EHR 插件配置接口\n */\nexport interface BeisenEHRConfig {\n /** 北森 API 地址 */\n apiUrl?: string;\n /** App Key */\n appKey: string;\n /** App Secret */\n appSecret: string;\n /** 员工 ID */\n staffId: string;\n /** 企业租户 ID */\n tenantId: string;\n /** 企业邮箱 */\n email: string;\n}\n\n/**\n * 默认配置\n */\nexport const defaultConfig: Partial<BeisenEHRConfig> = {\n apiUrl: 'https://openapi.italent.cn',\n};\n\n/**\n * 插件激活函数\n * \n * 当插件被激活时,自动配置 MCP 服务器\n */\nexport async function activate(runtime: any, config?: BeisenEHRConfig) {\n console.error(`🏢 北森 EHR 插件已激活 v${pluginVersion}`);\n \n // 处理空配置情况\n if (!config) {\n console.error('⚠️ 插件已安装,但未配置凭证');\n console.error('📝 请运行配置向导完成配置:');\n console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');\n console.error('');\n console.error('Windows 用户:');\n console.error(' node %USERPROFILE%\\\\.openclaw\\\\extensions\\\\beisen-ehr-plugin\\\\scripts\\\\configure.js');\n return;\n }\n \n // 验证必要配置\n const requiredFields: (keyof BeisenEHRConfig)[] = ['appKey', 'appSecret', 'staffId', 'tenantId', 'email'];\n const missingFields = requiredFields.filter(field => !config[field]);\n \n if (missingFields.length > 0) {\n console.error(`❌ 缺少必要配置:${missingFields.join(', ')}`);\n console.error('📝 请运行配置向导完成配置:');\n console.error(' node ~/.openclaw/extensions/beisen-ehr-plugin/scripts/configure.js');\n return;\n }\n \n // MCP 服务器配置会自动从 openclaw.plugin.json 加载\n // 这里只需要验证配置即可\n console.error('✅ 北森 EHR 配置验证通过');\n console.error(`📡 API: ${config.apiUrl || defaultConfig.apiUrl}`);\n console.error(`👤 员工:${config.staffId}`);\n console.error(`🏢 企业:${config.tenantId}`);\n}\n\n/**\n * 插件停用函数\n */\nexport async function deactivate() {\n console.error('🏢 北森 EHR 插件已停用');\n}\n\n/**\n * 配置变更回调\n */\nexport async function onConfigChange(config: BeisenEHRConfig) {\n console.error('🔄 北森 EHR 配置已更新');\n await activate(undefined as any, config);\n}\n\n// 导出插件入口\nconst plugin: OpenClawPlugin = {\n id: pluginId,\n version: pluginVersion,\n activate,\n deactivate,\n onConfigChange,\n};\n\nexport default plugin;\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AAIH;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,aAAa,GAAG;AAoB7B;;AAEG;AACI,MAAM,aAAa,GAA6B;AACrD,IAAA,MAAM,EAAE,4BAA4B;;AAGtC;;;;AAIG;AACI,eAAe,QAAQ,CAAC,OAAY,EAAE,MAAwB,EAAA;AACnE,IAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,aAAa,CAAA,CAAE,CAAC;;IAGlD,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC;AACjC,QAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,QAAA,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC;AACtF,QAAA,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AACjB,QAAA,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,wFAAwF,CAAC;QACvG;IACF;;AAGA,IAAA,MAAM,cAAc,GAA8B,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;AACzG,IAAA,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEpE,IAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,SAAA,EAAY,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AACrD,QAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,QAAA,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC;QACtF;IACF;;;AAIA,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,OAAO,CAAC,KAAK,CAAC,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAA,CAAE,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,OAAO,CAAA,CAAE,CAAC;IACxC,OAAO,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,MAAM,CAAC,QAAQ,CAAA,CAAE,CAAC;AAC3C;AAEA;;AAEG;AACI,eAAe,UAAU,GAAA;AAC9B,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAClC;AAEA;;AAEG;AACI,eAAe,cAAc,CAAC,MAAuB,EAAA;AAC1D,IAAA,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;AAChC,IAAA,MAAM,QAAQ,CAAC,SAAgB,EAAE,MAAM,CAAC;AAC1C;AAEA;AACA,MAAM,MAAM,GAAmB;AAC7B,IAAA,EAAE,EAAE,QAAQ;AACZ,IAAA,OAAO,EAAE,aAAa;IACtB,QAAQ;IACR,UAAU;IACV,cAAc;;;;;"}
@@ -34,8 +34,7 @@
34
34
  "format": "email",
35
35
  "description": "企业邮箱"
36
36
  }
37
- },
38
- "required": ["appKey", "appSecret", "staffId", "tenantId", "email"]
37
+ }
39
38
  }
40
39
  }
41
40
  ],
@@ -63,7 +62,6 @@
63
62
  "type": "string",
64
63
  "format": "email"
65
64
  }
66
- },
67
- "required": ["appKey", "appSecret", "staffId", "tenantId", "email"]
65
+ }
68
66
  }
69
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peninsula-med/beisen-ehr-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -49,6 +49,11 @@ async function main() {
49
49
 
50
50
  await sleep(1000);
51
51
 
52
+ console.log('💡 提示:');
53
+ console.log(' Windows 用户也可以使用此脚本自动配置');
54
+ console.log(' 脚本位置:%USERPROFILE%\\.openclaw\\extensions\\beisen-ehr-plugin\\scripts\\configure.js');
55
+ console.log('');
56
+
52
57
  const appKey = await question('请输入 App Key: ');
53
58
  const appSecret = await question('请输入 App Secret: ');
54
59
  const tenantId = await question('请输入 Tenant ID: ');