@xopcai/xopc 0.0.340 → 0.0.341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZsW4B_4.js → agent-avatar-dicebear-BLPcg31f.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6lTld5j.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DPil7wFb.js → agent-plugin-dialog-C4tkmkNX.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DXcxDhxl.js → agents-CfnoU72e.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B6_Ocd3H.js → app-management-settings-panel-D1t5R8Nw.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CYk3wLnQ.js → appearance-settings-AEXbf39m.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DOteYBc9.js → apps-page-BBlltMmy.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Cq8nfXI4.js → archive-plugin-Dn0-Buj5.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D3dSY_dy.js → automations-page-BSra2qfj.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DuULlur3.js → automations-workspace-wN4UZK_t.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BKqt6Et6.js → binary-plugins-Dot1Il-Y.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-H3ijAjys.js → block-editor-CDcC8LCq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CjIhwapc.js → browser-automations-page-CAUS0Ri8.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DvMsxdHZ.js → browser-settings-page-DXgm5Ckn.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CM55DJos.js → capabilities-page-CADE2fFw.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-3kh-Ox8d.js → capabilities-settings-panel-BVA9R5lZ.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-DRdadVwO.js → capability-header-actions-BJNo9stz.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BU6w4j04.js → channels-Do21a722.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-bMULpQTT.js → chat-terminal-dock-kdmj_0as.js} +1 -1
- package/dist/gateway/static/root/assets/computer-settings-page-0eV1PD7w.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-f6kDBxXv.js → connector-service-page-CfoHye-I.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BZ2oIRzn.js → connectors-page-Db1Y7qF-.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BxODmHib.js → date-picker-Cos4-ejW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BNPg7CKM.js → dependency-picker-BPwj_jHy.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-I6v0yXqp.js → desktop-pet-DEuqqeV7.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-tSuk-nRY.js → desktop-pet-settings-CjBMcLuI.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Dka3NDC5.js → device-pairing-wizard-BsqwXeyv.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BvrnQNVH.js → directory-picker-path-field-CcGJupzB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BU56INhZ.js → extension-debug-page-BK0gkhEA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DQu5R6aV.js → extension-page-BjfzKvd3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-oL7xkRyC.js → extension-settings-page-xqe5mUAc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Kp84CfNh.js → gateway-settings-C07o7J3o.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CtjDNSNA.js → home-page-a92Q8Na2.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CKj_w0ri.js → imports-page-BMiS5gUB.js} +1 -1
- package/dist/gateway/static/root/assets/index-CJRGgrw3.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BUqFy1Mk.js → keyboard-shortcuts-settings-BTOmULWn.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Uo5UKdF8.js → local-app-workbench-page-EwMSmvUp.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DoxtxoTl.js → local-apps-page-gicbE8bt.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-NHrVWElJ.js → logs-page-BBxTvrXn.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BDnKvfCl.js → management-settings-CcEPCLdK.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Gt-PA4Fe.js → media-plugins-1hJztT1f.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-ddFcoIGv.js → note-detail-panel-LcJBf6gK.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-DHY9KaXz.js → notes-page-BaTCRZLb.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CZ-NyERX.js → page-context-capture-button-yJUYnJxT.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-7u-lmA1o.js → page-tabs-BM7TwlkM.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bolgk7cf.js → preview-open-alternatives-C8ewCNje.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CJEViLcx.js → product-open-page-CRx7HKvw.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BcikJ4wu.js → project-detail-page-CSh8kKw8.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DFZXCRc2.js → projects-page-DYwOgWaC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Dr2FLBo-.js → remote-access-hub-B8ApF5IX.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BKus_7qQ.js → runtime-tools-settings-panel-DOB15s5m.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-Sp5hozOY.js → scenes-page-DqhxjqAy.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DvkI2pYT.js → schema-form-DchPlBrp.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Cm4j_l7t.js → sessions-page-BcnoQbIP.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cedcl54F.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BzC6oYCR.js → settings-form-section-UlkZDGLU.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DpEe6N0D.js → settings-page-PYnr6mlX.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CfuLya7v.js → setup-status-panel-xp2jQuPa.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DAE82vq9.js → share-preview-page-B0jqVHIE.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Bqkvdt3m.js → shares-settings-BnRfPQfC.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DkZFVXn8.js → skill-api-DgwnV477.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-rA2myUNh.js → skill-reload-api-zai_s2F8.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CrTKXe6r.js → skills-page-BYAE6Al2.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BWVB47be.js → system-settings-panel-eEK7Mm70.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DcsgbSjp.js → task-detail-page-BK82L-MC.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-D1I9v9nz.js → tunnel-api-Cty9Iw8k.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DyKTK2iS.js → usage-page-C3ZO6KNv.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-G5bltEoh.js → use-autosave-EEUVQbRp.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-7tObyrXy.js → user-model-page-CT_RNLbB.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-C2Q5SXkb.js → voice-api-key-field-DTmACeYO.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-J-w4XEEK.js → work-discovery-overlay-C9guuKGB.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmZCSCBe.js → workflow-run-setup-panel-BjGFnWIF.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DcXyKH2p.js → workflows-page-B1uzFMKj.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/current-turn-images.d.ts +4 -0
- package/dist/src/agent/embedded/current-turn-images.js +22 -0
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +15 -3
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/service.js +2 -2
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/omniEngine.js +8 -6
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C_56_X-e.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-T4wZrdXv.js +0 -1
- package/dist/gateway/static/root/assets/index-b_BtpHlo.js +0 -106
- package/dist/gateway/static/root/assets/settings-advanced-gate-CpD6cRcO.js +0 -1
|
@@ -3,8 +3,8 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
4
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
5
5
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
|
-
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
7
6
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
7
|
+
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
8
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
9
9
|
import { dirname, join } from "path";
|
|
10
10
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
3
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
4
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
//#region src/auth/sync-provider-auth.ts
|
|
7
7
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../../../../agent-catalog/repository.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
3
|
-
import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
|
|
4
|
-
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
5
3
|
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
|
|
4
|
+
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
6
5
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
6
|
+
import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
|
|
7
7
|
import { loadConfig } from "../../../../config/loader.js";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
//#region src/cli/commands/doctor/checks/provider-auth.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
|
|
4
3
|
import { COMPUTER_CONTROL_TOOL, ComputerAppSchema, ComputerObservationSchema, ComputerWindowSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
5
4
|
import { ComputerServiceLimitsSchema, computerModelProfile, init_model_policy } from "./model-policy.js";
|
|
6
5
|
import { getApiKey, init_providers, resolveModel } from "../providers/index.js";
|
|
6
|
+
import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
|
|
7
7
|
import { enterComputerControl, leaveComputerControl } from "./control-guard.js";
|
|
8
8
|
import { ComputerDiagnosticSchema, ComputerOperationError, computerDiagnostic, computerRecovery } from "./errors.js";
|
|
9
9
|
import { createComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";
|
package/dist/src/config/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, in
|
|
|
6
6
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
7
7
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
8
8
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
9
|
-
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
10
|
-
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
11
9
|
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
12
10
|
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
11
|
+
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
12
|
+
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
13
13
|
import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
|
|
14
14
|
import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
|
|
15
15
|
import { assertConfigRewriteSafeForRunningGateway, loadConfig, saveConfig } from "./loader.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
|
-
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
3
2
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
4
3
|
import { computerModelProfile, init_model_policy, isDedicatedComputerModel } from "../../../computer/model-policy.js";
|
|
5
4
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
@@ -9,6 +8,7 @@ import { CredentialResolver, init_credentials } from "../../../auth/credentials.
|
|
|
9
8
|
import "../../../providers/constants.js";
|
|
10
9
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
11
10
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured, isProviderConfiguredSync } from "../../../providers/index.js";
|
|
11
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
12
12
|
import { buildCapabilityPlansForConfig } from "../../../capabilities/readiness/from-config.js";
|
|
13
13
|
import "../../../capabilities/readiness/index.js";
|
|
14
14
|
import { getImageGenerationProvider, reloadImageGenerationProviders, resolveImageGenerationCredentialMode } from "../../../agent/image/generation/provider-registry.js";
|
|
@@ -20,13 +20,13 @@ import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDe
|
|
|
20
20
|
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
21
21
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
22
22
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
23
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
23
24
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
24
25
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
25
26
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
26
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
27
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
28
27
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
29
28
|
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.js";
|
|
29
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
30
30
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
31
31
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
32
32
|
import "../knowledge-memory/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
+
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
2
3
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
3
4
|
import { completeWithResolvedCredentials, isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
4
|
-
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
5
5
|
import { resolveModelSelector } from "../config/agent-model-intents.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/home-intelligence/generator.ts
|
|
@@ -7,8 +7,8 @@ import { init_note_markdown, parseNoteMarkdown } from "./note-markdown.js";
|
|
|
7
7
|
import { init_notes_repository, listNoteProjectSummaries } from "../storage/sqlite/notes-repository.js";
|
|
8
8
|
import { changedFieldsFromPatch, emitActivity, previewText, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
9
9
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
10
|
-
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
11
10
|
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
11
|
+
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
12
12
|
import { partitionAttachmentsByReference } from "./note-attachment-sync.js";
|
|
13
13
|
import { buildNoteAgentContextArtifact, getCachedNoteAgentContextArtifact } from "./agent-context.js";
|
|
14
14
|
import { revokeNoteShareRecords } from "../share/note-share-revocation.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
1
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
-
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
-
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
5
3
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
4
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
5
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
|
+
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
8
7
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
8
|
+
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
3
2
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
3
|
+
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
4
4
|
import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
5
5
|
//#region src/providers/register-runtime-providers.ts
|
|
6
6
|
function registerRuntimeProvider(modelRuntime, source) {
|
package/dist/src/tui/tui.js
CHANGED
|
@@ -2,8 +2,8 @@ import { version } from "../../package.js";
|
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
3
|
import { init_paths } from "../config/paths.js";
|
|
4
4
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
5
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
6
5
|
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
6
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
7
7
|
import { isTerminalWorkflowRunStatus } from "../workflows/domain/run.js";
|
|
8
8
|
import "../workflows/domain/index.js";
|
|
9
9
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
@@ -12,6 +12,7 @@ const MAX_QUEUED_AUDIO_BYTES = 24e3 * 2 * 60;
|
|
|
12
12
|
const MAX_PENDING_INPUT_BYTES = 64 * 1024;
|
|
13
13
|
const UPLOAD_TIMEOUT_MS = 1e4;
|
|
14
14
|
const RESPONSE_START_TIMEOUT_MS = 3e4;
|
|
15
|
+
const CANCELLATION_ERROR_GRACE_MS = 5e3;
|
|
15
16
|
const FAILURE_MESSAGES = {
|
|
16
17
|
OMNI_UPLOAD_TIMEOUT: "The connection to the voice service stopped uploading audio. Check the network to your configured endpoint and reconnect.",
|
|
17
18
|
OMNI_INPUT_RESET_TIMEOUT: "The voice service did not acknowledge clearing microphone input. Reconnect to continue.",
|
|
@@ -46,7 +47,7 @@ function createOmniVoiceEngine(options) {
|
|
|
46
47
|
let timer;
|
|
47
48
|
const recorded = /* @__PURE__ */ new Set();
|
|
48
49
|
let writes = Promise.resolve();
|
|
49
|
-
let
|
|
50
|
+
let cancellationPendingUntil = 0;
|
|
50
51
|
let inputQueue = [];
|
|
51
52
|
let queuedInputBytes = 0;
|
|
52
53
|
let uploadingBytes = 0;
|
|
@@ -151,7 +152,7 @@ function createOmniVoiceEngine(options) {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
if ((reason === "client_cancelled" || reason === "barge_in" && (options.route.route.managed || !options.bargeIn)) && response.generating && socket?.readyState === WebSocket.OPEN) {
|
|
154
|
-
|
|
155
|
+
cancellationPendingUntil = Date.now() + CANCELLATION_ERROR_GRACE_MS;
|
|
155
156
|
send("response.cancel");
|
|
156
157
|
}
|
|
157
158
|
return true;
|
|
@@ -295,8 +296,10 @@ function createOmniVoiceEngine(options) {
|
|
|
295
296
|
if (binary) throw new Error("Unexpected Omni binary frame");
|
|
296
297
|
const event = JSON.parse(raw.toString());
|
|
297
298
|
if (event.type === "error") {
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
const lateCancellation = event.error?.type === "invalid_request_error" && event.error?.message === "Conversation has none active response";
|
|
300
|
+
const managedLateCancellation = options.route.route.managed && event.error?.code === "invalid_request_error" && event.error?.message === "The voice provider rejected the request.";
|
|
301
|
+
if (Date.now() <= cancellationPendingUntil && (lateCancellation || managedLateCancellation)) {
|
|
302
|
+
cancellationPendingUntil = 0;
|
|
300
303
|
return;
|
|
301
304
|
}
|
|
302
305
|
fail("OMNI_PROVIDER_ERROR");
|
|
@@ -378,11 +381,10 @@ function createOmniVoiceEngine(options) {
|
|
|
378
381
|
} else if (event.type === "response.created") {
|
|
379
382
|
clearTimeout(responseStartTimer);
|
|
380
383
|
if (muted || inputBlocked) {
|
|
381
|
-
|
|
384
|
+
cancellationPendingUntil = Date.now() + CANCELLATION_ERROR_GRACE_MS;
|
|
382
385
|
send("response.cancel");
|
|
383
386
|
return;
|
|
384
387
|
}
|
|
385
|
-
cancellationPending = false;
|
|
386
388
|
if (active) cancel("barge_in");
|
|
387
389
|
const id = event.response?.id;
|
|
388
390
|
if (typeof id !== "string" || !id.length || id.length > 160) throw new Error("Invalid response ID");
|
|
@@ -8,15 +8,15 @@ import { ActivityService } from "../activity/service.js";
|
|
|
8
8
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
9
9
|
import { init_session_key, resolveConversationId } from "../routing/session-key.js";
|
|
10
10
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
11
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
12
11
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
12
|
+
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
13
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
13
14
|
import { writeKnowledgeItem } from "../knowledge-memory/repository.js";
|
|
14
15
|
import "../knowledge-memory/index.js";
|
|
15
16
|
import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
16
17
|
import { linkAssertionEvidence, reconcileAssertion } from "../user-model/repository.js";
|
|
17
18
|
import { createPriorityWindow, createUserGoal } from "../user-model/goals.js";
|
|
18
19
|
import "../user-model/index.js";
|
|
19
|
-
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
20
20
|
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, getUnderstandingSourceRun, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceGrantPolicies, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
21
21
|
import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
|
|
22
22
|
import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
|
|
@@ -2,8 +2,8 @@ import { TaskRepository, init_task_repository } from "../../tasks/task-repositor
|
|
|
2
2
|
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
3
3
|
import { init_conversation_repository, resolveRoutedConversation } from "../../storage/sqlite/conversation-repository.js";
|
|
4
4
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
5
|
-
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
5
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
6
|
+
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
7
7
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
8
8
|
import { getProjectWorkspacePathForSession } from "../../projects/workspace.js";
|
|
9
9
|
import { automationEventPublisher, getAutomationEventForRun } from "../../automations/events/event-repository.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.341",
|
|
4
4
|
"description": "Local-first personal AI for the one-person company, with durable context, tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -158,12 +158,12 @@
|
|
|
158
158
|
"vitepress": "^1.6.4",
|
|
159
159
|
"vitest": "4.1.5",
|
|
160
160
|
"vue": "^3.5.35",
|
|
161
|
-
"@xopcai/browser-control-contract": "0.1.0",
|
|
162
|
-
"@xopcai/computer-control-contract": "0.1.0",
|
|
163
161
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
164
|
-
"@xopcai/
|
|
162
|
+
"@xopcai/browser-control-contract": "0.1.0",
|
|
165
163
|
"@xopcai/gateway-contract": "0.0.0",
|
|
166
164
|
"@xopcai/realtime-client": "0.0.0",
|
|
165
|
+
"@xopcai/computer-control-contract": "0.1.0",
|
|
166
|
+
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
167
167
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
168
168
|
},
|
|
169
169
|
"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-BMYIfy9x.js";import{t as a}from"./popover-select-0p9PIHRy.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./cn-JdwAhgNB.js";import{c as u,n as d}from"./locale-store-GbEE8D1I.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-CS04eWY9.js";import{r as m}from"./gateway-config-swr-BdBCP9uF.js";import{n as h,t as g}from"./registry-api-DTHBAr2T.js";import{t as _}from"./skeleton-BwbyijEw.js";import{$u as v,Ac as y,Nc as b,Oc as ee,Oi as x,Ol as S,Pi as C,Ql as w,Zu as T,_n as E,ml as D,qc as te,v as O,vn as ne}from"./index-b_BtpHlo.js";import{n as k,r as A}from"./settings-page-layout-X1x-2Cp9.js";import{n as j,t as M}from"./use-autosave-G5bltEoh.js";import{s as N}from"./voice-config-api-DIBe0AZN.js";import{r as re}from"./image-generation-api-DufKsb8h.js";var P=e(t(),1),ie=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`};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 ae(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 bg-surface-base/55 p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function z(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=m(!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,f=n?`语音能力`:`Voice capabilities`,h;t[4]===f?h=t[5]:(h=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:f}),t[4]=f,t[5]=h);let g=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,y;t[6]===g?y=t[7]:(y=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:g}),t[6]=g,t[7]=y);let b;t[8]!==h||t[9]!==y?(b=(0,F.jsxs)(`div`,{children:[h,y]}),t[8]=h,t[9]=y,t[10]=b):b=t[10];let ee=n?`管理语音设置`:`Manage voice settings`,x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[11]=x):x=t[11];let S;t[12]===ee?S=t[13]:(S=(0,F.jsx)(p,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[ee,x]})}),t[12]=ee,t[13]=S);let C;t[14]!==b||t[15]!==S?(C=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,S]}),t[14]=b,t[15]=S,t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(w=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)(_,{className:`h-20 rounded-xl`}),(0,F.jsx)(_,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(ae,{icon:D,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(ae,{icon:T,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]=w):w=t[23];let E;return t[24]!==C||t[25]!==w?(E=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=E):E=t[26],E}var B=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],V=`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`,H={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 U(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function oe(e){let t=(0,ie.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:s,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=s?`回退顺序`:`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=s?`主模型不可用时,按从左到右的顺序尝试。`:`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]!==s?(_=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 bg-surface-base/70 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":s?`移除 ${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)(c,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:s?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=s,t[18]=_):_=t[18];let v=s?`添加回退模型`:`Add fallback model`,y=s?`搜索模型或服务商`:`Search models or providers`,b=s?`没有可添加的模型`:`No models available to add`,ee=s?`添加回退模型`:`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 C;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==ee||t[27]!==S||t[28]!==v||t[29]!==y?(C=(0,F.jsx)(x,{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:ee,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=ee,t[27]=S,t[28]=v,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==C||t[32]!==g||t[33]!==_?(w=(0,F.jsxs)(`div`,{children:[g,_,C]}),t[31]=C,t[32]=g,t[33]=_,t[34]=w):w=t[34],w}function W(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=f(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=f(`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,d;t[4]===c.data?d=t[5]:(d=c.data??[],t[4]=c.data,t[5]=d);let m;t[6]===d?m=t[7]:(m=d.flatMap(G),t[6]=d,t[7]=m);let _=m,v=i?H.zh:H.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=U(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,ee=i?`默认对话模型`:`Default conversation model`,S;t[11]===ee?S=t[12]:(S=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ee}),t[11]=ee,t[12]=S);let C=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,w;t[13]===C?w=t[14]:(w=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[13]=C,t[14]=w);let T;t[15]!==w||t[16]!==S?(T=(0,F.jsxs)(`div`,{children:[S,w]}),t[15]=w,t[16]=S,t[17]=T):T=t[17];let E=i?`主模型`:`Primary model`,D;t[18]===E?D=t[19]:(D=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:E}),t[18]=E,t[19]=D);let te=i?`选择模型`:`Select a model`,O=i?`搜索模型或服务商`:`Search models or providers`,ne=i?`没有匹配的模型`:`No matching models`,k=i?`默认对话模型`:`Default conversation model`,A;t[20]!==n||t[21]!==r?(A=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=A):A=t[22];let j;t[23]!==n.models.chat.primary||t[24]!==te||t[25]!==O||t[26]!==ne||t[27]!==k||t[28]!==A?(j=(0,F.jsx)(x,{value:n.models.chat.primary,placeholder:te,searchPlaceholder:O,noMatches:ne,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:k,onChange:A}),t[23]=n.models.chat.primary,t[24]=te,t[25]=O,t[26]=ne,t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==D||t[31]!==j?(M=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[D,j]}),t[30]=D,t[31]=j,t[32]=M):M=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 rounded-xl bg-surface-base/45 p-4`,children:(0,F.jsx)(oe,{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]!==T||t[45]!==M||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[T,M,P]}),t[44]=T,t[45]=M,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 ae=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,W;t[50]===ae?W=t[51]:(W=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ae}),t[50]=ae,t[51]=W);let K=i?`图片理解模型`:`Image understanding model`,q;t[52]===K?q=t[53]:(q=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:K}),t[52]=K,t[53]=q);let J=n.models.imageUnderstanding?.primary??``,Y=i?`关闭图片理解`:`Image understanding off`,X=i?`搜索视觉模型`:`Search vision models`,Z=i?`没有可用的视觉模型`:`No vision models available`,se=i?`关闭图片理解`:`Image understanding off`,ce=i?`图片理解模型`:`Image understanding model`,le;t[54]!==n||t[55]!==r?(le=e=>{let t={...n.models};e?t.imageUnderstanding=U(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=le):le=t[56];let ue;t[57]!==J||t[58]!==Y||t[59]!==X||t[60]!==Z||t[61]!==se||t[62]!==ce||t[63]!==le?(ue=(0,F.jsx)(x,{value:J,placeholder:Y,searchPlaceholder:X,noMatches:Z,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:se,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ce,onChange:le}),t[57]=J,t[58]=Y,t[59]=X,t[60]=Z,t[61]=se,t[62]=ce,t[63]=le,t[64]=ue):ue=t[64];let de;t[65]!==q||t[66]!==ue?(de=(0,F.jsxs)(`div`,{children:[q,ue]}),t[65]=q,t[66]=ue,t[67]=de):de=t[67];let fe=i?`图片生成模型`:`Image generation model`,pe;t[68]===fe?pe=t[69]:(pe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:fe}),t[68]=fe,t[69]=pe);let me=n.models.imageGeneration?.primary??``,he=i?`关闭图片生成`:`Image generation off`,ge=i?`搜索图片模型或服务商`:`Search image models or providers`,_e=i?`没有可用的图片生成模型`:`No image generation models available`,ve=i?`关闭图片生成`:`Image generation off`,ye=i?`图片生成模型`:`Image generation model`,be;t[70]!==n||t[71]!==r?(be=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]=be):be=t[72];let xe;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==me||t[77]!==he||t[78]!==ge||t[79]!==_e||t[80]!==ve||t[81]!==ye||t[82]!==be?(xe=(0,F.jsx)(x,{value:me,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:he,searchPlaceholder:ge,noMatches:_e,allowEmpty:!0,emptyLabel:ve,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ye,onChange:be}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=me,t[77]=he,t[78]=ge,t[79]=_e,t[80]=ve,t[81]=ye,t[82]=be,t[83]=xe):xe=t[83];let Se;t[84]!==pe||t[85]!==xe?(Se=(0,F.jsxs)(`div`,{children:[pe,xe]}),t[84]=pe,t[85]=xe,t[86]=Se):Se=t[86];let Ce;t[87]!==de||t[88]!==Se?(Ce=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[de,Se]}),t[87]=de,t[88]=Se,t[89]=Ce):Ce=t[89];let we;t[90]!==n||t[91]!==r||t[92]!==i?(we=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 rounded-xl bg-surface-base/45 p-4 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:`${V} 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)(p,{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]=we):we=t[93];let Te;t[94]!==R||t[95]!==W||t[96]!==Ce||t[97]!==we?(Te=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[R,W,Ce,we]}),t[94]=R,t[95]=W,t[96]=Ce,t[97]=we,t[98]=Te):Te=t[98];let Ee;t[99]===i?Ee=t[100]:(Ee=(0,F.jsx)(z,{zh:i}),t[99]=i,t[100]=Ee);let De=i?`按任务选择模型`:`Route by task`,Oe;t[101]===De?Oe=t[102]:(Oe=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:De}),t[101]=De,t[102]=Oe);let ke=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Ae;t[103]===ke?Ae=t[104]:(Ae=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ke}),t[103]=ke,t[104]=Ae);let Q;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(Q=B.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl bg-surface-base/55 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)(x,{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]=Q):Q=t[109];let je;t[110]===Q?je=t[111]:(je=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:Q}),t[110]=Q,t[111]=je);let $;t[112]!==Oe||t[113]!==Ae||t[114]!==je?($=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,Ae,je]}),t[112]=Oe,t[113]=Ae,t[114]=je,t[115]=$):$=t[115];let Me;return t[116]!==I||t[117]!==Te||t[118]!==Ee||t[119]!==$?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Te,Ee,$]}),t[116]=I,t[117]=Te,t[118]=Ee,t[119]=$,t[120]=Me):Me=t[120],Me}function G(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var K=`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 q(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function J(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=f(`agent-defaults-workflows`,O,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let u;t[3]===c?u=t[4]:(u=c.map(Y),t[3]=c,t[4]=u);let d=u,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 ee=i?`每次运行最多轮数`:`Maximum turns per run`,x=n.runtime.maxTurns??``,S=i?`系统默认`:`System default`,C;t[12]!==n||t[13]!==r?(C=e=>r({...n,runtime:{...n.runtime,maxTurns:q(e.target.value)}}),t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==x||t[16]!==S||t[17]!==C?(w=(0,F.jsx)(`input`,{type:`number`,min:1,value:x,placeholder:S,onChange:C,className:`${K} mt-2`}),t[15]=x,t[16]=S,t[17]=C,t[18]=w):w=t[18];let T;t[19]!==w||t[20]!==ee?(T=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ee,w]}),t[19]=w,t[20]=ee,t[21]=T):T=t[21];let E=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,D=n.runtime.timeoutMs??``,te=i?`系统默认`:`System default`,ne;t[22]!==n||t[23]!==r?(ne=e=>r({...n,runtime:{...n.runtime,timeoutMs:q(e.target.value)}}),t[22]=n,t[23]=r,t[24]=ne):ne=t[24];let k;t[25]!==D||t[26]!==te||t[27]!==ne?(k=(0,F.jsx)(`input`,{type:`number`,min:1,value:D,placeholder:te,onChange:ne,className:`${K} mt-2`}),t[25]=D,t[26]=te,t[27]=ne,t[28]=k):k=t[28];let A;t[29]!==E||t[30]!==k?(A=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[E,k]}),t[29]=E,t[30]=k,t[31]=A):A=t[31];let j=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,M=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:q(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==M||t[36]!==N||t[37]!==re?(P=(0,F.jsx)(`input`,{type:`number`,min:1,value:M,placeholder:N,onChange:re,className:`${K} mt-2`}),t[35]=M,t[36]=N,t[37]=re,t[38]=P):P=t[38];let I;t[39]!==j||t[40]!==P?(I=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,P]}),t[39]=j,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==T||t[43]!==A||t[44]!==I?(L=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[T,A,I]}),t[42]=T,t[43]=A,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-xl bg-surface-hover/20 p-5`,children:[v,b,L]}),t[46]=L,t[47]=v,t[48]=b,t[49]=R):R=t[49];let ae=i?`提示词缓存`:`Prompt cache`,z;t[50]===ae?z=t[51]:(z=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ae}),t[50]=ae,t[51]=z);let B=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,V;t[52]===B?V=t[53]:(V=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[52]=B,t[53]=V);let H=i?`缓存模式`:`Cache mode`,U;t[54]===H?U=t[55]:(U=(0,F.jsx)(`span`,{children:H}),t[54]=H,t[55]=U);let oe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=[`auto`,`off`],t[56]=oe):oe=t[56];let W;t[57]!==n||t[58]!==r||t[59]!==i?(W=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:oe.map(e=>(0,F.jsx)(p,{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]=W):W=t[60];let G;t[61]!==U||t[62]!==W?(G=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[U,W]}),t[61]=U,t[62]=W,t[63]=G):G=t[63];let J;t[64]!==n||t[65]!==r||t[66]!==i?(J=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)(p,{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]=J):J=t[67];let X;t[68]!==G||t[69]!==J?(X=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[G,J]}),t[68]=G,t[69]=J,t[70]=X):X=t[70];let Z;t[71]!==z||t[72]!==V||t[73]!==X?(Z=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,V,X]}),t[71]=z,t[72]=V,t[73]=X,t[74]=Z):Z=t[74];let se=i?`工作流`:`Workflows`,ce;t[75]===se?ce=t[76]:(ce=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:se}),t[75]=se,t[76]=ce);let le=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,ue;t[77]===le?ue=t[78]:(ue=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[77]=le,t[78]=ue);let de=i?`默认工作流`:`Default workflow`,fe;t[79]===de?fe=t[80]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[79]=de,t[80]=fe);let pe=n.workflows.default??``,me=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,he=i?`不设置默认工作流`:`No default workflow`,ge=i?`默认工作流`:`Default workflow`,_e;t[81]!==n||t[82]!==r?(_e=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=_e):_e=t[83];let ve;t[84]!==pe||t[85]!==me||t[86]!==he||t[87]!==ge||t[88]!==_e||t[89]!==d||t[90]!==s.isLoading?(ve=(0,F.jsx)(a,{value:pe,options:d,placeholder:me,emptyLabel:he,disabled:s.isLoading,ariaLabel:ge,onChange:_e,triggerClassName:`mt-2`}),t[84]=pe,t[85]=me,t[86]=he,t[87]=ge,t[88]=_e,t[89]=d,t[90]=s.isLoading,t[91]=ve):ve=t[91];let ye;t[92]!==fe||t[93]!==ve?(ye=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[fe,ve]}),t[92]=fe,t[93]=ve,t[94]=ye):ye=t[94];let be;t[95]===s.error?be=t[96]:(be=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]=be);let xe=i?`允许调用的工作流`:`Allowed workflows`,Se;t[97]===xe?Se=t[98]:(Se=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:xe}),t[97]=xe,t[98]=Se);let Ce;t[99]!==n||t[100]!==r?(Ce=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=Ce):Ce=t[101];let we=m?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Te;t[102]===we?Te=t[103]:(Te=l(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,we),t[102]=we,t[103]=Te);let Ee=i?`允许全部工作流`:`Allow every workflow`,De;t[104]===Ee?De=t[105]:(De=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ee}),t[104]=Ee,t[105]=De);let Oe=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,ke;t[106]===Oe?ke=t[107]:(ke=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Oe}),t[106]=Oe,t[107]=ke);let Ae;t[108]!==Ce||t[109]!==Te||t[110]!==De||t[111]!==ke?(Ae=(0,F.jsxs)(`button`,{type:`button`,onClick:Ce,className:Te,children:[De,ke]}),t[108]=Ce,t[109]=Te,t[110]=De,t[111]=ke,t[112]=Ae):Ae=t[112];let Q;t[113]!==n||t[114]!==r?(Q=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=Q):Q=t[115];let je=m?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,$;t[116]===je?$=t[117]:($=l(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,je),t[116]=je,t[117]=$);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]!==Q||t[123]!==$||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:Q,className:$,children:[Ne,Fe]}),t[122]=Q,t[123]=$,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Ae||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Ae,Ie]}),t[127]=Ae,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 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,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]!==Se||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[Se,Le,Re]}),t[137]=Se,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==ce||t[142]!==ue||t[143]!==ye||t[144]!==be||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[ce,ue,ye,be,ze]}),t[141]=ce,t[142]=ue,t[143]=ye,t[144]=be,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Z||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[R,Z,Be]}),t[147]=R,t[148]=Z,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function Y(e){return{value:e.id,label:e.title||e.name}}function X(e){return[...new Set(e)].sort()}var Z=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function se(e){let t=(0,ie.c)(115),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:c,error:u,isLoading:d}=f(`agent-defaults-skills-catalog`,C,a),[p,m]=(0,P.useState)(``),h=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let g;if(t[1]!==h||t[2]!==c?.catalog||t[3]!==p){let e=[...c?.catalog??[]],n=new Set(e.map(fe));for(let t of h)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=p.trim().toLowerCase();g=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(de),t[1]=h,t[2]=c?.catalog,t[3]=p,t[4]=g}else g=t[4];let _=g,v;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(v=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=v):v=t[8];let y=v,b;t[9]!==n||t[10]!==r?(b=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):X([...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):X([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=b):b=t[11];let ee=b,x;t[12]===c?.catalog?x=t[13]:(x=c?.catalog??[],t[12]=c?.catalog,t[13]=x);let w;if(t[14]!==y||t[15]!==x){let e;t[17]===y?e=t[18]:(e=e=>e.enabled&&y(e.name),t[17]=y,t[18]=e),w=x.filter(e),t[14]=y,t[15]=x,t[16]=w}else w=t[16];let T=w.length,E;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(E=e=>{let t=new Set((c?.catalog??[]).filter(ue).map(le));r({...n,skills:{mode:`selected`,include:X(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=E):E=t[22];let D=E,te=i?`技能策略`:`Skill policy`,O;t[23]===te?O=t[24]:(O=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:te}),t[23]=te,t[24]=O);let ne=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[25]===ne?k=t[26]:(k=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ne}),t[25]=ne,t[26]=k);let A;t[27]!==n||t[28]!==r?(A=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=A):A=t[29];let j=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,M;t[30]===j?M=t[31]:(M=l(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,j),t[30]=j,t[31]=M);let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=N):N=t[32];let re=i?`使用所有已启用技能`:`Use every enabled skill`,I;t[33]===re?I=t[34]:(I=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:re}),t[33]=re,t[34]=I);let L=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,R;t[35]===L?R=t[36]:(R=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:L}),t[35]=L,t[36]=R);let ae;t[37]!==I||t[38]!==R?(ae=(0,F.jsxs)(`span`,{children:[I,R]}),t[37]=I,t[38]=R,t[39]=ae):ae=t[39];let z;t[40]!==A||t[41]!==M||t[42]!==ae?(z=(0,F.jsxs)(`button`,{type:`button`,onClick:A,className:M,children:[N,ae]}),t[40]=A,t[41]=M,t[42]=ae,t[43]=z):z=t[43];let B;t[44]!==n||t[45]!==r?(B=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=B):B=t[46];let V=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,H;t[47]===V?H=t[48]:(H=l(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,V),t[47]=V,t[48]=H);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,F.jsx)(S,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=U):U=t[49];let oe=i?`只使用选中的技能`:`Use selected skills only`,W;t[50]===oe?W=t[51]:(W=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:oe}),t[50]=oe,t[51]=W);let G=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,K;t[52]===G?K=t[53]:(K=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:G}),t[52]=G,t[53]=K);let q;t[54]!==W||t[55]!==K?(q=(0,F.jsxs)(`span`,{children:[W,K]}),t[54]=W,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==B||t[58]!==H||t[59]!==q?(J=(0,F.jsxs)(`button`,{type:`button`,onClick:B,className:H,children:[U,q]}),t[57]=B,t[58]=H,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==z||t[62]!==J?(Y=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[z,J]}),t[61]=z,t[62]=J,t[63]=Y):Y=t[63];let se=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,pe;t[64]===se?pe=t[65]:(pe=(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:se}),t[64]=se,t[65]=pe);let me;t[66]!==D||t[67]!==c||t[68]!==i?(me=Z.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>D(e.names),disabled:!c,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=D,t[67]=c,t[68]=i,t[69]=me):me=t[69];let he;t[70]===me?he=t[71]:(he=(0,F.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:me}),t[70]=me,t[71]=he);let ge;t[72]!==pe||t[73]!==he?(ge=(0,F.jsxs)(`div`,{className:`mt-4`,children:[pe,he]}),t[72]=pe,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==k||t[76]!==Y||t[77]!==ge||t[78]!==O?(_e=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[O,k,Y,ge]}),t[75]=k,t[76]=Y,t[77]=ge,t[78]=O,t[79]=_e):_e=t[79];let ve=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,ye;t[80]===ve?ye=t[81]:(ye=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ve}),t[80]=ve,t[81]=ye);let be=i?`当前默认可用 ${T} 个技能。`:`${T} skills are available by default.`,xe;t[82]===be?xe=t[83]:(xe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:be}),t[82]=be,t[83]=xe);let Se;t[84]!==ye||t[85]!==xe?(Se=(0,F.jsxs)(`div`,{children:[ye,xe]}),t[84]=ye,t[85]=xe,t[86]=Se):Se=t[86];let Ce=i?`搜索技能`:`Search skills`,we;t[87]===Ce?we=t[88]:(we=(0,F.jsx)(`span`,{className:`sr-only`,children:Ce}),t[87]=Ce,t[88]=we);let Te;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,F.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Te):Te=t[89];let Ee;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>m(e.target.value),t[90]=Ee):Ee=t[90];let De=i?`搜索技能`:`Search skills`,Oe;t[91]!==p||t[92]!==De?(Oe=(0,F.jsx)(`input`,{type:`search`,value:p,onChange:Ee,placeholder:De,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=p,t[92]=De,t[93]=Oe):Oe=t[93];let ke;t[94]!==we||t[95]!==Oe?(ke=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[we,Te,Oe]}),t[94]=we,t[95]=Oe,t[96]=ke):ke=t[96];let Ae;t[97]!==Se||t[98]!==ke?(Ae=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[Se,ke]}),t[97]=Se,t[98]=ke,t[99]=Ae):Ae=t[99];let Q;t[100]===u?Q=t[101]:(Q=u?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u instanceof Error?u.message:String(u)}):null,t[100]=u,t[101]=Q);let je;t[102]!==y||t[103]!==d||t[104]!==_||t[105]!==ee||t[106]!==i?(je=d?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(ce)}):(0,F.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[_.map(e=>{let t=y(e.name);return(0,F.jsxs)(`label`,{className:l(`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:()=>ee(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)}),_.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[102]=y,t[103]=d,t[104]=_,t[105]=ee,t[106]=i,t[107]=je):je=t[107];let $;t[108]!==Ae||t[109]!==Q||t[110]!==je?($=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Ae,Q,je]}),t[108]=Ae,t[109]=Q,t[110]=je,t[111]=$):$=t[111];let Me;return t[112]!==_e||t[113]!==$?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[_e,$]}),t[112]=_e,t[113]=$,t[114]=Me):Me=t[114],Me}function ce(e){return(0,F.jsx)(_,{className:`h-14 rounded-xl`},e)}function le(e){return e.name}function ue(e){return e.enabled}function de(e,t){return e.name.localeCompare(t.name)}function fe(e){return e.name}function pe(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function me(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,c]=(0,P.useState)(``),[u,d]=(0,P.useState)(`all`),[f,m]=(0,P.useState)(),h;t[0]===i?h=t[1]:(h=new Map(i.map(ge)),t[0]=i,t[1]=h);let g=h,_;t[2]!==i||t[3]!==n.tools?(_=[...new Set([...i.map(he),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=_):_=t[4];let v=_,b;if(t[5]!==v||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),b=v.filter(e),t[5]=v,t[6]=n.tools,t[7]=b}else b=t[7];let ee=b.length,x;if(t[10]!==v||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),x=v.filter(e),t[10]=v,t[11]=n.tools,t[12]=x}else x=t[12];let S=x.length,C;if(t[15]!==v||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=v.filter(e),t[15]=v,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==b.length||t[21]!==x.length||t[22]!==C.length?(w={allow:ee,ask:S,deny:C.length},t[20]=b.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,E;if(t[24]!==v||t[25]!==g||t[26]!==n.tools||t[27]!==u||t[28]!==o){let e=o.trim().toLowerCase();E=v.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=g.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=v,t[25]=g,t[26]=n.tools,t[27]=u,t[28]=o,t[29]=E}else E=t[29];let D=E,te;t[30]!==n||t[31]!==r?(te=(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]=te):te=t[32];let O=te,ne=a?`全部 ${v.length}`:`All ${v.length}`,k;t[33]===ne?k=t[34]:(k={id:`all`,label:ne},t[33]=ne,t[34]=k);let A=a?`允许 ${T.allow}`:`Allow ${T.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let M=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,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]!==k||t[42]!==j||t[43]!==N||t[44]!==I?(L=[k,j,N,I],t[41]=k,t[42]=j,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,ae=a?`默认工具权限`:`Default tool permissions`,z;t[46]===ae?z=t[47]:(z=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ae}),t[46]=ae,t[47]=z);let B=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,V;t[48]===B?V=t[49]:(V=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:B}),t[48]=B,t[49]=V);let H;t[50]!==z||t[51]!==V?(H=(0,F.jsxs)(`div`,{children:[z,V]}),t[50]=z,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==u||t[54]!==R?(U=(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:()=>d(e.id),className:l(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=u,t[54]=R,t[55]=U):U=t[55];let oe=a?`搜索工具`:`Search tools`,W;t[56]===oe?W=t[57]:(W=(0,F.jsx)(`span`,{className:`sr-only`,children:oe}),t[56]=oe,t[57]=W);let G;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,F.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=G):G=t[58];let K;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>c(e.target.value),t[59]=K):K=t[59];let q=a?`搜索工具`:`Search tools`,J;t[60]!==o||t[61]!==q?(J=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:K,placeholder:q,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]=q,t[62]=J):J=t[62];let Y;t[63]!==W||t[64]!==J?(Y=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[W,G,J]}),t[63]=W,t[64]=J,t[65]=Y):Y=t[65];let X;t[66]!==U||t[67]!==Y?(X=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[U,Y]}),t[66]=U,t[67]=Y,t[68]=X):X=t[68];let Z;if(t[69]!==g||t[70]!==n.tools||t[71]!==f||t[72]!==O||t[73]!==D||t[74]!==a){let e;t[76]!==g||t[77]!==n.tools||t[78]!==f||t[79]!==O||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=g.get(e),i=f===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:()=>O(e,{mode:n}),className:l(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(p,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>m(i?void 0:e),children:(0,F.jsx)(y,{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=>O(e,{maxCallsPerTurn:pe(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=>O(e,{timeoutMs:pe(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]=g,t[77]=n.tools,t[78]=f,t[79]=O,t[80]=a,t[81]=e):e=t[81],Z=D.map(e),t[69]=g,t[70]=n.tools,t[71]=f,t[72]=O,t[73]=D,t[74]=a,t[75]=Z}else Z=t[75];let se;t[82]!==D.length||t[83]!==a?(se=D.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]=D.length,t[83]=a,t[84]=se):se=t[84];let ce;t[85]!==Z||t[86]!==se?(ce=(0,F.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[Z,se]}),t[85]=Z,t[86]=se,t[87]=ce):ce=t[87];let le;return t[88]!==H||t[89]!==X||t[90]!==ce?(le=(0,F.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[H,X,ce]}),t[88]=H,t[89]=X,t[90]=ce,t[91]=le):le=t[91],le}function he(e){return e.id}function ge(e){return[e.id,e.description]}function _e(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(A,{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)(_,{className:`h-7 w-56`}),(0,F.jsx)(_,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(_,{className:`h-9 w-28`})]}),(0,F.jsx)(_,{className:`h-20 rounded-2xl`}),(0,F.jsx)(_,{className:`h-12 rounded-xl`}),(0,F.jsx)(_,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ve(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,u]=(0,P.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[f,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]===f?g=t[7]:(g=JSON.stringify(f),t[6]=f,t[7]=g);let _=h!==g,v=i?`模型`:`Models`,y;t[8]===v?y=t[9]:(y={id:`models`,label:v,icon:ee},t[8]=v,t[9]=y);let x=i?`技能`:`Skills`,S;t[10]===x?S=t[11]:(S={id:`skills`,label:x,icon:te},t[10]=x,t[11]=S);let C=i?`工具`:`Tools`,T;t[12]===C?T=t[13]:(T={id:`tools`,label:C,icon:b},t[12]=C,t[13]=T);let E=i?`运行`:`Runtime`,D;t[14]===E?D=t[15]:(D={id:`runtime`,label:E,icon:w},t[14]=E,t[15]=D);let O;t[16]!==T||t[17]!==D||t[18]!==y||t[19]!==S?(O=[y,S,T,D],t[16]=T,t[17]=D,t[18]=y,t[19]=S,t[20]=O):O=t[20];let N=O,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await ne(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let I=re,L;t[22]!==_||t[23]!==c?(L={value:c,dirty:_,onSave:I,delayMs:0},t[22]=_,t[23]=c,t[24]=L):L=t[24];let R=M(L),ae=R.onBlurCapture,z=i?`智能体设置`:`Agent settings`,B;t[25]!==R.error||t[26]!==R.status?(B=(0,F.jsx)(j,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=B):B=t[27];let V;t[28]!==z||t[29]!==B?(V=(0,F.jsx)(k,{title:z,actions:B}),t[28]=z,t[29]=B,t[30]=V):V=t[30];let H;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(H=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)(p,{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]=H):H=t[34];let U=i?`默认配置分区`:`Default configuration sections`,oe;t[35]!==a||t[36]!==N?(oe=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:l(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:l(`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]=oe):oe=t[37];let G;t[38]!==U||t[39]!==oe?(G=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-1 rounded-xl bg-surface-hover/20 p-1 lg:grid-cols-4`,"aria-label":U,children:oe}),t[38]=U,t[39]=oe,t[40]=G):G=t[40];let K;t[41]!==a||t[42]!==c||t[43]!==i?(K=a===`models`?(0,F.jsx)(W,{draft:c,setDraft:u,zh:i}):null,t[41]=a,t[42]=c,t[43]=i,t[44]=K):K=t[44];let q;t[45]!==a||t[46]!==c||t[47]!==i?(q=a===`skills`?(0,F.jsx)(se,{draft:c,setDraft:u,zh:i}):null,t[45]=a,t[46]=c,t[47]=i,t[48]=q):q=t[48];let Y;t[49]!==a||t[50]!==r||t[51]!==c||t[52]!==i?(Y=a===`tools`?(0,F.jsx)(me,{draft:c,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=c,t[52]=i,t[53]=Y):Y=t[53];let X;t[54]!==a||t[55]!==c||t[56]!==i?(X=a===`runtime`?(0,F.jsx)(J,{draft:c,setDraft:u,zh:i}):null,t[54]=a,t[55]=c,t[56]=i,t[57]=X):X=t[57];let Z;return t[58]!==R.onBlurCapture||t[59]!==V||t[60]!==H||t[61]!==G||t[62]!==K||t[63]!==q||t[64]!==Y||t[65]!==X?(Z=(0,F.jsxs)(A,{gap:`gap-5`,onBlurCapture:ae,children:[V,H,G,K,q,Y,X]}),t[58]=R.onBlurCapture,t[59]=V,t[60]=H,t[61]=G,t[62]=K,t[63]=q,t[64]=Y,t[65]=X,t[66]=Z):Z=t[66],Z}function ye(){let e=(0,ie.c)(17),t=u(xe),n=d(be)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=f(t?`settings-agent-defaults`:null,E);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(A,{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)(p,{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)(A,{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)(_e,{}),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)(ve,{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 be(e){return e.language}function xe(e){return e.conversationId}export{ye as AgentDefaultsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./messages-DvcSrOiI.js";import{a as s,n as c,r as l}from"./locale-store-GbEE8D1I.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-CS04eWY9.js";import{r as f}from"./gateway-config-swr-BdBCP9uF.js";import{n as p,t as m}from"./registry-api-DTHBAr2T.js";import{t as h}from"./skeleton-BwbyijEw.js";import{Nc as g,Oi as _,_n as v,dl as y,fl as b,vn as x,wc as S}from"./index-b_BtpHlo.js";import{n as C,r as w}from"./settings-page-layout-X1x-2Cp9.js";var T=n(),E=e(t(),1),D=r();function O({zh:e}){let t=o(e?`zh`:`en`).computerSettings,n=u(`settings-agent-defaults`,v),r=u(m,p),a=n.data?.defaults.models.computerUse?.primary??``,[s,c]=(0,E.useState)(a),[l,f]=(0,E.useState)(!1),[g,y]=(0,E.useState)(``),[b,S]=(0,E.useState)(!1);(0,E.useEffect)(()=>{c(a)},[a]);let C=!s||r.data?.some(e=>e.id===s&&e.computerUse),w=async()=>{f(!0),y(``),S(!1);try{if(!C)throw Error(t.modelUnavailable);let e=await v(),r={...e.defaults.models};s?r.computerUse={primary:s,fallbacks:[]}:delete r.computerUse;let i=await x({...e.defaults,models:r});await n.mutate(i,!1),S(!0)}catch(e){y(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,D.jsxs)(`section`,{"aria-label":t.model,className:`space-y-3`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.model}),!n.data&&!n.error?(0,D.jsx)(h,{className:`h-52 w-full rounded-xl`}):n.error?(0,D.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[String(n.error),(0,D.jsx)(d,{onClick:()=>{n.mutate().catch(()=>{})},children:t.retry})]}):(0,D.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-hover/25 p-4 sm:p-5`,children:[(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.modelDescription}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t.modelScope}),r.isLoading?(0,D.jsx)(h,{className:`h-10 w-full rounded-lg`}):(0,D.jsx)(_,{value:s,onChange:e=>{c(e),S(!1)},disabled:l,capabilitiesFilter:`computer-use`,models:r.data??[],modelsError:r.error,placeholder:t.selectModel,searchPlaceholder:t.searchModel,noMatches:t.noModels,registryEmptyHint:t.noModels,allowEmpty:!0,emptyLabel:t.noModel,ariaLabel:t.modelLabel,className:`w-full`,contentAlign:`start`}),!C&&!r.isLoading&&!r.error&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:t.modelUnavailable}),r.error&&(0,D.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[String(r.error),(0,D.jsx)(d,{onClick:()=>{r.mutate().catch(()=>{})},children:t.retry})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(d,{variant:`primary`,disabled:l||s===a||!C||!!r.error||r.isLoading,onClick:()=>{w()},children:t.saveModel}),(0,D.jsx)(d,{asChild:!0,variant:`ghost`,children:(0,D.jsx)(i,{to:`/settings/capabilities/models?add=1`,children:t.manageModels})}),b&&(0,D.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:t.modelSaved})]}),g&&(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:g})]}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t.modelPrivacy})]})}function k(e){let t=(0,T.c)(15),{icon:n,title:r,description:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n&&(0,D.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base/70 text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,D.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,D.jsx)(`div`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=a&&(0,D.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 p-4 sm:flex-nowrap sm:p-5`,children:[o,l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function A(){let e=(0,T.c)(2),t=c(j)===`zh`,n;return e[0]===t?n=e[1]:(n=(0,D.jsx)(M,{zh:t}),e[0]=t,e[1]=n),n}function j(e){return e.language}function M({zh:e}){let t=o(e?`zh`:`en`).computerSettings,{data:n,mutate:r,error:c}=f(!0),u=n?.payload?.config,[p,m]=(0,E.useState)(!1),[_,v]=(0,E.useState)(``),[x,T]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),[M,N]=(0,E.useState)(!1),P=window.electronAPI?.platform===`darwin`?window.electronAPI.computer:void 0,F=window.electronAPI?.platform===`darwin`?window.electronAPI.system:void 0;(0,E.useEffect)(()=>{if(!P)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await P.status();e||(j(t),N(!1))}catch{e||(j(null),N(!0))}finally{t=!1}}};n();let r=window.setInterval(()=>{n()},2e3);return()=>{e=!0,window.clearInterval(r)}},[P]);let I=async e=>{m(!0),v(``);try{await e()}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}},L=e=>I(async()=>{await s(l(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({computer:{enabled:e}})}),await r()}),R=async()=>{v(``),T(!1);try{await P?.stop(),T(!0),P&&j(await P.status())}catch(e){v(e instanceof Error?e.message:String(e))}},z=A?.session?.status??`idle`,B=t.states[z]??z;return(0,D.jsxs)(w,{gap:`gap-7`,children:[(0,D.jsx)(C,{title:t.title,subtitle:t.subtitle,meta:(0,D.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,D.jsx)(`span`,{className:`inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.experimental}),(0,D.jsx)(`span`,{className:`inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.preview})]}),(0,D.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:t.experimentalDescription})]}),actions:P&&(0,D.jsxs)(d,{onClick:()=>{R()},children:[(0,D.jsx)(S,{className:`size-3.5`}),t.stop]})}),_&&(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:_}),x&&(0,D.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.stoppedNotice}),A?.controlPaused&&(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-warning-soft p-4`,children:[(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.pausedNotice}),(0,D.jsx)(d,{disabled:p,onClick:()=>{I(async()=>{P&&j(await P.resume()),T(!1)})},children:t.resume})]}),(0,D.jsx)(O,{zh:e}),(0,D.jsxs)(`section`,{"aria-labelledby":`computer-control-title`,className:`space-y-3`,children:[(0,D.jsx)(`h2`,{id:`computer-control-title`,className:`text-sm font-semibold text-fg`,children:t.control}),!u&&!c?(0,D.jsx)(h,{className:`h-40 w-full rounded-xl`}):c?(0,D.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[String(c),` `,(0,D.jsx)(d,{onClick:()=>{I(()=>r())},children:t.retry})]}):(0,D.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[(0,D.jsx)(k,{icon:(0,D.jsx)(y,{className:`size-5`}),title:t.desktop,description:t.desktopDescription,children:(0,D.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.desktop,"aria-checked":u?.computer?.enabled===!0,disabled:p,onClick:()=>{L(u?.computer?.enabled!==!0)},className:`touch-target flex items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,D.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${u?.computer?.enabled?`bg-accent`:`bg-fg-muted/30`}`,children:(0,D.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${u?.computer?.enabled?`translate-x-5`:`translate-x-0`}`})})})}),(0,D.jsx)(k,{icon:(0,D.jsx)(g,{className:`size-5`}),title:t.approvals,description:t.approvalsDescription,children:(0,D.jsx)(`span`,{className:`rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.approvalsRequired})}),(0,D.jsx)(k,{icon:(0,D.jsx)(a,{className:`size-5`}),title:t.browser,description:(0,D.jsxs)(D.Fragment,{children:[t.browserDescription,(0,D.jsx)(`span`,{className:`mt-1 block text-xs`,children:u?.browser?.enabled?t.browserEnabled:t.browserDisabled})]}),children:(0,D.jsx)(d,{asChild:!0,children:(0,D.jsx)(i,{to:`/settings/agent-browser`,children:t.manage})})})]}),(0,D.jsxs)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:[t.safety,` `,t.lockedDescription]})]}),(0,D.jsxs)(`section`,{"aria-labelledby":`computer-permissions-title`,className:`space-y-3`,children:[(0,D.jsx)(`h2`,{id:`computer-permissions-title`,className:`text-sm font-semibold text-fg`,children:t.permissions}),P?M?(0,D.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-5 text-sm text-danger`,children:t.nativeError}):A?(0,D.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[(0,D.jsx)(k,{icon:(0,D.jsx)(b,{className:`size-5`}),title:t.device,description:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{"aria-live":`polite`,children:[A.connected?t.connected:t.disconnected,` · `,B]}),A.reenrollmentRequired&&(0,D.jsx)(`p`,{className:`mt-1`,children:t.revoked})]}),children:A.reenrollmentRequired&&(0,D.jsx)(d,{disabled:p,onClick:()=>{I(async()=>{j(await P.reenroll())})},children:t.reenroll})}),F&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(k,{icon:(0,D.jsx)(g,{className:`size-5`}),title:t.accessibility,description:t.accessibilityDescription,children:[(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.accessibility?t.granted:t.notGranted}),!A.permissions.accessibility&&(0,D.jsx)(d,{disabled:p,"aria-label":`${t.openSettings}: ${t.accessibility}`,onClick:()=>{I(()=>F.requestAccessibility())},children:t.openSettings})]}),(0,D.jsxs)(k,{icon:(0,D.jsx)(b,{className:`size-5`}),title:t.screen,description:t.screenDescription,children:[(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:A.permissions.screenRecording===`granted`?t.granted:t.notGranted}),A.permissions.screenRecording!==`granted`&&(0,D.jsx)(d,{disabled:p,"aria-label":`${t.openSettings}: ${t.screen}`,onClick:()=>{I(()=>F.requestScreen())},children:t.openSettings})]})]})]}):(0,D.jsx)(`div`,{"aria-label":t.checking,children:(0,D.jsx)(h,{className:`h-52 w-full rounded-xl`})}):(0,D.jsx)(`p`,{className:`rounded-xl bg-surface-hover/20 p-5 text-sm leading-relaxed text-fg-muted`,children:window.electronAPI&&window.electronAPI.platform!==`darwin`?t.unsupportedPlatform:t.desktopRequired}),(A?.error||A?.session?.errorCode)&&(0,D.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-red-600`,children:A.error||A.session?.errorCode})]})]})}export{A as ComputerSettingsPage,M as ComputerSettingsPanel};
|