@xopcai/xopc 0.0.276 → 0.0.277
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/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sj_1IC5H.js → agent-avatar-dicebear-Cavbls0E.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DyCyuJpi.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CIzev0Qj.js → agents-DlDTItrB.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-5gS0_LWl.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-BeXvF-dZ.js → appearance-settings-DHzZCJon.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-__yzruGu.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BSgaIIGE.js → archive-plugin-Ia98yZe3.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CGNt02hP.js → attachment-load-DiWW88c8.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DoafJiVA.js → automations-page-BuhTeGRJ.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DaisbmEh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BsAL26Aq.js → binary-plugins-DDD48cJv.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BxB7m8aI.js → block-editor-0AWVCD3F.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DGCqIPXT.js → browser-automation-inputs-DcVLoIzc.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BNsO-Ip2.js → browser-automations-page-BKOYX5xV.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-C7zjxscU.js +8 -0
- package/dist/gateway/static/root/assets/{button-B11EPpor.js → button-BA45yciM.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-7kZMT1r6.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-BKUh6hzO.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-ZCFwco1W.js → chat-terminal-dock-CW9Byi8V.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-m8J-F3u8.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-C26e13YU.js → cron-expression-CjrWuy2m.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CpxFfgpg.js → date-picker-gdYmKC8W.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-eCIGAfHa.js → dependency-picker-40BYmiMc.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-_MSZvIDO.js → desktop-pet-By1z6tKE.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-feBnJWkV.js → desktop-pet-settings-ByjJqx9H.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CfWQfz7a.js +1 -0
- package/dist/gateway/static/root/assets/{dist-CpzYSoz7.js → dist-BGTk37IG.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-DBS3OB8K.js → dist-CI_fqRk-.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-DLmwHyAh.js → dist-Che_jiQF.js} +1 -1
- package/dist/gateway/static/root/assets/es2015-DBLcMg5B.js +41 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CotBlxJ-.js → extension-debug-page-DQO65KbM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CFBmQ7U3.js → extension-page-Db32jip6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Cd1lfh8z.js → extension-settings-page-CL8Wx8lf.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-wLly-Kc1.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-DRG0u1ON.js → heartbeat-settings-CRXWu2q6.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-FqgSwpmy.js +1 -0
- package/dist/gateway/static/root/assets/index-5UchbidQ.js +74 -0
- package/dist/gateway/static/root/assets/index-CXF9-BpI.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BLHsdFIQ.js → keyboard-shortcuts-settings-CjehhHPz.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DtYZa4GK.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BjAj1xhq.js → local-apps-page-CrIdaTrK.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-FfSwV_VH.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CPHxDaOw.js → management-settings-BakV5aOw.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B2IR4E2r.js → markdown-view-DF3aJP_5.js} +4 -4
- package/dist/gateway/static/root/assets/{media-plugins-BUOzcXCL.js → media-plugins-Blv9U6Jp.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-JbvyGdEX.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dm7mE2FK.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-BgEYFhqS.js → page-tabs-BQfVtLLC.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DGmMQt4t.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-C-pQIx6W.js → preview-open-alternatives-kjHFiO81.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-card-DfjMVJUW.js → proactive-card-Ap_wfos3.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-BGVcVsbd.js → proactive-page-D1lEuanT.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-BazdmFYo.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-h00lfcVI.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-C2Bo1FAL.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-_bZYAl49.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DkAjFJ-9.js → runtime-tools-settings-panel-BhJlopSW.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BpDcuSsl.js → schema-form-cxoO_5I1.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-F7CHsvPa.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DtZSUX4H.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-RElRijJw.js → settings-form-section-BiRTWiBi.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CaixunoA.js → settings-page-D-Cb71pq.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-VPfBsNVv.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CC-bFOTf.js → share-preview-page-DciHfTay.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BS2pnWO0.js +1 -0
- package/dist/gateway/static/root/assets/{skill-reload-api-CcOtxf53.js → skill-reload-api-DX344nVV.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DmRvRxtY.js → skills-page-BhfKUsv7.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page.utils-CU7PALQB.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DRIJ5mXq.js → system-settings-panel-GpjNbqvM.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CElcQ9Sh.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-Bhi_x_h4.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Cq4--C1i.js → use-autosave-LvCiBidm.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BydARq2C.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CbJ6tKGI.js → voice-api-key-field-BlGysZxj.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-DvIQOR5x.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-vw1229Fh.js → workflow-run-setup-panel-JIp60bXT.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B972t6zx.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +6 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- 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/extensions/update.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +7 -0
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/notes/service.js +3 -2
- package/dist/src/tasks/home-query-service.js +1 -0
- package/dist/src/tasks/project-operating-view-service.js +7 -4
- package/dist/src/tasks/task-application-service.js +32 -2
- package/dist/src/tasks/task-context-assembler.js +6 -3
- package/dist/src/tasks/task-read-model-projector.js +7 -5
- package/dist/src/tasks/task-run-coordinator.js +2 -0
- package/dist/src/tasks/task-run-repository.js +4 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B5MRLEy8.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-DY3Vwxjq.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Ch_9Ffgk.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-MACr99IO.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Nvdoi0B1.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BluLJq5I.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DYxxhcjb.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Bpcp8UyE.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_fB0fml.js +0 -1
- package/dist/gateway/static/root/assets/es2015-BvLh9GaE.js +0 -41
- package/dist/gateway/static/root/assets/gateway-settings-BH35C8RI.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BlZk-aD4.js +0 -1
- package/dist/gateway/static/root/assets/index-CfQor-TM.js +0 -74
- package/dist/gateway/static/root/assets/index-DKy1Qn1_.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-DJd71FlC.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-5MWeZ6Ae.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-panel-Bch98ut3.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CWO5dQKN.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-Dz_Qis2R.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DsQcgZkI.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DZFVirjV.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B2g6inq-.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CbkUOkQY.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page--7-w-0WS.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvZrH_sp.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Ul06Y5YX.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DwV2Wh7S.js +0 -1
- package/dist/gateway/static/root/assets/skills-page.utils-CT0-daZD.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BQjLHqSk.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-IvWcgZdD.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-hwc5-nqV.js +0 -2
- package/dist/gateway/static/root/assets/work-discovery-overlay-BG2pmXL3.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DZWpJHDr.js +0 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAllModels, getAvailableModels, init_providers } from "../../../providers/index.js";
|
|
2
2
|
import { ActivationPlanner } from "../../../extensions/activation-planner.js";
|
|
3
3
|
import { mergeActivationContext } from "../../../extensions/activation-context.js";
|
|
4
|
-
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
5
4
|
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
5
|
+
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
6
6
|
import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
7
7
|
import { createOAuthHandler } from "../oauth.js";
|
|
8
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
@@ -406,6 +406,13 @@ function registerTaskRoutes(authenticated, deps) {
|
|
|
406
406
|
latest: result.model
|
|
407
407
|
}, 409);
|
|
408
408
|
}
|
|
409
|
+
if (parsed.data.command?.type === "add_wait" && parsed.data.command.wait.kind === "paused" || parsed.data.command?.type === "close") {
|
|
410
|
+
const activeRun = runs.getActiveRoot(c.req.param("id"));
|
|
411
|
+
if (activeRun?.sessionKey) {
|
|
412
|
+
const liveRunId = deps.service.getActiveWebchatRunId(activeRun.sessionKey);
|
|
413
|
+
if (liveRunId) await deps.service.abortAgentRun(liveRunId);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
409
416
|
if (result.runId || parsed.data.command?.type === "resolve_wait") deps.service.dispatchTaskRuns();
|
|
410
417
|
else deps.service.dispatchTaskEvents();
|
|
411
418
|
if (parsed.data.command?.type === "close" && parsed.data.command.resolution === "done") signals.dependencyClosed(c.req.param("id"));
|
|
@@ -8,8 +8,8 @@ import { reloadImageGenerationProviders } from "../../agent/image/generation/pro
|
|
|
8
8
|
import "../../agent/mcp/bundle-mcp-tools.js";
|
|
9
9
|
import { ConfigHotReloader } from "../../config/reload.js";
|
|
10
10
|
import "../../config/index.js";
|
|
11
|
-
import { sanitizeTunnelConfig } from "../../tunnel/tunnel-config.js";
|
|
12
11
|
import { computeBundledExtensionExtensionsPatch } from "../../extensions/bundled-extension-activation.js";
|
|
12
|
+
import { sanitizeTunnelConfig } from "../../tunnel/tunnel-config.js";
|
|
13
13
|
//#region src/gateway/service/config-coordinator.ts
|
|
14
14
|
init_providers();
|
|
15
15
|
init_logger();
|
|
@@ -51,8 +51,17 @@ import { MessageBus, MessageBusShutdownError } from "../infra/bus/queue.js";
|
|
|
51
51
|
import "../infra/bus/index.js";
|
|
52
52
|
import { AgentService } from "../agent/service.js";
|
|
53
53
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
54
|
+
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
55
|
+
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
56
|
+
import { ChannelManager } from "../channels/manager.js";
|
|
54
57
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
55
58
|
import "../config/index.js";
|
|
59
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
60
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
61
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
62
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
63
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
64
|
+
import "../discussions/index.js";
|
|
56
65
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
57
66
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
58
67
|
import "../knowledge/index.js";
|
|
@@ -60,17 +69,8 @@ import { ConnectionRecoveryService } from "../connectors/connection-recovery-ser
|
|
|
60
69
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
61
70
|
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
62
71
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
63
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
64
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
65
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
66
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
67
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
68
|
-
import "../discussions/index.js";
|
|
69
72
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
70
73
|
import "../endpoint-tools/index.js";
|
|
71
|
-
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
72
|
-
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
73
|
-
import { ChannelManager } from "../channels/manager.js";
|
|
74
74
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
75
75
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
76
76
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
1
2
|
import "./update-channels.js";
|
|
2
3
|
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
3
|
-
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
4
4
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
5
5
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
6
6
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
|
@@ -36,8 +36,9 @@ function inferKind(markdown, hasAttachments, attachments) {
|
|
|
36
36
|
return "thought";
|
|
37
37
|
}
|
|
38
38
|
function deriveDefaultTitle(markdown) {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const heading = markdown?.match(/^#{1,3}\s+(.+)$/m)?.[1];
|
|
40
|
+
const normalized = parseNoteMarkdown(heading ?? markdown ?? "").plainText.trim().split(/[\n。!?!?]/).map((line) => line.trim()).find(Boolean)?.replace(/\s+/g, " ");
|
|
41
|
+
return normalized ? Array.from(normalized).slice(0, 36).join("") : void 0;
|
|
41
42
|
}
|
|
42
43
|
function splitMeaningfulLines(markdown) {
|
|
43
44
|
return parseNoteMarkdown(markdown ?? "").plainText.split(/\n|。|;|;/).map((line) => line.trim()).filter(Boolean);
|
|
@@ -63,6 +63,7 @@ function attentionDetail(kind, status, locale, timeoutSeconds) {
|
|
|
63
63
|
}
|
|
64
64
|
function decisionFromTask(model, projectName, locale) {
|
|
65
65
|
const task = model.task;
|
|
66
|
+
if (task.phase === "closed" || model.operationalState === "waiting" && model.attention.length === 0) return null;
|
|
66
67
|
const isChinese = locale?.toLowerCase().startsWith("zh") ?? task.locale === "zh";
|
|
67
68
|
if (task.phase === "review") return {
|
|
68
69
|
id: `task:${task.id}:review`,
|
|
@@ -17,8 +17,9 @@ function summarizeProjectOperatingView(view) {
|
|
|
17
17
|
counts.needsUser += 1;
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
-
if (task.phase === "closed")
|
|
21
|
-
|
|
20
|
+
if (task.phase === "closed") {
|
|
21
|
+
if (task.resolution === "done") counts.done += 1;
|
|
22
|
+
} else if ([
|
|
22
23
|
"queued",
|
|
23
24
|
"running",
|
|
24
25
|
"verifying"
|
|
@@ -48,7 +49,8 @@ var ProjectOperatingViewService = class {
|
|
|
48
49
|
const cards = projectTasks.map((task) => {
|
|
49
50
|
const model = this.#projector.project(task);
|
|
50
51
|
const latest = this.#runs.getLatestRoot(task.id);
|
|
51
|
-
const receipt = latest ? this.#runs.getReceipt(latest.id) : void 0;
|
|
52
|
+
const receipt = latest?.contractVersion === task.latestContractVersion ? this.#runs.getReceipt(latest.id) : void 0;
|
|
53
|
+
const nextCheckAt = this.#runs.listActiveWaits(task.id).filter((wait) => wait.kind !== "paused" && wait.resumeAt !== void 0).map((wait) => wait.resumeAt).sort((a, b) => a - b)[0];
|
|
52
54
|
return {
|
|
53
55
|
id: task.id,
|
|
54
56
|
title: task.title,
|
|
@@ -62,6 +64,7 @@ var ProjectOperatingViewService = class {
|
|
|
62
64
|
blockedBy: this.#dependencies.listBlocking(task.id),
|
|
63
65
|
allowedCommands: model.allowedCommands,
|
|
64
66
|
...receipt ? { latestVerification: receipt.verification.status } : {},
|
|
67
|
+
...nextCheckAt !== void 0 && model.allowedCommands.includes("add_wait") ? { nextCheckAt } : {},
|
|
65
68
|
updatedAt: task.updatedAt
|
|
66
69
|
};
|
|
67
70
|
});
|
|
@@ -95,7 +98,7 @@ var ProjectOperatingViewService = class {
|
|
|
95
98
|
digest: {
|
|
96
99
|
health: cards.length === 0 ? "empty" : attentionCount > 0 ? "attention" : "healthy",
|
|
97
100
|
summary: cards.length === 0 ? "No tasks yet" : `${cards.filter(moving).length} moving, ${attentionCount} need attention`,
|
|
98
|
-
recommendedAction: cards.find(needsUser)?.attention[0]?.summary ?? cards.find((card) => card.attention.length > 0)?.attention[0]?.summary ?? cards.find(moving)?.title ?? cards.find((card) => card.phase === "ready")?.title ?? cards.find((card) => card.phase === "backlog")?.title
|
|
101
|
+
recommendedAction: cards.find(needsUser)?.attention[0]?.summary ?? cards.find((card) => card.attention.length > 0)?.attention[0]?.summary ?? cards.find(moving)?.title ?? cards.find((card) => card.phase === "ready" && card.allowedCommands.includes("start"))?.title ?? cards.find((card) => card.phase === "backlog" && card.operationalState === "idle")?.title
|
|
99
102
|
},
|
|
100
103
|
monitoring: this.#monitoring.get(project.id)
|
|
101
104
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { verifiedTaskCriteria } from "../../packages/gateway-contract/src/tasks.js";
|
|
2
3
|
import { enqueueTaskAttentionRequiredEvent, enqueueTaskChangedEvent } from "./task-change-events.js";
|
|
3
4
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
4
5
|
import { TaskRepository } from "./task-repository.js";
|
|
@@ -208,7 +209,7 @@ var TaskApplicationService = class {
|
|
|
208
209
|
});
|
|
209
210
|
break;
|
|
210
211
|
case "request_review":
|
|
211
|
-
result = task.phase === "active" ? this.lifecycle(task.id, task.version, "review") : {
|
|
212
|
+
result = task.phase === "active" && !this.#runs.getActiveRoot(task.id) && this.#runs.listActiveWaits(task.id).length === 0 ? this.lifecycle(task.id, task.version, "review") : {
|
|
212
213
|
ok: false,
|
|
213
214
|
reason: "invalid_transition",
|
|
214
215
|
model
|
|
@@ -225,6 +226,14 @@ var TaskApplicationService = class {
|
|
|
225
226
|
};
|
|
226
227
|
break;
|
|
227
228
|
case "add_wait": {
|
|
229
|
+
if (task.phase === "closed") {
|
|
230
|
+
result = {
|
|
231
|
+
ok: false,
|
|
232
|
+
reason: "invalid_transition",
|
|
233
|
+
model
|
|
234
|
+
};
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
228
237
|
const activeRun = this.#runs.getActiveRoot(task.id);
|
|
229
238
|
this.#runs.createWait({
|
|
230
239
|
taskId: task.id,
|
|
@@ -364,6 +373,20 @@ var TaskApplicationService = class {
|
|
|
364
373
|
model: this.#projector.get(run.taskId)
|
|
365
374
|
};
|
|
366
375
|
const task = this.#tasks.require(run.taskId);
|
|
376
|
+
if (run.parentRunId || task.phase === "closed" || this.#runs.listActiveWaits(task.id).length > 0 || run.contractVersion !== task.latestContractVersion) {
|
|
377
|
+
enqueueTaskChangedEvent(db, {
|
|
378
|
+
taskId: task.id,
|
|
379
|
+
projectId: task.projectId,
|
|
380
|
+
version: task.version,
|
|
381
|
+
changedFields: ["runs", "receipts"],
|
|
382
|
+
actor: input.actor,
|
|
383
|
+
source: input.actor ? void 0 : "runtime"
|
|
384
|
+
});
|
|
385
|
+
return {
|
|
386
|
+
ok: true,
|
|
387
|
+
model: this.#projector.project(task)
|
|
388
|
+
};
|
|
389
|
+
}
|
|
367
390
|
if (input.receipt.status !== "succeeded") {
|
|
368
391
|
const model = this.#projector.project(task);
|
|
369
392
|
enqueueTaskAttentionRequiredEvent(db, {
|
|
@@ -391,7 +414,9 @@ var TaskApplicationService = class {
|
|
|
391
414
|
model
|
|
392
415
|
};
|
|
393
416
|
}
|
|
394
|
-
const
|
|
417
|
+
const verifiedCriteria = verifiedTaskCriteria(input.receipt);
|
|
418
|
+
const criteria = task.contract?.acceptanceCriteria ?? [];
|
|
419
|
+
const verified = criteria.length > 0 && criteria.every((criterion) => verifiedCriteria.has(criterion)) && input.receipt.verification.status === "passed" && input.receipt.completionVerdict === "achieved" && input.receipt.remainingWork.length === 0 && !input.receipt.needsUser;
|
|
395
420
|
const phase = task.contract?.acceptancePolicy === "verified_auto" && verified ? "closed" : "review";
|
|
396
421
|
const updated = this.#tasks.setLifecycle({
|
|
397
422
|
taskId: task.id,
|
|
@@ -446,6 +471,11 @@ var TaskApplicationService = class {
|
|
|
446
471
|
reason: "invalid_transition",
|
|
447
472
|
model: this.#projector.project(task)
|
|
448
473
|
};
|
|
474
|
+
if (this.#runs.listActiveWaits(taskId).length > 0) return {
|
|
475
|
+
ok: false,
|
|
476
|
+
reason: "blocked",
|
|
477
|
+
model: this.#projector.project(task)
|
|
478
|
+
};
|
|
449
479
|
const blocking = this.#dependencies.listBlocking(taskId);
|
|
450
480
|
if (blocking.length > 0) {
|
|
451
481
|
const existingWaits = this.#runs.listActiveWaits(taskId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { verifiedTaskCriteria } from "../../packages/gateway-contract/src/tasks.js";
|
|
2
3
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
3
4
|
import "../storage/sqlite/index.js";
|
|
4
5
|
import { TaskRepository } from "./task-repository.js";
|
|
@@ -17,11 +18,13 @@ function taskIdForSession(sessionKey) {
|
|
|
17
18
|
function getTaskExecutionBrief(taskId) {
|
|
18
19
|
if (!isXopcDatabaseOpen()) return void 0;
|
|
19
20
|
const task = new TaskRepository().get(taskId);
|
|
20
|
-
if (!task?.contract) return void 0;
|
|
21
|
+
if (!task?.contract || task.phase === "closed") return void 0;
|
|
21
22
|
const runs = new TaskRunRepository();
|
|
23
|
+
if (runs.listActiveWaits(taskId).some((wait) => wait.kind === "paused")) return void 0;
|
|
22
24
|
const latestRun = runs.getLatestRoot(taskId);
|
|
23
|
-
const latestReceipt = latestRun ? runs.getReceipt(latestRun.id) : void 0;
|
|
24
|
-
const
|
|
25
|
+
const latestReceipt = latestRun?.contractVersion === task.latestContractVersion ? runs.getReceipt(latestRun.id) : void 0;
|
|
26
|
+
const passedCriteria = verifiedTaskCriteria(latestReceipt);
|
|
27
|
+
const remainingCriteria = task.contract.acceptanceCriteria.filter((criterion) => !passedCriteria.has(criterion));
|
|
25
28
|
const critical = task.priority === "critical" || task.contract.risks.length > 0 || task.contract.approvalRequired.length > 0;
|
|
26
29
|
const allocation = critical ? {
|
|
27
30
|
profile: "critical",
|
|
@@ -13,6 +13,7 @@ var TaskReadModelProjector = class {
|
|
|
13
13
|
const activeRun = this.#runs.getActiveRoot(task.id);
|
|
14
14
|
const latestRun = activeRun ?? this.#runs.getLatestRoot(task.id);
|
|
15
15
|
const waits = this.#runs.listActiveWaits(task.id);
|
|
16
|
+
const paused = waits.some((wait) => wait.kind === "paused");
|
|
16
17
|
const hasIncompleteDependency = Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM task_dependencies edge
|
|
17
18
|
JOIN tasks dependency ON dependency.task_id = edge.depends_on_task_id
|
|
18
19
|
WHERE edge.task_id = ?
|
|
@@ -48,8 +49,8 @@ var TaskReadModelProjector = class {
|
|
|
48
49
|
waits,
|
|
49
50
|
hasIncompleteDependency
|
|
50
51
|
}),
|
|
51
|
-
attention,
|
|
52
|
-
allowedCommands: this.allowedCommands(task, activeRun?.status, waits.length > 0)
|
|
52
|
+
attention: task.phase === "closed" || paused ? [] : attention,
|
|
53
|
+
allowedCommands: this.allowedCommands(task, activeRun?.status, waits.length > 0, paused)
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
summary(taskId) {
|
|
@@ -65,6 +66,7 @@ var TaskReadModelProjector = class {
|
|
|
65
66
|
}
|
|
66
67
|
operationalState(input) {
|
|
67
68
|
if (input.task.phase === "closed") return "idle";
|
|
69
|
+
if (input.waits.some((wait) => wait.kind === "paused")) return "waiting";
|
|
68
70
|
if (input.activeRun?.status === "running") return "running";
|
|
69
71
|
if (input.activeRun?.status === "verifying") return "verifying";
|
|
70
72
|
if (input.activeRun?.status === "queued") return "queued";
|
|
@@ -74,15 +76,15 @@ var TaskReadModelProjector = class {
|
|
|
74
76
|
if (input.hasIncompleteDependency) return "blocked";
|
|
75
77
|
return "idle";
|
|
76
78
|
}
|
|
77
|
-
allowedCommands(task, activeRunStatus, hasWaits) {
|
|
79
|
+
allowedCommands(task, activeRunStatus, hasWaits, paused) {
|
|
78
80
|
if (task.phase === "closed") return ["reopen"];
|
|
79
81
|
const commands = ["revise_contract", "close"];
|
|
82
|
+
if (!paused) commands.push("add_wait");
|
|
80
83
|
if (!activeRunStatus && !hasWaits) commands.unshift("move");
|
|
81
84
|
if (hasWaits) commands.unshift("resolve_wait");
|
|
82
|
-
else if (activeRunStatus === "running" || activeRunStatus === "verifying") commands.unshift("add_wait");
|
|
83
85
|
if (task.phase === "backlog") commands.unshift("mark_ready");
|
|
84
86
|
if (!activeRunStatus && !hasWaits && task.phase !== "backlog") commands.unshift("start");
|
|
85
|
-
if (task.phase === "active" && !activeRunStatus) commands.push("request_review");
|
|
87
|
+
if (task.phase === "active" && !activeRunStatus && !hasWaits) commands.push("request_review");
|
|
86
88
|
return commands;
|
|
87
89
|
}
|
|
88
90
|
};
|
|
@@ -16,7 +16,9 @@ var TaskRunCoordinator = class TaskRunCoordinator {
|
|
|
16
16
|
const task = tasks.get(input.context.taskId);
|
|
17
17
|
if (!task || task.phase === "closed") return void 0;
|
|
18
18
|
const runs = new TaskRunRepository();
|
|
19
|
+
if (runs.listActiveWaits(task.id).length > 0) return void 0;
|
|
19
20
|
let run = runs.get(input.runId);
|
|
21
|
+
if (run && (run.taskId !== task.id || run.parentRunId || run.sessionKey && run.sessionKey !== input.context.sessionKey)) return void 0;
|
|
20
22
|
if (!run) {
|
|
21
23
|
if (runs.getActiveRoot(task.id)) return void 0;
|
|
22
24
|
const agentId = task.delegateAgentId ?? input.context.agentId;
|
|
@@ -137,6 +137,8 @@ var TaskRunRepository = class {
|
|
|
137
137
|
WHERE wait.task_run_id = task_runs.run_id AND wait.status = 'active'
|
|
138
138
|
))
|
|
139
139
|
)
|
|
140
|
+
AND EXISTS (SELECT 1 FROM tasks task WHERE task.task_id = task_runs.task_id AND task.phase != 'closed')
|
|
141
|
+
AND NOT EXISTS (SELECT 1 FROM task_waits wait WHERE wait.task_id = task_runs.task_id AND wait.status = 'active')
|
|
140
142
|
AND NOT EXISTS (SELECT 1 FROM session_inputs input WHERE input.task_run_id = task_runs.run_id AND input.status IN ('queued','running'))
|
|
141
143
|
AND (? IS NULL OR executor_kind = ?)
|
|
142
144
|
AND COALESCE(scheduled_at, 0) <= ?
|
|
@@ -208,7 +210,8 @@ var TaskRunRepository = class {
|
|
|
208
210
|
listReceipts(taskId, limit = 100) {
|
|
209
211
|
return getSqliteDatabase().prepare(`SELECT receipt.* FROM task_run_receipts receipt
|
|
210
212
|
JOIN task_runs run ON run.run_id = receipt.run_id
|
|
211
|
-
WHERE run.task_id = ?
|
|
213
|
+
WHERE run.task_id = ? AND run.parent_run_id IS NULL
|
|
214
|
+
ORDER BY receipt.finalized_at DESC, run.queued_at DESC LIMIT ?`).all(taskId, Math.max(1, Math.min(500, Math.floor(limit)))).map(receiptFromRow);
|
|
212
215
|
}
|
|
213
216
|
recordFeedback(input) {
|
|
214
217
|
this.require(input.runId);
|
|
@@ -23,9 +23,9 @@ import { parseModelRef } from "../../agent/models/selection.js";
|
|
|
23
23
|
import { buildReviewContext, resolveGitRoot } from "../../review/review-git.js";
|
|
24
24
|
import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
25
25
|
import "../../infra/bus/index.js";
|
|
26
|
+
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
26
27
|
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
27
28
|
import "../../config/index.js";
|
|
28
|
-
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
29
29
|
import { buildWorkflowChildTools } from "../../agent/workflow/workflow-child-tools.js";
|
|
30
30
|
import { WorkflowRunService } from "../../workflows/service/workflow-run-service.js";
|
|
31
31
|
import { WorkflowSessionBridge } from "../../workflows/service/workflow-session-bridge.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.277",
|
|
4
4
|
"description": "Local-first personal AI assistant with reviewable user understanding, durable tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -166,9 +166,9 @@
|
|
|
166
166
|
"vitest": "4.1.5",
|
|
167
167
|
"vue": "^3.5.35",
|
|
168
168
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
169
|
-
"@xopcai/realtime-client": "0.0.0",
|
|
170
169
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
171
170
|
"@xopcai/gateway-contract": "0.0.0",
|
|
171
|
+
"@xopcai/realtime-client": "0.0.0",
|
|
172
172
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
173
173
|
},
|
|
174
174
|
"scripts": {
|
|
@@ -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 i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./popover-select-Dz_Qis2R.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{c,n as l}from"./locale-store-BkJ7g35d.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-B11EPpor.js";import{r as p}from"./gateway-config-swr-cd8owslz.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-CTq8EECj.js";import{Cc as _,Du as v,El as y,Tu as b,Uc as x,ac as S,ai as C,cc as w,dn as T,mc as E,nl as D,nn as O,rc as ee,rn as k,y as te}from"./index-CfQor-TM.js";import{n as A,r as j}from"./settings-page-layout-DYelDcMV.js";import{n as M,t as ne}from"./use-autosave-Cq4--C1i.js";import{u as N}from"./voice-config-api-D3DdcH4H.js";import{r as re}from"./image-generation-api-DtMRG1oF.js";var P=e(t(),1),ie=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,ie.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function B(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:N(s);let e=u?L(u.stt.providers,u.stt.provider,`model`):void 0,n=u?L(u.tts.providers,u.tts.provider,`model`):void 0,r=u?L(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[R(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[R(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,y;t[6]===_?y=t[7]:(y=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=y);let S;t[8]!==g||t[9]!==y?(S=(0,F.jsxs)(`div`,{children:[g,y]}),t[8]=g,t[9]=y,t[10]=S):S=t[10];let C=n?`管理语音设置`:`Manage voice settings`,w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[11]=w):w=t[11];let T;t[12]===C?T=t[13]:(T=(0,F.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[C,w]})}),t[12]=C,t[13]=T);let E;t[14]!==S||t[15]!==T?(E=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[S,T]}),t[14]=S,t[15]=T,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(D=o||!u?a?(0,F.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,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(m,{className:`h-20 rounded-xl`}),(0,F.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:x,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(z,{icon:b,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=D):D=t[23];let O;return t[24]!==E||t[25]!==D?(O=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26],O}var V=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`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`,U={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function W(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function ae(e){let t=(0,ie.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,F.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,F.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,F.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,F.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,F.jsx)(s,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let w;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(w=(0,F.jsx)(C,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=w):w=t[30];let T;return t[31]!==w||t[32]!==g||t[33]!==_?(T=(0,F.jsxs)(`div`,{children:[g,_,w]}),t[31]=w,t[32]=g,t[33]=_,t[34]=T):T=t[34],T}function G(e){let t=(0,ie.c)(121),{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 o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,re,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(K),t[6]=p,t[7]=m);let _=m,v=i?U.zh:U.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=W(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let w=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===w?T=t[14]:(T=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:w}),t[13]=w,t[14]=T);let E;t[15]!==T||t[16]!==S?(E=(0,F.jsxs)(`div`,{children:[S,T]}),t[15]=T,t[16]=S,t[17]=E):E=t[17];let D=i?`主模型`:`Primary model`,O;t[18]===D?O=t[19]:(O=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:D}),t[18]=D,t[19]=O);let ee=i?`选择模型`:`Select a model`,k=i?`搜索模型或服务商`:`Search models or providers`,te=i?`没有匹配的模型`:`No matching models`,A=i?`默认对话模型`:`Default conversation model`,j;t[20]!==n||t[21]!==r?(j=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=j):j=t[22];let M;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==k||t[26]!==te||t[27]!==A||t[28]!==j?(M=(0,F.jsx)(C,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:k,noMatches:te,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:A,onChange:j}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=k,t[26]=te,t[27]=A,t[28]=j,t[29]=M):M=t[29];let ne;t[30]!==O||t[31]!==M?(ne=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[O,M]}),t[30]=O,t[31]=M,t[32]=ne):ne=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,F.jsx)(ae,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==E||t[45]!==ne||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,ne,P]}),t[44]=E,t[45]=ne,t[46]=P,t[47]=I):I=t[47];let L=i?`图片能力`:`Image capabilities`,R;t[48]===L?R=t[49]:(R=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:L}),t[48]=L,t[49]=R);let z=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===z?G=t[51]:(G=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:z}),t[50]=z,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=W(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,F.jsx)(C,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,F.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,$;t[70]!==n||t[71]!==r?($=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=$):$=t[72];let ye;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==$?(ye=(0,F.jsx)(C,{value:pe,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:$}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=$,t[83]=ye):ye=t[83];let be;t[84]!==fe||t[85]!==ye?(be=(0,F.jsxs)(`div`,{children:[fe,ye]}),t[84]=fe,t[85]=ye,t[86]=be):be=t[86];let xe;t[87]!==ue||t[88]!==be?(xe=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,be]}),t[87]=ue,t[88]=be,t[89]=xe):xe=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(f,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==R||t[95]!==G||t[96]!==xe||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[R,G,xe,Se]}),t[94]=R,t[95]=G,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(B,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=V.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,F.jsx)(C,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`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 J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,ie.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,te,o),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(X),t[3]=c,t[4]=l);let p=l,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(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]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,F.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,ee=i?`系统默认`:`System default`,k;t[22]!==n||t[23]!==r?(k=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==O||t[26]!==ee||t[27]!==k?(A=(0,F.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:ee,onChange:k,className:`${q} mt-2`}),t[25]=O,t[26]=ee,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==D||t[30]!==A?(j=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,A]}),t[29]=D,t[30]=A,t[31]=j):j=t[31];let M=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,ne=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==ne||t[36]!==N||t[37]!==re?(P=(0,F.jsx)(`input`,{type:`number`,min:1,value:ne,placeholder:N,onChange:re,className:`${q} mt-2`}),t[35]=ne,t[36]=N,t[37]=re,t[38]=P):P=t[38];let I;t[39]!==M||t[40]!==P?(I=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[M,P]}),t[39]=M,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==E||t[43]!==j||t[44]!==I?(L=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,j,I]}),t[42]=E,t[43]=j,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==L||t[47]!==v||t[48]!==b?(R=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,L]}),t[46]=L,t[47]=v,t[48]=b,t[49]=R):R=t[49];let z=i?`提示词缓存`:`Prompt cache`,B;t[50]===z?B=t[51]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,F.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,F.jsx)(f,{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[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let K;t[61]!==W||t[62]!==G?(K=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(f,{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[64]=n,t[65]=r,t[66]=i,t[67]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==B||t[72]!==H||t[73]!==Z?(Q=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[B,H,Z]}),t[71]=B,t[72]=H,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==p||t[90]!==s.isLoading?(_e=(0,F.jsx)(a,{value:fe,options:p,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=p,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let $;t[95]===s.error?$=t[96]:($=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=$);let ye=i?`允许调用的工作流`:`Allowed workflows`,be;t[97]===ye?be=t[98]:(be=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:ye}),t[97]=ye,t[98]=be);let xe;t[99]!==n||t[100]!==r?(xe=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=xe):xe=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=u(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==xe||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:xe,className:Ce,children:[Te,De]}),t[108]=xe,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=u(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,F.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==be||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[be,Le,Re]}),t[137]=be,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==se||t[142]!==le||t[143]!==ve||t[144]!==$||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[se,le,ve,$,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=$,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Q||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[R,Q,Be]}),t[147]=R,t[148]=Q,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}function Q(e){let t=(0,ie.c)(99),{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:s,error:c,isLoading:l}=d(`agent-defaults-skills-catalog`,T,a),[f,p]=(0,P.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(ce));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(se),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=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]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...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):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let b=y,x;t[12]===s?.catalog?x=t[13]:(x=s?.catalog??[],t[12]=s?.catalog,t[13]=x);let S;if(t[14]!==v||t[15]!==x){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=x.filter(e),t[14]=v,t[15]=x,t[16]=S}else S=t[16];let C=S.length,w=i?`技能策略`:`Skill policy`,O;t[19]===w?O=t[20]:(O=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:w}),t[19]=w,t[20]=O);let ee=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[21]===ee?k=t[22]:(k=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ee}),t[21]=ee,t[22]=k);let te;t[23]!==n||t[24]!==r?(te=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=te):te=t[25];let A=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,j;t[26]===A?j=t[27]:(j=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,A),t[26]=A,t[27]=j);let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=M):M=t[28];let ne=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[29]===ne?N=t[30]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ne}),t[29]=ne,t[30]=N);let re=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,I;t[31]===re?I=t[32]:(I=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:re}),t[31]=re,t[32]=I);let L;t[33]!==N||t[34]!==I?(L=(0,F.jsxs)(`span`,{children:[N,I]}),t[33]=N,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==te||t[37]!==j||t[38]!==L?(R=(0,F.jsxs)(`button`,{type:`button`,onClick:te,className:j,children:[M,L]}),t[36]=te,t[37]=j,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==n||t[41]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=z):z=t[42];let B=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,V;t[43]===B?V=t[44]:(V=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,B),t[43]=B,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,F.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=H):H=t[45];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[46]===U?W=t[47]:(W=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[46]=U,t[47]=W);let ae=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,G;t[48]===ae?G=t[49]:(G=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ae}),t[48]=ae,t[49]=G);let K;t[50]!==W||t[51]!==G?(K=(0,F.jsxs)(`span`,{children:[W,G]}),t[50]=W,t[51]=G,t[52]=K):K=t[52];let q;t[53]!==z||t[54]!==V||t[55]!==K?(q=(0,F.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,K]}),t[53]=z,t[54]=V,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==R||t[58]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,q]}),t[57]=R,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==k||t[61]!==J||t[62]!==O?(Y=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[O,k,J]}),t[60]=k,t[61]=J,t[62]=O,t[63]=Y):Y=t[63];let X=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Q;t[64]===X?Q=t[65]:(Q=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:X}),t[64]=X,t[65]=Q);let le=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,ue;t[66]===le?ue=t[67]:(ue=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[66]=le,t[67]=ue);let de;t[68]!==Q||t[69]!==ue?(de=(0,F.jsxs)(`div`,{children:[Q,ue]}),t[68]=Q,t[69]=ue,t[70]=de):de=t[70];let fe=i?`搜索技能`:`Search skills`,pe;t[71]===fe?pe=t[72]:(pe=(0,F.jsx)(`span`,{className:`sr-only`,children:fe}),t[71]=fe,t[72]=pe);let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=me):me=t[73];let he;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>p(e.target.value),t[74]=he):he=t[74];let ge=i?`搜索技能`:`Search skills`,_e;t[75]!==f||t[76]!==ge?(_e=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:he,placeholder:ge,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[75]=f,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]!==pe||t[79]!==_e?(ve=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[pe,me,_e]}),t[78]=pe,t[79]=_e,t[80]=ve):ve=t[80];let $;t[81]!==de||t[82]!==ve?($=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[de,ve]}),t[81]=de,t[82]=ve,t[83]=$):$=t[83];let ye;t[84]===c?ye=t[85]:(ye=c?(0,F.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[84]=c,t[85]=ye);let be;t[86]!==v||t[87]!==l||t[88]!==g||t[89]!==b||t[90]!==i?(be=l?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(oe)}):(0,F.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,F.jsxs)(`label`,{className:u(`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,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.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,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=l,t[88]=g,t[89]=b,t[90]=i,t[91]=be):be=t[91];let xe;t[92]!==$||t[93]!==ye||t[94]!==be?(xe=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[$,ye,be]}),t[92]=$,t[93]=ye,t[94]=be,t[95]=xe):xe=t[95];let Se;return t[96]!==Y||t[97]!==xe?(Se=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[Y,xe]}),t[96]=Y,t[97]=xe,t[98]=Se):Se=t[98],Se}function oe(e){return(0,F.jsx)(m,{className:`h-14 rounded-xl`},e)}function se(e,t){return e.name.localeCompare(t.name)}function ce(e){return e.name}function le(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ue(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(`all`),[d,p]=(0,P.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(fe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(de),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||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),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,b;if(t[10]!==_||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),b=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,C;if(t[15]!==_||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),C=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==v.length||t[21]!==b.length||t[22]!==C.length?(w={allow:y,ask:x,deny:C.length},t[20]=v.length,t[21]=b.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,D;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==c||t[28]!==o){let e=o.trim().toLowerCase();D=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(c===`all`||r===c)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=c,t[28]=o,t[29]=D}else D=t[29];let O=D,ee;t[30]!==n||t[31]!==r?(ee=(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]=ee):ee=t[32];let k=ee,te=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===te?A=t[34]:(A={id:`all`,label:te},t[33]=te,t[34]=A);let j=a?`允许 ${T.allow}`:`Allow ${T.allow}`,M;t[35]===j?M=t[36]:(M={id:`allow`,label:j},t[35]=j,t[36]=M);let ne=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===ne?N=t[38]:(N={id:`ask`,label:ne},t[37]=ne,t[38]=N);let re=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,I;t[39]===re?I=t[40]:(I={id:`deny`,label:re},t[39]=re,t[40]=I);let L;t[41]!==A||t[42]!==M||t[43]!==N||t[44]!==I?(L=[A,M,N,I],t[41]=A,t[42]=M,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,F.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==c||t[54]!==R?(W=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,c===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=c,t[54]=R,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,F.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,F.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,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]=o,t[61]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==W||t[67]!==X?(Z=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,X]}),t[66]=W,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==k||t[73]!==O||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==k||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>k(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,F.jsx)(S,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>k(e,{maxCallsPerTurn:le(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,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>k(e,{timeoutMs:le(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[76]=h,t[77]=n.tools,t[78]=d,t[79]=k,t[80]=a,t[81]=e):e=t[81],Q=O.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=k,t[73]=O,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==O.length||t[83]!==a?(oe=O.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=O.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,F.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==U||t[89]!==Z||t[90]!==se?(ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[U,Z,se]}),t[88]=U,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function de(e){return e.id}function fe(e){return[e.id,e.description]}function pe(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(m,{className:`h-7 w-56`}),(0,F.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(m,{className:`h-9 w-28`})]}),(0,F.jsx)(m,{className:`h-20 rounded-2xl`}),(0,F.jsx)(m,{className:`h-12 rounded-xl`}),(0,F.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,ie.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,P.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[c,l]=(0,P.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,P.useState)(d),h;t[4]===c?h=t[5]:(h=JSON.stringify(c),t[4]=c,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let v=h!==g,b=i?`模型`:`Models`,x;t[8]===b?x=t[9]:(x={id:`models`,label:b,icon:ee},t[8]=b,t[9]=x);let S=i?`技能`:`Skills`,C;t[10]===S?C=t[11]:(C={id:`skills`,label:S,icon:_},t[10]=S,t[11]=C);let T=i?`工具`:`Tools`,E;t[12]===T?E=t[13]:(E={id:`tools`,label:T,icon:w},t[12]=T,t[13]=E);let D=i?`运行`:`Runtime`,O;t[14]===D?O=t[15]:(O={id:`runtime`,label:D,icon:y},t[14]=D,t[15]=O);let te;t[16]!==E||t[17]!==O||t[18]!==x||t[19]!==C?(te=[x,C,E,O],t[16]=E,t[17]=O,t[18]=x,t[19]=C,t[20]=te):te=t[20];let N=te,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await k(t),r=structuredClone(n.defaults);l(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let I=re,L;t[22]!==v||t[23]!==c?(L={value:c,dirty:v,onSave:I,delayMs:0},t[22]=v,t[23]=c,t[24]=L):L=t[24];let R=ne(L),z=R.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==R.error||t[26]!==R.status?(V=(0,F.jsx)(M,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,F.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(U=R.error?(0,F.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,F.jsx)(`span`,{children:R.error}),(0,F.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:R.retry,children:i?`重试`:`Retry`})]}):null,t[31]=R.error,t[32]=R.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==N?(ae=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,a===t?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:u(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=N,t[37]=ae):ae=t[37];let K;t[38]!==W||t[39]!==ae?(K=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=K):K=t[40];let q;t[41]!==a||t[42]!==c||t[43]!==i?(q=a===`models`?(0,F.jsx)(G,{draft:c,setDraft:l,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==c||t[47]!==i?(J=a===`skills`?(0,F.jsx)(Q,{draft:c,setDraft:l,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(X=a===`tools`?(0,F.jsx)(ue,{draft:c,setDraft:l,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==c||t[56]!==i?(Z=a===`runtime`?(0,F.jsx)(Y,{draft:c,setDraft:l,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=Z):Z=t[57];let oe;return t[58]!==R.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(oe=(0,F.jsxs)(j,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,X,Z]}),t[58]=R.onBlurCapture,t[59]=H,t[60]=U,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=oe):oe=t[66],oe}function he(){let e=(0,ie.c)(17),t=c(_e),n=l(ge)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,O);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(j,{children:(0,F.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,F.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,F.jsx)(f,{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,F.jsxs)(j,{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,F.jsx)(pe,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(me,{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 ge(e){return e.language}function _e(e){return e.sessionKey}export{he 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{a as i,i as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./messages-BGc-OJWg.js";import{a as p,n as m,r as h}from"./locale-store-BkJ7g35d.js";import{t as g}from"./cn-JdwAhgNB.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-B11EPpor.js";import{t as y}from"./skeleton-BwbyijEw.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as S}from"./electron-env-DH5wF8X8.js";import{Lc as C,Xi as w,us as T}from"./index-CfQor-TM.js";import{n as E,r as D}from"./settings-page-layout-DYelDcMV.js";import{r as O,t as k}from"./settings-form-section-RElRijJw.js";import{t as A}from"./settings-loading-skeleton-CAmWMaOT.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,f]=(0,M.useReducer)(w,L),{info:p,loadError:m,actionError:h,copiedField:_,clearDialogOpen:y,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:O,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){f({type:`patch`,patch:{loadError:null}});try{f({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await d(e)){f({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>f({type:`patch`,patch:{copiedField:null}}),2e3);return}f({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){f({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:O});n.ok||f({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){f({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{f({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(m)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m});if(!p)return(0,N.jsx)(A,{rows:2});let H=!p.packaged,U=j||p.pendingUpdate||H,W=!H&&p.uninstallMode!==`unsupported`,G=I(p,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(k,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(C,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,h?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,p.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.appPath,`app`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:p.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:g(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,T.press),onClick:()=>void z(p.dataPath,`data`),children:[(0,N.jsx)(u,{className:`size-3`,"aria-hidden":!0}),_===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(p.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:g(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,T.press),onClick:()=>{f({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(l,{open:y,onOpenChange:e=>{e||f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>f({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:g(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>f({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{f({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(l,{open:D,onOpenChange:e=>{e||f({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(o,{children:[(0,N.jsx)(i,{className:g(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,x)}),(0,N.jsxs)(s,{className:g(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(c,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(a,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:O,onChange:e=>f({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),O?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(v,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>f({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(v,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await p(h(`/api/migrations/status`))).payload}async function B(){await p(h(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=_(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let u=t?.items??[],d=u.filter(e=>e.status===`conflict`||e.status===`error`),f=u.filter(e=>e.safety===`auto`&&e.status===`planned`),p=d.length>0||u.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:u.length===0?e.upToDate:p?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(f.length))})]}),f.length>0&&!p?(0,N.jsx)(v,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),u.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=m(U),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!S()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let l;return e[24]!==o||e[25]!==s||e[26]!==c?(l=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,e[27]=l):l=e[27],l}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|