weaver-work-cli 0.1.73 → 0.1.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/README.md +37 -1
  2. package/dist/chunks/{archive-THZV4ND4.js → archive-OZJ6PYUR.js} +14 -9
  3. package/dist/chunks/{archive-oa-PQ23OLEV.js → archive-oa-BHL5RK2F.js} +10 -7
  4. package/dist/chunks/{asset-RGPROZYH.js → asset-HKRFRQR2.js} +10 -7
  5. package/dist/chunks/{asset-idle-Z2PDX7NA.js → asset-idle-GGIR4KE7.js} +7 -4
  6. package/dist/chunks/{attachment-content-R3RPVOYE.js → attachment-content-4OV65NK5.js} +3 -3
  7. package/dist/chunks/{blog-7U3QZPIF.js → blog-HYDP4DV3.js} +10 -7
  8. package/dist/chunks/{caizhilian-3AB42GCV.js → caizhilian-JS4RQZ6Z.js} +10 -7
  9. package/dist/chunks/{calendar-KINM64E4.js → calendar-SWRY4DIT.js} +10 -7
  10. package/dist/chunks/chunk-257JXJGD.js +30 -0
  11. package/dist/chunks/{chunk-LLCMOZ5L.js → chunk-2AUFKU2D.js} +11 -11
  12. package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
  13. package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
  14. package/dist/chunks/{chunk-TV46Q4NY.js → chunk-4FCBEWNB.js} +74 -68
  15. package/dist/chunks/{chunk-NUP4RYZK.js → chunk-5D2V7ZAN.js} +2 -2
  16. package/dist/chunks/{chunk-DRUND2PJ.js → chunk-5QUTQHXF.js} +225 -152
  17. package/dist/chunks/{chunk-4BXR6CNB.js → chunk-5ZJGPEIB.js} +2 -2
  18. package/dist/chunks/chunk-7DE3VMZD.js +35 -0
  19. package/dist/chunks/chunk-BNKUHN4N.js +1346 -0
  20. package/dist/chunks/{chunk-2CHGUYMG.js → chunk-BSR5TM7U.js} +4 -4
  21. package/dist/chunks/{chunk-4I26YMBY.js → chunk-ERZY6GYL.js} +7 -3
  22. package/dist/chunks/{chunk-4YXAK6OA.js → chunk-FEZK536Z.js} +12 -7
  23. package/dist/chunks/{chunk-F4HM25K4.js → chunk-I6NOHKEK.js} +1 -1
  24. package/dist/chunks/{chunk-JMJBPP4B.js → chunk-J7FAAHWH.js} +2 -2
  25. package/dist/chunks/{chunk-54ST55IJ.js → chunk-JJONWB5N.js} +11 -1
  26. package/dist/chunks/chunk-JOY3HZXL.js +467 -0
  27. package/dist/chunks/{chunk-GWJLAF6B.js → chunk-JWF2R6EQ.js} +0 -462
  28. package/dist/chunks/{chunk-BWYVS62Z.js → chunk-KEA4XQPO.js} +4 -4
  29. package/dist/chunks/chunk-KINXYJXM.js +205 -0
  30. package/dist/chunks/{chunk-IBSJJGXL.js → chunk-KWJEICD4.js} +2 -2
  31. package/dist/chunks/{chunk-GAMGDNTF.js → chunk-LJI4N6FV.js} +1 -1
  32. package/dist/chunks/{chunk-IU6UB2TD.js → chunk-MXCRKXOP.js} +48 -6
  33. package/dist/chunks/{chunk-PAFOLIYQ.js → chunk-NWYHCZTY.js} +1 -1
  34. package/dist/chunks/chunk-OJ4JPD25.js +428 -0
  35. package/dist/chunks/{chunk-L7TYG5SN.js → chunk-OQCK5SAU.js} +2 -2
  36. package/dist/chunks/chunk-PG5YSNYY.js +1166 -0
  37. package/dist/chunks/{chunk-XZBYRYWX.js → chunk-QJWVYOOV.js} +2 -2
  38. package/dist/chunks/{chunk-AMAPQVBT.js → chunk-QVKRNL7L.js} +286 -305
  39. package/dist/chunks/chunk-SU6IJD6D.js +49 -0
  40. package/dist/chunks/{chunk-ZWLWXHJC.js → chunk-TA2RBUTH.js} +2 -2
  41. package/dist/chunks/{chunk-6HT73VOI.js → chunk-U6Y32KEV.js} +2 -2
  42. package/dist/chunks/chunk-UUJK76HV.js +209 -0
  43. package/dist/chunks/{chunk-R3MK2RBN.js → chunk-VOMDD2C5.js} +1 -1
  44. package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
  45. package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
  46. package/dist/chunks/{chunk-2XED2FKY.js → chunk-ZUB4M4N3.js} +38 -36
  47. package/dist/chunks/{chunk-7QFVXP2X.js → chunk-ZWIMLT6P.js} +8 -7
  48. package/dist/chunks/cli-FULPXIKJ.js +226 -0
  49. package/dist/chunks/commands-BNWFNTD3.js +70 -0
  50. package/dist/chunks/{conflict-VPAR7E6F.js → conflict-5BKCDV2F.js} +2 -2
  51. package/dist/chunks/{contract-DDXAO2DZ.js → contract-WI23OXVC.js} +12446 -5964
  52. package/dist/chunks/{cowork-34QCHMDD.js → cowork-DZBBVNMQ.js} +11 -8
  53. package/dist/chunks/{create-flow-52PU2OBI.js → create-flow-7ZRBRKX7.js} +6 -6
  54. package/dist/chunks/{data-CLQ62QGD.js → data-PAZVE6QE.js} +6 -3
  55. package/dist/chunks/{ebuilder-form-W5R7Q22S.js → ebuilder-form-5SQXIGXN.js} +9 -6
  56. package/dist/chunks/{ehr-LCNAVMK5.js → ehr-CX5F4ZAU.js} +23 -16
  57. package/dist/chunks/{entry-mode-6Z3ZV3DE.js → entry-mode-I2BYNONZ.js} +3 -3
  58. package/dist/chunks/{env-RDKWAARB.js → env-ZAQZ7EHN.js} +2 -2
  59. package/dist/chunks/{esb-ANKPUU65.js → esb-DQTXDIBF.js} +10 -7
  60. package/dist/chunks/{factory-434B7RAT.js → factory-XRI6KZ7H.js} +1 -1
  61. package/dist/chunks/{fna-AKBSG5HI.js → fna-FK6HQVJL.js} +13 -8
  62. package/dist/chunks/{group-chat-PROTW22R.js → group-chat-MLWNYM2P.js} +3 -3
  63. package/dist/chunks/{host-WO4L5G5I.js → host-3EPREGXS.js} +6 -3
  64. package/dist/chunks/{host-XIYG4F4B.js → host-J74JGYAW.js} +6 -3
  65. package/dist/chunks/{host-7FJW4E7R.js → host-KUMU3DDK.js} +6 -3
  66. package/dist/chunks/{host-5R2SNFWD.js → host-MEC4VQZA.js} +6 -3
  67. package/dist/chunks/{host-PDJAKCT7.js → host-T6NNQGVZ.js} +6 -3
  68. package/dist/chunks/{host-CGXUFQO4.js → host-VI7Q45PM.js} +6 -3
  69. package/dist/chunks/{hrm-WGODDTEH.js → hrm-KKVAW4P5.js} +8 -5
  70. package/dist/chunks/{im-YKTKAJU3.js → im-47CIWQNL.js} +7 -4
  71. package/dist/chunks/{invoice-PVYCCCVM.js → invoice-CDYRBNIG.js} +21 -16
  72. package/dist/chunks/{jiuchuanhui-RKOQW7BY.js → jiuchuanhui-M7QTRHZK.js} +17 -10
  73. package/dist/chunks/{lazy-dispatch-DW45AFQ5.js → lazy-dispatch-FKQJZFI5.js} +22 -8
  74. package/dist/chunks/{mail-BNB5S4NW.js → mail-NRBS5N6Y.js} +11 -8
  75. package/dist/chunks/{meeting-O2KDJH66.js → meeting-WC5LD3IO.js} +22 -18
  76. package/dist/chunks/{minute-doc-JUCG56GY.js → minute-doc-OQUMDTKG.js} +4 -4
  77. package/dist/chunks/{okr-LWFGWOE7.js → okr-EHKSKMPL.js} +10 -7
  78. package/dist/chunks/{operations-532PN5OB.js → operations-V5VM5MS2.js} +7 -4
  79. package/dist/chunks/{performance-7W5COCFU.js → performance-ZJADXJPN.js} +6 -3
  80. package/dist/chunks/{plan-ZVY3IYTL.js → plan-OTDNBDJ7.js} +10 -7
  81. package/dist/chunks/{project-SA62B7MH.js → project-4XVBQ3HX.js} +10 -7
  82. package/dist/chunks/{reception-NGIONPQ3.js → reception-3FAHOOH7.js} +8 -4
  83. package/dist/chunks/{recruit-stage-WOSN6MGP.js → recruit-stage-3WTVWW2K.js} +199 -74
  84. package/dist/chunks/register-SQOPIR2G.js +16 -0
  85. package/dist/chunks/{registry-R72GWXOG.js → registry-F4YFZLOD.js} +7 -3
  86. package/dist/chunks/registry-NBTBXR4L.js +30 -0
  87. package/dist/chunks/{registry-N7P3W2RD.js → registry-TJGCVRCW.js} +7 -4
  88. package/dist/chunks/{room-recommend-KCGIVUFR.js → room-recommend-KL62XB2Y.js} +4 -4
  89. package/dist/chunks/root-YZG2TS5W.js +16 -0
  90. package/dist/chunks/{schedule-6UP27HQ4.js → schedule-XOISYUPB.js} +4 -4
  91. package/dist/chunks/{smart-extract-DDOQSPRB.js → smart-extract-UYGNV3BM.js} +15 -7
  92. package/dist/chunks/update-AV5VOXGY.js +13 -0
  93. package/dist/chunks/{workflow-V5ALD6QZ.js → workflow-V54LJPXL.js} +15 -10
  94. package/dist/cli.js +40 -0
  95. package/dist/cmd/action.js +3 -1
  96. package/dist/cmd/doctor/index.js +1 -1
  97. package/dist/cmd/e10/index.js +1 -1
  98. package/dist/cmd/identity/index.js +5 -8
  99. package/dist/cmd/index.js +2 -0
  100. package/dist/cmd/setup/index.js +1 -1
  101. package/dist/cmd/update/index.js +38 -0
  102. package/dist/core/manifest-view.js +1 -1
  103. package/dist/core/output.js +8 -1
  104. package/dist/core/runtime-agent.js +13 -0
  105. package/dist/core/update-notice.js +23 -0
  106. package/dist/index.js +105 -198
  107. package/dist/internal/e10/auth/agent-host-key.js +16 -0
  108. package/dist/internal/e10/auth/agent-hosts.js +45 -9
  109. package/dist/internal/e10/auth/commands.js +66 -36
  110. package/dist/internal/e10/auth/session.js +30 -15
  111. package/dist/internal/e10/auth/xiaoe.js +4 -20
  112. package/dist/internal/e10/auth-recovery.js +44 -4
  113. package/dist/internal/e10/context.js +5 -2
  114. package/dist/internal/update/bootstrap.js +96 -0
  115. package/dist/internal/update/npm.js +78 -0
  116. package/dist/internal/update/service.js +252 -0
  117. package/dist/internal/update/store.js +135 -0
  118. package/dist/shortcuts/archive/index.js +2 -2
  119. package/dist/shortcuts/archive/manifest.js +1 -0
  120. package/dist/shortcuts/archive/operations/search.js +3 -1
  121. package/dist/shortcuts/archive-oa/index.js +1 -1
  122. package/dist/shortcuts/asset/index.js +1 -1
  123. package/dist/shortcuts/asset-idle/index.js +1 -1
  124. package/dist/shortcuts/blog/index.js +1 -1
  125. package/dist/shortcuts/caizhilian/index.js +1 -1
  126. package/dist/shortcuts/calendar/index.js +1 -1
  127. package/dist/shortcuts/contract/data/bi-config.js +156 -0
  128. package/dist/shortcuts/contract/data/collection-ledger-html.js +189 -0
  129. package/dist/shortcuts/contract/data/collection-node-catalog.js +226 -0
  130. package/dist/shortcuts/contract/data/metric-catalog.js +154 -20
  131. package/dist/shortcuts/contract/data/report-renderers.js +414 -0
  132. package/dist/shortcuts/contract/data/report-spec.js +132 -0
  133. package/dist/shortcuts/contract/error-actions.js +114 -0
  134. package/dist/shortcuts/contract/host.js +12 -3
  135. package/dist/shortcuts/contract/index.js +17 -1
  136. package/dist/shortcuts/contract/manifest.js +398 -3
  137. package/dist/shortcuts/contract/ooxml/docx-table.js +48 -0
  138. package/dist/shortcuts/contract/operations/bi-preview.js +131 -0
  139. package/dist/shortcuts/contract/operations/bizreview-report.js +496 -0
  140. package/dist/shortcuts/contract/operations/collection-node.js +229 -0
  141. package/dist/shortcuts/contract/operations/docx-slots.js +735 -16
  142. package/dist/shortcuts/contract/operations/draft-build.js +940 -0
  143. package/dist/shortcuts/contract/operations/draft-submit.js +229 -0
  144. package/dist/shortcuts/contract/operations/first-screen.js +3 -2
  145. package/dist/shortcuts/contract/operations/generated-submit.js +175 -0
  146. package/dist/shortcuts/contract/operations/ledger-report.js +233 -0
  147. package/dist/shortcuts/contract/operations/ledger-stat.js +1400 -0
  148. package/dist/shortcuts/contract/operations/ledger.js +4 -1
  149. package/dist/shortcuts/contract/operations/metrics.js +9 -3
  150. package/dist/shortcuts/contract/operations/ops-draft.js +527 -0
  151. package/dist/shortcuts/contract/operations/page.js +9 -0
  152. package/dist/shortcuts/contract/operations/quote-submit.js +55 -229
  153. package/dist/shortcuts/contract/operations/registry.js +20 -0
  154. package/dist/shortcuts/contract/operations/sign-launch.js +256 -0
  155. package/dist/shortcuts/contract/operations/viewlink.js +334 -0
  156. package/dist/shortcuts/cowork/index.js +2 -2
  157. package/dist/shortcuts/ebuilder-form/index.js +1 -1
  158. package/dist/shortcuts/ehr/index.js +2 -2
  159. package/dist/shortcuts/ehr/manifest.js +1 -1
  160. package/dist/shortcuts/ehr/operations/recruit-position.js +7 -2
  161. package/dist/shortcuts/ehr/operations/recruit-write.js +7 -6
  162. package/dist/shortcuts/ehr/operations/recruit.js +318 -248
  163. package/dist/shortcuts/ehr/operations/shared.js +22 -2
  164. package/dist/shortcuts/esb/index.js +1 -1
  165. package/dist/shortcuts/fna/index.js +1 -1
  166. package/dist/shortcuts/fna/manifest.js +1 -0
  167. package/dist/shortcuts/fna/operations/expense-chart.js +3 -1
  168. package/dist/shortcuts/hrm/index.js +1 -1
  169. package/dist/shortcuts/invoice/index.js +1 -1
  170. package/dist/shortcuts/jiuchuanhui/index.js +2 -2
  171. package/dist/shortcuts/jiuchuanhui/manifest.js +3 -0
  172. package/dist/shortcuts/mail/index.js +2 -2
  173. package/dist/shortcuts/meeting/index.js +1 -1
  174. package/dist/shortcuts/meeting/manifest.js +1 -0
  175. package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -3
  176. package/dist/shortcuts/meeting/operations/eb/conflict.js +3 -1
  177. package/dist/shortcuts/meeting/operations/eb/create-flow.js +10 -9
  178. package/dist/shortcuts/meeting/operations/eb/factory.js +2 -0
  179. package/dist/shortcuts/meeting/operations/eb/member-expand.js +3 -2
  180. package/dist/shortcuts/meeting/operations/invitation-publish.js +3 -3
  181. package/dist/shortcuts/meeting/operations/invitation.js +4 -4
  182. package/dist/shortcuts/meeting/operations/link.js +3 -1
  183. package/dist/shortcuts/okr/index.js +1 -1
  184. package/dist/shortcuts/performance/index.js +1 -1
  185. package/dist/shortcuts/plan/index.js +1 -1
  186. package/dist/shortcuts/project/index.js +1 -1
  187. package/dist/shortcuts/reception/manifest.js +2 -2
  188. package/dist/shortcuts/recruit-stage/context.js +10 -2
  189. package/dist/shortcuts/recruit-stage/index.js +16 -3
  190. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +1 -1
  191. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
  192. package/dist/shortcuts/recruit-stage/operations/jd-create.js +17 -8
  193. package/dist/shortcuts/recruit-stage/operations/list.js +1 -1
  194. package/dist/shortcuts/recruit-stage/operations/resume-import.js +178 -35
  195. package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
  196. package/dist/shortcuts/recruit-stage/operations/shortlist.js +4 -2
  197. package/dist/shortcuts/recruit-stage/shared.js +27 -53
  198. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  199. package/dist/shortcuts/smart-extract/operations/fill.js +7 -2
  200. package/dist/shortcuts/smart-extract/operations/validate.js +4 -1
  201. package/dist/shortcuts/workflow/index.js +2 -2
  202. package/dist/shortcuts/workflow/manifest.js +1 -0
  203. package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +4 -1
  204. package/dist/shortcuts/workflow/operations/deepRead.js +23 -2
  205. package/dist/shortcuts/workflow/operations/form.js +8 -2
  206. package/docs/contract.md +6 -1
  207. package/docs/e10-auth.md +25 -7
  208. package/docs/operation-manual.md +15 -0
  209. package/package.json +2 -2
  210. package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
  211. package/skill-template/business-info.json +28 -0
  212. package/skill-template/domains/jinchengda.md +13 -1
  213. package/skills/weaver-e10-archive-oa/references/source-manifest.json +3 -3
  214. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +2 -1
  215. package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
  216. package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
  217. package/skills/weaver-e10-jinchengda/SKILL.md +90 -32
  218. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +45 -0
  219. package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +68 -0
  220. package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +216 -0
  221. package/skills/weaver-e10-jinchengda/references/contract-clause-negotiate.md +215 -0
  222. package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +113 -0
  223. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +19 -3
  224. package/skills/weaver-e10-jinchengda/references/contract-decisions.md +114 -0
  225. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -44
  226. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +1 -1
  227. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +1 -1
  228. package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +200 -0
  229. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -1
  230. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +138 -3
  231. package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +158 -0
  232. package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +3 -1
  233. package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +139 -0
  234. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +2 -2
  235. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +10 -3
  236. package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +106 -0
  237. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  238. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +176 -56
  239. package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +123 -0
  240. package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +410 -0
  241. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  242. package/skills/weaver-e10-jinchengda/references/contract-viewlink.md +110 -0
  243. package/skills/weaver-e10-jinchengda/references/orchestration.md +38 -24
  244. package/skills/weaver-e10-meeting/SKILL.md +13 -0
  245. package/skills/weaver-e10-okr/SKILL.md +11 -0
  246. package/skills/weaver-e10-okr/references/source-manifest.json +7 -6
  247. package/skills/weaver-e10-performance/SKILL.md +131 -39
  248. package/skills/weaver-e10-performance/agents/openai.yaml +48 -17
  249. package/skills/weaver-e10-performance/references/default-assembly.md +3 -0
  250. package/skills/weaver-e10-performance/references/extraction-guide.md +17 -3
  251. package/skills/weaver-e10-performance/references/flow-assess.md +38 -5
  252. package/skills/weaver-e10-performance/references/scheme-setting-page.md +20 -3
  253. package/skills/weaver-e10-performance/scripts/assemble_scheme.py +461 -0
  254. package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +41 -0
  255. package/skills/weaver-e10-plan/SKILL.md +10 -0
  256. package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
  257. package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
  258. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
  259. package/skills/weaver-e10-recruit-stage/SKILL.md +188 -169
  260. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +55 -37
  261. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +3 -0
  262. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +168 -35
  263. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +175 -7
  264. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +3 -0
  265. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +15 -1
  266. package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +38 -0
  267. package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +5 -1
  268. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +4 -0
  269. package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
  270. package/skills/weaver-e10-recruit-stage/references/position-templates.md +12 -8
  271. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +16 -11
  272. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +10 -6
  273. package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +5 -1
  274. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +4 -0
  275. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +7 -3
  276. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +6 -1
  277. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +7 -3
  278. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +31 -23
  279. package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +4 -0
  280. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -0
  281. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +5 -1
  282. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +4 -0
  283. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +16 -10
  284. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +6 -2
  285. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +147 -34
  286. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +4 -0
  287. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +16 -4
  288. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
  289. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +8 -4
  290. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +6 -2
  291. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +24 -15
  292. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +7 -3
  293. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +7 -3
  294. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +8 -4
  295. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +5 -1
  296. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +5 -1
  297. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +5 -1
  298. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +41 -28
  299. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +23 -26
  300. package/skills/weaver-e10-recruit-stage/templates/match-report.html +32 -30
  301. package/skills/weaver-e10-shared/SKILL.md +40 -5
  302. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -1
  303. package/skills/weaver-e10-shared/references/json-output-contract.md +144 -8
  304. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +11 -0
  305. package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
  306. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  307. package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
  308. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +5 -5
  309. package/dist/chunks/chunk-ICP53R52.js +0 -2849
  310. package/dist/chunks/registry-RIQ67ZT7.js +0 -27
