weaver-work-cli 0.1.26 → 0.1.28

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 (137) hide show
  1. package/README.md +7 -2
  2. package/dist/cmd/setup/index.js +1 -1
  3. package/dist/internal/e10/auth/commands.js +1 -6
  4. package/dist/internal/e10/auth/messages.js +3 -0
  5. package/dist/internal/e10/auth/session.js +8 -0
  6. package/dist/internal/e10/auth-recovery.js +148 -0
  7. package/dist/internal/e10/client.js +47 -15
  8. package/dist/internal/e10/context.js +8 -8
  9. package/dist/internal/e10/index.js +1 -0
  10. package/dist/internal/e10/request-runtime.js +51 -9
  11. package/dist/shortcuts/archive/host.js +3 -2
  12. package/dist/shortcuts/archive/manifest.js +1 -1
  13. package/dist/shortcuts/archive-oa/host.js +2 -1
  14. package/dist/shortcuts/archive-oa/manifest.js +1 -1
  15. package/dist/shortcuts/asset/host.js +7 -6
  16. package/dist/shortcuts/blog/host.js +4 -3
  17. package/dist/shortcuts/caizhilian/host.js +3 -2
  18. package/dist/shortcuts/caizhilian/manifest.js +1 -1
  19. package/dist/shortcuts/calendar/host.js +2 -1
  20. package/dist/shortcuts/contract/host.js +34 -59
  21. package/dist/shortcuts/ehr/host.js +2 -1
  22. package/dist/shortcuts/esb/host.js +2 -1
  23. package/dist/shortcuts/fna/host.js +6 -3
  24. package/dist/shortcuts/fna/manifest.js +10 -5
  25. package/dist/shortcuts/fna/operations/expense-chart.js +162 -0
  26. package/dist/shortcuts/fna/operations/registry.js +2 -0
  27. package/dist/shortcuts/hrm/host.js +2 -1
  28. package/dist/shortcuts/im/host.js +3 -2
  29. package/dist/shortcuts/invoice/host.js +7 -6
  30. package/dist/shortcuts/invoice/manifest.js +21 -141
  31. package/dist/shortcuts/invoice/operations/issuing-qys.js +134 -167
  32. package/dist/shortcuts/invoice/operations/registry.js +1 -6
  33. package/dist/shortcuts/jiuchuanhui/host.js +2 -1
  34. package/dist/shortcuts/mail/host.js +2 -1
  35. package/dist/shortcuts/meeting/host.js +2 -1
  36. package/dist/shortcuts/meeting/operations/eb/conflict.js +78 -12
  37. package/dist/shortcuts/okr/host.js +2 -1
  38. package/dist/shortcuts/plan/host.js +2 -1
  39. package/dist/shortcuts/project/host.js +2 -1
  40. package/dist/shortcuts/workflow/host.js +3 -5
  41. package/dist/shortcuts/workflow/index.js +1 -1
  42. package/dist/shortcuts/workflow/operations/chatscene.js +4 -22
  43. package/dist/shortcuts/workflow/operations/form.js +281 -166
  44. package/dist/shortcuts/workflow/operations/read.js +26 -2
  45. package/dist/shortcuts/workflow/stdout-compact.js +7 -0
  46. package/docs/SKILL.md +1 -1
  47. package/docs/_catalog.md +1 -1
  48. package/docs/agent-invoice.md +1 -1
  49. package/docs/caizhilian.md +1 -1
  50. package/docs/e10-auth.md +1 -1
  51. package/docs/fna.md +7 -3
  52. package/docs/invoice.md +4 -6
  53. package/package.json +1 -1
  54. package/skill-template/business-info.json +4 -1
  55. package/skill-template/domains/caizhilian.md +2 -1
  56. package/skill-template/domains/qiyecheng.md +1 -0
  57. package/skill-template/domains/yepiaotong.md +6 -2
  58. package/skill-template/skill-template.md +1 -0
  59. package/skills/weaver-e10-blog/SKILL.md +6 -1
  60. package/skills/weaver-e10-blog/references/blog-query.md +3 -1
  61. package/skills/weaver-e10-caizhilian/SKILL.md +18 -9
  62. package/skills/weaver-e10-caizhilian/references/action-flow.md +70 -0
  63. package/skills/weaver-e10-caizhilian/references/agent-entry.md +6 -2
  64. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +207 -0
  65. package/skills/weaver-e10-caizhilian/references/file-collection.md +56 -54
  66. package/skills/weaver-e10-caizhilian/references/file-upload.md +4 -4
  67. package/skills/weaver-e10-caizhilian/references/host-executor-prompt.md +32 -0
  68. package/skills/weaver-e10-caizhilian/references/host-platform-integration.md +46 -0
  69. package/skills/weaver-e10-caizhilian/references/rule-index.md +56 -0
  70. package/skills/weaver-e10-caizhilian/references/setting-attach.md +5 -16
  71. package/skills/weaver-e10-caizhilian/references/setting-backup.md +4 -13
  72. package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +6 -15
  73. package/skills/weaver-e10-caizhilian/references/setting-storage-docs-summary.md +126 -0
  74. package/skills/weaver-e10-caizhilian/references/setting-storage-field-map.md +57 -0
  75. package/skills/weaver-e10-caizhilian/references/setting-storage.md +142 -482
  76. package/skills/weaver-e10-caizhilian/references/source-manifest.json +7 -7
  77. package/skills/weaver-e10-caizhilian/references/task-workflow.md +87 -0
  78. package/skills/weaver-e10-caizhilian/references/withheld.md +2 -2
  79. package/skills/weaver-e10-caizhilian/references/write-protocol.md +7 -0
  80. package/skills/weaver-e10-calendar/SKILL.md +6 -1
  81. package/skills/weaver-e10-esb/SKILL.md +8 -0
  82. package/skills/weaver-e10-esb/references/input-format.md +3 -1
  83. package/skills/weaver-e10-esb/references/source-manifest.json +5 -5
  84. package/skills/weaver-e10-hrm/SKILL.md +6 -1
  85. package/skills/weaver-e10-hrm/references/employee.md +1 -1
  86. package/skills/weaver-e10-hrm/references/org.md +1 -1
  87. package/skills/weaver-e10-hrm/references/position.md +1 -1
  88. package/skills/weaver-e10-jinchengda/SKILL.md +2 -1
  89. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +1 -1
  90. package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -1
  91. package/skills/weaver-e10-jucailin/SKILL.md +6 -1
  92. package/skills/weaver-e10-jucailin/references/hr-contact.md +1 -1
  93. package/skills/weaver-e10-jucailin/references/salary.md +1 -1
  94. package/skills/weaver-e10-mail/SKILL.md +6 -1
  95. package/skills/weaver-e10-meeting/SKILL.md +11 -6
  96. package/skills/weaver-e10-meeting/references/meeting-eb.md +7 -3
  97. package/skills/weaver-e10-meeting/references/meeting-queries.md +3 -1
  98. package/skills/weaver-e10-meeting/references/meeting-verification.md +4 -2
  99. package/skills/weaver-e10-okr/SKILL.md +6 -1
  100. package/skills/weaver-e10-okr/references/source-manifest.json +5 -5
  101. package/skills/weaver-e10-plan/SKILL.md +6 -1
  102. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +3 -1
  103. package/skills/weaver-e10-plan/references/plan-report-query.md +3 -1
  104. package/skills/weaver-e10-plan/references/source-manifest.json +7 -7
  105. package/skills/weaver-e10-qiyecheng/SKILL.md +16 -6
  106. package/skills/weaver-e10-qiyecheng/references/catalog.md +6 -3
  107. package/skills/weaver-e10-qiyecheng/references/expense-center.md +2 -0
  108. package/skills/weaver-e10-qiyecheng/references/expense-chart.md +78 -0
  109. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +87 -33
  110. package/skills/weaver-e10-shared/SKILL.md +37 -14
  111. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -8
  112. package/skills/weaver-e10-shared/references/non-interactive-environment.md +4 -4
  113. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +3 -1
  114. package/skills/weaver-e10-wenshuding/SKILL.md +6 -1
  115. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  116. package/skills/weaver-e10-workflow/references/source-manifest.json +1 -2
  117. package/skills/weaver-e10-workflow/references/workflow-create.md +30 -55
  118. package/skills/weaver-e10-yepiaotong/SKILL.md +19 -17
  119. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +72 -78
  120. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-form-fill-rules.md +152 -0
  121. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +210 -0
  122. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +7 -7
  123. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +11 -5
  124. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +55 -33
  125. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +102 -23
  126. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
  127. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +53 -42
  128. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +93 -213
  129. package/skills/weaver-e10-yimiaoban/SKILL.md +9 -2
  130. package/skills/weaver-e10-yimiaoban/references/file-user-i18n.md +1 -1
  131. package/skills/weaver-e10-yimiaoban/references/msg-read.md +1 -1
  132. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
  133. package/skills/weaver-e10-ziguanjia/SKILL.md +6 -1
  134. package/dist/shortcuts/invoice/operations/issuing.js +0 -198
  135. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +0 -161
  136. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-qys-ledger.md +0 -66
  137. package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +0 -107
