@xopcai/xopc 0.0.390 → 0.0.391
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/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DGMAYkw8.js → activity-store-DWQCDi8M.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B4AsZzJR.js → agent-avatar-dicebear-CzS0TUv9.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-0SlvsYl7.js +1 -0
- package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-DxdaiFWn.js → agents-admin-api-Bb3Kvz3X.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DHRfLkYD.js → app-management-settings-panel-9A7JN5V5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DtKSapgb.js → appearance-settings-BPdLEo6L.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-B9kuRt_z.js → apps-page-Cz7LypV9.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-AgySTXp_.js → archive-plugin-DFnHPNie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D1o7ZtUW.js → automations-page-CnBLPVNh.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-A1AXOsO6.js → binary-plugins-BQC0Tzoi.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUNLkLKF.js → block-editor-DSh5019z.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BvUC6OiW.js → browser-automation-inputs-C5tIrIRL.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-D61uSJPy.js → capabilities-D6RJG4QY.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BkCutK0V.js → capabilities-DGEmBQnF.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-D9uGs4Pw.js → capability-header-actions-xzjWZVbg.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-xb7n8rwF.js → channels-DRse_dD3.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dgn09YDs.js → chat-terminal-dock-CQF0M4kE.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-C66P4ifT.js → computer-settings-page-ZfzCTS0N.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Dp35XdYf.js → connector-service-page-CwAeWVLK.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CddHY982.js → date-picker-hmJlEAQZ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Ob6BZTqv.js → dependency-picker-Us_Juz6I.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-dmwCV-I4.js → desktop-pet-CvOTI4uw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B-TBkZAZ.js → desktop-pet-settings-DYg-Gb8t.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-6VZa4fT1.js → directory-picker-path-field-DZN9EDvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-C0_njMva.js → extension-debug-page-YIibp6Kk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeBLMFmW.js → extension-page-DkcGyb28.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DWI0KAKT.js → extension-provider-B1PQGTtY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-CmYcOqhb.js → gateway-config-swr-Dv_A5FMu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Ci1Jst5g.js → gateway-realtime-DghCGfY_.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C-BG5M7H.js → gateway-startup-retry-CkTVSESs.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-CsA7lCVc.js → highlighted-body-KQOG7T2V-DV2wNqBn.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B_DqCwtV.js → image-generation-api-B98iXt6A.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-oAvAF9QS.js → imports-page-DoBCBN8G.js} +1 -1
- package/dist/gateway/static/root/assets/index-DFgXwLsv.js +260 -0
- package/dist/gateway/static/root/assets/index-a6ZvhclR.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings--MjYe-Pb.js → keyboard-shortcuts-settings-DXVu4lqV.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DOa7mxjB.js → local-apps-page-BC6xhmUh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DAtLkTPg.js → local-session-drafts-DFnZQu9A.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DMy9W6IG.js → locale-store-BpK9AiDq.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-C0TzuD3-.js → management-settings-gq5L0THs.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-wyOHdXEg.js → markdown-view-IsYTotu6.js} +18 -18
- package/dist/gateway/static/root/assets/{media-plugins-Pb2zr_-L.js → media-plugins-oSChWbcP.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +1 -0
- package/dist/gateway/static/root/assets/{messages-O0BEUKnx.js → messages-CKTo_sIF.js} +2 -2
- package/dist/gateway/static/root/assets/{models-hub-cache-DdH1MODX.js → models-hub-cache-TjpL7hZ5.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-CYt2pGsm.js → notes-api-CBb944yw.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-3uj5EcQC.js → page-context-capture-button-CoWb7BYP.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-hI13tPS1.js → product-open-page-CTyy7H7-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-lT_in0-Q.js → product-preview-content-D4xqTaEy.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CgQrCqL6.js → registry-api-Dsa2LvRt.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-D12qVKeC.js → runtime-tools-api-C2Uw89eY.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DOSPOfCU.js → runtime-tools-settings-panel-Bqnp3tyt.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-CwOFgsyh.js → schema-form-h_RCNfiO.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-nH8Cw0US.js → send-session-input-DypbVTT7.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-B9HrwF-c.js → session-api-ga-SUOq_.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-aXqXuqDX.js → session-manager-C_OiKblh.js} +8 -8
- package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-BN70wE6R.js → settings-page-DPCgrICd.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CHzcVRi-.js → setup-status-panel-jjSYJpDd.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-B1TDyhPt.js → share-link-dialog-BGicglAS.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Br-eAZaP.js → share-preview-page-BORe9rLB.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Bl1ZBh5S.js → shares-api-Dbx3z6-1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-ClUw3SRC.js → skill-api-Cq6O1DZK.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api--1BfIPzb.js → skill-reload-api-Cq7QDjMA.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-tWrqu7ai.js → system-settings-panel-BNCGFO1e.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-D2t4ahzR.js → task-expandable-content-DAZGz5YC.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BBLjE0fi.js → theme-store-Db7hDESt.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-5ATxQH5c.js → tracing-settings-page-C6p2Mu92.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CF1Qh4wU.js → tunnel-api-Dw15EJp0.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-tY3keIbm.js → use-autosave-DDjIdW4U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-CXsocZjt.js → use-composer-attachments-DNl7O3Vb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-CEsxnDnQ.js → use-file-preview-expanded-DMHehhwG.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-COTNLUU3.js → voice-api-key-field-ByAxHE4P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DrxBjSja.js → voice-config-api-Dl39b27p.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-B47j0_xA.js → voice-transcribe-api-CVaU83Jc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-PByMJrhV.js → work-discovery-overlay-BvVvPA1T.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Bmx1O449.js → workspace-api-BpfKsrtP.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DVsAbvwP.js → xopc-cloud-account-card-CU5lzzE9.js} +1 -1
- package/dist/gateway/static/root/index.html +28 -36
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +4 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +2 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +8 -3
- package/dist/src/agent/embedded/run-turn.js +2 -1
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/tools/factory.js +14 -12
- package/dist/src/agent/tools/personal-read-tool.js +4 -0
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/hono/lib/voice-settings-revisions.js +2 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +15 -0
- package/dist/src/gateway/service.js +9 -7
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/providers/setup/profiles.d.ts +2 -2
- package/dist/src/providers/setup/profiles.js +6 -22
- package/dist/src/storage/sqlite/migrations/256_task_main_update_retries.sql +21 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/task-collaboration-repository.d.ts +2 -0
- package/dist/src/tasks/task-collaboration-repository.js +7 -1
- package/dist/src/tasks/task-main-update-delivery.js +11 -4
- package/dist/src/tasks/task-main-update-input.js +2 -1
- package/dist/src/tasks/task-main-update-retry.d.ts +5 -0
- package/dist/src/tasks/task-main-update-retry.js +15 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-9NUY1sO3.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CNc6ntzP.js +0 -1
- package/dist/gateway/static/root/assets/agents-QNY9Vkrf.js +0 -77
- package/dist/gateway/static/root/assets/automations-workspace-BJenz0P1.js +0 -6
- package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-Dq2LlVMh.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-BOZ-1g51.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BDP6gzlv.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D6PL3Mfl.js +0 -8
- package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +0 -1
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BHcRxYib.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-SWHwRgG3.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BiLUwoKx.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BMUiUQMk.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CzWT_v09.js +0 -1
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BeXJfxsg.js +0 -2
- package/dist/gateway/static/root/assets/index-W9ls-0Yd.css +0 -1
- package/dist/gateway/static/root/assets/index-xTL-vb51.js +0 -260
- package/dist/gateway/static/root/assets/local-app-workbench-page-DL33dtd7.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-C-GbTYsM.js +0 -2
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BxyGGa4D.js +0 -1
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BFpEqskQ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-h-qqFJ6Z.js +0 -8
- package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BGyW6cdt.js +0 -1
- package/dist/gateway/static/root/assets/play-kxZvpBg8.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Baj7fQ7N.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D7DyQFU3.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DU_d93Tm.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-swyUIF5A.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CI_PJmlX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DCVaeBLW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-jgCC_E4Y.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C9oRZSuL.js +0 -2
- package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BYRW7Rrr.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-CuEHzXil.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Dvt5TIZ6.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CSUkMo63.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BUDvFo3R.js +0 -6
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
//#region src/providers/setup/profiles.ts
|
|
3
|
-
/**
|
|
4
|
-
function isInteractiveOnlyProvider(
|
|
5
|
-
|
|
6
|
-
if (!baseUrl) return false;
|
|
7
|
-
try {
|
|
8
|
-
const url = new URL(baseUrl);
|
|
9
|
-
const hostname = url.hostname.toLowerCase().replace(/\.$/, "");
|
|
10
|
-
return [
|
|
11
|
-
"token-plan.cn-beijing.maas.aliyuncs.com",
|
|
12
|
-
"token-plan.ap-southeast-1.maas.aliyuncs.com",
|
|
13
|
-
"token-plan-cn.xiaomimimo.com",
|
|
14
|
-
"token-plan-ams.xiaomimimo.com",
|
|
15
|
-
"token-plan-sgp.xiaomimimo.com",
|
|
16
|
-
"coding.dashscope.aliyuncs.com",
|
|
17
|
-
"coding-intl.dashscope.aliyuncs.com"
|
|
18
|
-
].includes(hostname) || ["ark.cn-beijing.volces.com", "ark.ap-southeast.bytepluses.com"].includes(hostname) && decodeURIComponent(url.pathname).startsWith("/api/coding/");
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
3
|
+
/** Provider identity and endpoint do not restrict background or unknown calls. */
|
|
4
|
+
function isInteractiveOnlyProvider(_provider, _baseUrl) {
|
|
5
|
+
return false;
|
|
22
6
|
}
|
|
23
7
|
function getProviderSetupProfile(provider, name = provider, oauth = false, baseUrl) {
|
|
24
8
|
if (profiles[provider]) return {
|
|
@@ -39,7 +23,7 @@ function getProviderSetupProfile(provider, name = provider, oauth = false, baseU
|
|
|
39
23
|
"xiaomi-token-plan-sgp": "Xiaomi MiMo"
|
|
40
24
|
}[provider] ?? name,
|
|
41
25
|
name,
|
|
42
|
-
access:
|
|
26
|
+
access: subscriptionProviders.has(provider.trim().toLowerCase()) ? "subscription" : local ? "local" : "api",
|
|
43
27
|
credential: oauth ? "oauth" : local ? "none" : "api-key",
|
|
44
28
|
interactiveOnly
|
|
45
29
|
};
|
|
@@ -69,7 +53,7 @@ var init_profiles = __esmMin((() => {
|
|
|
69
53
|
name: "Bailian subscription · Beijing",
|
|
70
54
|
access: "subscription",
|
|
71
55
|
credential: "api-key",
|
|
72
|
-
interactiveOnly:
|
|
56
|
+
interactiveOnly: false,
|
|
73
57
|
apiKeyUrl: "https://bailian.console.aliyun.com/cn-beijing/subscription/overview"
|
|
74
58
|
},
|
|
75
59
|
"xopc-cloud": {
|
|
@@ -84,7 +68,7 @@ var init_profiles = __esmMin((() => {
|
|
|
84
68
|
name: "MiMo Token Plan · China",
|
|
85
69
|
access: "subscription",
|
|
86
70
|
credential: "api-key",
|
|
87
|
-
interactiveOnly:
|
|
71
|
+
interactiveOnly: false,
|
|
88
72
|
apiKeyUrl: "https://platform.xiaomimimo.com/"
|
|
89
73
|
}
|
|
90
74
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
CREATE TABLE task_main_update_deliveries_new (
|
|
2
|
+
entry_id TEXT PRIMARY KEY REFERENCES task_collaboration_entries(entry_id) ON DELETE CASCADE,
|
|
3
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
4
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'delivered', 'failed')),
|
|
5
|
+
updated_at INTEGER NOT NULL,
|
|
6
|
+
decision TEXT CHECK (decision IN ('notify', 'silent')),
|
|
7
|
+
decision_reason TEXT,
|
|
8
|
+
decided_at INTEGER,
|
|
9
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
10
|
+
last_error TEXT
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
INSERT INTO task_main_update_deliveries_new
|
|
14
|
+
(entry_id, conversation_id, status, updated_at, decision, decision_reason, decided_at)
|
|
15
|
+
SELECT entry_id, conversation_id, status, updated_at, decision, decision_reason, decided_at
|
|
16
|
+
FROM task_main_update_deliveries;
|
|
17
|
+
|
|
18
|
+
DROP TABLE task_main_update_deliveries;
|
|
19
|
+
ALTER TABLE task_main_update_deliveries_new RENAME TO task_main_update_deliveries;
|
|
20
|
+
CREATE INDEX idx_task_main_update_deliveries_pending
|
|
21
|
+
ON task_main_update_deliveries(status, updated_at);
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 256;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -59,7 +59,7 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
|
59
59
|
function applyPendingMigrations(db, options = {}) {
|
|
60
60
|
db.function("xopc_memory_search_text", { deterministic: true }, (value) => memorySearchText(String(value ?? "")));
|
|
61
61
|
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
62
|
-
const targetVersion = options.targetVersion ??
|
|
62
|
+
const targetVersion = options.targetVersion ?? 256;
|
|
63
63
|
let currentVersion = readSchemaVersion(db);
|
|
64
64
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
65
65
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
@@ -97,7 +97,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
97
97
|
}
|
|
98
98
|
/** Inspect schema version without mutating the database. */
|
|
99
99
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
100
|
-
const appVersion = options.targetVersion ??
|
|
100
|
+
const appVersion = options.targetVersion ?? 256;
|
|
101
101
|
const dbVersion = readSchemaVersion(db);
|
|
102
102
|
if (dbVersion > appVersion) return {
|
|
103
103
|
dbVersion,
|
|
@@ -140,7 +140,7 @@ var init_runner = __esmMin((() => {
|
|
|
140
140
|
init_errors();
|
|
141
141
|
log = createLogger("Sqlite:Migrations");
|
|
142
142
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
143
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
143
|
+
XOPC_DB_SCHEMA_VERSION = 256;
|
|
144
144
|
}));
|
|
145
145
|
//#endregion
|
|
146
146
|
init_runner();
|
|
@@ -41,12 +41,14 @@ export declare class TaskCollaborationRepository {
|
|
|
41
41
|
conversationId: string;
|
|
42
42
|
decision?: 'notify' | 'silent';
|
|
43
43
|
decisionReason?: string;
|
|
44
|
+
failureCount: number;
|
|
44
45
|
}>;
|
|
45
46
|
decideMainUpdate(entryId: string, decision: 'notify' | 'silent', reason: string): void;
|
|
46
47
|
hasNewerMainUpdate(taskId: string, sequence: number): boolean;
|
|
47
48
|
hasSubmittedMainUpdate(entryId: string): boolean;
|
|
48
49
|
markMainUpdateDelivered(entryId: string): void;
|
|
49
50
|
deferMainUpdate(entryId: string, delayMs?: number): void;
|
|
51
|
+
failMainUpdate(entryId: string, error: string, delayMs: number, terminal: boolean): void;
|
|
50
52
|
markDelivered(entryId: string, conversationId: string, assignmentEpoch: number): void;
|
|
51
53
|
canConfirm(entryId: string, conversationId: string, assignmentEpoch: number): boolean;
|
|
52
54
|
markConfirmed(entryId: string): void;
|
|
@@ -95,7 +95,7 @@ var TaskCollaborationRepository = class {
|
|
|
95
95
|
}
|
|
96
96
|
pendingMainUpdates(limit = 20) {
|
|
97
97
|
return getSqliteDatabase().prepare(`SELECT entry.*, main.conversation_id,
|
|
98
|
-
main.decision, main.decision_reason,
|
|
98
|
+
main.decision, main.decision_reason, main.failure_count,
|
|
99
99
|
delivery.status AS delivery_status
|
|
100
100
|
FROM task_collaboration_entries entry
|
|
101
101
|
LEFT JOIN task_collaboration_deliveries delivery ON delivery.entry_id = entry.entry_id
|
|
@@ -106,6 +106,7 @@ var TaskCollaborationRepository = class {
|
|
|
106
106
|
main.updated_at, entry.sequence, entry.entry_id LIMIT ?`).all(Date.now(), Math.max(1, Math.min(100, Math.floor(limit)))).map((row) => ({
|
|
107
107
|
entry: fromRow(row),
|
|
108
108
|
conversationId: row.conversation_id,
|
|
109
|
+
failureCount: row.failure_count,
|
|
109
110
|
...row.decision ? { decision: row.decision } : {},
|
|
110
111
|
...row.decision_reason ? { decisionReason: row.decision_reason } : {}
|
|
111
112
|
}));
|
|
@@ -134,6 +135,11 @@ var TaskCollaborationRepository = class {
|
|
|
134
135
|
deferMainUpdate(entryId, delayMs = 1e3) {
|
|
135
136
|
getSqliteDatabase().prepare(`UPDATE task_main_update_deliveries SET updated_at = ?
|
|
136
137
|
WHERE entry_id = ? AND status = 'pending'`).run(Date.now() + delayMs, entryId);
|
|
138
|
+
}
|
|
139
|
+
failMainUpdate(entryId, error, delayMs, terminal) {
|
|
140
|
+
getSqliteDatabase().prepare(`UPDATE task_main_update_deliveries
|
|
141
|
+
SET failure_count = failure_count + 1, last_error = ?, status = ?, updated_at = ?
|
|
142
|
+
WHERE entry_id = ? AND status = 'pending'`).run(error.slice(0, 1e3), terminal ? "failed" : "pending", Date.now() + delayMs, entryId);
|
|
137
143
|
}
|
|
138
144
|
markDelivered(entryId, conversationId, assignmentEpoch) {
|
|
139
145
|
getSqliteDatabase().prepare(`UPDATE task_collaboration_deliveries
|
|
@@ -5,6 +5,7 @@ import { init_request_repository, personalRequestForTask } from "../personal-age
|
|
|
5
5
|
import { TaskAllocationRepository } from "./task-allocation-repository.js";
|
|
6
6
|
import { TaskCollaborationRepository } from "./task-collaboration-repository.js";
|
|
7
7
|
import { TaskResultDeliveryRepository } from "./task-result-delivery-repository.js";
|
|
8
|
+
import { TaskMainUpdateExhaustedError, taskMainUpdateRetryDelay } from "./task-main-update-retry.js";
|
|
8
9
|
//#region src/tasks/task-main-update-delivery.ts
|
|
9
10
|
init_logger();
|
|
10
11
|
init_task_run_repository();
|
|
@@ -14,7 +15,7 @@ var TaskMainUpdateDelivery = class {
|
|
|
14
15
|
#entries = new TaskCollaborationRepository();
|
|
15
16
|
async drain(input, limit = 20) {
|
|
16
17
|
let delivered = 0;
|
|
17
|
-
for (const { entry, conversationId, decision, decisionReason } of this.#entries.pendingMainUpdates(limit)) {
|
|
18
|
+
for (const { entry, conversationId, decision, decisionReason, failureCount } of this.#entries.pendingMainUpdates(limit)) {
|
|
18
19
|
const connected = personalRequestForTask(entry.taskId);
|
|
19
20
|
if (entry.kind === "result" && connected) {
|
|
20
21
|
this.#entries.markMainUpdateDelivered(entry.id);
|
|
@@ -89,13 +90,19 @@ var TaskMainUpdateDelivery = class {
|
|
|
89
90
|
delivered += 1;
|
|
90
91
|
} else this.#entries.deferMainUpdate(entry.id);
|
|
91
92
|
} catch (error) {
|
|
93
|
+
const failures = failureCount + 1;
|
|
94
|
+
const terminal = error instanceof TaskMainUpdateExhaustedError || failures >= 20;
|
|
95
|
+
const retryDelayMs = terminal ? 0 : taskMainUpdateRetryDelay(error, failures);
|
|
96
|
+
this.#entries.failMainUpdate(entry.id, error instanceof Error ? error.message : String(error), retryDelayMs, terminal);
|
|
92
97
|
log.warn({
|
|
93
98
|
err: error,
|
|
94
99
|
conversationId,
|
|
95
100
|
taskId: entry.taskId,
|
|
96
|
-
entryId: entry.id
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
entryId: entry.id,
|
|
102
|
+
failures,
|
|
103
|
+
terminal,
|
|
104
|
+
retryDelayMs
|
|
105
|
+
}, terminal ? "Main Agent update delivery stopped after retry limit" : "Main Agent update delivery failed; retry deferred");
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
return delivered;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TaskMainUpdateExhaustedError } from "./task-main-update-retry.js";
|
|
1
2
|
//#region src/tasks/task-main-update-input.ts
|
|
2
3
|
function selectTaskMainUpdateAttempt(conversationId, baseClientMessageId, findInput) {
|
|
3
4
|
for (let attempt = 0; attempt < 20; attempt += 1) {
|
|
@@ -23,7 +24,7 @@ function selectTaskMainUpdateAttempt(conversationId, baseClientMessageId, findIn
|
|
|
23
24
|
async function submitAndConfirmTaskMainUpdate(input, deps) {
|
|
24
25
|
const attempt = selectTaskMainUpdateAttempt(input.conversationId, input.clientMessageId, deps.findInput);
|
|
25
26
|
if (attempt.kind === "completed") return true;
|
|
26
|
-
if (attempt.kind === "exhausted" || !attempt.clientMessageId) throw new
|
|
27
|
+
if (attempt.kind === "exhausted" || !attempt.clientMessageId) throw new TaskMainUpdateExhaustedError();
|
|
27
28
|
if (attempt.kind === "new" && !await deps.submit({
|
|
28
29
|
...input,
|
|
29
30
|
clientMessageId: attempt.clientMessageId
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/tasks/task-main-update-retry.ts
|
|
2
|
+
const TASK_MAIN_UPDATE_MAX_ATTEMPTS = 20;
|
|
3
|
+
var TaskMainUpdateExhaustedError = class extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super("Task update retry limit reached");
|
|
6
|
+
this.name = "TaskMainUpdateExhaustedError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function taskMainUpdateRetryDelay(error, failures) {
|
|
10
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11
|
+
const rateLimited = /\b429\b|rate[_ -]?limit|platform_token_limit_exceeded/i.test(message);
|
|
12
|
+
return Math.min(rateLimited ? 15 * 6e4 : 6e4, (rateLimited ? 3e4 : 1e3) * 2 ** Math.max(0, failures - 1));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { TASK_MAIN_UPDATE_MAX_ATTEMPTS, TaskMainUpdateExhaustedError, taskMainUpdateRetryDelay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.391",
|
|
4
4
|
"description": "Local-first personal AI with Ada, task delegation, files, projects, workflows, and automations. Use cloud or local models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
"vue": "^3.5.35",
|
|
172
172
|
"xlsx": "file:web/vendor/xlsx-0.20.3.tgz",
|
|
173
173
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
174
|
-
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
175
174
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
176
175
|
"@xopcai/computer-control-contract": "0.1.0",
|
|
177
|
-
"@xopcai/
|
|
176
|
+
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
178
177
|
"@xopcai/image-providers": "0.1.0",
|
|
178
|
+
"@xopcai/gateway-contract": "0.0.0",
|
|
179
179
|
"@xopcai/realtime-client": "0.0.0",
|
|
180
180
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
181
181
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as o}from"./popover-select-DHC7J4lG.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./mic-CuUb7zc-.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./sparkles-DHlfQFAF.js";import{t as d}from"./cn-0WouolD0.js";import{c as f,n as p}from"./locale-store-DMy9W6IG.js";import{n as m,r as h}from"./cloud-credits-BMYMiiNn.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-aIC072nz.js";import{r as v}from"./gateway-config-swr-CmYcOqhb.js";import{t as y}from"./skeleton-BI5TyibZ.js";import{t as b}from"./electron-env-Dit0bHgy.js";import{Gs as ee,Qo as x,Rn as S,Tn as C,Wn as w,bi as T,pc as E,ps as te,q as ne,rl as D,tl as O,ts as k,v as A,zn as re}from"./index-xTL-vb51.js";import{t as ie}from"./number-input-DDeqHK-G.js";import{n as j,r as ae}from"./settings-page-layout-Dx5S-Msc.js";import{n as M,t as oe}from"./use-autosave-tY3keIbm.js";import{s as N}from"./voice-config-api-DrxBjSja.js";var se=e(t(),1),ce=n(),P=r(),F={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};function I(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function L(e){return F[e]??e}function R(e){let t=(0,ce.c)(18),{icon:n,label:r,enabled:i,details:o,zh:s,href:c}=e,l;t[0]===n?l=t[1]:(l=(0,P.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,P.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,P.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=u);let d=i?s?`已启用`:`On`:s?`已关闭`:`Off`,f;t[4]===d?f=t[5]:(f=(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:d}),t[4]=d,t[5]=f);let p;t[6]!==u||t[7]!==f?(p=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,f]}),t[6]=u,t[7]=f,t[8]=p):p=t[8];let m=i?o:s?`不处理语音`:`Voice processing is disabled`,h;t[9]===m?h=t[10]:(h=(0,P.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,P.jsxs)(`div`,{className:`min-w-0`,children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;return t[14]!==c||t[15]!==l||t[16]!==g?(_=(0,P.jsxs)(a,{to:c,className:`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,g]}),t[14]=c,t[15]=l,t[16]=g,t[17]=_):_=t[17],_}function z(e){let t=(0,ce.c)(27),{zh:n}=e,{data:r,error:i,isLoading:o}=v(!0),s=r?.payload?.config,l,u,d;if(t[0]!==s){d=s===void 0?void 0:N(s);let e=d?I(d.stt.providers,d.stt.provider,`model`):void 0,n=d?I(d.tts.providers,d.tts.provider,`model`):void 0,r=d?I(d.tts.providers,d.tts.provider,`voice`):void 0;l=d?[L(d.stt.provider),e].filter(Boolean).join(` · `):void 0,u=d?[L(d.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=l,t[2]=u,t[3]=d}else l=t[1],u=t[2],d=t[3];let f=u,p=n?`语音能力`:`Voice capabilities`,m;t[4]===p?m=t[5]:(m=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:p}),t[4]=p,t[5]=m);let h=n?`语音识别和朗读由所有智能体共用,在「模型与能力」统一管理。`:`STT and TTS are shared by every agent and managed under Models and capabilities.`,g;t[6]===h?g=t[7]:(g=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:h}),t[6]=h,t[7]=g);let b;t[8]!==m||t[9]!==g?(b=(0,P.jsxs)(`div`,{children:[m,g]}),t[8]=m,t[9]=g,t[10]=b):b=t[10];let ee=n?`管理语音能力`:`Manage voice capabilities`,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,P.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[11]=x):x=t[11];let S;t[12]===ee?S=t[13]:(S=(0,P.jsx)(_,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,P.jsxs)(a,{to:`/settings/capabilities/models`,children:[ee,x]})}),t[12]=ee,t[13]=S);let C;t[14]!==b||t[15]!==S?(C=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,S]}),t[14]=b,t[15]=S,t[16]=C):C=t[16];let w;t[17]!==i||t[18]!==o||t[19]!==l||t[20]!==f||t[21]!==d||t[22]!==n?(w=o||!d?i?(0,P.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,P.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(y,{className:`h-20 rounded-xl`}),(0,P.jsx)(y,{className:`h-20 rounded-xl`})]}):(0,P.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(R,{icon:c,href:`/settings/capabilities/models?use=transcription`,label:n?`录音与听写(STT)`:`Recording and dictation (STT)`,enabled:d.stt.enabled,details:l,zh:n}),(0,P.jsx)(R,{icon:O,href:`/settings/capabilities/models?use=speech`,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:d.tts.enabled,details:f,zh:n})]}),t[17]=i,t[18]=o,t[19]=l,t[20]=f,t[21]=d,t[22]=n,t[23]=w):w=t[23];let T;return t[24]!==C||t[25]!==w?(T=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26],T}function le(e){let t=(0,ce.c)(34),{draft:n,zh:r}=e,i=r?`对话与任务`:`Chat and tasks`,o,s,c,l,u,d;if(t[0]!==n.models.background?.primary||t[1]!==n.models.chat.primary||t[2]!==n.models.imageGeneration?.primary||t[3]!==n.models.imageUnderstanding?.primary||t[4]!==i||t[5]!==r){let e=[{use:`chat`,label:i,model:n.models.chat.primary},{use:`vision`,label:r?`看图`:`Image understanding`,model:n.models.imageUnderstanding?.primary},{use:`image`,label:r?`生成图片`:`Image generation`,model:n.models.imageGeneration?.primary},{use:`background`,label:r?`自动与后台任务`:`Background tasks`,model:n.models.background?.primary}];d=`space-y-5`,c=`rounded-xl border border-edge p-5`;let f=r?`共用模型`:`Shared models`;t[12]===f?l=t[13]:(l=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:f}),t[12]=f,t[13]=l);let p=r?`所有智能体默认使用这些模型。在「模型与能力」统一管理;单个智能体可以单独覆盖。`:`Agents inherit these models. Manage them under Models and capabilities; individual agents can override them.`;t[14]===p?u=t[15]:(u=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:p}),t[14]=p,t[15]=u),o=`mt-4 divide-y divide-edge`,s=e.map(e=>(0,P.jsxs)(a,{to:C(e.use),className:`flex min-h-14 items-center justify-between gap-4 py-3 text-sm hover:bg-surface-hover rounded-lg px-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,P.jsxs)(`span`,{className:`min-w-0`,children:[(0,P.jsx)(`span`,{className:`block font-medium text-fg`,children:e.label}),(0,P.jsx)(`span`,{className:`block break-all text-fg-muted`,children:e.model??(e.use===`background`?r?`按对话模型的使用范围解析`:`Resolved from the chat model usage scope`:r?`未配置`:`Not configured`)})]}),(0,P.jsx)(`span`,{className:`shrink-0 text-accent-fg`,children:r?`管理`:`Manage`})]},e.use)),t[0]=n.models.background?.primary,t[1]=n.models.chat.primary,t[2]=n.models.imageGeneration?.primary,t[3]=n.models.imageUnderstanding?.primary,t[4]=i,t[5]=r,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d}else o=t[6],s=t[7],c=t[8],l=t[9],u=t[10],d=t[11];let f;t[16]!==o||t[17]!==s?(f=(0,P.jsx)(`div`,{className:o,children:s}),t[16]=o,t[17]=s,t[18]=f):f=t[18];let p;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(p=C(),t[19]=p):p=t[19];let m=r?`查看全部模型与能力`:`View all models and capabilities`,h;t[20]===m?h=t[21]:(h=(0,P.jsx)(a,{to:p,className:`mt-4 inline-block text-sm text-accent-fg hover:underline`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==h||t[23]!==c||t[24]!==l||t[25]!==u||t[26]!==f?(g=(0,P.jsxs)(`section`,{className:c,children:[l,u,f,h]}),t[22]=h,t[23]=c,t[24]=l,t[25]=u,t[26]=f,t[27]=g):g=t[27];let _;t[28]===r?_=t[29]:(_=(0,P.jsx)(z,{zh:r}),t[28]=r,t[29]=_);let v;return t[30]!==g||t[31]!==_||t[32]!==d?(v=(0,P.jsxs)(`div`,{className:d,children:[g,_]}),t[30]=g,t[31]=_,t[32]=d,t[33]=v):v=t[33],v}var ue=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function B(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function de({draft:e,setDraft:t,zh:n}){let[r,i]=(0,se.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?m(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,se.useState)(!1);return(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,P.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${ue} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:h(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?m(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,P.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function V(e){let t=(0,ce.c)(186),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let s=g(`agent-defaults-workflows`,A,a),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(fe),t[3]=c,t[4]=l);let u=l,f=n.workflows.allowed===void 0,p;t[5]!==n||t[6]!==r?(p=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=p):p=t[7];let m=p,h=i?`费用控制`:`Spending control`,v;t[8]===h?v=t[9]:(v=(0,P.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:h}),t[8]=h,t[9]=v);let y;t[10]!==n||t[11]!==r||t[12]!==i?(y=(0,P.jsx)(de,{draft:n,setDraft:r,zh:i}),t[10]=n,t[11]=r,t[12]=i,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let ee=i?`执行与缓存策略`:`Execution and cache policy`,x=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,S=n.runtime.codemode?.enabled??!1,C;t[17]!==n||t[18]!==r?(C=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[17]=n,t[18]=r,t[19]=C):C=t[19];let w;t[20]!==S||t[21]!==C?(w=(0,P.jsx)(`input`,{type:`checkbox`,checked:S,onChange:C,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T=i?`Codemode 读取试点`:`Codemode read pilot`,E;t[23]===T?E=t[24]:(E=(0,P.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:T}),t[23]=T,t[24]=E);let te=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,D;t[25]===te?D=t[26]:(D=(0,P.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:te}),t[25]=te,t[26]=D);let O;t[27]!==E||t[28]!==D?(O=(0,P.jsxs)(`span`,{children:[E,D]}),t[27]=E,t[28]=D,t[29]=O):O=t[29];let k;t[30]!==w||t[31]!==O?(k=(0,P.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[w,O]})}),t[30]=w,t[31]=O,t[32]=k):k=t[32];let re=i?`执行限制`:`Execution limits`,j;t[33]===re?j=t[34]:(j=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:re}),t[33]=re,t[34]=j);let ae=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,M;t[35]===ae?M=t[36]:(M=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ae}),t[35]=ae,t[36]=M);let oe=i?`每次运行最多轮数`:`Maximum turns per run`,N=n.runtime.maxTurns??``,se=i?`系统默认`:`System default`,F;t[37]!==n||t[38]!==r?(F=e=>r({...n,runtime:{...n.runtime,maxTurns:B(e.target.value)}}),t[37]=n,t[38]=r,t[39]=F):F=t[39];let I;t[40]!==N||t[41]!==se||t[42]!==F?(I=(0,P.jsx)(ie,{allowEmpty:!0,type:`number`,min:1,value:N,placeholder:se,onChange:F,className:`${ue} mt-2`}),t[40]=N,t[41]=se,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==oe||t[45]!==I?(L=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[oe,I]}),t[44]=oe,t[45]=I,t[46]=L):L=t[46];let R=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,z=n.runtime.timeoutMs??``,le=i?`系统默认`:`System default`,V;t[47]!==n||t[48]!==r?(V=e=>r({...n,runtime:{...n.runtime,timeoutMs:B(e.target.value)}}),t[47]=n,t[48]=r,t[49]=V):V=t[49];let H;t[50]!==z||t[51]!==le||t[52]!==V?(H=(0,P.jsx)(ie,{allowEmpty:!0,type:`number`,min:1,value:z,placeholder:le,onChange:V,className:`${ue} mt-2`}),t[50]=z,t[51]=le,t[52]=V,t[53]=H):H=t[53];let pe;t[54]!==R||t[55]!==H?(pe=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[R,H]}),t[54]=R,t[55]=H,t[56]=pe):pe=t[56];let me=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,he=n.runtime.maxToolFailuresPerTurn??``,U=i?`系统默认`:`System default`,W;t[57]!==n||t[58]!==r?(W=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:B(e.target.value)}}),t[57]=n,t[58]=r,t[59]=W):W=t[59];let G;t[60]!==he||t[61]!==U||t[62]!==W?(G=(0,P.jsx)(ie,{allowEmpty:!0,type:`number`,min:1,value:he,placeholder:U,onChange:W,className:`${ue} mt-2`}),t[60]=he,t[61]=U,t[62]=W,t[63]=G):G=t[63];let ge;t[64]!==me||t[65]!==G?(ge=(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[me,G]}),t[64]=me,t[65]=G,t[66]=ge):ge=t[66];let K;t[67]!==L||t[68]!==pe||t[69]!==ge?(K=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[L,pe,ge]}),t[67]=L,t[68]=pe,t[69]=ge,t[70]=K):K=t[70];let _e;t[71]!==j||t[72]!==M||t[73]!==K?(_e=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[j,M,K]}),t[71]=j,t[72]=M,t[73]=K,t[74]=_e):_e=t[74];let q=i?`提示词缓存`:`Prompt cache`,J;t[75]===q?J=t[76]:(J=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:q}),t[75]=q,t[76]=J);let Y=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,X;t[77]===Y?X=t[78]:(X=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let Z=i?`缓存模式`:`Cache mode`,Q;t[79]===Z?Q=t[80]:(Q=(0,P.jsx)(`span`,{children:Z}),t[79]=Z,t[80]=Q);let $;t[81]===Symbol.for(`react.memo_cache_sentinel`)?($=[`auto`,`off`],t[81]=$):$=t[81];let ve;t[82]!==n||t[83]!==r||t[84]!==i?(ve=(0,P.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:$.map(e=>(0,P.jsx)(_,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[82]=n,t[83]=r,t[84]=i,t[85]=ve):ve=t[85];let ye;t[86]!==Q||t[87]!==ve?(ye=(0,P.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[Q,ve]}),t[86]=Q,t[87]=ve,t[88]=ye):ye=t[88];let be;t[89]!==n||t[90]!==r||t[91]!==i?(be=n.runtime.promptCache?.mode===`auto`?(0,P.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,P.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,P.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,P.jsx)(_,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[89]=n,t[90]=r,t[91]=i,t[92]=be):be=t[92];let xe;t[93]!==ye||t[94]!==be?(xe=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[ye,be]}),t[93]=ye,t[94]=be,t[95]=xe):xe=t[95];let Se;t[96]!==J||t[97]!==X||t[98]!==xe?(Se=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[J,X,xe]}),t[96]=J,t[97]=X,t[98]=xe,t[99]=Se):Se=t[99];let Ce;t[100]!==x||t[101]!==k||t[102]!==_e||t[103]!==Se||t[104]!==ee?(Ce=(0,P.jsxs)(ne,{title:ee,summary:x,children:[k,_e,Se]}),t[100]=x,t[101]=k,t[102]=_e,t[103]=Se,t[104]=ee,t[105]=Ce):Ce=t[105];let we=i?`工作流`:`Workflows`,Te;t[106]===we?Te=t[107]:(Te=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:we}),t[106]=we,t[107]=Te);let Ee=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,De;t[108]===Ee?De=t[109]:(De=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ee}),t[108]=Ee,t[109]=De);let Oe=i?`默认工作流`:`Default workflow`,ke=n.workflows.default||(i?`未自动绑定工作流`:`No workflow bound automatically`),Ae=i?`默认工作流`:`Default workflow`,je;t[110]===Ae?je=t[111]:(je=(0,P.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:Ae}),t[110]=Ae,t[111]=je);let Me=n.workflows.default??``,Ne=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,Pe=i?`不设置默认工作流`:`No default workflow`,Fe=i?`默认工作流`:`Default workflow`,Ie;t[112]!==n||t[113]!==r?(Ie=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[112]=n,t[113]=r,t[114]=Ie):Ie=t[114];let Le;t[115]!==Me||t[116]!==Ne||t[117]!==Pe||t[118]!==Fe||t[119]!==Ie||t[120]!==u||t[121]!==s.isLoading?(Le=(0,P.jsx)(o,{value:Me,options:u,placeholder:Ne,emptyLabel:Pe,disabled:s.isLoading,ariaLabel:Fe,onChange:Ie,triggerClassName:`mt-2`}),t[115]=Me,t[116]=Ne,t[117]=Pe,t[118]=Fe,t[119]=Ie,t[120]=u,t[121]=s.isLoading,t[122]=Le):Le=t[122];let Re;t[123]!==je||t[124]!==Le?(Re=(0,P.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[je,Le]}),t[123]=je,t[124]=Le,t[125]=Re):Re=t[125];let ze;t[126]!==Oe||t[127]!==ke||t[128]!==Re?(ze=(0,P.jsx)(ne,{title:Oe,summary:ke,children:Re}),t[126]=Oe,t[127]=ke,t[128]=Re,t[129]=ze):ze=t[129];let Be;t[130]===s.error?Be=t[131]:(Be=s.error?(0,P.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[130]=s.error,t[131]=Be);let Ve=i?`允许调用的工作流`:`Allowed workflows`,He;t[132]===Ve?He=t[133]:(He=(0,P.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ve}),t[132]=Ve,t[133]=He);let Ue;t[134]!==n||t[135]!==r?(Ue=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[134]=n,t[135]=r,t[136]=Ue):Ue=t[136];let We=f?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Ge;t[137]===We?Ge=t[138]:(Ge=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,We),t[137]=We,t[138]=Ge);let Ke=i?`允许全部工作流`:`Allow every workflow`,qe;t[139]===Ke?qe=t[140]:(qe=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ke}),t[139]=Ke,t[140]=qe);let Je=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,Ye;t[141]===Je?Ye=t[142]:(Ye=(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Je}),t[141]=Je,t[142]=Ye);let Xe;t[143]!==Ue||t[144]!==Ge||t[145]!==qe||t[146]!==Ye?(Xe=(0,P.jsxs)(`button`,{type:`button`,onClick:Ue,className:Ge,children:[qe,Ye]}),t[143]=Ue,t[144]=Ge,t[145]=qe,t[146]=Ye,t[147]=Xe):Xe=t[147];let Ze;t[148]!==n||t[149]!==r?(Ze=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[148]=n,t[149]=r,t[150]=Ze):Ze=t[150];let Qe=f?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,$e;t[151]===Qe?$e=t[152]:($e=d(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Qe),t[151]=Qe,t[152]=$e);let et=i?`只允许选中的工作流`:`Allow selected workflows only`,tt;t[153]===et?tt=t[154]:(tt=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:et}),t[153]=et,t[154]=tt);let nt=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,rt;t[155]===nt?rt=t[156]:(rt=(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:nt}),t[155]=nt,t[156]=rt);let it;t[157]!==Ze||t[158]!==$e||t[159]!==tt||t[160]!==rt?(it=(0,P.jsxs)(`button`,{type:`button`,onClick:Ze,className:$e,children:[tt,rt]}),t[157]=Ze,t[158]=$e,t[159]=tt,t[160]=rt,t[161]=it):it=t[161];let at;t[162]!==Xe||t[163]!==it?(at=(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Xe,it]}),t[162]=Xe,t[163]=it,t[164]=at):at=t[164];let ot;t[165]!==f||t[166]!==n.workflows.allowed||t[167]!==m||t[168]!==s.data||t[169]!==s.isLoading||t[170]!==i?(ot=f?null:(0,P.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>m(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,P.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[165]=f,t[166]=n.workflows.allowed,t[167]=m,t[168]=s.data,t[169]=s.isLoading,t[170]=i,t[171]=ot):ot=t[171];let st;t[172]!==He||t[173]!==at||t[174]!==ot?(st=(0,P.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[He,at,ot]}),t[172]=He,t[173]=at,t[174]=ot,t[175]=st):st=t[175];let ct;t[176]!==Te||t[177]!==De||t[178]!==ze||t[179]!==Be||t[180]!==st?(ct=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Te,De,ze,Be,st]}),t[176]=Te,t[177]=De,t[178]=ze,t[179]=Be,t[180]=st,t[181]=ct):ct=t[181];let lt;return t[182]!==Ce||t[183]!==b||t[184]!==ct?(lt=(0,P.jsxs)(`div`,{className:`space-y-5`,children:[b,Ce,ct]}),t[182]=Ce,t[183]=b,t[184]=ct,t[185]=lt):lt=t[185],lt}function fe(e){return{value:e.id,label:e.title||e.name}}function H(e){return[...new Set(e)].sort()}var pe=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function me(e){let t=(0,ce.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:o,error:c,isLoading:u}=g(`agent-defaults-skills-catalog`,T,a),[f,p]=(0,se.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;o?.catalog;let h;if(t[1]!==m||t[2]!==o?.catalog||t[3]!==f){let e=[...o?.catalog??[]],n=new Set(e.map(ge));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(G),t[1]=m,t[2]=o?.catalog,t[3]=f,t[4]=h}else h=t[4];let _=h,v;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(v=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=v):v=t[8];let y=v,b;t[9]!==n||t[10]!==r?(b=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):H([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):H([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,S;t[12]===o?.catalog?S=t[13]:(S=o?.catalog??[],t[12]=o?.catalog,t[13]=S);let C;if(t[14]!==y||t[15]!==S){let e;t[17]===y?e=t[18]:(e=e=>e.enabled&&y(e.name),t[17]=y,t[18]=e),C=S.filter(e),t[14]=y,t[15]=S,t[16]=C}else C=t[16];let w=C.length,E;t[19]!==o?.catalog||t[20]!==n||t[21]!==r?(E=e=>{let t=new Set((o?.catalog??[]).filter(W).map(U));r({...n,skills:{mode:`selected`,include:H(e.filter(e=>t.has(e)))}})},t[19]=o?.catalog,t[20]=n,t[21]=r,t[22]=E):E=t[22];let te=E,ne=i?`技能策略`:`Skill policy`,D;t[23]===ne?D=t[24]:(D=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ne}),t[23]=ne,t[24]=D);let O=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[25]===O?k=t[26]:(k=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[25]=O,t[26]=k);let A;t[27]!==n||t[28]!==r?(A=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=A):A=t[29];let re=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,ie;t[30]===re?ie=t[31]:(ie=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,re),t[30]=re,t[31]=ie);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,P.jsx)(s,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=j):j=t[32];let ae=i?`使用所有已启用技能`:`Use every enabled skill`,M;t[33]===ae?M=t[34]:(M=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ae}),t[33]=ae,t[34]=M);let oe=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,N;t[35]===oe?N=t[36]:(N=(0,P.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:oe}),t[35]=oe,t[36]=N);let F;t[37]!==M||t[38]!==N?(F=(0,P.jsxs)(`span`,{children:[M,N]}),t[37]=M,t[38]=N,t[39]=F):F=t[39];let I;t[40]!==A||t[41]!==ie||t[42]!==F?(I=(0,P.jsxs)(`button`,{type:`button`,onClick:A,className:ie,children:[j,F]}),t[40]=A,t[41]=ie,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==n||t[45]!==r?(L=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=L):L=t[46];let R=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,z;t[47]===R?z=t[48]:(z=d(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,R),t[47]=R,t[48]=z);let le;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,P.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=le):le=t[49];let ue=i?`只使用选中的技能`:`Use selected skills only`,B;t[50]===ue?B=t[51]:(B=(0,P.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ue}),t[50]=ue,t[51]=B);let de=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,V;t[52]===de?V=t[53]:(V=(0,P.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:de}),t[52]=de,t[53]=V);let fe;t[54]!==B||t[55]!==V?(fe=(0,P.jsxs)(`span`,{children:[B,V]}),t[54]=B,t[55]=V,t[56]=fe):fe=t[56];let me;t[57]!==L||t[58]!==z||t[59]!==fe?(me=(0,P.jsxs)(`button`,{type:`button`,onClick:L,className:z,children:[le,fe]}),t[57]=L,t[58]=z,t[59]=fe,t[60]=me):me=t[60];let K;t[61]!==I||t[62]!==me?(K=(0,P.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[I,me]}),t[61]=I,t[62]=me,t[63]=K):K=t[63];let _e=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,q;t[64]===_e?q=t[65]:(q=(0,P.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_e}),t[64]=_e,t[65]=q);let J;t[66]!==te||t[67]!==o||t[68]!==i?(J=pe.map(e=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>te(e.names),disabled:!o,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=te,t[67]=o,t[68]=i,t[69]=J):J=t[69];let Y;t[70]===J?Y=t[71]:(Y=(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:J}),t[70]=J,t[71]=Y);let X;t[72]!==q||t[73]!==Y?(X=(0,P.jsxs)(`div`,{className:`mt-4`,children:[q,Y]}),t[72]=q,t[73]=Y,t[74]=X):X=t[74];let Z;t[75]!==k||t[76]!==K||t[77]!==X||t[78]!==D?(Z=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[D,k,K,X]}),t[75]=k,t[76]=K,t[77]=X,t[78]=D,t[79]=Z):Z=t[79];let Q=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,$;t[80]===Q?$=t[81]:($=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Q}),t[80]=Q,t[81]=$);let ve=i?`当前默认可用 ${w} 个技能。`:`${w} skills are available by default.`,ye;t[82]===ve?ye=t[83]:(ye=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ve}),t[82]=ve,t[83]=ye);let be;t[84]!==$||t[85]!==ye?(be=(0,P.jsxs)(`div`,{children:[$,ye]}),t[84]=$,t[85]=ye,t[86]=be):be=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,P.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,P.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>p(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==f||t[92]!==Te?(Ee=(0,P.jsx)(`input`,{type:`search`,value:f,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=f,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,P.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==be||t[98]!==De?(Oe=(0,P.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[be,De]}),t[97]=be,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===c?ke=t[101]:(ke=c?(0,P.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[100]=c,t[101]=ke);let Ae;t[102]!==y||t[103]!==u||t[104]!==_||t[105]!==x||t[106]!==i?(Ae=u?(0,P.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(he)}):(0,P.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[_.map(e=>{let t=y(e.name);return(0,P.jsxs)(`label`,{className:d(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>x(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,P.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,P.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),_.length===0?(0,P.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=y,t[103]=u,t[104]=_,t[105]=x,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==Z||t[113]!==je?(Me=(0,P.jsxs)(`div`,{className:`space-y-5`,children:[Z,je]}),t[112]=Z,t[113]=je,t[114]=Me):Me=t[114],Me}function he(e){return(0,P.jsx)(y,{className:`h-14 rounded-xl`},e)}function U(e){return e.name}function W(e){return e.enabled}function G(e,t){return e.name.localeCompare(t.name)}function ge(e){return e.name}function K(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function _e(e){let t=(0,ce.c)(98),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,o=w(),[s,c]=(0,se.useState)(``),[u,f]=(0,se.useState)(`all`),[p,m]=(0,se.useState)(),h;t[0]===i?h=t[1]:(h=new Map(i.map(Y)),t[0]=i,t[1]=h);let g=h,v;t[2]!==i||t[3]!==n.tools?(v=[...new Set([...i.map(J),...Object.keys(n.tools)])].filter(q).sort(),t[2]=i,t[3]=n.tools,t[4]=v):v=t[4];let y=v,b;if(t[5]!==y||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),b=y.filter(e),t[5]=y,t[6]=n.tools,t[7]=b}else b=t[7];let ee=b.length,S;if(t[10]!==y||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),S=y.filter(e),t[10]=y,t[11]=n.tools,t[12]=S}else S=t[12];let C=S.length,T;if(t[15]!==y||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),T=y.filter(e),t[15]=y,t[16]=n.tools,t[17]=T}else T=t[17];let E;t[20]!==b.length||t[21]!==S.length||t[22]!==T.length?(E={allow:ee,ask:C,deny:T.length},t[20]=b.length,t[21]=S.length,t[22]=T.length,t[23]=E):E=t[23];let te=E,D;if(t[24]!==y||t[25]!==g||t[26]!==n.tools||t[27]!==u||t[28]!==s){let e=s.trim().toLowerCase();D=y.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=g.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=y,t[25]=g,t[26]=n.tools,t[27]=u,t[28]=s,t[29]=D}else D=t[29];let O=D,k;t[30]!==n||t[31]!==r?(k=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=k):k=t[32];let A=k,re=a?`全部 ${y.length}`:`All ${y.length}`,j;t[33]===re?j=t[34]:(j={id:`all`,label:re},t[33]=re,t[34]=j);let ae=a?`允许 ${te.allow}`:`Allow ${te.allow}`,M;t[35]===ae?M=t[36]:(M={id:`allow`,label:ae},t[35]=ae,t[36]=M);let oe=a?`询问 ${te.ask}`:`Ask ${te.ask}`,N;t[37]===oe?N=t[38]:(N={id:`ask`,label:oe},t[37]=oe,t[38]=N);let F=a?`禁用 ${te.deny}`:`Deny ${te.deny}`,I;t[39]===F?I=t[40]:(I={id:`deny`,label:F},t[39]=F,t[40]=I);let L;t[41]!==j||t[42]!==M||t[43]!==N||t[44]!==I?(L=[j,M,N,I],t[41]=j,t[42]=M,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,le;t[46]===z?le=t[47]:(le=(0,P.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=le);let ue=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,B;t[48]===ue?B=t[49]:(B=(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ue}),t[48]=ue,t[49]=B);let de;t[50]!==le||t[51]!==B?(de=(0,P.jsxs)(`div`,{children:[le,B]}),t[50]=le,t[51]=B,t[52]=de):de=t[52];let V;t[53]!==u||t[54]!==R?(V=(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:d(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=u,t[54]=R,t[55]=V):V=t[55];let fe=a?`搜索工具`:`Search tools`,H;t[56]===fe?H=t[57]:(H=(0,P.jsx)(`span`,{className:`sr-only`,children:fe}),t[56]=fe,t[57]=H);let pe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,P.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=pe):pe=t[58];let me;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>c(e.target.value),t[59]=me):me=t[59];let he=a?`搜索工具`:`Search tools`,U;t[60]!==s||t[61]!==he?(U=(0,P.jsx)(`input`,{type:`search`,value:s,onChange:me,placeholder:he,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=s,t[61]=he,t[62]=U):U=t[62];let W;t[63]!==H||t[64]!==U?(W=(0,P.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[H,pe,U]}),t[63]=H,t[64]=U,t[65]=W):W=t[65];let G;t[66]!==V||t[67]!==W?(G=(0,P.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[V,W]}),t[66]=V,t[67]=W,t[68]=G):G=t[68];let ge=a?`工具调用限制`:`Tool call limits`,_e=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,X;t[69]!==ge||t[70]!==_e?(X=(0,P.jsx)(ne,{title:ge,summary:_e,children:null}),t[69]=ge,t[70]=_e,t[71]=X):X=t[71];let Z;if(t[72]!==g||t[73]!==n.tools||t[74]!==p||t[75]!==o||t[76]!==A||t[77]!==O||t[78]!==a){let e;t[80]!==g||t[81]!==n.tools||t[82]!==p||t[83]!==o||t[84]!==A||t[85]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=g.get(e),i=p===e;return(0,P.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,P.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>A(e,{mode:n}),className:d(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),o?(0,P.jsx)(_,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>m(i?void 0:e),children:(0,P.jsx)(x,{className:`size-4`})}):null]})]}),i&&o?(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,P.jsx)(ie,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>A(e,{maxCallsPerTurn:K(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,P.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,P.jsx)(ie,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>A(e,{timeoutMs:K(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[80]=g,t[81]=n.tools,t[82]=p,t[83]=o,t[84]=A,t[85]=a,t[86]=e):e=t[86],Z=O.map(e),t[72]=g,t[73]=n.tools,t[74]=p,t[75]=o,t[76]=A,t[77]=O,t[78]=a,t[79]=Z}else Z=t[79];let Q;t[87]!==O.length||t[88]!==a?(Q=O.length===0?(0,P.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[87]=O.length,t[88]=a,t[89]=Q):Q=t[89];let $;t[90]!==Z||t[91]!==Q?($=(0,P.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[Z,Q]}),t[90]=Z,t[91]=Q,t[92]=$):$=t[92];let ve;return t[93]!==de||t[94]!==G||t[95]!==X||t[96]!==$?(ve=(0,P.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[de,G,X,$]}),t[93]=de,t[94]=G,t[95]=X,t[96]=$,t[97]=ve):ve=t[97],ve}function q(e){return e!==`computer_use`||b()}function J(e){return e.id}function Y(e){return[e.id,e.description]}function X(){let e=(0,ce.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsxs)(ae,{gap:`gap-5`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(y,{className:`h-7 w-56`}),(0,P.jsx)(y,{className:`h-4 w-96 max-w-full`})]}),(0,P.jsx)(y,{className:`h-9 w-28`})]}),(0,P.jsx)(y,{className:`h-20 rounded-2xl`}),(0,P.jsx)(y,{className:`h-12 rounded-xl`}),(0,P.jsx)(y,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Z(e){let t=(0,ce.c)(73),{initial:n,builtinTools:r,zh:a}=e,{data:o}=g(`settings-agent-defaults`,S),s=o?.defaults??n,[c,l]=i(),f;t[0]===c?f=t[1]:(f=c.get(`panel`),t[0]=c,t[1]=f);let p=f,m=p===`skills`||p===`tools`||p===`runtime`?p:`models`,h;t[2]!==c||t[3]!==l?(h=e=>{let t=new URLSearchParams(c);t.set(`panel`,e),l(t,{replace:!0})},t[2]=c,t[3]=l,t[4]=h):h=t[4];let v=h,y;t[5]===n?y=t[6]:(y=()=>structuredClone(n),t[5]=n,t[6]=y);let[b,ee]=(0,se.useState)(y),x;t[7]===n?x=t[8]:(x=()=>structuredClone(n),t[7]=n,t[8]=x);let[C,w]=(0,se.useState)(x),T;t[9]===b?T=t[10]:(T=JSON.stringify(b),t[9]=b,t[10]=T);let ne;t[11]===C?ne=t[12]:(ne=JSON.stringify(C),t[11]=C,t[12]=ne);let D=T!==ne,O=a?`共用模型`:`Shared models`,A;t[13]===O?A=t[14]:(A={id:`models`,label:O,icon:u},t[13]=O,t[14]=A);let ie=a?`技能`:`Skills`,N;t[15]===ie?N=t[16]:(N={id:`skills`,label:ie,icon:te},t[15]=ie,t[16]=N);let F=a?`工具`:`Tools`,I;t[17]===F?I=t[18]:(I={id:`tools`,label:F,icon:k},t[17]=F,t[18]=I);let L=a?`运行`:`Runtime`,R;t[19]===L?R=t[20]:(R={id:`runtime`,label:L,icon:E},t[19]=L,t[20]=R);let z;t[21]!==N||t[22]!==I||t[23]!==R||t[24]!==A?(z=[A,N,I,R],t[21]=N,t[22]=I,t[23]=R,t[24]=A,t[25]=z):z=t[25];let ue=z,B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=async e=>{let t=structuredClone(e),n=await S(),r=await re({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);ee(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),w(structuredClone(i))},t[26]=B):B=t[26];let de=B,fe;t[27]!==D||t[28]!==b?(fe={value:b,dirty:D,onSave:de,delayMs:0},t[27]=D,t[28]=b,t[29]=fe):fe=t[29];let H=oe(fe),pe=H.onBlurCapture,he=a?`智能体设置`:`Agent settings`,U;t[30]!==H.error||t[31]!==H.status?(U=(0,P.jsx)(M,{status:H.status,error:H.error}),t[30]=H.error,t[31]=H.status,t[32]=U):U=t[32];let W;t[33]!==he||t[34]!==U?(W=(0,P.jsx)(j,{title:he,actions:U}),t[33]=he,t[34]=U,t[35]=W):W=t[35];let G;t[36]!==H.error||t[37]!==H.retry||t[38]!==a?(G=H.error?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,P.jsx)(`span`,{children:H.error}),(0,P.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:H.retry,children:a?`重试`:`Retry`})]}):null,t[36]=H.error,t[37]=H.retry,t[38]=a,t[39]=G):G=t[39];let ge=a?`默认配置分区`:`Default configuration sections`,K;t[40]!==m||t[41]!==v||t[42]!==ue?(K=ue.map(e=>{let{id:t,label:n,icon:r}=e;return(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":m===t,onClick:()=>v(t),className:d(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,P.jsx)(r,{className:d(`size-4 shrink-0`,m===t?`text-accent`:`text-fg-subtle`)}),(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[40]=m,t[41]=v,t[42]=ue,t[43]=K):K=t[43];let q;t[44]!==ge||t[45]!==K?(q=(0,P.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":ge,children:K}),t[44]=ge,t[45]=K,t[46]=q):q=t[46];let J;t[47]!==m||t[48]!==s||t[49]!==a?(J=m===`models`?(0,P.jsx)(le,{draft:s,zh:a}):null,t[47]=m,t[48]=s,t[49]=a,t[50]=J):J=t[50];let Y;t[51]!==m||t[52]!==b||t[53]!==a?(Y=m===`skills`?(0,P.jsx)(me,{draft:b,setDraft:ee,zh:a}):null,t[51]=m,t[52]=b,t[53]=a,t[54]=Y):Y=t[54];let X;t[55]!==m||t[56]!==r||t[57]!==b||t[58]!==a?(X=m===`tools`?(0,P.jsx)(_e,{draft:b,setDraft:ee,builtinTools:r,zh:a}):null,t[55]=m,t[56]=r,t[57]=b,t[58]=a,t[59]=X):X=t[59];let Z;t[60]!==m||t[61]!==b||t[62]!==a?(Z=m===`runtime`?(0,P.jsx)(V,{draft:b,setDraft:ee,zh:a}):null,t[60]=m,t[61]=b,t[62]=a,t[63]=Z):Z=t[63];let Q;return t[64]!==H.onBlurCapture||t[65]!==W||t[66]!==G||t[67]!==q||t[68]!==J||t[69]!==Y||t[70]!==X||t[71]!==Z?(Q=(0,P.jsxs)(ae,{gap:`gap-5`,onBlurCapture:pe,children:[W,G,q,J,Y,X,Z]}),t[64]=H.onBlurCapture,t[65]=W,t[66]=G,t[67]=q,t[68]=J,t[69]=Y,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72],Q}function Q(){let e=(0,ce.c)(17),t=f(ve),n=p($)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=g(t?`settings-agent-defaults`:null,S);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,P.jsx)(ae,{children:(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,P.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,P.jsx)(_,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,P.jsxs)(ae,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(X,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,P.jsx)(Z,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function $(e){return e.language}function ve(e){return e.conversationId}export{Q as AgentDefaultsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as ee}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-O0BEUKnx.js";import{t as c}from"./cn-0WouolD0.js";import{a as l,n as te,r as u}from"./locale-store-DMy9W6IG.js";import{a as d,i as f,o as p,r as ne,s as m,t as re}from"./dist-BGTk37IG.js";import{a as h}from"./vendor-swr-BIWyz7Rc.js";import{t as g}from"./button-aIC072nz.js";import{Cc as ie,Mi as _,Mo as v,Uc as y,ts as b}from"./index-xTL-vb51.js";var x=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function T(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function E(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function D(e,t,n){let r=await l(u(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function O(e){let t=(0,x.c)(49),{pluginId:n,server:r,enabled:ee}=e,i=te(ae),a;t[0]===i?a=t[1]:(a=i.startsWith(`zh`),t[0]=i,t[1]=a);let o=a,[s,c]=(0,S.useState)(``),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(``),[p,ne]=(0,S.useState)(r.type===`stdio`?`API_KEY`:`Authorization`),[m,re]=(0,S.useState)(r.type===`stdio`?``:`Bearer `),h;t[2]!==r.name||t[3]!==r.type?(h=(0,C.jsxs)(`p`,{className:`font-medium`,children:[r.name,` · `,r.type]}),t[2]=r.name,t[3]=r.type,t[4]=h):h=t[4];let ie=r.type===`stdio`?`xopc mcp list`:`xopc mcp login ${r.id}`,_;t[5]===ie?_=t[6]:(_=(0,C.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:ie}),t[5]=ie,t[6]=_);let v;t[7]!==p||t[8]!==n||t[9]!==m||t[10]!==s||t[11]!==r.name||t[12]!==r.type||t[13]!==o?(v=e=>{e.preventDefault(),u(!0),f(``),D(`/api/extensions/agent-plugins/${encodeURIComponent(n)}/mcp/${encodeURIComponent(r.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:r.type===`stdio`?`env`:`headers`,key:p,value:s,prefix:m}]}).then(()=>{c(``),f(o?`已保存`:`Saved`)}).catch(e=>f(String(e))).finally(()=>u(!1))},t[7]=p,t[8]=n,t[9]=m,t[10]=s,t[11]=r.name,t[12]=r.type,t[13]=o,t[14]=v):v=t[14];let y=o?`字段名`:`Field name`,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>ne(e.target.value),t[15]=b):b=t[15];let T;t[16]===p?T=t[17]:(T=(0,C.jsx)(`input`,{className:w,value:p,onChange:b,required:!0}),t[16]=p,t[17]=T);let E;t[18]!==y||t[19]!==T?(E=(0,C.jsxs)(`label`,{className:`block`,children:[y,T]}),t[18]=y,t[19]=T,t[20]=E):E=t[20];let O=o?`前缀`:`Prefix`,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>re(e.target.value),t[21]=k):k=t[21];let A;t[22]===m?A=t[23]:(A=(0,C.jsx)(`input`,{className:w,value:m,onChange:k}),t[22]=m,t[23]=A);let j;t[24]!==O||t[25]!==A?(j=(0,C.jsxs)(`label`,{className:`block`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M=o?`密钥`:`Secret`,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>c(e.target.value),t[27]=N):N=t[27];let P;t[28]===s?P=t[29]:(P=(0,C.jsx)(`input`,{type:`password`,autoComplete:`off`,className:w,value:s,onChange:N,required:!0}),t[28]=s,t[29]=P);let F;t[30]!==M||t[31]!==P?(F=(0,C.jsxs)(`label`,{className:`block`,children:[M,P]}),t[30]=M,t[31]=P,t[32]=F):F=t[32];let I=!ee||l||!s,L=o?`保存密钥`:`Save API key`,R;t[33]!==I||t[34]!==L?(R=(0,C.jsx)(g,{type:`submit`,disabled:I,children:L}),t[33]=I,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==E||t[37]!==j||t[38]!==F||t[39]!==R||t[40]!==v?(z=(0,C.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:v,children:[E,j,F,R]}),t[36]=E,t[37]=j,t[38]=F,t[39]=R,t[40]=v,t[41]=z):z=t[41];let B;t[42]===d?B=t[43]:(B=d?(0,C.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:d}):null,t[42]=d,t[43]=B);let V;return t[44]!==z||t[45]!==B||t[46]!==h||t[47]!==_?(V=(0,C.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[h,_,z,B]}),t[44]=z,t[45]=B,t[46]=h,t[47]=_,t[48]=V):V=t[48],V}function ae(e){return e.language}function k({extension:e,onClose:t,initialSource:n=``,marketplace:r,autoInstall:l=!1}){let u=te(e=>e.language),x=u.startsWith(`zh`),ae=r?.localizations?.[x?`zh-CN`:`en`],k=ae?.displayName??r?.name,A=ae?.description??r?.description,j=(0,S.useId)(),{mutate:M}=h(),[N,P]=(0,S.useState)(e),[F,I]=(0,S.useState)(n),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(``),[oe,se]=(0,S.useState)(!1),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(!1),[fe,U]=(0,S.useState)(!1),[pe,W]=(0,S.useState)(!1),[G,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(!1),_e=(0,S.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(N?.pluginId??``)}`,q=F.trim().startsWith(`store:`),J=()=>M(`gateway-extensions-list`);async function Y(e){B(!0),H(``);try{await e()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}function X(e){I(e),R(null),H(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function ve(){if(!Z?.openDirectory){W(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){W(!0);return}let e=await Z.openFile({...Q?{defaultPath:Q}:{},extensions:[`zip`]});e&&X(e)}function be(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!be(e))return;e.preventDefault(),U(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){H(x?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):H(x?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&X(n.trim().split(/\r?\n/)[0])}async function Se(e){P(await D(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!N,n=await D(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:F,reviewHash:e.reviewHash});P(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await D(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),P(n),await J()),R(null),ge(t&&n.activationEligible===!0)}async function we(){let e=await D(`/api/extensions/inspect`,`POST`,{source:F});if(E(e,r)){R(e);return}await Ce(e)}(0,S.useEffect)(()=>{e&&P(e)},[e]),(0,S.useEffect)(()=>{!l||N||!q||_e.current||(_e.current=!0,Y(we))},[l,N,q]);let Te=l&&!N&&q&&!_e.current,$=N?.components;return(0,C.jsx)(re,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,C.jsxs)(p,{children:[(0,C.jsx)(d,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,C.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,C.jsx)(m,{className:`font-semibold`,children:N?.name??k??(x?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,C.jsx)(g,{variant:`ghost`,onClick:t,children:x?`关闭`:`Close`})]}),(0,C.jsx)(f,{className:`sr-only`,children:x?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,C.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!N&&q?(0,C.jsxs)(`section`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,C.jsx)(b,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:k??L?.manifest.name??F.slice(6)}),A?(0,C.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:A}):null,(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r?.publisher?.verification===`verified`?x?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:x?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),L?null:(0,C.jsxs)(g,{className:`w-full`,disabled:z||Te,onClick:()=>void Y(we),children:[z||Te?(0,C.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,z||Te?x?`正在安全检查并安装…`:`Checking and installing…`:x?`一键安装`:`Install`]})]}):null,N?(0,C.jsxs)(C.Fragment,{children:[he?(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,C.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:x?`插件已安装并启用`:`Plugin installed and enabled`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,N.activationEligible?null:(0,C.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-accent-fg`,children:x?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,C.jsx)(g,{disabled:z||N.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:x?`启用插件`:`Enable plugin`})]}),(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,N.version,` · `,N.readiness&&{ready:x?`已就绪`:`Ready`,setup_required:x?`待连接`:`Setup required`,degraded:x?`部分不可用`:`Partially available`,blocked:x?`已阻止`:`Blocked`}[N.readiness]]}),N.provenance?(0,C.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[N.provenance.publisherVerification===`verified`?x?`已认证发布者`:`Verified publisher`:x?`社区发布者`:`Community publisher`,` · `,N.provenance.packageName,`@`,N.provenance.version,` · SHA-256 `,N.provenance.sha256.slice(0,12),`…`,N.provenance.riskTier?` · ${N.provenance.riskTier}`:``]}):null,(0,C.jsx)(`p`,{className:`text-sm`,children:N.description}),N.activationEligible?(0,C.jsx)(g,{disabled:z,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:x?`停用`:`Disable`}):null,N.canRollback?(0,C.jsx)(g,{disabled:z,variant:`secondary`,onClick:()=>void Y(async()=>{P(await D(`${K}/rollback`,`POST`)),await J()}),children:x?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,C.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:x?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,C.jsx)(g,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/skills?source=plugin`,children:x?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,C.jsx)(g,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/connectors?tab=connected`,children:x?`管理连接`:`Manage connections`})}):null]})]}):null,N.components?.mcp.length?(0,C.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,C.jsx)(`span`,{children:x?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,C.jsx)(y,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:x?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,C.jsx)(`div`,{className:`mt-3 space-y-3`,children:N.components.mcp.map(e=>(0,C.jsx)(O,{pluginId:N.pluginId,server:e,enabled:N.active},e.id))})]}):null,N.diagnostics?.map((e,t)=>(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&N?(0,C.jsxs)(g,{variant:`ghost`,className:`px-0`,"aria-expanded":G,onClick:()=>me(e=>!e),children:[(0,C.jsx)(y,{className:c(`size-4 transition-transform motion-reduce:transition-none`,G&&`rotate-180`),"aria-hidden":!0}),x?`高级操作`:`Advanced actions`]}):null,!q||G?(0,C.jsxs)(`form`,{className:c(`space-y-3`,N&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{R(await D(`/api/extensions/inspect`,`POST`,{source:F}))})},children:[(0,C.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:c(`rounded-xl border border-dashed p-3 transition-colors`,fe?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),U(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||U(!1)},onDrop:xe,children:[(0,C.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,C.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:j,className:`block text-sm font-medium`,children:N?x?`更新包来源`:`Update package source`:x?`安装包来源`:`Package source`}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:x?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,C.jsx)(`input`,{id:j,className:w,value:F,onChange:e=>X(e.target.value),placeholder:x?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(g,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ve),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择目录`:`Choose directory`]}),(0,C.jsxs)(g,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ye),children:[(0,C.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),x?`选择 ZIP`:`Choose ZIP`]})]}):(0,C.jsxs)(g,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>W(!0),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择文件或目录`:`Choose file or folder`]})})]}),(0,C.jsx)(g,{type:`submit`,variant:`secondary`,disabled:z||!F,children:x?`检查安装包`:`Inspect package`})]}):null,L?(0,C.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(b,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:x?`需要你的授权`:`Your authorization is required`}),(0,C.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:x?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,C.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:L.addedCapabilities.map(e=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,C.jsx)(`span`,{children:T(e,x)})]},e))}),L.diagnostics.map((e,t)=>(0,C.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsxs)(g,{disabled:z||!!N&&L.manifest.name!==N.pluginId,onClick:()=>void Y(()=>Ce(L)),children:[z?(0,C.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x?`授权并安装`:`Authorize and install`]}),(0,C.jsx)(g,{variant:`ghost`,disabled:z,onClick:()=>R(null),children:x?`取消`:`Cancel`})]})]}):null,N&&(!q||G)?(0,C.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ue?(0,C.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,C.jsx)(`p`,{children:x?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:oe,onChange:e=>se(e.target.checked)}),x?`同时删除插件数据`:`Also delete plugin data`]}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.target.checked)}),x?`同时删除本地凭据`:`Also delete local credentials`]}),(0,C.jsx)(g,{disabled:z,onClick:()=>void Y(async()=>{await D(K,`DELETE`,{removeData:oe,removeCredentials:ce}),await J(),t()}),children:x?`确认卸载`:`Confirm uninstall`})]}):(0,C.jsx)(g,{variant:`ghost`,disabled:z,onClick:()=>de(!0),children:x?`卸载插件`:`Uninstall`})}):null,V?(0,C.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:V}):null]})]}),Z?null:(0,C.jsx)(_,{open:pe,onOpenChange:W,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:s(u).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:x?`选择插件安装包`:`Choose plugin package`,description:x?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:x?`使用此来源`:`Use this source`,nested:!0})]})})}export{O as n,k as t};
|