package/dist/index.js CHANGED
@@ -2,211 +2,118 @@
2
2
  import { createRequire as __esbuildCreateRequire } from 'node:module';
3
3
  const require = __esbuildCreateRequire(import.meta.url);
4
4
  import {
5
- builtinCommands,
6
- createProgram,
7
- firstPositionalToken,
8
- registerCommands,
9
- toCommandMetadata
10
- } from "./chunks/chunk-ICP53R52.js";
11
- import "./chunks/chunk-54ST55IJ.js";
12
- import "./chunks/chunk-AJ62BGAW.js";
13
- import "./chunks/chunk-GWJLAF6B.js";
14
- import "./chunks/chunk-MD5CW4B6.js";
15
- import "./chunks/chunk-IU6UB2TD.js";
16
- import "./chunks/chunk-IZCQU5D5.js";
5
+ VALUE_TAKING_GLOBAL_OPTIONS,
6
+ firstPositionalToken
7
+ } from "./chunks/chunk-ZM7RN2IM.js";
17
8
  import {
18
- applyE10TlsPolicy
19
- } from "./chunks/chunk-AMAPQVBT.js";
20
- import "./chunks/chunk-UG5G54VL.js";
9
+ emitUpdateNotice,
10
+ setUpdateNotice
11
+ } from "./chunks/chunk-257JXJGD.js";
12
+ import {
13
+ UpdateService
14
+ } from "./chunks/chunk-OJ4JPD25.js";
15
+ import "./chunks/chunk-7DE3VMZD.js";
16
+ import {
17
+ packageRootDir
18
+ } from "./chunks/chunk-2BZ7TY4M.js";
21
19
  import "./chunks/chunk-BUSC6UAE.js";
