weaver-work-cli 0.1.67 → 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-WUZKAEZ6.js → archive-VUTREF3P.js} +16 -12
- package/dist/chunks/{archive-oa-PN46RTI2.js → archive-oa-VXXO4RTB.js} +4 -4
- package/dist/chunks/{asset-ZPC5VWZM.js → asset-45U6TY7I.js} +44 -12
- package/dist/chunks/{asset-idle-DHGP3NYY.js → asset-idle-YCRBMTIT.js} +4 -4
- package/dist/chunks/{attachment-content-7SDA6WER.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-33ANTJWB.js → chunk-3CBURKSY.js} +5 -5
- package/dist/chunks/{chunk-IN6NXQ26.js → chunk-3Q5F4C5B.js} +47 -27
- package/dist/chunks/{chunk-XARLZK6C.js → chunk-3TZURS7M.js} +3 -3
- package/dist/chunks/{chunk-R6GGDZ2C.js → chunk-4XYRTXRR.js} +1 -1
- package/dist/chunks/{chunk-LNWFHNVK.js → chunk-67AN5YJT.js} +379 -55
- package/dist/chunks/{chunk-KS6LXSCA.js → chunk-6DH73Q5H.js} +85 -81
- package/dist/chunks/{chunk-3W5NMGDS.js → chunk-727VKJQK.js} +2 -2
- package/dist/chunks/{chunk-5QYE52LG.js → chunk-7M5OYRK2.js} +18 -9
- package/dist/chunks/{chunk-TXXO4TJT.js → chunk-BEYEXCWU.js} +2 -2
- package/dist/chunks/{chunk-26FCCU5O.js → chunk-DSBV4GRK.js} +3 -3
- package/dist/chunks/{chunk-G7PQWD4L.js → chunk-DVFA3ODS.js} +38 -10
- package/dist/chunks/{chunk-HWA2A25Y.js → chunk-E7VWE2XI.js} +3 -3
- package/dist/chunks/{chunk-DTJZOAO6.js → chunk-ELF5TPSG.js} +7 -7
- package/dist/chunks/{chunk-6ZOSVKMT.js → chunk-ERAE4GHX.js} +1 -1
- package/dist/chunks/{chunk-4PYLZORW.js → chunk-FMAZ42HS.js} +12 -12
- 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-RU7ZZQQQ.js → chunk-JAIZY37Z.js} +4 -4
- package/dist/chunks/{chunk-ATEXBEPD.js → chunk-LCM5SSGJ.js} +4 -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-MRYKV5HN.js → chunk-MLJK4KLE.js} +37 -37
- package/dist/chunks/{chunk-C4YQJFZV.js → chunk-PAWXVT6H.js} +22 -11
- 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-JU5OPHSY.js → chunk-YR3K53BU.js} +36 -27
- package/dist/chunks/{conflict-DYCSX7CN.js → conflict-VKCRXHUV.js} +2 -2
- package/dist/chunks/{contract-N5WNHKHI.js → contract-3PMHUASH.js} +202 -25
- package/dist/chunks/{cowork-34CBYVQP.js → cowork-FZBTTBYX.js} +4 -4
- package/dist/chunks/{create-flow-PABAGCK2.js → create-flow-WYPLBLRK.js} +6 -6
- package/dist/chunks/{data-QKWI5325.js → data-2YZ6A6TL.js} +32 -5
- package/dist/chunks/{ebuilder-form-ZONRROK4.js → ebuilder-form-AWPTMZBZ.js} +6 -6
- package/dist/chunks/{ehr-2CONM7R6.js → ehr-MNPR4TE5.js} +4 -4
- package/dist/chunks/{employee-PGMY6NI6.js → employee-QX57HEWS.js} +1 -1
- package/dist/chunks/{entry-mode-C2WPJQJM.js → entry-mode-BCJ7RPFC.js} +3 -3
- package/dist/chunks/{env-SEEXUXZF.js → env-SCVCHBN2.js} +2 -2
- package/dist/chunks/{esb-FQASCY2H.js → esb-GSB5QCEX.js} +6 -6
- package/dist/chunks/{factory-WNLDOLJZ.js → factory-CBXYOEBF.js} +1 -1
- package/dist/chunks/{fna-FCLVIWAS.js → fna-XBSNUS2V.js} +4 -4
- package/dist/chunks/{group-chat-DOS4XWUN.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-XKL27NX2.js → hrm-FZUDJAND.js} +20 -14
- package/dist/chunks/{im-NDYIMASG.js → im-F5NENPD7.js} +5 -5
- package/dist/chunks/{invoice-SMODTN2D.js → invoice-DS6FLU55.js} +44 -7
- package/dist/chunks/{jiuchuanhui-3T5X7SB7.js → jiuchuanhui-PY2WEBUH.js} +161 -10
- 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-2IWXP5IL.js → meeting-N2AGGLVI.js} +15 -15
- package/dist/chunks/{minute-doc-N4OR5OLP.js → minute-doc-C62EZOJH.js} +4 -4
- package/dist/chunks/{okr-VZXRQGS4.js → okr-OZUMTMCL.js} +11 -5
- package/dist/chunks/{operations-62N6EP3C.js → operations-LQY3FTPH.js} +1 -1
- package/dist/chunks/{operations-MI2BSKZX.js → operations-UTUWFJTX.js} +5 -5
- package/dist/chunks/{org-NFE7X7FK.js → org-MWWIFNAO.js} +1 -1
- 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-3FT2F66K.js → reception-NH6MJFPR.js} +20 -10
- package/dist/chunks/{recruit-stage-WPGB5BDJ.js → recruit-stage-DPEFHLSE.js} +7 -4
- package/dist/chunks/{registry-JMNOXRST.js → registry-4S3RXXWS.js} +3 -3
- package/dist/chunks/{registry-XOUVCSV4.js → registry-7US3QQXV.js} +12 -12
- package/dist/chunks/{registry-E5RQJVWN.js → registry-AC33ZZVH.js} +1 -1
- package/dist/chunks/{registry-QRMXRSCT.js → registry-FTPUUHWC.js} +5 -5
- package/dist/chunks/{registry-ABKBGGGK.js → registry-Y2HWS6JS.js} +4 -4
- package/dist/chunks/{room-recommend-TWIEVY44.js → room-recommend-LMNF76YS.js} +4 -4
- package/dist/chunks/{schedule-XZ4UUX4E.js → schedule-4QE2THAP.js} +4 -4
- package/dist/chunks/{smart-extract-DEBLJPCQ.js → smart-extract-GTYKF5TJ.js} +32 -21
- package/dist/chunks/{workflow-D7LBN5MZ.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/archive/operations/archive-info.js +9 -5
- package/dist/shortcuts/asset/manifest.js +42 -4
- package/dist/shortcuts/contract/manifest.js +204 -21
- package/dist/shortcuts/data/manifest.js +45 -2
- package/dist/shortcuts/ebuilder-form/manifest.js +38 -10
- package/dist/shortcuts/hrm/index.js +20 -7
- package/dist/shortcuts/hrm/operations/employee.js +22 -11
- package/dist/shortcuts/hrm/operations/org.js +18 -9
- package/dist/shortcuts/hrm/operations/position.js +24 -12
- package/dist/shortcuts/hrm/operations/resolve.js +18 -10
- package/dist/shortcuts/im/operations/group-read.js +4 -1
- package/dist/shortcuts/invoice/manifest.js +44 -1
- package/dist/shortcuts/jiuchuanhui/host.js +76 -4
- package/dist/shortcuts/jiuchuanhui/manifest.js +106 -2
- package/dist/shortcuts/meeting/operations/attachment-content.js +25 -16
- package/dist/shortcuts/meeting/operations/eb/member-expand.js +1 -0
- package/dist/shortcuts/meeting/operations/invitation.js +1 -1
- package/dist/shortcuts/meeting/operations/link.js +20 -17
- package/dist/shortcuts/okr/operations/read.js +7 -1
- package/dist/shortcuts/reception/host.js +19 -5
- package/dist/shortcuts/reception/manifest.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -1
- package/dist/shortcuts/smart-extract/operations/structure.js +13 -10
- package/dist/shortcuts/smart-extract/operations/target.js +15 -7
- package/dist/shortcuts/workflow/index.js +55 -5
- package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +26 -2
- package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +23 -4
- package/dist/shortcuts/workflow/operations/deepRead.js +295 -4
- package/dist/shortcuts/workflow/operations/read.js +44 -22
- 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 +5 -5
- 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 +11 -11
- package/skills/weaver-e10-workflow/aiDeepRead/templates//346/261/207/346/200/273/345/256/241/346/211/271-demo.html +92 -12
- package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +6 -4
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -2
- package/skills/weaver-e10-workflow/references/workflow-deep-read.md +44 -8
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +84 -12
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -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
|
+
}
|
|
@@ -21,11 +21,15 @@ const archiveInfoGet = {
|
|
|
21
21
|
summary: '查看档案条目的基本信息(年度/案卷号/起止件号/文件日期/保管期限/密级/库位等);输入为档案标识 {档案ID}_{表单ID}(可来自借阅车 arc_dangan)',
|
|
22
22
|
capability: 'archive',
|
|
23
23
|
risk: READ,
|
|
24
|
-
inputSchema:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
inputSchema: {
|
|
25
|
+
...schemaOf({
|
|
26
|
+
arcDangan: { type: 'string', description: '{档案ID}_{表单ID},与 dataId+formId 二选一' },
|
|
27
|
+
dataId: { type: 'string', pattern: '^\\d+$', description: '档案数据 ID(arc_dangan 拆解前半段)' },
|
|
28
|
+
formId: { type: 'string', pattern: '^\\d+$', description: '档案所属表单 ID(arc_dangan 拆解后半段)' },
|
|
29
|
+
}, { description: '查询档案基本信息;arcDangan 与 dataId+formId 至少提供一组' }),
|
|
30
|
+
// 两组定位方式至少给一组:只给 arcDangan 时由它拆出 dataId+formId(见 handler 的 id_pair_required)
|
|
31
|
+
anyOf: [{ required: ['arcDangan'] }, { required: ['dataId', 'formId'] }],
|
|
32
|
+
},
|
|
29
33
|
handler: async (args, { host }) => {
|
|
30
34
|
let pair;
|
|
31
35
|
if (args.arcDangan !== undefined) {
|
|
@@ -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',
|
|
@@ -83,6 +116,8 @@ export const ziguanjiaOperations = [
|
|
|
83
116
|
asset_name: { type: 'string' },
|
|
84
117
|
with_view_link: { type: 'boolean', default: true, description: '是否给命中记录附带「查看详情」链接(默认 true)' },
|
|
85
118
|
},
|
|
119
|
+
// id / asset_number / asset_name 至少给一个,否则运行时直接报 input_required
|
|
120
|
+
anyOf: [{ required: ['id'] }, { required: ['asset_number'] }, { required: ['asset_name'] }],
|
|
86
121
|
},
|
|
87
122
|
},
|
|
88
123
|
{
|
|
@@ -139,10 +174,11 @@ export const ziguanjiaOperations = [
|
|
|
139
174
|
type: 'object',
|
|
140
175
|
additionalProperties: false,
|
|
141
176
|
properties: {
|
|
142
|
-
house_name: { type: 'string', description: '地点名称,按名称过滤取 ID' },
|
|
177
|
+
house_name: { type: 'string', description: '地点名称,按名称过滤取 ID(必填)' },
|
|
143
178
|
page_no: { type: 'integer', minimum: 1, default: 1 },
|
|
144
179
|
page_size: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
|
145
180
|
},
|
|
181
|
+
required: ['house_name'],
|
|
146
182
|
},
|
|
147
183
|
},
|
|
148
184
|
{
|
|
@@ -153,10 +189,11 @@ export const ziguanjiaOperations = [
|
|
|
153
189
|
type: 'object',
|
|
154
190
|
additionalProperties: false,
|
|
155
191
|
properties: {
|
|
156
|
-
status_name: { type: 'string', description: '状态名称,按名称过滤取 ID' },
|
|
192
|
+
status_name: { type: 'string', description: '状态名称,按名称过滤取 ID(必填)' },
|
|
157
193
|
page_no: { type: 'integer', minimum: 1, default: 1 },
|
|
158
194
|
page_size: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
|
159
195
|
},
|
|
196
|
+
required: ['status_name'],
|
|
160
197
|
},
|
|
161
198
|
},
|
|
162
199
|
{
|
|
@@ -167,10 +204,11 @@ export const ziguanjiaOperations = [
|
|
|
167
204
|
type: 'object',
|
|
168
205
|
additionalProperties: false,
|
|
169
206
|
properties: {
|
|
170
|
-
type_name: { type: 'string', description: '类型名称,按名称过滤取 ID' },
|
|
207
|
+
type_name: { type: 'string', description: '类型名称,按名称过滤取 ID(必填)' },
|
|
171
208
|
page_no: { type: 'integer', minimum: 1, default: 1 },
|
|
172
209
|
page_size: { type: 'integer', minimum: 1, maximum: 200, default: 50 },
|
|
173
210
|
},
|
|
211
|
+
required: ['type_name'],
|
|
174
212
|
},
|
|
175
213
|
},
|
|
176
214
|
{
|
|
@@ -450,7 +488,7 @@ export const ziguanjiaManifest = {
|
|
|
450
488
|
host: 'e10-ziguanjia',
|
|
451
489
|
status: 'builtin',
|
|
452
490
|
sourceSkill: 'weaver-e10-ziguanjia',
|
|
453
|
-
operations: ziguanjiaOperations,
|
|
491
|
+
operations: withSummaries(ziguanjiaOperations),
|
|
454
492
|
withheldOperations: [
|
|
455
493
|
{
|
|
456
494
|
name: 'asset.transfer',
|