weaver-work-cli 0.1.44 → 0.1.46
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/README.md +9 -5
- package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
- package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
- package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
- package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
- package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-MCXQBD6N.js} +3 -3
- package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
- package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
- package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
- package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
- package/dist/chunks/{chunk-FAZTGX7S.js → chunk-4RWS2YYL.js} +5 -5
- package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-6AXKWFKG.js} +32 -12
- package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
- package/dist/chunks/{chunk-QVSWRLLU.js → chunk-6V5ZPKHV.js} +56 -12
- package/dist/chunks/chunk-762M5XJS.js +215 -0
- package/dist/chunks/{chunk-PC7VKEB5.js → chunk-76H3IKH6.js} +178 -37
- package/dist/chunks/{chunk-FRZKBMSW.js → chunk-AD46OMQK.js} +239 -41
- package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
- package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
- package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
- package/dist/chunks/{chunk-CWYGFU5B.js → chunk-GSZTA43P.js} +2 -2
- package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
- package/dist/chunks/{chunk-N4M2DDFE.js → chunk-IP4CWQCF.js} +11 -11
- package/dist/chunks/{chunk-GAMZLAG2.js → chunk-IRMIEDXN.js} +1 -1
- package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
- package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-JFAWZX53.js} +134 -13
- package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
- package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-OXHHJWNC.js} +1 -1
- package/dist/chunks/chunk-P5GQRWDC.js +60 -0
- package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
- package/dist/chunks/{chunk-OF4S23UB.js → chunk-PSOMGA3U.js} +4 -4
- package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
- package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
- package/dist/chunks/{chunk-XHK4MDR5.js → chunk-UFIFZ4YC.js} +48 -14
- package/dist/chunks/chunk-VRPH24IC.js +76 -0
- package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
- package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
- package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-H7EHQXYY.js} +2 -2
- package/dist/chunks/continuation-GW6PRWK3.js +12 -0
- package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
- package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
- package/dist/chunks/{create-flow-J22BO65E.js → create-flow-VRVJEOBX.js} +6 -6
- package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
- package/dist/chunks/{ehr-GSTGAIY3.js → ehr-SH2LM3NK.js} +648 -88
- package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
- package/dist/chunks/{env-BX3VRFS7.js → env-66FPSJDV.js} +2 -2
- package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
- package/dist/chunks/{factory-PETTFME6.js → factory-UH2TZBVA.js} +1 -1
- package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
- package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-CAKMMV7K.js} +3 -3
- package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
- package/dist/chunks/host-7NTIBSPK.js +25 -0
- package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
- package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
- package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
- package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
- package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
- package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
- package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
- package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
- package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-DD6ULZ3I.js} +4 -4
- package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
- package/dist/chunks/{meeting-FEVPZ67S.js → meeting-VTBFW4HI.js} +12 -12
- package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
- package/dist/chunks/operations-J7PUIVWZ.js +15 -0
- package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
- package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
- package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
- package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-CAKZTUA7.js} +1343 -178
- package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
- package/dist/chunks/{registry-IM5G23LS.js → registry-JVQBLFQ5.js} +10 -10
- package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
- package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
- package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-5U55FMXZ.js} +6 -4
- package/dist/chunks/{schedule-ESZIBAUO.js → schedule-IDETODCA.js} +4 -4
- package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
- package/dist/cmd/action.js +14 -10
- package/dist/index.js +30 -30
- package/dist/internal/e10/auth/commands.js +32 -0
- package/dist/internal/e10/auth/error-log.js +156 -26
- package/dist/internal/e10/auth/xiaoe.js +176 -13
- package/dist/internal/e10/context.js +12 -1
- package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
- package/dist/shortcuts/archive/operations/flow-url.js +182 -22
- package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
- package/dist/shortcuts/archive/operations/prelib.js +33 -4
- package/dist/shortcuts/archive/operations/shared.js +52 -0
- package/dist/shortcuts/contract/host.js +111 -4
- package/dist/shortcuts/contract/index.js +19 -0
- package/dist/shortcuts/contract/manifest.js +125 -0
- package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
- package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
- package/dist/shortcuts/contract/operations/customer.js +192 -0
- package/dist/shortcuts/contract/operations/file-download.js +75 -0
- package/dist/shortcuts/contract/operations/flow.js +44 -2
- package/dist/shortcuts/contract/operations/form-info.js +162 -62
- package/dist/shortcuts/contract/operations/registry.js +8 -0
- package/dist/shortcuts/contract/operations/review.js +116 -1
- package/dist/shortcuts/contract/operations/summary.js +177 -0
- package/dist/shortcuts/contract/operations/upload.js +64 -4
- package/dist/shortcuts/contract/upload-cache.js +104 -0
- package/dist/shortcuts/ehr/host.js +2 -2
- package/dist/shortcuts/ehr/index.js +14 -3
- package/dist/shortcuts/ehr/manifest.js +5 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +44 -12
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +258 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +146 -43
- package/dist/shortcuts/ehr/operations/recruit-stats.js +14 -1
- package/dist/shortcuts/ehr/operations/recruit-tag.js +173 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +154 -36
- package/dist/shortcuts/ehr/operations/recruit.js +196 -12
- package/dist/shortcuts/ehr/operations/registry.js +4 -0
- package/dist/shortcuts/ehr/operations.js +24 -0
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/ehr/recruit-stage/context.js +231 -0
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +74 -0
- package/dist/shortcuts/ehr/recruit-stage/errors.js +65 -0
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/ehr/recruit-stage/host.js +109 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +1049 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +295 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +961 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +431 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +50 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +1647 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +158 -0
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +34 -0
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +31 -0
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +318 -0
- package/dist/shortcuts/ehr/recruit-stage/shared.js +805 -0
- package/dist/shortcuts/hrm/operations/employee.js +29 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +274 -75
- package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +63 -11
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +38 -7
- package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
- package/dist/shortcuts/meeting/operations/invitation.js +27 -4
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/batch-store.js +78 -0
- package/dist/shortcuts/recruit-stage/fs-scan.js +165 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +356 -29
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +36 -10
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +309 -67
- package/dist/shortcuts/recruit-stage/operations/registry.js +12 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +310 -17
- package/dist/shortcuts/recruit-stage/operations/types.js +9 -0
- package/dist/shortcuts/recruit-stage/shared.js +221 -24
- package/dist/shortcuts/workflow/index.js +2 -0
- package/dist/shortcuts/workflow/operations/read.js +8 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
- package/docs/contract.md +1 -0
- package/docs/e10-auth.md +4 -2
- package/docs/todo-smart-convert/data-contract.md +7 -0
- package/package.json +1 -1
- package/skill-template/domains/jinchengda.md +2 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
- package/skills/weaver-e10-jucailin/SKILL.md +12 -3
- package/skills/weaver-e10-jucailin/archive/LEGACY-README.md +18 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-SKILL.md +239 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-openai.yaml +131 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-position-templates.md +221 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +334 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +127 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +65 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +63 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +142 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +114 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +56 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +101 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +148 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +77 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +72 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +69 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +241 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +457 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +128 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +146 -0
- package/skills/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +69 -0
- package/skills/weaver-e10-jucailin/lib/recruit-xiaoe-file.mjs +192 -0
- package/skills/weaver-e10-jucailin/lib/xiaoe-session.mjs +66 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +19 -91
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +64 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +63 -1
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +95 -0
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +89 -0
- package/skills/weaver-e10-jucailin/references/recruit-tag.md +81 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +55 -11
- package/skills/weaver-e10-meeting/SKILL.md +103 -11
- package/skills/weaver-e10-meeting/references/meeting-eb.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +19 -11
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -8
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +5 -1
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +23 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +11 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
- package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
- package/skills/weaver-e10-workflow/SKILL.md +19 -17
- package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
|
@@ -61,19 +61,30 @@ export const XIAOE_BUNDLED_ENV_SCRIPT_SOURCE = 'bundled scripts/xiaoe_env.py';
|
|
|
61
61
|
/** 与 XiaoE `tokens.py` 保持一致:换票成功后默认有效 2 小时。 */
|
|
62
62
|
export const XIAOE_ETEAMID_TTL_MS = 7_200_000;
|
|
63
63
|
const XIAOE_DIAGNOSTIC_MAX_LENGTH = 300;
|
|
64
|
+
const XIAOE_SCRIPT_DIAGNOSTIC_MAX_LENGTH = 2_000;
|
|
64
65
|
/** 换票失败原因可能夹带服务端回显,落进结构化错误前先抹掉已知密钥。 */
|
|
65
|
-
function redactXiaoEDiagnostic(message, secrets) {
|
|
66
|
+
function redactXiaoEDiagnostic(message, secrets, maxLength = XIAOE_DIAGNOSTIC_MAX_LENGTH) {
|
|
66
67
|
let text = message;
|
|
67
68
|
for (const secret of secrets) {
|
|
68
69
|
if (secret && secret.length >= 8 && text.includes(secret)) {
|
|
69
70
|
text = text.split(secret).join('<redacted>');
|
|
70
71
|
}
|
|
71
72
|
}
|
|
73
|
+
text = text
|
|
74
|
+
.replace(/\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/giu, '$1<redacted>')
|
|
75
|
+
.replace(/((?:eteamsid|access[_-]?token|refresh[_-]?token|auth(?:orization)?|cookie|session[_-]?id|secret|password)\s*[:=]\s*)(["']?)[^\s,;}"']+/giu, '$1$2<redacted>');
|
|
72
76
|
const normalized = text.replace(/\s+/gu, ' ').trim();
|
|
73
|
-
return normalized.length >
|
|
74
|
-
? `${normalized.slice(0,
|
|
77
|
+
return normalized.length > maxLength
|
|
78
|
+
? `${normalized.slice(0, maxLength)}…`
|
|
75
79
|
: normalized;
|
|
76
80
|
}
|
|
81
|
+
function xiaoEDiagnosticSecrets(env) {
|
|
82
|
+
return Object.entries(env)
|
|
83
|
+
.filter(([key, value]) => Boolean(value
|
|
84
|
+
&& (key.startsWith('XIAOE_') || key.startsWith('WEAVER_XIAOE_'))
|
|
85
|
+
&& /(?:TOKEN|AUTH|ETEAMSID|COOKIE|SESSION|SECRET|PASSWORD)/iu.test(key)))
|
|
86
|
+
.map(([, value]) => value);
|
|
87
|
+
}
|
|
77
88
|
function noteXiaoEStep(diagnostics, step) {
|
|
78
89
|
diagnostics?.attemptedSteps.push(step);
|
|
79
90
|
}
|
|
@@ -86,6 +97,14 @@ function readTag(error, key, type) {
|
|
|
86
97
|
const value = error[key];
|
|
87
98
|
return typeof value === type ? value : undefined;
|
|
88
99
|
}
|
|
100
|
+
function readExchangeRequest(error) {
|
|
101
|
+
if (!error || typeof error !== 'object')
|
|
102
|
+
return undefined;
|
|
103
|
+
const request = error.request;
|
|
104
|
+
if (!request || typeof request !== 'object' || Array.isArray(request))
|
|
105
|
+
return undefined;
|
|
106
|
+
return request;
|
|
107
|
+
}
|
|
89
108
|
/** 401/403/3xx = 登录态被拒;其余 4xx/5xx 才算服务端 HTTP 异常。 */
|
|
90
109
|
function classifyXiaoEHttpStatus(status) {
|
|
91
110
|
if (status === 401 || status === 403)
|
|
@@ -128,21 +147,52 @@ function noteXiaoEError(diagnostics, error, secrets = [], stage = 'e10_session')
|
|
|
128
147
|
if (!diagnostics)
|
|
129
148
|
return;
|
|
130
149
|
const message = error instanceof Error ? error.message : String(error);
|
|
150
|
+
const request = readExchangeRequest(error);
|
|
131
151
|
const redacted = redactXiaoEDiagnostic(message, secrets);
|
|
132
152
|
if (redacted)
|
|
133
153
|
diagnostics.lastError = redacted;
|
|
154
|
+
const failureMessage = request || stage === 'bundled_env_script'
|
|
155
|
+
? redactXiaoEDiagnostic(message, secrets, XIAOE_SCRIPT_DIAGNOSTIC_MAX_LENGTH)
|
|
156
|
+
: redacted;
|
|
134
157
|
const { kind, causeCode, status } = classifyXiaoEError(error);
|
|
135
158
|
const failure = {
|
|
136
159
|
stage: readTag(error, 'stage', 'string') ?? stage,
|
|
137
160
|
kind,
|
|
138
|
-
message:
|
|
161
|
+
message: failureMessage,
|
|
139
162
|
...(causeCode ? { causeCode } : {}),
|
|
140
163
|
...(status === undefined ? {} : { httpStatus: status }),
|
|
164
|
+
...(request ? { request } : {}),
|
|
141
165
|
};
|
|
142
166
|
if (!diagnostics.failures)
|
|
143
167
|
diagnostics.failures = [];
|
|
144
168
|
diagnostics.failures.push(failure);
|
|
145
169
|
}
|
|
170
|
+
function xiaoEErrorChainDetail(error, secrets) {
|
|
171
|
+
const parts = [];
|
|
172
|
+
const seen = new Set();
|
|
173
|
+
let current = error;
|
|
174
|
+
for (let depth = 0; depth < 5 && current !== undefined && current !== null; depth += 1) {
|
|
175
|
+
if (seen.has(current))
|
|
176
|
+
break;
|
|
177
|
+
seen.add(current);
|
|
178
|
+
const record = typeof current === 'object' ? current : null;
|
|
179
|
+
const name = current instanceof Error
|
|
180
|
+
? current.name
|
|
181
|
+
: typeof record?.name === 'string' ? record.name : `cause${depth}`;
|
|
182
|
+
const message = current instanceof Error
|
|
183
|
+
? current.message
|
|
184
|
+
: typeof record?.message === 'string' ? record.message : String(current);
|
|
185
|
+
const attributes = ['code', 'errno', 'syscall', 'hostname', 'address', 'port']
|
|
186
|
+
.map((key) => {
|
|
187
|
+
const value = record?.[key];
|
|
188
|
+
return typeof value === 'string' || typeof value === 'number' ? `${key}=${String(value)}` : '';
|
|
189
|
+
})
|
|
190
|
+
.filter(Boolean);
|
|
191
|
+
parts.push(`${name}: ${message}${attributes.length ? ` {${attributes.join(', ')}}` : ''}`);
|
|
192
|
+
current = record?.cause;
|
|
193
|
+
}
|
|
194
|
+
return redactXiaoEDiagnostic(parts.join(' <- '), secrets, XIAOE_SCRIPT_DIAGNOSTIC_MAX_LENGTH);
|
|
195
|
+
}
|
|
146
196
|
/**
|
|
147
197
|
* 一次恢复失败的整体归因:只要出现过明确的凭证拒绝,就按凭证问题报(用户该去
|
|
148
198
|
* 重新登录);否则 HTTP 异常优先;只有**所有**失败都是网络错误时,才判定为
|
|
@@ -587,6 +637,73 @@ function isXiaoETokenScriptEnvFailure(message) {
|
|
|
587
637
|
return /No module named|ModuleNotFoundError|ENOENT|EACCES|permission denied|command not found|not recognized as an internal|cannot find the file/i
|
|
588
638
|
.test(message);
|
|
589
639
|
}
|
|
640
|
+
function safeXiaoEEndpoint(value) {
|
|
641
|
+
const url = value instanceof URL ? new URL(value.toString()) : new URL(value);
|
|
642
|
+
url.username = '';
|
|
643
|
+
url.password = '';
|
|
644
|
+
url.search = '';
|
|
645
|
+
url.hash = '';
|
|
646
|
+
return url.toString();
|
|
647
|
+
}
|
|
648
|
+
function xiaoEExchangeRequestDiagnostic(options) {
|
|
649
|
+
const endpoint = safeXiaoEEndpoint(options.endpoint);
|
|
650
|
+
const finalEndpoint = options.finalEndpoint ? safeXiaoEEndpoint(options.finalEndpoint) : endpoint;
|
|
651
|
+
const body = { domain: options.domain || DEFAULT_E10_BASE_URL };
|
|
652
|
+
const serializedBody = JSON.stringify(body);
|
|
653
|
+
return {
|
|
654
|
+
transport: options.transport,
|
|
655
|
+
method: 'POST',
|
|
656
|
+
endpoint,
|
|
657
|
+
...(finalEndpoint === endpoint ? {} : { finalEndpoint }),
|
|
658
|
+
redirect: options.transport === 'node_fetch' ? 'manual' : 'safe-follow',
|
|
659
|
+
headers: {
|
|
660
|
+
'content-type': 'application/json',
|
|
661
|
+
authorization: '<redacted>',
|
|
662
|
+
},
|
|
663
|
+
authorizationPresent: Boolean(options.authorization),
|
|
664
|
+
authorizationLength: options.authorization.length,
|
|
665
|
+
body,
|
|
666
|
+
bodyBytes: Buffer.byteLength(serializedBody, 'utf8'),
|
|
667
|
+
timeoutMs: XIAOE_CLIENT_TOKEN_TIMEOUT_MS,
|
|
668
|
+
elapsedMs: Math.max(0, Date.now() - options.startedAt),
|
|
669
|
+
...(options.redirectCount ? { redirectCount: options.redirectCount } : {}),
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function xiaoEPythonFailureDetail(error, stderr, env) {
|
|
673
|
+
const stderrText = stderr.trim();
|
|
674
|
+
const lines = stderrText.split(/\r?\n/u).map((line) => line.trim()).filter(Boolean);
|
|
675
|
+
let scriptMessage = '';
|
|
676
|
+
for (const line of [...lines].reverse()) {
|
|
677
|
+
try {
|
|
678
|
+
const parsed = JSON.parse(line);
|
|
679
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
680
|
+
const candidate = readString(parsed, 'msg', 'message', 'error');
|
|
681
|
+
if (candidate) {
|
|
682
|
+
scriptMessage = candidate;
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
catch {
|
|
688
|
+
// Keep scanning stderr; Python tracebacks and sandbox wrappers are not JSON.
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
const stderrTail = lines.slice(-12).join(' | ');
|
|
692
|
+
const rawDetail = [
|
|
693
|
+
`exitCode=${String(error.code ?? 'unknown')}`,
|
|
694
|
+
...(error.signal ? [`signal=${error.signal}`] : []),
|
|
695
|
+
...(error.killed ? ['killed=true'] : []),
|
|
696
|
+
...(scriptMessage ? [`scriptMessage=${scriptMessage}`] : []),
|
|
697
|
+
...(stderrTail ? [`stderrTail=${stderrTail}`] : [`processError=${error.message || 'unknown error'}`]),
|
|
698
|
+
].join(' ');
|
|
699
|
+
const detail = redactXiaoEDiagnostic(rawDetail, xiaoEDiagnosticSecrets(env), XIAOE_SCRIPT_DIAGNOSTIC_MAX_LENGTH);
|
|
700
|
+
const causeCode = /\b(?:UND_ERR_[A-Z_]+|E[A-Z_]{3,})\b/u.exec(detail)?.[0];
|
|
701
|
+
return {
|
|
702
|
+
detail,
|
|
703
|
+
...(causeCode && isNetworkErrorCode(causeCode) ? { causeCode } : {}),
|
|
704
|
+
network: Boolean((causeCode && isNetworkErrorCode(causeCode)) || looksLikeTransportMessage(detail)),
|
|
705
|
+
};
|
|
706
|
+
}
|
|
590
707
|
async function runXiaoETokenScriptOnce(pythonCommand, scriptPath, baseUrl, env) {
|
|
591
708
|
const wrapper = [
|
|
592
709
|
'import ast,contextlib,io,json,runpy,sys',
|
|
@@ -626,8 +743,15 @@ async function runXiaoETokenScriptOnce(pythonCommand, scriptPath, baseUrl, env)
|
|
|
626
743
|
maxBuffer: 1024 * 1024,
|
|
627
744
|
}, (error, stdout, stderr) => {
|
|
628
745
|
if (error) {
|
|
629
|
-
const detail = (
|
|
630
|
-
|
|
746
|
+
const { detail, causeCode, network } = xiaoEPythonFailureDetail(error, stderr, env);
|
|
747
|
+
const scriptError = new CliError('XiaoE credential script failed: ' + detail, ExitCode.AuthError);
|
|
748
|
+
if (network) {
|
|
749
|
+
Object.assign(scriptError, {
|
|
750
|
+
errorKind: 'network',
|
|
751
|
+
...(causeCode ? { causeCode } : {}),
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
reject(scriptError);
|
|
631
755
|
return;
|
|
632
756
|
}
|
|
633
757
|
const text = stdout.trim();
|
|
@@ -677,7 +801,26 @@ async function resolveXiaoEBundledEnvScriptCredential(baseUrl, env = process.env
|
|
|
677
801
|
const scriptPath = xiaoEBundledEnvScriptPath();
|
|
678
802
|
if (!scriptPath)
|
|
679
803
|
return null;
|
|
680
|
-
const
|
|
804
|
+
const platformCredential = readXiaoEPlatformCredential(env);
|
|
805
|
+
const startedAt = Date.now();
|
|
806
|
+
let tokenData;
|
|
807
|
+
try {
|
|
808
|
+
tokenData = await runXiaoEPythonCredentialScript(scriptPath, baseUrl, env);
|
|
809
|
+
}
|
|
810
|
+
catch (error) {
|
|
811
|
+
if (platformCredential && error && typeof error === 'object') {
|
|
812
|
+
Object.assign(error, {
|
|
813
|
+
request: xiaoEExchangeRequestDiagnostic({
|
|
814
|
+
transport: 'bundled_python',
|
|
815
|
+
endpoint: `${platformCredential.erpaUrl}${XIAOE_SKILL_ETEAMID_API_PATH}`,
|
|
816
|
+
domain: baseUrl,
|
|
817
|
+
authorization: platformCredential.authToken,
|
|
818
|
+
startedAt,
|
|
819
|
+
}),
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
throw error;
|
|
823
|
+
}
|
|
681
824
|
if (!tokenData)
|
|
682
825
|
return null;
|
|
683
826
|
return withDefaultXiaoEExpiry(readXiaoECredentialRecord(tokenData, XIAOE_BUNDLED_ENV_SCRIPT_SOURCE, baseUrl));
|
|
@@ -845,10 +988,23 @@ export function hasXiaoEUnifiedLoginSource(options = {}) {
|
|
|
845
988
|
return inspectXiaoEUnifiedLoginSources(options).any;
|
|
846
989
|
}
|
|
847
990
|
async function fetchXiaoEClientEteamId(credential, domain) {
|
|
991
|
+
const requestedDomain = domain || DEFAULT_E10_BASE_URL;
|
|
992
|
+
const startedAt = Date.now();
|
|
993
|
+
const initialEndpoint = new URL(`${credential.erpaUrl}${XIAOE_SKILL_ETEAMID_API_PATH}`);
|
|
994
|
+
let endpoint = initialEndpoint;
|
|
995
|
+
let redirectCount = 0;
|
|
996
|
+
const requestDiagnostic = () => xiaoEExchangeRequestDiagnostic({
|
|
997
|
+
transport: 'node_fetch',
|
|
998
|
+
endpoint: initialEndpoint,
|
|
999
|
+
finalEndpoint: endpoint,
|
|
1000
|
+
domain: requestedDomain,
|
|
1001
|
+
authorization: credential.authToken,
|
|
1002
|
+
startedAt,
|
|
1003
|
+
redirectCount,
|
|
1004
|
+
});
|
|
848
1005
|
const controller = new AbortController();
|
|
849
1006
|
const timer = setTimeout(() => controller.abort(), XIAOE_CLIENT_TOKEN_TIMEOUT_MS);
|
|
850
1007
|
try {
|
|
851
|
-
let endpoint = new URL(`${credential.erpaUrl}${XIAOE_SKILL_ETEAMID_API_PATH}`);
|
|
852
1008
|
let resp = null;
|
|
853
1009
|
for (let redirects = 0; redirects <= 5; redirects += 1) {
|
|
854
1010
|
resp = await fetch(endpoint, {
|
|
@@ -857,7 +1013,7 @@ async function fetchXiaoEClientEteamId(credential, domain) {
|
|
|
857
1013
|
'content-type': 'application/json',
|
|
858
1014
|
authorization: credential.authToken,
|
|
859
1015
|
},
|
|
860
|
-
body: JSON.stringify({ domain:
|
|
1016
|
+
body: JSON.stringify({ domain: requestedDomain }),
|
|
861
1017
|
redirect: 'manual',
|
|
862
1018
|
signal: controller.signal,
|
|
863
1019
|
});
|
|
@@ -889,6 +1045,7 @@ async function fetchXiaoEClientEteamId(credential, domain) {
|
|
|
889
1045
|
}
|
|
890
1046
|
await resp.body?.cancel().catch(() => undefined);
|
|
891
1047
|
endpoint = next;
|
|
1048
|
+
redirectCount = redirects + 1;
|
|
892
1049
|
}
|
|
893
1050
|
if (!resp?.ok) {
|
|
894
1051
|
const status = resp?.status || 0;
|
|
@@ -924,14 +1081,20 @@ async function fetchXiaoEClientEteamId(credential, domain) {
|
|
|
924
1081
|
}
|
|
925
1082
|
catch (error) {
|
|
926
1083
|
if (isAbortError(error)) {
|
|
927
|
-
throw tagXiaoEError(`XiaoE client token endpoint timed out after ${XIAOE_CLIENT_TOKEN_TIMEOUT_MS} ms.`, { errorKind: 'network', causeCode: 'ETIMEDOUT' });
|
|
1084
|
+
throw tagXiaoEError(`XiaoE client token endpoint timed out after ${XIAOE_CLIENT_TOKEN_TIMEOUT_MS} ms.`, { errorKind: 'network', causeCode: 'ETIMEDOUT', request: requestDiagnostic() });
|
|
928
1085
|
}
|
|
929
1086
|
// 已经带语义的 HTTP / 业务码错误原样上抛,别再包一层网络错误。
|
|
930
|
-
if (error instanceof CliError)
|
|
1087
|
+
if (error instanceof CliError) {
|
|
1088
|
+
Object.assign(error, { request: requestDiagnostic() });
|
|
931
1089
|
throw error;
|
|
1090
|
+
}
|
|
932
1091
|
const causeCode = readErrorCauseCode(error);
|
|
933
|
-
const
|
|
934
|
-
throw tagXiaoEError(`XiaoE client token endpoint request failed${causeCode ? ` (${causeCode})` : ''}: ${
|
|
1092
|
+
const detail = xiaoEErrorChainDetail(error, [credential.authToken]);
|
|
1093
|
+
throw tagXiaoEError(`XiaoE client token endpoint request failed${causeCode ? ` (${causeCode})` : ''}: ${detail}`, {
|
|
1094
|
+
errorKind: 'network',
|
|
1095
|
+
...(causeCode ? { causeCode } : {}),
|
|
1096
|
+
request: requestDiagnostic(),
|
|
1097
|
+
});
|
|
935
1098
|
}
|
|
936
1099
|
finally {
|
|
937
1100
|
clearTimeout(timer);
|
|
@@ -12,10 +12,21 @@ import { canAutomaticallyRecoverXiaoE, recoverXiaoEAuthSession, recoverXiaoEAuth
|
|
|
12
12
|
* 评估过哪些凭证通道及各自结果,`failures` 保留每一次失败的阶段、类别和
|
|
13
13
|
* `error.cause.code`,`lastError` 是最后一条真实原因(已脱敏截断),
|
|
14
14
|
* `resultSessionExpired` 表示票其实换到了、但被判为已过期。
|
|
15
|
+
* 完整请求快照只写入 auth logs;stderr details 刻意移除 `failure.request`。
|
|
15
16
|
*/
|
|
17
|
+
function xiaoEFailureForErrorDetails(failure) {
|
|
18
|
+
return {
|
|
19
|
+
stage: failure.stage,
|
|
20
|
+
kind: failure.kind,
|
|
21
|
+
message: failure.message,
|
|
22
|
+
...(failure.causeCode ? { causeCode: failure.causeCode } : {}),
|
|
23
|
+
...(failure.httpStatus === undefined ? {} : { httpStatus: failure.httpStatus }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
16
26
|
function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
|
|
17
27
|
const failureKind = summarizeXiaoEFailureKind(diagnostics);
|
|
18
28
|
const lastFailure = lastXiaoEFailure(diagnostics);
|
|
29
|
+
const publicFailures = diagnostics?.failures?.map(xiaoEFailureForErrorDetails);
|
|
19
30
|
const networkUnavailable = failureKind === 'network';
|
|
20
31
|
// Web sandboxes only have the platform credential channel. If the runtime
|
|
21
32
|
// marker survived but the host credential pair did not, asking the user to
|
|
@@ -35,7 +46,7 @@ function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
|
|
|
35
46
|
...(diagnostics.lastError ? { lastError: diagnostics.lastError } : {}),
|
|
36
47
|
...(failureKind ? { errorKind: failureKind } : {}),
|
|
37
48
|
...(lastFailure ? { failureStage: lastFailure.stage } : {}),
|
|
38
|
-
...(
|
|
49
|
+
...(publicFailures?.length ? { failures: publicFailures } : {}),
|
|
39
50
|
...(hostCredentialMissing ? { reason: 'host_credential_not_injected' } : {}),
|
|
40
51
|
...(resultSessionExpired ? { resultSessionExpired: true } : {}),
|
|
41
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArchiveCliError, archiveValidationError } from '../errors.js';
|
|
2
2
|
import { READ, archiveSuccess, schemaOf, } from './types.js';
|
|
3
|
-
import { positiveInt, unwrapDatajson } from './shared.js';
|
|
4
|
-
import { BORROWING_TAG, fetchArchiveListDatas, resolveArchiveListTarget } from './getPageUrl.js';
|
|
3
|
+
import { buildBrowserToolCell, buildOpenAction, isXiaoECtx, positiveInt, unwrapDatajson, } from './shared.js';
|
|
4
|
+
import { BORROWING_TAG, fetchArchiveListDatas, resolveArchiveListTarget, resolveBorrowFormId, } from './getPageUrl.js';
|
|
5
5
|
/** 兼容「纯 ID 字符串」与「对象数组」两种字段形态(列表接口两者都会出现)。 */
|
|
6
6
|
function textOrName(value) {
|
|
7
7
|
if (Array.isArray(value)) {
|
|
@@ -62,6 +62,34 @@ function isExpired(returnDateTime, now = Date.now()) {
|
|
|
62
62
|
const due = parseDateTime(returnDateTime);
|
|
63
63
|
return due === undefined ? false : now > due;
|
|
64
64
|
}
|
|
65
|
+
/** 借阅单卡片页地址:`/sp/ebdfpage/card/0/{formId}/{dataId}`。 */
|
|
66
|
+
function borrowCardPath(formId, dataId) {
|
|
67
|
+
return `/sp/ebdfpage/card/0/${formId}/${dataId}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 借阅单的打开链接(a 标签用)。
|
|
71
|
+
* `formId` 取「我的借阅」表单对象 ID(按环境 + 租户缓存),缺任一项就不给链接。
|
|
72
|
+
*/
|
|
73
|
+
function borrowCardLink(session, formId, dataId) {
|
|
74
|
+
if (!formId || !dataId)
|
|
75
|
+
return undefined;
|
|
76
|
+
const viewPath = borrowCardPath(formId, dataId);
|
|
77
|
+
const root = String(session?.baseUrl ?? '').replace(/\/+$/, '');
|
|
78
|
+
return { viewPath, url: root ? `${root}${viewPath}` : viewPath };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 列表行 / 单条记录的打开字段:`viewPath`、`url`,小E 环境再加单行 `<browsertool>` 单元格。
|
|
82
|
+
* 表单 ID 缺失(无链接)时返回空对象,调用方原样展开即可。
|
|
83
|
+
*/
|
|
84
|
+
function borrowOpenFields(session, formId, dataId, title, xiaoE) {
|
|
85
|
+
const link = borrowCardLink(session, formId, dataId);
|
|
86
|
+
if (!link)
|
|
87
|
+
return {};
|
|
88
|
+
return {
|
|
89
|
+
...link,
|
|
90
|
+
...(xiaoE ? { browserToolCell: buildBrowserToolCell(link.url, title || '打开借阅单') } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
65
93
|
function normalizeBorrowListRow(mainTable, index) {
|
|
66
94
|
const row = (mainTable && typeof mainTable === 'object' ? mainTable : {});
|
|
67
95
|
return {
|
|
@@ -119,23 +147,52 @@ const borrowListList = {
|
|
|
119
147
|
pageNo: { type: 'integer', minimum: 1, description: '页码,默认 1' },
|
|
120
148
|
pageSize: { type: 'integer', minimum: 1, description: '每页条数,默认 10' },
|
|
121
149
|
}),
|
|
122
|
-
handler: async (args, { host }) => {
|
|
150
|
+
handler: async (args, { ctx, host }) => {
|
|
123
151
|
const pageNo = positiveInt(args.pageNo, 'pageNo', 1);
|
|
124
152
|
const pageSize = positiveInt(args.pageSize, 'pageSize', 10);
|
|
125
153
|
const session = await host.getSession();
|
|
154
|
+
// 借阅单表单 ID:按「环境 + 租户」缓存(进程内 + state 目录),失败时降级为无链接
|
|
155
|
+
const formId = await resolveBorrowFormId(host, session, ctx);
|
|
156
|
+
const xiaoE = isXiaoECtx(ctx);
|
|
126
157
|
const custom = await listByCustomApi(host, session.userId, pageNo, pageSize);
|
|
127
158
|
if (custom) {
|
|
128
|
-
|
|
159
|
+
const rows = custom.rows.map((row) => ({
|
|
160
|
+
...row,
|
|
161
|
+
...borrowOpenFields(session, formId, row.dataId, row.name, xiaoE),
|
|
162
|
+
}));
|
|
163
|
+
return archiveSuccess('archive.borrow-list.list', {
|
|
164
|
+
source: 'myBorrowList',
|
|
165
|
+
pageNo,
|
|
166
|
+
pageSize,
|
|
167
|
+
count: custom.count,
|
|
168
|
+
...(formId ? { formId } : {}),
|
|
169
|
+
hasXiaoEEnv: xiaoE,
|
|
170
|
+
rows,
|
|
171
|
+
}, { source: 'myBorrowList' });
|
|
129
172
|
}
|
|
130
173
|
const target = await resolveArchiveListTarget(host, { sign: BORROWING_TAG, viewMode: 'myBorrow' });
|
|
131
174
|
const page = await fetchArchiveListDatas(host, target, pageNo);
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
dataId
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
175
|
+
const targetFormId = formId || String(target.objId ?? '');
|
|
176
|
+
const rows = page.rows.map((row, index) => {
|
|
177
|
+
const dataId = String(row.id ?? '');
|
|
178
|
+
const display = page.displayRows[index];
|
|
179
|
+
const title = String(display?.name ?? row.name ?? '');
|
|
180
|
+
return {
|
|
181
|
+
index: index + 1,
|
|
182
|
+
dataId,
|
|
183
|
+
fields: row,
|
|
184
|
+
...(display ? { display } : {}),
|
|
185
|
+
...borrowOpenFields(session, targetFormId, dataId, title, xiaoE),
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
return archiveSuccess('archive.borrow-list.list', {
|
|
189
|
+
source: 'ebuilder',
|
|
190
|
+
pageNo: page.pageNo,
|
|
191
|
+
count: rows.length,
|
|
192
|
+
...(targetFormId ? { formId: targetFormId } : {}),
|
|
193
|
+
hasXiaoEEnv: xiaoE,
|
|
194
|
+
rows,
|
|
195
|
+
}, { source: 'ebuilder', viewSource: target.viewSource });
|
|
139
196
|
},
|
|
140
197
|
};
|
|
141
198
|
/** 借阅单详情(myBorrowDetail),下载前的两项前置校验也基于本接口。 */
|
|
@@ -187,7 +244,7 @@ const borrowListDetail = {
|
|
|
187
244
|
capability: 'archive',
|
|
188
245
|
risk: READ,
|
|
189
246
|
inputSchema: schemaOf({ dataId: { type: 'string', pattern: '^\\d+$', description: '借阅单主表数据 ID' } }, { required: ['dataId'], description: '借阅单详情' }),
|
|
190
|
-
handler: async (args, { host }) => {
|
|
247
|
+
handler: async (args, { ctx, host }) => {
|
|
191
248
|
const dataId = args.dataId;
|
|
192
249
|
if (dataId === undefined || dataId === null || !/^\d+$/.test(String(dataId))) {
|
|
193
250
|
throw archiveValidationError('data_id_invalid', 'dataId 必填且为数字 ID');
|
|
@@ -196,6 +253,7 @@ const borrowListDetail = {
|
|
|
196
253
|
const detail = await fetchBorrowDetail(host, session.userId, String(dataId));
|
|
197
254
|
// 档案题名补可点击链接:arcDangan.id 形如 {档案ID}_{表单ID},拼成与全文检索一致的 archiveView
|
|
198
255
|
const root = String(session?.baseUrl ?? '').replace(/\/+$/, '');
|
|
256
|
+
const xiaoE = isXiaoECtx(ctx);
|
|
199
257
|
const details = detail.details.map((item) => ({
|
|
200
258
|
...item,
|
|
201
259
|
arcDangan: item.arcDangan.map((arc) => {
|
|
@@ -203,10 +261,43 @@ const borrowListDetail = {
|
|
|
203
261
|
if (!arcId || !arcFormId)
|
|
204
262
|
return arc;
|
|
205
263
|
const viewPath = `/sp/custom/archive/archiveView?arcId=${arcId}&arcFormId=${arcFormId}`;
|
|
206
|
-
|
|
264
|
+
const url = root ? `${root}${viewPath}` : viewPath;
|
|
265
|
+
const name = String(arc.name ?? '打开档案');
|
|
266
|
+
return {
|
|
267
|
+
...arc,
|
|
268
|
+
viewPath,
|
|
269
|
+
url,
|
|
270
|
+
// 小E 环境:明细表最后一列“操作”放该档案的单行 <browsertool>,与档案同一行;非小E 不带该字段
|
|
271
|
+
...(xiaoE ? { browserToolCell: buildBrowserToolCell(url, name) } : {}),
|
|
272
|
+
};
|
|
207
273
|
}),
|
|
208
274
|
}));
|
|
209
|
-
|
|
275
|
+
// 明细里的档案链接:题名正常给 a 标签,打开动作由宿主按 clientAction 执行
|
|
276
|
+
const openEnv = buildOpenAction(ctx, String(details[0]?.arcDangan?.[0]?.url ?? ''), '打开档案');
|
|
277
|
+
// 借阅单本身的卡片页链接(表单 ID 按环境 + 租户缓存)
|
|
278
|
+
const borrowFormId = await resolveBorrowFormId(host, session, ctx);
|
|
279
|
+
const selfLink = borrowCardLink(session, borrowFormId, String(detail.dataId || dataId));
|
|
280
|
+
// 单条场景:小E 环境给出 <browsertool> 参数,放在单据数据之后单独一行渲染
|
|
281
|
+
const selfOpen = selfLink
|
|
282
|
+
? buildOpenAction(ctx, selfLink.url, String(detail.name || '打开借阅单'))
|
|
283
|
+
: undefined;
|
|
284
|
+
return archiveSuccess('archive.borrow-list.detail', {
|
|
285
|
+
...detail,
|
|
286
|
+
details,
|
|
287
|
+
...(borrowFormId ? { formId: borrowFormId } : {}),
|
|
288
|
+
...(selfLink
|
|
289
|
+
? {
|
|
290
|
+
viewPath: selfLink.viewPath,
|
|
291
|
+
url: selfLink.url,
|
|
292
|
+
markdown: `[打开借阅单](${selfLink.url})`,
|
|
293
|
+
}
|
|
294
|
+
: {}),
|
|
295
|
+
...(selfOpen?.browserTool ? { browserTool: selfOpen.browserTool } : {}),
|
|
296
|
+
hasXiaoEEnv: xiaoE,
|
|
297
|
+
requiresHostAction: openEnv.requiresHostAction,
|
|
298
|
+
opened: openEnv.opened,
|
|
299
|
+
clientAction: openEnv.clientAction,
|
|
300
|
+
}, { count: details.length });
|
|
210
301
|
},
|
|
211
302
|
};
|
|
212
303
|
export const borrowListOperations = [borrowListList, borrowListDetail];
|