22
20
 
23
- // src/shortcuts/index.ts
24
- function lazyShortcut(definition) {
25
- return {
26
- name: definition.name,
27
- description: definition.description,
28
- category: "shortcut",
29
- load: definition.load,
30
- register({ program: program2 }) {
31
- const placeholder = program2.command(definition.name).description(definition.description);
32
- placeholder.allowUnknownOption(true);
33
- placeholder.allowExcessArguments(true);
34
- placeholder.helpOption(false);
35
- placeholder.action(async () => {
36
- const { dispatchLazyShortcut } = await import("./chunks/lazy-dispatch-DW45AFQ5.js");
37
- await dispatchLazyShortcut(definition, shortcutMetadata());
38
- });
21
+ // src/internal/update/bootstrap.ts
22
+ import { readFileSync } from "node:fs";
23
+ import { join } from "node:path";
24
+ import { setTimeout as delay } from "node:timers/promises";
25
+ function runtimeAgentFromArgv(argv) {
26
+ let runtimeAgent;
27
+ for (let index = 0; index < argv.length; index += 1) {
28
+ const token = argv[index];
29
+ if (token === "--") break;
30
+ if (token.startsWith("--runtime-agent=")) runtimeAgent = token.slice("--runtime-agent=".length);
31
+ else if (VALUE_TAKING_GLOBAL_OPTIONS.has(token)) {
32
+ const value = argv[++index];
33
+ if (token === "--runtime-agent") runtimeAgent = value;
39
34
  }
40
- };
35
+ }
36
+ return runtimeAgent;
41
37
  }
42
- var builtinShortcuts = [
43
- lazyShortcut({
44
- name: "invoice",
45
- description: "E10 \u4E1A\u7968\u901A\u53D1\u7968\u7BA1\u7406 CLI",
46
- load: async () => (await import("./chunks/invoice-PVYCCCVM.js")).invoiceShortcut
47
- }),
48
- lazyShortcut({
49
- name: "ehr",
50
- description: "\u6CDB\u5FAEE10\u805A\u624D\u6797\uFF08\u4EBA\u4E8B/\u51FA\u52E4/\u85AA\u916C\uFF09CLI",
51
- load: async () => (await import("./chunks/ehr-LCNAVMK5.js")).ehrShortcut
52
- }),
53
- lazyShortcut({
54
- name: "recruit-stage",
55
- description: "\u6CDB\u5FAEE10\u62DB\u8058\u52A9\u624B\uFF08JD\u751F\u6210/\u7B80\u5386\u5EFA\u6863/AI\u9762\u8BD5\u9080\u7EA6\uFF09CLI",
56
- load: async () => (await import("./chunks/recruit-stage-WOSN6MGP.js")).recruitStageShortcut
57
- }),
58
- lazyShortcut({
59
- name: "performance",
60
- description: "\u6CDB\u5FAEE10\u7EE9\u6548\u65B9\u6848\uFF08\u6587\u6863\u5BFC\u5165/\u5B9E\u4F53\u89E3\u6790/\u843D\u8349\u7A3F/\u786E\u8BA4\u53D1\u5E03\uFF09CLI",
61
- load: async () => (await import("./chunks/performance-7W5COCFU.js")).performanceShortcut
62
- }),
63
- lazyShortcut({
64
- name: "cowork",
65
- description: "\u6CDB\u5FAEE10\u534F\u4F5C\u533A\uFF08\u534F\u4F5C\u4E8B\u9879/\u8BA8\u8BBA/\u5BA1\u6279/\u5171\u4EAB\u6743\u9650\uFF09CLI",
66
- load: async () => (await import("./chunks/cowork-34QCHMDD.js")).coworkShortcut
67
- }),
68
- lazyShortcut({
69
- name: "archive",
70
- description: "E10 \u6587\u4E66\u5B9A\u6863\u6848\u7BA1\u7406 CLI",
71
- load: async () => (await import("./chunks/archive-THZV4ND4.js")).archiveShortcut
72
- }),
73
- lazyShortcut({
74
- name: "archive-oa",
75
- description: "E10 \u6863\u6848\u5B9A\u4F4D\u4E0E OA \u5546\u52A1\u5408\u540C\u501F\u9605 CLI",
76
- load: async () => (await import("./chunks/archive-oa-PQ23OLEV.js")).archiveOaShortcut
77
- }),
78
- lazyShortcut({
79
- name: "calendar",
80
- description: "\u6CDB\u5FAEE10\u65E5\u7A0B\u7BA1\u7406 CLI\uFF08\u521B\u5EFA/\u67E5\u8BE2/\u66F4\u65B0/\u5220\u9664/\u5B57\u5178\uFF09",
81
- load: async () => (await import("./chunks/calendar-KINM64E4.js")).calendarShortcut
82
- }),
83
- lazyShortcut({
84
- name: "fna",
85
- description: "\u6CDB\u5FAEE10\u9F50\u4E1A\u6210\u8D39\u63A7\u4E2D\u5FC3\uFF08\u9884\u7B97/\u8D39\u7528\u4E2D\u5FC3/\u501F\u6B3E\u7BA1\u7406/\u53D1\u7968\u6838\u9500\uFF09CLI",
86
- load: async () => (await import("./chunks/fna-AKBSG5HI.js")).fnaShortcut
87
- }),
88
- lazyShortcut({
89
- name: "hrm",
90
- description: "\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5/\u7EC4\u7EC7/\u5C97\u4F4D\u67E5\u8BE2\uFF09CLI",
91
- load: async () => (await import("./chunks/hrm-WGODDTEH.js")).hrmShortcut
92
- }),
93
- lazyShortcut({
94
- name: "mail",
95
- description: "\u6CDB\u5FAEE10\u90AE\u4EF6\u7BA1\u7406 CLI",
96
- load: async () => (await import("./chunks/mail-BNB5S4NW.js")).mailShortcut
97
- }),
98
- lazyShortcut({
99
- name: "meeting",
100
- description: "\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406 CLI\uFF08\u6807\u51C6\u7248\uFF1A\u67E5\u8BE2/\u51B2\u7A81/\u9884\u7EA6/\u56DE\u6267/\u7B7E\u5230\uFF09",
101
- load: async () => (await import("./chunks/meeting-O2KDJH66.js")).meetingShortcut
102
- }),
103
- lazyShortcut({
104
- name: "okr",
105
- description: "\u6CDB\u5FAEE10 OKR \u76EE\u6807\u7BA1\u7406 CLI\uFF08\u76EE\u6807\u67E5\u8BE2/\u65B0\u5EFA/\u7F16\u8F91\u3001\u5173\u952E\u6210\u679C\u3001\u76EE\u6807\u5BF9\u9F50\u3001\u8BC4\u8BBA\uFF09",
106
- load: async () => (await import("./chunks/okr-LWFGWOE7.js")).okrShortcut
107
- }),
108
- lazyShortcut({
109
- name: "plan",
110
- description: "\u6CDB\u5FAEE10\u8BA1\u5212\u62A5\u544A CLI\uFF08\u67E5\u8BE2/\u65B0\u5EFA/\u4FEE\u6539/\u53D1\u5E03/\u64A4\u56DE/\u63D0\u4EA4\u63D0\u9192/\u8BC4\u8BBA\uFF09",
111
- load: async () => (await import("./chunks/plan-ZVY3IYTL.js")).planShortcut
112
- }),
113
- lazyShortcut({
114
- name: "esb",
115
- description: "\u6CDB\u5FAEE10 ESB \u4E2D\u5FC3\u81EA\u5B9A\u4E49\u89E6\u53D1\u52A8\u4F5C\u6D41 CLI",
116
- load: async () => (await import("./chunks/esb-ANKPUU65.js")).esbShortcut
117
- }),
118
- lazyShortcut({
119
- name: "ebuilder-form",
120
- description: "\u6CDB\u5FAEE10 eBuilder \u8868\u5355\u83DC\u5355\u3001\u5217\u8868\u548C\u8868\u5355\u6570\u636E CLI",
121
- load: async () => (await import("./chunks/ebuilder-form-W5R7Q22S.js")).ebuilderFormShortcut
122
- }),
123
- lazyShortcut({
124
- name: "jiuchuanhui",
125
- description: "\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406 CLI\uFF08\u5BA2\u6237/\u8054\u7CFB\u4EBA/\u5546\u673A/\u7EBF\u7D22/\u8054\u7CFB\u8BA1\u5212/\u516C\u6D77\uFF09",
126
- load: async () => (await import("./chunks/jiuchuanhui-RKOQW7BY.js")).jiuchuanhuiShortcut
127
- }),
128
- lazyShortcut({
129
- name: "asset",
130
- description: "E10 \u8D44\u4EA7\u7BA1\u7406\uFF08\u8D44\u7BA1\u5BB6\uFF09CLI",
131
- load: async () => (await import("./chunks/asset-RGPROZYH.js")).assetShortcut
132
- }),
133
- lazyShortcut({
134
- name: "asset-idle",
135
- description: "E10 \u95F2\u7F6E\u8D44\u4EA7\u5224\u5B9A\u7ED3\u679C\u67E5\u8BE2 CLI\uFF08\u5206\u9875\u83B7\u53D6/\u805A\u5408\u7EDF\u8BA1\uFF09",
136
- load: async () => (await import("./chunks/asset-idle-Z2PDX7NA.js")).assetIdleShortcut
137
- }),
138
- lazyShortcut({
139
- name: "im",
140
- description: "\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF08\u5373\u65F6\u901A\u8BAF\uFF09CLI",
141
- load: async () => (await import("./chunks/im-YKTKAJU3.js")).imShortcut
142
- }),
143
- lazyShortcut({
144
- name: "project",
145
- description: "\u6CDB\u5FAEE10\u4E8B\u4E95\u7136\u9879\u76EE\u7BA1\u7406 CLI\uFF08\u9879\u76EE/\u4EFB\u52A1\u67E5\u8BE2\u4E0E\u786E\u8BA4\u5199\u5165\uFF09",
146
- load: async () => (await import("./chunks/project-SA62B7MH.js")).projectShortcut
147
- }),
148
- lazyShortcut({
149
- name: "workflow",
150
- description: "\u6CDB\u5FAEE10\u6D41\u7A0B\u667A\u80FD\u52A9\u624B CLI\uFF08\u67E5\u8BE2/\u67E5\u770B/\u64CD\u4F5C/\u6279\u91CF/\u53D1\u8D77/\u4FEE\u6539\uFF09",
151
- load: async () => (await import("./chunks/workflow-V5ALD6QZ.js")).workflowShortcut
152
- }),
153
- lazyShortcut({
154
- name: "blog",
155
- description: "\u6CDB\u5FAEE10\u5DE5\u4F5C\u65E5\u62A5 CLI\uFF08\u67E5\u8BE2/\u53D1\u5E03/\u7F16\u8F91/\u8BC4\u8BBA/\u70B9\u8D5E/\u63D0\u9192/\u5BFC\u51FA\uFF09",
156
- load: async () => (await import("./chunks/blog-7U3QZPIF.js")).blogShortcut
157
- }),
158
- lazyShortcut({
159
- name: "caizhilian",
160
- description: "\u6CDB\u5FAEE10\u91C7\u77E5\u8FDE\uFF08\u6587\u6863\u4E2D\u5FC3\uFF09CLI",
161
- load: async () => (await import("./chunks/caizhilian-3AB42GCV.js")).caizhilianShortcut
162
- }),
163
- lazyShortcut({
164
- name: "contract",
165
- description: "\u6CDB\u5FAEE10\u4ECA\u627F\u8FBE\u5408\u540C\u7BA1\u7406 CLI",
166
- load: async () => (await import("./chunks/contract-DDXAO2DZ.js")).contractShortcut
167
- }),
168
- lazyShortcut({
169
- name: "reception",
170
- description: "\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B CLI\uFF08\u9762\u677F/\u884C\u7A0B\u5355\u4E0E\u5185\u90E8\u65B9\u6848/\u586B\u5355\u9875\u9884\u586B\uFF09",
171
- load: async () => (await import("./chunks/reception-NGIONPQ3.js")).receptionShortcut
172
- }),
173
- lazyShortcut({
174
- name: "smart-extract",
175
- description: "\u6CDB\u5FAEE10\u667A\u80FD\u62BD\u53D6 CLI\uFF08\u8868\u5355\u7ED3\u6784 / \u9644\u4EF6\u6B63\u6587 / \u6821\u9A8C\u5E76\u843D\u5E93\uFF0C\u8FD4\u56DE aiExtraId\uFF09",
176
- load: async () => (await import("./chunks/smart-extract-DDOQSPRB.js")).smartExtractShortcut
177
- }),
178
- lazyShortcut({
179
- name: "data",
180
- description: "\u6CDB\u5FAEE10\u6570\u636E\u52A9\u624B CLI\uFF08\u6570\u636E\u6E90\u67E5\u8BE2 / \u914D\u7F6E\u4E2D\u5FC3 / \u573A\u666F\u5B9A\u4F4D\uFF09",
181
- load: async () => (await import("./chunks/data-CLQ62QGD.js")).dataShortcut
182
- })
183
- ];
184
- function shortcutMetadata() {
185
- return builtinShortcuts;
38
+ function startupCommand(argv) {
39
+ const normalized = argv.filter((token, index) => !(index > 0 && argv[index - 1] === "--is-connector" && ["true", "false", "1", "0", "yes", "no"].includes(token.toLowerCase())));
40
+ return firstPositionalToken(normalized);
186
41
  }
187
- async function loadShortcuts(names) {
188
- const wanted = new Set(names);
189
- const hits = builtinShortcuts.filter((shortcut) => wanted.has(shortcut.name));
190
- return Promise.all(hits.map((shortcut) => shortcut.load()));
191
- }
192
- async function loadAllShortcuts() {
193
- return Promise.all(builtinShortcuts.map((shortcut) => shortcut.load()));
42
+ async function bootstrap(argv = process.argv.slice(2)) {
43
+ const root = packageRootDir();
44
+ const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
45
+ const updater = new UpdateService({
46
+ packageRoot: root,
47
+ currentVersion: pkg.version,
48
+ env: process.env,
49
+ runtimeAgent: runtimeAgentFromArgv(argv)
50
+ });
51
+ const command = startupCommand(argv);
52
+ const informational = !command || argv.some((arg) => ["--help", "-h", "--version", "-V"].includes(arg));
53
+ let release;
54
+ if (updater.isNpmInstallation) {
55
+ try {
56
+ const deadline = Date.now() + 2e3;
57
+ while (!(release = updater.store.enter())) {
58
+ if (Date.now() >= deadline) {
59
+ process.stderr.write(JSON.stringify({
60
+ ok: false,
61
+ error: {
62
+ type: "cli",
63
+ subtype: "update_in_progress",
64
+ retryable: true,
65
+ message: "CLI \u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u6267\u884C\u547D\u4EE4\u3002"
66
+ }
67
+ }) + "\n");
68
+ process.exitCode = 1;
69
+ return { handled: true };
70
+ }
71
+ await delay(25);
72
+ }
73
+ process.once("exit", release);
74
+ } catch {
75
+ }
76
+ }
77
+ const cleanup = () => {
78
+ if (release) {
79
+ process.removeListener("exit", release);
80
+ release();
81
+ }
82
+ };
83
+ if (command === "update") {
84
+ try {
85
+ const [{ createProgram }, { registerCommands }, { updateCommand }] = await Promise.all([
86
+ import("./chunks/root-YZG2TS5W.js"),
87
+ import("./chunks/register-SQOPIR2G.js"),
88
+ import("./chunks/update-AV5VOXGY.js")
89
+ ]);
90
+ const { program, ctx } = createProgram();
91
+ await registerCommands(program, ctx, [updateCommand]);
92
+ await program.parseAsync();
93
+ return { handled: true };
94
+ } finally {
95
+ cleanup();
96
+ }
97
+ }
98
+ if (!informational && !updater.skipReason) {
99
+ try {
100
+ await updater.check();
101
+ if (!argv.includes("--quiet")) {
102
+ setUpdateNotice(updater.notice());
103
+ process.once("exit", emitUpdateNotice);
104
+ }
105
+ } catch {
106
+ }
107
+ }
108
+ return { handled: false, release: cleanup };
194
109
  }
195
110
 
196
111
  // src/index.ts
197
- applyE10TlsPolicy();
198
- var BUILTIN_NAMES = new Set(builtinCommands.map((command) => command.name));
199
- async function selectShortcuts(wanted) {
200
- if (!wanted) return builtinShortcuts;
201
- if (builtinShortcuts.some((shortcut) => shortcut.name === wanted)) return loadShortcuts([wanted]);
202
- if (BUILTIN_NAMES.has(wanted)) return builtinShortcuts;
203
- return loadAllShortcuts();
112
+ var startup = await bootstrap();
113
+ if (!startup.handled) {
114
+ try {
115
+ await import("./chunks/cli-FULPXIKJ.js");
116
+ } finally {
117
+ startup.release?.();
118
+ }
204
119
  }
205
- var { program, ctx } = createProgram();
206
- await registerCommands(program, ctx, [
207
- ...builtinCommands,
208
- ...await selectShortcuts(firstPositionalToken(process.argv.slice(2)))
209
- ]);
210
- ctx.commands = toCommandMetadata([...builtinCommands, ...shortcutMetadata()]);
211
- ctx.modules = ctx.commands;
212
- await program.parseAsync();
@@ -8,6 +8,7 @@
8
8
  * 关键约束:**不能用 `resolveAgentType()` 的返回值当 key**。它的 fallback 是
9
9
  * `weaver-work-cli`,会让「终端手工执行」也写出一条宿主记录,污染分区。
10
10
  */
11
+ import { isXiaoERuntimeAgent } from '../../../core/runtime-agent.js';
11
12
  function hasEnvPrefix(env, prefix) {
12
13
  return Object.keys(env).some((key) => key === prefix || key.startsWith(`${prefix}_`));
13
14
  }
@@ -29,6 +30,21 @@ const AGENT_HOST_PREFIXES = [
29
30
  ];
30
31
  /** 无任何宿主标识时的分区,表示终端/未知宿主。 */
31
32
  export const DEFAULT_AGENT_HOST_KEY = 'default';
33
+ export function resolveSessionHostKey(env, options = {}) {
34
+ if (isXiaoERuntimeAgent(options.runtimeAgent))
35
+ return 'xiaoe';
36
+ return resolveAgentHostKey(env, options.runtimeAgent);
37
+ }
38
+ export function isIsolatedAgentHost(hostKey) {
39
+ return hostKey === 'workbuddy' || hostKey === 'xiaoe';
40
+ }
41
+ export function matchesAgentHost(hostKey, agentType) {
42
+ if (hostKey === 'xiaoe')
43
+ return isXiaoERuntimeAgent(agentType);
44
+ if (hostKey === 'workbuddy')
45
+ return normalizeAgentHostKey(agentType) === 'workbuddy';
46
+ return true;
47
+ }
32
48
  export function normalizeAgentHostKey(value) {
33
49
  return value.trim().toLowerCase().replace(/[^a-z0-9]+/gu, '');
34
50
  }
@@ -1,7 +1,9 @@
1
1
  import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { isConnectorMode } from '../../../core/connector.js';
4
- import { resolveAgentHostKey } from './agent-host-key.js';
4
+ import { CliError, ExitCode } from '../../../core/errors.js';
5
+ import { isIsolatedAgentHost, matchesAgentHost, resolveAgentHostKey } from './agent-host-key.js';
6
+ import { parseAuthFile } from './crypto.js';
5
7
  import { getE10AgentsPath, getE10ProfilesRoot } from './paths.js';
6
8
  const AGENTS_FILE_VERSION = 1;
7
9
  /** 拿锁的最长等待,超时后退化为无锁写:宁可偶尔丢记录,也不能让登录卡死。 */
@@ -84,7 +86,8 @@ function readProfileConfigAt(profile) {
84
86
  /**
85
87
  * 查找当前宿主记住的 profile,并给出可用性判定。
86
88
  *
87
- * 返回 `null` 表示**没有该宿主的记录**,调用方应回落到全局 `profile` 指针(旧行为)。
89
+ * 返回 `null` 表示**没有该宿主的记录**。WorkBuddy / XiaoE 按未登录处理;
90
+ * 其他宿主可保留全局 profile 的兼容行为。
88
91
  * 返回非 `ok` 的记录表示「该宿主曾经登录过,但现在不能直接用」:此时调用方必须
89
92
  * 视为未登录,**不能**借用其他宿主的 profile,否则就是跨租户串用凭据。
90
93
  */
@@ -113,20 +116,53 @@ export function lookupAgentHost(env = process.env, explicitAgentType = '') {
113
116
  /**
114
117
  * 决定本次登录写哪个 profile。
115
118
  *
116
- * 默认沿用按域名派生的名字;只有当**另一个宿主已经占用同名 profile 且域名不同**时,
117
- * 才加 `-<hostKey>` 后缀隔离。`profileNameFromUrl` 只看注册域标签,
118
- * `weapp.xx.cn` 与 `www.xx.cn` 会撞成同一个名字,不加后缀就会互相把对方挤下线。
119
- *
120
- * 两个宿主登同一个域名时**不加后缀**:同租户共用一份凭据是合理的,也不该制造两份登录态。
119
+ * WorkBuddy / XiaoE 的新 profile 固定带宿主后缀;已有且归属正确的旧记录可以沿用。
120
+ * 显式 profile 必须检查归属,不能借登录覆盖另一宿主的会话。
121
+ * 其他宿主保留按域名派生及不同域名冲突时加后缀的兼容行为。
121
122
  */
122
123
  export function resolveLoginProfileName(input) {
123
124
  const hinted = (input.profileHint || '').trim();
124
- if (hinted)
125
- return hinted;
126
125
  const derived = (input.derivedName || '').trim() || 'default';
127
126
  const hostKey = (input.hostKey || '').trim() || resolveAgentHostKey(input.env || process.env);
128
127
  const origin = normalizeOrigin(input.baseUrl);
129
128
  const hosts = readAgentHosts()?.hosts || {};
129
+ const ownedByAnotherHost = (profile) => {
130
+ if (Object.entries(hosts).some(([key, record]) => key !== hostKey && record.profile === profile
131
+ && (isIsolatedAgentHost(key) || isIsolatedAgentHost(hostKey))))
132
+ return true;
133
+ try {
134
+ const data = parseAuthFile(readFileSync(resolve(getE10ProfilesRoot(), profile, 'auth'), 'utf-8'));
135
+ const agentType = data?.agentType || data?.agent_type || '';
136
+ return Boolean(data) && (!matchesAgentHost(hostKey, agentType)
137
+ || (isIsolatedAgentHost(resolveAgentHostKey({}, agentType)) && resolveAgentHostKey({}, agentType) !== hostKey));
138
+ }
139
+ catch {
140
+ return false;
141
+ }
142
+ };
143
+ if (hinted) {
144
+ if (ownedByAnotherHost(hinted)) {
145
+ throw new CliError(`E10 profile "${hinted}" belongs to another agent host. Select a separate profile for ${hostKey}.`, ExitCode.AuthError);
146
+ }
147
+ return hinted;
148
+ }
149
+ // 新的隔离宿主从首次登录就使用独立名称,避免两个宿主同时首次登录时撞写。
150
+ // 已有、归属正确的旧记录仍可沿用,避免升级后强制用户重新授权。
151
+ if (isIsolatedAgentHost(hostKey)
152
+ && !(hosts[hostKey]?.profile === derived && !ownedByAnotherHost(derived))) {
153
+ const isolated = `${derived}-${hostKey}`;
154
+ if (ownedByAnotherHost(isolated)) {
155
+ throw new CliError(`E10 profile "${isolated}" belongs to another agent host. Select a separate profile for ${hostKey}.`, ExitCode.AuthError);
156
+ }
157
+ return isolated;
158
+ }
159
+ if (ownedByAnotherHost(derived)) {
160
+ const isolated = `${derived}-${hostKey}`;
161
+ if (ownedByAnotherHost(isolated)) {
162
+ throw new CliError(`E10 profile "${isolated}" belongs to another agent host. Select a separate profile for ${hostKey}.`, ExitCode.AuthError);
163
+ }
164
+ return isolated;
165
+ }
130
166
  const claimedByOthers = Object.entries(hosts)
131
167
  .filter(([key, record]) => key !== hostKey && record.profile === derived);
132
168
  if (!claimedByOthers.length)
@@ -7,7 +7,7 @@ import { CliError, ExitCode } from '../../../core/errors.js';
7
7
  import { clearInvoiceTokenForSession } from '../../../shortcuts/invoice/host.js';
8
8
  import { buildE10CookieHeader, E10AuthSession, clearProfileAuthFile, extractRawSetCookie, extractSessionTicket, findAuthFile, getActiveProfile, getProfileAuthPath, getProfileDir, listProfiles, profileNameFromUrl, readProfileConfig, readTeamsCheckUserInfo, resolveActiveProfileForHost, saveAuthFile, saveProfileConfig, setActiveProfile, switchActiveProfile, } from './session.js';
9
9
  import { lookupAgentHost, resolveLoginProfileName, upsertAgentHost } from './agent-hosts.js';
10
- import { resolveAgentHostKey } from './agent-host-key.js';
10
+ import { isIsolatedAgentHost, resolveAgentHostKey, resolveSessionHostKey } from './agent-host-key.js';
11
11
  import { getE10AuthRoot } from './paths.js';
12
12
  import { appendXiaoEAuthErrorLog, clearXiaoEAuthErrorLog, getXiaoEAuthErrorLogPath, normalizeXiaoEAuthErrorLogLimit, readXiaoEAuthErrorLog, xiaoEAuthLogSecrets, } from './error-log.js';
13
13
  import { XIAOE_AGENT_TYPE, createXiaoEUnifiedLoginUnavailableError, hasXiaoEEnv, inspectXiaoEUnifiedLoginSources, resolveDefaultE10BaseUrl, resolveXiaoEPreferredBaseUrl, tryXiaoEUnifiedLogin as tryXiaoEUnifiedSessionLogin, } from './xiaoe.js';
@@ -100,7 +100,7 @@ export function resolveAgentType(options = {}, env = process.env) {
100
100
  || DEFAULT_AGENT_TYPE;
101
101
  }
102
102
  /**
103
- * 登录类命令的目标解析:先按宿主记忆,再退回全局指针。
103
+ * 登录目标优先按宿主记忆解析;WorkBuddy / XiaoE 不借用全局指针。
104
104
  *
105
105
  * 优先级的完整定义见 `docs/e10-auth.md`;这里只负责「读哪个 profile 的 config」,
106
106
  * 真正拼 baseUrl 时调用方仍把显式 `--base-url` 放在最前面。
@@ -121,6 +121,8 @@ function resolveLoginTarget(input) {
121
121
  return { hostKey, profile: host.profile, cfg };
122
122
  }
123
123
  const active = getActiveProfile();
124
+ if (isIsolatedAgentHost(hostKey))
125
+ return { hostKey, profile: hostKey, cfg: {} };
124
126
  return { hostKey, profile: active, cfg: readProfileConfig(active) };
125
127
  }
126
128
  function normalizeAgentKey(value) {
@@ -221,9 +223,27 @@ function cookieValue(rawCookie, name) {
221
223
  const match = rawCookie.match(new RegExp(`${name}=([^;]+)`));
222
224
  return match?.[1] || '';
223
225
  }
226
+ async function resolveAuthState(session, probe) {
227
+ if (!session) {
228
+ return { hasSessionFile: false, expired: false, reachable: undefined, authorized: false };
229
+ }
230
+ const expired = session.isExpired();
231
+ // 过期后不再发探活请求:结论已经确定,省一次必然 401 的往返。
232
+ const reachable = expired ? false : probe ? await session.probeValid() : undefined;
233
+ // 网络异常保持乐观:只有明确失效(401/403)或已过期才算未授权,避免逼用户重复登录。
234
+ return { hasSessionFile: true, expired, reachable, authorized: reachable !== false };
235
+ }
224
236
  function formatAuthStatus(status) {
225
237
  if (!status.loggedIn) {
226
- return 'Not logged in. Select the appropriate authentication method for the current runtime before retrying.';
238
+ const lines = ['Not logged in. Select the appropriate authentication method for the current runtime before retrying.'];
239
+ if (status.hasSessionFile) {
240
+ lines.push('session file exists but is not usable:');
241
+ lines.push('authFile: ' + status.authFile);
242
+ lines.push('expired: ' + String(status.expired));
243
+ if ('reachable' in status)
244
+ lines.push('reachable: ' + String(status.reachable));
245
+ }
246
+ return lines.join('\n');
227
247
  }
228
248
  const lines = [
229
249
  'Logged in.',
@@ -245,8 +265,8 @@ function formatAuthStatus(status) {
245
265
  ...('credentialSourceLabel' in status && status.credentialSourceLabel ? ['credentialSourceLabel: ' + status.credentialSourceLabel] : []),
246
266
  ...('expiryTimes' in status && status.expiryTimes ? ['expiryTimes: ' + status.expiryTimes] : []),
247
267
  ];
248
- if ('valid' in status) {
249
- lines.push('valid: ' + String(status.valid));
268
+ if ('reachable' in status) {
269
+ lines.push('reachable: ' + String(status.reachable));
250
270
  }
251
271
  return lines.join('\n');
252
272
  }
@@ -714,8 +734,8 @@ async function runXiaoELogin(ctx, options) {
714
734
  const commandOpts = asOptions(options);
715
735
  const globalOptions = ctx.getGlobalOptions();
716
736
  const profileFromGlobal = globalOptions.profile;
717
- const hostKey = resolveAgentHostKey(ctx.env);
718
- const cfg = readProfileConfig(profileFromGlobal || resolveActiveProfileForHost(ctx.env));
737
+ const hostKey = 'xiaoe';
738
+ const cfg = readProfileConfig(profileFromGlobal || resolveActiveProfileForHost(ctx.env, { runtimeAgent: 'xiaoe' }));
719
739
  const explicitBaseUrl = optionString(commandOpts, 'baseUrl') || globalOptions.baseUrl || '';
720
740
  const preferredXiaoEBaseUrl = resolveXiaoEPreferredBaseUrl({
721
741
  explicitBaseUrl,
@@ -782,7 +802,7 @@ async function runXiaoELogin(ctx, options) {
782
802
  }).catch((logError) => ctx.logger.debug(`Could not persist XiaoE auth error log: ${logError instanceof Error ? logError.message : String(logError)}`));
783
803
  throw error;
784
804
  }
785
- async function runBrowserLogin(ctx, options, loginMode = {}) {
805
+ export async function runBrowserLogin(ctx, options, loginMode = {}) {
786
806
  const commandOpts = asOptions(options);
787
807
  const globalOptions = ctx.getGlobalOptions();
788
808
  const profileFromGlobal = globalOptions.profile;
@@ -1216,16 +1236,19 @@ export function registerE10AuthCommands(parent, action) {
1216
1236
  .action(action(async (ctx, options) => {
1217
1237
  const opts = ctx.getGlobalOptions();
1218
1238
  const commandOpts = asOptions(options);
1219
- const authFile = findAuthFile(ctx.cwd, opts);
1239
+ const authFile = findAuthFile(ctx.cwd, opts, ctx.env);
1220
1240
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1221
- const profile = opts.profile || resolveActiveProfileForHost(ctx.env);
1222
- const agentHost = resolveAgentHostKey(ctx.env);
1223
- const valid = session && commandOpts.check !== false
1224
- ? session.isExpired() ? false : await session.checkValid()
1225
- : undefined;
1241
+ const profile = opts.profile || resolveActiveProfileForHost(ctx.env, opts);
1242
+ const agentHost = resolveSessionHostKey(ctx.env, opts);
1243
+ const state = await resolveAuthState(session, commandOpts.check !== false);
1226
1244
  const status = session
1227
1245
  ? {
1228
- loggedIn: true,
1246
+ status: state.authorized ? 'authorized' : 'unauthorized',
1247
+ // 名字必须配得上语义:`loggedIn` 只表示"登录有效",不表示"有会话文件"。
1248
+ loggedIn: state.authorized,
1249
+ hasSessionFile: true,
1250
+ expired: state.expired,
1251
+ reachable: state.reachable,
1229
1252
  userId: session.userId,
1230
1253
  tenantKey: session.tenantKey,
1231
1254
  tenantName: session.tenantName,
@@ -1245,10 +1268,12 @@ export function registerE10AuthCommands(parent, action) {
1245
1268
  ...(session.credentialSourceType ? { credentialSourceType: session.credentialSourceType } : {}),
1246
1269
  ...(session.credentialSourceLabel ? { credentialSourceLabel: session.credentialSourceLabel } : {}),
1247
1270
  ...(session.expiryTimes ? { expiryTimes: session.expiryTimes } : {}),
1248
- valid,
1249
1271
  }
1250
1272
  : {
1273
+ status: 'unauthorized',
1251
1274
  loggedIn: false,
1275
+ hasSessionFile: false,
1276
+ expired: false,
1252
1277
  profile,
1253
1278
  agentHost,
1254
1279
  authFile,
@@ -1262,24 +1287,20 @@ export function registerE10AuthCommands(parent, action) {
1262
1287
  .action(action(async (ctx, options) => {
1263
1288
  const opts = ctx.getGlobalOptions();
1264
1289
  const commandOpts = asOptions(options);
1265
- const authFile = findAuthFile(ctx.cwd, opts);
1290
+ const authFile = findAuthFile(ctx.cwd, opts, ctx.env);
1266
1291
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1267
- const profile = opts.profile || resolveActiveProfileForHost(ctx.env);
1268
- const expired = session ? session.isExpired() : false;
1269
- // 三态探活:只有明确失效(401/403)才算未授权,网络异常保持乐观,避免逼用户重复登录。
1270
- const probe = session && !expired && commandOpts.check !== false
1271
- ? await session.probeValid()
1272
- : undefined;
1273
- const authorized = Boolean(session) && !expired && probe !== false;
1292
+ const profile = opts.profile || resolveActiveProfileForHost(ctx.env, opts);
1293
+ const state = await resolveAuthState(session, commandOpts.check !== false);
1274
1294
  if (commandOpts.status === true) {
1275
- ctx.output.raw(JSON.stringify({ status: authorized ? 'authorized' : 'unauthorized' }));
1295
+ ctx.output.raw(JSON.stringify({ status: state.authorized ? 'authorized' : 'unauthorized' }));
1276
1296
  return;
1277
1297
  }
1278
1298
  ctx.output.write({
1279
- status: authorized ? 'authorized' : 'unauthorized',
1280
- loggedIn: Boolean(session),
1281
- expired,
1282
- reachable: probe,
1299
+ status: state.authorized ? 'authorized' : 'unauthorized',
1300
+ loggedIn: state.authorized,
1301
+ hasSessionFile: state.hasSessionFile,
1302
+ expired: state.expired,
1303
+ reachable: state.reachable,
1283
1304
  profile,
1284
1305
  baseUrl: session ? session.getBaseUrl() : '',
1285
1306
  }, { json: true });
@@ -1332,8 +1353,12 @@ export function registerE10AuthCommands(parent, action) {
1332
1353
  .action(action(async (ctx) => {
1333
1354
  const opts = ctx.getGlobalOptions();
1334
1355
  // 当前宿主有记录时清它自己的 profile,避免在 WorkBuddy 里把智能小 E 的登录清掉。
1335
- const profile = opts.profile || resolveActiveProfileForHost(ctx.env);
1336
- const authFile = getProfileAuthPath(profile);
1356
+ const profile = opts.profile || resolveActiveProfileForHost(ctx.env, opts);
1357
+ const authFile = findAuthFile(ctx.cwd, { ...opts, auth: undefined, profile }, ctx.env);
1358
+ if (!authFile) {
1359
+ ctx.output.write({ profile, cleared: false }, { text: 'No E10 auth to clear.' });
1360
+ return;
1361
+ }
1337
1362
  const session = E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl);
1338
1363
  if (session) {
1339
1364
  await clearInvoiceTokenCache(profile, {
@@ -1356,11 +1381,11 @@ export function registerE10AuthCommands(parent, action) {
1356
1381
  const commandOpts = asOptions(options);
1357
1382
  const json = commandOpts.json === true;
1358
1383
  const live = commandOpts.live === true;
1359
- const authFile = findAuthFile(ctx.cwd, opts);
1384
+ const authFile = findAuthFile(ctx.cwd, opts, ctx.env);
1360
1385
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1361
1386
  if (!session || !session.eteamsId)
1362
1387
  throw new CliError('E10 auth not found.', ExitCode.AuthError);
1363
- const profile = opts.profile || resolveActiveProfileForHost(ctx.env);
1388
+ const profile = opts.profile || resolveActiveProfileForHost(ctx.env, opts);
1364
1389
  const cached = sessionToCachedUser(session, profile);
1365
1390
  if (!live) {
1366
1391
  ctx.output.write(cached, {
@@ -1404,7 +1429,7 @@ export function registerE10AuthCommands(parent, action) {
1404
1429
  .option('--shell <shell>', 'Shell syntax: auto, posix, or powershell', 'auto')
1405
1430
  .action(action(async (ctx, options) => {
1406
1431
  const commandOpts = asOptions(options);
1407
- const session = await E10AuthSession.fromOptions(ctx.getGlobalOptions(), ctx.cwd);
1432
+ const session = await E10AuthSession.fromOptions(ctx.getGlobalOptions(), ctx.cwd, {}, ctx.env);
1408
1433
  if (!session)
1409
1434
  throw new CliError('E10 auth not found.', ExitCode.AuthError);
1410
1435
  const value = {
@@ -1439,11 +1464,16 @@ export function registerE10AuthCommands(parent, action) {
1439
1464
  .action(action((ctx, name) => {
1440
1465
  if (typeof name !== 'string')
1441
1466
  throw new CliError('profile name must be a string', ExitCode.UsageError);
1467
+ resolveLoginProfileName({
1468
+ derivedName: name, profileHint: name, baseUrl: '',
1469
+ hostKey: resolveSessionHostKey(ctx.env, ctx.getGlobalOptions()),
1470
+ });
1442
1471
  switchActiveProfile(name);
1443
1472
  // 显式切换同时更新宿主记忆:否则下一次登录会被旧记录带回原来的 profile。
1444
1473
  const cfg = readProfileConfig(name);
1445
1474
  const hostRecord = upsertAgentHost({
1446
1475
  profile: name,
1476
+ hostKey: resolveSessionHostKey(ctx.env, ctx.getGlobalOptions()),
1447
1477
  ...(cfg.baseUrl ? { baseUrl: cfg.baseUrl } : {}),
1448
1478
  ...(cfg.tenantKey ? { tenantKey: cfg.tenantKey } : {}),
1449
1479
  env: ctx.env,
@@ -1452,7 +1482,7 @@ export function registerE10AuthCommands(parent, action) {
1452
1482
  active: name,
1453
1483
  dir: getProfileDir(name),
1454
1484
  authFile: getProfileAuthPath(name),
1455
- agentHost: resolveAgentHostKey(ctx.env),
1485
+ agentHost: resolveSessionHostKey(ctx.env, ctx.getGlobalOptions()),
1456
1486
  ...(hostRecord ? { agentHostProfile: hostRecord.profile } : {}),
1457
1487
  };
1458
1488
  ctx.output.write(result, { text: 'Active E10 profile: ' + name + '\n' + 'dir: ' + result.dir });
@@ -1460,7 +1490,7 @@ export function registerE10AuthCommands(parent, action) {
1460
1490
  profile.command('current')
1461
1491
  .description('Print active E10 profile')
1462
1492
  .action(action((ctx) => {
1463
- const active = getActiveProfile();
1493
+ const active = resolveActiveProfileForHost(ctx.env, ctx.getGlobalOptions());
1464
1494
  ctx.output.write({ active, dir: getProfileDir(active) }, { text: active });
1465
1495
  }));
1466
1496
  return auth;