bdip-office-assistant-cli 0.0.0-stage → 1.0.1

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 (63) hide show
  1. package/README.md +37 -2
  2. package/dist/accounts.js +30 -0
  3. package/dist/args.js +36 -0
  4. package/dist/auth-token.js +783 -0
  5. package/dist/auth.js +331 -0
  6. package/dist/blog.js +562 -0
  7. package/dist/browser-links.js +224 -0
  8. package/dist/captcha-display.js +30 -0
  9. package/dist/cli.js +5533 -0
  10. package/dist/client.js +254 -0
  11. package/dist/config.js +170 -0
  12. package/dist/createcontext.js +41 -0
  13. package/dist/crypto.js +139 -0
  14. package/dist/cube.js +1771 -0
  15. package/dist/documents.js +98 -0
  16. package/dist/email.js +841 -0
  17. package/dist/field-preparation.js +237 -0
  18. package/dist/fileutil.js +20 -0
  19. package/dist/formula-runtime.js +55 -0
  20. package/dist/hrm.js +478 -0
  21. package/dist/keepalive.js +99 -0
  22. package/dist/kq.js +280 -0
  23. package/dist/linkage-calculations.js +68 -0
  24. package/dist/links.js +34 -0
  25. package/dist/meetings.js +172 -0
  26. package/dist/nodemap.js +242 -0
  27. package/dist/odoc.js +199 -0
  28. package/dist/office-tools.js +155 -0
  29. package/dist/pageopen.js +29 -0
  30. package/dist/parse.js +177 -0
  31. package/dist/password-input.js +84 -0
  32. package/dist/password-login.js +208 -0
  33. package/dist/person-selection.js +81 -0
  34. package/dist/querystate.js +38 -0
  35. package/dist/render.js +21 -0
  36. package/dist/report.js +50 -0
  37. package/dist/session-worker.js +54 -0
  38. package/dist/session.js +280 -0
  39. package/dist/submissionplan.js +45 -0
  40. package/dist/submissionstate.js +81 -0
  41. package/dist/subordinate.js +458 -0
  42. package/dist/supervise.js +152 -0
  43. package/dist/todoaskidea.js +54 -0
  44. package/dist/todobatch.js +172 -0
  45. package/dist/todocc.js +128 -0
  46. package/dist/todoforward.js +66 -0
  47. package/dist/todoreject.js +215 -0
  48. package/dist/todosubmit.js +325 -0
  49. package/dist/todotransfer.js +54 -0
  50. package/dist/util.js +25 -0
  51. package/dist/wfagent.js +538 -0
  52. package/dist/wfcreate.js +102 -0
  53. package/dist/wfform.js +169 -0
  54. package/dist/wfops.js +40 -0
  55. package/dist/wfreceiver.js +43 -0
  56. package/dist/wfstart.js +558 -0
  57. package/dist/wfsummary.js +89 -0
  58. package/dist/wfupload.js +83 -0
  59. package/dist/wfuser.js +96 -0
  60. package/dist/workflow-runtime.js +177 -0
  61. package/dist/workflow.js +570 -0
  62. package/dist/workplan.js +431 -0
  63. package/package.json +29 -6
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
- # Temporary Holding Version
1
+ # 毕埃慕ai助手 CLI 1.0.1
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ BDIP5办公平台的命令行工具,由毕埃慕(上海)建筑数据技术股份有限公司提供。配合WorkBuddy的“毕埃慕ai助手”技能使用,也可直接运行`bdip --help`查看命令。
4
+
5
+ ## 安装
6
+
7
+ 需要Node.js 18或更高版本及npm。在实际运行助手的环境安装;手机使用云电脑时需要安装在云电脑。
8
+
9
+ ```text
10
+ npm install -g bdip-office-assistant-cli@1.0.1 --registry=https://registry.npmjs.org/
11
+ bdip version
12
+ bdip --help
13
+ ```
14
+
15
+ 当前配套技能版本为 1.0.1,CLI 版本为 1.0.1。安装时固定版本,两种交付包必须使用相同源码。CLI 版本不匹配时手机适配器会停止。
16
+
17
+ ## 配置
18
+
19
+ ```text
20
+ bdip config set baseUrl https://你的BDIP5平台
21
+ ```
22
+
23
+ 需要BDIP5平台账号及相应业务权限,运行环境必须能访问平台。HTTP站点仍支持手机密码登录,须按用户明确授权设置当前站点:
24
+
25
+ ```text
26
+ bdip config set baseUrl http://你的平台主机:端口
27
+ bdip config set httpPasswordLoginOrigin http://你的平台主机:端口
28
+ ```
29
+
30
+ HTTP设置只对同协议、主机和端口有效;HTTP没有传输加密,登录前按技能说明明示风险。用户凭据通过独立stdin传入,不写入命令或临时文件。验证码由用户人工填写,动态口令、设备验证、强制改密等平台要求不能跳过。
31
+
32
+ ## 使用与数据
33
+
34
+ 支持查询与办理待办、普通流程与草稿、台账、日报、邮件、日程、公文及考勤,具体命令与适配边界以`bdip --help`及配套技能参考为准。写操作需先预览并取得明确确认;接口返回不确定时不自动重复提交。
35
+
36
+ 配置与登录态保存在运行环境用户目录`.bdip/`,不在安装包内。使用技能时相关办公信息会经过助手所用模型平台;登录及权限说明见配套技能。
37
+
38
+ 基础密码登录不需要额外Java扩展;长会话TTL与免登录桥接等增强能力依赖另行部署的服务端扩展,npm安装不会自动部署。手机原图验证码显示仍需宿主支持,不宣称所有宿主均已验证。
@@ -0,0 +1,30 @@
1
+ import { createApiFromProfile } from './client.js';
2
+ import { ensureSessionHeartbeat } from './session.js';
3
+
4
+ export async function listAccounts(cfg) {
5
+ const api = await createApiFromProfile(cfg);
6
+ const r = await api.get('/api/hrm/login/getAccountList', { __random__: Date.now() }, { forceCookie: true });
7
+ const accounts = r.json?.data?.accountlist;
8
+ if (!Array.isArray(accounts) || !accounts.length) throw new Error('未获取到关联账号,请检查登录状态。');
9
+ return accounts.map(a => ({ id: String(a.userid), name: a.username, company: a.subcompanyname,
10
+ department: a.deptname, job: a.jobs, current: String(a.iscurrent) === '1', type: String(a.usertype) }));
11
+ }
12
+
13
+ export async function switchAccount(cfg, id) {
14
+ const accounts = await listAccounts(cfg);
15
+ const target = accounts.find(a => a.id === String(id));
16
+ if (!target) throw new Error('目标账号不在当前登录的关联账号列表中。');
17
+ if (target.current) return target;
18
+ const api = await createApiFromProfile(cfg);
19
+ const r = await api.post('/api/hrm/login/identityShift', { shiftid: target.id }, { forceCookie: true });
20
+ const currentAccounts = (await listAccounts(cfg)).filter(a => a.current);
21
+ const current = currentAccounts.length === 1 ? currentAccounts[0] : null;
22
+ if (String(r.json?.status) !== '1' || current?.id !== target.id)
23
+ throw new Error('账号切换未验证成功,请查询 bdip account list 核实当前身份。');
24
+ // Refresh the shared identity before another business request can select an old token.
25
+ const heartbeat = await ensureSessionHeartbeat(cfg);
26
+ const state = await heartbeat?.tick();
27
+ if (state && (!state.authenticated || state.userId !== target.id))
28
+ throw new Error('账号已切换,但保活身份未核验一致;请检查登录状态后再办理业务。');
29
+ return current;
30
+ }
package/dist/args.js ADDED
@@ -0,0 +1,36 @@
1
+ export function parseArgs(argv) {
2
+ const args = { _: [], flags: {} };
3
+ for (let i = 0; i < argv.length; i++) {
4
+ const a = argv[i];
5
+ if (a.startsWith('--')) {
6
+ const key = a.slice(2);
7
+ // --key=value 形式
8
+ const eq = key.indexOf('=');
9
+ if (eq >= 0) {
10
+ args.flags[key.slice(0, eq)] = key.slice(eq + 1);
11
+ continue;
12
+ }
13
+ const next = argv[i + 1];
14
+ if (next === undefined || next.startsWith('--')) {
15
+ args.flags[key] = true;
16
+ }
17
+ else {
18
+ args.flags[key] = next;
19
+ i++;
20
+ }
21
+ }
22
+ else {
23
+ args._.push(a);
24
+ }
25
+ }
26
+ return args;
27
+ }
28
+ /** 取字符串型 flag;布尔/缺省返回 undefined。 */
29
+ export function flagStr(args, key) {
30
+ const v = args.flags[key];
31
+ return typeof v === 'string' ? v : undefined;
32
+ }
33
+ /** 取布尔型 flag。 */
34
+ export function flagBool(args, key) {
35
+ return args.flags[key] === true;
36
+ }