weaver-work-cli 0.1.57 → 0.1.59

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 (86) hide show
  1. package/dist/chunks/{attachment-content-QGM5MLQE.js → attachment-content-TP6WDNC6.js} +3 -3
  2. package/dist/chunks/{caizhilian-QJ4FLSQJ.js → caizhilian-5NM4X5HG.js} +1 -1
  3. package/dist/chunks/{chunk-7EBV7Q3R.js → chunk-2FHP4PYS.js} +50 -27
  4. package/dist/chunks/{chunk-DVR2EDUU.js → chunk-6YWHRXEQ.js} +17 -1
  5. package/dist/chunks/{chunk-FDAJC7R4.js → chunk-AQOPPNTR.js} +2 -2
  6. package/dist/chunks/{chunk-6DVL5IN5.js → chunk-CI2RF3AJ.js} +7 -4
  7. package/dist/chunks/{chunk-WHJIUKJW.js → chunk-FM7B5BIR.js} +206 -39
  8. package/dist/chunks/{chunk-L2LMBFG5.js → chunk-I3BFBBP2.js} +1 -1
  9. package/dist/chunks/{chunk-6MS3RLPO.js → chunk-MQBMMJUV.js} +2 -2
  10. package/dist/chunks/{chunk-XU3FL3AW.js → chunk-QNPIY5R6.js} +4 -4
  11. package/dist/chunks/{chunk-AHJZIMCX.js → chunk-U2DWV6JC.js} +1 -1
  12. package/dist/chunks/{chunk-WMB3SMXI.js → chunk-WINR2Q6K.js} +27 -4
  13. package/dist/chunks/{chunk-UI66EMOR.js → chunk-XR5BGFNT.js} +4 -4
  14. package/dist/chunks/{chunk-TJUAGZU7.js → chunk-ZHPCNM2S.js} +6 -6
  15. package/dist/chunks/{conflict-VAFFPUY3.js → conflict-Y3ESXYIA.js} +2 -2
  16. package/dist/chunks/{create-flow-TVYE3IOH.js → create-flow-JHQSA6JF.js} +6 -6
  17. package/dist/chunks/{data-WVICO3DT.js → data-ZVS3BWPT.js} +3 -5
  18. package/dist/chunks/{env-BVVFIN4P.js → env-LQBLL3MZ.js} +2 -2
  19. package/dist/chunks/{factory-RCQ36LLE.js → factory-X7PN6B3B.js} +1 -1
  20. package/dist/chunks/{group-chat-YFZDUUY3.js → group-chat-PPFY7SPV.js} +3 -3
  21. package/dist/chunks/{invoice-7JGSEWT5.js → invoice-6XDMPCWB.js} +59 -8
  22. package/dist/chunks/{lazy-dispatch-JHGFCKJN.js → lazy-dispatch-GCA6HDOB.js} +1 -1
  23. package/dist/chunks/{meeting-JOHV4RH3.js → meeting-GMRQZFJP.js} +16 -12
  24. package/dist/chunks/{minute-doc-JLS4KMFZ.js → minute-doc-JXH3MNC7.js} +5 -5
  25. package/dist/chunks/{operations-ZPWBMYKE.js → operations-6NXJ7RTE.js} +1 -1
  26. package/dist/chunks/{registry-LITYOH2W.js → registry-WZCCBI5L.js} +10 -10
  27. package/dist/chunks/{room-recommend-62MECG4J.js → room-recommend-CKU5NF2E.js} +4 -4
  28. package/dist/chunks/{schedule-6QRXIBGU.js → schedule-DEFAO2RY.js} +4 -4
  29. package/dist/index.js +6 -6
  30. package/dist/internal/e10/auth/commands.js +29 -1
  31. package/dist/shortcuts/caizhilian/operations/files.js +4 -1
  32. package/dist/shortcuts/caizhilian/operations/handlers/document.js +33 -4
  33. package/dist/shortcuts/data/index.js +0 -1
  34. package/dist/shortcuts/data/manifest.js +1 -1
  35. package/dist/shortcuts/data/operations/module.js +2 -3
  36. package/dist/shortcuts/invoice/manifest.js +6 -4
  37. package/dist/shortcuts/invoice/operations/reim-subsidy.js +54 -4
  38. package/dist/shortcuts/meeting/host.js +6 -1
  39. package/dist/shortcuts/meeting/minute-doc.js +3 -2
  40. package/dist/shortcuts/meeting/operations/compose-outcome.js +4 -0
  41. package/dist/shortcuts/meeting/operations/eb/create-flow.js +29 -3
  42. package/dist/shortcuts/meeting/operations/eb/crm-search.js +20 -0
  43. package/dist/shortcuts/meeting/operations/eb/decision-task-reassign.js +113 -0
  44. package/dist/shortcuts/meeting/operations/eb/decision.js +41 -1
  45. package/dist/shortcuts/meeting/operations/eb/factory.js +4 -4
  46. package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
  47. package/dist/shortcuts/meeting/operations/eb-fallback.js +3 -0
  48. package/dist/shortcuts/meeting/operations/registry.js +14 -1
  49. package/dist/shortcuts/meeting/operations/shared.js +4 -0
  50. package/docs/agent-invoice.md +0 -1
  51. package/docs/data.md +1 -1
  52. package/docs/e10-auth.md +5 -0
  53. package/docs/invoice.md +1 -1
  54. package/package.json +1 -1
  55. package/skill-template/domains/yepiaotong.md +2 -0
  56. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  57. package/skills/weaver-e10-caizhilian/references/document.md +1 -1
  58. package/skills/weaver-e10-caizhilian/references/source-manifest.json +2 -2
  59. package/skills/weaver-e10-data/references/config-center.md +0 -1
  60. package/skills/weaver-e10-jucailin/SKILL.md +6 -6
  61. package/skills/weaver-e10-jucailin/references/recruit-read.md +3 -2
  62. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +1 -1
  63. package/skills/weaver-e10-jucailin/references/recruit-write.md +15 -8
  64. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +3 -1
  65. package/skills/weaver-e10-meeting/SKILL.md +14 -4
  66. package/skills/weaver-e10-recruit-stage/SKILL.md +42 -14
  67. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +61 -20
  68. package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +194 -0
  69. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +5 -4
  70. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -5
  71. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +1 -10
  72. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +25 -6
  73. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +3 -2
  74. package/skills/weaver-e10-yepiaotong/SKILL.md +5 -5
  75. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +0 -23
  76. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +1 -1
  77. package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +1 -1
  78. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +2 -2
  79. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +15 -11
  80. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +2 -2
  81. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
  82. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +1 -1
  83. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +80 -35
  84. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +9 -9
  85. package/skills/weaver-e10-yepiaotong/references/invoice-summarize.py +0 -217
  86. package/skills/weaver-e10-yepiaotong.zip +0 -0
