botmux 2.114.0 → 3.0.0
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/adapters/backend/riff-backend.d.ts +15 -0
- package/dist/adapters/backend/riff-backend.d.ts.map +1 -1
- package/dist/adapters/backend/riff-backend.js +9 -3
- package/dist/adapters/backend/riff-backend.js.map +1 -1
- package/dist/core/dashboard-ipc-server.js +2 -2
- package/dist/core/dashboard-ipc-server.js.map +1 -1
- package/dist/dashboard/compat.d.ts +19 -0
- package/dist/dashboard/compat.d.ts.map +1 -0
- package/dist/dashboard/compat.js +38 -0
- package/dist/dashboard/compat.js.map +1 -0
- package/dist/dashboard/stale-chunk-module.d.ts +3 -0
- package/dist/dashboard/stale-chunk-module.d.ts.map +1 -0
- package/dist/dashboard/stale-chunk-module.js +55 -0
- package/dist/dashboard/stale-chunk-module.js.map +1 -0
- package/dist/dashboard/web/app.d.ts.map +1 -1
- package/dist/dashboard/web/app.js +64 -2
- package/dist/dashboard/web/app.js.map +1 -1
- package/dist/dashboard/web/bot-defaults-page.d.ts.map +1 -1
- package/dist/dashboard/web/bot-defaults-page.js +9 -7
- package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
- package/dist/dashboard/web/i18n.js +10 -10
- package/dist/dashboard/web/i18n.js.map +1 -1
- package/dist/dashboard/web/sessions-page.js +2 -2
- package/dist/dashboard/web/sessions-page.js.map +1 -1
- package/dist/dashboard/web/stale-chunk-reload.d.ts +16 -0
- package/dist/dashboard/web/stale-chunk-reload.d.ts.map +1 -0
- package/dist/dashboard/web/stale-chunk-reload.js +51 -0
- package/dist/dashboard/web/stale-chunk-reload.js.map +1 -0
- package/dist/dashboard-web/app.js +1 -1
- package/dist/dashboard-web/chunks/{bot-defaults-page-SRCBF7Z3.js → bot-defaults-page-MBORWWP7.js} +5 -5
- package/dist/dashboard-web/chunks/{chunk-3H6MVXXU.js → chunk-4QTBR7UF.js} +2 -2
- package/dist/dashboard-web/chunks/{chunk-77KD4TK2.js → chunk-7STGZ5BX.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-D2I5F4MY.js → chunk-EIO5AWDA.js} +1 -1
- package/dist/dashboard-web/chunks/{chunk-NGRUZCXP.js → chunk-G43RUPUN.js} +1 -1
- package/dist/dashboard-web/chunks/{connectors-page-RM3BJVMV.js → connectors-page-LKDT4WBG.js} +1 -1
- package/dist/dashboard-web/chunks/{groups-page-3D4YSYLA.js → groups-page-XKIWJ2TP.js} +1 -1
- package/dist/dashboard-web/chunks/{insights-page-CRFJKA54.js → insights-page-CBEZCYKV.js} +1 -1
- package/dist/dashboard-web/chunks/{monitor-room-HLK3XDT2.js → monitor-room-AQTHAWXA.js} +1 -1
- package/dist/dashboard-web/chunks/{monitoring-page-E3SNZFFN.js → monitoring-page-2R4NCNBQ.js} +1 -1
- package/dist/dashboard-web/chunks/{office-page-MKQ2TENK.js → office-page-5M6MQIIL.js} +1 -1
- package/dist/dashboard-web/chunks/{overview-page-ICFKKRLV.js → overview-page-N22HDZ2V.js} +1 -1
- package/dist/dashboard-web/chunks/{roles-page-2DFJ7YRU.js → roles-page-J6K2HWFX.js} +1 -1
- package/dist/dashboard-web/chunks/{schedules-page-S4WDIXH5.js → schedules-page-CGAQCB4J.js} +1 -1
- package/dist/dashboard-web/chunks/{sessions-page-4XWGUGB5.js → sessions-page-WJ2QYTIE.js} +2 -2
- package/dist/dashboard-web/chunks/{settings-page-OBTE4LYP.js → settings-page-GLRWV5KU.js} +1 -1
- package/dist/dashboard-web/chunks/{skills-page-CTRQJR47.js → skills-page-KQVW42QU.js} +1 -1
- package/dist/dashboard-web/chunks/{team-federation-page-GICLDKJP.js → team-federation-page-5PYUOV5M.js} +1 -1
- package/dist/dashboard-web/chunks/{v3-page-DI55IRL5.js → v3-page-DXPFILRZ.js} +1 -1
- package/dist/dashboard-web/chunks/{whiteboards-page-7KFWMILV.js → whiteboards-page-NUH6VZ4I.js} +1 -1
- package/dist/dashboard.js +26 -0
- package/dist/dashboard.js.map +1 -1
- package/dist/desktop/main/auto-start.d.ts +17 -0
- package/dist/desktop/main/auto-start.d.ts.map +1 -0
- package/dist/desktop/main/auto-start.js +37 -0
- package/dist/desktop/main/auto-start.js.map +1 -0
- package/dist/desktop/main/dashboard-compat.d.ts +25 -0
- package/dist/desktop/main/dashboard-compat.d.ts.map +1 -0
- package/dist/desktop/main/dashboard-compat.js +117 -0
- package/dist/desktop/main/dashboard-compat.js.map +1 -0
- package/dist/desktop/main/external-runtime.d.ts +29 -0
- package/dist/desktop/main/external-runtime.d.ts.map +1 -0
- package/dist/desktop/main/external-runtime.js +202 -0
- package/dist/desktop/main/external-runtime.js.map +1 -0
- package/dist/desktop/main/ipc.d.ts +20 -0
- package/dist/desktop/main/ipc.d.ts.map +1 -0
- package/dist/desktop/main/ipc.js +241 -0
- package/dist/desktop/main/ipc.js.map +1 -0
- package/dist/desktop/main/log-service.d.ts +4 -0
- package/dist/desktop/main/log-service.d.ts.map +1 -0
- package/dist/desktop/main/log-service.js +53 -0
- package/dist/desktop/main/log-service.js.map +1 -0
- package/dist/desktop/main/login-item.d.ts +10 -0
- package/dist/desktop/main/login-item.d.ts.map +1 -0
- package/dist/desktop/main/login-item.js +11 -0
- package/dist/desktop/main/login-item.js.map +1 -0
- package/dist/desktop/main/node-command.d.ts +22 -0
- package/dist/desktop/main/node-command.d.ts.map +1 -0
- package/dist/desktop/main/node-command.js +56 -0
- package/dist/desktop/main/node-command.js.map +1 -0
- package/dist/desktop/main/paths.d.ts +11 -0
- package/dist/desktop/main/paths.d.ts.map +1 -0
- package/dist/desktop/main/paths.js +13 -0
- package/dist/desktop/main/paths.js.map +1 -0
- package/dist/desktop/main/pm2-apps.d.ts +15 -0
- package/dist/desktop/main/pm2-apps.d.ts.map +1 -0
- package/dist/desktop/main/pm2-apps.js +97 -0
- package/dist/desktop/main/pm2-apps.js.map +1 -0
- package/dist/desktop/main/runtime-service.d.ts +49 -0
- package/dist/desktop/main/runtime-service.d.ts.map +1 -0
- package/dist/desktop/main/runtime-service.js +297 -0
- package/dist/desktop/main/runtime-service.js.map +1 -0
- package/dist/desktop/main/runtime-source.d.ts +17 -0
- package/dist/desktop/main/runtime-source.d.ts.map +1 -0
- package/dist/desktop/main/runtime-source.js +61 -0
- package/dist/desktop/main/runtime-source.js.map +1 -0
- package/dist/desktop/main/tray.d.ts +10 -0
- package/dist/desktop/main/tray.d.ts.map +1 -0
- package/dist/desktop/main/tray.js +27 -0
- package/dist/desktop/main/tray.js.map +1 -0
- package/dist/desktop/main/window.d.ts +16 -0
- package/dist/desktop/main/window.d.ts.map +1 -0
- package/dist/desktop/main/window.js +113 -0
- package/dist/desktop/main/window.js.map +1 -0
- package/dist/desktop/main.d.ts +2 -0
- package/dist/desktop/main.d.ts.map +1 -0
- package/dist/desktop/main.js +175 -0
- package/dist/desktop/main.js.map +1 -0
- package/dist/desktop/preload.d.ts +2 -0
- package/dist/desktop/preload.d.ts.map +1 -0
- package/dist/desktop/preload.js +24 -0
- package/dist/desktop/preload.js.map +1 -0
- package/dist/desktop/renderer/app.d.ts +35 -0
- package/dist/desktop/renderer/app.d.ts.map +1 -0
- package/dist/desktop/renderer/app.js +945 -0
- package/dist/desktop/renderer/app.js.map +1 -0
- package/dist/desktop/renderer/dashboard-url.d.ts +13 -0
- package/dist/desktop/renderer/dashboard-url.d.ts.map +1 -0
- package/dist/desktop/renderer/dashboard-url.js +98 -0
- package/dist/desktop/renderer/dashboard-url.js.map +1 -0
- package/dist/desktop/renderer/runtime-state.d.ts +8 -0
- package/dist/desktop/renderer/runtime-state.d.ts.map +1 -0
- package/dist/desktop/renderer/runtime-state.js +67 -0
- package/dist/desktop/renderer/runtime-state.js.map +1 -0
- package/dist/desktop/shared/types.d.ts +48 -0
- package/dist/desktop/shared/types.d.ts.map +1 -0
- package/dist/desktop/shared/types.js +2 -0
- package/dist/desktop/shared/types.js.map +1 -0
- package/dist/desktop/smoke.d.ts +28 -0
- package/dist/desktop/smoke.d.ts.map +1 -0
- package/dist/desktop/smoke.js +258 -0
- package/dist/desktop/smoke.js.map +1 -0
- package/dist/utils/version-info.d.ts +25 -0
- package/dist/utils/version-info.d.ts.map +1 -0
- package/dist/utils/version-info.js +48 -0
- package/dist/utils/version-info.js.map +1 -0
- package/package.json +9 -1
|
@@ -19,7 +19,7 @@ oc_yyy`,"botDefaults.substituteTargetsPlaceholder":`zhangsan@bytedance.com
|
|
|
19
19
|
ou_xxxx\uFF08\u4E5F\u53EF\u76F4\u63A5\u586B open_id / union_id\uFF09`,"botDefaults.substituteTargets":"\u66FF\u8EAB\u5BF9\u8C61","botDefaults.substituteTargetsHelp":"\u6BCF\u9879\u5BF9\u5E94\u4E00\u4E2A\u66FF\u8EAB\u5BF9\u8C61\u3002\u53EF\u76F4\u63A5\u586B\u90AE\u7BB1\uFF08\u4FDD\u5B58\u65F6\u81EA\u52A8\u89E3\u6790\u4E3A Open ID\uFF09\uFF0C\u4E5F\u53EF\u9009\u62E9 Open ID\u3001User ID \u6216 Union ID\uFF1B\u89E3\u6790\u5931\u8D25\u7684\u90AE\u7BB1\u4F1A\u6807\u7EA2\u3002","botDefaults.substituteTargetType":"\u6807\u8BC6\u7C7B\u578B","botDefaults.substituteTargetEmail":"\u90AE\u7BB1","botDefaults.substituteTargetOpenId":"Open ID","botDefaults.substituteTargetUserId":"User ID","botDefaults.substituteTargetUnionId":"Union ID","botDefaults.substituteTargetIdPlaceholder":"\u8F93\u5165\u98DE\u4E66\u7528\u6237\u6807\u8BC6\u6216\u90AE\u7BB1","botDefaults.substituteTargetName":"\u663E\u793A\u540D\u79F0","botDefaults.substituteTargetNamePlaceholder":"\u663E\u793A\u540D\u79F0\uFF08\u53EF\u9009\uFF09","botDefaults.substituteTargetAdd":"\u6DFB\u52A0\u66FF\u8EAB\u5BF9\u8C61","botDefaults.substituteTargetRemove":"\u5220\u9664\u66FF\u8EAB\u5BF9\u8C61","botDefaults.substituteTargetsInvalid":"\u542F\u7528\u524D\u81F3\u5C11\u586B\u5199\u4E00\u4E2A\u6709\u6548\u7684\u66FF\u8EAB\u5BF9\u8C61\uFF1B\u90AE\u7BB1\u9700\u80FD\u89E3\u6790\u4E3A Open ID","botDefaults.substituteTargetsRequired":"\u5F00\u542F\u66FF\u8EAB\u89E6\u53D1\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u80FD\u89E3\u6790\u6210 open_id \u7684\u5BF9\u8C61","botDefaults.substituteResolving":"\u89E3\u6790\u4E2D\u2026","botDefaults.substituteUnresolved":"\u672A\u89E3\u6790","botDefaults.substituteReasonCrossAppOpenId":"\u8BE5 Open ID \u5C5E\u4E8E\u5176\u4ED6\u5E94\u7528\uFF0C\u8BF7\u6539\u7528\u90AE\u7BB1\u6216 Union ID","botDefaults.substituteReasonNotVisible":"\u8BE5\u7528\u6237\u4E0D\u5728\u5E94\u7528\u901A\u8BAF\u5F55\u53EF\u89C1\u8303\u56F4\uFF0C\u8BF7\u8C03\u6574\u5E94\u7528\u53EF\u89C1\u6027\u6216\u6539\u7528\u90AE\u7BB1","botDefaults.substituteReasonResolveFailed":"\u89E3\u6790\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u901A\u8BAF\u5F55\u6743\u9650","botDefaults.substituteReasonUnresolvable":"\u65E0\u6CD5\u89E3\u6790\u8BE5\u6807\u8BC6\uFF0C\u8BF7\u68C0\u67E5\u62FC\u5199\u6216\u6539\u7528\u90AE\u7BB1","botDefaults.substituteSave":"\u4FDD\u5B58\u66FF\u8EAB\u6A21\u5F0F","botDefaults.substituteOff":"\u5173\u95ED\u5168\u5C40\u66FF\u8EAB\u914D\u7F6E","botDefaults.sectionGrant":"\u6388\u6743\u4E0E\u989D\u5EA6","botDefaults.autoGrantCard":"\u672A\u6388\u6743 @ \u81EA\u52A8\u5F39\u6388\u6743\u5361","botDefaults.autoGrantCardHelp":"\u672A\u6388\u6743\u7528\u6237\u6216\u5916\u90E8 bot \u660E\u786E @ \u65F6\uFF0C\u81EA\u52A8\u5411 owner \u53D1\u9001 /grant \u7533\u8BF7\u5361\u3002\u5173\u95ED\u540E\u4ECD\u62E6\u622A\uFF0C\u4F46\u4E0D\u63D0\u793A\u3002","botDefaults.restrictGrant":"\u9650\u5236\u88AB\u6388\u6743\u4EBA\u53EA\u80FD\u7EAF\u5BF9\u8BDD","botDefaults.restrictGrantHelp":"\u9650\u5236 /grant \u7528\u6237\u53EA\u80FD\u666E\u901A\u5BF9\u8BDD\uFF0C\u7981\u6B62 botmux \u547D\u4EE4\u3001\u900F\u4F20\u547D\u4EE4\u3001CLI \u539F\u751F\u547D\u4EE4\u548C\u5DE5\u4F5C\u6D41\u76F8\u5173\u547D\u4EE4\uFF1Bowner \u4E0D\u53D7\u5F71\u54CD\u3002","botDefaults.quotaDefault":"\u9ED8\u8BA4\u6D88\u606F\u989D\u5EA6","botDefaults.quotaPlaceholder":"\u7559\u7A7A\uFF1D\u4E0D\u914D\u7F6E\u9ED8\u8BA4\u989D\u5EA6","botDefaults.quotaHelp":"\u8BBE\u7F6E\u88F8 /grant @\u7528\u6237 \u7684\u9ED8\u8BA4\u6D88\u606F\u989D\u5EA6\u3002\u7559\u7A7A\u4FDD\u5B58=\u4E0D\u518D\u8BBE\u7F6E\u9ED8\u8BA4\u989D\u5EA6\uFF1B\u5DF2\u6709\u989D\u5EA6\u548C\u663E\u5F0F /grant @\u7528\u6237 N \u4E0D\u53D7\u5F71\u54CD\u3002\u989D\u5EA6\u7528\u5C3D\u540E\u81EA\u52A8\u64A4\u9500\u6388\u6743\u3002","botDefaults.quotaSave":"\u4FDD\u5B58\u989D\u5EA6","botDefaults.quotaInvalid":"\u989D\u5EA6\u5FC5\u987B\u662F\u6B63\u6574\u6570","botDefaults.quotaStateOff":"\u5F53\u524D\uFF1A\u672A\u914D\u7F6E\u9ED8\u8BA4\u989D\u5EA6","botDefaults.quotaStateOn":"\u5F53\u524D\uFF1A\u6BCF\u4EBA {count} \u6761","botDefaults.sectionSessionCap":"\u4F1A\u8BDD\u5E38\u9A7B\u4E0A\u9650","botDefaults.maxLiveWorkers":"\u6700\u5927\u5E38\u9A7B\u4F1A\u8BDD\u6570","botDefaults.maxLiveWorkersPlaceholder":"\u7559\u7A7A\uFF1D\u9ED8\u8BA4 30","botDefaults.maxLiveWorkersUsage":"\u5E38\u9A7B {resident}/{cap} \xB7 \u4F11\u7720 {dormant} \xB7 \u603B\u4F1A\u8BDD {logical}","botDefaults.maxLiveWorkersHelp":"\u672C Bot \u540C\u65F6\u5E38\u9A7B\u5185\u5B58\u7684\u4F1A\u8BDD\u6570\u4E0A\u9650\u3002\u8D85\u8FC7\u540E\u6700\u4E45\u672A\u7528\u7684\u4F1A\u8BDD\u81EA\u52A8\u4F11\u7720\uFF1A\u5176\u540E\u53F0\u8FDB\u7A0B\u548C CLI \u4E00\u8D77\u9000\u51FA\u3001\u56DE\u6536\u5185\u5B58\uFF0C\u4F46\u8BDD\u9898\u4ECD\u53EF\u7EE7\u7EED\uFF1B\u4E0B\u6761\u6D88\u606F\u4F1A\u4ECE\u78C1\u76D8\u8BB0\u5F55\u51B7\u6062\u590D\u4E0A\u4E0B\u6587\uFF08\u901A\u5E38\u51E0\u79D2\uFF09\u3002\u7559\u7A7A\uFF1D\u9ED8\u8BA4 30\uFF1B\u586B\u6570\u5B57\uFF1D\u672C Bot \u81EA\u5B9A\u4E49\u3002\u6CE8\u610F\uFF1A\u6B63\u5728\u51FA\u7B54\u6848\u7684\u4F1A\u8BDD\u4E0D\u4F1A\u88AB\u6253\u65AD\uFF1B\u53EA\u6709\u53EF\u6062\u590D\u7684\u4F1A\u8BDD\u4F1A\u81EA\u52A8\u4F11\u7720\uFF0C\u63A5\u5165\u5916\u90E8\u7EC8\u7AEF\u6216\u4E0D\u53EF\u6062\u590D\u7684\u4F1A\u8BDD\u4E0D\u53D7\u5F71\u54CD\u3002","botDefaults.maxLiveWorkersSave":"\u4FDD\u5B58\u4E0A\u9650","botDefaults.maxLiveWorkersOff":"\u6062\u590D\u9ED8\u8BA4","botDefaults.maxLiveWorkersInvalid":"\u4E0A\u9650\u5FC5\u987B\u662F\u6B63\u6574\u6570","botDefaults.maxLiveWorkersStateDefault":"\u5F53\u524D\uFF1A\u9ED8\u8BA4\u5E38\u9A7B 30 \u4E2A\u4F1A\u8BDD","botDefaults.maxLiveWorkersStateOn":"\u5F53\u524D\uFF1A\u6700\u591A\u5E38\u9A7B {count} \u4E2A\u4F1A\u8BDD","botDefaults.sectionRuntimeEnv":"\u542F\u52A8\u73AF\u5883","botDefaults.sectionStartupCommands":"\u542F\u52A8\u547D\u4EE4","botDefaults.startupCommandsHelp":"\u65B0\u4F1A\u8BDD\u542F\u52A8\u540E\u3001\u9996\u6761\u6D88\u606F\u524D\u81EA\u52A8\u53D1\u9001\u7684 CLI \u547D\u4EE4\u3002\u652F\u6301\u9017\u53F7\u6216\u6362\u884C\u5206\u9694\uFF1B\u6BCF\u6B21\u65B0\u4F1A\u8BDD\u548C\u6062\u590D\u90FD\u4F1A\u91CD\u653E\u3002\u4EC5\u539F\u751F CLI \u4F1A\u8BDD\u751F\u6548\u3002","botDefaults.startupCommandsPlaceholder":"\u6BCF\u884C\u4E00\u6761\uFF0C\u5982 /effort ultracode","botDefaults.startupCommandsSave":"\u4FDD\u5B58\u542F\u52A8\u547D\u4EE4","botDefaults.sectionLaunchShell":"\u542F\u52A8 Shell","botDefaults.launchShellHelp":"\u6307\u5B9A\u542F\u52A8 CLI \u7684 shell\uFF08\u5982 zsh \u6216 /usr/bin/zsh\uFF09\uFF0C\u8986\u76D6 daemon \u7684 $SHELL\u3002\u7528\u4E8E\u7ED5\u8FC7\u767B\u5F55 shell rc \u4E2D\u7684\u8DF3\u8F6C\u95EE\u9898\uFF1BPATH \u7B49\u4ECD\u9700\u5728\u6240\u9009 shell \u914D\u7F6E\u4E2D\u53EF\u7528\u3002\u4E0B\u4E2A\u65B0\u4F1A\u8BDD\u751F\u6548\u3002","botDefaults.launchShellPlaceholder":"\u5982 zsh \u6216 /usr/bin/zsh\uFF1B\u7559\u7A7A\uFF1D\u7528 $SHELL","botDefaults.launchShellSave":"\u4FDD\u5B58\u542F\u52A8 Shell","botDefaults.sectionEnv":"\u73AF\u5883\u53D8\u91CF","botDefaults.envHelp":"\u4EE5 JSON \u4E3A\u8BE5 bot \u7684 CLI \u8FDB\u7A0B\u6CE8\u5165\u73AF\u5883\u53D8\u91CF\u3002\u652F\u6301\u5B57\u7B26\u4E32/\u6570\u5B57/\u5E03\u5C14\uFF1BBOTMUX_\u3001LARK_APP_ \u7B49\u4FDD\u7559\u952E\u4F1A\u88AB\u5FFD\u7565\u3002\u4E0B\u4E2A\u65B0\u4F1A\u8BDD\u751F\u6548\uFF0C\u660E\u6587\u5B58\u50A8\u5728 bots.json\u3002","botDefaults.envPlaceholder":`{
|
|
20
20
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
|
21
21
|
"ANTHROPIC_AUTH_TOKEN": "\u4F60\u7684 GLM Coding Plan key"
|
|
22
|
-
}`,"botDefaults.envSave":"\u4FDD\u5B58\u73AF\u5883\u53D8\u91CF","botDefaults.sectionRiff":"Riff \u540E\u7AEF\u914D\u7F6E","botDefaults.riffHelp":"\u914D\u7F6E riff
|
|
22
|
+
}`,"botDefaults.envSave":"\u4FDD\u5B58\u73AF\u5883\u53D8\u91CF","botDefaults.sectionRiff":"Riff \u540E\u7AEF\u914D\u7F6E","botDefaults.riffHelp":"\u914D\u7F6E riff \u670D\u52A1\u7684\u8FDE\u63A5\u53C2\u6570\uFF0C\u4E0B\u4E2A\u65B0\u4F1A\u8BDD\u751F\u6548\u3002agent \u56FA\u5B9A\u4E3A codex\uFF08riff \u670D\u52A1\u7AEF\u5DF2\u4E0B\u7EBF\u5176\u5B83 runner\uFF09\u3002\u8BA4\u8BC1\uFF1A\u9ED8\u8BA4\u81EA\u52A8\u8BFB\u53D6\u672C\u673A ByteCloud keychain \u7684 JWT\uFF08\u767B\u5F55\u8FC7 kaboo-cli / aiden-cli / cjadk \u4EFB\u4E00\u5373\u53EF\uFF09\uFF0C\u65B0\u673A\u5668\u53EA\u9700\u767B\u5F55\u4E00\u6B21\uFF1B\u4E5F\u53EF\u7528\u300CJWT \u73AF\u5883\u53D8\u91CF\u300D\u6307\u5B9A\u3002\u4ED3\u5E93\uFF1A\u81EA\u52A8\u590D\u7528\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\uFF08\u542B\u4ED3\u5E93\u9009\u62E9\u5361 / \u4EC5\u9ED8\u8BA4\u76EE\u5F55 / Oncall \u76EE\u5F55\uFF09\u7684 git \u4ED3\u5E93\u4E0E\u5F53\u524D\u5206\u652F\uFF0C\u65E0\u9700\u5355\u72EC\u914D\u7F6E\u3002","botDefaults.riffBaseUrl":"Base URL","botDefaults.riffBaseUrlPlaceholder":"https://riff.example.com","botDefaults.riffReasoningEffort":"\u601D\u8003\u7B49\u7EA7","botDefaults.riffReasoningEffortDefault":"\u9ED8\u8BA4\uFF08medium\uFF09","botDefaults.riffReasoningEffortHelp":"codex \u7684\u63A8\u7406\u5F3A\u5EA6\uFF08model_reasoning_effort\uFF09\uFF0C\u5199\u5165\u6C99\u7BB1\u914D\u7F6E\u3002\u7559\u7A7A\u8DDF\u968F riff \u9ED8\u8BA4 medium\uFF1Bxhigh \u6700\u5F3A\u4F46\u66F4\u6162\u66F4\u8D35\u3002","botDefaults.riffModel":"\u6A21\u578B","botDefaults.riffModelPlaceholder":"\uFF08\u53EF\u9009\uFF09\u7559\u7A7A\u4F7F\u7528 riff \u9ED8\u8BA4\u6A21\u578B\uFF08\u63A8\u8350\uFF09","botDefaults.riffModelHelp":"riff \u4EFB\u52A1\u7684\u6A21\u578B\u540D\u3002\u7559\u7A7A\u4F7F\u7528 riff \u9ED8\u8BA4\uFF08gpt-5.5\uFF09\uFF1B\u4EC5\u63A5\u53D7 riff \u652F\u6301\u6E05\u5355\u5185\u7684\u503C\uFF0C\u975E\u6CD5\u540D\u5B57\u4F1A\u521B\u5EFA\u5931\u8D25\u5E76\u56DE\u663E\u5B8C\u6574\u6E05\u5355\u3002","botDefaults.riffJwtEnv":"JWT \u73AF\u5883\u53D8\u91CF","botDefaults.riffJwtEnvPlaceholder":"RIFF_JWT","botDefaults.riffSystemPrompt":"System Prompt","botDefaults.riffSystemPromptPlaceholder":"\uFF08\u53EF\u9009\uFF09\u6CE8\u5165\u5230 riff \u4EFB\u52A1\u7684\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF1B\u4E0D\u586B\u5219\u4F7F\u7528\u5185\u7F6E\u9ED8\u8BA4\u503C","botDefaults.riffSetupCommands":"\u989D\u5916\u521D\u59CB\u5316\u547D\u4EE4","botDefaults.riffSetupCommandsPlaceholder":"\uFF08\u53EF\u9009\uFF09\u6BCF\u884C\u4E00\u6761 shell \u547D\u4EE4\uFF0C\u5728 agent \u5F00\u59CB\u5DE5\u4F5C\u524D\u6267\u884C\u3002botmux \u4F1A\u81EA\u52A8\u5B89\u88C5\uFF0C\u65E0\u9700\u624B\u52A8\u6DFB\u52A0\u3002","botDefaults.riffJwtEnvHelp":"\u5B58\u653E JWT \u4EE4\u724C\u7684\u73AF\u5883\u53D8\u91CF\u540D\u3002botmux \u542F\u52A8\u65F6\u4ECE\u8BE5\u53D8\u91CF\u8BFB\u53D6\u4EE4\u724C\u7528\u4E8E\u8C03\u7528 riff API\uFF1B\u4E5F\u53EF\u7559\u7A7A\u4F7F\u7528 ByteCloud keychain \u81EA\u52A8\u83B7\u53D6\u3002","botDefaults.riffCliPersistFailed":"\u5207\u6362\u5230 Riff \u672A\u80FD\u4FDD\u5B58\uFF08CLI \u9009\u62E9\u6301\u4E45\u5316\u5931\u8D25\uFF09\uFF0C\u8BF7\u91CD\u8BD5","botDefaults.riffSave":"\u4FDD\u5B58 Riff \u914D\u7F6E","nav.roles":"\u89D2\u8272\u7BA1\u7406","nav.groupRoles":"\u7FA4\u89D2\u8272","nav.roleProfiles":"Profiles","roles.title":"\u89D2\u8272\u7BA1\u7406","roleProfiles.title":"Profiles","roles.search":"\u641C\u7D22\u7FA4\u540D/Bot/ID","roles.refresh":"\u5237\u65B0","roles.selectHint":"\u2190 \u5C55\u5F00\u7FA4\u7EC4\uFF0C\u9009\u62E9\u4E00\u4E2A Bot \u6765\u7F16\u8F91\u89D2\u8272","roles.editorPlaceholder":`\u8F93\u5165\u89D2\u8272\u63CF\u8FF0\uFF0C\u4F8B\u5982\uFF1A
|
|
23
23
|
\u4F60\u662F\u672C\u7FA4\u7684\u6280\u672F\u987E\u95EE\uFF0C\u8D1F\u8D23\u56DE\u7B54\u6240\u6709\u6280\u672F\u95EE\u9898...`,"roles.injectModeLabel":"\u6CE8\u5165\u65B9\u5F0F","roles.injectModeEvery":"\u6BCF\u8F6E\u6CE8\u5165\uFF08\u9ED8\u8BA4\uFF09","roles.injectModeOnce":"\u4EC5\u9996\u8F6E\u6CE8\u5165\u4E00\u6B21","roles.injectModeHint":"\u300C\u4EC5\u4E00\u6B21\u300D\u53EA\u5728\u4F1A\u8BDD\u5F00\u59CB/\u91CD\u5EFA\u65F6\u6CE8\u5165\u89D2\u8272\uFF0C\u4E4B\u540E\u4E0D\u518D\u91CD\u590D\uFF0C\u7701 token\uFF1B\u6539\u52A8\u5373\u65F6\u4FDD\u5B58","roles.configured":"\u5DF2\u914D\u7F6E","roles.unconfigured":"\u672A\u914D\u7F6E","roles.noChats":"\u6682\u65E0\u7FA4\u7EC4","roles.preview":"\u9884\u89C8","roles.previewEmpty":"\uFF08\u7A7A\u5185\u5BB9\uFF09","roles.saved":"\u5DF2\u4FDD\u5B58","roles.delete":"\u5220\u9664","roles.save":"\u4FDD\u5B58","roles.confirmDelete":"\u786E\u8BA4\u5220\u9664\u8BE5 Bot \u5728\u6B64\u7FA4\u7684\u89D2\u8272\u914D\u7F6E\uFF1F","roles.botsWithRoles":"\u4E2A Bot \u5DF2\u914D\u7F6E\u89D2\u8272","roles.emptyError":"\u89D2\u8272\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u5148\u8F93\u5165\u5185\u5BB9","roles.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","roles.tabGroups":"\u6309\u7FA4\u7EC4","roles.tabProfiles":"Profiles","roles.profileIdPlaceholder":"profile id\uFF0C\u5982 collab-main","roles.profileIdInvalid":"Profile id \u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u70B9\u3001\u4E0B\u5212\u7EBF\u3001\u77ED\u6A2A\u7EBF\uFF0C\u6700\u957F 64\uFF0C\u4E14\u4E0D\u80FD\u662F . \u6216 ..","roles.openProfile":"\u6253\u5F00","roles.profileSearch":"\u641C\u7D22 profile","roles.profileSelectHint":"\u2190 \u9009\u62E9\u6216\u8F93\u5165\u4E00\u4E2A profile \u6765\u7F16\u8F91","roles.profileEmpty":"\u6682\u65E0 Profiles","roles.profileEntries":"\u4E2A entry","roles.profileMissing":"\u7F3A\u5931","roles.profileRuntimeHint":"Profile \u53EA\u662F\u53EF\u590D\u7528\u5957\u88C5\uFF1BApply \u540E\u5199\u6210\u672C\u7FA4 Role\uFF0C\u4E0D\u589E\u52A0\u8FD0\u884C\u65F6\u5C42\u7EA7\u3002","roles.profileBots":"Bot Entries","roles.profileEditorPlaceholder":"\u8F93\u5165\u5F53\u524D bot \u5728\u8BE5 profile \u4E0B\u7684 Markdown role...","roles.saveEntry":"\u4FDD\u5B58 Entry","roles.profileBotSelectHint":"\u9009\u62E9\u4E00\u4E2A Bot \u6765\u7F16\u8F91\u5B83\u5728\u8BE5 profile \u91CC\u7684 entry","roles.applyToGroup":"Apply \u5230\u7FA4\u7EC4","roles.applyForce":"\u8986\u76D6\u5DF2\u6709\u672C\u7FA4 Role","roles.previewApply":"\u9884\u89C8 Apply","roles.applyProfile":"Apply Profile","roles.applyPickBots":"\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A Bot","roles.applyWouldRefuse":"\u4F1A\u62D2\u7EDD\uFF08\u5DF2\u6709\u672C\u7FA4 Role\uFF09","roles.applyPreviewOk":"\u53EF\u5E94\u7528","roles.applyOk":"\u5DF2\u5E94\u7528","roles.applyFailed":"\u5931\u8D25","roles.confirmDeleteProfileEntry":"\u786E\u8BA4\u5220\u9664\u8BE5 Bot \u5728\u6B64 profile \u91CC\u7684 entry\uFF1F","common.none":"\u65E0","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.unknown":"\u672A\u77E5","common.now":"\u521A\u521A","common.never":"\u4ECE\u672A","common.all":"\u5168\u90E8","common.dropdownSearch":"\u641C\u7D22\u2026","common.dropdownSearchEmpty":"\u65E0\u5339\u914D\u9879","nav.workflows":"\u5DE5\u4F5C\u6D41","workflow.v3.cancel":"\u53D6\u6D88\u8FD0\u884C","workflow.v3.cancelTitle":"\u53D6\u6D88\u8FD9\u4E2A v3 \u5DE5\u4F5C\u6D41\u8FD0\u884C","workflow.v3.cancelTerminal":"\u8FD0\u884C\u5DF2\u7ED3\u675F","workflow.v3.cancelling":"\u53D6\u6D88\u4E2D\u2026","workflow.v3.cancelConfirm":`\u786E\u8BA4\u53D6\u6D88 v3 \u5DE5\u4F5C\u6D41\u8FD0\u884C {runId}\uFF1F
|
|
24
24
|
|
|
25
25
|
\u5DF2\u5B8C\u6210\u7684\u8282\u70B9\u4F1A\u4FDD\u7559\uFF0C\u8FD0\u884C\u4E2D\u7684\u8282\u70B9\u4F1A\u88AB\u4E2D\u65AD\u3002`,"workflow.v3.cancelPending":"\u53D6\u6D88\u8BF7\u6C42\u5DF2\u6301\u4E45\u5316\uFF1B\u6B63\u5728\u7B49\u5F85\u8FD0\u884C\u4E2D\u7684\u8282\u70B9\u6536\u655B\u3002","workflow.v3.cancelled":"\u8FD0\u884C\u5DF2\u53D6\u6D88\u3002","workflow.v3.cancelAlreadyTerminal":"\u8FD0\u884C\u5DF2\u5148\u4E00\u6B65\u8FDB\u5165\u7EC8\u6001\uFF0C\u672A\u518D\u63D0\u4EA4\u53D6\u6D88\u3002","workflow.v3.cancelAuthRequired":"\u9700\u8981 Dashboard \u5199\u6743\u9650\uFF1A\u8BF7\u5728\u7EC8\u7AEF\u8FD0\u884C `botmux dashboard` \u83B7\u53D6\u4E00\u6B21\u6027\u94FE\u63A5\u540E\u91CD\u8BD5\u3002","workflow.v3.cancelFailed":"\u53D6\u6D88\u5931\u8D25\uFF1A{error}"},me={"app.name":"botmux","app.subtitle":"Feishu AI CLI Control","nav.docs":"Docs","time.secondsAgo":"{value}s ago","time.minutesAgo":"{value}m ago","time.hoursAgo":"{value}h ago","nav.overview":"Workbench","nav.monitoring":"Monitoring Board","nav.sessions":"Session Control","nav.groups":"Group Management","nav.schedules":"Scheduled Tasks","nav.settings":"Global Settings","nav.botDefaults":"Bot Config","nav.skills":"Skill Management","nav.whiteboards":"Whiteboards","nav.team":"Team Collaboration","nav.connectors":"Webhook","nav.webhookLogs":"Invocation Logs","nav.office":"Office","nav.createSession":"Create session","nav.createBot":"Create bot","status.live":"Live link","status.disconnected":"Disconnected","status.system":"System","status.light":"Light","status.dark":"Dark","status.language":"Language","status.theme":"Theme","theme.base":"Basic","theme.skins":"Skins","skin.cyber":"2077","skin.fallout":"Fallout","botOnboarding.add":"Add Bot","botOnboarding.title":"Add Bot","botOnboarding.intro":"Choose how it works. Scan once to sign in, then reuse that account for future additions without scanning.","botOnboarding.sessionChecking":"Checking your Feishu sign-in\u2026","botOnboarding.sessionReady":"Will use {user} \xB7 {tenant}","botOnboarding.switchAccount":"Switch account","botOnboarding.reuseCurrentAccount":"Use current account","botOnboarding.sessionSwitching":"A new scan will choose another account","botOnboarding.sessionSwitchingHint":"The new sign-in will replace the cache on this machine.","botOnboarding.sessionScanRequired":"Scan to sign in","botOnboarding.sessionScanRequiredHint":"Scan on first use or after expiry. The sign-in stays on this machine so later additions can skip it.","botOnboarding.confirmReuse":"Confirm account and add","botOnboarding.appNameLabel":"Bot name (optional)","botOnboarding.appNamePlaceholder":"e.g. Engineering Assistant","botOnboarding.appNameHint":"Leave blank to use {name}","botOnboarding.cliLabel":"AI CLI","botOnboarding.cliMissingOption":"{label} (not installed: {command})","botOnboarding.cliMissingHint":"{command} is not available on this machine. Install it or fix the daemon PATH before creating the Bot.","botOnboarding.dirModeLabel":"Where new topics start","botOnboarding.dirModeFixed":"Fixed folder (recommended)","botOnboarding.dirModeCard":"Choose a repository each time","botOnboarding.dirLabelFixed":"Default working directory","botOnboarding.dirLabelCard":"Repo scan root","botOnboarding.dirPlaceholderFixed":"Default ~ (home); must exist on the daemon host","botOnboarding.dirPlaceholderCard":"e.g. ~/projects \u2014 the card lists git repos under it; must exist on the daemon host","botOnboarding.modelLabel":"Model (optional)","botOnboarding.modelPlaceholder":"Leave empty for the CLI default model","botOnboarding.modelTtadkPlaceholder":"ttadk gateway model, default {model}, editable anytime","botOnboarding.modelTtadkCocoPlaceholder":"CoCo needs no model","botOnboarding.startScan":"Scan to add","botOnboarding.cancel":"Cancel","botOnboarding.starting":"Preparing secure sign-in\u2026","botOnboarding.waiting":"Scan with Feishu. One scan creates and configures \u201C{name}\u201D.","botOnboarding.waitingCompat":"Scan with Feishu for compatibility mode. An additional scan may be required, and the platform chooses the app name.","botOnboarding.verifying":"App created. Confirming your account\u2026","botOnboarding.configuringPermissions":"Configuring permissions and events, then publishing the bot\u2026","botOnboarding.platformScanHint":"Compatibility mode needs an additional Open Platform sign-in. Scan to continue.","botOnboarding.platformQrAlt":"Open Platform login QR code","botOnboarding.completed":"\u201C{name}\u201D is ready","botOnboarding.botFallback":"Bot","botOnboarding.permissionOk":"Auto-imported {count} permissions.","botOnboarding.permissionSkipped":"({count} skipped \u2014 not in the tenant catalog)","botOnboarding.permissionVersion":"Submitted version {version}.","botOnboarding.permissionManual":"Permissions could not be auto-configured. Complete these steps manually:","botOnboarding.metaDir":"Dir","botOnboarding.createFailedTitle":"Couldn\u2019t create the app","botOnboarding.createFailedDescription":"Your form values are preserved. Retry or explicitly choose compatibility mode.","botOnboarding.qrExpiredTitle":"QR code expired","botOnboarding.qrExpiredDescription":"Your form values are preserved. Generate a new code.","botOnboarding.authIncompleteTitle":"Authorization wasn\u2019t completed","botOnboarding.authIncompleteDescription":"No app was created. You can scan again.","botOnboarding.partialFailureTitle":"The app was created, but setup is incomplete","botOnboarding.partialFailureDescription":"The App ID is preserved and no new app will be created. Use the recovery command in Technical details.","botOnboarding.technicalDetails":"Technical details","botOnboarding.retry":"Retry","botOnboarding.generateQr":"Generate a new code","botOnboarding.scanAgain":"Scan again","botOnboarding.compatibilityMode":"Use compatibility mode","botOnboarding.compatibilityConfirm":"Compatibility mode may require an additional scan and cannot apply a custom bot name. Continue?","botOnboarding.openLink":"Open scan link in browser","botOnboarding.close":"Close","botOnboarding.restartHint":"bots.json has been updated. Auto-start did not succeed; run botmux restart for the new bot to take effect.","botOnboarding.liveOk":"The bot is live \u2014 no restart needed. Just @mention it in Feishu to use it.","botOnboarding.needsOwnerTitle":"One more step: confirm an administrator","botOnboarding.needsOwnerDescription":"We could not confirm an administrator from the scanned account. Enter a company email to finish; the bot will not start before confirmation.","botOnboarding.ownerLabel":"Administrator email","botOnboarding.ownerPlaceholder":"name@company.com","botOnboarding.ownerUseId":"Use an ID","botOnboarding.ownerIdLabel":"union_id / open_id","botOnboarding.ownerIdPlaceholder":"on_xxx or ou_xxx","botOnboarding.ownerSubmit":"Confirm and finish","botOnboarding.ownerEmpty":"Enter an administrator email or ID.","botOnboarding.ownerInvalid":"Administrator validation failed. Check the value and retry.","botOnboarding.qrAlt":"Feishu bot onboarding QR code","overview.title":"Workbench","overview.team":"AI Team","overview.teamHint":"Live status of every digital teammate","overview.attention":"Needs You","overview.activeSessions":"Active Sessions","overview.sessionOverview":"Session Overview","overview.viewAll":"View all \u2192","overview.viewAllPlain":"View all","overview.sort":"Sort","overview.sortByTime":"By time","overview.sortAttentionFirst":"Needs you first","overview.botIdle":"Standing by, ready for new tasks","overview.botOffline":"Offline \u2014 daemon not running","overview.botBusy":"Working \xB7 {count} sessions","overview.botNeedsYou":"Waiting on you","overview.botReady":"Ready","overview.botOff":"Offline","overview.sessionsCount":"{count} sessions","overview.lastActive":"active {time} ago","overview.teamCount":"{count} bots","overview.teamExpand":"Show all","overview.teamCollapse":"Collapse","strip.pending":"{count} pending","strip.longestCompact":"longest {time} \xB7 {bot} \xB7 {reason}","strip.handle":"Handle now","overview.openSessions":"Active Sessions","overview.workingSessions":"Working","overview.idleSessions":"Idle","overview.onlineBots":"Online Bots","overview.schedules":"Schedules","overview.groups":"Groups Seen","overview.enabledSchedules":"Enabled","overview.total":"total","overview.active":"active","overview.daemonRegistry":"daemon registry","overview.chatMatrix":"chat matrix","overview.recentSessions":"Recent Sessions","overview.nextSchedules":"Schedules","overview.noSessions":"No sessions yet.","overview.noSchedules":"No schedules yet.","monitoring.eyebrow":"Runtime resources","monitoring.title":"Monitoring Board","monitoring.subtitle":"Watch host, botmux, bot, and session CPU and memory pressure in real time.","monitoring.runtimeTitle":"Monitoring Board","monitoring.runtimeSubtitle":"Monitor botmux runtime health, resource pressure, and session pressure in real time.","monitoring.runtimeHealth":"Runtime Health","monitoring.runtimeHealthHint":"Check sample freshness, daemon availability, and session buildup.","monitoring.resourcePressure":"Resource Pressure","monitoring.resourcePressureHint":"Machine resource trends are memory-only and reset after restart.","monitoring.sessionPressure":"Session Pressure","monitoring.sessionPressureHint":"Find long-running, waiting, and process-unlinked live sessions.","monitoring.botRuntime":"Bot Runtime","monitoring.botRuntimeHint":"Aggregate daemon status, session pressure, and resource usage by bot.","monitoring.sampleHealth":"Sample Health","monitoring.sampleAge":"Data age","monitoring.sample.fresh":"Fresh","monitoring.sample.stale":"Stale","monitoring.sample.unsupported":"Unsupported","monitoring.sample.unknown":"Unknown","monitoring.health.ok":"Healthy","monitoring.health.warn":"Watch","monitoring.health.danger":"High Pressure","monitoring.health.unknown":"Unknown","monitoring.daemonHealth":"Daemon Online","monitoring.sessionHealth":"Session Health","monitoring.offline":"Offline","monitoring.working":"Working","monitoring.starting":"Starting","monitoring.waiting":"Waiting","monitoring.idle":"Idle","monitoring.unknown":"Unknown","monitoring.statusDistribution":"Status Distribution","monitoring.longestRunning":"Longest Running","monitoring.longestWaiting":"Longest Waiting","monitoring.unattributedSessions":"No Linked Process","monitoring.unattributedHint":"These live sessions have no reliable PID link, so session-level resource usage cannot be calculated.","monitoring.unsupported":"Resource sampling is unavailable on this platform.","monitoring.unsupportedKicker":"Linux only","monitoring.unsupportedTitle":"Resource sampling requires Linux","monitoring.unsupportedHint":"This platform has no readable /proc data; runtime health remains available.","monitoring.unsupportedRuntimeOk":"Runtime health available","monitoring.unsupportedResourceOnly":"CPU / Memory / RSS paused","monitoring.hostCpu":"CPU","monitoring.hostMemory":"Memory","monitoring.botmuxRss":"Botmux memory","monitoring.botmuxSelf":"Self","monitoring.botmuxDaemon":"daemon","monitoring.botmuxWorker":"worker","monitoring.botmuxCli":"External CLI","monitoring.rssHelpLabel":"About this memory number","monitoring.rssHelp":`Memory uses PSS (Proportional Set Size): shared pages are divided by the number of processes sharing them, so summing across processes does not double-count the shared Node runtime / libs the way RSS would (falls back to RSS when smaps_rollup is unavailable).
|
|
@@ -43,7 +43,7 @@ oc_yyy`,"botDefaults.substituteTargetsPlaceholder":`alice@example.com
|
|
|
43
43
|
ou_xxxx (open_id / union_id also accepted)`,"botDefaults.substituteTargets":"Substitute targets","botDefaults.substituteTargetsHelp":"Each row is one substitute target. Enter an email to resolve it to an Open ID on save, or select Open ID, User ID, or Union ID. Emails that cannot be resolved are flagged.","botDefaults.substituteTargetType":"Identifier type","botDefaults.substituteTargetEmail":"Email","botDefaults.substituteTargetOpenId":"Open ID","botDefaults.substituteTargetUserId":"User ID","botDefaults.substituteTargetUnionId":"Union ID","botDefaults.substituteTargetIdPlaceholder":"Enter a Lark user identifier or email","botDefaults.substituteTargetName":"Display name","botDefaults.substituteTargetNamePlaceholder":"Display name (optional)","botDefaults.substituteTargetAdd":"Add substitute target","botDefaults.substituteTargetRemove":"Remove substitute target","botDefaults.substituteTargetsInvalid":"Add at least one valid substitute target before enabling; emails must resolve to an Open ID","botDefaults.substituteTargetsRequired":"Enabling the substitute trigger needs at least one target that resolves to an open_id","botDefaults.substituteResolving":"Resolving\u2026","botDefaults.substituteUnresolved":"unresolved","botDefaults.substituteReasonCrossAppOpenId":"This Open ID belongs to another app; use email or Union ID instead","botDefaults.substituteReasonNotVisible":"This user is outside the app's contact visibility scope; adjust app visibility or use email","botDefaults.substituteReasonResolveFailed":"Resolution failed; check network or contact permissions","botDefaults.substituteReasonUnresolvable":"Unable to resolve this identifier; check spelling or use email","botDefaults.substituteSave":"Save substitute mode","botDefaults.substituteOff":"Turn off global substitute config","botDefaults.sectionGrant":"Authorization & Quota","botDefaults.autoGrantCard":"Auto grant card for blocked @mentions","botDefaults.autoGrantCardHelp":"When an unauthorized user or external bot @mentions this bot, send a /grant request card to the owner. Off still blocks, but silently.","botDefaults.restrictGrant":"Restrict grantees to plain conversation","botDefaults.restrictGrantHelp":"Restricts /grant users to plain conversation. Botmux commands, passthrough commands, CLI-native commands, and workflow commands are blocked; the owner is exempt.","botDefaults.quotaDefault":"Default message quota","botDefaults.quotaPlaceholder":"Empty = no default quota","botDefaults.quotaHelp":"Default quota for bare /grant @user. Saving empty stops assigning a default; existing quotas and explicit /grant @user N are unchanged. Authorization is revoked when quota runs out.","botDefaults.quotaSave":"Save quota","botDefaults.quotaInvalid":"Quota must be a positive integer","botDefaults.quotaStateOff":"Current: no default quota","botDefaults.quotaStateOn":"Current: {count} per grantee","botDefaults.sectionSessionCap":"Resident session limit","botDefaults.maxLiveWorkers":"Max resident sessions","botDefaults.maxLiveWorkersPlaceholder":"Empty = default 30","botDefaults.maxLiveWorkersUsage":"Resident {resident}/{cap} \xB7 dormant {dormant} \xB7 total {logical}","botDefaults.maxLiveWorkersHelp":"Maximum sessions this bot keeps resident in memory. Beyond it, the least-recently-used session is suspended: its background process and CLI exit to reclaim memory, while the conversation remains resumable. The next message cold-restores context from disk, usually within a few seconds. Empty = default 30; enter a number for a per-bot override. A session producing an answer is never interrupted; adopted external terminals and non-resumable sessions are exempt.","botDefaults.maxLiveWorkersSave":"Save limit","botDefaults.maxLiveWorkersOff":"Reset to default","botDefaults.maxLiveWorkersInvalid":"Limit must be a positive integer","botDefaults.maxLiveWorkersStateDefault":"Current: 30 resident sessions by default","botDefaults.maxLiveWorkersStateOn":"Current: up to {count} resident sessions","botDefaults.sectionRuntimeEnv":"Startup environment","botDefaults.sectionStartupCommands":"Startup commands","botDefaults.startupCommandsHelp":"CLI commands sent automatically after launch and before the first message. Use commas or new lines; replayed on every new or resumed session. Native CLI sessions only.","botDefaults.startupCommandsPlaceholder":"One per line, e.g. /effort ultracode","botDefaults.startupCommandsSave":"Save startup commands","botDefaults.sectionLaunchShell":"Launch shell","botDefaults.launchShellHelp":"Shell used to launch the CLI, such as zsh or /usr/bin/zsh, overriding the daemon $SHELL. Use it to avoid login-shell rc redirection issues; PATH must still be available in that shell. Applies next session.","botDefaults.launchShellPlaceholder":"e.g. zsh or /usr/bin/zsh; empty = $SHELL","botDefaults.launchShellSave":"Save launch shell","botDefaults.sectionEnv":"Environment variables","botDefaults.envHelp":"JSON environment variables injected into this bot's CLI process. Values may be string, number, or boolean; reserved BOTMUX_ / LARK_APP_ keys are ignored. Applies next session and is stored in plaintext in bots.json.","botDefaults.envPlaceholder":`{
|
|
44
44
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
|
45
45
|
"ANTHROPIC_AUTH_TOKEN": "your GLM Coding Plan key"
|
|
46
|
-
}`,"botDefaults.envSave":"Save environment variables","botDefaults.sectionRiff":"Riff backend config","botDefaults.riffHelp":"Connection parameters for the riff
|
|
46
|
+
}`,"botDefaults.envSave":"Save environment variables","botDefaults.sectionRiff":"Riff backend config","botDefaults.riffHelp":"Connection parameters for the riff service; applies next session. Agent is fixed to codex (other runners were retired server-side). Auth: the JWT is auto-read from the local ByteCloud keychain (log in once with kaboo-cli / aiden-cli / cjadk), or set via the JWT env var field. Repo: the session workingDir git repo + current branch are reused automatically (repo picker / default dir / oncall dir included) \u2014 no separate repo config.","botDefaults.riffBaseUrl":"Base URL","botDefaults.riffBaseUrlPlaceholder":"https://riff.example.com","botDefaults.riffReasoningEffort":"Reasoning effort","botDefaults.riffReasoningEffortDefault":"Default (medium)","botDefaults.riffReasoningEffortHelp":"codex reasoning strength (model_reasoning_effort), written into the sandbox config. Empty follows the riff default (medium); xhigh is strongest but slower/costlier.","botDefaults.riffModel":"Model","botDefaults.riffModelPlaceholder":"(optional) leave empty to use riff default model (recommended)","botDefaults.riffModelHelp":"Model name for riff tasks. Empty uses the riff default (gpt-5.5); only values in the riff-supported catalog are accepted \u2014 an invalid name fails task creation and echoes the full list.","botDefaults.riffJwtEnv":"JWT env var","botDefaults.riffJwtEnvPlaceholder":"RIFF_JWT","botDefaults.riffSystemPrompt":"System Prompt","botDefaults.riffSystemPromptPlaceholder":"(optional) system prompt injected into riff tasks; falls back to built-in default if empty","botDefaults.riffSetupCommands":"Additional setup commands","botDefaults.riffSetupCommandsPlaceholder":"(optional) one shell command per line, run before the agent starts. botmux is installed automatically \u2014 no need to add it here.","botDefaults.riffJwtEnvHelp":"Name of the env var holding the JWT token. botmux reads the token from this var at startup to call the riff API; leave empty to auto-fetch from the ByteCloud keychain.","botDefaults.riffCliPersistFailed":"Switching to Riff was not saved (CLI selection persist failed) \u2014 please retry","botDefaults.riffSave":"Save Riff config","nav.roles":"Role Management","nav.groupRoles":"Group Roles","nav.roleProfiles":"Profiles","roles.title":"Role Management","roleProfiles.title":"Profiles","roles.search":"Search group / bot / ID","roles.refresh":"Refresh","roles.selectHint":"\u2190 Expand a group and select a bot to edit its role","roles.editorPlaceholder":`Enter role description, e.g.:
|
|
47
47
|
You are a code reviewer for this group...`,"roles.injectModeLabel":"Injection","roles.injectModeEvery":"Every turn (default)","roles.injectModeOnce":"Only once (first turn)","roles.injectModeHint":'"Only once" injects the role at session start/rebuild and never re-sends it, saving tokens; saved instantly on change',"roles.configured":"Configured","roles.unconfigured":"None","roles.noChats":"No groups","roles.preview":"Preview","roles.previewEmpty":"(empty)","roles.saved":"Saved","roles.delete":"Delete","roles.save":"Save","roles.confirmDelete":"Delete this bot's role config for this group?","roles.botsWithRoles":"bots configured","roles.emptyError":"Role content cannot be empty","roles.saveFailed":"Save failed, please retry","roles.tabGroups":"By Group","roles.tabProfiles":"Profiles","roles.profileIdPlaceholder":"profile id, e.g. collab-main","roles.profileIdInvalid":"Profile id may contain letters, numbers, dots, underscores, and hyphens only; max 64; cannot be . or ..","roles.openProfile":"Open","roles.profileSearch":"Search profile","roles.profileSelectHint":"\u2190 Select or enter a profile to edit","roles.profileEmpty":"No Profiles","roles.profileEntries":"entries","roles.profileMissing":"Missing","roles.profileRuntimeHint":"Profiles are reusable suites; applying one writes a group role, not a new runtime layer.","roles.profileBots":"Bot Entries","roles.profileEditorPlaceholder":"Enter this bot's Markdown role for this profile...","roles.saveEntry":"Save Entry","roles.profileBotSelectHint":"Select a bot to edit its entry in this profile","roles.applyToGroup":"Apply To Group","roles.applyForce":"Overwrite existing group roles","roles.previewApply":"Preview Apply","roles.applyProfile":"Apply Profile","roles.applyPickBots":"Select at least one bot","roles.applyWouldRefuse":"Would refuse (group role exists)","roles.applyPreviewOk":"Can apply","roles.applyOk":"Applied","roles.applyFailed":"Failed","roles.confirmDeleteProfileEntry":"Delete this bot entry from the profile?","common.none":"None","common.loading":"Loading\u2026","common.unknown":"Unknown","common.now":"now","common.never":"never","common.all":"All","common.dropdownSearch":"Search\u2026","common.dropdownSearchEmpty":"No matches","nav.workflows":"Workflows","workflow.v3.cancel":"Cancel run","workflow.v3.cancelTitle":"Cancel this v3 workflow run","workflow.v3.cancelTerminal":"Run finished","workflow.v3.cancelling":"Cancelling\u2026","workflow.v3.cancelConfirm":`Cancel v3 workflow run {runId}?
|
|
48
48
|
|
|
49
49
|
Completed nodes remain committed; running nodes will be interrupted.`,"workflow.v3.cancelPending":"The cancel request is durable; waiting for running nodes to drain.","workflow.v3.cancelled":"Run cancelled.","workflow.v3.cancelAlreadyTerminal":"The run reached a terminal state first; no cancel was submitted.","workflow.v3.cancelAuthRequired":"Dashboard write access is required. Run `botmux dashboard` in a terminal, open its one-time link, then retry.","workflow.v3.cancelFailed":"Cancel failed: {error}"},G={zh:pe,en:me};function j(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();return e==="zh"||e.startsWith("zh-")?"zh":e==="en"||e.startsWith("en-")?"en":null}function be(t=[]){for(let e of t){let s=j(e);if(s)return s}return"zh"}function w(t){return(e,s)=>{let o=G[t][e]??G.zh[e]??e;return s?o.replace(/\{(\w+)\}/g,(n,i)=>{let a=s[i];return a==null?`{${i}}`:String(a)}):o}}function q(t,e){return(t?j(t.getItem(x)):null)??be(e)}var I="botmux.dashboard.theme",z="botmux.dashboard.sessions.view",Y="botmux.dashboard.sessions.showUnknownChats";function fe(t){return t==="system"||t==="light"||t==="dark"?t:null}function ve(t){return t==="kanban"||t==="board"||t==="table"?t:null}function K(t,e){return t==="system"?e?"dark":"light":t}function J(t){return fe(t?.getItem(I))??"dark"}function qe(t){return ve(t?.getItem(z))??"board"}function ze(t){try{let e=t?.getItem(Y);return e==null?!0:e==="1"}catch{return!0}}var V="botmux.dashboard.sessions.boardOrder",p=["needs-you","starting","working","idle"];function ke(t){if(!Array.isArray(t)||t.length!==p.length)return null;let e=new Set(t);if(e.size!==t.length)return null;for(let s of p)if(!e.has(s))return null;return t.slice()}function Ye(t){try{let e=t?.getItem(V);return e?ke(JSON.parse(e))??[...p]:[...p]}catch{return[...p]}}function Ke(t,e){try{t?.setItem(V,JSON.stringify(e))}catch{}}function Je(t,e){try{t?.setItem(z,e)}catch{}}function Ve(t,e){try{t?.setItem(Y,e?"1":"0")}catch{}}var $="botmux.dashboard.sessions.createKeepOpen";function $e(t){try{return t?.getItem($)==="1"}catch{return!1}}function Qe(t,e){try{t?.setItem($,e?"1":"0")}catch{}}var Q="botmux.dashboard.sessions.kanbanGroupBy",Ze="botmux.dashboard.sessions.kanbanTeam";function ye(t){return t==="flow"||t==="team"||t==="bot"?t:null}function Xe(t){return ye(t?.getItem(Q))??"flow"}function et(t,e){try{t?.setItem(Q,e)}catch{}}var we=["default","cyber","fallout"],O="botmux.dashboard.skin";function Se(t){return typeof t=="string"&&we.includes(t)?t:null}function Z(t){return Se(t?.getItem(O))??"default"}var De="\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF830123456789\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E$#%&@*+=<>/\\",X=["186 100% 60%","56 97% 60%","330 100% 64%","150 80% 58%"],H=[{key:"shake",dur:280},{key:"rgb",dur:340},{key:"tear",dur:400},{key:"invert",dur:220},{key:"slice",dur:320},{key:"blackout",dur:260}],ee=["ESTABLISHING NETLINK","BYPASSING ICE","DECRYPTING DATAFLOW","SYNCING BOTMUX TELEMETRY","ACCESS GRANTED"],te="0123456789ABCDEF#<>*/=+\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C",Ce=3200,m=[],u=0,S=0;function _(){return typeof window<"u"&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function M(t,e){let s="";for(let o=0;o<t;o++)s+=e[Math.floor(Math.random()*e.length)];return s}function Le(t){let e=document.createElement("div");e.className="cyber-rain";let s=Math.max(10,Math.min(26,Math.round(window.innerWidth/70)));for(let o=0;o<s;o++){let n=document.createElement("span");n.className="cyber-rain-col",n.textContent=M(28+Math.floor(Math.random()*22),De);let i=X[Math.floor(Math.random()*X.length)];n.style.cssText=`left:${(o+.5)/s*100}%;--rc:${i};--sz:${10+Math.floor(Math.random()*9)}px;--op:${(.25+Math.random()*.45).toFixed(2)};--dur:${(6+Math.random()*9).toFixed(1)}s;--delay:${(-Math.random()*12).toFixed(1)}s;`,e.appendChild(n)}t.appendChild(e)}function Te(){if(_())return;let t=document.body,e=()=>{let s=H[Math.floor(Math.random()*H.length)],o=`cp-fx-${s.key}`;t.classList.add(o),m.push(window.setTimeout(()=>t.classList.remove(o),s.dur)),m.push(window.setTimeout(e,2400+Math.random()*4200))};m.push(window.setTimeout(e,1800+Math.random()*2600))}function Pe(){m.forEach(t=>window.clearTimeout(t)),m=[];for(let t of H)document.body.classList.remove(`cp-fx-${t.key}`)}function Re(){if(_()||document.getElementById("cyber-boot"))return;let t=document.createElement("div");t.id="cyber-boot",t.className="cyber-boot",t.setAttribute("aria-hidden","true"),t.innerHTML='<div class="cyber-boot-grid"></div><div class="cyber-loader"><div class="cyber-loader-frame"><div class="cyber-loader-head"><span>KIROSHI NETLINK</span><span class="cyber-loader-jp">\u4FB5\u5165\u4E2D</span></div><div class="cyber-loader-line"><span class="cyber-loader-prompt">></span><span class="cyber-loader-text"></span><span class="cyber-loader-cursor">_</span></div><div class="cyber-loader-stream"></div></div></div>',document.body.appendChild(t);let e=t.querySelector(".cyber-loader-text"),s=t.querySelector(".cyber-loader-stream"),o=0,n=0,i=0;u=window.setInterval(()=>{let a=ee[o];e&&(n<a.length?(n+=1,e.textContent=a.slice(0,n)+M(a.length-n,te),e.classList.remove("done")):i<16?(i+=1,e.textContent=a,e.classList.add("done")):(o=(o+1)%ee.length,n=0,i=0)),s&&(s.textContent=M(26,te))},50),S=window.setTimeout(()=>{window.clearInterval(u),u=0,t.remove()},Ce)}function xe(){u&&(window.clearInterval(u),u=0),S&&(window.clearTimeout(S),S=0),document.getElementById("cyber-boot")?.remove()}var Ie=320,se=16,b=!0,c=0,A=0,D=!1,C=[],E=[];function Oe(){if(D)return;D=!0,b=!1,c=0;let t=_(),e="";for(let o=0;o<se;o++){let n=o%3===0?"186 100% 52%":o%3===1?"330 100% 58%":"56 97% 52%",i=(o%2===0?1:-1)*(8+o%5*7);e+=`<span class="cyber-breach-shard" style="top:${o/se*100}%;height:${2+o%4*3}%;--shift:${i}px;--delay:${o%8*.09}s;--dur:${(.36+o%5*.12).toFixed(2)}s;--hue:${n}"></span>`}let s=document.createElement("div");s.id="cyber-breach",s.className="cyber-breach",s.setAttribute("aria-hidden","true"),s.innerHTML=`<span class="cyber-breach-flash"></span><span class="cyber-breach-grid"></span><div class="cyber-breach-shards">${e}</div><div class="cyber-breach-banner"><span class="cyber-breach-tag">// BREACH PROTOCOL \u2014 SYSTEM OVERRIDE</span><span class="cyber-breach-caption" data-text="SYSTEM BREACH">SYSTEM BREACH</span><span class="cyber-breach-sub" data-text="NETWATCH OVERRIDE ENGAGED">NETWATCH OVERRIDE ENGAGED</span></div>`,document.body.appendChild(s),t||document.body.classList.add("cyber-breach-quake"),C.push(window.setTimeout(()=>document.body.classList.remove("cyber-breach-quake"),760)),C.push(window.setTimeout(()=>{s.remove(),D=!1},t?2600:4200))}function Ae(){b=!0,c=0;let t=document.documentElement,e=()=>t.scrollHeight-(window.innerHeight+window.scrollY)<=4,s=r=>{r<=0||!e()||(c+=r,c>Ie&&b&&Oe())},o=r=>s(r.deltaY),n=r=>{A=r.touches[0]?.clientY??0},i=r=>{let g=r.touches[0]?.clientY??0,de=A-g;A=g,s(de)},a=()=>{e()||(c=0,b=!0)},l=(r,g)=>{window.addEventListener(r,g,{passive:!0}),E.push([r,g])};l("wheel",o),l("touchstart",n),l("touchmove",i),l("scroll",a)}function He(){for(let[t,e]of E)window.removeEventListener(t,e);E=[],C.forEach(t=>window.clearTimeout(t)),C=[],document.body.classList.remove("cyber-breach-quake"),document.getElementById("cyber-breach")?.remove(),D=!1,b=!0,c=0}function oe(t,e=!1){if(!(typeof document>"u")){if(!t){document.getElementById("cyber-fx")?.remove(),document.getElementById("cyber-hud")?.remove(),document.getElementById("cyber-glitch")?.remove(),Pe(),xe(),He();return}if(!document.getElementById("cyber-fx")){let s=document.createElement("div");s.id="cyber-fx",s.className="cyber-fx",s.setAttribute("aria-hidden","true"),s.innerHTML='<div class="cyber-fx-grid"></div><div class="cyber-fx-scan"></div><span class="cyber-flicker"></span><span class="cyber-rollline"></span>',Le(s),document.body.appendChild(s);let o=document.createElement("div");o.id="cyber-hud",o.className="cyber-hud",o.setAttribute("aria-hidden","true"),o.innerHTML='<span class="cyber-hud-corner tl"></span><span class="cyber-hud-corner tr"></span><span class="cyber-hud-corner bl"></span><span class="cyber-hud-corner br"></span><span class="cyber-hud-tag">NIGHT CITY // NETWATCH</span>',document.body.appendChild(o);let n=document.createElement("div");n.id="cyber-glitch",n.className="cyber-glitch",n.setAttribute("aria-hidden","true"),document.body.appendChild(n),Te(),Ae()}e&&Re()}}var B=class{locale="zh";themeMode="system";resolvedTheme="light";skin="default";authed=!0;publicReadOnly=!1;listeners=new Set;translate=w(this.locale);mediaQuery=null;init(){let e=typeof window<"u"?window:void 0;this.locale=q(e?.localStorage,Ee()),this.translate=w(this.locale),this.themeMode=J(e?.localStorage),this.skin=Z(e?.localStorage),this.mediaQuery=e?.matchMedia?.("(prefers-color-scheme: dark)")??null,this.mediaQuery?.addEventListener("change",()=>{this.applyTheme(),this.emit()}),this.applyTheme(),this.applySkin(),this.applyLocale()}t(e,s){return this.translate(e,s)}setLocale(e){this.locale!==e&&(this.locale=e,this.translate=w(e),window.localStorage.setItem(x,e),this.applyLocale(),this.emit())}get theme(){return this.skin==="default"?this.themeMode:this.skin}setTheme(e){let s=e==="system"||e==="light"||e==="dark",o=s?"default":e,n=o!==this.skin;s&&this.themeMode!==e&&(this.themeMode=e,window.localStorage.setItem(I,this.themeMode)),n&&(this.skin=o,window.localStorage.setItem(O,this.skin)),this.applyTheme(),this.applySkin(n),this.emit()}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(){for(let e of this.listeners)e()}applyTheme(){this.resolvedTheme=K(this.themeMode,!!this.mediaQuery?.matches);let e=this.skin==="default"?this.resolvedTheme:Me[this.skin];document.documentElement.dataset.theme=e,document.documentElement.dataset.themeMode=this.themeMode}applySkin(e=!1){document.documentElement.dataset.skin=this.skin,oe(this.skin==="cyber",e)}applyLocale(){document.documentElement.lang=this.locale==="zh"?"zh-CN":"en"}},Me={default:"light",cyber:"dark",fallout:"dark"};function Ee(){return typeof navigator>"u"?[]:navigator.languages?.length?navigator.languages:[navigator.language].filter(Boolean)}var _e=new B;function f(t,e){return _e.t(t,e)}function ie(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function rt(t){if(!t)return"-";let e=Date.now()-t;return e<6e4?f("common.now"):e<36e5?Math.floor(e/6e4)+"m":e<864e5?Math.floor(e/36e5)+"h":Math.floor(e/864e5)+"d"}var ne=[{c1:"#5be3ff",c2:"#4f8bff"},{c1:"#b89bff",c2:"#6b4df0"},{c1:"#7ce0c3",c2:"#2e9e8f"},{c1:"#8fb4ff",c2:"#3b62d8"},{c1:"#ffd28f",c2:"#d8783b"},{c1:"#7df0a8",c2:"#1f9e63"},{c1:"#9fd0ff",c2:"#4878c8"},{c1:"#ff9fb8",c2:"#d84a78"}];function ae(t){let e=0,s=String(t??"");for(let i=0;i<s.length;i++)e=e*31+s.charCodeAt(i)>>>0;let{c1:o,c2:n}=ne[e%ne.length];return`--c1:${o};--c2:${n}`}var v=new Map,k=new Map;function Ne(t,e){return e?v.get(e):t?k.get(String(t)):void 0}function lt(t){let e=t.name??"",s=t.avatarUrl??Ne(t.name,t.larkAppId),o=t.size==="sm"?" orb-avatar-sm":"",n=s?" orb-has-img":"",i=t.dot?`<i class="orb-dot orb-dot-${t.dot}"></i>`:"",a=s?`<img class="orb-img" src="${ie(s)}" alt="" decoding="async" referrerpolicy="no-referrer" onerror="this.closest('.orb-avatar')?.classList.remove('orb-has-img');this.remove()"/>`:"";return`<span class="orb-avatar${o}${n}" style="${ae(e)}" aria-hidden="true">${a}${i}</span>`}function Be(t){return t?T.get(t):void 0}function dt(t){let e=t.name??t.chatId??"",s=t.avatarUrl??Be(t.chatId),o=t.size==="sm"?" orb-avatar-sm":"",n=s?" orb-has-img":"",i=s?`<img class="orb-img" src="${ie(s)}" alt="" decoding="async" referrerpolicy="no-referrer" onerror="this.closest('.orb-avatar')?.classList.remove('orb-has-img');this.remove()"/>`:"";return`<span class="orb-avatar orb-square${o}${n}" style="${ae(e)}" aria-hidden="true">${i}</span>`}var y=new Map,L=new Map,T=new Map,N=null,re="botmux.avatarCache.v1";function Fe(){try{let t=typeof window<"u"?window.localStorage.getItem(re):null;if(!t)return;let e=JSON.parse(t);for(let[s,o]of Object.entries(e.botByAppId??{}))v.set(s,o);for(let[s,o]of Object.entries(e.botByName??{}))k.set(s,o);for(let[s,o]of Object.entries(e.chatById??{}))T.set(s,o);for(let[s,o]of Object.entries(e.nameByAppId??{}))y.set(s,o);for(let[s,o]of Object.entries(e.chatNameById??{}))L.set(s,o)}catch{}}function le(){try{if(typeof window>"u")return;window.localStorage.setItem(re,JSON.stringify({botByAppId:Object.fromEntries(v),botByName:Object.fromEntries(k),chatById:Object.fromEntries(T),nameByAppId:Object.fromEntries(y),chatNameById:Object.fromEntries(L)}))}catch{}}Fe();function ct(t,e,s){!t||!s||(v.set(t,s),e&&k.set(String(e),s),le())}function ut(){return N??=(async()=>{try{let t=await W();for(let e of t.bots??[])e.larkAppId&&e.botName&&e.botName!==e.larkAppId&&y.set(e.larkAppId,String(e.botName)),e.botAvatarUrl&&(e.larkAppId&&v.set(e.larkAppId,String(e.botAvatarUrl)),e.botName&&k.set(String(e.botName),String(e.botAvatarUrl)));for(let e of t.chats??[])e.chatId&&e.name&&L.set(e.chatId,String(e.name)),e.chatId&&e.avatar&&T.set(e.chatId,String(e.avatar));le()}catch{N=null}})(),N}function gt(t){return t?y.get(t):void 0}function ht(t){let e=t.larkAppId?y.get(t.larkAppId):void 0;return e||(t.botName&&t.botName!==t.larkAppId?String(t.botName):String(t.botName??t.larkAppId??"-"))}function pt(t){let e=String(t.chatDisplayName??"").trim();return e||t.chatId&&L.get(t.chatId)||null}function mt(t){let e=String(t??"");return e.replace(/^(?:@\S+\s*)+/,"").trim()||e}function bt(t){return t.status==="closed"?null:t.agentAttention?.reason?t.agentAttention.reason:t.agentAttention?f("sessions.board.signalAgent"):t.pendingRepo?f("sessions.board.signalRepo"):t.tuiPromptActive?f("sessions.board.signalPrompt"):t.status==="limited"?f("sessions.board.signalLimited"):null}function ft(t){let e=Number(t.agentAttention?.at??t.lastMessageAt??0);if(Number.isFinite(e))return e;let s=Number(t.lastMessageAt??0);return Number.isFinite(s)?s:0}export{d as a,Ue as b,ce as c,W as d,j as e,ve as f,qe as g,ze as h,Ye as i,Ke as j,Je as k,Ve as l,$e as m,Qe as n,Ze as o,Xe as p,et as q,_e as r,f as s,ie as t,rt as u,ae as v,lt as w,Be as x,dt as y,ct as z,ut as A,gt as B,ht as C,pt as D,mt as E,bt as F,ft as G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as i,F as c,d as r}from"./chunk-
|
|
1
|
+
import{B as i,F as c,d as r}from"./chunk-4QTBR7UF.js";var l={chats:[],bots:[]};async function A(){try{l=await r()}catch{}}var u=new Set(["working","analyzing","active","starting"]);function m(d){let s=new Map,e=t=>{let o=s.get(t);return o||(o={botName:t,larkAppId:t,cliId:"unknown",online:!1,sessions:[],active:[],busy:[],attention:[],lastActiveAt:0},s.set(t,o)),o};for(let t of l.bots??[]){let o=e(t.larkAppId??t.botName??"-");o.online=!0,t.botName&&(o.botName=t.botName),t.botAvatarUrl&&(o.botAvatarUrl=t.botAvatarUrl),t.cliId&&(o.cliId=t.cliId)}let p=[...d].sort((t,o)=>+(t.status==="closed")-+(o.status==="closed"));for(let t of p){let o=t.larkAppId??t.botName??"-";if(t.status==="closed"&&!s.has(o))continue;let a=e(o);t.botName&&(a.botName===a.larkAppId||!a.botName)&&(a.botName=t.botName),a.sessions.push(t),t.cliId&&a.cliId==="unknown"&&(a.cliId=t.cliId),a.lastActiveAt=Math.max(a.lastActiveAt,Number(t.lastMessageAt??0)),t.status!=="closed"&&(a.active.push(t),u.has(t.status)&&a.busy.push(t),c(t)&&a.attention.push(t))}for(let t of s.values())if(t.botName===t.larkAppId){let o=i(t.larkAppId);o&&(t.botName=o)}return[...s.values()].sort((t,o)=>{let a=n=>n.attention.length?0:n.busy.length?1:n.online||n.active.length?2:3;return a(t)!==a(o)?a(t)-a(o):o.lastActiveAt-t.lastActiveAt})}export{A as a,m as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n,r as s,s as i}from"./chunk-
|
|
1
|
+
import{a as n,r as s,s as i}from"./chunk-4QTBR7UF.js";import{a as l}from"./chunk-5THX4DI2.js";import{c as S}from"./chunk-7SZRL6FY.js";var e=S(l(),1);function f(o){return n.on(o)}function m(o){let u=(0,e.useRef)(o),r=(0,e.useRef)(null);u.current=o;let a=()=>{let t=n.getSnapshot();if(r.current&&r.current.version===t.version)return r.current.value;let c=u.current(t);return r.current={version:t.version,value:c},c};return(0,e.useSyncExternalStore)(f,a,a)}function h(o){return s.on(o)}function p(){return s.locale}function v(){return(0,e.useSyncExternalStore)(h,p,p)}function T(){return v(),i}export{m as a,T as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as T}from"./chunk-I35DXGM4.js";import{s as t}from"./chunk-3H6MVXXU.js";import{a as Z,d as B}from"./chunk-5THX4DI2.js";import{c as E}from"./chunk-7SZRL6FY.js";var r=E(Z(),1);var e=E(B(),1),nn="botmux:open-bot-onboarding",L={id:"claude-code",label:"Claude"},G="glm-5.1";function x(){return{options:[L],ttadkModelDefault:G,ttadkModelSuggestions:[],suggestedAppName:"botmux-0",webSession:{status:"checking"}}}function Q(){return{appName:"",cliId:L.id,dirMode:"fixed",workingDir:"~",model:""}}function en(n,o){return n||o==="checking"}function q(n){return n instanceof Error?n.message:String(n)}function X(n){return n.status==="completed"||n.status==="failed"||n.status==="needs_owner"}function N(n){return n==="login_failed"||n==="invalid_session"||n==="identity_unavailable"||n==="session_changed"}function tn(n){return n.status==="waiting_for_scan"?n.registrationMode==="compat"?t("botOnboarding.waitingCompat"):t("botOnboarding.waiting",{name:n.appName??""}):n.status==="verifying"?t("botOnboarding.verifying"):n.status==="configuring_permissions"?n.permissionStatusMsg?`${t("botOnboarding.configuringPermissions")} ${n.permissionStatusMsg}`:t("botOnboarding.configuringPermissions"):n.status==="waiting_for_platform_scan"?t("botOnboarding.platformScanHint"):n.status==="needs_owner"?t("botOnboarding.needsOwnerTitle"):n.status==="completed"?t("botOnboarding.completed",{name:n.appName??t("botOnboarding.botFallback")}):n.status==="failed"?n.appId?t("botOnboarding.partialFailureTitle"):n.error==="qr_expired"?t("botOnboarding.qrExpiredTitle"):N(n.error)?t("botOnboarding.authIncompleteTitle"):t("botOnboarding.createFailedTitle"):t("botOnboarding.starting")}async function on(){try{let n=await fetch("/api/cli-options"),o=await n.json();if(n.ok&&Array.isArray(o?.options)){let a=typeof o.ttadkModelDefault=="string"&&o.ttadkModelDefault.trim()?o.ttadkModelDefault.trim():G,l=Array.isArray(o.ttadkModelSuggestions)?o.ttadkModelSuggestions.filter(f=>typeof f=="string"):[],d=typeof o.suggestedAppName=="string"&&o.suggestedAppName.trim()?o.suggestedAppName.trim():"botmux-0",b=o?.webSession?.identity,c=o?.webSession?.status==="ready"&&typeof b?.userId=="string"&&typeof b?.userName=="string"&&typeof b?.tenantId=="string"&&typeof b?.tenantName=="string"?{status:"ready",source:typeof o.webSession.source=="string"?o.webSession.source:"botmux_cache",identity:{userId:b.userId,userName:b.userName,...typeof b.email=="string"?{email:b.email}:{},tenantId:b.tenantId,tenantName:b.tenantName}}:{status:"scan_required",...typeof o?.webSession?.reason=="string"?{reason:o.webSession.reason}:{}};return{options:o.options,ttadkModelDefault:a,ttadkModelSuggestions:l,suggestedAppName:d,webSession:c}}}catch{}return{...x(),webSession:{status:"scan_required"}}}function K(n,o,a){let l=a.options.find(f=>f.id===o),d=l?.gateway==="ttadk",b=d&&l?.acceptsModel!==!1,c=n.model;return d&&!b?c="":b&&!c.trim()?c=a.ttadkModelDefault:!b&&c.trim()===a.ttadkModelDefault&&(c=""),{...n,cliId:o,model:c}}function an(n,o){let a=o.options.some(l=>l.id===n.cliId)?n.cliId:o.options[0]?.id??L.id;return K({...n},a,o)}async function gn(){window.dispatchEvent(new Event(nn))}function rn(n){let{job:o}=n;if(o.status!=="completed"&&o.status!=="needs_owner"||!o.permission)return null;let a=o.permission;if(a.ok){let d=[t("botOnboarding.permissionOk",{count:a.scopeCount??0})];return a.skippedScopeCount&&a.skippedScopeCount>0&&d.push(t("botOnboarding.permissionSkipped",{count:a.skippedScopeCount})),a.versionId&&d.push(t("botOnboarding.permissionVersion",{version:a.versionId})),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"hint-ok",children:d.join(" ")}),a.scopeWarning?(0,e.jsx)("p",{className:"hint-warn",children:a.scopeWarning}):null]})}let l=o.remainingSteps??[];return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("p",{className:"hint-warn",children:[t("botOnboarding.permissionManual"),a.message?`\uFF08${a.message}\uFF09`:""]}),l.length?(0,e.jsx)("ol",{className:"onboarding-steps",children:l.map(d=>(0,e.jsx)("li",{children:(0,e.jsx)("a",{href:d.url,target:"_blank",rel:"noopener",children:d.title})},`${d.title}:${d.url}`))}):null]})}function sn(n){let{job:o}=n;return o.appId?(0,e.jsxs)("p",{className:"onboarding-meta",children:[(0,e.jsx)("b",{children:"App ID:"})," ",(0,e.jsx)("code",{children:o.appId}),o.appName?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsxs)("b",{children:[t("botOnboarding.appNameLabel"),":"]})," ",(0,e.jsx)("code",{children:o.appName})]}):null,o.cliId?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsx)("b",{children:"CLI:"})," ",(0,e.jsx)("code",{children:o.cliId})]}):null,o.workingDir?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsxs)("b",{children:[t("botOnboarding.metaDir"),":"]})," ",(0,e.jsx)("code",{children:o.workingDir})]}):null]}):null}function W(n){return(0,e.jsxs)("div",{className:"qr-card",children:[(0,e.jsx)("img",{className:"qr-image",src:n.dataUrl,alt:n.alt}),n.link?(0,e.jsx)("a",{className:"onboarding-link",href:n.link,target:"_blank",rel:"noopener",children:t("botOnboarding.openLink")}):null]})}function z(n,o){return n.find(a=>a.value===o)?.label??o}function ln(n){let{job:o,ownerError:a}=n.view;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:`onboarding-status status-${o.status}`,children:tn(o)}),o.status==="waiting_for_scan"&&o.qrDataUrl?(0,e.jsx)(W,{dataUrl:o.qrDataUrl,alt:t("botOnboarding.qrAlt"),link:o.qrUrl}):null,o.status==="waiting_for_platform_scan"&&o.platformQrDataUrl?(0,e.jsx)(W,{dataUrl:o.platformQrDataUrl,alt:t("botOnboarding.platformQrAlt")}):null,(0,e.jsx)(sn,{job:o}),(0,e.jsx)(rn,{job:o}),o.status==="needs_owner"?(0,e.jsxs)("form",{className:"onboarding-form",id:"ob-owner-form",onSubmit:l=>{l.preventDefault(),n.onSubmitOwner(o,n.ownerInput,n.ownerIdInput)},children:[(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.ownerLabel")}),(0,e.jsx)("input",{id:"ob-owner",type:"email",placeholder:t("botOnboarding.ownerPlaceholder"),autoComplete:"off",spellCheck:!1,value:n.ownerInput,onChange:l=>n.onOwnerInputChange(l.currentTarget.value)})]}),(0,e.jsx)("p",{className:"hint-warn",children:t("botOnboarding.needsOwnerDescription")}),(0,e.jsxs)("details",{className:"onboarding-technical",children:[(0,e.jsx)("summary",{children:t("botOnboarding.ownerUseId")}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.ownerIdLabel")}),(0,e.jsx)("input",{id:"ob-owner-id",type:"text",placeholder:t("botOnboarding.ownerIdPlaceholder"),autoComplete:"off",spellCheck:!1,value:n.ownerIdInput,onChange:l=>n.onOwnerIdInputChange(l.currentTarget.value)})]})]}),a?(0,e.jsx)("p",{className:"form-error",children:a}):null,(0,e.jsx)("div",{className:"actions onboarding-actions",children:(0,e.jsx)("button",{type:"submit",className:"primary onboarding-submit",children:t("botOnboarding.ownerSubmit")})})]}):null,o.status==="completed"?(0,e.jsx)("p",{className:"hint-ok",children:o.liveStarted?t("botOnboarding.liveOk"):t("botOnboarding.restartHint")}):null,o.status==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"hint-warn",children:o.appId?t("botOnboarding.partialFailureDescription"):o.error==="qr_expired"?t("botOnboarding.qrExpiredDescription"):N(o.error)?t("botOnboarding.authIncompleteDescription"):t("botOnboarding.createFailedDescription")}),(0,e.jsxs)("details",{className:"onboarding-technical",children:[(0,e.jsx)("summary",{children:t("botOnboarding.technicalDetails")}),(0,e.jsx)("code",{children:o.message??o.error??"unknown"})]}),(0,e.jsxs)("div",{className:"actions onboarding-actions",children:[(0,e.jsx)("button",{type:"button",onClick:n.onClose,children:t("botOnboarding.close")}),o.appId?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:()=>n.onRetry("compat"),children:t("botOnboarding.compatibilityMode")}),(0,e.jsx)("button",{type:"button",className:"primary onboarding-submit",onClick:()=>n.onRetry("web"),children:o.error==="qr_expired"?t("botOnboarding.generateQr"):N(o.error)?t("botOnboarding.scanAgain"):t("botOnboarding.retry")})]})]})]}):null,o.status==="completed"?(0,e.jsx)("div",{className:"actions onboarding-actions",children:(0,e.jsx)("button",{type:"button",onClick:n.onClose,children:t("botOnboarding.close")})}):null]})}function dn(n){let o=n.cliState.options.find(s=>s.id===n.form.cliId),a=o?.gateway==="ttadk"&&o.acceptsModel!==!1,l=o?.gateway==="ttadk"&&o.acceptsModel===!1,d=a?t("botOnboarding.modelTtadkPlaceholder").replace("{model}",n.cliState.ttadkModelDefault):t("botOnboarding.modelPlaceholder"),b=n.form.dirMode==="card"?t("botOnboarding.dirLabelCard"):t("botOnboarding.dirLabelFixed"),c=n.form.dirMode==="card"?t("botOnboarding.dirPlaceholderCard"):t("botOnboarding.dirPlaceholderFixed"),f=[...n.cliState.options].sort((s,p)=>s.label.localeCompare(p.label,"en",{sensitivity:"base"})).map(s=>({value:s.id,label:s.available===!1?t("botOnboarding.cliMissingOption",{label:s.label,command:s.command??s.id}):s.label})),S=[{value:"fixed",label:t("botOnboarding.dirModeFixed")},{value:"card",label:t("botOnboarding.dirModeCard")}];return(0,e.jsxs)("form",{id:"onboarding-form",className:"onboarding-form",onSubmit:n.onSubmit,children:[(0,e.jsx)("div",{className:"onboarding-session","aria-live":"polite",children:n.sessionMode==="checking"?(0,e.jsx)("p",{children:t("botOnboarding.sessionChecking")}):n.cliState.webSession.status==="ready"?n.sessionMode==="reuse"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionReady",{user:n.cliState.webSession.identity.userName,tenant:n.cliState.webSession.identity.tenantName})}),n.cliState.webSession.identity.email?(0,e.jsx)("small",{children:n.cliState.webSession.identity.email}):null]}),(0,e.jsx)("button",{type:"button",className:"onboarding-session-action",onClick:()=>n.onSessionModeChange("qr"),children:t("botOnboarding.switchAccount")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionSwitching")}),(0,e.jsx)("small",{children:t("botOnboarding.sessionSwitchingHint")})]}),(0,e.jsx)("button",{type:"button",className:"onboarding-session-action",onClick:()=>n.onSessionModeChange("reuse"),children:t("botOnboarding.reuseCurrentAccount")})]}):(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionScanRequired")}),(0,e.jsx)("small",{children:t("botOnboarding.sessionScanRequiredHint")})]})}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.appNameLabel")}),(0,e.jsx)("input",{id:"ob-app-name",type:"text",maxLength:64,value:n.form.appName,placeholder:t("botOnboarding.appNamePlaceholder"),autoComplete:"off",spellCheck:!1,onChange:s=>n.onFormChange({...n.form,appName:s.currentTarget.value})}),(0,e.jsx)("small",{className:"onboarding-field-hint",children:t("botOnboarding.appNameHint",{name:n.cliState.suggestedAppName})})]}),(0,e.jsxs)("div",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.cliLabel")}),(0,e.jsx)(T,{id:"ob-cli",className:"onboarding-menu",ariaLabel:t("botOnboarding.cliLabel"),label:z(f,n.form.cliId),value:n.form.cliId,options:f,searchable:!0,searchPlaceholder:t("common.dropdownSearch"),searchEmptyLabel:t("common.dropdownSearchEmpty"),onChange:s=>{n.onFormChange(K(n.form,s,n.cliState))}}),o?.available===!1?(0,e.jsx)("small",{className:"hint-warn",children:t("botOnboarding.cliMissingHint",{command:o.command??n.form.cliId})}):(0,e.jsx)("small",{className:"onboarding-field-hint",children:n.form.cliId})]}),(0,e.jsxs)("div",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.dirModeLabel")}),(0,e.jsx)(T,{id:"ob-dir-mode",className:"onboarding-menu",ariaLabel:t("botOnboarding.dirModeLabel"),label:z(S,n.form.dirMode),value:n.form.dirMode,options:S,onChange:s=>n.onFormChange({...n.form,dirMode:s})})]}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:b}),(0,e.jsx)("input",{id:"ob-dir",type:"text",value:n.form.workingDir,placeholder:c,autoComplete:"off",spellCheck:!1,onChange:s=>n.onFormChange({...n.form,workingDir:s.currentTarget.value})})]}),l?null:(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.modelLabel")}),(0,e.jsx)("input",{id:"ob-model",type:"text",list:a?"ob-model-suggestions":void 0,placeholder:d,autoComplete:"off",spellCheck:!1,value:n.form.model,onChange:s=>n.onFormChange({...n.form,model:s.currentTarget.value})}),a?(0,e.jsx)("datalist",{id:"ob-model-suggestions",children:n.cliState.ttadkModelSuggestions.map(s=>(0,e.jsx)("option",{value:s},s))}):null]}),n.error?(0,e.jsx)("p",{className:"form-error",children:n.error}):null,(0,e.jsxs)("div",{className:"actions onboarding-actions",children:[(0,e.jsx)("button",{type:"button",id:"ob-cancel",disabled:n.submitting,onClick:n.onClose,children:t("botOnboarding.cancel")}),(0,e.jsx)("button",{type:"submit",className:"primary onboarding-submit",disabled:en(n.submitting,n.sessionMode),children:n.submitting?t("botOnboarding.starting"):n.sessionMode==="reuse"?t("botOnboarding.confirmReuse"):t("botOnboarding.startScan")})]})]})}function un(n){let o=(0,r.useRef)(null),a=(0,r.useRef)(null),l=(0,r.useRef)(0),[d,b]=(0,r.useState)(()=>x()),[c,f]=(0,r.useState)(()=>Q()),[S,s]=(0,r.useState)("checking"),[p,w]=(0,r.useState)({kind:"form"}),[P,I]=(0,r.useState)(!1),[A,M]=(0,r.useState)(""),[J,_]=(0,r.useState)(""),g=(0,r.useCallback)(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]),v=(0,r.useCallback)(()=>{g(),n.onClose()},[n,g]),y=(0,r.useCallback)(i=>{w({kind:"job",job:i}),i.status==="needs_owner"&&(M(i.suggestedOwner??""),_("")),X(i)&&g()},[g]),j=(0,r.useCallback)(async i=>{let m=await fetch(`/api/bot-onboarding/${encodeURIComponent(i)}`),u=await m.json();if(!m.ok||!u?.job)throw new Error(u?.error??`http_${m.status}`);y(u.job)},[y]),R=(0,r.useCallback)(i=>{g(),a.current=window.setInterval(()=>{j(i).catch(m=>{g(),w({kind:"job",job:{id:i,status:"failed",message:q(m)}})})},1200)},[j,g]),U=(0,r.useCallback)(()=>{g();let i=l.current+1;l.current=i;let m=x();b(m),f(Q()),s("checking"),w({kind:"form"}),I(!1),M(""),_(""),on().then(u=>{l.current===i&&(b(u),f(k=>an(k,u)),s(u.webSession.status==="ready"?"reuse":"qr"))})},[g]);(0,r.useEffect)(()=>{if(n.open){U();return}g(),l.current+=1},[n.open,U,g]),(0,r.useEffect)(()=>{let i=o.current;if(i)if(n.open&&!i.open)try{i.showModal()}catch{}else!n.open&&i.open&&i.close()},[n.open]),(0,r.useEffect)(()=>()=>g(),[g]);let C=(0,r.useCallback)(async(i,m)=>{g(),I(!0),w({kind:"job",job:{id:"",status:"starting"}});try{let u=m??(S==="reuse"?"reuse":"qr"),k=i==="web"&&u==="reuse"&&d.webSession.status==="ready"?{userId:d.webSession.identity.userId,tenantId:d.webSession.identity.tenantId}:void 0,h=await fetch("/api/bot-onboarding/start",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({appName:i==="web"&&c.appName.trim()||void 0,registrationMode:i,...i==="web"?{sessionMode:u,expectedIdentity:k}:{},cliId:c.cliId,workingDir:c.workingDir.trim(),dirMode:c.dirMode,model:c.model.trim()||void 0})}),O=await h.json();if(h.status===400){w({kind:"form",error:O?.message??O?.error??"invalid_input"});return}if(!h.ok||!O?.job?.id)throw new Error(O?.error??`http_${h.status}`);let F=O.job;y(F),X(F)||R(F.id)}catch(u){w({kind:"job",job:{id:"",status:"failed",message:q(u)}})}finally{I(!1)}},[y,d.webSession,c,S,R,g]),H=(0,r.useCallback)(i=>{i.preventDefault(),C("web")},[C]),$=(0,r.useCallback)(i=>{if(i==="compat"&&!window.confirm(t("botOnboarding.compatibilityConfirm")))return;let m=i==="web"&&p.kind==="job"&&N(p.job.error);m&&s("qr"),C(i,m?"qr":void 0)},[C,p]),V=(0,r.useCallback)(async(i,m,u)=>{let k=[m.trim(),u.trim()].filter(Boolean).join(",");if(!k){w({kind:"job",job:i,ownerError:t("botOnboarding.ownerEmpty")});return}try{let h=await fetch(`/api/bot-onboarding/${encodeURIComponent(i.id)}/owner`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({owner:k})}),O=await h.json();if(!h.ok){w({kind:"job",job:i,ownerError:O?.message??O?.error??t("botOnboarding.ownerInvalid")});return}O?.job&&y(O.job)}catch(h){w({kind:"job",job:i,ownerError:q(h)})}},[y]),Y=(0,r.useMemo)(()=>p.kind==="form"?(0,e.jsx)(dn,{cliState:d,form:c,sessionMode:S,error:p.error,submitting:P,onFormChange:f,onSessionModeChange:s,onSubmit:H,onClose:v}):(0,e.jsx)(ln,{view:p,ownerInput:A,ownerIdInput:J,onOwnerInputChange:M,onOwnerIdInputChange:_,onSubmitOwner:V,onRetry:$,onClose:v}),[d,v,c,J,A,$,S,H,V,P,p]),D=p.kind==="form"||p.kind==="job"&&(p.job.status==="completed"||p.job.status==="failed");return(0,e.jsx)("dialog",{className:"onboarding-dialog",ref:o,onCancel:i=>{D||i.preventDefault()},onClose:()=>{D&&v()},onClick:i=>{D&&i.target===i.currentTarget&&v()},children:(0,e.jsxs)("article",{className:"onboarding-card",children:[(0,e.jsxs)("header",{className:"onboarding-header",children:[(0,e.jsx)("h3",{children:t("botOnboarding.title")}),(0,e.jsx)("p",{children:t("botOnboarding.intro")})]}),Y]})})}export{nn as a,gn as b,un as c};
|
|
1
|
+
import{p as T}from"./chunk-I35DXGM4.js";import{s as t}from"./chunk-4QTBR7UF.js";import{a as Z,d as B}from"./chunk-5THX4DI2.js";import{c as E}from"./chunk-7SZRL6FY.js";var r=E(Z(),1);var e=E(B(),1),nn="botmux:open-bot-onboarding",L={id:"claude-code",label:"Claude"},G="glm-5.1";function x(){return{options:[L],ttadkModelDefault:G,ttadkModelSuggestions:[],suggestedAppName:"botmux-0",webSession:{status:"checking"}}}function Q(){return{appName:"",cliId:L.id,dirMode:"fixed",workingDir:"~",model:""}}function en(n,o){return n||o==="checking"}function q(n){return n instanceof Error?n.message:String(n)}function X(n){return n.status==="completed"||n.status==="failed"||n.status==="needs_owner"}function N(n){return n==="login_failed"||n==="invalid_session"||n==="identity_unavailable"||n==="session_changed"}function tn(n){return n.status==="waiting_for_scan"?n.registrationMode==="compat"?t("botOnboarding.waitingCompat"):t("botOnboarding.waiting",{name:n.appName??""}):n.status==="verifying"?t("botOnboarding.verifying"):n.status==="configuring_permissions"?n.permissionStatusMsg?`${t("botOnboarding.configuringPermissions")} ${n.permissionStatusMsg}`:t("botOnboarding.configuringPermissions"):n.status==="waiting_for_platform_scan"?t("botOnboarding.platformScanHint"):n.status==="needs_owner"?t("botOnboarding.needsOwnerTitle"):n.status==="completed"?t("botOnboarding.completed",{name:n.appName??t("botOnboarding.botFallback")}):n.status==="failed"?n.appId?t("botOnboarding.partialFailureTitle"):n.error==="qr_expired"?t("botOnboarding.qrExpiredTitle"):N(n.error)?t("botOnboarding.authIncompleteTitle"):t("botOnboarding.createFailedTitle"):t("botOnboarding.starting")}async function on(){try{let n=await fetch("/api/cli-options"),o=await n.json();if(n.ok&&Array.isArray(o?.options)){let a=typeof o.ttadkModelDefault=="string"&&o.ttadkModelDefault.trim()?o.ttadkModelDefault.trim():G,l=Array.isArray(o.ttadkModelSuggestions)?o.ttadkModelSuggestions.filter(f=>typeof f=="string"):[],d=typeof o.suggestedAppName=="string"&&o.suggestedAppName.trim()?o.suggestedAppName.trim():"botmux-0",b=o?.webSession?.identity,c=o?.webSession?.status==="ready"&&typeof b?.userId=="string"&&typeof b?.userName=="string"&&typeof b?.tenantId=="string"&&typeof b?.tenantName=="string"?{status:"ready",source:typeof o.webSession.source=="string"?o.webSession.source:"botmux_cache",identity:{userId:b.userId,userName:b.userName,...typeof b.email=="string"?{email:b.email}:{},tenantId:b.tenantId,tenantName:b.tenantName}}:{status:"scan_required",...typeof o?.webSession?.reason=="string"?{reason:o.webSession.reason}:{}};return{options:o.options,ttadkModelDefault:a,ttadkModelSuggestions:l,suggestedAppName:d,webSession:c}}}catch{}return{...x(),webSession:{status:"scan_required"}}}function K(n,o,a){let l=a.options.find(f=>f.id===o),d=l?.gateway==="ttadk",b=d&&l?.acceptsModel!==!1,c=n.model;return d&&!b?c="":b&&!c.trim()?c=a.ttadkModelDefault:!b&&c.trim()===a.ttadkModelDefault&&(c=""),{...n,cliId:o,model:c}}function an(n,o){let a=o.options.some(l=>l.id===n.cliId)?n.cliId:o.options[0]?.id??L.id;return K({...n},a,o)}async function gn(){window.dispatchEvent(new Event(nn))}function rn(n){let{job:o}=n;if(o.status!=="completed"&&o.status!=="needs_owner"||!o.permission)return null;let a=o.permission;if(a.ok){let d=[t("botOnboarding.permissionOk",{count:a.scopeCount??0})];return a.skippedScopeCount&&a.skippedScopeCount>0&&d.push(t("botOnboarding.permissionSkipped",{count:a.skippedScopeCount})),a.versionId&&d.push(t("botOnboarding.permissionVersion",{version:a.versionId})),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"hint-ok",children:d.join(" ")}),a.scopeWarning?(0,e.jsx)("p",{className:"hint-warn",children:a.scopeWarning}):null]})}let l=o.remainingSteps??[];return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("p",{className:"hint-warn",children:[t("botOnboarding.permissionManual"),a.message?`\uFF08${a.message}\uFF09`:""]}),l.length?(0,e.jsx)("ol",{className:"onboarding-steps",children:l.map(d=>(0,e.jsx)("li",{children:(0,e.jsx)("a",{href:d.url,target:"_blank",rel:"noopener",children:d.title})},`${d.title}:${d.url}`))}):null]})}function sn(n){let{job:o}=n;return o.appId?(0,e.jsxs)("p",{className:"onboarding-meta",children:[(0,e.jsx)("b",{children:"App ID:"})," ",(0,e.jsx)("code",{children:o.appId}),o.appName?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsxs)("b",{children:[t("botOnboarding.appNameLabel"),":"]})," ",(0,e.jsx)("code",{children:o.appName})]}):null,o.cliId?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsx)("b",{children:"CLI:"})," ",(0,e.jsx)("code",{children:o.cliId})]}):null,o.workingDir?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:" / "}),(0,e.jsxs)("b",{children:[t("botOnboarding.metaDir"),":"]})," ",(0,e.jsx)("code",{children:o.workingDir})]}):null]}):null}function W(n){return(0,e.jsxs)("div",{className:"qr-card",children:[(0,e.jsx)("img",{className:"qr-image",src:n.dataUrl,alt:n.alt}),n.link?(0,e.jsx)("a",{className:"onboarding-link",href:n.link,target:"_blank",rel:"noopener",children:t("botOnboarding.openLink")}):null]})}function z(n,o){return n.find(a=>a.value===o)?.label??o}function ln(n){let{job:o,ownerError:a}=n.view;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:`onboarding-status status-${o.status}`,children:tn(o)}),o.status==="waiting_for_scan"&&o.qrDataUrl?(0,e.jsx)(W,{dataUrl:o.qrDataUrl,alt:t("botOnboarding.qrAlt"),link:o.qrUrl}):null,o.status==="waiting_for_platform_scan"&&o.platformQrDataUrl?(0,e.jsx)(W,{dataUrl:o.platformQrDataUrl,alt:t("botOnboarding.platformQrAlt")}):null,(0,e.jsx)(sn,{job:o}),(0,e.jsx)(rn,{job:o}),o.status==="needs_owner"?(0,e.jsxs)("form",{className:"onboarding-form",id:"ob-owner-form",onSubmit:l=>{l.preventDefault(),n.onSubmitOwner(o,n.ownerInput,n.ownerIdInput)},children:[(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.ownerLabel")}),(0,e.jsx)("input",{id:"ob-owner",type:"email",placeholder:t("botOnboarding.ownerPlaceholder"),autoComplete:"off",spellCheck:!1,value:n.ownerInput,onChange:l=>n.onOwnerInputChange(l.currentTarget.value)})]}),(0,e.jsx)("p",{className:"hint-warn",children:t("botOnboarding.needsOwnerDescription")}),(0,e.jsxs)("details",{className:"onboarding-technical",children:[(0,e.jsx)("summary",{children:t("botOnboarding.ownerUseId")}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.ownerIdLabel")}),(0,e.jsx)("input",{id:"ob-owner-id",type:"text",placeholder:t("botOnboarding.ownerIdPlaceholder"),autoComplete:"off",spellCheck:!1,value:n.ownerIdInput,onChange:l=>n.onOwnerIdInputChange(l.currentTarget.value)})]})]}),a?(0,e.jsx)("p",{className:"form-error",children:a}):null,(0,e.jsx)("div",{className:"actions onboarding-actions",children:(0,e.jsx)("button",{type:"submit",className:"primary onboarding-submit",children:t("botOnboarding.ownerSubmit")})})]}):null,o.status==="completed"?(0,e.jsx)("p",{className:"hint-ok",children:o.liveStarted?t("botOnboarding.liveOk"):t("botOnboarding.restartHint")}):null,o.status==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"hint-warn",children:o.appId?t("botOnboarding.partialFailureDescription"):o.error==="qr_expired"?t("botOnboarding.qrExpiredDescription"):N(o.error)?t("botOnboarding.authIncompleteDescription"):t("botOnboarding.createFailedDescription")}),(0,e.jsxs)("details",{className:"onboarding-technical",children:[(0,e.jsx)("summary",{children:t("botOnboarding.technicalDetails")}),(0,e.jsx)("code",{children:o.message??o.error??"unknown"})]}),(0,e.jsxs)("div",{className:"actions onboarding-actions",children:[(0,e.jsx)("button",{type:"button",onClick:n.onClose,children:t("botOnboarding.close")}),o.appId?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:()=>n.onRetry("compat"),children:t("botOnboarding.compatibilityMode")}),(0,e.jsx)("button",{type:"button",className:"primary onboarding-submit",onClick:()=>n.onRetry("web"),children:o.error==="qr_expired"?t("botOnboarding.generateQr"):N(o.error)?t("botOnboarding.scanAgain"):t("botOnboarding.retry")})]})]})]}):null,o.status==="completed"?(0,e.jsx)("div",{className:"actions onboarding-actions",children:(0,e.jsx)("button",{type:"button",onClick:n.onClose,children:t("botOnboarding.close")})}):null]})}function dn(n){let o=n.cliState.options.find(s=>s.id===n.form.cliId),a=o?.gateway==="ttadk"&&o.acceptsModel!==!1,l=o?.gateway==="ttadk"&&o.acceptsModel===!1,d=a?t("botOnboarding.modelTtadkPlaceholder").replace("{model}",n.cliState.ttadkModelDefault):t("botOnboarding.modelPlaceholder"),b=n.form.dirMode==="card"?t("botOnboarding.dirLabelCard"):t("botOnboarding.dirLabelFixed"),c=n.form.dirMode==="card"?t("botOnboarding.dirPlaceholderCard"):t("botOnboarding.dirPlaceholderFixed"),f=[...n.cliState.options].sort((s,p)=>s.label.localeCompare(p.label,"en",{sensitivity:"base"})).map(s=>({value:s.id,label:s.available===!1?t("botOnboarding.cliMissingOption",{label:s.label,command:s.command??s.id}):s.label})),S=[{value:"fixed",label:t("botOnboarding.dirModeFixed")},{value:"card",label:t("botOnboarding.dirModeCard")}];return(0,e.jsxs)("form",{id:"onboarding-form",className:"onboarding-form",onSubmit:n.onSubmit,children:[(0,e.jsx)("div",{className:"onboarding-session","aria-live":"polite",children:n.sessionMode==="checking"?(0,e.jsx)("p",{children:t("botOnboarding.sessionChecking")}):n.cliState.webSession.status==="ready"?n.sessionMode==="reuse"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionReady",{user:n.cliState.webSession.identity.userName,tenant:n.cliState.webSession.identity.tenantName})}),n.cliState.webSession.identity.email?(0,e.jsx)("small",{children:n.cliState.webSession.identity.email}):null]}),(0,e.jsx)("button",{type:"button",className:"onboarding-session-action",onClick:()=>n.onSessionModeChange("qr"),children:t("botOnboarding.switchAccount")})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionSwitching")}),(0,e.jsx)("small",{children:t("botOnboarding.sessionSwitchingHint")})]}),(0,e.jsx)("button",{type:"button",className:"onboarding-session-action",onClick:()=>n.onSessionModeChange("reuse"),children:t("botOnboarding.reuseCurrentAccount")})]}):(0,e.jsxs)("div",{children:[(0,e.jsx)("strong",{children:t("botOnboarding.sessionScanRequired")}),(0,e.jsx)("small",{children:t("botOnboarding.sessionScanRequiredHint")})]})}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.appNameLabel")}),(0,e.jsx)("input",{id:"ob-app-name",type:"text",maxLength:64,value:n.form.appName,placeholder:t("botOnboarding.appNamePlaceholder"),autoComplete:"off",spellCheck:!1,onChange:s=>n.onFormChange({...n.form,appName:s.currentTarget.value})}),(0,e.jsx)("small",{className:"onboarding-field-hint",children:t("botOnboarding.appNameHint",{name:n.cliState.suggestedAppName})})]}),(0,e.jsxs)("div",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.cliLabel")}),(0,e.jsx)(T,{id:"ob-cli",className:"onboarding-menu",ariaLabel:t("botOnboarding.cliLabel"),label:z(f,n.form.cliId),value:n.form.cliId,options:f,searchable:!0,searchPlaceholder:t("common.dropdownSearch"),searchEmptyLabel:t("common.dropdownSearchEmpty"),onChange:s=>{n.onFormChange(K(n.form,s,n.cliState))}}),o?.available===!1?(0,e.jsx)("small",{className:"hint-warn",children:t("botOnboarding.cliMissingHint",{command:o.command??n.form.cliId})}):(0,e.jsx)("small",{className:"onboarding-field-hint",children:n.form.cliId})]}),(0,e.jsxs)("div",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.dirModeLabel")}),(0,e.jsx)(T,{id:"ob-dir-mode",className:"onboarding-menu",ariaLabel:t("botOnboarding.dirModeLabel"),label:z(S,n.form.dirMode),value:n.form.dirMode,options:S,onChange:s=>n.onFormChange({...n.form,dirMode:s})})]}),(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:b}),(0,e.jsx)("input",{id:"ob-dir",type:"text",value:n.form.workingDir,placeholder:c,autoComplete:"off",spellCheck:!1,onChange:s=>n.onFormChange({...n.form,workingDir:s.currentTarget.value})})]}),l?null:(0,e.jsxs)("label",{className:"onboarding-field",children:[(0,e.jsx)("span",{children:t("botOnboarding.modelLabel")}),(0,e.jsx)("input",{id:"ob-model",type:"text",list:a?"ob-model-suggestions":void 0,placeholder:d,autoComplete:"off",spellCheck:!1,value:n.form.model,onChange:s=>n.onFormChange({...n.form,model:s.currentTarget.value})}),a?(0,e.jsx)("datalist",{id:"ob-model-suggestions",children:n.cliState.ttadkModelSuggestions.map(s=>(0,e.jsx)("option",{value:s},s))}):null]}),n.error?(0,e.jsx)("p",{className:"form-error",children:n.error}):null,(0,e.jsxs)("div",{className:"actions onboarding-actions",children:[(0,e.jsx)("button",{type:"button",id:"ob-cancel",disabled:n.submitting,onClick:n.onClose,children:t("botOnboarding.cancel")}),(0,e.jsx)("button",{type:"submit",className:"primary onboarding-submit",disabled:en(n.submitting,n.sessionMode),children:n.submitting?t("botOnboarding.starting"):n.sessionMode==="reuse"?t("botOnboarding.confirmReuse"):t("botOnboarding.startScan")})]})]})}function un(n){let o=(0,r.useRef)(null),a=(0,r.useRef)(null),l=(0,r.useRef)(0),[d,b]=(0,r.useState)(()=>x()),[c,f]=(0,r.useState)(()=>Q()),[S,s]=(0,r.useState)("checking"),[p,w]=(0,r.useState)({kind:"form"}),[P,I]=(0,r.useState)(!1),[A,M]=(0,r.useState)(""),[J,_]=(0,r.useState)(""),g=(0,r.useCallback)(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]),v=(0,r.useCallback)(()=>{g(),n.onClose()},[n,g]),y=(0,r.useCallback)(i=>{w({kind:"job",job:i}),i.status==="needs_owner"&&(M(i.suggestedOwner??""),_("")),X(i)&&g()},[g]),j=(0,r.useCallback)(async i=>{let m=await fetch(`/api/bot-onboarding/${encodeURIComponent(i)}`),u=await m.json();if(!m.ok||!u?.job)throw new Error(u?.error??`http_${m.status}`);y(u.job)},[y]),R=(0,r.useCallback)(i=>{g(),a.current=window.setInterval(()=>{j(i).catch(m=>{g(),w({kind:"job",job:{id:i,status:"failed",message:q(m)}})})},1200)},[j,g]),U=(0,r.useCallback)(()=>{g();let i=l.current+1;l.current=i;let m=x();b(m),f(Q()),s("checking"),w({kind:"form"}),I(!1),M(""),_(""),on().then(u=>{l.current===i&&(b(u),f(k=>an(k,u)),s(u.webSession.status==="ready"?"reuse":"qr"))})},[g]);(0,r.useEffect)(()=>{if(n.open){U();return}g(),l.current+=1},[n.open,U,g]),(0,r.useEffect)(()=>{let i=o.current;if(i)if(n.open&&!i.open)try{i.showModal()}catch{}else!n.open&&i.open&&i.close()},[n.open]),(0,r.useEffect)(()=>()=>g(),[g]);let C=(0,r.useCallback)(async(i,m)=>{g(),I(!0),w({kind:"job",job:{id:"",status:"starting"}});try{let u=m??(S==="reuse"?"reuse":"qr"),k=i==="web"&&u==="reuse"&&d.webSession.status==="ready"?{userId:d.webSession.identity.userId,tenantId:d.webSession.identity.tenantId}:void 0,h=await fetch("/api/bot-onboarding/start",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({appName:i==="web"&&c.appName.trim()||void 0,registrationMode:i,...i==="web"?{sessionMode:u,expectedIdentity:k}:{},cliId:c.cliId,workingDir:c.workingDir.trim(),dirMode:c.dirMode,model:c.model.trim()||void 0})}),O=await h.json();if(h.status===400){w({kind:"form",error:O?.message??O?.error??"invalid_input"});return}if(!h.ok||!O?.job?.id)throw new Error(O?.error??`http_${h.status}`);let F=O.job;y(F),X(F)||R(F.id)}catch(u){w({kind:"job",job:{id:"",status:"failed",message:q(u)}})}finally{I(!1)}},[y,d.webSession,c,S,R,g]),H=(0,r.useCallback)(i=>{i.preventDefault(),C("web")},[C]),$=(0,r.useCallback)(i=>{if(i==="compat"&&!window.confirm(t("botOnboarding.compatibilityConfirm")))return;let m=i==="web"&&p.kind==="job"&&N(p.job.error);m&&s("qr"),C(i,m?"qr":void 0)},[C,p]),V=(0,r.useCallback)(async(i,m,u)=>{let k=[m.trim(),u.trim()].filter(Boolean).join(",");if(!k){w({kind:"job",job:i,ownerError:t("botOnboarding.ownerEmpty")});return}try{let h=await fetch(`/api/bot-onboarding/${encodeURIComponent(i.id)}/owner`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({owner:k})}),O=await h.json();if(!h.ok){w({kind:"job",job:i,ownerError:O?.message??O?.error??t("botOnboarding.ownerInvalid")});return}O?.job&&y(O.job)}catch(h){w({kind:"job",job:i,ownerError:q(h)})}},[y]),Y=(0,r.useMemo)(()=>p.kind==="form"?(0,e.jsx)(dn,{cliState:d,form:c,sessionMode:S,error:p.error,submitting:P,onFormChange:f,onSessionModeChange:s,onSubmit:H,onClose:v}):(0,e.jsx)(ln,{view:p,ownerInput:A,ownerIdInput:J,onOwnerInputChange:M,onOwnerIdInputChange:_,onSubmitOwner:V,onRetry:$,onClose:v}),[d,v,c,J,A,$,S,H,V,P,p]),D=p.kind==="form"||p.kind==="job"&&(p.job.status==="completed"||p.job.status==="failed");return(0,e.jsx)("dialog",{className:"onboarding-dialog",ref:o,onCancel:i=>{D||i.preventDefault()},onClose:()=>{D&&v()},onClick:i=>{D&&i.target===i.currentTarget&&v()},children:(0,e.jsxs)("article",{className:"onboarding-card",children:[(0,e.jsxs)("header",{className:"onboarding-header",children:[(0,e.jsx)("h3",{children:t("botOnboarding.title")}),(0,e.jsx)("p",{children:t("botOnboarding.intro")})]}),Y]})})}export{nn as a,gn as b,un as c};
|
package/dist/dashboard-web/chunks/{connectors-page-RM3BJVMV.js → connectors-page-LKDT4WBG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H,b as Q}from"./chunk-EVK77ASG.js";import{b as W}from"./chunk-D2I5F4MY.js";import{a as le,c as ce,g as Le,k as P,p as ie}from"./chunk-I35DXGM4.js";import"./chunk-3H6MVXXU.js";import{a as re}from"./chunk-SYC6D5XU.js";import{a as Ne,d as se}from"./chunk-5THX4DI2.js";import{c as K}from"./chunk-7SZRL6FY.js";var c=K(Ne(),1);var b=K(Ne(),1);var n=K(se(),1),De=50,we={total:0,ok:0,error:0,successRate:0};function Re(t,e=Date.now()){if(t==="all")return;let a=t==="24h"?24:t==="7d"?168:720;return new Date(e-a*60*60*1e3).toISOString()}function $e(t,e=0){let a=new URLSearchParams({limit:String(De),offset:String(e)});t.connectorId&&a.set("connectorId",t.connectorId),t.status&&a.set("status",t.status);let m=Re(t.timeWindow);return m&&a.set("since",m),t.query.trim()&&a.set("q",t.query.trim()),a}function Ie(t){if(!t)return"\u2014";let e=new Date(t);return Number.isFinite(e.getTime())?e.toLocaleString():t}function de(t){return t===void 0||!Number.isFinite(t)?"\u2014":t<1e3?`${Math.round(t)} ms`:t<6e4?`${(t/1e3).toFixed(t<1e4?1:0)} s`:`${(t/6e4).toFixed(1)} min`}function Oe(t){return t===void 0?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function ke(t){return t.value===void 0||t.value===null?(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:t.empty}):typeof t.value=="object"&&!Array.isArray(t.value)&&Object.keys(t.value).length===0?(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:t.empty}):(0,n.jsx)("pre",{className:`webhook-log-json${t.fullHeight?" full-height":""}`,children:(0,n.jsx)("code",{children:JSON.stringify(t.value,null,2)})})}function Ae(t){let e=[["kind",t.value?.kind],["mode",t.value?.mode],["botId",t.value?.botId],["chatId",t.value?.chatId],["sessionId",t.value?.sessionId],["rootMessageId",t.value?.rootMessageId],["workflowId",t.value?.workflowId]].filter(([,a])=>a!=null&&a!=="");return e.length?(0,n.jsx)("dl",{className:"webhook-log-target-facts",children:e.map(([a,m])=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:a}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:String(m)})})]},a))}):(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:"\u2014"})}function ve(t){return(0,n.jsx)(ie,{id:t.id,className:"webhook-log-filter-menu",ariaLabel:t.label,style:{width:"100%",minWidth:0},value:t.value,label:le(t.options,t.value),options:t.options,onChange:t.onChange})}function ue(t){return(0,n.jsxs)("article",{className:`card webhook-log-metric${t.tone?` ${t.tone}`:""}`,children:[(0,n.jsx)("span",{children:t.label}),(0,n.jsx)("strong",{children:t.value}),(0,n.jsx)("small",{children:t.hint||"\xA0"})]})}function Te(t={}){let e=W(),a=(0,b.useRef)(!1),m=(0,b.useRef)([]),[k,N]=(0,b.useState)([]),[p,L]=(0,b.useState)([]),[f,D]=(0,b.useState)(we),[v,$]=(0,b.useState)({connectorId:"",status:"",timeWindow:"7d",query:""}),[d,s]=(0,b.useState)(null),[M,_]=(0,b.useState)(!0),[C,U]=(0,b.useState)(!1),[q,J]=(0,b.useState)(!1),[V,Y]=(0,b.useState)(0),[B,T]=(0,b.useState)(""),[X,Z]=(0,b.useState)(!1),I=(0,b.useMemo)(()=>new Map(k.map(l=>[l.id,l.name])),[k]),u=(0,b.useMemo)(()=>p.find(l=>l.triggerId===d)??p[0]??null,[p,d]),ee=(0,b.useMemo)(()=>[{value:"",label:e("webhookLogs.allConnectors")},...k.map(l=>({value:l.id,label:l.name}))],[k,e]),G=(0,b.useMemo)(()=>[{value:"",label:e("webhookLogs.allStatuses")},{value:"ok",label:e("webhookLogs.success")},{value:"error",label:e("webhookLogs.failed")}],[e]),be=(0,b.useMemo)(()=>[{value:"24h",label:e("webhookLogs.last24h")},{value:"7d",label:e("webhookLogs.last7d")},{value:"30d",label:e("webhookLogs.last30d")},{value:"all",label:e("webhookLogs.allTime")}],[e]),O=(0,b.useCallback)(async(l=!1,w=!1)=>{w?U(!0):_(!0),T("");let z=l?m.current.length:0,oe=$e(v,z),y=new URLSearchParams(oe);y.delete("limit"),y.delete("offset");try{let[x,te]=await Promise.all([H(`/api/trigger-logs?${oe}`),l?Promise.resolve(null):H(`/api/trigger-logs/summary?${y}`)]);if(!a.current)return;if(x.status!==200)throw new Error(String(x.body?.error||x.status));let S=Array.isArray(x.body?.logs)?x.body.logs:[],ne=l?[...m.current,...S]:S;m.current=ne,L(ne),Y(Number(x.body?.total??S.length)),J(x.body?.hasMore===!0),l||(D(te?.status===200?te.body?.summary??we:we),s(ae=>S.some(fe=>fe.triggerId===ae)?ae:S[0]?.triggerId??null))}catch(x){a.current&&T(x?.message||e("webhookLogs.loadFailed"))}finally{a.current&&(_(!1),U(!1))}},[v,e]);(0,b.useEffect)(()=>(a.current=!0,H("/api/connectors").then(l=>{a.current&&l.status===200&&N(Array.isArray(l.body?.connectors)?l.body.connectors:[])}),()=>{a.current=!1}),[]),(0,b.useEffect)(()=>{let l=setTimeout(()=>{O(!1)},v.query?260:0);return()=>clearTimeout(l)},[v,O]),(0,b.useEffect)(()=>{let l=setInterval(()=>{O(!1,!0)},15e3);return()=>clearInterval(l)},[O]);async function he(){u&&(await navigator.clipboard?.writeText(JSON.stringify(u,null,2)),Z(!0),setTimeout(()=>a.current&&Z(!1),1200))}let pe=u?.request?.payloadOmittedReason==="disabled"?e("webhookLogs.payloadDisabled"):u?.request?.payloadOmittedReason==="too_large"?e("webhookLogs.payloadTooLarge"):e("webhookLogs.payloadUnavailable"),j=(0,n.jsxs)(n.Fragment,{children:[t.embedded?null:(0,n.jsxs)("div",{className:"page-heading",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"eyebrow",children:e("nav.connectors")}),(0,n.jsx)("h1",{children:e("nav.webhookLogs")}),(0,n.jsx)("p",{className:"webhook-log-heading-copy",children:e("webhookLogs.subtitle")})]}),(0,n.jsxs)("div",{className:"page-heading-actions",children:[(0,n.jsxs)("span",{className:`webhook-log-live${C?" refreshing":""}`,children:[(0,n.jsx)("i",{}),e("webhookLogs.autoRefresh")]}),(0,n.jsx)("a",{className:"button page-primary-action",href:"#/connectors",children:e("webhookLogs.manage")})]})]}),(0,n.jsxs)("section",{className:"webhook-log-metrics","aria-label":e("webhookLogs.summary"),children:[(0,n.jsx)(ue,{label:e("webhookLogs.total"),value:f.total,hint:e("webhookLogs.filteredRange")}),(0,n.jsx)(ue,{label:e("webhookLogs.successRate"),value:`${f.successRate.toFixed(f.successRate%1?1:0)}%`,tone:"ok",hint:`${f.ok} ${e("webhookLogs.calls")}`}),(0,n.jsx)(ue,{label:e("webhookLogs.failures"),value:f.error,tone:f.error?"error":void 0,hint:f.error?e("webhookLogs.needsReview"):e("webhookLogs.noFailures")}),(0,n.jsx)(ue,{label:e("webhookLogs.p95"),value:de(f.p95DurationMs),hint:`${e("webhookLogs.average")} ${de(f.avgDurationMs)}`})]}),(0,n.jsxs)("form",{className:"filters dashboard-toolbar webhook-log-toolbar",onSubmit:l=>l.preventDefault(),children:[(0,n.jsx)("input",{type:"search",name:"q","aria-label":e("webhookLogs.search"),placeholder:e("webhookLogs.searchPlaceholder"),value:v.query,onChange:l=>{let w=l.currentTarget.value;$(z=>({...z,query:w}))}}),(0,n.jsx)(ve,{id:"webhook-log-connector",label:e("webhookLogs.connector"),value:v.connectorId,options:ee,onChange:l=>$(w=>({...w,connectorId:l}))}),(0,n.jsx)(ve,{id:"webhook-log-status",label:e("webhookLogs.status"),value:v.status,options:G,onChange:l=>$(w=>({...w,status:l}))}),(0,n.jsx)(ve,{id:"webhook-log-window",label:e("webhookLogs.timeRange"),value:v.timeWindow,options:be,onChange:l=>$(w=>({...w,timeWindow:l}))}),(0,n.jsx)("button",{type:"button",className:"ghost webhook-log-refresh",disabled:C,onClick:()=>{O(!1,!0)},children:e("webhookLogs.refresh")})]}),B?(0,n.jsxs)("p",{className:"err webhook-log-error",children:[e("webhookLogs.loadFailed"),": ",B]}):null,(0,n.jsxs)("section",{className:"webhook-log-workspace",children:[(0,n.jsxs)("article",{className:"card webhook-log-list-panel",children:[(0,n.jsx)("header",{className:"webhook-log-panel-head",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e("webhookLogs.records")}),(0,n.jsx)("span",{children:e("webhookLogs.matching",{count:V})})]})}),M&&!p.length?(0,n.jsx)(ce,{label:e("webhookLogs.loading"),compact:!0}):null,!M&&!p.length?(0,n.jsxs)("div",{className:"webhook-log-empty",children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"\u25CE"}),(0,n.jsx)("strong",{children:e("webhookLogs.empty")}),(0,n.jsx)("p",{children:e("webhookLogs.emptyHint")})]}):null,(0,n.jsx)("div",{className:"webhook-log-list",role:"listbox","aria-label":e("webhookLogs.records"),children:p.map(l=>{let w=u?.triggerId===l.triggerId;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":w,className:`webhook-log-row${w?" active":""}`,onClick:()=>s(l.triggerId),children:[(0,n.jsx)("span",{className:`webhook-log-status-dot ${l.status}`,"aria-hidden":"true"}),(0,n.jsxs)("span",{className:"webhook-log-row-main",children:[(0,n.jsxs)("span",{className:"webhook-log-row-title",children:[(0,n.jsx)("strong",{children:I.get(l.connectorId||"")||l.connectorId||e("webhookLogs.unknownConnector")}),(0,n.jsx)("code",{children:l.request?.method||"POST"})]}),(0,n.jsxs)("span",{className:"webhook-log-row-meta",children:[(0,n.jsx)("span",{children:Ie(l.createdAt)}),(0,n.jsx)("span",{children:l.errorCode||l.action})]})]}),(0,n.jsxs)("span",{className:"webhook-log-row-result",children:[(0,n.jsx)("b",{className:l.status,children:l.response?.httpStatus??(l.status==="ok"?"2xx":"ERR")}),(0,n.jsx)("small",{children:de(l.response?.durationMs)})]})]},`${l.triggerId}-${l.createdAt}`)})}),q?(0,n.jsx)("button",{type:"button",className:"ghost webhook-log-more",disabled:M,onClick:()=>{O(!0)},children:e("webhookLogs.loadMore")}):null]}),(0,n.jsx)("article",{className:"card webhook-log-detail-panel",children:u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("header",{className:"webhook-log-detail-head",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:`webhook-log-result-pill ${u.status}`,children:u.status==="ok"?e("webhookLogs.success"):e("webhookLogs.failed")}),(0,n.jsx)("h2",{children:I.get(u.connectorId||"")||u.connectorId||e("webhookLogs.unknownConnector")}),(0,n.jsxs)("p",{children:[Ie(u.createdAt)," \xB7 ",u.request?.method||"POST"," ",u.request?.path||"/webhook/\u2026"]})]}),(0,n.jsx)("button",{type:"button",className:"ghost",onClick:()=>{he()},children:e(X?"webhookLogs.copied":"webhookLogs.copyJson")})]}),u.error?(0,n.jsxs)("div",{className:"webhook-log-failure",children:[(0,n.jsx)("strong",{children:u.errorCode||e("webhookLogs.failureReason")}),(0,n.jsx)("span",{children:u.error})]}):null,(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.overview")}),(0,n.jsxs)("dl",{className:"webhook-log-facts",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.httpStatus")}),(0,n.jsx)("dd",{children:u.response?.httpStatus??"\u2014"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.duration")}),(0,n.jsx)("dd",{children:de(u.response?.durationMs)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.action")}),(0,n.jsx)("dd",{children:u.action})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.bodySize")}),(0,n.jsx)("dd",{children:Oe(u.request?.bodyBytes)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"Trigger ID"}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.triggerId})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"Request ID"}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.requestId||"\u2014"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.remoteAddress")}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.request?.remoteAddress||"\u2014"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.target")}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.target?.chatId||u.target?.sessionId||u.response?.chatId||"\u2014"})})]})]})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.queryParams")}),(0,n.jsx)(ke,{value:u.request?.query,empty:e("webhookLogs.none")})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsxs)("h3",{children:[e("webhookLogs.headers"),(0,n.jsx)("small",{children:e("webhookLogs.redacted")})]}),(0,n.jsx)(ke,{value:u.request?.headers,empty:e("webhookLogs.headersNotStored")})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsxs)("h3",{children:[e("webhookLogs.payload"),(0,n.jsx)("small",{children:e("webhookLogs.redacted")})]}),u.request?.payloadStored?(0,n.jsx)(ke,{value:u.request.payload,empty:e("webhookLogs.none")}):(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:pe})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.routeTarget")}),(0,n.jsx)(Ae,{value:u.target})]})]}):(0,n.jsx)("div",{className:"webhook-log-empty",children:(0,n.jsx)("strong",{children:e("webhookLogs.selectRecord")})})})]})]});return t.embedded?(0,n.jsx)("section",{className:"webhook-logs-content webhook-logs-panel",children:j}):(0,n.jsx)("section",{className:"page webhook-logs-content webhook-logs-page",children:j})}var o=K(se(),1);function He(t,e){return t.map(a=>a.id===e.id?e:a)}var Pe={name:"",botId:"",kind:"turn",workflowId:"",mode:"dynamic",chatId:"",manualChat:!1,manualChatId:"",allowChats:[],deduplicate:!1,dedup:"",instruction:"",verify:"token",secret:"",storePayload:!0};function eo(t,e){return{promptEnvelope:{sourceName:t.promptEnvelope?.sourceName||t.name,instruction:e}}}function qe(t){return[{value:"turn",label:t("connectors.kindTurn")},{value:"workflow",label:t("connectors.kindWorkflowRetiring"),disabled:!0}]}function Ce(t){return`${location.origin}/webhook/${encodeURIComponent(t)}`}function ge(t){return(0,o.jsx)(ie,{id:t.id,className:"connector-form-menu",ariaLabel:t.label,value:t.value,label:le(t.options,t.value),options:t.options,onChange:t.onChange})}function Se(t){let e=(0,c.useRef)(null),[a,m]=(0,c.useState)(!1),[k,N]=(0,c.useState)(""),p=Array.isArray(t.value)?t.value:t.value?[t.value]:[],L=(0,c.useMemo)(()=>new Set(p),[p]),f=k.trim().toLocaleLowerCase(),D=(0,c.useMemo)(()=>f?t.groups.filter(d=>`${d.name} ${d.chatId}`.toLocaleLowerCase().includes(f)):t.groups,[f,t.groups]),v=t.multiple?p.length===0?t.allLabel||t.placeholder:t.selectedCountLabel(p.length):t.groups.find(d=>d.chatId===p[0])?.name||p[0]||t.placeholder;(0,c.useEffect)(()=>{if(!a)return;let d=s=>{e.current?.contains(s.target)||m(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[a]);function $(d){if(!t.multiple){t.onChange(d),m(!1),N("");return}t.onChange(L.has(d)?p.filter(s=>s!==d):[...p,d])}return(0,o.jsxs)("div",{ref:e,className:`connector-group-picker${a?" open":""}`,children:[(0,o.jsxs)("button",{id:t.id,type:"button",className:"connector-group-picker-trigger","aria-label":t.label,"aria-haspopup":"listbox","aria-expanded":a,onClick:()=>m(d=>!d),children:[(0,o.jsx)("span",{className:p.length||t.multiple&&t.allLabel?"":"muted",children:v}),(0,o.jsx)("span",{className:"connector-group-picker-chevron","aria-hidden":"true"})]}),a?(0,o.jsxs)("div",{className:"connector-group-picker-popover",children:[(0,o.jsxs)("label",{className:"connector-group-search",htmlFor:`${t.id}-search`,children:[(0,o.jsx)("span",{className:"connector-group-search-icon","aria-hidden":"true"}),(0,o.jsx)("input",{id:`${t.id}-search`,type:"search",autoComplete:"off",autoFocus:!0,value:k,placeholder:t.searchPlaceholder,onChange:d=>N(d.currentTarget.value),onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),m(!1))}})]}),(0,o.jsxs)("div",{className:"connector-group-options",role:"listbox","aria-label":t.label,"aria-multiselectable":t.multiple||void 0,children:[t.multiple&&t.allLabel&&!f?(0,o.jsxs)("button",{type:"button",className:`connector-group-option connector-group-option-all${p.length===0?" selected":""}`,role:"option","aria-selected":p.length===0,onClick:()=>t.onChange([]),children:[(0,o.jsx)("span",{className:"connector-group-check","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:t.allLabel}),(0,o.jsx)("small",{children:t.placeholder})]})]}):null,D.map(d=>{let s=L.has(d.chatId);return(0,o.jsxs)("button",{type:"button",className:`connector-group-option${s?" selected":""}`,role:"option","aria-selected":s,onClick:()=>$(d.chatId),children:[(0,o.jsx)("span",{className:"connector-group-check","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:d.name||d.chatId}),d.name?(0,o.jsx)("small",{children:d.chatId}):null]})]},d.chatId)}),D.length?null:(0,o.jsx)("p",{className:"connector-group-empty",children:t.emptyLabel})]})]}):null]})}function me(t,e){return t.filter(a=>a.bots.includes(e))}function Be(t,e){let a=t.target.chatId||"",m=a&&me(e,t.target.botId).some(k=>k.chatId===a);return{name:t.name,botId:t.target.botId,kind:t.target.kind,workflowId:t.target.workflowId||"",mode:t.target.mode,chatId:m?a:"",manualChat:!!(a&&!m),manualChatId:m?"":a,allowChats:t.target.allowChats||[],deduplicate:!!t.lifecycleExtractors?.dedupKey,dedup:t.lifecycleExtractors?.dedupKey||"",instruction:t.promptEnvelope?.instruction||"",verify:t.verify?.type||"token",secret:"",storePayload:t.loggingPolicy?.storePayload!==!1}}function Ge(t){let e=W(),a=t.active==="webhooks",m=t.active==="logs";return(0,o.jsxs)("nav",{className:"connectors-subnav-slot connectors-subnav insight-tabs",role:"tablist","aria-label":e("nav.connectors"),children:[(0,o.jsx)("a",{href:"#/connectors",className:`itab${a?" on":""}`,role:"tab","aria-selected":a,children:e("connectors.tabWebhooks")}),(0,o.jsx)("a",{href:"#/connectors/logs",className:`itab${m?" on":""}`,role:"tab","aria-selected":m,children:e("connectors.tabLogs")})]})}function xe(t){let e=W(),a=(0,c.useRef)(!1),m=(0,c.useRef)(null),k=(0,c.useRef)(null),[N,p]=(0,c.useState)([]),[L,f]=(0,c.useState)([]),[D,v]=(0,c.useState)([]),[$,d]=(0,c.useState)(!0),[s,M]=(0,c.useState)(Pe),[_,C]=(0,c.useState)(null),[U,q]=(0,c.useState)(null),[J,V]=(0,c.useState)(!1),[Y,B]=(0,c.useState)(!1),[T,X]=(0,c.useState)(null),[Z,I]=(0,c.useState)(null),[u,ee]=(0,c.useState)(null),G=(0,c.useMemo)(()=>me(L,s.botId),[L,s.botId]),be=(0,c.useMemo)(()=>N.length?N.map(r=>({value:r.larkAppId,label:r.botName})):[{value:"",label:e("connectors.noOnlineBots")}],[N,e]),O=(0,c.useMemo)(()=>qe(e),[e]),he=(0,c.useMemo)(()=>[{value:"dynamic",label:e("connectors.modeDynamic")},{value:"fixed",label:e("connectors.modeFixed")},{value:"new-group",label:e("connectors.modeNewGroup")}],[e]),pe=(0,c.useMemo)(()=>[{value:"token",label:e("connectors.verifyToken")},{value:"hmac-sha256",label:e("connectors.verifyHmac")}],[e]),j=(0,c.useCallback)(r=>L.find(g=>g.chatId===r)?.name||r,[L]),l=(0,c.useCallback)((r,i)=>{M(g=>{let h=g.botId&&r.some(R=>R.larkAppId===g.botId)?g.botId:r[0]?.larkAppId??"",E=me(i,h),F=g.chatId&&E.some(R=>R.chatId===g.chatId)?g.chatId:E[0]?.chatId??"",A=new Set(E.map(R=>R.chatId));return{...g,botId:h,chatId:F,allowChats:g.allowChats.filter(R=>A.has(R))}})},[]),w=(0,c.useCallback)(async()=>{d(!0);try{let[r,i,g]=await Promise.all([H("/api/bots"),H("/api/connectors"),H("/api/groups")]);if(!a.current)return;let h=(r.body?.bots||[]).map(F=>({larkAppId:F.larkAppId,botName:F.botName||F.larkAppId})),E=(g.body?.chats||[]).map(F=>({chatId:F.chatId,name:F.name||"",bots:(F.memberBots||[]).filter(A=>A.inChat).map(A=>A.larkAppId)}));p(h),f(E),v(Array.isArray(i.body?.connectors)?i.body.connectors:[]),l(h,E)}finally{a.current&&d(!1)}},[l]);(0,c.useEffect)(()=>(a.current=!0,w(),()=>{a.current=!1,m.current&&clearTimeout(m.current)}),[w]),(0,c.useEffect)(()=>{let r=new Set(G.map(i=>i.chatId));M(i=>({...i,chatId:i.chatId&&r.has(i.chatId)?i.chatId:G[0]?.chatId??"",allowChats:i.allowChats.filter(g=>r.has(g))}))},[G]),(0,c.useEffect)(()=>{let r=k.current;if(r)if(Y){if(!r.open)try{r.showModal()}catch{}let i=r.querySelector(".connector-modal-body");i&&(i.scrollTop=0)}else r.open&&r.close()},[Y]),(0,c.useEffect)(()=>()=>{let r=k.current;r?.open&&r.close()},[]);function z(r){return e(r==="fixed"?"connectors.modeLabelFixed":r==="new-group"?"connectors.modeLabelNewGroup":"connectors.modeLabelDynamic")}function oe(r){return e(r==="workflow"?"connectors.kindLabelWorkflow":"connectors.kindLabelTurn")}function y(r){M(i=>({...i,...r}))}function x(){C(null),q(null),X(null),M(r=>{let i=r.botId||N[0]?.larkAppId||"";return{...Pe,botId:i,chatId:me(L,i)[0]?.chatId||""}}),B(!0)}function te(r){C(null),q(null),I(null),X(r),M(Be(r,L)),B(!0)}function S(){J||(B(!1),C(null),q(null),X(null))}async function ne(){C(null),q(null);let r=s.name.trim(),i=s.botId;if(!r){C({text:e("connectors.errName"),error:!0});return}if(!i){C({text:e("connectors.errBot"),error:!0});return}if(s.kind==="workflow"){C({text:e("connectors.errLegacyWorkflowRetired"),error:!0});return}let g={name:r,enabled:T?.enabled??!0,target:{kind:s.kind,mode:s.mode,botId:i},promptEnvelope:{sourceName:r,instruction:s.instruction.trim()},verify:{type:s.verify},loggingPolicy:{storePayload:s.storePayload,storeHeaders:!0,retentionDays:14}};if(s.mode==="fixed"){let h=s.manualChat?s.manualChatId.trim():s.chatId;if(!h){C({text:e("connectors.errChat"),error:!0});return}g.target.chatId=h}else s.mode==="dynamic"&&(g.target.allowChats=s.allowChats);if(s.mode==="new-group"){let h=s.dedup.trim();if(s.deduplicate&&!h){C({text:e("connectors.errDedup"),error:!0});return}g.lifecycleExtractors=s.deduplicate?{dedupKey:h}:null}else g.lifecycleExtractors=null;s.secret.trim()&&(g.secret=s.secret.trim()),V(!0),C({text:e(T?"connectors.saving":"connectors.creating")});try{let h=await Q(T?"PUT":"POST",T?`/api/connectors/${encodeURIComponent(T.id)}`:"/api/connectors",g);if(!a.current)return;if((h.status===201||h.status===200)&&h.body?.ok){if(T){let ye=T.id;v(Ee=>He(Ee,h.body.connector)),I({id:ye,text:e("connectors.updated")}),B(!1),X(null);return}let E=h.body.webhookUrl||Ce(h.body.connector.id),F=(h.body.connector?.verify?.type??"token")==="token",A=s.mode==="dynamic",R=A?g.target.allowChats?.[0]||"<chatId>":"";C(null),q({name:r,mode:s.mode,chatId:g.target.chatId,url:E,secret:h.body.secret,isToken:F,isDynamic:A,exampleChat:R}),M(ye=>({...ye,name:"",workflowId:"",manualChatId:"",dedup:"",secret:"",instruction:"",allowChats:[],storePayload:!0})),await w()}else{let E=h.body?.error||h.status;C({text:e("connectors.createFailed",{error:String(E)}),error:!0})}}finally{a.current&&V(!1)}}async function ae(r){I({id:r.id,text:e(r.enabled?"connectors.disabling":"connectors.enabling")});let i=await Q("PATCH",`/api/connectors/${encodeURIComponent(r.id)}`,{enabled:!r.enabled});if(a.current)if(i.status===200&&i.body?.ok)I(null),await w();else{let g=i.body?.error||i.status;I({id:r.id,text:e("connectors.toggleFailed",{error:String(g)}),error:!0})}}async function fe(r){let i=r.loggingPolicy?.storePayload!==!1;I({id:r.id,text:e("connectors.saving")});let g=await Q("PUT",`/api/connectors/${encodeURIComponent(r.id)}`,{loggingPolicy:{storePayload:!i,storeHeaders:r.loggingPolicy?.storeHeaders!==!1,retentionDays:r.loggingPolicy?.retentionDays??14}});if(a.current)if(g.status===200&&g.body?.ok)I(null),await w();else{let h=g.body?.error||g.status;I({id:r.id,text:e("connectors.saveFailed",{error:String(h)}),error:!0})}}async function Fe(r){if(!confirm(e("connectors.delConfirm")))return;I({id:r.id,text:e("connectors.deleting")});let i=await Q("DELETE",`/api/connectors/${encodeURIComponent(r.id)}`);if(a.current)if(i.status===200&&i.body?.ok)I(null),await w();else{let g=i.body?.error||i.status;I({id:r.id,text:e("connectors.deleteFailed",{error:String(g)}),error:!0})}}function Me(r){navigator.clipboard?.writeText(Ce(r.id)),ee(r.id),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{a.current&&ee(null)},1200)}return(0,o.jsxs)("section",{className:"page connectors-page",children:[(0,o.jsxs)("div",{className:"page-heading",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"eyebrow",children:e("nav.connectors")}),(0,o.jsx)("h1",{children:e("nav.connectors")})]}),(0,o.jsx)("div",{className:"page-heading-actions",children:t.tab==="webhooks"?(0,o.jsx)(Le,{className:"page-primary-action connector-create-trigger",onClick:x,children:e("connectors.createTitle")}):(0,o.jsx)("a",{className:"button page-primary-action",href:"#/connectors",children:e("webhookLogs.manage")})})]}),(0,o.jsx)(Ge,{active:t.tab}),t.tab==="webhooks"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("dialog",{ref:k,className:"connector-create-modal",onCancel:r=>{r.preventDefault(),S()},onClose:S,onClick:r=>{r.target===r.currentTarget&&S()},children:(0,o.jsxs)("article",{className:"connector-modal-card",children:[(0,o.jsxs)("header",{className:"connector-modal-header",children:[(0,o.jsx)("h3",{children:e(T?"connectors.editTitle":"connectors.createTitle")}),(0,o.jsx)("button",{type:"button",className:"connector-modal-close","aria-label":e("connectors.close"),title:e("connectors.close"),disabled:J,onClick:S,children:(0,o.jsx)("span",{"aria-hidden":"true",children:"\xD7"})})]}),(0,o.jsx)("div",{className:"connector-modal-body",children:U?(0,o.jsx)(We,{created:U,groupName:j}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"cn-form",children:[(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-name",children:[(0,o.jsx)(P,{children:e("connectors.fName")}),(0,o.jsx)("input",{id:"cn-name",value:s.name,onChange:r=>y({name:r.currentTarget.value}),placeholder:e("connectors.fNamePh")})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fBot")}),(0,o.jsx)(ge,{id:"cn-bot",label:e("connectors.fBot"),value:s.botId,options:be,onChange:r=>y({botId:r})})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fKind")}),(0,o.jsx)(ge,{id:"cn-kind",label:e("connectors.fKind"),value:s.kind,options:O,onChange:r=>y({kind:r})})]}),s.kind==="workflow"?(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-wf",children:[(0,o.jsx)(P,{children:e("connectors.fWf")}),(0,o.jsx)("input",{id:"cn-wf",value:s.workflowId,onChange:r=>y({workflowId:r.currentTarget.value}),placeholder:"workflowId"})]}):null,(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fMode")}),(0,o.jsx)(ge,{id:"cn-mode",label:e("connectors.fMode"),value:s.mode,options:he,onChange:r=>y({mode:r})})]}),s.mode==="fixed"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide",children:[(0,o.jsx)(P,{children:e("connectors.fFixedChat")}),(0,o.jsxs)("div",{className:"connector-chat-control",children:[s.manualChat?(0,o.jsx)("input",{id:"cn-chat",value:s.manualChatId,onChange:r=>y({manualChatId:r.currentTarget.value}),placeholder:e("connectors.fChatManualPh")}):(0,o.jsx)(Se,{id:"cn-chat-sel",label:e("connectors.fFixedChat"),groups:G,value:s.chatId,placeholder:e("connectors.groupPickerPlaceholder"),searchPlaceholder:e("connectors.groupSearchPlaceholder"),emptyLabel:e("connectors.groupNoMatches"),selectedCountLabel:r=>e("connectors.groupSelectedCount",{count:r}),onChange:r=>y({chatId:r})}),(0,o.jsx)("button",{type:"button",className:"ghost connector-inline-link",onClick:()=>y({manualChat:!s.manualChat}),children:s.manualChat?e("connectors.chatListLink"):e("connectors.chatManualLink")})]})]}):s.mode==="dynamic"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide",children:[(0,o.jsxs)(P,{help:e("connectors.allowHint"),children:[e("connectors.fAllow"),(0,o.jsx)("span",{className:"muted cn-optional",children:e("connectors.optional")})]}),(0,o.jsx)(Se,{id:"cn-allow-chats",label:e("connectors.fAllow"),groups:G,value:s.allowChats,multiple:!0,allLabel:e("connectors.allowAll"),placeholder:e("connectors.allowAllHint"),searchPlaceholder:e("connectors.groupSearchPlaceholder"),emptyLabel:e("connectors.groupNoMatches"),selectedCountLabel:r=>e("connectors.groupSelectedCount",{count:r}),onChange:r=>y({allowChats:r})})]}):null,s.mode==="dynamic"?(0,o.jsx)("div",{className:"cn-field-wide",children:(0,o.jsx)("div",{className:"muted connector-form-hint",dangerouslySetInnerHTML:{__html:e("connectors.dynamicHint")}})}):null,s.mode==="new-group"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide connector-new-group-config",children:[(0,o.jsx)(P,{children:e("connectors.newGroupStrategy")}),(0,o.jsxs)("div",{className:"connector-strategy-options",role:"radiogroup","aria-label":e("connectors.newGroupStrategy"),children:[(0,o.jsxs)("button",{type:"button",role:"radio","aria-checked":!s.deduplicate,className:`connector-strategy-option${s.deduplicate?"":" selected"}`,onClick:()=>y({deduplicate:!1}),children:[(0,o.jsx)("span",{className:"connector-strategy-radio","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:e("connectors.newGroupFresh")}),(0,o.jsx)("small",{children:e("connectors.newGroupFreshHint")})]})]}),(0,o.jsxs)("button",{type:"button",role:"radio","aria-checked":s.deduplicate,className:`connector-strategy-option${s.deduplicate?" selected":""}`,onClick:()=>y({deduplicate:!0}),children:[(0,o.jsx)("span",{className:"connector-strategy-radio","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:e("connectors.newGroupReuse")}),(0,o.jsx)("small",{children:e("connectors.newGroupReuseHint")})]})]})]}),s.deduplicate?(0,o.jsxs)("label",{className:"connector-dedup-field",htmlFor:"cn-dedup",children:[(0,o.jsx)(P,{help:(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:e("connectors.dedupHint")}}),children:e("connectors.fDedup")}),(0,o.jsx)("input",{id:"cn-dedup",value:s.dedup,onChange:r=>y({dedup:r.currentTarget.value}),placeholder:e("connectors.fDedupPh")})]}):null,(0,o.jsx)("p",{className:"connector-new-group-note",children:e("connectors.newGroupNotice")})]}):null,(0,o.jsxs)("label",{className:"cn-field cn-field-wide",htmlFor:"cn-instruction",children:[(0,o.jsxs)(P,{help:e("connectors.fInstructionPh"),children:[e("connectors.fInstruction"),(0,o.jsx)("span",{className:"muted cn-optional",children:e("connectors.optional")})]}),(0,o.jsx)("textarea",{id:"cn-instruction",rows:3,value:s.instruction,onChange:r=>y({instruction:r.currentTarget.value}),placeholder:e("connectors.fInstructionPh")})]}),(0,o.jsxs)("label",{className:"connector-log-policy cn-field-wide",htmlFor:"cn-store-payload",children:[(0,o.jsx)("input",{id:"cn-store-payload",type:"checkbox",checked:s.storePayload,onChange:r=>y({storePayload:r.currentTarget.checked})}),(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:e("connectors.storePayload")}),(0,o.jsx)("small",{children:e("connectors.storePayloadHint")})]})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fVerify")}),(0,o.jsx)(ge,{id:"cn-verify",label:e("connectors.fVerify"),value:s.verify,options:pe,onChange:r=>y({verify:r})})]}),(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-secret",children:[(0,o.jsx)(P,{children:e("connectors.fSecret")}),(0,o.jsx)("input",{id:"cn-secret",value:s.secret,onChange:r=>y({secret:r.currentTarget.value}),placeholder:e(T?"connectors.fSecretEditPh":"connectors.fSecretPh")})]})]}),_?(0,o.jsx)("p",{className:`connector-create-message${_.error?" err":""}`,children:_.text}):null]})}),(0,o.jsxs)("footer",{className:"connector-modal-actions",children:[(0,o.jsx)("button",{type:"button",disabled:J,onClick:S,children:e("connectors.cancel")}),U?(0,o.jsx)("button",{type:"button",className:"primary",onClick:S,children:e("connectors.close")}):(0,o.jsx)("button",{id:"cn-create",type:"button",className:"primary",disabled:J,onClick:()=>{ne()},children:e(T?"connectors.btnSave":"connectors.btnCreate")})]})]})}),(0,o.jsx)("section",{className:"overview-block connector-section connector-list-section",children:(0,o.jsx)("div",{className:"card connector-list-card",children:$?(0,o.jsx)(ce,{className:"connector-list-loading",label:e("connectors.loading"),compact:!0}):(0,o.jsx)(_e,{connectors:D,bots:N,copiedId:u,editMsg:Z,groupName:j,modeLabel:z,kindLabel:oe,onCopy:Me,onEdit:te,onToggle:r=>{ae(r)},onTogglePayloadLogging:r=>{fe(r)},onDelete:r=>{Fe(r)}})})})]}):(0,o.jsx)(Te,{embedded:!0})]})}function We(t){let e=W(),a=t.created,m=a.isDynamic?`${a.url}?chatId=${a.exampleChat}`:a.url,k=a.exampleChat!=="<chatId>"?`\uFF08${t.groupName(a.exampleChat)}\uFF09`:"";return(0,o.jsx)("div",{className:"connector-created-wrap",children:(0,o.jsxs)("div",{className:"card connector-created-card",children:[(0,o.jsxs)("p",{className:"connector-created-title ok",children:[e("connectors.createdPrefix",{name:a.name}),a.mode==="fixed"&&a.chatId?(0,o.jsxs)("span",{className:"muted",children:[" \xB7 ",e("connectors.createdDest",{name:t.groupName(a.chatId)})]}):null]}),(0,o.jsxs)("p",{className:"connector-created-line",children:[(0,o.jsx)("span",{className:"muted",children:e("connectors.webhookUrl")}),(0,o.jsx)("code",{children:a.url})]}),a.secret?(0,o.jsxs)("p",{className:"connector-created-line",children:[(0,o.jsxs)("span",{className:"muted",children:[a.isToken?e("connectors.tokenLabel"):e("connectors.signLabel"),e("connectors.secretOnce")]}),(0,o.jsx)("code",{children:a.secret})]}):null,a.isToken&&a.isDynamic?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"muted connector-created-help",children:e("connectors.usageDynamicLede",{gn:k})}),(0,o.jsx)("pre",{children:(0,o.jsx)("code",{children:`curl -X POST '${m}' -H 'content-type: application/json' -d '{}'`})}),(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageDynamicNote")}})]}):a.isToken?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"muted connector-created-help",children:e("connectors.usageTokenLede")}),(0,o.jsx)("pre",{children:(0,o.jsx)("code",{children:`curl -X POST '${m}' -H 'content-type: application/json' -d '{}'`})}),(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageTokenNote")}})]}):(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageHmac")+(a.isDynamic?e("connectors.usageHmacDynamic"):"")}})]})})}function _e(t){let e=W();return t.connectors.length?(0,o.jsx)(o.Fragment,{children:t.connectors.map(a=>{let m=t.bots.find(v=>v.larkAppId===a.target.botId),k=Ce(a.id),N=(a.verify?.type??"token")==="token",p=e(N?"connectors.badgeToken":"connectors.badgeSign"),L=a.target.mode==="fixed"&&a.target.chatId?e("connectors.dest",{name:t.groupName(a.target.chatId)}):"",f=t.editMsg?.id===a.id?t.editMsg:null,D=t.copiedId===a.id;return(0,o.jsxs)("div",{className:"card connector-item-card",children:[(0,o.jsxs)("div",{className:"connector-item-head",children:[(0,o.jsxs)("div",{className:"connector-item-main",children:[(0,o.jsxs)("div",{className:"connector-item-title",children:[(0,o.jsx)("b",{children:a.name}),(0,o.jsx)("span",{className:a.enabled?"connector-status-pill ok":"connector-status-pill muted",children:a.enabled?e("connectors.enabled"):e("connectors.disabled")})]}),(0,o.jsxs)("div",{className:"connector-item-meta",children:[(0,o.jsx)("span",{children:m?.botName||a.target.botId}),(0,o.jsx)("span",{children:t.kindLabel(a.target.kind)}),(0,o.jsx)("span",{children:t.modeLabel(a.target.mode)}),L?(0,o.jsx)("span",{children:L}):null,(0,o.jsx)("span",{children:p}),(0,o.jsx)("span",{children:a.loggingPolicy?.storePayload!==!1?e("connectors.payloadLogged",{days:a.loggingPolicy?.retentionDays??14}):e("connectors.metadataOnly")})]})]}),(0,o.jsx)("button",{className:`ghost connector-copy-button${D?" copied":""}`,type:"button",onClick:()=>t.onCopy(a),children:e(D?"connectors.copied":"connectors.copy")})]}),(0,o.jsxs)("div",{className:"connector-url-row",children:[(0,o.jsx)("span",{className:"muted",children:e("connectors.webhookUrl")}),(0,o.jsxs)("code",{children:[k,N?"/<token>":""]})]}),N?(0,o.jsx)("div",{className:"muted connector-item-note",dangerouslySetInnerHTML:{__html:e("connectors.tokenHint")}}):null,a.target.kind==="workflow"?(0,o.jsx)("div",{className:"muted connector-item-note",children:e("connectors.legacyWorkflowNote")}):null,a.target.mode==="dynamic"?(0,o.jsx)("div",{className:"muted connector-item-note",dangerouslySetInnerHTML:{__html:e("connectors.dynamicReqHint")}}):null,a.promptEnvelope?.instruction?(0,o.jsxs)("div",{className:"muted connector-item-note",children:[e("connectors.instructionPrefix"),a.promptEnvelope.instruction]}):null,f?(0,o.jsx)("div",{className:f.error?"err connector-item-note":"muted connector-item-note",children:f.text}):null,(0,o.jsxs)("div",{className:"connector-item-actions",children:[(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onEdit(a),children:e("connectors.btnEdit")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onTogglePayloadLogging(a),children:a.loggingPolicy?.storePayload!==!1?e("connectors.btnDisablePayloadLog"):e("connectors.btnEnablePayloadLog")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onToggle(a),children:a.enabled?e("connectors.btnDisable"):e("connectors.btnEnable")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onDelete(a),children:e("connectors.btnDel")})]})]},a.id)})}):(0,o.jsx)("p",{className:"muted connector-list-empty",children:e("connectors.empty")})}function oo(t){return re(t,(0,o.jsx)(xe,{tab:"webhooks"}))}function to(t){return re(t,(0,o.jsx)(xe,{tab:"logs"}))}export{eo as buildConnectorInstructionUpdateBody,qe as buildConnectorKindOptions,to as renderConnectorsLogsPage,oo as renderConnectorsPage,He as replaceConnectorById};
|
|
1
|
+
import{a as H,b as Q}from"./chunk-EVK77ASG.js";import{b as W}from"./chunk-EIO5AWDA.js";import{a as le,c as ce,g as Le,k as P,p as ie}from"./chunk-I35DXGM4.js";import"./chunk-4QTBR7UF.js";import{a as re}from"./chunk-SYC6D5XU.js";import{a as Ne,d as se}from"./chunk-5THX4DI2.js";import{c as K}from"./chunk-7SZRL6FY.js";var c=K(Ne(),1);var b=K(Ne(),1);var n=K(se(),1),De=50,we={total:0,ok:0,error:0,successRate:0};function Re(t,e=Date.now()){if(t==="all")return;let a=t==="24h"?24:t==="7d"?168:720;return new Date(e-a*60*60*1e3).toISOString()}function $e(t,e=0){let a=new URLSearchParams({limit:String(De),offset:String(e)});t.connectorId&&a.set("connectorId",t.connectorId),t.status&&a.set("status",t.status);let m=Re(t.timeWindow);return m&&a.set("since",m),t.query.trim()&&a.set("q",t.query.trim()),a}function Ie(t){if(!t)return"\u2014";let e=new Date(t);return Number.isFinite(e.getTime())?e.toLocaleString():t}function de(t){return t===void 0||!Number.isFinite(t)?"\u2014":t<1e3?`${Math.round(t)} ms`:t<6e4?`${(t/1e3).toFixed(t<1e4?1:0)} s`:`${(t/6e4).toFixed(1)} min`}function Oe(t){return t===void 0?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function ke(t){return t.value===void 0||t.value===null?(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:t.empty}):typeof t.value=="object"&&!Array.isArray(t.value)&&Object.keys(t.value).length===0?(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:t.empty}):(0,n.jsx)("pre",{className:`webhook-log-json${t.fullHeight?" full-height":""}`,children:(0,n.jsx)("code",{children:JSON.stringify(t.value,null,2)})})}function Ae(t){let e=[["kind",t.value?.kind],["mode",t.value?.mode],["botId",t.value?.botId],["chatId",t.value?.chatId],["sessionId",t.value?.sessionId],["rootMessageId",t.value?.rootMessageId],["workflowId",t.value?.workflowId]].filter(([,a])=>a!=null&&a!=="");return e.length?(0,n.jsx)("dl",{className:"webhook-log-target-facts",children:e.map(([a,m])=>(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:a}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:String(m)})})]},a))}):(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:"\u2014"})}function ve(t){return(0,n.jsx)(ie,{id:t.id,className:"webhook-log-filter-menu",ariaLabel:t.label,style:{width:"100%",minWidth:0},value:t.value,label:le(t.options,t.value),options:t.options,onChange:t.onChange})}function ue(t){return(0,n.jsxs)("article",{className:`card webhook-log-metric${t.tone?` ${t.tone}`:""}`,children:[(0,n.jsx)("span",{children:t.label}),(0,n.jsx)("strong",{children:t.value}),(0,n.jsx)("small",{children:t.hint||"\xA0"})]})}function Te(t={}){let e=W(),a=(0,b.useRef)(!1),m=(0,b.useRef)([]),[k,N]=(0,b.useState)([]),[p,L]=(0,b.useState)([]),[f,D]=(0,b.useState)(we),[v,$]=(0,b.useState)({connectorId:"",status:"",timeWindow:"7d",query:""}),[d,s]=(0,b.useState)(null),[M,_]=(0,b.useState)(!0),[C,U]=(0,b.useState)(!1),[q,J]=(0,b.useState)(!1),[V,Y]=(0,b.useState)(0),[B,T]=(0,b.useState)(""),[X,Z]=(0,b.useState)(!1),I=(0,b.useMemo)(()=>new Map(k.map(l=>[l.id,l.name])),[k]),u=(0,b.useMemo)(()=>p.find(l=>l.triggerId===d)??p[0]??null,[p,d]),ee=(0,b.useMemo)(()=>[{value:"",label:e("webhookLogs.allConnectors")},...k.map(l=>({value:l.id,label:l.name}))],[k,e]),G=(0,b.useMemo)(()=>[{value:"",label:e("webhookLogs.allStatuses")},{value:"ok",label:e("webhookLogs.success")},{value:"error",label:e("webhookLogs.failed")}],[e]),be=(0,b.useMemo)(()=>[{value:"24h",label:e("webhookLogs.last24h")},{value:"7d",label:e("webhookLogs.last7d")},{value:"30d",label:e("webhookLogs.last30d")},{value:"all",label:e("webhookLogs.allTime")}],[e]),O=(0,b.useCallback)(async(l=!1,w=!1)=>{w?U(!0):_(!0),T("");let z=l?m.current.length:0,oe=$e(v,z),y=new URLSearchParams(oe);y.delete("limit"),y.delete("offset");try{let[x,te]=await Promise.all([H(`/api/trigger-logs?${oe}`),l?Promise.resolve(null):H(`/api/trigger-logs/summary?${y}`)]);if(!a.current)return;if(x.status!==200)throw new Error(String(x.body?.error||x.status));let S=Array.isArray(x.body?.logs)?x.body.logs:[],ne=l?[...m.current,...S]:S;m.current=ne,L(ne),Y(Number(x.body?.total??S.length)),J(x.body?.hasMore===!0),l||(D(te?.status===200?te.body?.summary??we:we),s(ae=>S.some(fe=>fe.triggerId===ae)?ae:S[0]?.triggerId??null))}catch(x){a.current&&T(x?.message||e("webhookLogs.loadFailed"))}finally{a.current&&(_(!1),U(!1))}},[v,e]);(0,b.useEffect)(()=>(a.current=!0,H("/api/connectors").then(l=>{a.current&&l.status===200&&N(Array.isArray(l.body?.connectors)?l.body.connectors:[])}),()=>{a.current=!1}),[]),(0,b.useEffect)(()=>{let l=setTimeout(()=>{O(!1)},v.query?260:0);return()=>clearTimeout(l)},[v,O]),(0,b.useEffect)(()=>{let l=setInterval(()=>{O(!1,!0)},15e3);return()=>clearInterval(l)},[O]);async function he(){u&&(await navigator.clipboard?.writeText(JSON.stringify(u,null,2)),Z(!0),setTimeout(()=>a.current&&Z(!1),1200))}let pe=u?.request?.payloadOmittedReason==="disabled"?e("webhookLogs.payloadDisabled"):u?.request?.payloadOmittedReason==="too_large"?e("webhookLogs.payloadTooLarge"):e("webhookLogs.payloadUnavailable"),j=(0,n.jsxs)(n.Fragment,{children:[t.embedded?null:(0,n.jsxs)("div",{className:"page-heading",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"eyebrow",children:e("nav.connectors")}),(0,n.jsx)("h1",{children:e("nav.webhookLogs")}),(0,n.jsx)("p",{className:"webhook-log-heading-copy",children:e("webhookLogs.subtitle")})]}),(0,n.jsxs)("div",{className:"page-heading-actions",children:[(0,n.jsxs)("span",{className:`webhook-log-live${C?" refreshing":""}`,children:[(0,n.jsx)("i",{}),e("webhookLogs.autoRefresh")]}),(0,n.jsx)("a",{className:"button page-primary-action",href:"#/connectors",children:e("webhookLogs.manage")})]})]}),(0,n.jsxs)("section",{className:"webhook-log-metrics","aria-label":e("webhookLogs.summary"),children:[(0,n.jsx)(ue,{label:e("webhookLogs.total"),value:f.total,hint:e("webhookLogs.filteredRange")}),(0,n.jsx)(ue,{label:e("webhookLogs.successRate"),value:`${f.successRate.toFixed(f.successRate%1?1:0)}%`,tone:"ok",hint:`${f.ok} ${e("webhookLogs.calls")}`}),(0,n.jsx)(ue,{label:e("webhookLogs.failures"),value:f.error,tone:f.error?"error":void 0,hint:f.error?e("webhookLogs.needsReview"):e("webhookLogs.noFailures")}),(0,n.jsx)(ue,{label:e("webhookLogs.p95"),value:de(f.p95DurationMs),hint:`${e("webhookLogs.average")} ${de(f.avgDurationMs)}`})]}),(0,n.jsxs)("form",{className:"filters dashboard-toolbar webhook-log-toolbar",onSubmit:l=>l.preventDefault(),children:[(0,n.jsx)("input",{type:"search",name:"q","aria-label":e("webhookLogs.search"),placeholder:e("webhookLogs.searchPlaceholder"),value:v.query,onChange:l=>{let w=l.currentTarget.value;$(z=>({...z,query:w}))}}),(0,n.jsx)(ve,{id:"webhook-log-connector",label:e("webhookLogs.connector"),value:v.connectorId,options:ee,onChange:l=>$(w=>({...w,connectorId:l}))}),(0,n.jsx)(ve,{id:"webhook-log-status",label:e("webhookLogs.status"),value:v.status,options:G,onChange:l=>$(w=>({...w,status:l}))}),(0,n.jsx)(ve,{id:"webhook-log-window",label:e("webhookLogs.timeRange"),value:v.timeWindow,options:be,onChange:l=>$(w=>({...w,timeWindow:l}))}),(0,n.jsx)("button",{type:"button",className:"ghost webhook-log-refresh",disabled:C,onClick:()=>{O(!1,!0)},children:e("webhookLogs.refresh")})]}),B?(0,n.jsxs)("p",{className:"err webhook-log-error",children:[e("webhookLogs.loadFailed"),": ",B]}):null,(0,n.jsxs)("section",{className:"webhook-log-workspace",children:[(0,n.jsxs)("article",{className:"card webhook-log-list-panel",children:[(0,n.jsx)("header",{className:"webhook-log-panel-head",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e("webhookLogs.records")}),(0,n.jsx)("span",{children:e("webhookLogs.matching",{count:V})})]})}),M&&!p.length?(0,n.jsx)(ce,{label:e("webhookLogs.loading"),compact:!0}):null,!M&&!p.length?(0,n.jsxs)("div",{className:"webhook-log-empty",children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"\u25CE"}),(0,n.jsx)("strong",{children:e("webhookLogs.empty")}),(0,n.jsx)("p",{children:e("webhookLogs.emptyHint")})]}):null,(0,n.jsx)("div",{className:"webhook-log-list",role:"listbox","aria-label":e("webhookLogs.records"),children:p.map(l=>{let w=u?.triggerId===l.triggerId;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":w,className:`webhook-log-row${w?" active":""}`,onClick:()=>s(l.triggerId),children:[(0,n.jsx)("span",{className:`webhook-log-status-dot ${l.status}`,"aria-hidden":"true"}),(0,n.jsxs)("span",{className:"webhook-log-row-main",children:[(0,n.jsxs)("span",{className:"webhook-log-row-title",children:[(0,n.jsx)("strong",{children:I.get(l.connectorId||"")||l.connectorId||e("webhookLogs.unknownConnector")}),(0,n.jsx)("code",{children:l.request?.method||"POST"})]}),(0,n.jsxs)("span",{className:"webhook-log-row-meta",children:[(0,n.jsx)("span",{children:Ie(l.createdAt)}),(0,n.jsx)("span",{children:l.errorCode||l.action})]})]}),(0,n.jsxs)("span",{className:"webhook-log-row-result",children:[(0,n.jsx)("b",{className:l.status,children:l.response?.httpStatus??(l.status==="ok"?"2xx":"ERR")}),(0,n.jsx)("small",{children:de(l.response?.durationMs)})]})]},`${l.triggerId}-${l.createdAt}`)})}),q?(0,n.jsx)("button",{type:"button",className:"ghost webhook-log-more",disabled:M,onClick:()=>{O(!0)},children:e("webhookLogs.loadMore")}):null]}),(0,n.jsx)("article",{className:"card webhook-log-detail-panel",children:u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("header",{className:"webhook-log-detail-head",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:`webhook-log-result-pill ${u.status}`,children:u.status==="ok"?e("webhookLogs.success"):e("webhookLogs.failed")}),(0,n.jsx)("h2",{children:I.get(u.connectorId||"")||u.connectorId||e("webhookLogs.unknownConnector")}),(0,n.jsxs)("p",{children:[Ie(u.createdAt)," \xB7 ",u.request?.method||"POST"," ",u.request?.path||"/webhook/\u2026"]})]}),(0,n.jsx)("button",{type:"button",className:"ghost",onClick:()=>{he()},children:e(X?"webhookLogs.copied":"webhookLogs.copyJson")})]}),u.error?(0,n.jsxs)("div",{className:"webhook-log-failure",children:[(0,n.jsx)("strong",{children:u.errorCode||e("webhookLogs.failureReason")}),(0,n.jsx)("span",{children:u.error})]}):null,(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.overview")}),(0,n.jsxs)("dl",{className:"webhook-log-facts",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.httpStatus")}),(0,n.jsx)("dd",{children:u.response?.httpStatus??"\u2014"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.duration")}),(0,n.jsx)("dd",{children:de(u.response?.durationMs)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.action")}),(0,n.jsx)("dd",{children:u.action})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.bodySize")}),(0,n.jsx)("dd",{children:Oe(u.request?.bodyBytes)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"Trigger ID"}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.triggerId})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"Request ID"}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.requestId||"\u2014"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.remoteAddress")}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.request?.remoteAddress||"\u2014"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:e("webhookLogs.target")}),(0,n.jsx)("dd",{children:(0,n.jsx)("code",{children:u.target?.chatId||u.target?.sessionId||u.response?.chatId||"\u2014"})})]})]})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.queryParams")}),(0,n.jsx)(ke,{value:u.request?.query,empty:e("webhookLogs.none")})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsxs)("h3",{children:[e("webhookLogs.headers"),(0,n.jsx)("small",{children:e("webhookLogs.redacted")})]}),(0,n.jsx)(ke,{value:u.request?.headers,empty:e("webhookLogs.headersNotStored")})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsxs)("h3",{children:[e("webhookLogs.payload"),(0,n.jsx)("small",{children:e("webhookLogs.redacted")})]}),u.request?.payloadStored?(0,n.jsx)(ke,{value:u.request.payload,empty:e("webhookLogs.none")}):(0,n.jsx)("p",{className:"webhook-log-detail-empty",children:pe})]}),(0,n.jsxs)("section",{className:"webhook-log-detail-section",children:[(0,n.jsx)("h3",{children:e("webhookLogs.routeTarget")}),(0,n.jsx)(Ae,{value:u.target})]})]}):(0,n.jsx)("div",{className:"webhook-log-empty",children:(0,n.jsx)("strong",{children:e("webhookLogs.selectRecord")})})})]})]});return t.embedded?(0,n.jsx)("section",{className:"webhook-logs-content webhook-logs-panel",children:j}):(0,n.jsx)("section",{className:"page webhook-logs-content webhook-logs-page",children:j})}var o=K(se(),1);function He(t,e){return t.map(a=>a.id===e.id?e:a)}var Pe={name:"",botId:"",kind:"turn",workflowId:"",mode:"dynamic",chatId:"",manualChat:!1,manualChatId:"",allowChats:[],deduplicate:!1,dedup:"",instruction:"",verify:"token",secret:"",storePayload:!0};function eo(t,e){return{promptEnvelope:{sourceName:t.promptEnvelope?.sourceName||t.name,instruction:e}}}function qe(t){return[{value:"turn",label:t("connectors.kindTurn")},{value:"workflow",label:t("connectors.kindWorkflowRetiring"),disabled:!0}]}function Ce(t){return`${location.origin}/webhook/${encodeURIComponent(t)}`}function ge(t){return(0,o.jsx)(ie,{id:t.id,className:"connector-form-menu",ariaLabel:t.label,value:t.value,label:le(t.options,t.value),options:t.options,onChange:t.onChange})}function Se(t){let e=(0,c.useRef)(null),[a,m]=(0,c.useState)(!1),[k,N]=(0,c.useState)(""),p=Array.isArray(t.value)?t.value:t.value?[t.value]:[],L=(0,c.useMemo)(()=>new Set(p),[p]),f=k.trim().toLocaleLowerCase(),D=(0,c.useMemo)(()=>f?t.groups.filter(d=>`${d.name} ${d.chatId}`.toLocaleLowerCase().includes(f)):t.groups,[f,t.groups]),v=t.multiple?p.length===0?t.allLabel||t.placeholder:t.selectedCountLabel(p.length):t.groups.find(d=>d.chatId===p[0])?.name||p[0]||t.placeholder;(0,c.useEffect)(()=>{if(!a)return;let d=s=>{e.current?.contains(s.target)||m(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[a]);function $(d){if(!t.multiple){t.onChange(d),m(!1),N("");return}t.onChange(L.has(d)?p.filter(s=>s!==d):[...p,d])}return(0,o.jsxs)("div",{ref:e,className:`connector-group-picker${a?" open":""}`,children:[(0,o.jsxs)("button",{id:t.id,type:"button",className:"connector-group-picker-trigger","aria-label":t.label,"aria-haspopup":"listbox","aria-expanded":a,onClick:()=>m(d=>!d),children:[(0,o.jsx)("span",{className:p.length||t.multiple&&t.allLabel?"":"muted",children:v}),(0,o.jsx)("span",{className:"connector-group-picker-chevron","aria-hidden":"true"})]}),a?(0,o.jsxs)("div",{className:"connector-group-picker-popover",children:[(0,o.jsxs)("label",{className:"connector-group-search",htmlFor:`${t.id}-search`,children:[(0,o.jsx)("span",{className:"connector-group-search-icon","aria-hidden":"true"}),(0,o.jsx)("input",{id:`${t.id}-search`,type:"search",autoComplete:"off",autoFocus:!0,value:k,placeholder:t.searchPlaceholder,onChange:d=>N(d.currentTarget.value),onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),m(!1))}})]}),(0,o.jsxs)("div",{className:"connector-group-options",role:"listbox","aria-label":t.label,"aria-multiselectable":t.multiple||void 0,children:[t.multiple&&t.allLabel&&!f?(0,o.jsxs)("button",{type:"button",className:`connector-group-option connector-group-option-all${p.length===0?" selected":""}`,role:"option","aria-selected":p.length===0,onClick:()=>t.onChange([]),children:[(0,o.jsx)("span",{className:"connector-group-check","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:t.allLabel}),(0,o.jsx)("small",{children:t.placeholder})]})]}):null,D.map(d=>{let s=L.has(d.chatId);return(0,o.jsxs)("button",{type:"button",className:`connector-group-option${s?" selected":""}`,role:"option","aria-selected":s,onClick:()=>$(d.chatId),children:[(0,o.jsx)("span",{className:"connector-group-check","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:d.name||d.chatId}),d.name?(0,o.jsx)("small",{children:d.chatId}):null]})]},d.chatId)}),D.length?null:(0,o.jsx)("p",{className:"connector-group-empty",children:t.emptyLabel})]})]}):null]})}function me(t,e){return t.filter(a=>a.bots.includes(e))}function Be(t,e){let a=t.target.chatId||"",m=a&&me(e,t.target.botId).some(k=>k.chatId===a);return{name:t.name,botId:t.target.botId,kind:t.target.kind,workflowId:t.target.workflowId||"",mode:t.target.mode,chatId:m?a:"",manualChat:!!(a&&!m),manualChatId:m?"":a,allowChats:t.target.allowChats||[],deduplicate:!!t.lifecycleExtractors?.dedupKey,dedup:t.lifecycleExtractors?.dedupKey||"",instruction:t.promptEnvelope?.instruction||"",verify:t.verify?.type||"token",secret:"",storePayload:t.loggingPolicy?.storePayload!==!1}}function Ge(t){let e=W(),a=t.active==="webhooks",m=t.active==="logs";return(0,o.jsxs)("nav",{className:"connectors-subnav-slot connectors-subnav insight-tabs",role:"tablist","aria-label":e("nav.connectors"),children:[(0,o.jsx)("a",{href:"#/connectors",className:`itab${a?" on":""}`,role:"tab","aria-selected":a,children:e("connectors.tabWebhooks")}),(0,o.jsx)("a",{href:"#/connectors/logs",className:`itab${m?" on":""}`,role:"tab","aria-selected":m,children:e("connectors.tabLogs")})]})}function xe(t){let e=W(),a=(0,c.useRef)(!1),m=(0,c.useRef)(null),k=(0,c.useRef)(null),[N,p]=(0,c.useState)([]),[L,f]=(0,c.useState)([]),[D,v]=(0,c.useState)([]),[$,d]=(0,c.useState)(!0),[s,M]=(0,c.useState)(Pe),[_,C]=(0,c.useState)(null),[U,q]=(0,c.useState)(null),[J,V]=(0,c.useState)(!1),[Y,B]=(0,c.useState)(!1),[T,X]=(0,c.useState)(null),[Z,I]=(0,c.useState)(null),[u,ee]=(0,c.useState)(null),G=(0,c.useMemo)(()=>me(L,s.botId),[L,s.botId]),be=(0,c.useMemo)(()=>N.length?N.map(r=>({value:r.larkAppId,label:r.botName})):[{value:"",label:e("connectors.noOnlineBots")}],[N,e]),O=(0,c.useMemo)(()=>qe(e),[e]),he=(0,c.useMemo)(()=>[{value:"dynamic",label:e("connectors.modeDynamic")},{value:"fixed",label:e("connectors.modeFixed")},{value:"new-group",label:e("connectors.modeNewGroup")}],[e]),pe=(0,c.useMemo)(()=>[{value:"token",label:e("connectors.verifyToken")},{value:"hmac-sha256",label:e("connectors.verifyHmac")}],[e]),j=(0,c.useCallback)(r=>L.find(g=>g.chatId===r)?.name||r,[L]),l=(0,c.useCallback)((r,i)=>{M(g=>{let h=g.botId&&r.some(R=>R.larkAppId===g.botId)?g.botId:r[0]?.larkAppId??"",E=me(i,h),F=g.chatId&&E.some(R=>R.chatId===g.chatId)?g.chatId:E[0]?.chatId??"",A=new Set(E.map(R=>R.chatId));return{...g,botId:h,chatId:F,allowChats:g.allowChats.filter(R=>A.has(R))}})},[]),w=(0,c.useCallback)(async()=>{d(!0);try{let[r,i,g]=await Promise.all([H("/api/bots"),H("/api/connectors"),H("/api/groups")]);if(!a.current)return;let h=(r.body?.bots||[]).map(F=>({larkAppId:F.larkAppId,botName:F.botName||F.larkAppId})),E=(g.body?.chats||[]).map(F=>({chatId:F.chatId,name:F.name||"",bots:(F.memberBots||[]).filter(A=>A.inChat).map(A=>A.larkAppId)}));p(h),f(E),v(Array.isArray(i.body?.connectors)?i.body.connectors:[]),l(h,E)}finally{a.current&&d(!1)}},[l]);(0,c.useEffect)(()=>(a.current=!0,w(),()=>{a.current=!1,m.current&&clearTimeout(m.current)}),[w]),(0,c.useEffect)(()=>{let r=new Set(G.map(i=>i.chatId));M(i=>({...i,chatId:i.chatId&&r.has(i.chatId)?i.chatId:G[0]?.chatId??"",allowChats:i.allowChats.filter(g=>r.has(g))}))},[G]),(0,c.useEffect)(()=>{let r=k.current;if(r)if(Y){if(!r.open)try{r.showModal()}catch{}let i=r.querySelector(".connector-modal-body");i&&(i.scrollTop=0)}else r.open&&r.close()},[Y]),(0,c.useEffect)(()=>()=>{let r=k.current;r?.open&&r.close()},[]);function z(r){return e(r==="fixed"?"connectors.modeLabelFixed":r==="new-group"?"connectors.modeLabelNewGroup":"connectors.modeLabelDynamic")}function oe(r){return e(r==="workflow"?"connectors.kindLabelWorkflow":"connectors.kindLabelTurn")}function y(r){M(i=>({...i,...r}))}function x(){C(null),q(null),X(null),M(r=>{let i=r.botId||N[0]?.larkAppId||"";return{...Pe,botId:i,chatId:me(L,i)[0]?.chatId||""}}),B(!0)}function te(r){C(null),q(null),I(null),X(r),M(Be(r,L)),B(!0)}function S(){J||(B(!1),C(null),q(null),X(null))}async function ne(){C(null),q(null);let r=s.name.trim(),i=s.botId;if(!r){C({text:e("connectors.errName"),error:!0});return}if(!i){C({text:e("connectors.errBot"),error:!0});return}if(s.kind==="workflow"){C({text:e("connectors.errLegacyWorkflowRetired"),error:!0});return}let g={name:r,enabled:T?.enabled??!0,target:{kind:s.kind,mode:s.mode,botId:i},promptEnvelope:{sourceName:r,instruction:s.instruction.trim()},verify:{type:s.verify},loggingPolicy:{storePayload:s.storePayload,storeHeaders:!0,retentionDays:14}};if(s.mode==="fixed"){let h=s.manualChat?s.manualChatId.trim():s.chatId;if(!h){C({text:e("connectors.errChat"),error:!0});return}g.target.chatId=h}else s.mode==="dynamic"&&(g.target.allowChats=s.allowChats);if(s.mode==="new-group"){let h=s.dedup.trim();if(s.deduplicate&&!h){C({text:e("connectors.errDedup"),error:!0});return}g.lifecycleExtractors=s.deduplicate?{dedupKey:h}:null}else g.lifecycleExtractors=null;s.secret.trim()&&(g.secret=s.secret.trim()),V(!0),C({text:e(T?"connectors.saving":"connectors.creating")});try{let h=await Q(T?"PUT":"POST",T?`/api/connectors/${encodeURIComponent(T.id)}`:"/api/connectors",g);if(!a.current)return;if((h.status===201||h.status===200)&&h.body?.ok){if(T){let ye=T.id;v(Ee=>He(Ee,h.body.connector)),I({id:ye,text:e("connectors.updated")}),B(!1),X(null);return}let E=h.body.webhookUrl||Ce(h.body.connector.id),F=(h.body.connector?.verify?.type??"token")==="token",A=s.mode==="dynamic",R=A?g.target.allowChats?.[0]||"<chatId>":"";C(null),q({name:r,mode:s.mode,chatId:g.target.chatId,url:E,secret:h.body.secret,isToken:F,isDynamic:A,exampleChat:R}),M(ye=>({...ye,name:"",workflowId:"",manualChatId:"",dedup:"",secret:"",instruction:"",allowChats:[],storePayload:!0})),await w()}else{let E=h.body?.error||h.status;C({text:e("connectors.createFailed",{error:String(E)}),error:!0})}}finally{a.current&&V(!1)}}async function ae(r){I({id:r.id,text:e(r.enabled?"connectors.disabling":"connectors.enabling")});let i=await Q("PATCH",`/api/connectors/${encodeURIComponent(r.id)}`,{enabled:!r.enabled});if(a.current)if(i.status===200&&i.body?.ok)I(null),await w();else{let g=i.body?.error||i.status;I({id:r.id,text:e("connectors.toggleFailed",{error:String(g)}),error:!0})}}async function fe(r){let i=r.loggingPolicy?.storePayload!==!1;I({id:r.id,text:e("connectors.saving")});let g=await Q("PUT",`/api/connectors/${encodeURIComponent(r.id)}`,{loggingPolicy:{storePayload:!i,storeHeaders:r.loggingPolicy?.storeHeaders!==!1,retentionDays:r.loggingPolicy?.retentionDays??14}});if(a.current)if(g.status===200&&g.body?.ok)I(null),await w();else{let h=g.body?.error||g.status;I({id:r.id,text:e("connectors.saveFailed",{error:String(h)}),error:!0})}}async function Fe(r){if(!confirm(e("connectors.delConfirm")))return;I({id:r.id,text:e("connectors.deleting")});let i=await Q("DELETE",`/api/connectors/${encodeURIComponent(r.id)}`);if(a.current)if(i.status===200&&i.body?.ok)I(null),await w();else{let g=i.body?.error||i.status;I({id:r.id,text:e("connectors.deleteFailed",{error:String(g)}),error:!0})}}function Me(r){navigator.clipboard?.writeText(Ce(r.id)),ee(r.id),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{a.current&&ee(null)},1200)}return(0,o.jsxs)("section",{className:"page connectors-page",children:[(0,o.jsxs)("div",{className:"page-heading",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"eyebrow",children:e("nav.connectors")}),(0,o.jsx)("h1",{children:e("nav.connectors")})]}),(0,o.jsx)("div",{className:"page-heading-actions",children:t.tab==="webhooks"?(0,o.jsx)(Le,{className:"page-primary-action connector-create-trigger",onClick:x,children:e("connectors.createTitle")}):(0,o.jsx)("a",{className:"button page-primary-action",href:"#/connectors",children:e("webhookLogs.manage")})})]}),(0,o.jsx)(Ge,{active:t.tab}),t.tab==="webhooks"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("dialog",{ref:k,className:"connector-create-modal",onCancel:r=>{r.preventDefault(),S()},onClose:S,onClick:r=>{r.target===r.currentTarget&&S()},children:(0,o.jsxs)("article",{className:"connector-modal-card",children:[(0,o.jsxs)("header",{className:"connector-modal-header",children:[(0,o.jsx)("h3",{children:e(T?"connectors.editTitle":"connectors.createTitle")}),(0,o.jsx)("button",{type:"button",className:"connector-modal-close","aria-label":e("connectors.close"),title:e("connectors.close"),disabled:J,onClick:S,children:(0,o.jsx)("span",{"aria-hidden":"true",children:"\xD7"})})]}),(0,o.jsx)("div",{className:"connector-modal-body",children:U?(0,o.jsx)(We,{created:U,groupName:j}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"cn-form",children:[(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-name",children:[(0,o.jsx)(P,{children:e("connectors.fName")}),(0,o.jsx)("input",{id:"cn-name",value:s.name,onChange:r=>y({name:r.currentTarget.value}),placeholder:e("connectors.fNamePh")})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fBot")}),(0,o.jsx)(ge,{id:"cn-bot",label:e("connectors.fBot"),value:s.botId,options:be,onChange:r=>y({botId:r})})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fKind")}),(0,o.jsx)(ge,{id:"cn-kind",label:e("connectors.fKind"),value:s.kind,options:O,onChange:r=>y({kind:r})})]}),s.kind==="workflow"?(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-wf",children:[(0,o.jsx)(P,{children:e("connectors.fWf")}),(0,o.jsx)("input",{id:"cn-wf",value:s.workflowId,onChange:r=>y({workflowId:r.currentTarget.value}),placeholder:"workflowId"})]}):null,(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fMode")}),(0,o.jsx)(ge,{id:"cn-mode",label:e("connectors.fMode"),value:s.mode,options:he,onChange:r=>y({mode:r})})]}),s.mode==="fixed"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide",children:[(0,o.jsx)(P,{children:e("connectors.fFixedChat")}),(0,o.jsxs)("div",{className:"connector-chat-control",children:[s.manualChat?(0,o.jsx)("input",{id:"cn-chat",value:s.manualChatId,onChange:r=>y({manualChatId:r.currentTarget.value}),placeholder:e("connectors.fChatManualPh")}):(0,o.jsx)(Se,{id:"cn-chat-sel",label:e("connectors.fFixedChat"),groups:G,value:s.chatId,placeholder:e("connectors.groupPickerPlaceholder"),searchPlaceholder:e("connectors.groupSearchPlaceholder"),emptyLabel:e("connectors.groupNoMatches"),selectedCountLabel:r=>e("connectors.groupSelectedCount",{count:r}),onChange:r=>y({chatId:r})}),(0,o.jsx)("button",{type:"button",className:"ghost connector-inline-link",onClick:()=>y({manualChat:!s.manualChat}),children:s.manualChat?e("connectors.chatListLink"):e("connectors.chatManualLink")})]})]}):s.mode==="dynamic"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide",children:[(0,o.jsxs)(P,{help:e("connectors.allowHint"),children:[e("connectors.fAllow"),(0,o.jsx)("span",{className:"muted cn-optional",children:e("connectors.optional")})]}),(0,o.jsx)(Se,{id:"cn-allow-chats",label:e("connectors.fAllow"),groups:G,value:s.allowChats,multiple:!0,allLabel:e("connectors.allowAll"),placeholder:e("connectors.allowAllHint"),searchPlaceholder:e("connectors.groupSearchPlaceholder"),emptyLabel:e("connectors.groupNoMatches"),selectedCountLabel:r=>e("connectors.groupSelectedCount",{count:r}),onChange:r=>y({allowChats:r})})]}):null,s.mode==="dynamic"?(0,o.jsx)("div",{className:"cn-field-wide",children:(0,o.jsx)("div",{className:"muted connector-form-hint",dangerouslySetInnerHTML:{__html:e("connectors.dynamicHint")}})}):null,s.mode==="new-group"?(0,o.jsxs)("div",{className:"cn-field cn-field-wide connector-new-group-config",children:[(0,o.jsx)(P,{children:e("connectors.newGroupStrategy")}),(0,o.jsxs)("div",{className:"connector-strategy-options",role:"radiogroup","aria-label":e("connectors.newGroupStrategy"),children:[(0,o.jsxs)("button",{type:"button",role:"radio","aria-checked":!s.deduplicate,className:`connector-strategy-option${s.deduplicate?"":" selected"}`,onClick:()=>y({deduplicate:!1}),children:[(0,o.jsx)("span",{className:"connector-strategy-radio","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:e("connectors.newGroupFresh")}),(0,o.jsx)("small",{children:e("connectors.newGroupFreshHint")})]})]}),(0,o.jsxs)("button",{type:"button",role:"radio","aria-checked":s.deduplicate,className:`connector-strategy-option${s.deduplicate?" selected":""}`,onClick:()=>y({deduplicate:!0}),children:[(0,o.jsx)("span",{className:"connector-strategy-radio","aria-hidden":"true"}),(0,o.jsxs)("span",{children:[(0,o.jsx)("b",{children:e("connectors.newGroupReuse")}),(0,o.jsx)("small",{children:e("connectors.newGroupReuseHint")})]})]})]}),s.deduplicate?(0,o.jsxs)("label",{className:"connector-dedup-field",htmlFor:"cn-dedup",children:[(0,o.jsx)(P,{help:(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:e("connectors.dedupHint")}}),children:e("connectors.fDedup")}),(0,o.jsx)("input",{id:"cn-dedup",value:s.dedup,onChange:r=>y({dedup:r.currentTarget.value}),placeholder:e("connectors.fDedupPh")})]}):null,(0,o.jsx)("p",{className:"connector-new-group-note",children:e("connectors.newGroupNotice")})]}):null,(0,o.jsxs)("label",{className:"cn-field cn-field-wide",htmlFor:"cn-instruction",children:[(0,o.jsxs)(P,{help:e("connectors.fInstructionPh"),children:[e("connectors.fInstruction"),(0,o.jsx)("span",{className:"muted cn-optional",children:e("connectors.optional")})]}),(0,o.jsx)("textarea",{id:"cn-instruction",rows:3,value:s.instruction,onChange:r=>y({instruction:r.currentTarget.value}),placeholder:e("connectors.fInstructionPh")})]}),(0,o.jsxs)("label",{className:"connector-log-policy cn-field-wide",htmlFor:"cn-store-payload",children:[(0,o.jsx)("input",{id:"cn-store-payload",type:"checkbox",checked:s.storePayload,onChange:r=>y({storePayload:r.currentTarget.checked})}),(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:e("connectors.storePayload")}),(0,o.jsx)("small",{children:e("connectors.storePayloadHint")})]})]}),(0,o.jsxs)("div",{className:"cn-field",children:[(0,o.jsx)(P,{children:e("connectors.fVerify")}),(0,o.jsx)(ge,{id:"cn-verify",label:e("connectors.fVerify"),value:s.verify,options:pe,onChange:r=>y({verify:r})})]}),(0,o.jsxs)("label",{className:"cn-field",htmlFor:"cn-secret",children:[(0,o.jsx)(P,{children:e("connectors.fSecret")}),(0,o.jsx)("input",{id:"cn-secret",value:s.secret,onChange:r=>y({secret:r.currentTarget.value}),placeholder:e(T?"connectors.fSecretEditPh":"connectors.fSecretPh")})]})]}),_?(0,o.jsx)("p",{className:`connector-create-message${_.error?" err":""}`,children:_.text}):null]})}),(0,o.jsxs)("footer",{className:"connector-modal-actions",children:[(0,o.jsx)("button",{type:"button",disabled:J,onClick:S,children:e("connectors.cancel")}),U?(0,o.jsx)("button",{type:"button",className:"primary",onClick:S,children:e("connectors.close")}):(0,o.jsx)("button",{id:"cn-create",type:"button",className:"primary",disabled:J,onClick:()=>{ne()},children:e(T?"connectors.btnSave":"connectors.btnCreate")})]})]})}),(0,o.jsx)("section",{className:"overview-block connector-section connector-list-section",children:(0,o.jsx)("div",{className:"card connector-list-card",children:$?(0,o.jsx)(ce,{className:"connector-list-loading",label:e("connectors.loading"),compact:!0}):(0,o.jsx)(_e,{connectors:D,bots:N,copiedId:u,editMsg:Z,groupName:j,modeLabel:z,kindLabel:oe,onCopy:Me,onEdit:te,onToggle:r=>{ae(r)},onTogglePayloadLogging:r=>{fe(r)},onDelete:r=>{Fe(r)}})})})]}):(0,o.jsx)(Te,{embedded:!0})]})}function We(t){let e=W(),a=t.created,m=a.isDynamic?`${a.url}?chatId=${a.exampleChat}`:a.url,k=a.exampleChat!=="<chatId>"?`\uFF08${t.groupName(a.exampleChat)}\uFF09`:"";return(0,o.jsx)("div",{className:"connector-created-wrap",children:(0,o.jsxs)("div",{className:"card connector-created-card",children:[(0,o.jsxs)("p",{className:"connector-created-title ok",children:[e("connectors.createdPrefix",{name:a.name}),a.mode==="fixed"&&a.chatId?(0,o.jsxs)("span",{className:"muted",children:[" \xB7 ",e("connectors.createdDest",{name:t.groupName(a.chatId)})]}):null]}),(0,o.jsxs)("p",{className:"connector-created-line",children:[(0,o.jsx)("span",{className:"muted",children:e("connectors.webhookUrl")}),(0,o.jsx)("code",{children:a.url})]}),a.secret?(0,o.jsxs)("p",{className:"connector-created-line",children:[(0,o.jsxs)("span",{className:"muted",children:[a.isToken?e("connectors.tokenLabel"):e("connectors.signLabel"),e("connectors.secretOnce")]}),(0,o.jsx)("code",{children:a.secret})]}):null,a.isToken&&a.isDynamic?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"muted connector-created-help",children:e("connectors.usageDynamicLede",{gn:k})}),(0,o.jsx)("pre",{children:(0,o.jsx)("code",{children:`curl -X POST '${m}' -H 'content-type: application/json' -d '{}'`})}),(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageDynamicNote")}})]}):a.isToken?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"muted connector-created-help",children:e("connectors.usageTokenLede")}),(0,o.jsx)("pre",{children:(0,o.jsx)("code",{children:`curl -X POST '${m}' -H 'content-type: application/json' -d '{}'`})}),(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageTokenNote")}})]}):(0,o.jsx)("p",{className:"muted connector-created-help",dangerouslySetInnerHTML:{__html:e("connectors.usageHmac")+(a.isDynamic?e("connectors.usageHmacDynamic"):"")}})]})})}function _e(t){let e=W();return t.connectors.length?(0,o.jsx)(o.Fragment,{children:t.connectors.map(a=>{let m=t.bots.find(v=>v.larkAppId===a.target.botId),k=Ce(a.id),N=(a.verify?.type??"token")==="token",p=e(N?"connectors.badgeToken":"connectors.badgeSign"),L=a.target.mode==="fixed"&&a.target.chatId?e("connectors.dest",{name:t.groupName(a.target.chatId)}):"",f=t.editMsg?.id===a.id?t.editMsg:null,D=t.copiedId===a.id;return(0,o.jsxs)("div",{className:"card connector-item-card",children:[(0,o.jsxs)("div",{className:"connector-item-head",children:[(0,o.jsxs)("div",{className:"connector-item-main",children:[(0,o.jsxs)("div",{className:"connector-item-title",children:[(0,o.jsx)("b",{children:a.name}),(0,o.jsx)("span",{className:a.enabled?"connector-status-pill ok":"connector-status-pill muted",children:a.enabled?e("connectors.enabled"):e("connectors.disabled")})]}),(0,o.jsxs)("div",{className:"connector-item-meta",children:[(0,o.jsx)("span",{children:m?.botName||a.target.botId}),(0,o.jsx)("span",{children:t.kindLabel(a.target.kind)}),(0,o.jsx)("span",{children:t.modeLabel(a.target.mode)}),L?(0,o.jsx)("span",{children:L}):null,(0,o.jsx)("span",{children:p}),(0,o.jsx)("span",{children:a.loggingPolicy?.storePayload!==!1?e("connectors.payloadLogged",{days:a.loggingPolicy?.retentionDays??14}):e("connectors.metadataOnly")})]})]}),(0,o.jsx)("button",{className:`ghost connector-copy-button${D?" copied":""}`,type:"button",onClick:()=>t.onCopy(a),children:e(D?"connectors.copied":"connectors.copy")})]}),(0,o.jsxs)("div",{className:"connector-url-row",children:[(0,o.jsx)("span",{className:"muted",children:e("connectors.webhookUrl")}),(0,o.jsxs)("code",{children:[k,N?"/<token>":""]})]}),N?(0,o.jsx)("div",{className:"muted connector-item-note",dangerouslySetInnerHTML:{__html:e("connectors.tokenHint")}}):null,a.target.kind==="workflow"?(0,o.jsx)("div",{className:"muted connector-item-note",children:e("connectors.legacyWorkflowNote")}):null,a.target.mode==="dynamic"?(0,o.jsx)("div",{className:"muted connector-item-note",dangerouslySetInnerHTML:{__html:e("connectors.dynamicReqHint")}}):null,a.promptEnvelope?.instruction?(0,o.jsxs)("div",{className:"muted connector-item-note",children:[e("connectors.instructionPrefix"),a.promptEnvelope.instruction]}):null,f?(0,o.jsx)("div",{className:f.error?"err connector-item-note":"muted connector-item-note",children:f.text}):null,(0,o.jsxs)("div",{className:"connector-item-actions",children:[(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onEdit(a),children:e("connectors.btnEdit")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onTogglePayloadLogging(a),children:a.loggingPolicy?.storePayload!==!1?e("connectors.btnDisablePayloadLog"):e("connectors.btnEnablePayloadLog")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onToggle(a),children:a.enabled?e("connectors.btnDisable"):e("connectors.btnEnable")}),(0,o.jsx)("button",{className:"ghost",type:"button",onClick:()=>t.onDelete(a),children:e("connectors.btnDel")})]})]},a.id)})}):(0,o.jsx)("p",{className:"muted connector-list-empty",children:e("connectors.empty")})}function oo(t){return re(t,(0,o.jsx)(xe,{tab:"webhooks"}))}function to(t){return re(t,(0,o.jsx)(xe,{tab:"logs"}))}export{eo as buildConnectorInstructionUpdateBody,qe as buildConnectorKindOptions,to as renderConnectorsLogsPage,oo as renderConnectorsPage,He as replaceConnectorById};
|