@@ -26,6 +26,13 @@ import { EB_BASE, ebBusinessSuccess, extractEbRows, queryBody } from './factory.
26
26
  * 失败语义与标准版(create.ts 的 runMandatoryConflictChecks)对齐:
27
27
  * - 应用设置读取失败:非致命,按「开启检测 + 仅提醒」继续,并在 warnings 中如实说明;
28
28
  * - 检测请求本身失败:视为冲突 → 拒绝建会(`conflict_check_failed`),宁可拦住不可漏检。
29
+ *
30
+ * 建会路径闸门(2026-10-15 补齐)—— 与冲突检测共用同一次 baseSet 读取:
31
+ * 文档一直要求「`only_flow_create=1` 或审批开启 → CLI 不直接建会」,但 EB 版 prepare
32
+ * 只在**文档层**要求、**代码层没有拦**,于是应用设置 `only_flow_create=1` 时
33
+ * `meeting.eb.meeting.create.prepare` 仍放行、`apply` 照样落库(真机复现:产生
34
+ * `request_id` 为空、绕过流程的会议)。现由 `assertEbCreatePathAllowed` 在 prepare 阶段
35
+ * 直接拒绝(`conflict_rejected`),读不到应用设置则保守拒绝(`conflict_check_failed`)。
29
36
  */