@@ -22,6 +22,22 @@ const MARKDOWN_ALLOWED_EXT = ['.md', '.markdown'];
22
22
  const CREATE_DETAIL_PATH = '/api/doc/document/createDetail';
23
23
  /** 源 CreateDocumentByUploadPlugin.MAX_UPLOAD_WORKERS。 */
24
24
  const MAX_UPLOAD_WORKERS = 8;
25
+ /** 并发上限保护值:环境变量给得过大时夹取,避免并发风暴打爆服务端。 */
26
+ const MAX_UPLOAD_WORKERS_CAP = 32;
27
+ /**
28
+ * 批量上传与文件元数据读取的并发上限。
29
+ * 默认 8(与源插件 ThreadPoolExecutor(min(8, n)) 一致);
30
+ * 可用环境变量 WEAVER_CAIZHILIAN_UPLOAD_MAX_WORKERS 微调(1~32),非法值回落默认。
31
+ */
32
+ function uploadMaxWorkers() {
33
+ const raw = process.env.WEAVER_CAIZHILIAN_UPLOAD_MAX_WORKERS;
34
+ if (raw === undefined)
35
+ return MAX_UPLOAD_WORKERS;
36
+ const parsed = Number(raw);
37
+ if (!Number.isInteger(parsed) || parsed < 1)
38
+ return MAX_UPLOAD_WORKERS;
39
+ return Math.min(parsed, MAX_UPLOAD_WORKERS_CAP);
40
+ }
25
41
  /** 源 UpdateDocFieldPlugin._FIELD_MAP:field -> (filed, arg_key, allow_empty)。 */
