weaver-work-cli 0.1.68 → 0.1.69
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/dist/chunks/{archive-SJTC5265.js → archive-VUTREF3P.js} +4 -4
- package/dist/chunks/{archive-oa-PN46RTI2.js → archive-oa-VXXO4RTB.js} +4 -4
- package/dist/chunks/{asset-XM3Y4FVU.js → asset-45U6TY7I.js} +32 -5
- package/dist/chunks/{asset-idle-DHGP3NYY.js → asset-idle-YCRBMTIT.js} +4 -4
- package/dist/chunks/{attachment-content-IXIBOET6.js → attachment-content-7BEDNQ3O.js} +3 -3
- package/dist/chunks/{blog-JC47AIXK.js → blog-5AML4WMG.js} +4 -4
- package/dist/chunks/{caizhilian-IKIHM77A.js → caizhilian-3P7BUNHT.js} +6 -6
- package/dist/chunks/{calendar-GZTSJ57Y.js → calendar-2HUXM3CZ.js} +4 -4
- package/dist/chunks/{chunk-QO6JYDIW.js → chunk-3CBURKSY.js} +4 -4
- package/dist/chunks/{chunk-Y7RGBRLG.js → chunk-3TZURS7M.js} +1 -1
- package/dist/chunks/{chunk-X7ZTM4XG.js → chunk-4XYRTXRR.js} +1 -1
- package/dist/chunks/{chunk-OKUJY5YB.js → chunk-67AN5YJT.js} +61 -18
- package/dist/chunks/{chunk-LXXR2RRE.js → chunk-6DH73Q5H.js} +50 -50
- package/dist/chunks/{chunk-3W5NMGDS.js → chunk-727VKJQK.js} +2 -2
- package/dist/chunks/{chunk-QHKY4WZA.js → chunk-BEYEXCWU.js} +2 -2
- package/dist/chunks/{chunk-26FCCU5O.js → chunk-DSBV4GRK.js} +3 -3
- package/dist/chunks/{chunk-HWA2A25Y.js → chunk-E7VWE2XI.js} +3 -3
- package/dist/chunks/{chunk-6OK4LW76.js → chunk-ELF5TPSG.js} +6 -6
- package/dist/chunks/{chunk-BJNSTCJK.js → chunk-ERAE4GHX.js} +1 -1
- package/dist/chunks/{chunk-YSEHTSHS.js → chunk-FMAZ42HS.js} +11 -11
- package/dist/chunks/{chunk-TJN4PIYO.js → chunk-GTAFCAVP.js} +2 -0
- package/dist/chunks/{chunk-WSHIOSGM.js → chunk-H2NRTGZR.js} +3 -3
- package/dist/chunks/{chunk-4WCVRDC5.js → chunk-HG6INLH6.js} +13 -0
- package/dist/chunks/{chunk-FDBAFANU.js → chunk-I5XB4MZT.js} +227 -23
- package/dist/chunks/{chunk-C5IIIT4D.js → chunk-JAIZY37Z.js} +4 -4
- package/dist/chunks/{chunk-FJUOUSV3.js → chunk-LRKKKO5A.js} +36 -9
- package/dist/chunks/{chunk-HLT6B26P.js → chunk-LSVA7QA6.js} +1 -1
- package/dist/chunks/{chunk-6N4JPNFL.js → chunk-MD5CW4B6.js} +1 -1
- package/dist/chunks/{chunk-O7KPHPXQ.js → chunk-MLJK4KLE.js} +34 -34
- package/dist/chunks/{chunk-Q6D6PSMH.js → chunk-QYDSTYGG.js} +3 -3
- package/dist/chunks/{chunk-AFZTMYGC.js → chunk-T24EBWAZ.js} +1 -1
- package/dist/chunks/{chunk-6T5X6YWX.js → chunk-U3OO3IZF.js} +3 -3
- package/dist/chunks/{chunk-VLY5RTVO.js → chunk-UVWW5ABZ.js} +3 -3
- package/dist/chunks/{chunk-NP3ZZFGI.js → chunk-VZUH3LKI.js} +16 -5
- package/dist/chunks/{chunk-3NJQTG6X.js → chunk-YR3K53BU.js} +2 -2
- package/dist/chunks/{conflict-CEXRX2KP.js → conflict-VKCRXHUV.js} +2 -2
- package/dist/chunks/{contract-PM3EUPZC.js → contract-3PMHUASH.js} +164 -5
- package/dist/chunks/{cowork-34CBYVQP.js → cowork-FZBTTBYX.js} +4 -4
- package/dist/chunks/{create-flow-DG6D7U2L.js → create-flow-WYPLBLRK.js} +6 -6
- package/dist/chunks/{data-3G4GQS5P.js → data-2YZ6A6TL.js} +19 -4
- package/dist/chunks/{ebuilder-form-5ENYH7IF.js → ebuilder-form-AWPTMZBZ.js} +5 -5
- package/dist/chunks/{ehr-2CONM7R6.js → ehr-MNPR4TE5.js} +4 -4
- package/dist/chunks/{entry-mode-KMP66KHE.js → entry-mode-BCJ7RPFC.js} +3 -3
- package/dist/chunks/{env-SW6CTETI.js → env-SCVCHBN2.js} +2 -2
- package/dist/chunks/{esb-FQASCY2H.js → esb-GSB5QCEX.js} +6 -6
- package/dist/chunks/{factory-ETQAICPA.js → factory-CBXYOEBF.js} +1 -1
- package/dist/chunks/{fna-FCLVIWAS.js → fna-XBSNUS2V.js} +4 -4
- package/dist/chunks/{group-chat-GTYMCBYS.js → group-chat-RFL4U7RF.js} +3 -3
- package/dist/chunks/{host-P7G22WNM.js → host-2UMNXX5H.js} +4 -4
- package/dist/chunks/{host-XLCBLNJD.js → host-BD44ASOD.js} +4 -4
- package/dist/chunks/{host-2ED2KC4X.js → host-NVDG3NC6.js} +4 -4
- package/dist/chunks/{host-46NYKDQP.js → host-R7BP3CTI.js} +4 -4
- package/dist/chunks/{host-7IPZKIM4.js → host-SYPCA63D.js} +4 -4
- package/dist/chunks/{host-2UYZEY2V.js → host-XVWBOSEN.js} +4 -4
- package/dist/chunks/{hrm-5WSMSKPX.js → hrm-FZUDJAND.js} +17 -11
- package/dist/chunks/{im-P7GNBRG6.js → im-F5NENPD7.js} +4 -4
- package/dist/chunks/{invoice-2QCVNXBG.js → invoice-DS6FLU55.js} +42 -6
- package/dist/chunks/{jiuchuanhui-FHGFYAHU.js → jiuchuanhui-PY2WEBUH.js} +157 -9
- package/dist/chunks/{lazy-dispatch-K25LTKQY.js → lazy-dispatch-F6O2EPGR.js} +7 -7
- package/dist/chunks/{mail-P7VMUKQW.js → mail-ZEOSANEJ.js} +4 -4
- package/dist/chunks/{meeting-3PTTPUSG.js → meeting-N2AGGLVI.js} +15 -15
- package/dist/chunks/{minute-doc-3IMRJDJV.js → minute-doc-C62EZOJH.js} +4 -4
- package/dist/chunks/{okr-OIWJRYWY.js → okr-OZUMTMCL.js} +4 -4
- package/dist/chunks/{operations-MI2BSKZX.js → operations-UTUWFJTX.js} +5 -5
- package/dist/chunks/{performance-OPEQNW7Y.js → performance-GBKM5G2Y.js} +3 -3
- package/dist/chunks/{plan-TJAS4N5X.js → plan-C2NENH42.js} +4 -4
- package/dist/chunks/{project-CYBGU6K6.js → project-FAJ2P3UR.js} +4 -4
- package/dist/chunks/{reception-2VSWJQ5N.js → reception-NH6MJFPR.js} +16 -8
- package/dist/chunks/{recruit-stage-KHJYQE3I.js → recruit-stage-DPEFHLSE.js} +3 -3
- package/dist/chunks/{registry-PHPYTXS4.js → registry-7US3QQXV.js} +12 -12
- package/dist/chunks/{registry-QRMXRSCT.js → registry-FTPUUHWC.js} +5 -5
- package/dist/chunks/{registry-FXBOGH2X.js → registry-Y2HWS6JS.js} +4 -4
- package/dist/chunks/{room-recommend-BKCPAXQG.js → room-recommend-LMNF76YS.js} +4 -4
- package/dist/chunks/{schedule-Q3MPSZV6.js → schedule-4QE2THAP.js} +4 -4
- package/dist/chunks/{smart-extract-TYYKC244.js → smart-extract-GTYKF5TJ.js} +4 -4
- package/dist/chunks/{workflow-GEDHALMY.js → workflow-KXYTQZ2H.js} +81 -12
- package/dist/core/error-codes.js +1 -1
- package/dist/core/host-policy.js +56 -0
- package/dist/core/timing.js +227 -0
- package/dist/index.js +39 -36
- package/dist/internal/e10/auth/commands.js +11 -0
- package/dist/internal/e10/auth/error-log.js +13 -0
- package/dist/internal/e10/auth/messages.js +10 -0
- package/dist/internal/e10/auth/xiaoe.js +12 -2
- package/dist/internal/e10/context.js +39 -12
- package/dist/internal/e10/network-error.js +28 -0
- package/dist/internal/e10/tls-policy.js +260 -0
- package/dist/shortcuts/asset/manifest.js +34 -1
- package/dist/shortcuts/contract/manifest.js +166 -1
- package/dist/shortcuts/data/manifest.js +32 -1
- package/dist/shortcuts/hrm/index.js +20 -7
- package/dist/shortcuts/invoice/manifest.js +43 -1
- package/dist/shortcuts/jiuchuanhui/host.js +76 -4
- package/dist/shortcuts/jiuchuanhui/manifest.js +102 -1
- package/dist/shortcuts/reception/host.js +19 -5
- package/dist/shortcuts/workflow/index.js +55 -5
- package/dist/shortcuts/workflow/operations/read.js +12 -2
- package/dist/shortcuts/workflow/operations/types.js +7 -1
- package/dist/shortcuts/workflow/operations/write.js +20 -2
- package/dist/shortcuts/workflow/operations.js +19 -1
- package/docs/e10-auth.md +48 -1
- package/package.json +1 -1
- package/scripts/xiaoe_env.py +18 -3
- package/skills/weaver-e10-asset-idle/SKILL.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +2 -2
- package/skills/weaver-e10-calendar/SKILL.md +1 -1
- package/skills/weaver-e10-data/SKILL.md +1 -1
- package/skills/weaver-e10-esb/SKILL.md +1 -1
- package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
- package/skills/weaver-e10-hrm/SKILL.md +1 -1
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +1 -0
- package/skills/weaver-e10-jucailin/SKILL.md +84 -17
- package/skills/weaver-e10-jucailin/agents/openai.yaml +2 -1
- package/skills/weaver-e10-jucailin/references/recruit-create.md +7 -8
- package/skills/weaver-e10-jucailin/references/recruit-implement-INDEX.md +41 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-consult-sop.md +77 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-guardrails.md +41 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-kb-data-update-channels.md +31 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-kb-form-external.md +43 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-kb-talent-base-form.md +32 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-pattern-external-collect-update-talent.md +93 -0
- package/skills/weaver-e10-jucailin/references/recruit-implement-pattern-external-share-edit.md +64 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -11
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +3 -3
- package/skills/weaver-e10-mail/SKILL.md +52 -10
- package/skills/weaver-e10-mail/references/mail-agent-entry.md +1 -2
- package/skills/weaver-e10-meeting/SKILL.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-okr/SKILL.md +1 -1
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +2 -2
- package/skills/weaver-e10-plan/references/source-manifest.json +3 -3
- package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +3 -3
- package/skills/weaver-e10-reception-flow/SKILL.md +53 -16
- package/skills/weaver-e10-shared/SKILL.md +4 -9
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
- package/skills/weaver-e10-shijingran/SKILL.md +14 -6
- package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
- package/skills/weaver-e10-workflow/SKILL.md +1 -1
- package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -2
- package/skills/weaver-e10-ziguanjia/SKILL.md +1 -1
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +1 -2
|
@@ -562,6 +562,48 @@ const issuingContractDetailOutputSchema = objectSchema({
|
|
|
562
562
|
}, ['docId', 'fileId', 'name'])),
|
|
563
563
|
contractDocIds: { ...nullableText, description: '全部文档 id,英文逗号分隔。开票申请「合同文本」不要填这个字符串' },
|
|
564
564
|
}, ['requestId', 'requestName', 'workflowName', 'customer', 'customerSource', 'contractDocuments', 'contractDocIds']);
|
|
565
|
+
/**
|
|
566
|
+
* 每条 operation 的一句话用途,写入 schema 的 summary。
|
|
567
|
+
*
|
|
568
|
+
* 口径:只描述「做什么 + 关键入参 + 是否写库」,不写未在实现里体现的业务承诺;
|
|
569
|
+
* prepare/apply 成对出现时,prepare 标注「只出预览,不写入」,apply 标注「落库前需确认」。
|
|
570
|
+
*/
|
|
571
|
+
const OPERATION_SUMMARIES = {
|
|
572
|
+
'invoice.list': '分页查询本人票夹的发票列表;可按类型、开票/消费日期区间、关键词过滤',
|
|
573
|
+
'invoice.enterprise.list': '分页查询企业票夹的发票列表(企业抬头下的发票);过滤条件同票夹列表',
|
|
574
|
+
'invoice.get': '按 fid 或票号取单张发票详情',
|
|
575
|
+
'invoice.upload': '上传本地文件或 URL 到发票系统(产出 fileId,尚不入票夹);入参 file/url',
|
|
576
|
+
'invoice.ocr.preview': '对上传的文件做 OCR 预览(不落库);入参 file/url,可指定 upload/is_save',
|
|
577
|
+
'invoice.upload-and-validate': '上传并做发票查验(真假校验),返回查验结果',
|
|
578
|
+
'invoice.import.prepare': '准备把发票导入票夹(只出预览,不写入);入参 file/url/validate/syncToOa',
|
|
579
|
+
'invoice.import.apply': '提交把发票导入票夹(落库前需确认);需 continuation + confirm',
|
|
580
|
+
'invoice.add.prepare': '准备新增发票记录(只出预览,不写入);入参 info/scope',
|
|
581
|
+
'invoice.add.apply': '提交新增发票记录(落库前需确认);需 continuation + confirm',
|
|
582
|
+
'invoice.update.prepare': '准备修改发票记录(只出预览,不写入);入参 fid/scope/changes',
|
|
583
|
+
'invoice.update.apply': '提交修改发票记录(落库前需确认);需 continuation + confirm',
|
|
584
|
+
'invoice.download': '把发票文件下载到本地;入参 fid/fileId/output(写本地文件)',
|
|
585
|
+
'invoice.delete.prepare': '准备删除发票记录(只出预览,不写入);入参 fid/scope',
|
|
586
|
+
'invoice.delete.apply': '提交删除发票记录(落库前需确认);需 continuation + confirm',
|
|
587
|
+
'invoice.reim.file-ocr.preview': '按报销附件 fileId 取发票识别结果(批量,不落库)',
|
|
588
|
+
'invoice.reim.requests.list': '分页查询可报销的流程单(报销申请列表);可按时间与场景过滤',
|
|
589
|
+
'invoice.reim.workflow.resolve': '按流程单 ID 批量解析对应的报销流程定义',
|
|
590
|
+
'invoice.reim.employee-superiors': '取当前员工的上级链(报销审批人候选,无入参)',
|
|
591
|
+
'invoice.reim.field.search': '按关键词检索报销表单字段(含字段 ID 与所属流程/节点)',
|
|
592
|
+
'invoice.reim.customer.search': '按关键词检索客户(报销关联客户候选)',
|
|
593
|
+
'invoice.reim.relation.search': '按目标与关键词检索报销关联关系(客户/项目)',
|
|
594
|
+
'invoice.reim.relation.save': '保存发票与客户/项目的关联关系(写操作,经动作流)',
|
|
595
|
+
'invoice.reim.relation.list': '按发票 fid/fids 查已建立的报销关联关系',
|
|
596
|
+
'invoice.reim.candidates.list': '按消费日期区间查询可参与报销的发票候选(有数量上限)',
|
|
597
|
+
'invoice.reim.subsidy.submit': '提交报销补贴申请并创建报销流程(高风险写操作,会落库发起流程)',
|
|
598
|
+
'invoice.issuing.contracts.list': '按合同卡片/流程 ID 查可开票的合同列表',
|
|
599
|
+
'invoice.issuing.contract.detail': '按 requestId 查开票对应合同的流程明细',
|
|
600
|
+
};
|
|
601
|
+
function withSummaries(operations) {
|
|
602
|
+
return operations.map((item) => ({
|
|
603
|
+
...item,
|
|
604
|
+
summary: item.summary || OPERATION_SUMMARIES[item.name] || '',
|
|
605
|
+
}));
|
|
606
|
+
}
|
|
565
607
|
export const invoiceOperations = [
|
|
566
608
|
{
|
|
567
609
|
name: 'invoice.list',
|
|
@@ -1246,7 +1288,7 @@ export const invoiceManifest = {
|
|
|
1246
1288
|
},
|
|
1247
1289
|
note: '--view 与 --fields 互斥。投影只影响输出,不改变任何请求参数;meta.projection 会说明本次裁剪结果。',
|
|
1248
1290
|
},
|
|
1249
|
-
operations: invoiceOperations,
|
|
1291
|
+
operations: withSummaries(invoiceOperations),
|
|
1250
1292
|
withheldOperations: [
|
|
1251
1293
|
{
|
|
1252
1294
|
name: 'invoice.share',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { charsOf, compactForStdout } from '../../core/output.js';
|
|
1
2
|
import { E10_SESSION_EXPIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
|
|
2
3
|
import { requireE10Session } from '../../internal/e10/context.js';
|
|
3
4
|
import { getActiveProfile } from '../../internal/e10/auth/session.js';
|
|
@@ -56,6 +57,75 @@ function businessCode(value) {
|
|
|
56
57
|
return code;
|
|
57
58
|
return undefined;
|
|
58
59
|
}
|
|
60
|
+
/** 错误里透传原始响应时的上限(字符)。失败响应不保证小,必须定量。 */
|
|
61
|
+
const RAW_RESPONSE_BUDGET_CHARS = 4_096;
|
|
62
|
+
const BUSINESS_MESSAGE_KEYS = ['msg', 'message', 'resultMsg', 'reminderMsg', 'failMsg', 'errorMsg'];
|
|
63
|
+
const BUSINESS_MESSAGE_CONTAINERS = ['actionData', 'responseData', 'customData', 'mainTable', 'data', 'result'];
|
|
64
|
+
function deepMessage(value, depth) {
|
|
65
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || depth > 4)
|
|
66
|
+
return '';
|
|
67
|
+
const record = value;
|
|
68
|
+
for (const key of BUSINESS_MESSAGE_KEYS) {
|
|
69
|
+
const item = record[key];
|
|
70
|
+
if (typeof item === 'string' && item.trim())
|
|
71
|
+
return item.trim();
|
|
72
|
+
}
|
|
73
|
+
for (const key of BUSINESS_MESSAGE_CONTAINERS) {
|
|
74
|
+
const found = deepMessage(record[key], depth + 1);
|
|
75
|
+
if (found)
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ESB 动作流失败时,顶层 `resultMsg` 往往只是框架给的「执行失败!」;
|
|
82
|
+
* 真正原因藏在出参里(`actionData.responseData.customData.mainTable.msg`,
|
|
83
|
+
* 例如「您对当前客户无领取权限,无法领取。」)。
|
|
84
|
+
*
|
|
85
|
+
* 只在**比顶层文案更有信息量**时返回,避免与 `message` 重复。
|
|
86
|
+
* 注意:本函数只补充 `details`,不改动 `message` 原文。
|
|
87
|
+
*/
|
|
88
|
+
export function jiuchuanhuiBusinessDetailMessage(value) {
|
|
89
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
90
|
+
return '';
|
|
91
|
+
const root = value;
|
|
92
|
+
const top = jiuchuanhuiBusinessMessage(value);
|
|
93
|
+
for (const key of BUSINESS_MESSAGE_CONTAINERS) {
|
|
94
|
+
const found = deepMessage(root[key], 0);
|
|
95
|
+
if (found && found !== top)
|
|
96
|
+
return found;
|
|
97
|
+
}
|
|
98
|
+
return '';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 原始响应超出预算时逐档压缩;压缩后仍超线就只留键名,绝不把 stderr 撑爆
|
|
102
|
+
* (错误通道不过 `Output.prepare`,没有落盘与预算兜底)。
|
|
103
|
+
*/
|
|
104
|
+
function boundedResponse(value) {
|
|
105
|
+
if (value === undefined)
|
|
106
|
+
return undefined;
|
|
107
|
+
const chars = charsOf(value);
|
|
108
|
+
if (chars <= RAW_RESPONSE_BUDGET_CHARS)
|
|
109
|
+
return value;
|
|
110
|
+
const compacted = compactForStdout(value, RAW_RESPONSE_BUDGET_CHARS);
|
|
111
|
+
if (charsOf(compacted) <= RAW_RESPONSE_BUDGET_CHARS) {
|
|
112
|
+
return { note: `原始响应 ${chars} 字符,已按预算压缩为预览`, preview: compacted };
|
|
113
|
+
}
|
|
114
|
+
const keys = value && typeof value === 'object' && !Array.isArray(value)
|
|
115
|
+
? Object.keys(value).slice(0, 20)
|
|
116
|
+
: [];
|
|
117
|
+
return { note: `原始响应 ${chars} 字符,超过 ${RAW_RESPONSE_BUDGET_CHARS} 字符预算,未内联`, keys };
|
|
118
|
+
}
|
|
119
|
+
/** 业务失败时的 details:保留原有 code/message,另带可执行的业务原因与原始响应。 */
|
|
120
|
+
function failureDetails(value, code, message) {
|
|
121
|
+
const businessMessage = jiuchuanhuiBusinessDetailMessage(value);
|
|
122
|
+
return {
|
|
123
|
+
code,
|
|
124
|
+
message,
|
|
125
|
+
...(businessMessage ? { businessMessage } : {}),
|
|
126
|
+
response: boundedResponse(value),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
59
129
|
export function assertJiuchuanhuiPath(requestPath) {
|
|
60
130
|
if (typeof requestPath !== 'string' || !requestPath.startsWith('/') || requestPath.startsWith('//')) {
|
|
61
131
|
throw jiuchuanhuiValidationError('path_invalid', '请求路径必须是相对绝对路径');
|
|
@@ -135,7 +205,7 @@ export function createJiuchuanhuiHost(ctx, dependencies = {}) {
|
|
|
135
205
|
if (response.status < 200 || response.status >= 300) {
|
|
136
206
|
throw new JiuchuanhuiCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
137
207
|
code: response.status,
|
|
138
|
-
details: { status: response.status },
|
|
208
|
+
details: { status: response.status, response: boundedResponse(response.value) },
|
|
139
209
|
exitCode: 1,
|
|
140
210
|
});
|
|
141
211
|
}
|
|
@@ -144,14 +214,16 @@ export function createJiuchuanhuiHost(ctx, dependencies = {}) {
|
|
|
144
214
|
if (response.status < 200 || response.status >= 300) {
|
|
145
215
|
throw new JiuchuanhuiCliError('api', 'http_error', `泛微接口 HTTP ${response.status}`, {
|
|
146
216
|
code: response.status,
|
|
147
|
-
details: { status: response.status, message: jiuchuanhuiBusinessMessage(response.value) },
|
|
217
|
+
details: { status: response.status, message: jiuchuanhuiBusinessMessage(response.value), response: boundedResponse(response.value) },
|
|
148
218
|
exitCode: 1,
|
|
149
219
|
});
|
|
150
220
|
}
|
|
151
221
|
if (!isJiuchuanhuiSuccess(response.value)) {
|
|
152
|
-
|
|
222
|
+
const message = jiuchuanhuiBusinessMessage(response.value);
|
|
223
|
+
throw new JiuchuanhuiCliError('api', 'business_error', message, {
|
|
153
224
|
code: businessCode(response.value),
|
|
154
|
-
|
|
225
|
+
// message 一律原样(服务端 resultMsg),细节另开字段补充,不改写既有文案。
|
|
226
|
+
details: failureDetails(response.value, businessCode(response.value), message),
|
|
155
227
|
exitCode: 1,
|
|
156
228
|
});
|
|
157
229
|
}
|
|
@@ -59,6 +59,107 @@ function writePair(baseName, title, props, required = [], fixed = {}, withPrepar
|
|
|
59
59
|
});
|
|
60
60
|
return list;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* 每条 operation 的一句话用途,写入 schema 的 summary。
|
|
64
|
+
*
|
|
65
|
+
* 口径:只描述「做什么 + 关键入参 + 是否写库」,不写未在实现里体现的业务承诺;
|
|
66
|
+
* prepare/apply 成对出现时,prepare 标注「只出预览,不写入」,apply 标注「落库前需确认」。
|
|
67
|
+
*/
|
|
68
|
+
const OPERATION_SUMMARIES = {
|
|
69
|
+
'jiuchuanhui.cache.init': '初始化九氚汇本地缓存(写本地缓存文件,不调业务接口);入参 dryRun/verbose',
|
|
70
|
+
'jiuchuanhui.app.discovery': '按标签取九氚汇相关 eBuilder 应用 ID 列表',
|
|
71
|
+
'jiuchuanhui.form.discovery': '按标签与应用取表单(对象)定义,用于定位客户/商机等主表',
|
|
72
|
+
'jiuchuanhui.field.options': '取表单某字段的选项字典(id↔name);入参 fieldName/objId/groupId',
|
|
73
|
+
'jiuchuanhui.rest.cfg.detail': '按 apid + id 取 REST 配置详情(动作流配置解析结果)',
|
|
74
|
+
'jiuchuanhui.config.id.by.pk': '按主表与数据主键反查配置 ID(经动作流)',
|
|
75
|
+
'jiuchuanhui.file.preview': '取附件预览地址;入参 fileId/fieldId/appId',
|
|
76
|
+
'jiuchuanhui.customer.create.prepare': '准备新建客户(只出预览,不写入);入参 mainTable 与客户字段',
|
|
77
|
+
'jiuchuanhui.customer.create.apply': '提交新建客户(落库前需确认);需 continuation + confirm',
|
|
78
|
+
'jiuchuanhui.customer.get': '按 id 取客户详情',
|
|
79
|
+
'jiuchuanhui.customer.search': '分页查询客户列表(支持条件过滤)',
|
|
80
|
+
'jiuchuanhui.customer.type.search': '分页查询客户类型字典',
|
|
81
|
+
'jiuchuanhui.customer.status.search': '分页查询客户状态字典',
|
|
82
|
+
'jiuchuanhui.customer.industry.search': '分页查询客户行业字典',
|
|
83
|
+
'jiuchuanhui.customer.open-sea.search': '分页查询公海客户列表',
|
|
84
|
+
'jiuchuanhui.customer.update.prepare': '准备修改客户(只出预览,不写入);入参 mainTable 与待改字段',
|
|
85
|
+
'jiuchuanhui.customer.update.apply': '提交修改客户(落库前需确认);需 continuation + confirm',
|
|
86
|
+
'jiuchuanhui.customer.transfer.prepare': '准备转移客户负责人(只出预览,不写入);入参 mainTable 与目标负责人',
|
|
87
|
+
'jiuchuanhui.customer.transfer.apply': '提交转移客户负责人(落库前需确认);需 continuation + confirm',
|
|
88
|
+
'jiuchuanhui.customer.open-sea.release.prepare': '准备把客户释放到公海(只出预览,不写入)',
|
|
89
|
+
'jiuchuanhui.customer.open-sea.release.apply': '提交把客户释放到公海(落库前需确认);需 continuation + confirm',
|
|
90
|
+
'jiuchuanhui.customer.open-sea.claim.prepare': '准备从公海领取客户(只出预览,不写入)',
|
|
91
|
+
'jiuchuanhui.customer.open-sea.claim.apply': '提交从公海领取客户(落库前需确认);需 continuation + confirm',
|
|
92
|
+
'jiuchuanhui.customer.duplicate.check': '客户查重:按名称/关键信息找出疑似重复客户(经动作流)',
|
|
93
|
+
'jiuchuanhui.customer.contact-record.create.prepare': '准备新增客户联系记录(只出预览,不写入)',
|
|
94
|
+
'jiuchuanhui.customer.contact-record.create.apply': '提交新增客户联系记录(落库前需确认);需 continuation + confirm',
|
|
95
|
+
'jiuchuanhui.customer.contact-record.batch.prepare': '准备批量新增客户联系记录(只出预览,不写入)',
|
|
96
|
+
'jiuchuanhui.customer.contact-record.batch.apply': '提交批量新增客户联系记录(落库前需确认);需 continuation + confirm',
|
|
97
|
+
'jiuchuanhui.contact.create.prepare': '准备新建联系人(只出预览,不写入);入参 mainTable 与联系人字段',
|
|
98
|
+
'jiuchuanhui.contact.create.apply': '提交新建联系人(落库前需确认);需 continuation + confirm',
|
|
99
|
+
'jiuchuanhui.contact.get': '按 id 取联系人详情',
|
|
100
|
+
'jiuchuanhui.contact.update.prepare': '准备修改联系人(只出预览,不写入)',
|
|
101
|
+
'jiuchuanhui.contact.update.apply': '提交修改联系人(落库前需确认);需 continuation + confirm',
|
|
102
|
+
'jiuchuanhui.contact.by-entity.search': '按客户或商机查询关联的联系人列表;入参 customerId/saleChanceId',
|
|
103
|
+
'jiuchuanhui.sale.create.prepare': '准备新建商机(只出预览,不写入);入参 mainTable 与商机字段',
|
|
104
|
+
'jiuchuanhui.sale.create.apply': '提交新建商机(落库前需确认);需 continuation + confirm',
|
|
105
|
+
'jiuchuanhui.sale.get': '按 id 取商机详情',
|
|
106
|
+
'jiuchuanhui.sale.search': '分页查询商机列表(支持条件过滤)',
|
|
107
|
+
'jiuchuanhui.sale.update.prepare': '准备修改商机(只出预览,不写入)',
|
|
108
|
+
'jiuchuanhui.sale.update.apply': '提交修改商机(落库前需确认);需 continuation + confirm',
|
|
109
|
+
'jiuchuanhui.sale.stage.search': '分页查询销售阶段字典',
|
|
110
|
+
'jiuchuanhui.sale.process.search': '分页查询商机的流程/阶段推进记录',
|
|
111
|
+
'jiuchuanhui.sale.lose-reason.search': '分页查询丢单原因字典',
|
|
112
|
+
'jiuchuanhui.rival.search': '分页查询竞争对手列表',
|
|
113
|
+
'jiuchuanhui.sale.win.prepare': '准备标记商机赢单(只出预览,不写入)',
|
|
114
|
+
'jiuchuanhui.sale.win.apply': '提交标记商机赢单(落库前需确认);需 continuation + confirm',
|
|
115
|
+
'jiuchuanhui.sale.lose.prepare': '准备标记商机输单(只出预览,不写入)',
|
|
116
|
+
'jiuchuanhui.sale.lose.apply': '提交标记商机输单(落库前需确认);需 continuation + confirm',
|
|
117
|
+
'jiuchuanhui.sale.invalid.prepare': '准备作废商机(只出预览,不写入)',
|
|
118
|
+
'jiuchuanhui.sale.invalid.apply': '提交作废商机(落库前需确认);需 continuation + confirm',
|
|
119
|
+
'jiuchuanhui.sale.pause.prepare': '准备暂停商机(只出预览,不写入)',
|
|
120
|
+
'jiuchuanhui.sale.pause.apply': '提交暂停商机(落库前需确认);需 continuation + confirm',
|
|
121
|
+
'jiuchuanhui.sale.restart.prepare': '准备重启商机(只出预览,不写入)',
|
|
122
|
+
'jiuchuanhui.sale.restart.apply': '提交重启商机(落库前需确认);需 continuation + confirm',
|
|
123
|
+
'jiuchuanhui.sale.manager-change.prepare': '准备变更商机负责人(只出预览,不写入)',
|
|
124
|
+
'jiuchuanhui.sale.manager-change.apply': '提交变更商机负责人(落库前需确认);需 continuation + confirm',
|
|
125
|
+
'jiuchuanhui.sale.link-contacts.prepare': '准备给商机关联联系人(只出预览,不写入)',
|
|
126
|
+
'jiuchuanhui.sale.link-contacts.apply': '提交给商机关联联系人(落库前需确认);需 continuation + confirm',
|
|
127
|
+
'jiuchuanhui.sale.contact-record.create.prepare': '准备新增商机联系记录(只出预览,不写入)',
|
|
128
|
+
'jiuchuanhui.sale.contact-record.create.apply': '提交新增商机联系记录(落库前需确认);需 continuation + confirm',
|
|
129
|
+
'jiuchuanhui.clue.create.prepare': '准备新建线索(只出预览,不写入);入参 mainTable 与线索字段',
|
|
130
|
+
'jiuchuanhui.clue.create.apply': '提交新建线索(落库前需确认);需 continuation + confirm',
|
|
131
|
+
'jiuchuanhui.clue.get': '按 id 取线索详情',
|
|
132
|
+
'jiuchuanhui.clue.search': '分页查询线索列表(支持条件过滤)',
|
|
133
|
+
'jiuchuanhui.clue.pool.search': '分页查询线索池列表',
|
|
134
|
+
'jiuchuanhui.clue.update.prepare': '准备修改线索(只出预览,不写入)',
|
|
135
|
+
'jiuchuanhui.clue.update.apply': '提交修改线索(落库前需确认);需 continuation + confirm',
|
|
136
|
+
'jiuchuanhui.clue.status-change.prepare': '准备变更线索状态(只出预览,不写入)',
|
|
137
|
+
'jiuchuanhui.clue.status-change.apply': '提交变更线索状态(落库前需确认);需 continuation + confirm',
|
|
138
|
+
'jiuchuanhui.clue.to-customer.prepare': '准备把线索转为客户(只出预览,不写入)',
|
|
139
|
+
'jiuchuanhui.clue.to-customer.apply': '提交把线索转为客户(落库前需确认);需 continuation + confirm',
|
|
140
|
+
'jiuchuanhui.clue.contact-record.create.prepare': '准备新增线索联系记录(只出预览,不写入)',
|
|
141
|
+
'jiuchuanhui.clue.contact-record.create.apply': '提交新增线索联系记录(落库前需确认);需 continuation + confirm',
|
|
142
|
+
'jiuchuanhui.contact-plan.create.prepare': '准备新建联系计划(只出预览,不写入)',
|
|
143
|
+
'jiuchuanhui.contact-plan.create.apply': '提交新建联系计划(落库前需确认);需 continuation + confirm',
|
|
144
|
+
'jiuchuanhui.contact-plan.complete.prepare': '准备把联系计划标记完成(只出预览,不写入)',
|
|
145
|
+
'jiuchuanhui.contact-plan.complete.apply': '提交把联系计划标记完成(落库前需确认);需 continuation + confirm',
|
|
146
|
+
'jiuchuanhui.entity.contact-records.list': '查某个实体(客户/商机/线索)名下的联系记录;入参 mainTable 与实体主键',
|
|
147
|
+
'jiuchuanhui.contact-records.by-person-time.list': '按人员与时间范围查联系记录',
|
|
148
|
+
'jiuchuanhui.entity.id.by-name': '按名称解析实体 ID(重名时会给出候选)',
|
|
149
|
+
'jiuchuanhui.user.id.by-name': '按姓名解析用户 ID(重名时会给出候选)',
|
|
150
|
+
'jiuchuanhui.user.current-profile': '取当前登录人的画像信息(部门/岗位/上级)',
|
|
151
|
+
'jiuchuanhui.entity.permission.judge': '判定当前用户对某实体(客户/商机/线索)的操作权限',
|
|
152
|
+
'jiuchuanhui.company.business-profile.query': '查客户的工商画像信息',
|
|
153
|
+
'jiuchuanhui.field.info.by-ids': '按 ID 批量取字段信息(名称/类型)',
|
|
154
|
+
'jiuchuanhui.browser-option.search': '通用浏览按钮检索:按自定义浏览按钮类型取候选(路径参数 pathParams)',
|
|
155
|
+
'jiuchuanhui.get-rest-cfg-detail': '按 apid + id 取 REST 配置详情(与 rest.cfg.detail 同类,路径不同)',
|
|
156
|
+
};
|
|
157
|
+
function withSummaries(operations) {
|
|
158
|
+
return operations.map((item) => ({
|
|
159
|
+
...item,
|
|
160
|
+
summary: item.summary || OPERATION_SUMMARIES[item.name] || '',
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
62
163
|
export const jiuchuanhuiOperations = [
|
|
63
164
|
// ==================== 发现与配置 ====================
|
|
64
165
|
{
|
|
@@ -459,7 +560,7 @@ export const jiuchuanhuiManifest = {
|
|
|
459
560
|
host: 'e10-jiuchuanhui',
|
|
460
561
|
status: 'builtin',
|
|
461
562
|
sourceSkill: 'weaver-e10-jiuchuanhui',
|
|
462
|
-
operations: jiuchuanhuiOperations,
|
|
563
|
+
operations: withSummaries(jiuchuanhuiOperations),
|
|
463
564
|
withheldOperations: [
|
|
464
565
|
{
|
|
465
566
|
name: 'jiuchuanhui.sale.stage-advance',
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isStructuredError } from '../../core/errors.js';
|
|
2
|
+
import { getE10Session, requireE10Session } from '../../internal/e10/context.js';
|
|
3
|
+
import { E10_AUTH_REQUIRED_MESSAGE } from '../../internal/e10/auth/messages.js';
|
|
2
4
|
import { E10ApiError, createE10RequestRuntime, } from '../../internal/e10/request-runtime.js';
|
|
3
5
|
import { receptionBusinessError, receptionEnvironmentError } from './errors.js';
|
|
4
6
|
import { UploadProtocolError, uploadToFileService } from './upload.js';
|
|
5
7
|
import { fetchRestaurantRooms as fetchRooms } from './operations/restaurant-rooms.js';
|
|
6
8
|
/** 单次上传的总时限。分片上传是多轮请求,留足 3 分钟。 */
|
|
7
9
|
const UPLOAD_TIMEOUT_MS = 180_000;
|
|
8
|
-
export function createReceptionHost(ctx) {
|
|
10
|
+
export function createReceptionHost(ctx, dependencies = {}) {
|
|
9
11
|
let cached = null;
|
|
12
|
+
const requireSession = dependencies.requireSession || requireE10Session;
|
|
10
13
|
async function resolve() {
|
|
11
14
|
if (cached)
|
|
12
15
|
return cached;
|
|
@@ -129,11 +132,22 @@ export function createReceptionHost(ctx) {
|
|
|
129
132
|
/**
|
|
130
133
|
* 查「小食堂包厢」。
|
|
131
134
|
* eteamsId / tenantKey 只在这里取用并塞进请求体,不返回给调用方。
|
|
135
|
+
*
|
|
136
|
+
* 这条命令必须拿到真实会话,所以走 `requireSession` 而不是只读快照:
|
|
137
|
+
* 小e 下本地没有 auth 文件时,公共会话层会先静默换票再执行,不会再直接
|
|
138
|
+
* 报「未取得会话」。
|
|
132
139
|
*/
|
|
133
140
|
async function fetchRestaurantRooms(options = {}) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
let e10;
|
|
142
|
+
try {
|
|
143
|
+
e10 = await requireSession(ctx);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// 小e 自动恢复失败时抛的是结构化认证错误(authentication/xiaoe_*),
|
|
147
|
+
// details.attemptedSteps 能说明试过哪些凭据通道,原样上抛让模型按现行口径处理。
|
|
148
|
+
if (isStructuredError(error))
|
|
149
|
+
throw error;
|
|
150
|
+
throw receptionEnvironmentError('NO_SESSION', E10_AUTH_REQUIRED_MESSAGE);
|
|
137
151
|
}
|
|
138
152
|
const runtime = createE10RequestRuntime(ctx, e10);
|
|
139
153
|
return fetchRooms(runtime, {
|
|
@@ -5,7 +5,8 @@ import { createWorkflowContinuationSigner } from './continuation.js';
|
|
|
5
5
|
import { createWorkflowHost } from './host.js';
|
|
6
6
|
import { workflowManifest } from './manifest.js';
|
|
7
7
|
import { executeWorkflowOperation } from './operations.js';
|
|
8
|
-
import { workflowValidationError } from './errors.js';
|
|
8
|
+
import { workflowValidationError, workflowPolicyError } from './errors.js';
|
|
9
|
+
import { isCapabilityDeniedHere } from '../../core/host-policy.js';
|
|
9
10
|
import { compactStdoutPaths } from './stdout-compact.js';
|
|
10
11
|
import { join } from 'node:path';
|
|
11
12
|
import { loadRules, resetActiveRules } from './operations/todoSmartConvert/aigroupRules.js';
|
|
@@ -134,7 +135,43 @@ function fieldNamesOf(inputSchema) {
|
|
|
134
135
|
return [];
|
|
135
136
|
return Object.keys(properties);
|
|
136
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* 当前宿主可见的 operation:被宿主策略扣留的(如豆包环境下的记忆类)不参与编目。
|
|
140
|
+
*
|
|
141
|
+
* 只在 schema 层过滤还不够——`run` 侧另有门禁(`operations.ts` 的 `assertHostAllows`),
|
|
142
|
+
* 两处判据同源(`core/host-policy.ts`),不会出现"列得出但跑不动"或"列不出却跑得动"。
|
|
143
|
+
*/
|
|
144
|
+
function visibleOperations() {
|
|
145
|
+
return workflowManifest.operations.filter((definition) => !isCapabilityDeniedHere(definition.capability));
|
|
146
|
+
}
|
|
147
|
+
/** 被宿主策略扣留的 operation,写进 manifest 让调用方看到"为什么没有",而不是凭空少两条。 */
|
|
148
|
+
function hostWithheldOperations() {
|
|
149
|
+
return workflowManifest.operations
|
|
150
|
+
.filter((definition) => isCapabilityDeniedHere(definition.capability))
|
|
151
|
+
.map((definition) => ({
|
|
152
|
+
name: definition.name,
|
|
153
|
+
reason: `当前运行环境不提供「${definition.capability}」类操作,已在该环境禁用`,
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 编目里补两个「必填」提示:`required` 与 `atLeastOne`。
|
|
158
|
+
*
|
|
159
|
+
* 编目为了控制体积只输出字段名(`fields`),于是「哪些字段必填」在编目里完全不可见,
|
|
160
|
+
* 实测只能靠空入参触发 E-0003 再反推(workflow.detail 报「必须提供 requestId 或 group+index」)。
|
|
161
|
+
* 这里把 `inputSchema.required` 与 `anyOf` 各分支的 required 并集压成两个短数组带出去,
|
|
162
|
+
* 体积可控(单条几十字节),仍不搬完整 properties。
|
|
163
|
+
*/
|
|
164
|
+
function requiredHints(inputSchema) {
|
|
165
|
+
const schema = inputSchema;
|
|
166
|
+
const required = Array.isArray(schema?.required) && schema.required.length ? schema.required : undefined;
|
|
167
|
+
const anyOf = Array.isArray(schema?.anyOf) ? schema.anyOf : null;
|
|
168
|
+
const atLeastOne = anyOf
|
|
169
|
+
? [...new Set(anyOf.flatMap((branch) => branch?.required ?? []))]
|
|
170
|
+
: [];
|
|
171
|
+
return { ...(required ? { required } : {}), ...(atLeastOne.length ? { atLeastOne } : {}) };
|
|
172
|
+
}
|
|
137
173
|
function manifestIndex() {
|
|
174
|
+
const operations = visibleOperations();
|
|
138
175
|
return {
|
|
139
176
|
schemaVersion: workflowManifest.schemaVersion,
|
|
140
177
|
name: workflowManifest.name,
|
|
@@ -144,8 +181,8 @@ function manifestIndex() {
|
|
|
144
181
|
status: workflowManifest.status,
|
|
145
182
|
sourceSkill: workflowManifest.sourceSkill,
|
|
146
183
|
capabilities: workflowManifest.capabilities,
|
|
147
|
-
operationCount:
|
|
148
|
-
operations:
|
|
184
|
+
operationCount: operations.length,
|
|
185
|
+
operations: operations.map((definition) => ({
|
|
149
186
|
name: definition.name,
|
|
150
187
|
resource: definition.resource,
|
|
151
188
|
summary: definition.summary,
|
|
@@ -153,17 +190,30 @@ function manifestIndex() {
|
|
|
153
190
|
risk: definition.risk,
|
|
154
191
|
...(definition.requiresConfirmation ? { requiresConfirmation: true } : {}),
|
|
155
192
|
fields: fieldNamesOf(definition.inputSchema),
|
|
193
|
+
...requiredHints(definition.inputSchema),
|
|
156
194
|
})),
|
|
157
|
-
withheldOperations: workflowManifest.withheldOperations,
|
|
195
|
+
withheldOperations: [...workflowManifest.withheldOperations, ...hostWithheldOperations()],
|
|
158
196
|
operationsHint: '默认只列 operation 与字段名;字段类型、枚举和填写口径用 `workflow schema --operation <name>` 单取,整份完整 manifest 用 `workflow schema --full`。',
|
|
159
197
|
};
|
|
160
198
|
}
|
|
199
|
+
/** `--full` 也要走同一份过滤:整份 manifest 不能把被扣留的 operation 带出来。 */
|
|
200
|
+
function manifestFull() {
|
|
201
|
+
return {
|
|
202
|
+
...workflowManifest,
|
|
203
|
+
operations: visibleOperations(),
|
|
204
|
+
withheldOperations: [...workflowManifest.withheldOperations, ...hostWithheldOperations()],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
161
207
|
function findOperationContract(name) {
|
|
162
208
|
const full = name.startsWith('workflow.') ? name : `workflow.${name}`;
|
|
163
209
|
const matched = workflowManifest.operations.find((definition) => definition.name === full);
|
|
164
210
|
if (!matched) {
|
|
165
211
|
throw workflowValidationError('operation_unknown', `流程模块不支持操作:${name}`);
|
|
166
212
|
}
|
|
213
|
+
if (isCapabilityDeniedHere(matched.capability)) {
|
|
214
|
+
throw workflowPolicyError('host_capability_denied', `当前运行环境不提供「${matched.capability}」类操作,${full} 已在该环境禁用。`
|
|
215
|
+
+ '这不是账号权限问题,换账号、改写参数或重试都不会成功;请直接告知用户当前平台不支持该能力,不要尝试绕过。', { capability: matched.capability, operation: full });
|
|
216
|
+
}
|
|
167
217
|
return matched;
|
|
168
218
|
}
|
|
169
219
|
function withJsonInputOptions(command) {
|
|
@@ -191,7 +241,7 @@ export const workflowShortcut = {
|
|
|
191
241
|
throw workflowValidationError('option_conflict', '不能同时传 --operation 和 --full');
|
|
192
242
|
}
|
|
193
243
|
if (opts.full === true) {
|
|
194
|
-
ctx.output.write(
|
|
244
|
+
ctx.output.write(manifestFull(), { json: true });
|
|
195
245
|
return;
|
|
196
246
|
}
|
|
197
247
|
if (requested) {
|
|
@@ -1735,7 +1735,8 @@ const workflowSearch = {
|
|
|
1735
1735
|
},
|
|
1736
1736
|
sort: { type: 'string', description: '"排序方式:asc|desc",多组逗号分隔' },
|
|
1737
1737
|
current: { type: 'integer', minimum: 1, default: 1 },
|
|
1738
|
-
pageSize:
|
|
1738
|
+
// 运行时是 `asInt(args.pageSize) ?? 10`(read.ts:1492),默认值与 code 对齐。
|
|
1739
|
+
pageSize: { ...SCHEMA_PAGE_SIZE, default: 10 },
|
|
1739
1740
|
conditionType: { type: 'string', enum: ['and', 'or'], default: 'and' },
|
|
1740
1741
|
totalOnly: { type: 'boolean', default: false },
|
|
1741
1742
|
batchType: {
|
|
@@ -4974,7 +4975,16 @@ const workflowPageOpen = {
|
|
|
4974
4975
|
capability: 'page',
|
|
4975
4976
|
risk: 'read',
|
|
4976
4977
|
inputSchema: schemaOf({
|
|
4977
|
-
page: {
|
|
4978
|
+
page: {
|
|
4979
|
+
type: 'string',
|
|
4980
|
+
// 8 个列表页 + newflow/monitor + 两个动态页,共 13 个规范值(COMMON_OA_PAGES 的 key 全量)。
|
|
4981
|
+
// 运行时另兼容 new/发起流程→create、detail/详情→view 等别名,但只导正规范值,避免模型自造 page。
|
|
4982
|
+
enum: [
|
|
4983
|
+
'center', 'todo', 'done', 'mine', 'share', 'attention', 'draft',
|
|
4984
|
+
'subordinates', 'all', 'newflow', 'monitor', 'create', 'view',
|
|
4985
|
+
],
|
|
4986
|
+
description: '页面 key:center/todo/done/mine/share/attention/draft/subordinates/all/newflow/monitor;动态页 create(配合 workflowId)、view(配合 requestId)',
|
|
4987
|
+
},
|
|
4978
4988
|
workflowId: { type: 'string', description: '打开发起流程页(page=create)时的工作流 ID' },
|
|
4979
4989
|
requestId: { type: 'string', description: '打开流程详情页(page=view)时的流程 requestId' },
|
|
4980
4990
|
openMode: { type: 'string', enum: ['auto', 'localBrowser', 'clientAction', 'url'], default: 'auto' },
|
|
@@ -4,13 +4,19 @@ export function workflowSuccess(action, data, meta) {
|
|
|
4
4
|
payload.meta = meta;
|
|
5
5
|
return payload;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* 构造「对象类型 + 严格禁止额外字段」的 JSON Schema。
|
|
9
|
+
*
|
|
10
|
+
* `anyOf` 用于表达 required 表达不了的约束:多个定位参数「至少给一个」、
|
|
11
|
+
* 互斥的两条路径「二选一」。只写进 schema 供模型读,不参与运行时校验。
|
|
12
|
+
*/
|
|
8
13
|
export function schemaOf(properties, options = {}) {
|
|
9
14
|
return {
|
|
10
15
|
type: 'object',
|
|
11
16
|
additionalProperties: false,
|
|
12
17
|
properties,
|
|
13
18
|
...(options.required?.length ? { required: options.required } : {}),
|
|
19
|
+
...(options.anyOf?.length ? { anyOf: options.anyOf } : {}),
|
|
14
20
|
...(options.description ? { description: options.description } : {}),
|
|
15
21
|
};
|
|
16
22
|
}
|
|
@@ -856,7 +856,11 @@ const OPERATE_LOCATE_SCHEMA = schemaOf({
|
|
|
856
856
|
selectFlowParamJson: { type: 'string', description: 'submit/agree 多出口节点提交时的指定流转参数 JSON(selectFlowParam)' },
|
|
857
857
|
exceptionHandleInfoJson: { type: 'string', description: 'submit/agree 提交时的异常处理参数 JSON(exceptionHandleInfo)' },
|
|
858
858
|
formdataJson: { type: 'string', description: 'submit/agree 随提交携带的表单数据 JSON(formdata)' },
|
|
859
|
-
}, {
|
|
859
|
+
}, {
|
|
860
|
+
required: ['action'],
|
|
861
|
+
// 定位复用 resolveTargetItem:无 requestId 时必须有 index(否则 locate_required)。
|
|
862
|
+
anyOf: [{ required: ['requestId'] }, { required: ['index'] }],
|
|
863
|
+
});
|
|
860
864
|
const workflowOperatePrepare = {
|
|
861
865
|
name: 'workflow.operatePrepare',
|
|
862
866
|
resource: 'workflow',
|
|
@@ -1191,6 +1195,11 @@ const SHARE_INPUT = schemaOf({
|
|
|
1191
1195
|
},
|
|
1192
1196
|
minSeclevel: { type: 'string', description: '最小安全级别(与默认值取大)' },
|
|
1193
1197
|
maxSeclevel: { type: 'string', description: '最大安全级别(与默认值取小)' },
|
|
1198
|
+
}, {
|
|
1199
|
+
// 运行时两条硬校验:无 requestId 时靠 index 定位(否则 locate_required);
|
|
1200
|
+
// shareObjects 为空直接 share_objects_required。
|
|
1201
|
+
required: ['shareObjects'],
|
|
1202
|
+
anyOf: [{ required: ['requestId'] }, { required: ['index'] }],
|
|
1194
1203
|
});
|
|
1195
1204
|
const workflowSharePrepare = {
|
|
1196
1205
|
name: 'workflow.sharePrepare',
|
|
@@ -1864,7 +1873,16 @@ function withBatchScopeDriver(definition, suffix) {
|
|
|
1864
1873
|
};
|
|
1865
1874
|
return {
|
|
1866
1875
|
...definition,
|
|
1867
|
-
|
|
1876
|
+
// `requestIds` 与 `scopeCondition` 是**二选一**(runScopeDrivenBatch 的 batch_scope_conflict),
|
|
1877
|
+
// 且给 `scopeCondition` 时必须显式 `action`(batch_action_required)——三条路径原样写进 schema:
|
|
1878
|
+
// ① requestIds ② scopeCondition + action:"total" ③ scopeCondition + action:"execute"。
|
|
1879
|
+
inputSchema: {
|
|
1880
|
+
...schemaOf(properties, { required: ['confirm'] }),
|
|
1881
|
+
anyOf: [
|
|
1882
|
+
{ required: ['requestIds'] },
|
|
1883
|
+
{ required: ['scopeCondition', 'action'] },
|
|
1884
|
+
],
|
|
1885
|
+
},
|
|
1868
1886
|
handler: async (args, env) => {
|
|
1869
1887
|
const scoped = await runScopeDrivenBatch(args, env, definition.name, suffix, (pageArgs) => inner(pageArgs, env));
|
|
1870
1888
|
if (scoped)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { workflowSuccess } from './operations/types.js';
|
|
2
2
|
import { getWorkflowOperation } from './operations/registry.js';
|
|
3
3
|
import { assertNoForbiddenKeys, asObject } from './operations/shared.js';
|
|
4
|
-
import { WorkflowCliError, CLARIFICATION_SUBTYPE } from './errors.js';
|
|
4
|
+
import { WorkflowCliError, CLARIFICATION_SUBTYPE, workflowPolicyError } from './errors.js';
|
|
5
|
+
import { hostCapabilityDenial } from '../../core/host-policy.js';
|
|
5
6
|
/**
|
|
6
7
|
* 幂等回报:一次性 continuation 被**重复执行**时,若上一次已经执行成功,就不能把成功报成失败。
|
|
7
8
|
*
|
|
@@ -151,8 +152,25 @@ async function settleAppliedContinuation(input, result, context, definition) {
|
|
|
151
152
|
return;
|
|
152
153
|
await context.continuation.settle(reference, result.data, definition.action || definition.name);
|
|
153
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* 宿主能力门禁:某些 capability 在特定宿主内**整体不可用**(例如豆包渠道禁用记忆类操作)。
|
|
157
|
+
*
|
|
158
|
+
* 放在 `getWorkflowOperation()` 之后、handler 之前,是唯一覆盖全部 operation 的收口点:
|
|
159
|
+
* 后续新增同 capability 的命令自动被禁,不需要再改这里。
|
|
160
|
+
*
|
|
161
|
+
* 判据来自进程环境变量(见 `core/host-policy.ts`),**不读 session**——手动调用不受影响。
|
|
162
|
+
*/
|
|
163
|
+
function assertHostAllows(operation, capability) {
|
|
164
|
+
const denial = hostCapabilityDenial(capability);
|
|
165
|
+
if (!denial)
|
|
166
|
+
return;
|
|
167
|
+
throw workflowPolicyError('host_capability_denied', `当前运行环境(${denial.host})不提供「${denial.capability}」类操作,${operation} 已在该环境禁用。`
|
|
168
|
+
+ '这不是账号权限问题,换账号、改写参数或重试都不会成功;'
|
|
169
|
+
+ '请直接告知用户当前平台不支持该能力,不要尝试绕过。', { host: denial.host, capability: denial.capability, operation });
|
|
170
|
+
}
|
|
154
171
|
export async function executeWorkflowOperation(operation, rawInput, context) {
|
|
155
172
|
const definition = getWorkflowOperation(operation);
|
|
173
|
+
assertHostAllows(operation, definition.capability);
|
|
156
174
|
const input = asObject(rawInput);
|
|
157
175
|
assertNoForbiddenKeys(input);
|
|
158
176
|
let result;
|
package/docs/e10-auth.md
CHANGED
|
@@ -203,7 +203,54 @@ XiaoE 换票结果中的 `expiryTimes` 按 Unix 毫秒时间戳持久化。宿
|
|
|
203
203
|
`ETEAMSID`。命令会调用 `teamsCheck` 解析当前用户、租户和组织信息,并写入
|
|
204
204
|
E10 兼容的 auth 文件。
|
|
205
205
|
|
|
206
|
-
静默恢复失败时,`authentication/xiaoe_credential_unavailable` 会带 `details` 以便定位而不必复现:`attemptedSteps` 按序记录评估过的凭证通道及结果(如 `platform_token:missing`、`bundled_env_script:failed`、`token_script:disabled`、`environment_map:empty`、`e10_session:failed`),`failures` 按发生顺序保留每一次失败的阶段(`platform_token` / `bundled_env_script` / `token_script` / `client_session` / `teams_check` / `e10_session`)、类别(`network` / `http` / `credential`)以及网络错误的系统错误码 `causeCode`(取自 `error.cause.code`,如 `ECONNREFUSED`、`ETIMEDOUT`)和 HTTP 错误的状态码 `httpStatus`。Node 换票失败会保留最多五层脱敏的 `error.cause` 链,以及存在时的 `errno`、`syscall`、`hostname`、`address`、`port`。完整换票请求快照仅持久化到 `auth logs` 对应的认证错误日志:其中 `failure.request` 记录实际请求方法、去除用户信息和查询串后的接口地址、最终重定向地址、完整 `domain` 请求体、请求体字节数、重定向策略、15 秒超时、实际耗时、重定向次数及固定的脱敏请求头,`auth logs show` 再把它渲染为单行 `requestParams` JSON。业务命令失败的 stderr / `error.details.failures` 会移除 `request`,不会带接口与请求体。`Authorization` 永远只显示 `<redacted>`,但认证日志会记录 `authorizationPresent` 和 `authorizationLength`,用于区分宿主未注入与网络失败。Python 兼容路径会保留最多 12 行、总长 2000 字符的脱敏 stderr 尾部,避免只剩一行源码。`lastError` 是最后一条真实原因(已对已知凭据脱敏并截断到 300 字符),并附带解析出的 `baseUrl`、`clientType`、`platformCredentialDetected`、整体归类 `errorKind` 与最后失败阶段 `failureStage`;若票其实换到了、但按 `expiryTimes` 判定为已过期,会额外带 `resultSessionExpired: true`。当且仅当所有失败都是网络错误时,错误改为 `authentication/xiaoe_network_unavailable`、`retryable: true`,文案换成“暂时无法连接 E10
|
|
206
|
+
静默恢复失败时,`authentication/xiaoe_credential_unavailable` 会带 `details` 以便定位而不必复现:`attemptedSteps` 按序记录评估过的凭证通道及结果(如 `platform_token:missing`、`bundled_env_script:failed`、`token_script:disabled`、`environment_map:empty`、`e10_session:failed`),`failures` 按发生顺序保留每一次失败的阶段(`platform_token` / `bundled_env_script` / `token_script` / `client_session` / `teams_check` / `e10_session`)、类别(`network` / `http` / `credential`)以及网络错误的系统错误码 `causeCode`(取自 `error.cause.code`,如 `ECONNREFUSED`、`ETIMEDOUT`)和 HTTP 错误的状态码 `httpStatus`。Node 换票失败会保留最多五层脱敏的 `error.cause` 链,以及存在时的 `errno`、`syscall`、`hostname`、`address`、`port`。完整换票请求快照仅持久化到 `auth logs` 对应的认证错误日志:其中 `failure.request` 记录实际请求方法、去除用户信息和查询串后的接口地址、最终重定向地址、完整 `domain` 请求体、请求体字节数、重定向策略、15 秒超时、实际耗时、重定向次数及固定的脱敏请求头,`auth logs show` 再把它渲染为单行 `requestParams` JSON。业务命令失败的 stderr / `error.details.failures` 会移除 `request`,不会带接口与请求体。`Authorization` 永远只显示 `<redacted>`,但认证日志会记录 `authorizationPresent` 和 `authorizationLength`,用于区分宿主未注入与网络失败。Python 兼容路径会保留最多 12 行、总长 2000 字符的脱敏 stderr 尾部,避免只剩一行源码。`lastError` 是最后一条真实原因(已对已知凭据脱敏并截断到 300 字符),并附带解析出的 `baseUrl`、`clientType`、`platformCredentialDetected`、整体归类 `errorKind` 与最后失败阶段 `failureStage`;若票其实换到了、但按 `expiryTimes` 判定为已过期,会额外带 `resultSessionExpired: true`。当且仅当所有失败都是网络错误时,错误改为 `authentication/xiaoe_network_unavailable`、`retryable: true`,文案换成“暂时无法连接 E10,请稍后重试”(此时登录态并未被验证,提示用户重新登录属于误导)。证书链不受信任是这条判定的例外,见下节。这条路径默认依然完全无输出,需要看每一步的过程日志时给业务命令加 `--verbose`(经 stderr 以 `[debug]` 前缀输出;`--json` 下完全不输出)。
|
|
207
|
+
|
|
208
|
+
### 网关证书不受信任(自签名 / 私有 CA)
|
|
209
|
+
|
|
210
|
+
内网网关常用自签名证书或私有 CA 签发,Node 与 Python 的默认根证书池都不认,表现是
|
|
211
|
+
`SELF_SIGNED_CERT_IN_CHAIN` / `certificate verify failed: self-signed certificate in certificate chain`。
|
|
212
|
+
这类错误过去会被归进「网络抖动」,提示「稍后重试」——重试永远不会成功,只会把用户带向错误的排查方向。
|
|
213
|
+
|
|
214
|
+
CLI 用一个显式入口解决,不开任何「关掉校验」的口子:换票请求的 `Authorization` 头里就是平台票据,
|
|
215
|
+
静默跳过校验等于把票据暴露给任何中间人。
|
|
216
|
+
|
|
217
|
+
```text
|
|
218
|
+
WEAVER_E10_CA_FILE=<网关 CA 的 PEM 路径>[,<第二份 PEM>...]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- Node ≥ 22.15:CLI 在**进程入口**就把 PEM 追加进默认 CA 池(`tls.setDefaultCACertificates`),
|
|
222
|
+
换票、`teamsCheck`、业务请求共用同一份信任链;追加不替换,公网域(如 `weapp.eteams.cn`)仍按原链校验。
|
|
223
|
+
- Node < 22.15:没有运行时入口,CLI 会在错误里引导改用 `NODE_EXTRA_CA_CERTS=<PEM 路径>` 启动。
|
|
224
|
+
- Python 兼容脚本(`xiaoe_env.py`):子进程自动拿到 `SSL_CERT_FILE` / `REQUESTS_CA_BUNDLE`;
|
|
225
|
+
调用方显式设置过就不覆盖。
|
|
226
|
+
- 多份 PEM 用逗号分隔;某一份损坏(截断、混入说明文字)不会让其余证书一起失效,坏文件在 `details.tls.error` 里点名。
|
|
227
|
+
- 路径写错不会让命令起不来,但会在 TLS 报错时一并给出「文件不存在 / 不是 PEM」。
|
|
228
|
+
|
|
229
|
+
命中时的错误信封为 `authentication/xiaoe_tls_untrusted`、`retryable: false`,文案直接给出配置方法;
|
|
230
|
+
`details.tls` 记录本次生效的策略:`mode`(`system` / `custom-ca` / `insecure`)、`caFiles`、`applied`,
|
|
231
|
+
未生效时带 `notAppliedReason`(`no-custom-ca` / `unsupported-runtime` / `failed`)与 `error`;
|
|
232
|
+
配置了但没生效时额外带 `details.tlsHint=configured_ca_not_applied`。
|
|
233
|
+
`auth logs show` 会在每条记录上渲染一行 `tls: mode=… applied=… caFiles=…`。
|
|
234
|
+
|
|
235
|
+
排障逃生口:`WEAVER_E10_TLS_INSECURE=1` 会关闭**本进程**的证书校验,优先级高于 `WEAVER_E10_CA_FILE`。
|
|
236
|
+
实现方式是设置 `NODE_TLS_REJECT_UNAUTHORIZED=0`(Node 的 `https.request` 与全局 `fetch`/undici 都认),
|
|
237
|
+
Python 兼容脚本另读同一变量切到 `ssl._create_unverified_context()`。它只用于确认「报错是不是证书引起的」:
|
|
238
|
+
关闭期间 `Authorization` 里的平台票据可被中间人截获,stderr 会打印一次警告,`details.tls.mode` 会显示
|
|
239
|
+
`insecure`。确认是证书问题后应改用上面的 CA 配置,不要把该变量写进任何持久化配置或技能文档。
|
|
240
|
+
|
|
241
|
+
```text
|
|
242
|
+
# 只验证「是不是证书问题」,不要长期开启
|
|
243
|
+
WEAVER_E10_TLS_INSECURE=1 weaver-work-cli doctor --e10
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
注入必须早于第一个请求:`setDefaultCACertificates` 只影响之后创建的 TLS 上下文。因此 CLI 在入口统一注入,
|
|
247
|
+
统一登录再调用一次(幂等、按配置缓存),不依赖某个命令是否走到。
|
|
248
|
+
|
|
249
|
+
```text
|
|
250
|
+
openssl s_client -showcerts -connect <网关主机>:443 </dev/null \
|
|
251
|
+
| openssl x509 -outform PEM > gateway-ca.pem
|
|
252
|
+
WEAVER_E10_CA_FILE=./gateway-ca.pem weaver-work-cli doctor --e10
|
|
253
|
+
```
|
|
207
254
|
|
|
208
255
|
显式 `auth xiaoe` 失败和上述静默恢复失败都会把同一份诊断持久化为 JSON Lines。
|
|
209
256
|
持久化前会再次移除 URL 查询参数、已知凭据、Bearer 值和服务端原始 `details`;日志不保存
|