weaver-work-cli 0.1.63 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{archive-BLDYBZDX.js → archive-WUZKAEZ6.js} +2 -2
- package/dist/chunks/{archive-oa-3GJ3TWXR.js → archive-oa-PN46RTI2.js} +2 -2
- package/dist/chunks/{asset-AFXJN4CK.js → asset-ZPC5VWZM.js} +2 -2
- package/dist/chunks/{asset-idle-VUJXWGWJ.js → asset-idle-DHGP3NYY.js} +2 -2
- package/dist/chunks/{attachment-content-VMJA7NSQ.js → attachment-content-QUM27QNB.js} +3 -3
- package/dist/chunks/{blog-EREB35VU.js → blog-JC47AIXK.js} +2 -2
- package/dist/chunks/{caizhilian-ATM2JO5S.js → caizhilian-IKIHM77A.js} +4 -4
- package/dist/chunks/{calendar-E26ZIH7S.js → calendar-GZTSJ57Y.js} +2 -2
- package/dist/chunks/{chunk-OMAGCLUE.js → chunk-26FCCU5O.js} +2 -2
- package/dist/chunks/{chunk-EOZHSNND.js → chunk-3W5NMGDS.js} +2 -2
- package/dist/chunks/{chunk-SHBDXEUE.js → chunk-6AW5LW4T.js} +4 -4
- package/dist/chunks/{chunk-C5PIGPGX.js → chunk-6T5X6YWX.js} +2 -2
- package/dist/chunks/{chunk-WPBZQVLS.js → chunk-AFZTMYGC.js} +1 -1
- package/dist/chunks/{chunk-LOVAIGM2.js → chunk-CUY64WP4.js} +50 -50
- package/dist/chunks/{chunk-IGICM3WJ.js → chunk-D6SWOUUP.js} +2 -2
- package/dist/chunks/{chunk-BY3WDJO5.js → chunk-E3OQSNF5.js} +1 -1
- package/dist/chunks/{chunk-G3ZM57PD.js → chunk-F4ME3CGS.js} +2 -2
- package/dist/chunks/{chunk-6VCQLZXE.js → chunk-FDBAFANU.js} +1 -0
- package/dist/chunks/{chunk-RV2JAA5I.js → chunk-FJUOUSV3.js} +1 -1
- package/dist/chunks/{chunk-6G2JARDK.js → chunk-HLT6B26P.js} +1 -1
- package/dist/chunks/{chunk-THMBDCRA.js → chunk-HWA2A25Y.js} +2 -2
- package/dist/chunks/{chunk-HEJPVXD3.js → chunk-IJDZ7VDC.js} +4 -4
- package/dist/chunks/{chunk-GOBNIGWS.js → chunk-IT3SB7RV.js} +89 -16
- package/dist/chunks/{chunk-TNFIUZ4H.js → chunk-JDZOYHAL.js} +1 -1
- package/dist/chunks/{chunk-QZYKZ7MQ.js → chunk-K7QKQRSL.js} +155 -57
- package/dist/chunks/{chunk-QAMIIFP6.js → chunk-LRK7YND4.js} +11 -11
- package/dist/chunks/{chunk-4OB22YKE.js → chunk-NZLFKBEM.js} +6 -6
- package/dist/chunks/{chunk-RR45ELVE.js → chunk-Q6D6PSMH.js} +2 -2
- package/dist/chunks/{chunk-5CY37VLS.js → chunk-QT7GGCSY.js} +45 -43
- package/dist/chunks/{chunk-GQK6WLOS.js → chunk-VLY5RTVO.js} +2 -2
- package/dist/chunks/{chunk-SDPC7BG2.js → chunk-WSHIOSGM.js} +2 -2
- package/dist/chunks/{chunk-I4C2KR2G.js → chunk-ZV3TYANI.js} +1 -1
- package/dist/chunks/{conflict-AMNTM3FV.js → conflict-76ZUL3E7.js} +2 -2
- package/dist/chunks/{contract-PLO2V2NO.js → contract-INMS7SYQ.js} +846 -199
- package/dist/chunks/{cowork-FZAXE6FO.js → cowork-34CBYVQP.js} +2 -2
- package/dist/chunks/{create-flow-2DAUN7HU.js → create-flow-7WGKLRHH.js} +8 -6
- package/dist/chunks/{data-7NXMWET4.js → data-QKWI5325.js} +13 -2
- package/dist/chunks/{ebuilder-form-DEYHX6M7.js → ebuilder-form-ZONRROK4.js} +3 -3
- package/dist/chunks/{ehr-QQH2DYYA.js → ehr-2CONM7R6.js} +2 -2
- package/dist/chunks/{entry-mode-2JTVEKMP.js → entry-mode-3UMMMK6Z.js} +3 -3
- package/dist/chunks/{env-2JZMXC6I.js → env-7EGXNZR2.js} +2 -2
- package/dist/chunks/{esb-I5ZFHJUK.js → esb-FQASCY2H.js} +4 -4
- package/dist/chunks/{factory-XIATYHU6.js → factory-BDERKTYX.js} +1 -1
- package/dist/chunks/{fna-3V2TL6B2.js → fna-FCLVIWAS.js} +2 -2
- package/dist/chunks/{group-chat-CVYUZCOQ.js → group-chat-4E7EZMTJ.js} +3 -3
- package/dist/chunks/{host-CBONEAZS.js → host-2ED2KC4X.js} +3 -3
- package/dist/chunks/{host-4DP7C7YQ.js → host-2UYZEY2V.js} +3 -3
- package/dist/chunks/{host-4KQCAEWA.js → host-46NYKDQP.js} +3 -3
- package/dist/chunks/{host-BD7NAM33.js → host-7IPZKIM4.js} +3 -3
- package/dist/chunks/{host-L37QVNIV.js → host-P7G22WNM.js} +3 -3
- package/dist/chunks/{host-4X2F3JPQ.js → host-XLCBLNJD.js} +3 -3
- package/dist/chunks/{hrm-OL3IKN7C.js → hrm-XKL27NX2.js} +3 -3
- package/dist/chunks/{im-YXQWUF3R.js → im-NDYIMASG.js} +3 -3
- package/dist/chunks/{invoice-4WY32PR2.js → invoice-MOGNB6HN.js} +3 -3
- package/dist/chunks/{jiuchuanhui-L6SHLONH.js → jiuchuanhui-3T5X7SB7.js} +2 -2
- package/dist/chunks/{lazy-dispatch-OYE6QV24.js → lazy-dispatch-4WOIL3ZQ.js} +4 -4
- package/dist/chunks/{mail-PZV2KNRU.js → mail-P7VMUKQW.js} +2 -2
- package/dist/chunks/{meeting-6SOBCC6N.js → meeting-2FMYZXG5.js} +13 -13
- package/dist/chunks/{minute-doc-KSJSJNOH.js → minute-doc-3DHMYMBE.js} +4 -4
- package/dist/chunks/{okr-B76FW5M2.js → okr-VZXRQGS4.js} +2 -2
- package/dist/chunks/{operations-YOMEGFLV.js → operations-MI2BSKZX.js} +4 -4
- package/dist/chunks/{performance-4VBKUPFO.js → performance-OPEQNW7Y.js} +870 -15
- package/dist/chunks/{plan-HBNZRQTI.js → plan-TJAS4N5X.js} +2 -2
- package/dist/chunks/{project-IV6FWK74.js → project-CYBGU6K6.js} +2 -2
- package/dist/chunks/{reception-BR5YURT6.js → reception-3FT2F66K.js} +2 -2
- package/dist/chunks/{recruit-stage-4HQ6OGXT.js → recruit-stage-WPGB5BDJ.js} +2 -2
- package/dist/chunks/{registry-JFQEFC7E.js → registry-6UGQO35C.js} +2 -2
- package/dist/chunks/{registry-MZJQX65Q.js → registry-QRMXRSCT.js} +4 -4
- package/dist/chunks/{registry-7LICMV5J.js → registry-XXFMYPBM.js} +12 -12
- package/dist/chunks/{room-recommend-43GLLE7Y.js → room-recommend-7LD2OHL5.js} +4 -4
- package/dist/chunks/{schedule-ZQ42BEW6.js → schedule-ZAYMZKTQ.js} +4 -4
- package/dist/chunks/{smart-extract-QKAEAZGM.js → smart-extract-FOBSVNYW.js} +2 -2
- package/dist/chunks/{workflow-6HV7H5PC.js → workflow-NYJJIT3D.js} +4 -4
- package/dist/index.js +33 -33
- package/dist/internal/e10/auth/commands.js +182 -43
- package/dist/shortcuts/contract/error-actions.js +112 -0
- package/dist/shortcuts/contract/errors.js +9 -1
- package/dist/shortcuts/contract/manifest.js +18 -7
- package/dist/shortcuts/contract/operations/docx-slots.js +112 -5
- package/dist/shortcuts/contract/operations/docx-verify.js +2 -70
- package/dist/shortcuts/contract/operations/elements-build.js +82 -56
- package/dist/shortcuts/contract/operations/elements-spec.js +140 -3
- package/dist/shortcuts/contract/operations/ledger-card.js +25 -2
- package/dist/shortcuts/contract/operations/ledger.js +33 -5
- package/dist/shortcuts/contract/operations/money.js +90 -0
- package/dist/shortcuts/contract/operations/placeholder-scan.js +104 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +54 -17
- package/dist/shortcuts/contract/operations/quote-ref.js +179 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +20 -3
- package/dist/shortcuts/contract/operations/quote.js +66 -12
- package/dist/shortcuts/contract/operations/solutions-spec.js +79 -0
- package/dist/shortcuts/contract/operations/triage.js +55 -9
- package/dist/shortcuts/data/operations/shared.js +14 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +25 -11
- package/dist/shortcuts/performance/flow-utils.js +363 -0
- package/dist/shortcuts/performance/manifest.js +2 -2
- package/dist/shortcuts/performance/operations/flow-detail.js +85 -0
- package/dist/shortcuts/performance/operations/flow-list.js +213 -0
- package/dist/shortcuts/performance/operations/flow-score.js +241 -0
- package/dist/shortcuts/performance/operations/registry.js +6 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.categoryCounts.js +64 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +15 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +4 -0
- package/docs/e10-auth.md +27 -2
- package/package.json +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +87 -39
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +29 -29
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +29 -7
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +22 -25
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -314
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +19 -11
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +43 -25
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +103 -212
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +7 -7
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +7 -6
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +34 -21
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +6 -6
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +22 -22
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +21 -19
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +132 -95
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +12 -12
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +5 -5
- package/skills/weaver-e10-meeting/SKILL.md +8 -7
- package/skills/weaver-e10-meeting/references/create-commands.md +2 -2
- package/skills/weaver-e10-meeting/references/create-flow.md +6 -6
- package/skills/weaver-e10-meeting/references/create-guardrails.md +10 -10
- package/skills/weaver-e10-meeting/references/invitation.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-eb.md +26 -26
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +2 -2
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-performance/SKILL.md +45 -5
- package/skills/weaver-e10-performance/agents/openai.yaml +26 -2
- package/skills/weaver-e10-performance/references/flow-api.md +128 -0
- package/skills/weaver-e10-performance/references/flow-assess.md +149 -0
- package/skills/weaver-e10-workflow/SKILL.md +40 -16
- package/skills/weaver-e10-workflow/aigroup/default.json +1 -1
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +30 -27
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +90 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +18 -2
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +240 -43
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -5
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
Command,
|
|
24
24
|
clearInvoiceTokenForSession
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-WSHIOSGM.js";
|
|
26
26
|
import {
|
|
27
27
|
shouldReportPlatformError,
|
|
28
28
|
toPlatformError
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
normalizeXiaoEAuthErrorLogLimit,
|
|
35
35
|
readXiaoEAuthErrorLog,
|
|
36
36
|
xiaoEAuthLogSecrets
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-FJUOUSV3.js";
|
|
38
38
|
import {
|
|
39
39
|
E10AuthSession,
|
|
40
40
|
XIAOE_AGENT_TYPE,
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
getProfileDir,
|
|
51
51
|
hasXiaoEEnv,
|
|
52
52
|
inspectXiaoEUnifiedLoginSources,
|
|
53
|
+
isConnectorMode,
|
|
53
54
|
listProfiles,
|
|
54
55
|
lookupAgentHost,
|
|
55
56
|
normalizeGlobalOptions,
|
|
@@ -69,7 +70,7 @@ import {
|
|
|
69
70
|
switchActiveProfile,
|
|
70
71
|
tryXiaoEUnifiedLogin,
|
|
71
72
|
upsertAgentHost
|
|
72
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-FDBAFANU.js";
|
|
73
74
|
import {
|
|
74
75
|
CliError,
|
|
75
76
|
isCliError,
|
|
@@ -259,6 +260,7 @@ var doctorCommand = {
|
|
|
259
260
|
// src/internal/e10/auth/commands.ts
|
|
260
261
|
import { execFile } from "node:child_process";
|
|
261
262
|
import { randomBytes } from "node:crypto";
|
|
263
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
262
264
|
import { createServer } from "node:http";
|
|
263
265
|
var DEFAULT_AGENT_TYPE = "weaver-work-cli";
|
|
264
266
|
var EXPLICIT_AGENT_TYPE_ENV_KEYS = [
|
|
@@ -383,7 +385,11 @@ function validateAgentReturnUrl(value) {
|
|
|
383
385
|
}
|
|
384
386
|
return value;
|
|
385
387
|
}
|
|
386
|
-
function
|
|
388
|
+
function isMachineAuthMode(stdout = process.stdout, connectorMode = isConnectorMode()) {
|
|
389
|
+
if (connectorMode) return true;
|
|
390
|
+
return stdout.isTTY !== true;
|
|
391
|
+
}
|
|
392
|
+
function resolveAgentReturnTarget(options = {}, env = process.env, agentType = resolveAgentType(options, env), mode = {}) {
|
|
387
393
|
const builtInTarget = builtInAgentReturnTarget(agentType);
|
|
388
394
|
const explicitUrl = optionString(options, "agentReturnUrl") || envString(env, AGENT_RETURN_URL_ENV_KEY);
|
|
389
395
|
if (explicitUrl) {
|
|
@@ -392,6 +398,7 @@ function resolveAgentReturnTarget(options = {}, env = process.env, agentType = r
|
|
|
392
398
|
url: validateAgentReturnUrl(explicitUrl)
|
|
393
399
|
};
|
|
394
400
|
}
|
|
401
|
+
if (mode.machine) return null;
|
|
395
402
|
if (builtInTarget) return builtInTarget;
|
|
396
403
|
const conventionalUrl = conventionalAgentReturnUrl(agentType);
|
|
397
404
|
return conventionalUrl ? { label: agentType, url: conventionalUrl } : null;
|
|
@@ -497,18 +504,77 @@ function renderE10LoginSuccessPage(userId, returnTarget = null, launchToken = ""
|
|
|
497
504
|
const returnScript = safeReturnTarget && launchToken ? `<script nonce="${esc(launchToken)}">(()=>{const root=document.querySelector('[data-agent-return]');if(!root)return;const status=root.querySelector('.status');const buttons=[...root.querySelectorAll('button')];const agentLabel=root.dataset.agentLabel||'\u5E94\u7528';const fallbackUrl=root.dataset.fallbackUrl||'';const storageKey='weaver-work-cli.agent-return.'+root.dataset.agentKey;let busy=false;const setBusy=value=>{busy=value;buttons.forEach(button=>{button.disabled=value;});};const closePrompt=()=>{root.hidden=true;};const savePreference=()=>{try{localStorage.setItem(storageKey,'1');}catch{}};const clearPreference=()=>{try{localStorage.removeItem(storageKey);}catch{}};const hasPreference=()=>{try{return localStorage.getItem(storageKey)==='1';}catch{return false;}};const post=async action=>{let response;try{response=await fetch('${AGENT_RETURN_PATH}?action='+encodeURIComponent(action),{method:'POST',headers:{'${AGENT_RETURN_TOKEN_HEADER}':root.dataset.token}});}catch{return false;}if(!response.ok)throw new Error(await response.text()||'\u8BF7\u6C42\u5931\u8D25');return true;};const openAgent=async persist=>{if(busy)return;setBusy(true);status.textContent='\u6B63\u5728\u6253\u5F00 '+agentLabel+'\u2026';try{const openedLocally=await post('open');if(persist)savePreference();if(!openedLocally){closePrompt();window.location.href=fallbackUrl;return;}closePrompt();}catch(error){if(persist)clearPreference();status.textContent=error instanceof Error?error.message:'\u65E0\u6CD5\u6253\u5F00\u5E94\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002';setBusy(false);}};root.querySelector('[data-action="open"]').addEventListener('click',()=>openAgent(false));root.querySelector('[data-action="always"]').addEventListener('click',()=>openAgent(true));root.querySelector('[data-action="cancel"]').addEventListener('click',()=>{if(busy)return;clearPreference();closePrompt();post('cancel').catch(()=>{});});if(hasPreference())openAgent(false);})();</script>` : "";
|
|
498
505
|
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>weaver-work-cli \u767B\u5F55\u6210\u529F</title><style>:root{color-scheme:light}*{box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;background:radial-gradient(circle at 50% 18%,#eefbf8 0,#f6f7f9 42%,#eef1f5 100%);color:#20242a;display:grid;place-items:center;min-height:100vh;margin:0}.card{background:rgba(255,255,255,.88);border:1px solid #e6e8ec;border-radius:18px;padding:34px 38px;box-shadow:0 18px 55px rgba(18,24,40,.09);width:min(560px,calc(100vw - 40px));text-align:center}.title{font-size:24px;font-weight:700;margin-bottom:10px}.desc{color:#667085;font-size:15px;line-height:24px}.user{color:#98a2b3;font-size:12px;margin-top:18px}.overlay{position:fixed;inset:0;z-index:10;display:grid;place-items:center;padding:20px;background:rgba(28,34,41,.36);backdrop-filter:blur(5px)}.overlay[hidden]{display:none}.prompt{width:min(410px,calc(100vw - 32px));padding:32px 28px 26px;border:1px solid rgba(255,255,255,.75);border-radius:24px;background:rgba(250,250,251,.97);box-shadow:0 24px 70px rgba(15,23,42,.28);text-align:center}.app-icon{width:74px;height:74px;margin:0 auto 24px;filter:drop-shadow(0 8px 14px rgba(8,170,130,.22))}.app-icon svg{display:block;width:100%;height:100%}.prompt h1{margin:0;font-size:20px;line-height:30px;font-weight:700;letter-spacing:-.2px}.prompt p{margin:10px 0 24px;color:#667085;font-size:14px;line-height:22px}.prompt button{display:block;width:100%;min-height:40px;border:0;border-radius:12px;font:600 16px/22px inherit;cursor:pointer;transition:transform .12s ease,filter .12s ease}.prompt button+button{margin-top:10px}.prompt button:hover{filter:brightness(.98)}.prompt button:active{transform:scale(.99)}.prompt button:disabled{cursor:wait;opacity:.62}.primary{background:linear-gradient(180deg,#2f91ff,#0b74e5);color:#fff;box-shadow:0 8px 18px rgba(11,116,229,.2)}.secondary{background:#e9eaec;color:#22252a}.status{min-height:18px;margin-top:14px;color:#667085;font-size:12px;line-height:18px}</style></head><body><main class="card"><div class="title">\u767B\u5F55\u6388\u6743\u6210\u529F</div><div class="desc">\u4F60\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u8FD4\u56DE\u667A\u80FD\u4F53\u6216\u7EC8\u7AEF\u7EE7\u7EED\u4F7F\u7528\u3002</div><div class="user">${esc(userId)}</div></main>${returnAction}${returnScript}</body></html>`;
|
|
499
506
|
}
|
|
500
|
-
function
|
|
507
|
+
function defaultFileExists(file) {
|
|
508
|
+
try {
|
|
509
|
+
return existsSync3(file);
|
|
510
|
+
} catch {
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function firstExisting(candidates, exists) {
|
|
515
|
+
return candidates.find((candidate) => exists(candidate)) ?? null;
|
|
516
|
+
}
|
|
517
|
+
function resolveWindowsRundll32Path(env = process.env, exists = defaultFileExists) {
|
|
518
|
+
const systemRoot = (env.SystemRoot || env.windir || env.WINDIR || "C:\\Windows").replace(/[\\/]+$/, "");
|
|
519
|
+
return firstExisting(
|
|
520
|
+
[
|
|
521
|
+
// 常规路径;32 位进程下会被 WOW64 重定向到 SysWOW64,同样可正常 ShellExecute。
|
|
522
|
+
`${systemRoot}\\System32\\rundll32.exe`,
|
|
523
|
+
// 仅 32 位进程可见的虚拟目录,作为兜底;64 位进程探测会返回 false。
|
|
524
|
+
`${systemRoot}\\Sysnative\\rundll32.exe`
|
|
525
|
+
],
|
|
526
|
+
exists
|
|
527
|
+
) ?? "rundll32.exe";
|
|
528
|
+
}
|
|
529
|
+
function closeHttpServer(server, onClosed, graceMs = 500) {
|
|
530
|
+
let closed = false;
|
|
531
|
+
let timer = null;
|
|
532
|
+
const done = () => {
|
|
533
|
+
if (closed) return;
|
|
534
|
+
closed = true;
|
|
535
|
+
if (timer) clearTimeout(timer);
|
|
536
|
+
onClosed();
|
|
537
|
+
};
|
|
538
|
+
try {
|
|
539
|
+
server.close(done);
|
|
540
|
+
server.closeIdleConnections?.();
|
|
541
|
+
timer = setTimeout(() => {
|
|
542
|
+
try {
|
|
543
|
+
server.closeAllConnections?.();
|
|
544
|
+
} catch {
|
|
545
|
+
}
|
|
546
|
+
done();
|
|
547
|
+
}, graceMs);
|
|
548
|
+
timer.unref?.();
|
|
549
|
+
} catch {
|
|
550
|
+
done();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function resolveBrowserOpenCommand(url, platform = process.platform, options = {}) {
|
|
554
|
+
const exists = options.exists ?? defaultFileExists;
|
|
555
|
+
const env = options.env ?? process.env;
|
|
501
556
|
if (platform === "win32") {
|
|
502
|
-
return { file:
|
|
557
|
+
return { file: resolveWindowsRundll32Path(env, exists), args: ["url.dll,FileProtocolHandler", url] };
|
|
503
558
|
}
|
|
504
|
-
if (platform === "darwin")
|
|
505
|
-
|
|
559
|
+
if (platform === "darwin") {
|
|
560
|
+
return { file: firstExisting(["/usr/bin/open"], exists) ?? "open", args: [url] };
|
|
561
|
+
}
|
|
562
|
+
return { file: firstExisting(["/usr/bin/xdg-open", "/bin/xdg-open"], exists) ?? "xdg-open", args: [url] };
|
|
563
|
+
}
|
|
564
|
+
function describeOpenFailure(error) {
|
|
565
|
+
if (error instanceof Error) {
|
|
566
|
+
const code = error.code;
|
|
567
|
+
return code ? `${code}: ${error.message}` : error.message;
|
|
568
|
+
}
|
|
569
|
+
return String(error);
|
|
506
570
|
}
|
|
507
571
|
function openUrlInBrowser(url, ctx) {
|
|
508
572
|
const command = resolveBrowserOpenCommand(url);
|
|
509
573
|
execFile(command.file, command.args, (error) => {
|
|
510
574
|
if (error) {
|
|
511
|
-
ctx.logger.warn(
|
|
575
|
+
ctx.logger.warn(
|
|
576
|
+
`Could not open browser automatically (${command.file}: ${describeOpenFailure(error)}). Copy the login URL manually.`
|
|
577
|
+
);
|
|
512
578
|
}
|
|
513
579
|
});
|
|
514
580
|
}
|
|
@@ -670,9 +736,12 @@ async function oidcExchange(code, redirectUri, baseUrl, tenantKeyFallback, agent
|
|
|
670
736
|
redirect: "manual"
|
|
671
737
|
});
|
|
672
738
|
const tokenData = await readJsonObject(tokenResp);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
739
|
+
const businessStatus = Number(tokenData.status);
|
|
740
|
+
const businessFailed = Number.isFinite(businessStatus) && businessStatus >= 400;
|
|
741
|
+
if (tokenResp.status >= 400 || businessFailed) {
|
|
742
|
+
const message = readString(tokenData, "message", "msg", "error_description", "error") || `OAuth token exchange failed: ${businessFailed ? businessStatus : tokenResp.status}`;
|
|
743
|
+
const code2 = readString(tokenData, "code");
|
|
744
|
+
throw new CliError(code2 ? `${message} (code ${code2})` : message, 3 /* AuthError */);
|
|
676
745
|
}
|
|
677
746
|
let eteamsId = readString(tokenData, "eteamsId", "eteamsid");
|
|
678
747
|
let userId = readString(tokenData, "id", "userId", "employeeId");
|
|
@@ -850,7 +919,7 @@ async function runXiaoELogin(ctx, options) {
|
|
|
850
919
|
));
|
|
851
920
|
throw error;
|
|
852
921
|
}
|
|
853
|
-
async function runBrowserLogin(ctx, options) {
|
|
922
|
+
async function runBrowserLogin(ctx, options, loginMode = {}) {
|
|
854
923
|
const commandOpts = asOptions(options);
|
|
855
924
|
const globalOptions = ctx.getGlobalOptions();
|
|
856
925
|
const profileFromGlobal = globalOptions.profile;
|
|
@@ -865,35 +934,43 @@ async function runBrowserLogin(ctx, options) {
|
|
|
865
934
|
const hostKey = target.hostKey;
|
|
866
935
|
const baseUrl = normalizeUrl(explicitBaseUrl || target.cfg.baseUrl || resolveDefaultE10BaseUrl(ctx.env));
|
|
867
936
|
const tenantKey = optionString(commandOpts, "tenantKey");
|
|
868
|
-
const
|
|
869
|
-
const
|
|
870
|
-
|
|
937
|
+
const explicitPort = optionString(commandOpts, "port");
|
|
938
|
+
const portText = explicitPort || "19800";
|
|
939
|
+
let port = Number(portText);
|
|
940
|
+
if (!/^\d+$/u.test(portText) || !Number.isInteger(port) || port < 0 || port > 65535) {
|
|
871
941
|
throw new CliError("Invalid --port value", 2 /* UsageError */);
|
|
872
942
|
}
|
|
873
|
-
const
|
|
943
|
+
const machineMode = loginMode.machine === true || isMachineAuthMode();
|
|
944
|
+
const agentReturnTarget = loginMode.machine === true ? null : resolveAgentReturnTarget(commandOpts, ctx.env, agentType, { machine: machineMode });
|
|
874
945
|
const agentReturnToken = agentReturnTarget ? randomBytes(24).toString("base64url") : "";
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
|
|
946
|
+
const successHeaders = {
|
|
947
|
+
"cache-control": "no-store",
|
|
948
|
+
"content-security-policy": agentReturnTarget ? `default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-${agentReturnToken}'; connect-src 'self'` : `default-src 'none'; style-src 'unsafe-inline'`,
|
|
949
|
+
"content-type": "text/html; charset=utf-8",
|
|
950
|
+
"referrer-policy": "no-referrer",
|
|
951
|
+
"x-content-type-options": "nosniff",
|
|
952
|
+
"x-frame-options": "DENY"
|
|
953
|
+
};
|
|
954
|
+
let redirectUri = "";
|
|
955
|
+
if (machineMode && !agentReturnTarget) {
|
|
956
|
+
ctx.logger.info("Machine mode: closing the callback server right after authorization.");
|
|
957
|
+
}
|
|
878
958
|
ctx.logger.info("Waiting for E10 authorization callback...");
|
|
879
959
|
return await new Promise((resolve8, reject) => {
|
|
880
960
|
let settled = false;
|
|
881
961
|
let timer = null;
|
|
882
962
|
let pendingLoginResult = null;
|
|
883
963
|
let tlsCallbackDetected = false;
|
|
964
|
+
let exchanging = false;
|
|
965
|
+
let retriedPort = false;
|
|
884
966
|
const finish = (error, result) => {
|
|
885
967
|
if (settled) return;
|
|
886
968
|
settled = true;
|
|
887
969
|
if (timer) clearTimeout(timer);
|
|
888
|
-
|
|
970
|
+
closeHttpServer(server, () => {
|
|
889
971
|
if (error) reject(error);
|
|
890
972
|
else resolve8(result);
|
|
891
|
-
};
|
|
892
|
-
try {
|
|
893
|
-
server.close(complete);
|
|
894
|
-
} catch {
|
|
895
|
-
complete();
|
|
896
|
-
}
|
|
973
|
+
});
|
|
897
974
|
};
|
|
898
975
|
const server = createServer(async (req, res) => {
|
|
899
976
|
const callbackUrl = new URL(req.url || "/", `http://127.0.0.1:${port}`);
|
|
@@ -923,8 +1000,10 @@ async function runBrowserLogin(ctx, options) {
|
|
|
923
1000
|
res.writeHead(200, { "cache-control": "no-store", "content-type": "application/json; charset=utf-8" });
|
|
924
1001
|
res.end('{"ok":true}');
|
|
925
1002
|
finish(null, result);
|
|
926
|
-
} catch {
|
|
927
|
-
ctx.logger.warn(
|
|
1003
|
+
} catch (openError) {
|
|
1004
|
+
ctx.logger.warn(
|
|
1005
|
+
`Could not open ${agentReturnTarget.label} automatically (${describeOpenFailure(openError)}).`
|
|
1006
|
+
);
|
|
928
1007
|
res.writeHead(500, { "cache-control": "no-store", "content-type": "text/plain; charset=utf-8" });
|
|
929
1008
|
res.end(`\u65E0\u6CD5\u6253\u5F00 ${agentReturnTarget.label}\uFF0C\u8BF7\u786E\u8BA4\u5E94\u7528\u5DF2\u5B89\u88C5\u3002`);
|
|
930
1009
|
}
|
|
@@ -935,6 +1014,16 @@ async function runBrowserLogin(ctx, options) {
|
|
|
935
1014
|
res.end("Not found");
|
|
936
1015
|
return;
|
|
937
1016
|
}
|
|
1017
|
+
if (pendingLoginResult) {
|
|
1018
|
+
res.writeHead(200, successHeaders);
|
|
1019
|
+
res.end(renderE10LoginSuccessPage(pendingLoginResult.userId, agentReturnTarget, agentReturnToken));
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
if (exchanging || settled) {
|
|
1023
|
+
res.writeHead(409, { "cache-control": "no-store", "content-type": "text/plain; charset=utf-8" });
|
|
1024
|
+
res.end("Authorization callback already received.");
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
938
1027
|
const error = callbackUrl.searchParams.get("error");
|
|
939
1028
|
const code = callbackUrl.searchParams.get("code");
|
|
940
1029
|
const redirectAgentType = explicitAgentType || callbackUrl.searchParams.get("agent_type") || callbackUrl.searchParams.get("agentType") || callbackUrl.searchParams.get("from") || agentType;
|
|
@@ -956,22 +1045,15 @@ async function runBrowserLogin(ctx, options) {
|
|
|
956
1045
|
timer = null;
|
|
957
1046
|
}
|
|
958
1047
|
try {
|
|
1048
|
+
exchanging = true;
|
|
959
1049
|
const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal, hostKey);
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
"content-security-policy": agentReturnTarget ? `default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-${agentReturnToken}'; connect-src 'self'` : `default-src 'none'; style-src 'unsafe-inline'`,
|
|
963
|
-
"content-type": "text/html; charset=utf-8",
|
|
964
|
-
"referrer-policy": "no-referrer",
|
|
965
|
-
"x-content-type-options": "nosniff",
|
|
966
|
-
"x-frame-options": "DENY"
|
|
967
|
-
};
|
|
968
|
-
res.writeHead(200, responseHeaders);
|
|
1050
|
+
pendingLoginResult = result;
|
|
1051
|
+
res.writeHead(200, successHeaders);
|
|
969
1052
|
res.end(renderE10LoginSuccessPage(result.userId, agentReturnTarget, agentReturnToken));
|
|
970
1053
|
if (!agentReturnTarget) {
|
|
971
1054
|
finish(null, result);
|
|
972
1055
|
return;
|
|
973
1056
|
}
|
|
974
|
-
pendingLoginResult = result;
|
|
975
1057
|
if (timer) clearTimeout(timer);
|
|
976
1058
|
timer = setTimeout(() => finish(null, result), AGENT_RETURN_TIMEOUT_MS);
|
|
977
1059
|
} catch (exchangeError) {
|
|
@@ -982,6 +1064,12 @@ async function runBrowserLogin(ctx, options) {
|
|
|
982
1064
|
}
|
|
983
1065
|
});
|
|
984
1066
|
server.on("error", (error) => {
|
|
1067
|
+
if (error.code === "EADDRINUSE" && !explicitPort && !retriedPort) {
|
|
1068
|
+
retriedPort = true;
|
|
1069
|
+
ctx.logger.warn(`Port ${port} is already in use. Using an available callback port.`);
|
|
1070
|
+
server.listen(0, "127.0.0.1");
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
985
1073
|
const message = error.code === "EADDRINUSE" ? `Port ${port} is already in use. Retry with --port ${port + 1}.` : error.code === "EACCES" ? `Port ${port} is not accessible. Retry with another --port.` : error.message;
|
|
986
1074
|
finish(new CliError(message, 2 /* UsageError */));
|
|
987
1075
|
});
|
|
@@ -1004,10 +1092,20 @@ async function runBrowserLogin(ctx, options) {
|
|
|
1004
1092
|
}
|
|
1005
1093
|
socket.destroy();
|
|
1006
1094
|
});
|
|
1007
|
-
server.
|
|
1095
|
+
server.once("listening", () => {
|
|
1096
|
+
const address = server.address();
|
|
1097
|
+
if (!address || typeof address === "string") {
|
|
1098
|
+
finish(new CliError("Could not resolve local OAuth callback port.", 2 /* UsageError */));
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
port = address.port;
|
|
1102
|
+
redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
1103
|
+
const loginUrl = buildE10AuthorizeUrl(baseUrl, redirectUri, agentType);
|
|
1104
|
+
ctx.logger.info("Open browser login: " + loginUrl);
|
|
1008
1105
|
ctx.logger.info("Local callback server: " + redirectUri);
|
|
1009
1106
|
openUrlInBrowser(loginUrl, ctx);
|
|
1010
1107
|
});
|
|
1108
|
+
server.listen(port, "127.0.0.1");
|
|
1011
1109
|
timer = setTimeout(() => {
|
|
1012
1110
|
finish(new CliError("Login timed out after 5 minutes.", 3 /* AuthError */));
|
|
1013
1111
|
}, 3e5);
|
|
@@ -1138,7 +1236,7 @@ logFile: ${result.path}`;
|
|
|
1138
1236
|
}));
|
|
1139
1237
|
}
|
|
1140
1238
|
function registerBrowserLoginCommand(auth, action, name, description, machine = false) {
|
|
1141
|
-
const command = auth.command(name).description(description).option("--base-url <url>", "E10 base URL (defaults to https://weapp.eteams.cn)").option("--tenant-key <key>", "Tenant key fallback after login").option("--port <n>", "Local OAuth callback port
|
|
1239
|
+
const command = auth.command(name).description(description).option("--base-url <url>", "E10 base URL (defaults to https://weapp.eteams.cn)").option("--tenant-key <key>", "Tenant key fallback after login").option("--port <n>", "Local OAuth callback port (default: 19800 with automatic fallback; 0 selects an available port)").option("--agent_type <value>", "Agent type sent to E10 authorize endpoint").option("--agent-type <value>", "Alias of --agent_type").option("--agent-return-url <url>", "Desktop application URL linked by the login success page");
|
|
1142
1240
|
command.action(action(async (ctx, options) => {
|
|
1143
1241
|
if (!machine) {
|
|
1144
1242
|
const result = await runBrowserLogin(ctx, options);
|
|
@@ -1147,7 +1245,7 @@ function registerBrowserLoginCommand(auth, action, name, description, machine =
|
|
|
1147
1245
|
}
|
|
1148
1246
|
ctx.logger.machineMode = true;
|
|
1149
1247
|
try {
|
|
1150
|
-
const result = await runBrowserLogin(ctx, options);
|
|
1248
|
+
const result = await runBrowserLogin(ctx, options, { machine: true });
|
|
1151
1249
|
ctx.output.raw(JSON.stringify({
|
|
1152
1250
|
status: "authorized",
|
|
1153
1251
|
employeeId: result.userId || "",
|
|
@@ -1713,10 +1811,10 @@ var runCommand = {
|
|
|
1713
1811
|
};
|
|
1714
1812
|
|
|
1715
1813
|
// src/cmd/setup/index.ts
|
|
1716
|
-
import { existsSync as
|
|
1814
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1717
1815
|
|
|
1718
1816
|
// src/internal/skills/install.ts
|
|
1719
|
-
import { cpSync as cpSync2, existsSync as
|
|
1817
|
+
import { cpSync as cpSync2, existsSync as existsSync4, mkdirSync, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, writeFileSync } from "node:fs";
|
|
1720
1818
|
import { homedir } from "node:os";
|
|
1721
1819
|
import { basename, posix, relative, resolve as resolve3, sep, win32 } from "node:path";
|
|
1722
1820
|
var SKILL_PREFIX = "weaver-e10-";
|
|
@@ -1802,7 +1900,7 @@ function resolveSkillsRoot(env = process.env, options = {}) {
|
|
|
1802
1900
|
}
|
|
1803
1901
|
const codexRoot = hostSkillsRoot("codex", env, options);
|
|
1804
1902
|
const workBuddyRoot = hostSkillsRoot("workbuddy", env, options);
|
|
1805
|
-
const pathExists = options.pathExists ??
|
|
1903
|
+
const pathExists = options.pathExists ?? existsSync4;
|
|
1806
1904
|
if (host === "unknown") {
|
|
1807
1905
|
const existing = [
|
|
1808
1906
|
{ root: codexRoot, host: "codex" },
|
|
@@ -1852,7 +1950,7 @@ function normalizePackagedSkillName(value) {
|
|
|
1852
1950
|
return trimmed.startsWith(SKILL_PREFIX) ? trimmed : `${SKILL_PREFIX}${trimmed}`;
|
|
1853
1951
|
}
|
|
1854
1952
|
function resolvePackagedSkillNames(sourceRoot, requested = "all") {
|
|
1855
|
-
const available = readdirSync2(sourceRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() &&
|
|
1953
|
+
const available = readdirSync2(sourceRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync4(resolve3(sourceRoot, entry.name, "SKILL.md"))).map((entry) => entry.name).sort();
|
|
1856
1954
|
const normalized = normalizePackagedSkillName(requested);
|
|
1857
1955
|
if (!normalized || normalized === "all") return available;
|
|
1858
1956
|
if (!available.includes(normalized)) {
|
|
@@ -1915,7 +2013,7 @@ function installPackagedSkills(sourceRoot, targetRoot, requested = "all") {
|
|
|
1915
2013
|
}
|
|
1916
2014
|
function productMetadataContent(sourceRoot) {
|
|
1917
2015
|
const productPath = productMetadataPath(sourceRoot);
|
|
1918
|
-
if (!
|
|
2016
|
+
if (!existsSync4(productPath)) return null;
|
|
1919
2017
|
const product = JSON.parse(readFileSync2(productPath, "utf8"));
|
|
1920
2018
|
const packageInfo = readPackageInfo(resolve3(sourceRoot, "..", "package.json"));
|
|
1921
2019
|
const metadata = {
|
|
@@ -1934,11 +2032,11 @@ function productMetadataContent(sourceRoot) {
|
|
|
1934
2032
|
}
|
|
1935
2033
|
function productMetadataPath(sourceRoot) {
|
|
1936
2034
|
const templatePath = resolve3(sourceRoot, "..", "skill-template", "product.json");
|
|
1937
|
-
if (
|
|
2035
|
+
if (existsSync4(templatePath)) return templatePath;
|
|
1938
2036
|
return resolve3(sourceRoot, "product.json");
|
|
1939
2037
|
}
|
|
1940
2038
|
function readPackageInfo(packagePath2) {
|
|
1941
|
-
if (!
|
|
2039
|
+
if (!existsSync4(packagePath2)) return null;
|
|
1942
2040
|
return JSON.parse(readFileSync2(packagePath2, "utf8"));
|
|
1943
2041
|
}
|
|
1944
2042
|
function stringOrEmpty(value) {
|
|
@@ -2011,7 +2109,7 @@ var setupCommand = {
|
|
|
2011
2109
|
},
|
|
2012
2110
|
{
|
|
2013
2111
|
name: "e10Auth",
|
|
2014
|
-
ok: Boolean(authFile &&
|
|
2112
|
+
ok: Boolean(authFile && existsSync5(authFile)),
|
|
2015
2113
|
detail: authFile || "not found"
|
|
2016
2114
|
}
|
|
2017
2115
|
];
|
|
@@ -2059,11 +2157,11 @@ var setupCommand = {
|
|
|
2059
2157
|
};
|
|
2060
2158
|
|
|
2061
2159
|
// src/cmd/skills/index.ts
|
|
2062
|
-
import { existsSync as
|
|
2160
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
2063
2161
|
import { spawnSync } from "node:child_process";
|
|
2064
2162
|
|
|
2065
2163
|
// src/internal/skills/detector.ts
|
|
2066
|
-
import { existsSync as
|
|
2164
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
2067
2165
|
import { join, resolve as resolve4 } from "node:path";
|
|
2068
2166
|
var PACKAGED_DETECTOR_VERSION = "1.0.13";
|
|
2069
2167
|
var PACKAGED_DETECTOR_NAME = `weaver-skill-detector-${PACKAGED_DETECTOR_VERSION}`;
|
|
@@ -2079,7 +2177,7 @@ function legacySiblingDetectorDir() {
|
|
|
2079
2177
|
function detectorVersion(detectorDir) {
|
|
2080
2178
|
let version = PACKAGED_DETECTOR_VERSION;
|
|
2081
2179
|
const metaPath = join(detectorDir, "_meta.json");
|
|
2082
|
-
if (
|
|
2180
|
+
if (existsSync6(metaPath)) {
|
|
2083
2181
|
try {
|
|
2084
2182
|
const meta = JSON.parse(readFileSync3(metaPath, "utf8"));
|
|
2085
2183
|
if (typeof meta.version === "string" && meta.version) version = meta.version;
|
|
@@ -2093,7 +2191,7 @@ function resolveDetectorInfo(detectorDir) {
|
|
|
2093
2191
|
const candidates = detectorDir ? [resolve4(detectorDir)] : [packagedDetectorDir(), legacySiblingDetectorDir()].map((candidate) => resolve4(candidate));
|
|
2094
2192
|
for (const candidate of candidates) {
|
|
2095
2193
|
const scriptPath = detectorScriptPath(candidate);
|
|
2096
|
-
if (
|
|
2194
|
+
if (existsSync6(scriptPath)) {
|
|
2097
2195
|
return { detectorDir: candidate, scriptPath, version: detectorVersion(candidate) };
|
|
2098
2196
|
}
|
|
2099
2197
|
}
|
|
@@ -2233,7 +2331,7 @@ function parseFrontmatter(content) {
|
|
|
2233
2331
|
// src/cmd/skills/index.ts
|
|
2234
2332
|
var SKILLS_DIR2 = packagePath("skills");
|
|
2235
2333
|
function reader() {
|
|
2236
|
-
if (!
|
|
2334
|
+
if (!existsSync7(SKILLS_DIR2)) {
|
|
2237
2335
|
throw new CliError("skills directory does not exist: " + SKILLS_DIR2);
|
|
2238
2336
|
}
|
|
2239
2337
|
return new SkillReader(SKILLS_DIR2);
|
|
@@ -2538,7 +2636,7 @@ import { homedir as homedir2 } from "node:os";
|
|
|
2538
2636
|
import { resolve as resolve7 } from "node:path";
|
|
2539
2637
|
|
|
2540
2638
|
// src/core/config-store.ts
|
|
2541
|
-
import { existsSync as
|
|
2639
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2542
2640
|
import { dirname } from "node:path";
|
|
2543
2641
|
var ConfigStore = class {
|
|
2544
2642
|
constructor(getPath) {
|
|
@@ -2550,7 +2648,7 @@ var ConfigStore = class {
|
|
|
2550
2648
|
}
|
|
2551
2649
|
all() {
|
|
2552
2650
|
const filePath = this.path();
|
|
2553
|
-
if (!
|
|
2651
|
+
if (!existsSync8(filePath)) return {};
|
|
2554
2652
|
try {
|
|
2555
2653
|
const value = JSON.parse(readFileSync5(filePath, "utf-8"));
|
|
2556
2654
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -2,12 +2,12 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
meetingStateDir
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E3OQSNF5.js";
|
|
6
6
|
import {
|
|
7
7
|
meetingSuccess,
|
|
8
8
|
meetingValidationError,
|
|
9
9
|
schemaOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JDZOYHAL.js";
|
|
11
11
|
|
|
12
12
|
// src/shortcuts/meeting/operations/eb/group-chat.ts
|
|
13
13
|
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
@@ -16,17 +16,17 @@ var DEFAULT_MEETING_GROUP_FLOW_ID = "1333212605456498718";
|
|
|
16
16
|
var GROUP_FIELD = "imchat_groupid";
|
|
17
17
|
var PENDING_DIR = "pending-forms";
|
|
18
18
|
async function buildEsbEnv(env) {
|
|
19
|
-
const { createEsbHost } = await import("./host-
|
|
19
|
+
const { createEsbHost } = await import("./host-P7G22WNM.js");
|
|
20
20
|
const { createEsbContinuationSigner } = await import("./continuation-KI7DRRZN.js");
|
|
21
21
|
return { ctx: env.ctx, host: createEsbHost(env.ctx), continuation: createEsbContinuationSigner(env.ctx) };
|
|
22
22
|
}
|
|
23
23
|
async function buildImEnv(env) {
|
|
24
|
-
const { createImHost } = await import("./host-
|
|
24
|
+
const { createImHost } = await import("./host-XLCBLNJD.js");
|
|
25
25
|
const { createImContinuationSigner } = await import("./continuation-3S37AUSH.js");
|
|
26
26
|
return { ctx: env.ctx, host: createImHost(env.ctx), continuation: createImContinuationSigner(env.ctx) };
|
|
27
27
|
}
|
|
28
28
|
async function buildWorkflowEnv(env) {
|
|
29
|
-
const { createWorkflowHost } = await import("./host-
|
|
29
|
+
const { createWorkflowHost } = await import("./host-2ED2KC4X.js");
|
|
30
30
|
const { createWorkflowContinuationSigner } = await import("./continuation-HFW2YT5S.js");
|
|
31
31
|
return { ctx: env.ctx, host: createWorkflowHost(env.ctx), continuation: createWorkflowContinuationSigner(env.ctx) };
|
|
32
32
|
}
|
|
@@ -159,7 +159,7 @@ async function triggerGroupFlow(env, input, meetingName, memberIds) {
|
|
|
159
159
|
if (addressText === "[object Object]") addressText = "";
|
|
160
160
|
if (addressText) {
|
|
161
161
|
try {
|
|
162
|
-
const { resolveAddressRoom } = await import("./create-flow-
|
|
162
|
+
const { resolveAddressRoom } = await import("./create-flow-7WGKLRHH.js");
|
|
163
163
|
const room = await resolveAddressRoom(env, addressText);
|
|
164
164
|
if (room?.name) addressText = room.name;
|
|
165
165
|
} catch {
|
|
@@ -168,7 +168,7 @@ async function triggerGroupFlow(env, input, meetingName, memberIds) {
|
|
|
168
168
|
if (addressText) mainTable.address = addressText;
|
|
169
169
|
}
|
|
170
170
|
try {
|
|
171
|
-
const { getEsbOperation } = await import("./registry-
|
|
171
|
+
const { getEsbOperation } = await import("./registry-QRMXRSCT.js");
|
|
172
172
|
const esbEnv = await buildEsbEnv(env);
|
|
173
173
|
const prepare = getEsbOperation("esb.trigger.prepare");
|
|
174
174
|
const apply = getEsbOperation("esb.trigger.apply");
|
|
@@ -201,7 +201,7 @@ async function bindGroupToMeeting(env, meetingId, groupId) {
|
|
|
201
201
|
const group = String(groupId).trim();
|
|
202
202
|
if (id === "" || group === "") return { ok: false, error: "\u6CA1\u6709\u4F1A\u8BAE id \u6216\u7FA4 id" };
|
|
203
203
|
try {
|
|
204
|
-
const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-
|
|
204
|
+
const { EB_BASE, ebBusinessSuccess, writeBody } = await import("./factory-BDERKTYX.js");
|
|
205
205
|
const session = await env.host.getSession();
|
|
206
206
|
await env.host.request({
|
|
207
207
|
method: "POST",
|
|
@@ -219,7 +219,7 @@ async function bindGroupToMeeting(env, meetingId, groupId) {
|
|
|
219
219
|
return { ok: false, error: String(error?.message ?? error).slice(0, 300) };
|
|
220
220
|
}
|
|
221
221
|
try {
|
|
222
|
-
const { getMeetingOperation } = await import("./registry-
|
|
222
|
+
const { getMeetingOperation } = await import("./registry-XXFMYPBM.js");
|
|
223
223
|
const detail = getMeetingOperation("meeting.eb.meeting.detail");
|
|
224
224
|
const read = await detail.handler({ id }, env);
|
|
225
225
|
const main = read?.data?.data ?? read?.data?.main ?? {};
|
|
@@ -235,7 +235,7 @@ async function bindGroupToMeeting(env, meetingId, groupId) {
|
|
|
235
235
|
}
|
|
236
236
|
async function searchMyRequests(env, options = {}) {
|
|
237
237
|
try {
|
|
238
|
-
const { getWorkflowOperation } = await import("./registry-
|
|
238
|
+
const { getWorkflowOperation } = await import("./registry-6UGQO35C.js");
|
|
239
239
|
const op = getWorkflowOperation("workflow.search");
|
|
240
240
|
const wfEnv = await buildWorkflowEnv(env);
|
|
241
241
|
const args = { category: "mine", pageSize: 20, sort: "createTime:desc" };
|
|
@@ -267,7 +267,7 @@ async function resolveMeetingByRequestId(env, requestId, sinceMs) {
|
|
|
267
267
|
const target = String(requestId).trim();
|
|
268
268
|
if (target === "") return null;
|
|
269
269
|
try {
|
|
270
|
-
const { getMeetingOperation } = await import("./registry-
|
|
270
|
+
const { getMeetingOperation } = await import("./registry-XXFMYPBM.js");
|
|
271
271
|
const list = getMeetingOperation("meeting.eb.meeting.list");
|
|
272
272
|
const detail = getMeetingOperation("meeting.eb.meeting.detail");
|
|
273
273
|
const page = await list.handler({ pageSize: 30 }, env);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
meetingValidationError,
|
|
13
13
|
queryBody,
|
|
14
14
|
toIdCsv
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JDZOYHAL.js";
|
|
16
16
|
|
|
17
17
|
// src/shortcuts/meeting/operations/eb/conflict.ts
|
|
18
18
|
var ACTIVE_MT_STATUS = "1,2,8,9";
|
|
@@ -146,7 +146,7 @@ async function collectMemberConflicts(members, begin, end, excludeMtId, env, ope
|
|
|
146
146
|
let candidates = allCandidates;
|
|
147
147
|
let prefilterSkipped = 0;
|
|
148
148
|
try {
|
|
149
|
-
const { resolveEmployeeNames } = await import("./create-flow-
|
|
149
|
+
const { resolveEmployeeNames } = await import("./create-flow-7WGKLRHH.js");
|
|
150
150
|
const names = await resolveEmployeeNames(env, members);
|
|
151
151
|
const tokens = [...members, ...names.values()].map((token) => String(token ?? "").trim()).filter((token) => token !== "");
|
|
152
152
|
if (tokens.length > 0) {
|
|
@@ -315,7 +315,7 @@ var ebMeetingWritePreflight = async ({ endpoint, payload, args, env, extras }) =
|
|
|
315
315
|
const items = rawMembers.split(/[,;,;]+/u).map((item) => item.trim()).filter((item) => item !== "");
|
|
316
316
|
const nameLike = items.filter((item) => !/^\d+$/u.test(item));
|
|
317
317
|
if (nameLike.length > 0) {
|
|
318
|
-
const { resolveMemberIdsByName } = await import("./schedule-
|
|
318
|
+
const { resolveMemberIdsByName } = await import("./schedule-ZAYMZKTQ.js");
|
|
319
319
|
const idsByName = await resolveMemberIdsByName(env, nameLike);
|
|
320
320
|
const resolved = items.map((item) => idsByName.get(item) ?? item);
|
|
321
321
|
payload.mainTable.hrm_members = [...new Set(resolved)].join(",");
|
|
@@ -448,7 +448,7 @@ var ebConflictRoom = {
|
|
|
448
448
|
let addressId = String(args.address ?? "").trim();
|
|
449
449
|
let resolvedRoom = null;
|
|
450
450
|
if (!addressId && String(args.room_name ?? "").trim()) {
|
|
451
|
-
const { resolveAddressRoom } = await import("./create-flow-
|
|
451
|
+
const { resolveAddressRoom } = await import("./create-flow-7WGKLRHH.js");
|
|
452
452
|
const resolved = await resolveAddressRoom(env, String(args.room_name));
|
|
453
453
|
if (!resolved?.id) {
|
|
454
454
|
throw meetingValidationError(
|
|
@@ -637,7 +637,7 @@ async function findCommonFreeSlots(env, input) {
|
|
|
637
637
|
let meetings = allMeetings;
|
|
638
638
|
let prefilterSkipped = 0;
|
|
639
639
|
try {
|
|
640
|
-
const { resolveEmployeeNames } = await import("./create-flow-
|
|
640
|
+
const { resolveEmployeeNames } = await import("./create-flow-7WGKLRHH.js");
|
|
641
641
|
const names2 = await resolveEmployeeNames(env, members);
|
|
642
642
|
const tokens = [...members, ...names2.values()].map((token) => String(token ?? "").trim()).filter((token) => token !== "");
|
|
643
643
|
if (tokens.length > 0 && process.env.WEAVER_MEETING_NO_PREFILTER !== "1") {
|
|
@@ -675,7 +675,7 @@ async function findCommonFreeSlots(env, input) {
|
|
|
675
675
|
const scheduleItems = [];
|
|
676
676
|
if (includeSchedule) {
|
|
677
677
|
try {
|
|
678
|
-
const { runScheduleConflictFlow, parseScheduleConflictMessage, resolveMemberIdsByName } = await import("./schedule-
|
|
678
|
+
const { runScheduleConflictFlow, parseScheduleConflictMessage, resolveMemberIdsByName } = await import("./schedule-ZAYMZKTQ.js");
|
|
679
679
|
const dayBegin = new Date(rangeStart.getFullYear(), rangeStart.getMonth(), rangeStart.getDate(), 0, 0, 0, 0);
|
|
680
680
|
const dayEnd = new Date(rangeStart.getFullYear(), rangeStart.getMonth(), rangeStart.getDate(), 23, 59, 0, 0);
|
|
681
681
|
const flow = await runScheduleConflictFlow(env, {
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
createE10RequestRuntime,
|
|
12
12
|
isE10SessionExpiredResponse,
|
|
13
13
|
requireE10Session
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FJUOUSV3.js";
|
|
15
15
|
import {
|
|
16
16
|
E10_SESSION_EXPIRED_MESSAGE
|
|
17
17
|
} from "./chunk-TJN4PIYO.js";
|
|
18
18
|
import {
|
|
19
19
|
getActiveProfile
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FDBAFANU.js";
|
|
21
21
|
|
|
22
22
|
// src/shortcuts/im/host.ts
|
|
23
23
|
import { createHash } from "node:crypto";
|