26
42
  const FIELD_MAP = {
27
43
  name: { filed: 'name', argKey: 'name', allowEmpty: false },
@@ -472,9 +488,22 @@ async function planCreateByUpload(args, env, action) {
472
488
  sharers: JSON.stringify(sharers),
473
489
  extraParameters: '{}',
474
490
  };
491
+ // 并行读文件元数据(重叠本地 I/O);错误仍按输入顺序抛出,与串行版语义一致。
492
+ const settledMetas = await mapWithConcurrency(filePaths, uploadMaxWorkers(), async (filePath) => {
493
+ try {
494
+ return { ok: true, meta: await readFileMetadata(filePath) };
495
+ }
496
+ catch (error) {
497
+ return { ok: false, error };
498
+ }
499
+ });
475
500
  const metas = [];
476
- for (const filePath of filePaths)
477
- metas.push(await readFileMetadata(filePath));
501
+ for (const item of settledMetas) {
502
+ if (item.ok)
503
+ metas.push(item.meta);
504
+ else
505
+ throw item.error;
506
+ }
478
507
  return {
479
508
  filePaths,
480
509
  folderId,
@@ -557,7 +586,7 @@ const createByUploadHandler = {
557
586
  upload: {
558
587
  path: '/api/file/module/upload',
559
588
  extra_result_fields: ['docId'],
560
- max_workers: MAX_UPLOAD_WORKERS,
589
+ max_workers: uploadMaxWorkers(),
561
590
  deferred_to_apply: true,
562
591
  },
563
592
  }, lease, plan.warnings);
@@ -571,7 +600,7 @@ const createByUploadHandler = {
571
600
  return caizhilianSuccess(action, data, { batch: false }, plan.warnings);
572
601
  }
573
602
  const warnings = [...plan.warnings];
574
- const results = await mapWithConcurrency(plan.metas, MAX_UPLOAD_WORKERS, async (meta, index) => {
603
+ const results = await mapWithConcurrency(plan.metas, uploadMaxWorkers(), async (meta, index) => {
575
604
  try {
576
605
  return await uploadOneDocument(env, meta, plan, action);
577
606
  }
@@ -398,7 +398,6 @@ export const dataShortcut = {
398
398
  .option('--header <k: v>', '额外请求头(单个)')
399
399
  .option('--headers <json|@file>', '额外请求头(JSON 对象)')
400
400
  .option('--method <GET|POST|FORM>', '提交方式,默认取 confAttrs.http_method')
401
- .option('--limit <n>', '行数上限,默认 50;0 = 不截断')
402
401
  .option('--fields <a,b|@f>', '只保留这些行字段')
403
402
  .option('--raw', '原样输出响应体')
404
403
  .option('--show-params', '只打印入/出参说明,不调接口')
@@ -54,7 +54,7 @@ const INPUT_SCHEMAS = {
54
54
  required: [],
55
55
  optional: [
56
56
  'conf_key', 'group', 'type', 'conf_file', 'args', 'query', 'header', 'headers',
57
- 'method', 'limit', 'fields', 'raw', 'show_params', 'full', 'with_example', 'no_example',
57
+ 'method', 'fields', 'raw', 'show_params', 'full', 'with_example', 'no_example',
58
58
  'dry_run', 'timeout',
59
59
  ],
60
60
  },
@@ -136,7 +136,6 @@ export async function moduleCall(input, host) {
136
136
  let group = typeof input.group === 'string' ? input.group : '';
137
137
  const confType = typeof input.type === 'string' && input.type ? input.type : 'api';
138
138
  const timeoutMs = Math.max(1, Number(input.timeout || '60') || 60) * 1000;
139
- const limit = input.limit === undefined || input.limit === true ? 50 : (Number(input.limit) || 0);
140
139
  const fields = typeof input.fields === 'string' && input.fields
141
140
  ? readListArg(input.fields).split(',').map((item) => item.trim()).filter(Boolean)
142
141
  : null;
@@ -341,7 +340,7 @@ export async function moduleCall(input, host) {
341
340
  const out = { ok: true, api_name: apiName, http: status, via: payload.via, ...tipFields(tips) };
342
341
  let projected = null;
343
342
  if (rows !== null) {
344
- const shown = limit > 0 ? rows.slice(0, limit) : rows;
343
+ const shown = rows;
345
344
  projected = fields
346
345
  ? shown.map((row) => {
347
346
  const picked = {};
@@ -364,7 +363,7 @@ export async function moduleCall(input, host) {
364
363
  out.flags = flags;
365
364
  const lines = [`== ${apiName} ==`, `${effMethod} ${apiPath} → HTTP ${status}(via=${payload.via})`];
366
365
  if (rows !== null) {
367
- lines.push(`rows=${rows.length}${total !== null && total !== undefined ? ` / total=${total}` : ''}${limit > 0 && rows.length > limit ? `(已截断到 ${limit} 行)` : ''}`);
366
+ lines.push(`rows=${rows.length}${total !== null && total !== undefined ? ` / total=${total}` : ''}`);
368
367
  lines.push(renderTable('', projected));
369
368
  }
370
369
  else {
@@ -1088,6 +1088,7 @@ export const invoiceOperations = [
1088
1088
  path: '/api/secondev/fna/expense/reimbursement/aiCreateWf',
1089
1089
  autoCommit: '1',
1090
1090
  currentEmpId: 'session.userId',
1091
+ invoiceDateWindow: '开票日期必须在最近 30 个东八区日历日内(今天及前 29 天,含首尾);缺失、无效、超期或未来日期均在提交前拒绝',
1091
1092
  detailList: 'invoices 每张一行 {relatedProcessId, relatedInvoiceId, reimbursedAmount},relatedProcessId 全部相同;reimbursedAmount 取该发票 total,合计不超过 monthlyAllowance,超额那行报「额度 − 前面行累加」,额度用完后剩下的发票不进明细',
1092
1093
  },
1093
1094
  inputSchema: {
@@ -1102,14 +1103,15 @@ export const invoiceOperations = [
1102
1103
  type: 'array',
1103
1104
  minItems: 1,
1104
1105
  maxItems: 100,
1105
- description: '本次报销的发票,每张生成一行明细;顺序即额度扣减顺序',
1106
+ description: '本次报销的发票,仅限最近 30 天开票;每张生成一行明细,顺序即额度扣减顺序',
1106
1107
  items: {
1107
1108
  type: 'object',
1108
1109
  additionalProperties: false,
1109
- required: ['fid', 'total'],
1110
+ required: ['fid', 'total', 'date'],
1110
1111
  properties: {
1111
1112
  fid: { ...positiveId, description: '票夹发票 fid' },
1112
1113
  total: { type: 'string', pattern: '^\\d+(\\.\\d{1,2})?$', description: '这张发票的价税合计(invoice.list 的 total)' },
1114
+ date: { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2}$', description: '开票日期,原样取 invoice.list 的 date;必须在今天及前 29 天内(北京时间,含首尾)' },
1113
1115
  },
1114
1116
  },
1115
1117
  },
@@ -1135,8 +1137,8 @@ export const invoiceOperations = [
1135
1137
  skippedInvoices: arrayOf(objectSchema({
1136
1138
  relatedInvoiceId: { type: 'string' },
1137
1139
  invoiceTotal: { type: 'string' },
1138
- }, ['relatedInvoiceId', 'invoiceTotal']), { description: '额度用完后没进明细、留在票夹的发票' }),
1139
- finalMarkdown: { type: 'string', description: '[processTitle](url),直接展示给用户' },
1140
+ }, ['relatedInvoiceId', 'invoiceTotal']), { description: '额度用完后没进明细、留在票夹的发票;成功回执汇总其张数和金额' }),
1141
+ finalMarkdown: { type: 'string', description: '成功提示、报销事由、实际报销金额、已使用发票张数及票面合计、开票日期、月补贴额度(有值时)、超额及未纳入发票说明(有则展示),末尾附报销流程链接;原样展示给用户' },
1140
1142
  result: rawObject,
1141
1143
  workflow: workflowSchema,
1142
1144
  }, ['requestId', 'url', 'processTitle', 'invoiceCount', 'reimbursedAmount', 'invoiceTotal', 'monthlyAllowance', 'capped', 'details', 'skippedInvoices', 'finalMarkdown', 'result', 'workflow']),
@@ -1,5 +1,6 @@
1
1
  import { InvoiceCliError, invoicePartialError, invoiceValidationError, isInvoiceNetworkError } from '../errors.js';
2
2
  import { asNonEmptyString, asPositiveString, workflow } from './shared.js';
3
+ import { addCalendarDays, shanghaiCalendarDate } from './reim.js';
3
4
  const SUBSIDY_SUBMIT_PATH = '/api/secondev/fna/expense/reimbursement/aiCreateWf';
4
5
  /** 泛微上海 */
5
6
  const DEFAULT_CUSTOMER_ID = '100504500000311504';
@@ -26,19 +27,35 @@ function amountCents(value, name) {
26
27
  function formatCents(cents) {
27
28
  return cents % 100 === 0 ? String(cents / 100) : (cents / 100).toFixed(2);
28
29
  }
30
+ /** 最近 30 个东八区日历日,包含今天及前 29 天。 */
31
+ export function subsidyInvoiceDateRange(now = new Date()) {
32
+ const dateEnd = shanghaiCalendarDate(0, now);
33
+ return { dateBegin: addCalendarDays(dateEnd, -29), dateEnd };
34
+ }
29
35
  function normalizeInvoices(value) {
30
36
  if (!Array.isArray(value) || value.length === 0)
31
37
  throw invoiceValidationError('input_invalid', 'invoices 必须是非空数组');
32
38
  if (value.length > 100)
33
39
  throw invoiceValidationError('input_invalid', 'invoices 单次最多支持 100 张');
40
+ const { dateBegin, dateEnd } = subsidyInvoiceDateRange();
34
41
  const invoices = value.map((item, index) => {
35
42
  if (!item || typeof item !== 'object')
36
- throw invoiceValidationError('input_invalid', `invoices[${index}] 必须是 {fid,total}`);
43
+ throw invoiceValidationError('input_invalid', `invoices[${index}] 必须是 {fid,total,date}`);
37
44
  const fid = asPositiveString(String(item.fid ?? ''), `invoices[${index}].fid`);
38
45
  const cents = amountCents(item.total, `invoices[${index}].total`);
39
46
  if (cents === null)
40
47
  throw invoiceValidationError('input_invalid', `invoices[${index}].total 必填:这张发票的价税合计`);
41
- return { fid, cents };
48
+ const date = asNonEmptyString(item.date, `invoices[${index}].date`);
49
+ const timestamp = Date.parse(`${date}T00:00:00Z`);
50
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(date) || !Number.isFinite(timestamp) || new Date(timestamp).toISOString().slice(0, 10) !== date) {
51
+ throw invoiceValidationError('input_invalid', `invoices[${index}].date 必须是有效的开票日期(YYYY-MM-DD)`);
52
+ }
53
+ if (date < dateBegin || date > dateEnd) {
54
+ throw invoiceValidationError('invoice_date_out_of_range', `发票 ${fid} 的开票日期 ${date} 不在最近 30 天范围(${dateBegin} 至 ${dateEnd},北京时间)内,不能报销`, {
55
+ fid, date, dateBegin, dateEnd,
56
+ });
57
+ }
58
+ return { fid, cents, date };
42
59
  });
43
60
  if (new Set(invoices.map((item) => item.fid)).size !== invoices.length) {
44
61
  throw invoiceValidationError('input_invalid', 'invoices 不能包含重复 fid');
@@ -48,11 +65,44 @@ function normalizeInvoices(value) {
48
65
  function workflowViewUrl(baseUrl, requestId) {
49
66
  return `${baseUrl.replace(/\/+$/, '')}/sp/workflow/flowpage/view/${requestId}`;
50
67
  }
68
+ function subsidyReceipt(options) {
69
+ const { processTitle, reason, url, details, skipped, allowanceCents, reimbursedTotalCents } = options;
70
+ const money = (cents) => `¥${(cents / 100).toFixed(2)}`;
71
+ const includedTotalCents = details.reduce((sum, item) => sum + item.cents, 0);
72
+ const partialAmountCents = includedTotalCents - reimbursedTotalCents;
73
+ const dates = details.map((item) => item.date).sort();
74
+ const firstDate = dates[0];
75
+ const lastDate = dates[dates.length - 1];
76
+ const dateRange = firstDate === lastDate ? firstDate : `${firstDate} 至 ${lastDate}`;
77
+ const lines = [
78
+ '已报销成功,流程已提交。',
79
+ '',
80
+ '| 项目 | 本次报销 |',
81
+ '| --- | --- |',
82
+ `| 报销事由 | ${reason.replace(/\|/gu, '\\|').replace(/[\r\n]+/gu, ' ')} |`,
83
+ `| 报销金额 | **${money(reimbursedTotalCents)}** |`,
84
+ `| 已使用发票 | ${details.length} 张,票面合计 ${money(includedTotalCents)} |`,
85
+ `| 开票日期 | ${dateRange} |`,
86
+ ];
87
+ if (allowanceCents !== null)
88
+ lines.push(`| 月补贴额度 | ${money(allowanceCents)} |`);
89
+ lines.push('');
90
+ if (partialAmountCents > 0) {
91
+ lines.push(`本次按月补贴额度报销,已使用发票中超出的 ${money(partialAmountCents)} 未计入报销金额。`, '');
92
+ }
93
+ if (skipped.length > 0) {
94
+ const skippedTotalCents = skipped.reduce((sum, item) => sum + item.cents, 0);
95
+ lines.push(`月补贴额度已用完,另有 ${skipped.length} 张发票(合计 ${money(skippedTotalCents)})未纳入本次报销,仍在票夹。后续报销仍须满足最近 30 天的开票日期要求。`, '');
96
+ }
97
+ lines.push(`[查看报销流程:${processTitle}](${url})`);
98
+ return lines.join('\n');
99
+ }
51
100
  /**
52
101
  * 话费 / 油费补贴报销:一次调用直接创建并提交报销流程(autoCommit 固定 "1")。
102
+ * 提交前校验全部发票的开票日期,仅允许最近 30 个东八区日历日。
53
103
  * 明细每行 = 一张发票 + 同一条事前申请;当前人员取登录会话。
54
104
  * 明细报销金额合计不超过月补贴额度:每行取该发票价税合计,超额的那一行报「额度 − 前面行累加」,
55
- * 额度用完后剩下的发票不进明细,留在票夹下次再报。
105
+ * 额度用完后剩下的发票不进明细,留在票夹;下次仍需满足最近 30 天限制。
56
106
  */
57
107
  export class InvoiceReimSubsidySubmitOperation {
58
108
  name = 'invoice.reim.subsidy.submit';
@@ -154,7 +204,7 @@ export class InvoiceReimSubsidySubmitOperation {
154
204
  relatedInvoiceId: item.fid,
155
205
  invoiceTotal: formatCents(item.cents),
156
206
  })),
157
- finalMarkdown: `[${processTitle}](${url})`,
207
+ finalMarkdown: subsidyReceipt({ processTitle, reason, url, details, skipped, allowanceCents, reimbursedTotalCents }),
158
208
  result,
159
209
  workflow: workflow(this.name, 'COMPLETE'),
160
210
  },
@@ -209,7 +209,12 @@ export function createMeetingHost(ctx, dependencies = {}) {
209
209
  exitCode: 1,
210
210
  });
211
211
  }
212
- throw new MeetingCliError('api', 'business_error', message, {
212
+ // 「接口类型不一致」是 EB 侧动作流类型配错(如 update 接口配成"新建数据"),
213
+ // 不是参数问题:直接给可执行提示,省得调用方反复试参数。
214
+ const typeMismatchHint = /接口类型不一致/.test(message)
215
+ ? ';EB 应用里该动作流类型与调用方式不符:update 类接口需配成「修改数据」,create 类需配成「新建数据」'
216
+ : '';
217
+ throw new MeetingCliError('api', 'business_error', `${message}${typeMismatchHint}`, {
213
218
  code,
214
219
  details: { code, message },
215
220
  exitCode: 1,
@@ -93,7 +93,8 @@ export async function ensureMinuteDoc(env, input) {
93
93
  });
94
94
  const dir = join(meetingStateDir(env.ctx), 'minute-docs');
95
95
  await mkdir(dir, { recursive: true });
96
- const filePath = join(dir, `${id}.docx`);
96
+ // 文档名取 basename(file_path):文件名必须是「纪要标题」,不能是 <id>.docx
97
+ const filePath = join(dir, `${fileName}.docx`);
97
98
  await writeFile(filePath, buf);
98
99
  const upload = await getMeetingOperation('meeting.attachment.upload').handler({ file: filePath, name: `${fileName}.docx`, module: 'meeting', refId: mtId }, env);
99
100
  const fileId = String(upload?.data?.fileId ?? '').trim();
@@ -135,7 +136,7 @@ export async function ensureMinuteDoc(env, input) {
135
136
  id,
136
137
  mt_id: mtId,
137
138
  doc_file: fileId,
138
- ...(docId ? { mt_minutes: JSON.stringify([{ id: docId, name: `${fileName}.docx` }]) } : {}),
139
+ ...(docId ? { mt_minutes: docId } : {}),
139
140
  file_type: '0',
140
141
  minutes_status: '2',
141
142
  }, env);
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { meetingSuccess } from './types.js';
9
9
  import { meetingValidationError } from '../errors.js';
10
+ import { meetingUrlMap } from './eb/meeting-link.js';
10
11
  const composeOutcome = {
11
12
  name: 'meeting.outcome.compose',
12
13
  resource: 'outcome',
@@ -159,9 +160,12 @@ const composeOutcome = {
159
160
  detail1: details,
160
161
  }, env);
161
162
  const decisionApplied = await publishApply.handler({ confirm: true, continuation: decisionPrepared?.data?.continuation }, env);
163
+ const urlMap = await meetingUrlMap(env, [mtId]);
164
+ const meetingUrl = urlMap.get(mtId) ?? '';
162
165
  return meetingSuccess('meeting.outcome.compose', {
163
166
  status: 'COMPLETE',
164
167
  mtId,
168
+ ...(meetingUrl ? { meetingUrl } : {}),
165
169
  minuteId,
166
170
  minuteDoc,
167
171
  minutesStatus: '2',
@@ -1093,6 +1093,18 @@ export async function resolveWorkflowId(env, args) {
1093
1093
  }
1094
1094
  // 固化优先(2026-10-30):自用固定流程,省一次设置查询,也不受 mt_new_wf 配置影响。
1095
1095
  // 只有登录环境命中固化配置才启用(避免拿生产的流程 id 去撞测试环境)。
1096
+ // 流程记忆优先:上次成功用过的流程直接沿用,不读应用设置、不探测权限。
1097
+ if (String(args.flowChoice ?? '') !== 'ask') {
1098
+ const remembered = await readFlowPick(env).catch(() => null);
1099
+ if (remembered?.workflowId) {
1100
+ return {
1101
+ workflowId: remembered.workflowId,
1102
+ candidates: [remembered.workflowId],
1103
+ source: 'memory',
1104
+ ...(remembered.name ? { label: remembered.name } : {}),
1105
+ };
1106
+ }
1107
+ }
1096
1108
  const fixed = await fixedFlowIdsForEnv(env);
1097
1109
  if (fixed.ids.length > 0) {
1098
1110
  return {
@@ -1298,6 +1310,9 @@ const ebMeetingCreateFlowPrepare = {
1298
1310
  },
1299
1311
  }, { required: ['mt_name'] }),
1300
1312
  handler: async (args, env) => {
1313
+ // 预检各阶段耗时(debugTimings:true 时随结果返回)
1314
+ const marks = (env.__meetingTimings ??= {});
1315
+ const mark = (key, from) => { marks[key] = (marks[key] ?? 0) + (Date.now() - from); };
1301
1316
  // ⚠️ 2026-10-30 顺序调整:**先确认四要素(名称 / 时间 / 参会人 / 地点),最后才定流程**。
1302
1317
  // 流程探测与选择整体后移到房间闸门之后(见下方「流程闸门」);这里先占位,
1303
1318
  // 好让前面的时间/会议室选择分支仍能带出"当前用的是哪条流程"(此刻通常还是空的)。
@@ -1756,9 +1771,11 @@ const ebMeetingCreateFlowPrepare = {
1756
1771
  includeSchedule: true,
1757
1772
  }).catch(noteFailure('参会人**日程空闲**检测'))
1758
1773
  : Promise.resolve(null);
1774
+ const enrichStarted = Date.now();
1759
1775
  const [roomRec, memberConflict, free, roomConflict] = await Promise.all([
1760
1776
  roomTask, conflictTask, availabilityTask, roomConflictTask,
1761
1777
  ]);
1778
+ mark('enrichMs', enrichStarted);
1762
1779
  timings.parallelMs = Date.now() - startedAt;
1763
1780
  // 参会人冲突 / 共同空闲时段**已经并行算完了**。即使接下来要先让用户选会议室,
1764
1781
  // 也必须把这两项结论一起交出去 —— 否则用户选完房才知道时间撞了,等于白选一次
@@ -2048,7 +2065,9 @@ const ebMeetingCreateFlowPrepare = {
2048
2065
  ? '调用方传入'
2049
2066
  : (resolved.source === 'fixed'
2050
2067
  ? `固化配置(${resolved.label ?? '默认'})`
2051
- : '应用设置配置');
2068
+ : (resolved.source === 'memory'
2069
+ ? `沿用上次使用的流程${resolved.label ? `(${resolved.label})` : ''}`
2070
+ : '应用设置配置'));
2052
2071
  let probes = [];
2053
2072
  let loadedForms = new Map();
2054
2073
  // 固化自用场景:多个流程都能发起时自动取优先级最高的,不再打断用户去选(2026-10-30 要求)。
@@ -2056,7 +2075,9 @@ const ebMeetingCreateFlowPrepare = {
2056
2075
  if (!workflowId && candidates.length > 1) {
2057
2076
  // 有多个建会流程候选:**逐个探测当前人员能否发起**(createForm 能载入 = 有发起权限)。
2058
2077
  // 并行探测:每个流程一次 createForm(内含多次 OA 请求),串行会成倍放大等待。
2078
+ const probeStarted = Date.now();
2059
2079
  let probed = await probeWorkflowCandidates(env, candidates);
2080
+ mark('flowProbeMs', probeStarted);
2060
2081
  probes = probed.probes;
2061
2082
  loadedForms = probed.loadedForms;
2062
2083
  let launchable = probes.filter((probe) => probe.launchable);
@@ -2178,7 +2199,9 @@ const ebMeetingCreateFlowPrepare = {
2178
2199
  let form = loadedForms.get(workflowId);
2179
2200
  if (!form) {
2180
2201
  try {
2202
+ const formStarted = Date.now();
2181
2203
  form = await loadCreateForm(env, workflowId);
2204
+ mark('formLoadMs', formStarted);
2182
2205
  }
2183
2206
  catch (error) {
2184
2207
  throw meetingValidationError('flow_not_launchable', `当前账号**没有发起建会流程的权限**(或流程已停用):建会流程 ${workflowId} 的表单载入失败 —— `
@@ -2247,10 +2270,13 @@ const ebMeetingCreateFlowPrepare = {
2247
2270
  const value = main[id];
2248
2271
  if (value === undefined || value === null || value === '')
2249
2272
  continue;
2250
- if (field.isMultiple === true && !Array.isArray(value)) {
2273
+ // Ebuilder 组件(如「参会客户」)的 isMultiple 可能缺省,但服务端只认数组:
2274
+ // 缺省时不要按单选折叠成对象,否则提交报"不是数组"。
2275
+ const keepArray = field.isMultiple === true || String(field.componentKey ?? '') === 'Ebuilder';
2276
+ if (keepArray && !Array.isArray(value)) {
2251
2277
  main[id] = [value];
2252
2278
  }
2253
- else if (field.isMultiple !== true && Array.isArray(value) && value.length === 1) {
2279
+ else if (!keepArray && Array.isArray(value) && value.length === 1) {
2254
2280
  main[id] = value[0];
2255
2281
  }
2256
2282
  }
@@ -51,6 +51,26 @@ function pickFirst(row, keys) {
51
51
  const value = row[key];
52
52
  if (value === undefined || value === null)
53
53
  continue;
54
+ // ESB 常把单值也包成数组(`mc: ["客户名"]`、`sjID: ["5750…"]`):
55
+ // 数组要取首个非空元素,不能当对象跳过(以前这里 continue ⇒ 数据被吞成空行)。
56
+ if (Array.isArray(value)) {
57
+ const first = value.find((item) => item !== undefined && item !== null && String(item).trim() !== '');
58
+ if (first === undefined)
59
+ continue;
60
+ if (typeof first === 'object') {
61
+ const nested = asRecord(first);
62
+ if (nested) {
63
+ const inner = pickFirst(nested, keys) || pickFirst(nested, ['id', 'name']);
64
+ if (inner)
65
+ return inner;
66
+ }
67
+ continue;
68
+ }
69
+ const text = String(first).trim();
70
+ if (text !== '')
71
+ return text;
72
+ continue;
73
+ }
54
74
  if (typeof value === 'object') {
55
75
  const nested = asRecord(value);
56
76
  if (nested) {
@@ -0,0 +1,113 @@
1
+ /**
2
+ * 改派决议任务执行人:update_mt_decision_task 只认 detail1 的完成状态,
3
+ * **改不了执行人**(返回成功但数据不变)。可行路径只有「建新任务 + 删旧任务」。
4
+ */
5
+ import { meetingSuccess } from '../types.js';
6
+ import { meetingValidationError } from '../../errors.js';
7
+ function fieldId(value) {
8
+ if (Array.isArray(value)) {
9
+ const first = value[0];
10
+ return String(first?.id ?? '').trim();
11
+ }
12
+ if (value && typeof value === 'object')
13
+ return String(value.id ?? '').trim();
14
+ return String(value ?? '').trim();
15
+ }
16
+ async function resolveEmployeeId(env, token) {
17
+ const value = String(token ?? '').trim();
18
+ if (/^\d{8,}$/.test(value))
19
+ return { id: value, name: value };
20
+ const { hrmEmployeeOperations } = await import('../../../hrm/operations/employee.js');
21
+ const query = hrmEmployeeOperations.find((operation) => operation.name === 'hrm.employee.query');
22
+ if (!query)
23
+ throw meetingValidationError('employee_query_unavailable', '无法解析姓名:员工查询操作不可用');
24
+ const found = await query.handler({ keyword: value, pageSize: 20 }, env);
25
+ const rows = (found?.data?.rows ?? []);
26
+ const exact = rows.filter((row) => String(row.name ?? '').trim() === value);
27
+ if (exact.length === 1)
28
+ return { id: String(exact[0].id), name: value };
29
+ if (rows.length === 1)
30
+ return { id: String(rows[0].id), name: String(rows[0].name ?? value) };
31
+ throw meetingValidationError(exact.length > 1 ? 'employee_ambiguous' : 'employee_not_found', exact.length > 1 ? `姓名「${value}」命中多人,请改用员工 id` : `未找到员工「${value}」`, { candidates: (exact.length > 1 ? exact : rows).slice(0, 10).map((row) => ({ id: row.id, name: row.name })) });
32
+ }
33
+ const reassign = {
34
+ name: 'meeting.eb.decisionTask.reassign',
35
+ resource: 'eb',
36
+ method: 'meeting.eb.decisionTask.reassign',
37
+ action: 'meeting.eb.decisionTask.reassign',
38
+ summary: '改派决议任务执行人(建新任务+删旧任务;update 接口改不了执行人)',
39
+ capability: 'eb.decisionTask',
40
+ risk: 'high-risk-write',
41
+ requiresConfirmation: true,
42
+ inputSchema: {
43
+ type: 'object',
44
+ additionalProperties: false,
45
+ properties: {
46
+ confirm: { type: 'boolean', description: '可省略(默认执行);传 false 阻止' },
47
+ mt_id: { type: 'string', minLength: 1 },
48
+ to_executor: { type: 'string', minLength: 1, description: '新执行人:姓名或员工 id' },
49
+ from_executor: { type: 'string', description: '只改派原执行人是此人(姓名/id)的任务;省略=全部' },
50
+ ids: { type: 'array', items: { type: 'string' }, description: '只改指定任务 id' },
51
+ },
52
+ required: ['mt_id', 'to_executor'],
53
+ },
54
+ handler: async (args, env) => {
55
+ if (args.confirm === false)
56
+ throw meetingValidationError('confirmation_required', 'confirm=false,未执行');
57
+ const { getMeetingOperation } = await import('../registry.js');
58
+ const mtId = String(args.mt_id ?? '').trim();
59
+ const target = await resolveEmployeeId(env, String(args.to_executor ?? ''));
60
+ const from = String(args.from_executor ?? '').trim();
61
+ const fromId = from === '' ? '' : (await resolveEmployeeId(env, from)).id;
62
+ const onlyIds = new Set((args.ids ?? []).map((id) => String(id).trim()).filter((id) => id !== ''));
63
+ const listOp = getMeetingOperation('meeting.eb.decisionTask.list');
64
+ const listed = await listOp.handler({ mt_id: mtId, all: true }, env);
65
+ const rows = (listed?.data?.rows ?? [])
66
+ .map((row) => row?.mainTable ?? row)
67
+ .filter((row) => onlyIds.size === 0 || onlyIds.has(String(row?.id ?? '')))
68
+ .filter((row) => fromId === '' || fieldId(row?.executors) === fromId);
69
+ const createPrepare = getMeetingOperation('meeting.eb.decisionTask.create.prepare');
70
+ const createApply = getMeetingOperation('meeting.eb.decisionTask.create.apply');
71
+ const deletePrepare = getMeetingOperation('meeting.eb.decisionTask.delete.prepare');
72
+ const deleteApply = getMeetingOperation('meeting.eb.decisionTask.delete.apply');
73
+ const created = [];
74
+ const failed = [];
75
+ for (const row of rows) {
76
+ const oldId = String(row?.id ?? '').trim();
77
+ const title = String(row?.decision_title ?? '').trim();
78
+ try {
79
+ const prepared = await createPrepare.handler({
80
+ mt_id: mtId,
81
+ relate_decision: fieldId(row?.relate_decision),
82
+ decision_title: title,
83
+ executors: target.id,
84
+ rummager: fieldId(row?.rummager) || target.id,
85
+ begin_datetime: String(row?.begin_datetime ?? ''),
86
+ end_datetime: String(row?.end_datetime ?? ''),
87
+ detail1: [{ executor: target.id, finish_status: '0', finish_date: '' }],
88
+ }, env);
89
+ const applied = await createApply.handler({ confirm: true, continuation: prepared?.data?.continuation }, env);
90
+ const newId = String((applied?.data?.dataIds ?? [])[0] ?? '').trim();
91
+ if (!newId)
92
+ throw new Error('创建未返回 id');
93
+ const delPrepared = await deletePrepare.handler({ id: oldId }, env);
94
+ await deleteApply.handler({ confirm: true, continuation: delPrepared?.data?.continuation }, env);
95
+ created.push({ oldId, newId, title });
96
+ }
97
+ catch (error) {
98
+ failed.push({ id: oldId, title, error: String(error?.message ?? error).slice(0, 160) });
99
+ }
100
+ }
101
+ return meetingSuccess('meeting.eb.decisionTask.reassign', {
102
+ status: failed.length === 0 ? 'COMPLETE' : (created.length > 0 ? 'PARTIAL' : 'FAILED'),
103
+ mtId,
104
+ toExecutor: target,
105
+ matched: rows.length,
106
+ reassigned: created.length,
107
+ created,
108
+ failed,
109
+ hint: '回查 decisionTask.list 看 executors 是否为新人;旧任务已删除',
110
+ });
111
+ },
112
+ };
113
+ export const meetingEbDecisionTaskReassignOperations = [reassign];
@@ -169,7 +169,47 @@ function normalizeDecisionRows(input) {
169
169
  throw meetingValidationError('invalid_detail', 'detail1 必须是数组,每个元素为一条决议明细', { node: 'detail1' });
170
170
  }
171
171
  return input.map((row, index) => {
172
- const source = (row && typeof row === 'object' ? row : {});
172
+ const source = (row && typeof row === 'object' ? { ...row } : {});
173
+ // 字段别名容错:模型常写 title/executor/start/end,统一映射成 CLI 字段名,
174
+ // 避免"字段名需要调整"再回一轮。
175
+ const pick = (...names) => names
176
+ .map((name) => source[name])
177
+ .find((value) => value !== undefined && value !== null && String(value).trim() !== '');
178
+ if (source.decision_title === undefined) {
179
+ const title = pick('title', 'task', 'task_title', 'decisionTitle');
180
+ if (title !== undefined)
181
+ source.decision_title = title;
182
+ }
183
+ if (source.executors === undefined) {
184
+ const executors = pick('executor', 'owner', 'assignee');
185
+ if (executors !== undefined)
186
+ source.executors = Array.isArray(executors) ? executors.join(',') : executors;
187
+ }
188
+ if (source.begin_datetime === undefined) {
189
+ const begin = pick('start', 'begin', 'start_time', 'startTime');
190
+ if (begin !== undefined)
191
+ source.begin_datetime = begin;
192
+ }
193
+ if (source.end_datetime === undefined) {
194
+ const end = pick('end', 'due', 'deadline', 'end_time', 'endTime');
195
+ if (end !== undefined)
196
+ source.end_datetime = end;
197
+ }
198
+ if (source.rummager === undefined) {
199
+ const checker = pick('checker', 'reviewer');
200
+ if (checker !== undefined)
201
+ source.rummager = checker;
202
+ }
203
+ // 日期容错:只写 2026-11-18 时补 09:00;带 T 的 ISO 归一成空格
204
+ for (const key of ['begin_datetime', 'end_datetime']) {
205
+ const raw = String(source[key] ?? '').trim();
206
+ if (raw === '')
207
+ continue;
208
+ if (/^\d{4}-\d{2}-\d{2}$/.test(raw))
209
+ source[key] = raw + ' 09:00';
210
+ else
211
+ source[key] = raw.replace('T', ' ').slice(0, 16);
212
+ }
173
213
  return {
174
214
  // 明细序号与两个状态字段给默认值:调用方通常不关心,缺了会让列表顺序不稳/状态为空。
175
215
  sort_number: String(index + 1),
@@ -373,8 +373,8 @@ function buildReadOperation(endpoint) {
373
373
  collected.push(...pageRows);
374
374
  if (totalKnown > 0 && collected.length >= totalKnown)
375
375
  break;
376
- if (pageRows.length < 10)
377
- break; // 服务端单页上限 10
376
+ if (pageRows.length === 0)
377
+ break; // 只认空页/总数,单页条数不固定(有的接口只回 5)
378
378
  }
379
379
  const allRows = Object.keys(mainTableFilters).length === 0
380
380
  ? collected
@@ -778,7 +778,7 @@ function buildWriteInputSchema(endpoint, includeConfirm) {
778
778
  properties[field] = isDate
779
779
  ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$', description: `${field}(yyyy-MM-dd HH:mm,不带秒)` }
780
780
  : isSecondDate
781
- ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', description: `${field}(yyyy-MM-dd HH:mm:ss,带秒)` }
781
+ ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(?::\\d{2})?$', description: `${field}(yyyy-MM-dd HH:mm:ss,带秒)` }
782
782
  : { type: 'string', description: `${field}${required ? '(必填)' : ''}` };
783
783
  }
784
784
  for (const spec of endpoint.details ?? []) {
@@ -796,7 +796,7 @@ function buildWriteInputSchema(endpoint, includeConfirm) {
796
796
  (spec.dateFields ?? []).includes(field)
797
797
  ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$', description: `${field}(yyyy-MM-dd HH:mm)` }
798
798
  : (spec.secondDateFields ?? []).includes(field)
799
- ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', description: `${field}(yyyy-MM-dd HH:mm:ss,带秒)` }
799
+ ? { type: 'string', pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(?::\\d{2})?$', description: `${field}(yyyy-MM-dd HH:mm:ss,带秒)` }
800
800
  : { type: 'string', description: `${field}${requiredFields.includes(field) ? '(必填)' : ''}` },
801
801
  ])),
802
802
  required: requiredFields,
@@ -11,6 +11,7 @@ import { meetingEbCreateFlowOperations } from './create-flow.js';
11
11
  import { meetingEbGroupChatOperations } from './group-chat.js';
12
12
  import { attachMeetingUrls } from './meeting-link.js';
13
13
  import { meetingEbDecisionTaskBatchOperations } from './decision-task-batch.js';
14
+ import { meetingEbDecisionTaskReassignOperations } from './decision-task-reassign.js';
14
15
  /**
15
16
  * 会议 EB 版(eBuilder)operations。
16
17
  *
@@ -297,6 +298,7 @@ export const meetingEbOperations = [
297
298
  ...decisionPublishAliases,
298
299
  ...minuteCreateAliases,
299
300
  ...meetingEbDecisionTaskBatchOperations,
301
+ ...meetingEbDecisionTaskReassignOperations,
300
302
  ...meetingEbScheduleOperations,
301
303
  ...meetingEbCrmOperations,
302
304
  ...meetingEbCreateFlowOperations,
@@ -72,6 +72,9 @@ const NO_FALLBACK_SUBTYPES = new Set([
72
72
  'target_changed',
73
73
  'env_unavailable',
74
74
  'env_fallback',
75
+ // 服务端业务错(如「update_meeting_sign_info接口类型不一致」):参数/配置问题,
76
+ // 换标准版不可能解决,只会让调用方白跑一轮并掩盖真实错误。
77
+ 'business_error',
75
78
  ]);
76
79
  function describe(error) {
77
80
  if (error instanceof MeetingCliError) {