30
37
  /** 候选会议的有效状态:1审批中 / 2未开始 / 8已结束 / 9进行中。 */
31
38
  const ACTIVE_MT_STATUS = '1,2,8,9';
@@ -69,8 +76,11 @@ async function listAllEbRows(env, interfacePk, baseQuery, operation) {
69
76
  }
70
77
  return { rows, requests };
71
78
  }
72
- /** 读取应用设置(query_meeting_baseset,返回 1 条,多条取第一条)中的冲突策略。 */
73
- export async function fetchEbConflictPolicy(env, operation) {
79
+ /**
80
+ * 读取应用设置(query_meeting_baseset,返回 1 条,多条取第一条):
81
+ * 同时取「冲突策略」与「建会路径开关」,一次请求供两处使用。
82
+ */
83
+ export async function fetchEbAppSettings(env, operation) {
74
84
  try {
75
85
  const rows = await requestEbList(env, 'query_meeting_baseset', { pageNo: 1, pageSize: 5 }, operation);
76
86
  const base = rows[0] ?? {};
@@ -79,6 +89,10 @@ export async function fetchEbConflictPolicy(env, operation) {
79
89
  roomAction: String(base.room_conflict ?? ''),
80
90
  memberChk: String(base.member_conflict_chk ?? ''),
81
91
  memberAction: String(base.member_conflict ?? ''),
92
+ onlyFlowCreate: String(base.only_flow_create ?? ''),
93
+ openMtApprove: String(base.open_mt_approve ?? ''),
94
+ mtNewWf: String(base.mt_new_wf ?? ''),
95
+ mtRepeatNewWf: String(base.mt_repeat_new_wf ?? ''),
82
96
  };
83
97
  }
84
98
  catch (error) {
@@ -87,10 +101,50 @@ export async function fetchEbConflictPolicy(env, operation) {
87
101
  roomAction: '',
88
102
  memberChk: '',
89
103
  memberAction: '',
104
+ onlyFlowCreate: '',
105
+ openMtApprove: '',
106
+ mtNewWf: '',
107
+ mtRepeatNewWf: '',
90
108
  error: errorText(error),
91
109
  };
92
110
  }
93
111
  }
112
+ /**
113
+ * 建会路径闸门(2026-10-15 补齐,口径与标准版 `create.ts` 的 `assertCreatePathAllowed` 对齐)。
114
+ *
115
+ * 规则:
116
+ * - `only_flow_create=1`(只允许通过流程新建会议)→ 拒绝:应用明确不允许流程之外建会;
117
+ * - `open_mt_approve=1`(会议提交需审批)→ 同样拒绝:会议须由 `mt_new_wf` 流程/ESB 创建,
118
+ * 手动 `create_meeting` 会绕开审批并产生重复记录(references 实测曾出现 4 条同名会议);
119
+ * - 应用设置**读不到** → 无法判定是否允许直接建会 ⇒ 保守拒绝(宁可拦住,不可绕过管控);
120
+ * - 开关为空 / 非 `1` → 放行(交由后续冲突检测与用户确认)。
121
+ *
122
+ * 拒绝后 CLI 不代为发起流程(流程集成不在本模块范围),只把已确认的信息交回调用方,
123
+ * 由调用方转 `weaver-e10-workflow`。
124
+ */
125
+ export function assertEbCreatePathAllowed(settings) {
126
+ if (settings.error) {
127
+ throw meetingConflictError('conflict_check_failed', `无法读取会议应用设置(query_meeting_baseset),无法判定是否允许直接建会(only_flow_create / open_mt_approve),已按保守策略拒绝:${settings.error}`);
128
+ }
129
+ const blocked = [];
130
+ if (settings.onlyFlowCreate === '1') {
131
+ blocked.push('only_flow_create=1(只允许通过流程新建会议)');
132
+ }
133
+ if (settings.openMtApprove === '1') {
134
+ blocked.push('open_mt_approve=1(会议提交需审批)');
135
+ }
136
+ if (blocked.length === 0)
137
+ return;
138
+ throw meetingConflictError('conflict_rejected', `应用设置不允许直接建会:${blocked.join(';')}。该应用的会议必须经流程创建`
139
+ + `(新建会议工作流 mt_new_wf=${settings.mtNewWf || '未配置'},周期会议工作流 mt_repeat_new_wf=${settings.mtRepeatNewWf || '未配置'})——`
140
+ + 'CLI 不直接建会、也不代替流程建会(否则会产生流程之外、request_id 为空的会议,且与流程/ESB 自动建会重复)。'
141
+ + '请改用 weaver-e10-workflow 发起流程建会;如需 CLI 直接建会,请管理员先在会议应用设置中关闭该开关。', {
142
+ onlyFlowCreate: settings.onlyFlowCreate,
143
+ openMtApprove: settings.openMtApprove,
144
+ mtNewWf: settings.mtNewWf,
145
+ mtRepeatNewWf: settings.mtRepeatNewWf,
146
+ });
147
+ }
94
148
  /** 会议室冲突:查占用视图(query_roomusage_list),时间重叠即冲突。 */
95
149
  async function checkRoomConflict(roomId, begin, end, excludeMtId, env, operation) {
96
150
  const { rows, requests } = await listAllEbRows(env, 'query_roomusage_list',
@@ -179,7 +233,8 @@ export async function runEbConflictCheck(input, env, operation, options = {}) {
179
233
  const begin = assertDateTimeMinute(input.beginDatetime, 'begin_datetime');
180
234
  const end = assertDateTimeMinute(input.endDatetime, 'end_datetime');
181
235
  const warnings = [];
182
- const policy = await fetchEbConflictPolicy(env, operation);
236
+ // 调用方(建会/变更 preflight)已读过应用设置时直接复用,避免为闸门与冲突各发一次请求。
237
+ const policy = options.settings ?? await fetchEbAppSettings(env, operation);
183
238
  const outcome = { warnings, policy };
184
239
  if (policy.error) {
185
240
  warnings.push(`应用设置(query_meeting_baseset)读取失败,冲突策略按「开启检测 + 仅提醒」处理:${policy.error}`);
@@ -268,20 +323,31 @@ export async function runEbConflictCheck(input, env, operation, options = {}) {
268
323
  return outcome;
269
324
  }
270
325
  /**
271
- * 建会/变更 prepare 的前置钩子:EB 版补上强制冲突检测。
272
- * 仅在拿到起止时间、且传了 address / hrm_members 时才发请求(无目标即无冲突可言)。
326
+ * 建会/变更 prepare 的前置钩子:EB 版补上**建会路径闸门**与强制冲突检测。
327
+ *
328
+ * 顺序(重要):
329
+ * 1. 建会(`create_meeting`)**先过路径闸门** —— 应用设置不允许直接建会时直接拒绝,
330
+ * 连冲突检测都不必做(结论已定局);读应用设置失败同样拒绝。
331
+ * 2. 冲突检测仅在拿到起止时间、且传了 address / hrm_members 时才发请求(无目标即无冲突)。
273
332
  */
274
333
  export const ebMeetingWritePreflight = async ({ endpoint, payload, args, env }) => {
275
- if (endpoint.interfacePk !== 'create_meeting' && endpoint.interfacePk !== 'change_meeting')
334
+ const isCreate = endpoint.interfacePk === 'create_meeting';
335
+ const isChange = endpoint.interfacePk === 'change_meeting';
336
+ if (!isCreate && !isChange)
276
337
  return [];
277
- // 载荷自 2026-09-21 起为结构化(mainTable + details),冲突检测只关心主表字段。
338
+ const operation = isChange ? 'meeting.eb.meeting.change.prepare' : 'meeting.eb.meeting.create.prepare';
339
+ // 载荷自 2026-09-21 起为结构化(mainTable + details),闸门与冲突检测都只关心主表字段。
278
340
  const main = payload.mainTable;
279
- const begin = main.begin_datetime;
280
- const end = main.end_datetime;
281
- if (typeof begin !== 'string' || typeof end !== 'string' || !begin || !end)
282
- return [];
341
+ const begin = typeof main.begin_datetime === 'string' ? main.begin_datetime : '';
342
+ const end = typeof main.end_datetime === 'string' ? main.end_datetime : '';
283
343
  const address = typeof main.address === 'string' && main.address ? main.address : undefined;
284
344
  const hrmMembers = typeof main.hrm_members === 'string' && main.hrm_members ? main.hrm_members : undefined;
345
+ // 建会必读应用设置(闸门);变更只在确有冲突检测目标时才读(避免多一次请求)。
346
+ const settings = isCreate || address || hrmMembers ? await fetchEbAppSettings(env, operation) : undefined;
347
+ if (settings && isCreate)
348
+ assertEbCreatePathAllowed(settings);
349
+ if (!begin || !end)
350
+ return [];
285
351
  if (!address && !hrmMembers)
286
352
  return [];
287
353
  const outcome = await runEbConflictCheck({
@@ -291,7 +357,7 @@ export const ebMeetingWritePreflight = async ({ endpoint, payload, args, env })
291
357
  ...(hrmMembers ? { hrmMembers } : {}),
292
358
  ...(typeof main.org_members === 'string' && main.org_members ? { orgMembers: main.org_members } : {}),
293
359
  ...(typeof args.id === 'string' || typeof args.id === 'number' ? { excludeMtId: String(args.id) } : {}),
294
- }, env, endpoint.operation === 'meeting.eb.meeting.change' ? 'meeting.eb.meeting.change.prepare' : 'meeting.eb.meeting.create.prepare');
360
+ }, env, operation, settings ? { settings } : {});
295
361
  return outcome.warnings;
296
362
  };
297
363
  /** 只查不建:会议室冲突检测 operation。 */
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
4
4
  import { resolve } from 'node:path';
5
+ import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
5
6
  import { getActiveProfile } from '../../internal/e10/auth/session.js';
6
7
  import { requireE10Session } from '../../internal/e10/context.js';
7
8
  import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
@@ -143,7 +144,7 @@ export function createOkrHost(ctx, dependencies = {}) {
143
144
  mapRuntimeNetworkError(error);
144
145
  }
145
146
  if (response.status === 401 || response.status === 302) {
146
- throw okrAuthError('session_expired', 'E10 登录态已失效,请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url E10_DOMAIN --agent_type AGENT_NAME 完成登录', { httpStatus: response.status });
147
+ throw okrAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
147
148
  }
148
149
  if (response.parseError) {
149
150
  throw okrNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
4
4
  import { resolve } from 'node:path';
5
+ import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
5
6
  import { getActiveProfile } from '../../internal/e10/auth/session.js';
6
7
  import { requireE10Session } from '../../internal/e10/context.js';
7
8
  import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
@@ -150,7 +151,7 @@ export function createPlanHost(ctx, dependencies = {}) {
150
151
  mapRuntimeNetworkError(error);
151
152
  }
152
153
  if (response.status === 401 || response.status === 302) {
153
- throw planAuthError('session_expired', 'E10 登录态已失效,请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url <域名> 完成登录', { httpStatus: response.status });
154
+ throw planAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
154
155
  }
155
156
  if (response.parseError) {
156
157
  throw planNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
@@ -1,3 +1,4 @@
1
+ import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
1
2
  import { getActiveProfile } from '../../internal/e10/auth/session.js';
2
3
  import { requireE10Session } from '../../internal/e10/context.js';
3
4
  import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
@@ -133,7 +134,7 @@ export function createProjectHost(ctx, dependencies = {}) {
133
134
  mapRuntimeNetworkError(error);
134
135
  }
135
136
  if (response.status === 401 || response.status === 302) {
136
- throw projectAuthError('session_expired', 'E10 登录态已失效,请先完成登录或重新登录', {
137
+ throw projectAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, {
137
138
  httpStatus: response.status,
138
139
  });
139
140
  }
@@ -1,3 +1,4 @@
1
+ import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
1
2
  import { requireE10Session } from '../../internal/e10/context.js';
2
3
  import { getActiveProfile } from '../../internal/e10/auth/session.js';
3
4
  import { createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
@@ -118,9 +119,6 @@ export function extractApiBusinessError(payload) {
118
119
  }
119
120
  return '';
120
121
  }
121
- function loginExpiredMessage() {
122
- return 'OA 登录状态或系统认证信息无效,本次任务已停止。请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url <域名> --agent_type <当前智能体名称> 完成登录,随后重放原请求。';
123
- }
124
122
  export function createWorkflowHost(ctx, dependencies = {}) {
125
123
  let session = null;
126
124
  let sessionContext = null;
@@ -174,7 +172,7 @@ export function createWorkflowHost(ctx, dependencies = {}) {
174
172
  }
175
173
  if ('content' in response) {
176
174
  if (isLoginExpired({}, response.status)) {
177
- throw workflowAuthError('session_expired', loginExpiredMessage(), { httpStatus: response.status });
175
+ throw workflowAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
178
176
  }
179
177
  return {
180
178
  status: response.status,
@@ -184,7 +182,7 @@ export function createWorkflowHost(ctx, dependencies = {}) {
184
182
  };
185
183
  }
186
184
  if (isLoginExpired(response.value, response.status)) {
187
- throw workflowAuthError('session_expired', loginExpiredMessage(), {
185
+ throw workflowAuthError('session_expired', E10_SESSION_EXPIRED_MESSAGE, {
188
186
  httpStatus: response.status,
189
187
  details: { endpointKey: operation, response: response.value },
190
188
  });
@@ -88,7 +88,7 @@ export { compactStdoutPaths };
88
88
  *
89
89
  * ★ 2026-10-21 用户裁定(**改口径**):小e 的 `BROWSER_FILL` 档**不再直出** `<browsertool>` 标签块,
90
90
  * 一律走 JSON 信封 —— 标签块放在 `data.finalMarkdown` 里,与 `createRequestDirect` 统一成一种结构,
91
- * 于是 `durationMs` / `apiDurations` / `authMs` 三个耗时键在这一档也可见。
91
+ * 于是 `durationMs` / `apiDurations` / `apiSlowest` / `authMs` 四个耗时键在这一档也可见。
92
92
  * 原来的 `rawStdoutOf()` 直出通道随之删除(它当时只为"stdout 就是标签块"服务)。
93
93
  */
94
94
  export function printWorkflowResult(ctx, operation, result) {
@@ -69,21 +69,22 @@ export function formatLocalNow(date = new Date()) {
69
69
  + ` ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
70
70
  }
71
71
  /**
72
- * 交给智能体的字段属性**白名单** —— 就是智能体入参契约里的那 12 个键,一个不多一个不少
72
+ * 交给智能体的字段属性**白名单** —— 就是智能体入参契约里的那 11 个键,一个不多一个不少
73
73
  * (2026-10-20 用户对齐真机入参)。为此要挡掉 `createForm` 侧那些**只给 CLI 自己用**的属性:
74
74
  *
75
75
  * | 属性 | 为什么不给智能体 |
76
76
  * | --- | --- |
77
+ * | `initialValue` | 字段默认值:智能体只负责按用户意图产值,不需要(也不该被)默认值影响(2026-10-22 用户裁定去掉) |
77
78
  * | `fileUploadParams` | 文件夹 / 大小格式限制 / 一次性签名,是给调 caizhilian 上传的模型用的;带上它会让智能体误以为要自己判上传限制 |
78
79
  * | `browserType` / `browserModule` | 浏览通道标识,由 CLI 在 `createRequest` 解析值时用,与「意图 → 值」无关 |
79
80
  * | `readOnly` / `disableEdit` / `folderDependsOnOption` | 是否可写、附件文件夹是否随选项变,都是 CLI 侧的门禁/联动细节 |
80
81
  *
81
- * 键序与契约一致(`componentKey` → 布尔标记 → `format` → `initialValue` → `options`)。
82
+ * 键序与契约一致(`componentKey` → 布尔标记 → `format` → `options`)。
82
83
  */
83
84
  const AGENT_FIELD_KEYS = [
84
85
  'id', 'name', 'subFormId', 'componentKey',
85
86
  'isBrowser', 'isSelect', 'isMultiple', 'isEmployeeScope', 'isEinvoice',
86
- 'format', 'initialValue', 'options',
87
+ 'format', 'options',
87
88
  ];
88
89
  function pickAgentFields(fields) {
89
90
  const picked = [];
@@ -101,31 +102,12 @@ function pickAgentFields(fields) {
101
102
  }
102
103
  return picked;
103
104
  }
104
- /**
105
- * 交给智能体的 `systemFields` **只留三项**:`defaults` / `levelOptions` / `secLevelOptions`。
106
- *
107
- * `createForm` 内部那份 `systemFields` 还带 `permissions`(逐字段的 view/edit/mandatory 位图,
108
- * 真机 278 字段的表单就是 278 条)—— 那是 CLI 自己判"字段看不看得见、能不能填"用的,
109
- * 与「意图 → 字段值」这个映射无关,发给智能体纯属噪声(2026-10-20 用户对齐真机入参)。
110
- */
111
- function pickAgentSystemFields(raw) {
112
- const source = (raw && typeof raw === 'object' && !Array.isArray(raw))
113
- ? raw
114
- : {};
115
- const isPlainObject = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
116
- return {
117
- defaults: isPlainObject(source.defaults) ? source.defaults : {},
118
- levelOptions: Array.isArray(source.levelOptions) ? source.levelOptions : [],
119
- secLevelOptions: Array.isArray(source.secLevelOptions) ? source.secLevelOptions : [],
120
- };
121
- }
122
105
  export function buildChatSceneInput(params) {
123
106
  return {
124
107
  userQuestion: params.userQuestion,
125
108
  workflow: { id: String(params.workflow.id ?? ''), name: String(params.workflow.name ?? '') },
126
109
  fields: pickAgentFields(params.fields || []),
127
110
  historyRequestData: params.historyRequestData ?? null,
128
- systemFields: pickAgentSystemFields(params.systemFields),
129
111
  userMemory: String(params.userMemory ?? ''),
130
112
  now: params.now || formatLocalNow(),
131
113
  };