weaver-work-cli 0.1.68 → 0.1.70
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-DMU7KNZ7.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-6OK4LW76.js → chunk-4W6BSNIL.js} +6 -6
- package/dist/chunks/{chunk-3W5NMGDS.js → chunk-727VKJQK.js} +2 -2
- package/dist/chunks/{chunk-QHKY4WZA.js → chunk-7CINV2BU.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-C5IIIT4D.js → chunk-EHH363SP.js} +4 -4
- package/dist/chunks/{chunk-LXXR2RRE.js → chunk-GFOFUH6O.js} +50 -50
- package/dist/chunks/{chunk-TJN4PIYO.js → chunk-GTAFCAVP.js} +2 -0
- package/dist/chunks/{chunk-O7KPHPXQ.js → chunk-GWM5TLIK.js} +34 -34
- package/dist/chunks/{chunk-WSHIOSGM.js → chunk-H2NRTGZR.js} +3 -3
- package/dist/chunks/{chunk-YSEHTSHS.js → chunk-HAORST2G.js} +11 -11
- 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-BJNSTCJK.js → chunk-IVCOZCAW.js} +1 -1
- package/dist/chunks/{chunk-Y7RGBRLG.js → chunk-KDOJW5LH.js} +1 -1
- package/dist/chunks/{chunk-QO6JYDIW.js → chunk-L2A3COWV.js} +4 -4
- package/dist/chunks/{chunk-X7ZTM4XG.js → chunk-LJE7RZNC.js} +1 -1
- 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-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-OKUJY5YB.js → chunk-X6PMJQGO.js} +64 -21
- package/dist/chunks/{chunk-3NJQTG6X.js → chunk-XIBMZEDB.js} +2 -2
- package/dist/chunks/{conflict-CEXRX2KP.js → conflict-YW5BULJ3.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-5OBS3B3V.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-L65OWPFM.js} +3 -3
- package/dist/chunks/{env-SW6CTETI.js → env-XW7LYIME.js} +2 -2
- package/dist/chunks/{esb-FQASCY2H.js → esb-GSB5QCEX.js} +6 -6
- package/dist/chunks/{factory-ETQAICPA.js → factory-MHFZZAGH.js} +1 -1
- package/dist/chunks/{fna-FCLVIWAS.js → fna-XBSNUS2V.js} +4 -4
- package/dist/chunks/{group-chat-GTYMCBYS.js → group-chat-EEOLO5NM.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-JCBUR563.js} +1332 -1037
- 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-PCD5EPBF.js} +15 -15
- package/dist/chunks/{minute-doc-3IMRJDJV.js → minute-doc-WTZJVCHG.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-SMVTPK6T.js} +8 -7
- 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-FXBOGH2X.js → registry-3B3OAJYX.js} +4 -4
- package/dist/chunks/{registry-QRMXRSCT.js → registry-FTPUUHWC.js} +5 -5
- package/dist/chunks/{registry-PHPYTXS4.js → registry-ZQ7OONCB.js} +12 -12
- package/dist/chunks/{room-recommend-BKCPAXQG.js → room-recommend-73NBN3RU.js} +4 -4
- package/dist/chunks/{schedule-Q3MPSZV6.js → schedule-SDBOBBUQ.js} +4 -4
- package/dist/chunks/{smart-extract-TYYKC244.js → smart-extract-GTYKF5TJ.js} +4 -4
- package/dist/chunks/{workflow-GEDHALMY.js → workflow-OWHWLAOX.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/cache.js +49 -35
- package/dist/shortcuts/jiuchuanhui/host.js +109 -5
- package/dist/shortcuts/jiuchuanhui/index.js +43 -7
- package/dist/shortcuts/jiuchuanhui/manifest.js +138 -2
- package/dist/shortcuts/jiuchuanhui/operations/customer-quick.js +110 -0
- package/dist/shortcuts/jiuchuanhui/operations/datajson.js +11 -56
- package/dist/shortcuts/jiuchuanhui/operations/esb.js +9 -16
- package/dist/shortcuts/jiuchuanhui/operations/generic.js +8 -30
- package/dist/shortcuts/jiuchuanhui/operations/registry.js +8 -2
- package/dist/shortcuts/jiuchuanhui/operations/shared.js +0 -10
- package/dist/shortcuts/performance/operations/flow-detail.js +5 -4
- package/dist/shortcuts/reception/host.js +19 -5
- package/dist/shortcuts/workflow/index.js +55 -5
- package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +5 -2
- 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/docs/jiuchuanhui.md +17 -5
- 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/SKILL.md +49 -90
- package/skills/weaver-e10-jiuchuanhui/references/cache.md +17 -13
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +33 -4
- package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +3 -3
- package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +9 -7
- 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-performance/SKILL.md +2 -2
- package/skills/weaver-e10-performance/agents/openai.yaml +4 -2
- package/skills/weaver-e10-performance/references/flow-assess.md +19 -6
- 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 +2 -2
- 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-workflow/references/workflow-deep-read.md +8 -3
- package/skills/weaver-e10-ziguanjia/SKILL.md +1 -1
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +1 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CliError, ExitCode } from '../../core/errors.js';
|
|
2
|
-
import { E10_AUTH_REQUIRED_MESSAGE, E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE, E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE, E10_XIAOE_RECOVERY_FAILED_MESSAGE, } from './auth/messages.js';
|
|
2
|
+
import { E10_AUTH_REQUIRED_MESSAGE, E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE, E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE, E10_XIAOE_RECOVERY_FAILED_MESSAGE, E10_XIAOE_TLS_UNTRUSTED_MESSAGE, } from './auth/messages.js';
|
|
3
3
|
import { lastXiaoEFailure, summarizeXiaoEFailureKind, } from './auth/xiaoe.js';
|
|
4
4
|
import { appendXiaoEAuthErrorLog, xiaoEAuthLogSecrets } from './auth/error-log.js';
|
|
5
5
|
import { E10AuthSession, getActiveProfile } from './auth/session.js';
|
|
6
6
|
import { E10ApiClient } from './client.js';
|
|
7
|
+
import { isTlsTrustErrorCode, looksLikeTlsTrustMessage } from './network-error.js';
|
|
8
|
+
import { currentE10TlsPolicyStatus, summarizeE10TlsPolicy } from './tls-policy.js';
|
|
7
9
|
import { canAutomaticallyRecoverXiaoE, recoverXiaoEAuthSession, recoverXiaoEAuthSessionWithDiagnostics, } from './auth-recovery.js';
|
|
8
10
|
/**
|
|
9
11
|
* 把一次失败的静默恢复转成可定位的结构化错误。文案按归因分流:只有网络层
|
|
@@ -23,11 +25,27 @@ function xiaoEFailureForErrorDetails(failure) {
|
|
|
23
25
|
...(failure.httpStatus === undefined ? {} : { httpStatus: failure.httpStatus }),
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 失败链的最后一条是不是「证书不受信任」。
|
|
30
|
+
*
|
|
31
|
+
* 只看最后一条:前面的通道失败(例如 DNS 抖动)不代表最终结论,最后一条才说明
|
|
32
|
+
* 真正卡住的那一步。`causeCode` 与文案都看,是因为 Python 兼容路径只剩 stderr。
|
|
33
|
+
*/
|
|
34
|
+
function xiaoETlsTrustFailure(diagnostics) {
|
|
35
|
+
const last = lastXiaoEFailure(diagnostics);
|
|
36
|
+
if (!last)
|
|
37
|
+
return undefined;
|
|
38
|
+
return isTlsTrustErrorCode(last.causeCode) || looksLikeTlsTrustMessage(last.message)
|
|
39
|
+
? last
|
|
40
|
+
: undefined;
|
|
41
|
+
}
|
|
42
|
+
function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false, env = process.env) {
|
|
27
43
|
const failureKind = summarizeXiaoEFailureKind(diagnostics);
|
|
28
44
|
const lastFailure = lastXiaoEFailure(diagnostics);
|
|
29
45
|
const publicFailures = diagnostics?.failures?.map(xiaoEFailureForErrorDetails);
|
|
30
46
|
const networkUnavailable = failureKind === 'network';
|
|
47
|
+
// 证书不受信任也属「网络层没打通」,但重试不可能成功,必须换成「配 CA」的出口。
|
|
48
|
+
const tlsUntrusted = networkUnavailable && Boolean(xiaoETlsTrustFailure(diagnostics));
|
|
31
49
|
// Web sandboxes only have the platform credential channel. If the runtime
|
|
32
50
|
// marker survived but the host credential pair did not, asking the user to
|
|
33
51
|
// log in again is misleading: the sandbox launcher dropped the injection.
|
|
@@ -35,6 +53,7 @@ function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
|
|
|
35
53
|
&& diagnostics.platformCredentialDetected === false
|
|
36
54
|
&& diagnostics.attemptedSteps.includes('platform_token:missing')
|
|
37
55
|
&& diagnostics.attemptedSteps.includes('environment_map:empty');
|
|
56
|
+
const tlsPolicy = tlsUntrusted ? summarizeE10TlsPolicy(currentE10TlsPolicyStatus(env)) : undefined;
|
|
38
57
|
const details = diagnostics
|
|
39
58
|
? {
|
|
40
59
|
...(diagnostics.baseUrl ? { baseUrl: diagnostics.baseUrl } : {}),
|
|
@@ -47,19 +66,27 @@ function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
|
|
|
47
66
|
...(failureKind ? { errorKind: failureKind } : {}),
|
|
48
67
|
...(lastFailure ? { failureStage: lastFailure.stage } : {}),
|
|
49
68
|
...(publicFailures?.length ? { failures: publicFailures } : {}),
|
|
69
|
+
...(tlsPolicy ? { tls: tlsPolicy } : {}),
|
|
70
|
+
...(tlsPolicy && tlsPolicy.mode === 'custom-ca' && !tlsPolicy.applied
|
|
71
|
+
? { tlsHint: 'configured_ca_not_applied' }
|
|
72
|
+
: {}),
|
|
50
73
|
...(hostCredentialMissing ? { reason: 'host_credential_not_injected' } : {}),
|
|
51
74
|
...(resultSessionExpired ? { resultSessionExpired: true } : {}),
|
|
52
75
|
}
|
|
53
76
|
: undefined;
|
|
54
|
-
return Object.assign(new CliError(
|
|
55
|
-
?
|
|
56
|
-
:
|
|
57
|
-
?
|
|
58
|
-
:
|
|
77
|
+
return Object.assign(new CliError(tlsUntrusted
|
|
78
|
+
? E10_XIAOE_TLS_UNTRUSTED_MESSAGE
|
|
79
|
+
: networkUnavailable
|
|
80
|
+
? E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE
|
|
81
|
+
: hostCredentialMissing
|
|
82
|
+
? E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE
|
|
83
|
+
: E10_XIAOE_RECOVERY_FAILED_MESSAGE, ExitCode.AuthError), {
|
|
59
84
|
type: 'authentication',
|
|
60
|
-
subtype:
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
subtype: tlsUntrusted
|
|
86
|
+
? 'xiaoe_tls_untrusted'
|
|
87
|
+
: networkUnavailable ? 'xiaoe_network_unavailable' : 'xiaoe_credential_unavailable',
|
|
88
|
+
// 网络错误是可重试的;证书不可信、凭证缺失/被拒重试也一样失败,不能让调用方空转。
|
|
89
|
+
retryable: networkUnavailable && !tlsUntrusted,
|
|
63
90
|
stage: lastFailure?.stage || 'xiaoe_unified_login',
|
|
64
91
|
...(details ? { details } : {}),
|
|
65
92
|
});
|
|
@@ -76,7 +103,7 @@ export async function requireE10Session(ctx, load = {}) {
|
|
|
76
103
|
session = outcome?.session || null;
|
|
77
104
|
if (!session || session.isExpired()) {
|
|
78
105
|
const resultSessionExpired = session?.isExpired() === true;
|
|
79
|
-
const error = xiaoERecoveryFailedError(outcome?.diagnostics, resultSessionExpired);
|
|
106
|
+
const error = xiaoERecoveryFailedError(outcome?.diagnostics, resultSessionExpired, ctx.env);
|
|
80
107
|
if (resultSessionExpired) {
|
|
81
108
|
await appendXiaoEAuthErrorLog({
|
|
82
109
|
source: 'recovery',
|
|
@@ -97,7 +124,7 @@ export async function requireE10Session(ctx, load = {}) {
|
|
|
97
124
|
const outcome = await recoverXiaoEAuthSessionWithDiagnostics(ctx).catch(() => null);
|
|
98
125
|
session = outcome?.session || null;
|
|
99
126
|
if (!session) {
|
|
100
|
-
throw xiaoERecoveryFailedError(outcome?.diagnostics);
|
|
127
|
+
throw xiaoERecoveryFailedError(outcome?.diagnostics, false, ctx.env);
|
|
101
128
|
}
|
|
102
129
|
}
|
|
103
130
|
if (!session) {
|
|
@@ -34,6 +34,26 @@ const NETWORK_ERROR_CODES = new Set([
|
|
|
34
34
|
'ERR_TLS_CERT_ALTNAME_INVALID',
|
|
35
35
|
'ERR_SSL_WRONG_VERSION_NUMBER',
|
|
36
36
|
]);
|
|
37
|
+
/**
|
|
38
|
+
* 证书信任类错误码(OpenSSL/Node)。
|
|
39
|
+
*
|
|
40
|
+
* 这些码在 `NETWORK_ERROR_CODES` 里也算网络错误——确实没连通——但它们重试一万次
|
|
41
|
+
* 也不会好,提示「稍后重试」是误导。归因时单独拎出来,引导用户配 CA。
|
|
42
|
+
*/
|
|
43
|
+
const TLS_TRUST_ERROR_CODES = new Set([
|
|
44
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
45
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
46
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
|
|
47
|
+
'UNABLE_TO_GET_ISSUER_CERT',
|
|
48
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
49
|
+
'CERT_HAS_EXPIRED',
|
|
50
|
+
'CERT_NOT_YET_VALID',
|
|
51
|
+
'CERT_UNTRUSTED',
|
|
52
|
+
'CERT_REVOKED',
|
|
53
|
+
'ERR_TLS_CERT_ALTNAME_INVALID',
|
|
54
|
+
]);
|
|
55
|
+
/** Python 侧(`ssl.SSLCertVerificationError`)只有文本,没有 errno,只能按文案判。 */
|
|
56
|
+
const TLS_TRUST_MESSAGE_PATTERN = /certificate verify failed|self[- ]signed certificate|certificate (?:has )?expired|unable to (?:verify|get) (?:the )?(?:leaf|issuer|local issuer)|certificate chain/i;
|
|
37
57
|
/** `AbortController.abort()` 抛出的 DOMException 没有 errno,统一用这个码表示「超时」。 */
|
|
38
58
|
export const ABORT_ERROR_CODE = 'ABORT_ERR';
|
|
39
59
|
function asRecord(value) {
|
|
@@ -77,6 +97,14 @@ export function isAbortError(error) {
|
|
|
77
97
|
export function isNetworkErrorCode(code) {
|
|
78
98
|
return typeof code === 'string' && NETWORK_ERROR_CODES.has(code.toUpperCase());
|
|
79
99
|
}
|
|
100
|
+
/** 错误码是否属于「证书链不受信任」。 */
|
|
101
|
+
export function isTlsTrustErrorCode(code) {
|
|
102
|
+
return typeof code === 'string' && TLS_TRUST_ERROR_CODES.has(code.toUpperCase());
|
|
103
|
+
}
|
|
104
|
+
/** 文案是否在说证书不受信任(Node 的 `fetch failed` 与 Python 的 stderr 都可能只剩文案)。 */
|
|
105
|
+
export function looksLikeTlsTrustMessage(message) {
|
|
106
|
+
return TLS_TRUST_MESSAGE_PATTERN.test(message);
|
|
107
|
+
}
|
|
80
108
|
/** undici 把底层原因藏起来时只剩这句话,但语义已经很明确了。 */
|
|
81
109
|
const TRANSPORT_MESSAGE_PATTERN = /fetch failed|socket hang up|other side closed|network|connection (?:refused|reset|closed)|timed? ?out|timeout|certificate|getaddrinfo|dns lookup/i;
|
|
82
110
|
export function looksLikeTransportMessage(message) {
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import * as tls from 'node:tls';
|
|
5
|
+
/**
|
|
6
|
+
* E10 网关 TLS 信任策略。
|
|
7
|
+
*
|
|
8
|
+
* 背景:内网网关(如小 e 沙箱里的 `qll-nginx`)常用自签名证书或私有 CA 签发,
|
|
9
|
+
* Node 与 Python 的默认根证书池都不认,换票请求会直接死在
|
|
10
|
+
* `SELF_SIGNED_CERT_IN_CHAIN`。CLI 必须提供一条**显式**的信任入口,
|
|
11
|
+
* 而不是关掉校验——换票请求的 `Authorization` 头里就是平台票据。
|
|
12
|
+
*
|
|
13
|
+
* 入口只有一个环境变量:`WEAVER_E10_CA_FILE`(逗号分隔可给多份 PEM 路径)。
|
|
14
|
+
* - Node ≥ 22.15:运行时把 PEM 追加进进程默认 CA 池(`tls.setDefaultCACertificates`),
|
|
15
|
+
* 对全局 `fetch`(undici)与 `https.Agent` 同时生效,业务请求也一起受益;
|
|
16
|
+
* - 更低版本:Node 没有运行时入口,只能引导调用方用 `NODE_EXTRA_CA_CERTS` 启动;
|
|
17
|
+
* - Python 兼容脚本:子进程注入 `SSL_CERT_FILE` / `REQUESTS_CA_BUNDLE`。
|
|
18
|
+
*/
|
|
19
|
+
export const E10_TLS_CA_FILE_ENV = 'WEAVER_E10_CA_FILE';
|
|
20
|
+
/** 历史命名,保留为别名,便于与 `WEAVER_XIAOE_*` 一族对齐。 */
|
|
21
|
+
export const E10_TLS_CA_FILE_ALIASES = ['WEAVER_XIAOE_CA_FILE'];
|
|
22
|
+
/**
|
|
23
|
+
* 排障用的逃生开关:设成 `1` / `true` / `yes` / `on` 时本进程**不再校验证书**。
|
|
24
|
+
*
|
|
25
|
+
* 优先级高于 `WEAVER_E10_CA_FILE`:显式要求跳过就不必再配 CA。只影响当前进程
|
|
26
|
+
* (通过 `NODE_TLS_REJECT_UNAUTHORIZED`,Node 的 `fetch`/undici 会在建连时读取),
|
|
27
|
+
* 不会写进任何持久化配置。关闭校验期间 `Authorization` 里的平台票据可被中间人截获,
|
|
28
|
+
* 所以只用于确认「是不是证书问题」,确认完立刻去掉。
|
|
29
|
+
*/
|
|
30
|
+
export const E10_TLS_INSECURE_ENV = 'WEAVER_E10_TLS_INSECURE';
|
|
31
|
+
const INSECURE_VALUES = new Set(['1', 'true', 'yes', 'on']);
|
|
32
|
+
const PEM_MARKER = 'BEGIN CERTIFICATE';
|
|
33
|
+
/**
|
|
34
|
+
* 逗号分隔而不是 `path.delimiter`:Windows 的盘符冒号与 POSIX 的 `:` 分隔符
|
|
35
|
+
* 在同一个环境变量里会互相打架,逗号是唯一两边都安全的写法。
|
|
36
|
+
*/
|
|
37
|
+
export function readE10TlsCaFilePaths(env = process.env) {
|
|
38
|
+
const raw = [E10_TLS_CA_FILE_ENV, ...E10_TLS_CA_FILE_ALIASES]
|
|
39
|
+
.map((key) => env[key])
|
|
40
|
+
.filter((value) => typeof value === 'string' && value.trim().length > 0)
|
|
41
|
+
.join(',');
|
|
42
|
+
const paths = [];
|
|
43
|
+
for (const candidate of raw.split(/[,\n]/u)) {
|
|
44
|
+
const trimmed = candidate.trim();
|
|
45
|
+
if (!trimmed)
|
|
46
|
+
continue;
|
|
47
|
+
const absolute = resolve(expandHome(trimmed));
|
|
48
|
+
if (!paths.includes(absolute))
|
|
49
|
+
paths.push(absolute);
|
|
50
|
+
}
|
|
51
|
+
return paths;
|
|
52
|
+
}
|
|
53
|
+
function expandHome(value) {
|
|
54
|
+
if (value === '~')
|
|
55
|
+
return homedir();
|
|
56
|
+
if (value.startsWith('~/'))
|
|
57
|
+
return resolve(homedir(), value.slice(2));
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
export function isE10TlsInsecureEnabled(env = process.env) {
|
|
61
|
+
const raw = env[E10_TLS_INSECURE_ENV];
|
|
62
|
+
return typeof raw === 'string' && INSECURE_VALUES.has(raw.trim().toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 读取并校验配置的 CA 文件。刻意不抛异常:配置写错不应该让所有命令起不来,
|
|
66
|
+
* 应该在真正遇到证书错误时把 `error` 一起报给用户。
|
|
67
|
+
*/
|
|
68
|
+
export function resolveE10TlsPolicy(env = process.env) {
|
|
69
|
+
const configuredFiles = readE10TlsCaFilePaths(env);
|
|
70
|
+
// 调用方自己设了 `NODE_TLS_REJECT_UNAUTHORIZED=0` 也算跳过校验:诊断不能声称在验证证书。
|
|
71
|
+
const insecureSource = isE10TlsInsecureEnabled(env)
|
|
72
|
+
? 'flag'
|
|
73
|
+
: env.NODE_TLS_REJECT_UNAUTHORIZED === '0' ? 'node-env' : undefined;
|
|
74
|
+
if (insecureSource) {
|
|
75
|
+
// 跳过校验时不再需要 CA;两个都配时以「显式跳过」为准,诊断里会看到 mode=insecure。
|
|
76
|
+
return { mode: 'insecure', configuredFiles, caFiles: [], ca: [], insecureSource };
|
|
77
|
+
}
|
|
78
|
+
if (!configuredFiles.length) {
|
|
79
|
+
return { mode: 'system', configuredFiles: [], caFiles: [], ca: [] };
|
|
80
|
+
}
|
|
81
|
+
const ca = [];
|
|
82
|
+
const caFiles = [];
|
|
83
|
+
const problems = [];
|
|
84
|
+
for (const file of configuredFiles) {
|
|
85
|
+
try {
|
|
86
|
+
if (!existsSync(file)) {
|
|
87
|
+
problems.push(`${file}: 文件不存在`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const text = readFileSync(file, 'utf8');
|
|
91
|
+
if (!text.includes(PEM_MARKER)) {
|
|
92
|
+
problems.push(`${file}: 不是 PEM 证书(缺少 ${PEM_MARKER})`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
ca.push(text);
|
|
96
|
+
caFiles.push(file);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
problems.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
mode: 'custom-ca',
|
|
104
|
+
configuredFiles,
|
|
105
|
+
caFiles,
|
|
106
|
+
ca,
|
|
107
|
+
...(problems.length ? { error: problems.join(';') } : {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
let cachedStatus;
|
|
111
|
+
let cachedKey = '';
|
|
112
|
+
function policyKey(policy) {
|
|
113
|
+
return [policy.mode, policy.caFiles.join(','), policy.ca.length, policy.error || ''].join('|');
|
|
114
|
+
}
|
|
115
|
+
let insecureWarningEmitted = false;
|
|
116
|
+
/**
|
|
117
|
+
* 关掉本进程的证书校验。
|
|
118
|
+
*
|
|
119
|
+
* `NODE_TLS_REJECT_UNAUTHORIZED=0` 是 Node 里唯一能同时覆盖 `https.request` 与
|
|
120
|
+
* 全局 `fetch`(undici 在建连时读取它)的开关;代价是**进程级**的,所以必须由
|
|
121
|
+
* 用户显式设置 `WEAVER_E10_TLS_INSECURE=1`,并在 stderr 留一条可见警告。
|
|
122
|
+
*/
|
|
123
|
+
function applyInsecure(policy) {
|
|
124
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
125
|
+
// 调用方本来就设了的话 Node 自己会打警告,不重复刷一条。
|
|
126
|
+
if (policy.insecureSource === 'flag' && !insecureWarningEmitted) {
|
|
127
|
+
insecureWarningEmitted = true;
|
|
128
|
+
process.stderr.write('[weaver-work-cli] 警告:已按 WEAVER_E10_TLS_INSECURE 关闭 TLS 证书校验,'
|
|
129
|
+
+ '仅用于排查证书问题;换票请求会携带平台票据,确认后请立即取消该变量。\n');
|
|
130
|
+
}
|
|
131
|
+
return { ...policy, applied: true };
|
|
132
|
+
}
|
|
133
|
+
function applyUncached(policy) {
|
|
134
|
+
if (policy.mode === 'insecure')
|
|
135
|
+
return applyInsecure(policy);
|
|
136
|
+
if (policy.mode !== 'custom-ca' || !policy.ca.length) {
|
|
137
|
+
return { ...policy, applied: false, notAppliedReason: 'no-custom-ca' };
|
|
138
|
+
}
|
|
139
|
+
const runtime = tls;
|
|
140
|
+
if (typeof runtime.setDefaultCACertificates !== 'function') {
|
|
141
|
+
return { ...policy, applied: false, notAppliedReason: 'unsupported-runtime' };
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const existing = typeof runtime.getCACertificates === 'function'
|
|
145
|
+
? runtime.getCACertificates('default')
|
|
146
|
+
: [];
|
|
147
|
+
// 追加而不是替换:平台自己的证书链之外,公网域(如 weapp.eteams.cn)仍要能验。
|
|
148
|
+
runtime.setDefaultCACertificates([...existing, ...policy.ca]);
|
|
149
|
+
return { ...policy, applied: true };
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
// `setDefaultCACertificates` 是整批生效的:一份坏 PEM(截断、混入说明文字)会让
|
|
153
|
+
// 其余证书一起失效。逐个重试,能用的保留,坏的单独报出来。
|
|
154
|
+
return applyPerFile(runtime, policy, error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function applyPerFile(runtime, policy, batchError) {
|
|
158
|
+
const setter = runtime.setDefaultCACertificates;
|
|
159
|
+
let existing = [];
|
|
160
|
+
try {
|
|
161
|
+
existing = typeof runtime.getCACertificates === 'function' ? runtime.getCACertificates('default') : [];
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
existing = [];
|
|
165
|
+
}
|
|
166
|
+
const acceptedCa = [];
|
|
167
|
+
const acceptedFiles = [];
|
|
168
|
+
const rejectedFiles = [];
|
|
169
|
+
for (let index = 0; index < policy.ca.length; index += 1) {
|
|
170
|
+
const pem = policy.ca[index];
|
|
171
|
+
const file = policy.caFiles[index];
|
|
172
|
+
try {
|
|
173
|
+
setter([...existing, ...acceptedCa, pem]);
|
|
174
|
+
acceptedCa.push(pem);
|
|
175
|
+
if (file)
|
|
176
|
+
acceptedFiles.push(file);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
rejectedFiles.push(file || `#${index + 1}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!acceptedCa.length) {
|
|
183
|
+
return {
|
|
184
|
+
...policy,
|
|
185
|
+
applied: false,
|
|
186
|
+
notAppliedReason: 'failed',
|
|
187
|
+
applyError: batchError instanceof Error ? batchError.message : String(batchError),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
...policy,
|
|
192
|
+
caFiles: acceptedFiles,
|
|
193
|
+
ca: acceptedCa,
|
|
194
|
+
applied: true,
|
|
195
|
+
...(rejectedFiles.length ? { error: `以下 CA 文件无法加入信任链:${rejectedFiles.join('、')}` } : {}),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 把 `WEAVER_E10_CA_FILE` 指向的 CA 注入进程默认信任链。
|
|
200
|
+
*
|
|
201
|
+
* 幂等且按配置缓存:同一个 `env` 反复调用只注入一次(`setDefaultCACertificates`
|
|
202
|
+
* 每次都会重建默认证书池,重复调用没有必要)。调用点有两处——CLI 入口(覆盖
|
|
203
|
+
* 全部业务请求)与统一登录(覆盖被当作库调用的场景)。
|
|
204
|
+
*/
|
|
205
|
+
export function applyE10TlsPolicy(env = process.env) {
|
|
206
|
+
const policy = resolveE10TlsPolicy(env);
|
|
207
|
+
const key = policyKey(policy);
|
|
208
|
+
if (cachedStatus && cachedKey === key)
|
|
209
|
+
return cachedStatus;
|
|
210
|
+
cachedStatus = applyUncached(policy);
|
|
211
|
+
cachedKey = key;
|
|
212
|
+
return cachedStatus;
|
|
213
|
+
}
|
|
214
|
+
/** 最近一次解析/注入的结果(诊断上报用)。配置变了会重新解析,不会拿到上一个环境的陈旧结论。 */
|
|
215
|
+
export function currentE10TlsPolicyStatus(env = process.env) {
|
|
216
|
+
const policy = resolveE10TlsPolicy(env);
|
|
217
|
+
if (cachedStatus && cachedKey === policyKey(policy))
|
|
218
|
+
return cachedStatus;
|
|
219
|
+
return applyE10TlsPolicy(env);
|
|
220
|
+
}
|
|
221
|
+
export function summarizeE10TlsPolicy(status) {
|
|
222
|
+
const summary = {
|
|
223
|
+
mode: status.mode,
|
|
224
|
+
caFiles: status.caFiles,
|
|
225
|
+
applied: status.applied,
|
|
226
|
+
};
|
|
227
|
+
if (!status.applied && status.notAppliedReason)
|
|
228
|
+
summary.notAppliedReason = status.notAppliedReason;
|
|
229
|
+
if (status.error)
|
|
230
|
+
summary.error = status.error;
|
|
231
|
+
if (status.mode === 'insecure' && status.insecureSource)
|
|
232
|
+
summary.insecureSource = status.insecureSource;
|
|
233
|
+
return summary;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Python 兼容脚本只认自己的信任链:把它能理解的两个变量补进子进程环境。
|
|
237
|
+
* 调用方显式设置过就尊重调用方(可能是平台统一的证书入口)。
|
|
238
|
+
*/
|
|
239
|
+
export function e10TlsChildEnv(env = process.env) {
|
|
240
|
+
const policy = resolveE10TlsPolicy(env);
|
|
241
|
+
if (policy.mode === 'insecure') {
|
|
242
|
+
// `NODE_TLS_REJECT_UNAUTHORIZED` 对 Python 无效,脚本自己认这个开关。
|
|
243
|
+
return { ...env, [E10_TLS_INSECURE_ENV]: '1' };
|
|
244
|
+
}
|
|
245
|
+
if (policy.mode !== 'custom-ca' || !policy.caFiles.length)
|
|
246
|
+
return env;
|
|
247
|
+
const bundle = policy.caFiles[0];
|
|
248
|
+
const next = { ...env };
|
|
249
|
+
if (!next.SSL_CERT_FILE)
|
|
250
|
+
next.SSL_CERT_FILE = bundle;
|
|
251
|
+
if (!next.REQUESTS_CA_BUNDLE)
|
|
252
|
+
next.REQUESTS_CA_BUNDLE = bundle;
|
|
253
|
+
return next;
|
|
254
|
+
}
|
|
255
|
+
/** 测试用:清掉模块级缓存。 */
|
|
256
|
+
export function resetE10TlsPolicyCache() {
|
|
257
|
+
cachedStatus = undefined;
|
|
258
|
+
cachedKey = '';
|
|
259
|
+
insecureWarningEmitted = false;
|
|
260
|
+
}
|
|
@@ -41,6 +41,39 @@ export const ziguanjiaViewLink = {
|
|
|
41
41
|
sceneFormTags: VIEW_LINK_SCENE_TAGS,
|
|
42
42
|
};
|
|
43
43
|
export const ziguanjiaFixed = { EB_INTERFACE_PK, ES_UNIQUE_INDENT, VIEW_LINK_SCENE_TAGS, DEPRE_VIEWPORT_PATH };
|
|
44
|
+
/**
|
|
45
|
+
* 每条 operation 的一句话用途,写入 schema 的 summary。
|
|
46
|
+
*
|
|
47
|
+
* 口径:只描述「做什么 + 关键入参 + 是否写库」,不写未在实现里体现的业务承诺;
|
|
48
|
+
* prepare/apply 成对出现时,prepare 标注「只出预览,不写入」,apply 标注「落库前需确认」。
|
|
49
|
+
*/
|
|
50
|
+
const OPERATION_SUMMARIES = {
|
|
51
|
+
'asset.gate.check': '资产模块版本门禁:确认当前租户的资产应用可用与版本匹配(无入参)',
|
|
52
|
+
'asset.list': '分页查询资产台账;可按资产名称/编号/状态/类型/地点/管理人/使用人过滤',
|
|
53
|
+
'asset.detail': '按 id、资产编号或名称查资产详情(三者至少给一个);可附带查看链接',
|
|
54
|
+
'asset.uselist': '分页查询资产领用记录;缺省查当前登录人的领用单',
|
|
55
|
+
'asset.repaillist': '分页查询资产报修记录;缺省查当前登录人的报修单',
|
|
56
|
+
'asset.purchaselist': '分页查询资产采购申请记录;可按领用人/采购人过滤',
|
|
57
|
+
'asset.resolve.location': '按地点名称解析存放地点 ID(建资产/查询前先解析)',
|
|
58
|
+
'asset.resolve.status': '按状态名称解析资产状态 ID',
|
|
59
|
+
'asset.resolve.type': '按类型名称解析资产类型 ID',
|
|
60
|
+
'asset.create': '新建资产台账记录(高风险写操作,会落库);入参 asset_name/asset_type_browse',
|
|
61
|
+
'asset.update': '修改资产台账记录(高风险写操作,会落库);入参 id 或 asset_number + changes',
|
|
62
|
+
'asset.use': '发起资产领用(高风险写操作,会落库);入参 detail1 与领用信息',
|
|
63
|
+
'asset.return.query': '领用退回前的校验查询:确认该领用单可退回(只读,不写入)',
|
|
64
|
+
'asset.return.create': '提交资产退回(高风险写操作,会落库);入参 data_ids',
|
|
65
|
+
'asset.repair.query': '报修前的校验查询:确认该资产可报修(只读,不写入)',
|
|
66
|
+
'asset.repair.create': '提交资产报修(高风险写操作,会落库);入参 repail_name/detail1',
|
|
67
|
+
'asset.purch': '发起资产采购申请(高风险写操作,会落库);入参 purchase_name/detail1',
|
|
68
|
+
'asset.depre': '发起资产折旧计提(高风险写操作,会落库);入参 calc_month/company_ids',
|
|
69
|
+
'asset.viewlink': '生成资产相关页面的查看链接;入参 scene/ids(可带 calc_month/anchor)',
|
|
70
|
+
};
|
|
71
|
+
function withSummaries(operations) {
|
|
72
|
+
return operations.map((item) => ({
|
|
73
|
+
...item,
|
|
74
|
+
summary: item.summary || OPERATION_SUMMARIES[item.name] || '',
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
44
77
|
export const ziguanjiaOperations = [
|
|
45
78
|
{
|
|
46
79
|
name: 'asset.gate.check',
|
|
@@ -455,7 +488,7 @@ export const ziguanjiaManifest = {
|
|
|
455
488
|
host: 'e10-ziguanjia',
|
|
456
489
|
status: 'builtin',
|
|
457
490
|
sourceSkill: 'weaver-e10-ziguanjia',
|
|
458
|
-
operations: ziguanjiaOperations,
|
|
491
|
+
operations: withSummaries(ziguanjiaOperations),
|
|
459
492
|
withheldOperations: [
|
|
460
493
|
{
|
|
461
494
|
name: 'asset.transfer',
|
|
@@ -771,6 +771,171 @@ const contractCustomerOperationContracts = [
|
|
|
771
771
|
}, ['searchValue', 'workflowId']),
|
|
772
772
|
},
|
|
773
773
|
];
|
|
774
|
+
/**
|
|
775
|
+
* 每条 operation 的一句话用途,写入 schema 的 summary。
|
|
776
|
+
*
|
|
777
|
+
* 口径:只描述「做什么 + 关键入参 + 是否写库」,不写未在实现里体现的业务承诺;
|
|
778
|
+
* prepare/apply 成对出现时,prepare 标注「只出预览,不写入」,apply 标注「落库前需确认」。
|
|
779
|
+
*/
|
|
780
|
+
const OPERATION_SUMMARIES = {
|
|
781
|
+
'contract.type.tree': '合同类型组织树:取全部合同类型节点(含层级与类型 ID),用于选择合同类型、挂载条款或流程',
|
|
782
|
+
'contract.modeltext.list': '分页查询合同正文模板列表(eBuilder 表单数据,按 pageNo/pageSize 翻页)',
|
|
783
|
+
'contract.clause.tree': '条款分类树:取条款目录节点(含层级),用于按分类浏览条款',
|
|
784
|
+
'contract.clause.list': '分页查询条款列表;可按条款名称/编号/状态/分组/合同类型/组织过滤,返回条款概要',
|
|
785
|
+
'contract.clause.group.list': '分页查询条款分组列表;可按条款名称/编号/状态/合同类型过滤',
|
|
786
|
+
'contract.clause.search': '按关键词/标签检索条款正文(getClauses);支持 id/title/tagId/group 过滤与分页',
|
|
787
|
+
'contract.clause.tags': '取条款标签字典(label↔value),用于条款搜索与筛选',
|
|
788
|
+
'contract.clause.reference.get': '查询某份合同文件已引用的条款(按 fileId/requestId 过滤,可按引用对象类型与时间范围收窄)',
|
|
789
|
+
'contract.clause.reference.save.prepare': '准备保存条款引用(只出预览,不写入);入参 clauseIds/fileId/requestId',
|
|
790
|
+
'contract.clause.reference.save.apply': '提交保存条款引用(落库前需确认);入参 clauseIds/fileId/requestId + continuation + confirm',
|
|
791
|
+
'contract.subject.app': '按标签取 eBuilder 应用 ID 列表(签约主体数据所在应用)',
|
|
792
|
+
'contract.subject.form': '按 appId + tag 取签约主体的表单(对象)定义',
|
|
793
|
+
'contract.subject.fields': '取签约主体表单的字段元数据(用于确定可写字段与字段类型)',
|
|
794
|
+
'contract.subject.options': '取签约主体表单某字段的选项字典(id↔name)',
|
|
795
|
+
'contract.subject.query': '分页查询签约主体数据(按 objId/mainTable,可带明细)',
|
|
796
|
+
'contract.subject.create.prepare': '准备新建签约主体(只出预览,不写入);入参 objId/mainTable',
|
|
797
|
+
'contract.subject.create.apply': '提交新建签约主体(落库前需确认);入参 objId/mainTable + continuation + confirm',
|
|
798
|
+
'contract.workflow.query': '按流程名查合同流程定义基础信息(含类型与启用状态)',
|
|
799
|
+
'contract.workflow.list': '按 wfpCode 查当前用户可发起的合同流程列表',
|
|
800
|
+
'contract.workflow.form.info': '取流程发起页的基础参数(表单与节点初始化信息)',
|
|
801
|
+
'contract.workflow.field.options': '取流程表单某字段的选项值(浏览按钮类字段,分页)',
|
|
802
|
+
'contract.request.create.prepare': '准备新建合同流程(只出预览,不写入);入参 workflowId/requestname/formData',
|
|
803
|
+
'contract.request.create.apply': '提交新建合同流程(落库前需确认);入参 workflowId/requestname/formData + continuation + confirm',
|
|
804
|
+
'contract.request.save.prepare': '准备保存流程表单草稿(只出预览,不写入);入参 requestId/workflowId/formData',
|
|
805
|
+
'contract.request.save.apply': '提交保存流程表单草稿(落库前需确认);入参 requestId/workflowId/formData + continuation + confirm',
|
|
806
|
+
'contract.request.submit.prepare': '准备提交流程(只出预览,不写入);入参 requestId',
|
|
807
|
+
'contract.request.submit.apply': '提交流程(落库前需确认);入参 requestId + continuation + confirm',
|
|
808
|
+
'contract.request.supervise.prepare': '准备流程督办(只出预览,不写入);入参 requestId/remark',
|
|
809
|
+
'contract.request.supervise.apply': '提交流程督办(落库前需确认);入参 requestId/remark + continuation + confirm',
|
|
810
|
+
'contract.request.status': '按 requestId 查流程当前状态(当前节点与处理人)',
|
|
811
|
+
'contract.request.log': '按 requestId 查流程流转日志与签字意见',
|
|
812
|
+
'contract.review.export': '导出合同 AI 审查记录(按 fileId/flowId)',
|
|
813
|
+
'contract.review.digest': '汇总合同 AI 审查结果摘要(可按通过项、是否附原文过滤)',
|
|
814
|
+
'contract.flow.page': '按流程名取合同流程页面地址(供打开或跳转)',
|
|
815
|
+
'contract.flow.upload-field': '取流程附件上传字段定义(含字段 ID 与表单 ID)',
|
|
816
|
+
'contract.flow.launch': '上传本地文件并拉起合同流程发起页;入参 flow/path/fileName',
|
|
817
|
+
'contract.flow.save-recognize-record': '把 AI 识别结果保存到流程附件字段(写操作,会落库识别记录)',
|
|
818
|
+
'contract.recommend.doc': '按文本内容推荐合同正文模板',
|
|
819
|
+
'contract.compare.upload': '校验待比对的本地文件可上传(preUploadCheck,只校验不落库)',
|
|
820
|
+
'contract.compare.search': '按关键词检索可参与比对的文档(文档中心)',
|
|
821
|
+
'contract.compare.versions': '取某文档的历史版本列表(按 fileId/docId 分页)',
|
|
822
|
+
'contract.compare.page': '生成两版本比对的页面地址(供打开比对页)',
|
|
823
|
+
'contract.compare.diff': '取两份文件的 AI 比对差异结果(按 baseFileId/compareFileId)',
|
|
824
|
+
'contract.compare.report': '生成合同比对报告并写到本地文件;入参 files/baseFileId/compareFileId/out',
|
|
825
|
+
'contract.credit.page': '按企业名称生成征信查询页面地址(打开外部征信页)',
|
|
826
|
+
'contract.clause.permission': '查询当前用户对条款组件的操作权限(能否新增/修改/删除)',
|
|
827
|
+
'contract.clause.types': '取全部条款类型(queryAllCluseType),用于条款归属分类',
|
|
828
|
+
'contract.clause.check': '校验条款名称在同一归属下是否重复(按 clauseName/belongId)',
|
|
829
|
+
'contract.clause.browser': '按名称检索条款浏览按钮候选(表单选条款时用)',
|
|
830
|
+
'contract.clause.subcompany': '按名称检索分部/子公司浏览按钮候选(表单选组织时用)',
|
|
831
|
+
'contract.clause.category.create.prepare': '准备新建条款分类(只出预览,不写入);入参 clauseName/parentId',
|
|
832
|
+
'contract.clause.category.create.apply': '提交新建条款分类(落库前需确认);入参 clauseName/parentId + continuation + confirm',
|
|
833
|
+
'contract.clause.category.update.prepare': '准备修改条款分类(只出预览,不写入);入参 id',
|
|
834
|
+
'contract.clause.category.update.apply': '提交修改条款分类(落库前需确认);入参 id + continuation + confirm',
|
|
835
|
+
'contract.clause.category.delete.prepare': '准备删除条款分类(只出预览,不写入);入参 id',
|
|
836
|
+
'contract.clause.category.delete.apply': '提交删除条款分类(落库前需确认);入参 id + continuation + confirm',
|
|
837
|
+
'contract.clause.insert': '把条款清单插入本地 Word 模板并另存;入参 path/out/clauses(写本地文件)',
|
|
838
|
+
'contract.clause.create.prepare': '准备新建条款(只出预览,不写入);入参 clauseName/clauseContent/belongId',
|
|
839
|
+
'contract.clause.create.apply': '提交新建条款(落库前需确认);入参 clauseName/clauseContent/belongId + continuation + confirm',
|
|
840
|
+
'contract.clause.update.prepare': '准备修改条款(只出预览,不写入);入参 id',
|
|
841
|
+
'contract.clause.update.apply': '提交修改条款(落库前需确认);入参 id + continuation + confirm',
|
|
842
|
+
'contract.clause.delete.prepare': '准备删除条款(只出预览,不写入);入参 id',
|
|
843
|
+
'contract.clause.delete.apply': '提交删除条款(落库前需确认);入参 id + continuation + confirm',
|
|
844
|
+
'contract.clause.group.create.prepare': '准备新建条款分组(只出预览,不写入);入参 clauseName/belongId',
|
|
845
|
+
'contract.clause.group.create.apply': '提交新建条款分组(落库前需确认);入参 clauseName/belongId + continuation + confirm',
|
|
846
|
+
'contract.clause.group.update.prepare': '准备修改条款分组(只出预览,不写入);入参 id',
|
|
847
|
+
'contract.clause.group.update.apply': '提交修改条款分组(落库前需确认);入参 id + continuation + confirm',
|
|
848
|
+
'contract.clause.group.delete.prepare': '准备删除条款分组(只出预览,不写入);入参 id',
|
|
849
|
+
'contract.clause.group.delete.apply': '提交删除条款分组(落库前需确认);入参 id + continuation + confirm',
|
|
850
|
+
'contract.customer.browser': '在流程表单中检索客户浏览按钮候选(按 searchValue 与字段)',
|
|
851
|
+
'contract.assistant.init': '取合同助手初始化配置(全部 eBuilder 配置项)',
|
|
852
|
+
'contract.assistant.meta': '取合同助手基础元数据(可用类型与标识)',
|
|
853
|
+
'contract.assistant.list': '按名称分页查询合同助手列表',
|
|
854
|
+
'contract.assistant.doc.query': '按 ai_id 查合同助手关联的文档配置',
|
|
855
|
+
'contract.assistant.config.query': '按 ai_id/aiMark 查合同助手的能力配置',
|
|
856
|
+
'contract.assistant.tips.query': '按 ai_id 查合同助手的提示语配置',
|
|
857
|
+
'contract.assistant.doc.folder.search': '检索文档中心文件夹浏览按钮候选(配置助手文档范围时用)',
|
|
858
|
+
'contract.assistant.keygroup.search': '检索合同要点分组浏览按钮候选',
|
|
859
|
+
'contract.assistant.rule.classification.list': '查询合同助手的分类规则列表',
|
|
860
|
+
'contract.assistant.rule.list': '按 flid 分页查询合同助手规则',
|
|
861
|
+
'contract.assistant.rule.group.query': '按 config_id 查自定义规则分组配置',
|
|
862
|
+
'contract.assistant.element.query': '按 config_id 查要素规则配置',
|
|
863
|
+
'contract.assistant.flow.list': '按 ai_id 分页查询合同助手绑定的流程',
|
|
864
|
+
'contract.assistant.create.prepare': '准备新建合同助手(只出预览,不写入);入参 ai_name/type',
|
|
865
|
+
'contract.assistant.create.apply': '提交新建合同助手(落库前需确认);入参 ai_name/type + continuation + confirm',
|
|
866
|
+
'contract.assistant.delete.prepare': '准备删除合同助手(只出预览,不写入);入参 ids',
|
|
867
|
+
'contract.assistant.delete.apply': '提交删除合同助手(落库前需确认);入参 ids + continuation + confirm',
|
|
868
|
+
'contract.assistant.doc.save.prepare': '准备保存合同助手文档配置(只出预览,不写入);入参 kind/ai_id',
|
|
869
|
+
'contract.assistant.doc.save.apply': '提交保存合同助手文档配置(落库前需确认);入参 kind/ai_id + continuation + confirm',
|
|
870
|
+
'contract.assistant.agent.update.prepare': '准备修改合同助手智能体配置(只出预览,不写入);入参 id/ai_id',
|
|
871
|
+
'contract.assistant.agent.update.apply': '提交修改合同助手智能体配置(落库前需确认);入参 id/ai_id + continuation + confirm',
|
|
872
|
+
'contract.assistant.tips.create.prepare': '准备新增合同助手提示语(只出预览,不写入);入参 tsynr/ai_id',
|
|
873
|
+
'contract.assistant.tips.create.apply': '提交新增合同助手提示语(落库前需确认);入参 tsynr/ai_id + continuation + confirm',
|
|
874
|
+
'contract.assistant.tips.delete.prepare': '准备删除合同助手提示语(只出预览,不写入);入参 ids/ai_id',
|
|
875
|
+
'contract.assistant.tips.delete.apply': '提交删除合同助手提示语(落库前需确认);入参 ids/ai_id + continuation + confirm',
|
|
876
|
+
'contract.assistant.rule.classification.create.prepare': '准备新建分类规则(只出预览,不写入);入参 htlx/htlxlabelid',
|
|
877
|
+
'contract.assistant.rule.classification.create.apply': '提交新建分类规则(落库前需确认);入参 htlx/htlxlabelid + continuation + confirm',
|
|
878
|
+
'contract.assistant.rule.classification.update.prepare': '准备修改分类规则(只出预览,不写入);入参 id/htlx',
|
|
879
|
+
'contract.assistant.rule.classification.update.apply': '提交修改分类规则(落库前需确认);入参 id/htlx + continuation + confirm',
|
|
880
|
+
'contract.assistant.rule.classification.delete.prepare': '准备删除分类规则(只出预览,不写入);入参 id',
|
|
881
|
+
'contract.assistant.rule.classification.delete.apply': '提交删除分类规则(落库前需确认);入参 id + continuation + confirm',
|
|
882
|
+
'contract.assistant.rule.create.prepare': '准备新建审查规则(只出预览,不写入);入参 gzmc/rule_content/flid',
|
|
883
|
+
'contract.assistant.rule.create.apply': '提交新建审查规则(落库前需确认);入参 gzmc/rule_content/flid + continuation + confirm',
|
|
884
|
+
'contract.assistant.rule.update.prepare': '准备修改审查规则(只出预览,不写入);入参 id/gzmc',
|
|
885
|
+
'contract.assistant.rule.update.apply': '提交修改审查规则(落库前需确认);入参 id/gzmc + continuation + confirm',
|
|
886
|
+
'contract.assistant.rule.delete.prepare': '准备删除审查规则(只出预览,不写入);入参 ids',
|
|
887
|
+
'contract.assistant.rule.delete.apply': '提交删除审查规则(落库前需确认);入参 ids + continuation + confirm',
|
|
888
|
+
'contract.assistant.rule.group.create.prepare': '准备新建自定义规则分组(只出预览,不写入);入参 rule_flag/config_id',
|
|
889
|
+
'contract.assistant.rule.group.create.apply': '提交新建自定义规则分组(落库前需确认);入参 rule_flag/config_id + continuation + confirm',
|
|
890
|
+
'contract.assistant.rule.group.update.prepare': '准备修改自定义规则分组(只出预览,不写入);入参 id/rule_flag',
|
|
891
|
+
'contract.assistant.rule.group.update.apply': '提交修改自定义规则分组(落库前需确认);入参 id/rule_flag + continuation + confirm',
|
|
892
|
+
'contract.assistant.rule.group.delete.prepare': '准备删除自定义规则分组(只出预览,不写入);入参 ids/config_id',
|
|
893
|
+
'contract.assistant.rule.group.delete.apply': '提交删除自定义规则分组(落库前需确认);入参 ids/config_id + continuation + confirm',
|
|
894
|
+
'contract.assistant.element.create.prepare': '准备新增要素规则(只出预览,不写入);入参 element_name/config_id',
|
|
895
|
+
'contract.assistant.element.create.apply': '提交新增要素规则(落库前需确认);入参 element_name/config_id + continuation + confirm',
|
|
896
|
+
'contract.assistant.element.delete.prepare': '准备删除要素规则(只出预览,不写入);入参 ids/config_id',
|
|
897
|
+
'contract.assistant.element.delete.apply': '提交删除要素规则(落库前需确认);入参 ids/config_id + continuation + confirm',
|
|
898
|
+
'contract.assistant.flow.save.prepare': '准备新增合同助手流程绑定(只出预览,不写入);入参 ai_id/flowId',
|
|
899
|
+
'contract.assistant.flow.save.apply': '提交新增合同助手流程绑定(落库前需确认);入参 ai_id/flowId + confirm',
|
|
900
|
+
'contract.assistant.flow.update.prepare': '准备修改合同助手流程绑定(只出预览,不写入);入参 id/ai_id',
|
|
901
|
+
'contract.assistant.flow.update.apply': '提交修改合同助手流程绑定(落库前需确认);入参 id/ai_id + confirm',
|
|
902
|
+
'contract.assistant.flow.delete.prepare': '准备删除合同助手流程绑定(只出预览,不写入);入参 ids/ai_id',
|
|
903
|
+
'contract.assistant.flow.delete.apply': '提交删除合同助手流程绑定(落库前需确认);入参 ids/ai_id + continuation + confirm',
|
|
904
|
+
'contract.performance.link': '按菜单/统计期间/时间字段生成履约报表查询链接',
|
|
905
|
+
'contract.performance.fields': '取履约报表菜单的可用字段(用于组装查询条件)',
|
|
906
|
+
'contract.performance.source.entry': '按数据来源与菜单解析履约数据的入口配置',
|
|
907
|
+
'contract.performance.menu.search': '按关键词检索当前用户有权限的履约报表菜单',
|
|
908
|
+
'contract.performance.list.init': '初始化履约列表(listInit:取列配置与筛选器定义)',
|
|
909
|
+
'contract.performance.list.filters': '取履约列表的筛选器定义(可含字段元数据)',
|
|
910
|
+
'contract.performance.list.query': '查询履约列表数据(按搜索字段/条件/分页,支持多页翻取)',
|
|
911
|
+
'contract.performance.receipt.query': '按合同编号批量查询履约收款数据',
|
|
912
|
+
'contract.quote.rmb': '把金额数字转成人民币大写(本地计算,不调接口)',
|
|
913
|
+
'contract.docx.slots.scan': '扫描 Word 模板的占位槽位并列出;入参 template',
|
|
914
|
+
'contract.docx.slots.fill': '按计划把内容填入 Word 模板槽位并另存;入参 template/out/plan(写本地文件)',
|
|
915
|
+
'contract.docx.verify': '校验生成的 Word 是否满足标题与占位要求;入参 path',
|
|
916
|
+
'contract.quotescreen.recognize': '识别报价单截图/附件并生成结构化报价文件(写本地产物)',
|
|
917
|
+
'contract.quotescreen.submit': '把识别后的报价提交到指定合同流程(写操作,会落库)',
|
|
918
|
+
'contract.triage.extract': '从合同文件中抽取分诊要素并生成结构化结果(写本地文件);入参 file/outDir',
|
|
919
|
+
'contract.ledger.aggregate': '按维度汇总台账数据(可过滤、去重、取明细;支持引用已有结果 refId)',
|
|
920
|
+
'contract.ledger.metrics': '按 key 取台账指标定义(口径说明)',
|
|
921
|
+
'contract.ledger.guard': '校验台账合计与明细条件是否一致(防多算/漏算)',
|
|
922
|
+
'contract.ledger.route': '按查询意图把需求路由到台账菜单与查询条件',
|
|
923
|
+
'contract.ledger.card': '生成台账卡片页面并写入本地产物;入参 menu/pageId/out',
|
|
924
|
+
'contract.review.report': '生成合同审查报告文档并写到本地;入参 data/out',
|
|
925
|
+
'contract.elements.build': '按分诊结果构建合同要素结构(写本地产物)',
|
|
926
|
+
'contract.firstscreen.run': '跑合同首屏流程:识别附件并生成首屏结果(写本地产物)',
|
|
927
|
+
'contract.file.download': '按 fileId 下载合同附件到本地;入参 fileId/savePath(可限最大字节)',
|
|
928
|
+
'contract.quote.sheets': '列出报价 Excel 的工作表名;入参 path(读本地文件)',
|
|
929
|
+
'contract.quote.parse': '解析报价 Excel 明细(可按 sheet 过滤、可保留备注);入参 path',
|
|
930
|
+
'contract.quote.extract': '从报价文件抽取结构化报价;入参 path',
|
|
931
|
+
'contract.quote.normalize': '把已有报价数据规范化后输出;入参 data',
|
|
932
|
+
};
|
|
933
|
+
function withSummaries(operations) {
|
|
934
|
+
return operations.map((item) => ({
|
|
935
|
+
...item,
|
|
936
|
+
summary: item.summary || OPERATION_SUMMARIES[item.name] || '',
|
|
937
|
+
}));
|
|
938
|
+
}
|
|
774
939
|
export const contractOperations = [
|
|
775
940
|
{
|
|
776
941
|
name: 'contract.type.tree',
|
|
@@ -1898,7 +2063,7 @@ export const contractManifest = {
|
|
|
1898
2063
|
host: 'e10-contract',
|
|
1899
2064
|
status: 'builtin',
|
|
1900
2065
|
sourceSkill: 'weaver-e10-jinchengda',
|
|
1901
|
-
operations: contractOperations,
|
|
2066
|
+
operations: withSummaries(contractOperations),
|
|
1902
2067
|
withheldOperations: [
|
|
1903
2068
|
{
|
|
1904
2069
|
name: 'contract.credit.query',
|