@xopcai/xopc 0.0.346 → 0.0.347

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.
Files changed (109) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-M2vuj6W3.js → agent-avatar-dicebear-CoiIwwcu.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B_d0WGFm.js → agent-defaults-settings-panel-CMnbBav3.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-egTQDEeV.js → agent-plugin-dialog-SJIZZLqo.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-BbwmG8Kl.js → agents-CB-eDUCf.js} +3 -3
  7. package/dist/gateway/static/root/assets/{agents-admin-api-Dlw9XxYa.js → agents-admin-api-DZsBZ9R6.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-IxWZDAeT.js → app-management-settings-panel-6zwkqMLD.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-C56szwjn.js → appearance-settings-DiWUyQlA.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-Cqoc4xoi.js → apps-page-Dhtxj66a.js} +1 -1
  11. package/dist/gateway/static/root/assets/{archive-plugin-Ce3TNO-R.js → archive-plugin-12JlrV5S.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-4so9_Bya.js → automations-page-DkCvD50d.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-CP3GH1iA.js → automations-workspace-BWrYnsIk.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-l6tKp21u.js → binary-plugins-PhtCEjXI.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-cj2RNjQs.js → block-editor-ClfFgVfs.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-C9W2EklQ.js → browser-automation-inputs-BgK2Ma4E.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-automations-page-CbTkFxIX.js → browser-automations-page-Cln2uM_F.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-settings-page-KMfDs9dO.js → browser-settings-page-BtqTwprD.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capabilities-Co9ZxHHB.js → capabilities-C2vyJC-B.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capabilities-page-cm2Q7EfF.js → capabilities-page-eKbC_K_v.js} +2 -2
  21. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CIe5qsxW.js → capabilities-settings-panel-Cga_BvtH.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capability-header-actions-D2ASOs4Z.js → capability-header-actions-BlSn4DO-.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-D-DnLz_c.js → channels-CUNI7YuR.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-DaQrqzCz.js → chat-terminal-dock-CjJ3yFld.js} +1 -1
  25. package/dist/gateway/static/root/assets/computer-settings-page-L7oHWFBe.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-service-page-Cq7t7AJq.js → connector-service-page-5522WTzU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{connectors-page-BH53KX8Y.js → connectors-page-C2AUOcWz.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-CcfRQKmj.js → date-picker-CX-fcLaj.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-b9Tif8dg.js → dependency-picker-aQFvZft6.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-BHe6Cb51.js → desktop-pet-C4Uhyxe8.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-wgA6yOo1.js → desktop-pet-settings-Cfe9_J1_.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-fv8c6u1o.js → device-pairing-wizard-CKpSUyhq.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-DM2YpM4N.js → directory-picker-path-field-C8SJyIWD.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-B-Y_Zk8L.js → extension-debug-page-D6cI3rxD.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-BC1m3MlB.js → extension-page-hAhyhLBd.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-Cu3cfeJj.js → extension-settings-page-BaVBR7JT.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-ukBQYwfH.js → gateway-config-swr-COCA8geG.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-realtime-DvNfXjan.js → gateway-realtime-Blcloycq.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-realtime-store-B87bp5kF.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-settings-pxmn3b8n.js → gateway-settings-CDbZ2_6H.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-CVpOj205.js → gateway-startup-retry-CradGmBo.js} +1 -1
  42. package/dist/gateway/static/root/assets/{home-page-DOsvv2rU.js → home-page-B7KbsJKW.js} +1 -1
  43. package/dist/gateway/static/root/assets/{image-generation-api-zxx0qG9z.js → image-generation-api-CCe_-wBX.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-CWYDLeqJ.js → imports-page-B86kmOio.js} +1 -1
  45. package/dist/gateway/static/root/assets/{index-DsIQD44S.js → index-BXK396ki.js} +8 -8
  46. package/dist/gateway/static/root/assets/index-DUAz4R7d.css +1 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEkTI6mv.js → keyboard-shortcuts-settings-hrPwzRF0.js} +1 -1
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-aSXZL05r.js → local-app-workbench-page-xxr8vk61.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-apps-page-BJThsekO.js → local-apps-page-DjGpad5m.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-session-drafts-Dt_Yx7kq.js → local-session-drafts-CIcrQnQp.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-B008NR-f.js → locale-store-K7mHrs6W.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-WlqqTmpk.js → logs-page-BaNpykh9.js} +1 -1
  53. package/dist/gateway/static/root/assets/{management-settings-j_npowOA.js → management-settings-BFX3uxYe.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-view-BjDzimRP.js → markdown-view-BNVvybMV.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-DhYWGP6O.js → media-plugins-N8-QJc33.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-CY3XVeek.js +3 -0
  57. package/dist/gateway/static/root/assets/{note-detail-panel-CYcNB2Pf.js → note-detail-panel-Cd2Xn69o.js} +3 -3
  58. package/dist/gateway/static/root/assets/notes-page-Bsl4HbT9.js +8 -0
  59. package/dist/gateway/static/root/assets/{page-context-capture-button-BfmOqRGN.js → page-context-capture-button-BmgyQ8lB.js} +1 -1
  60. package/dist/gateway/static/root/assets/{page-tabs-aFGUXE53.js → page-tabs-yZZdLTLc.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-BCEnqJTC.js → preview-open-alternatives-BWqdZ75S.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-DHcx6kDT.js → product-open-page-ysuSrfYK.js} +1 -1
  63. package/dist/gateway/static/root/assets/{project-detail-page-ChKkovsq.js → project-detail-page-Cw4eSr4K.js} +1 -1
  64. package/dist/gateway/static/root/assets/{projects-page-Lt3HXMRm.js → projects-page-B2Y4n5sK.js} +1 -1
  65. package/dist/gateway/static/root/assets/{registry-api-EPj5O77m.js → registry-api-DKxVZeHC.js} +1 -1
  66. package/dist/gateway/static/root/assets/{remote-access-hub-B94Vc-fj.js → remote-access-hub-DYwr2taY.js} +1 -1
  67. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DNU19xEH.js → runtime-tools-settings-panel-C8OZvZxC.js} +1 -1
  68. package/dist/gateway/static/root/assets/{scenes-page-BgzfnfOB.js → scenes-page-R9FSDMyC.js} +1 -1
  69. package/dist/gateway/static/root/assets/{schema-form-MKBLqh8C.js → schema-form-DEK9fasz.js} +1 -1
  70. package/dist/gateway/static/root/assets/{session-api-D5BlAIge.js → session-api-DoE_8MbN.js} +1 -1
  71. package/dist/gateway/static/root/assets/{session-manager-DcFS0yfO.js → session-manager-B9ZJw1W4.js} +1 -1
  72. package/dist/gateway/static/root/assets/{sessions-page-sYWhgEMH.js → sessions-page-BpFoEKF1.js} +1 -1
  73. package/dist/gateway/static/root/assets/settings-advanced-gate-DjmP_P8-.js +1 -0
  74. package/dist/gateway/static/root/assets/{settings-form-section-C2gcfyxy.js → settings-form-section-DEWe2yXX.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-CYd6_yBb.js → settings-page-J9m511lP.js} +1 -1
  76. package/dist/gateway/static/root/assets/{setup-status-panel-CUbH_YtB.js → setup-status-panel-CzXfd8sp.js} +1 -1
  77. package/dist/gateway/static/root/assets/{share-preview-page-Dxwq4fx1.js → share-preview-page-CfN124hX.js} +1 -1
  78. package/dist/gateway/static/root/assets/{shares-settings-CqwHm0Mf.js → shares-settings-CTsg7oUv.js} +1 -1
  79. package/dist/gateway/static/root/assets/{skill-api-C9k6G-tI.js → skill-api-DKKacicr.js} +1 -1
  80. package/dist/gateway/static/root/assets/skill-reload-api-CPUdkUW4.js +1 -0
  81. package/dist/gateway/static/root/assets/{skills-page-CFiCgbAs.js → skills-page-DaehgBFO.js} +1 -1
  82. package/dist/gateway/static/root/assets/{system-settings-panel-1tXKr0cJ.js → system-settings-panel-CBABQnDB.js} +1 -1
  83. package/dist/gateway/static/root/assets/{task-detail-page-BBQ3sk4y.js → task-detail-page-C7Vpoc1R.js} +1 -1
  84. package/dist/gateway/static/root/assets/{tunnel-api-COo0rSrc.js → tunnel-api-h8J8sWvL.js} +1 -1
  85. package/dist/gateway/static/root/assets/{usage-page-DHXG-2Rr.js → usage-page-BqN4hLxa.js} +1 -1
  86. package/dist/gateway/static/root/assets/{use-autosave-CJfX4SWk.js → use-autosave-DAYoOcKf.js} +1 -1
  87. package/dist/gateway/static/root/assets/{user-model-page-d-Gjs-EX.js → user-model-page-Bog1W3OS.js} +1 -1
  88. package/dist/gateway/static/root/assets/{voice-api-key-field-D0gWz3iO.js → voice-api-key-field-C2SX3Gb3.js} +1 -1
  89. package/dist/gateway/static/root/assets/{voice-config-api-BnnUzr07.js → voice-config-api-C9HKTnnD.js} +1 -1
  90. package/dist/gateway/static/root/assets/{work-discovery-overlay-CDAZKFVO.js → work-discovery-overlay-F0tCV50t.js} +1 -1
  91. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Db0lk_9G.js → workflow-run-setup-panel-BWyDzuu9.js} +1 -1
  92. package/dist/gateway/static/root/assets/{workflows-page-Dj89Gagd.js → workflows-page-ClBQeXmf.js} +1 -1
  93. package/dist/gateway/static/root/index.html +15 -15
  94. package/dist/package.js +1 -1
  95. package/dist/src/computer/errors.js +1 -0
  96. package/dist/src/gateway/hono/routes/sessions.js +9 -0
  97. package/dist/src/gateway/service/sessions-api.d.ts +2 -3
  98. package/dist/src/gateway/service/sessions-api.js +5 -0
  99. package/dist/src/session/execution-detail.d.ts +16 -0
  100. package/dist/src/session/execution-detail.js +150 -0
  101. package/dist/src/tui/tui.js +1 -1
  102. package/package.json +3 -3
  103. package/dist/gateway/static/root/assets/computer-settings-page-C-59NTyH.js +0 -1
  104. package/dist/gateway/static/root/assets/gateway-realtime-store-DGQMXjfI.js +0 -1
  105. package/dist/gateway/static/root/assets/index-y6kxoLV2.css +0 -1
  106. package/dist/gateway/static/root/assets/messages-aVTaD9Mj.js +0 -3
  107. package/dist/gateway/static/root/assets/notes-page-4D1-mt6Y.js +0 -8
  108. package/dist/gateway/static/root/assets/settings-advanced-gate-alf3atpI.js +0 -1
  109. package/dist/gateway/static/root/assets/skill-reload-api-D9bB-ANm.js +0 -1
@@ -0,0 +1,150 @@
1
+ import { init_redact, redactSensitiveOutput } from "../utils/logger/redact.js";
2
+ //#region src/session/execution-detail.ts
3
+ init_redact();
4
+ function toolCategory(name, args) {
5
+ const key = name.split("__").pop()?.toLowerCase().replace(/-/g, "_") ?? "";
6
+ if (key === "skill_view" || key === "tool_manual") return key;
7
+ if (key === "xopc_use") {
8
+ let input = args;
9
+ if (typeof input === "string") try {
10
+ input = JSON.parse(input);
11
+ } catch {
12
+ return "manage_work";
13
+ }
14
+ const record = input && typeof input === "object" && !Array.isArray(input) ? input : {};
15
+ const mode = typeof record.mode === "string" ? record.mode : "work";
16
+ const command = typeof record.command === "string" ? record.command : "";
17
+ const inspect = [
18
+ "list",
19
+ "get",
20
+ "get_card",
21
+ "history",
22
+ "list_milestones",
23
+ "list_updates",
24
+ "mail_sources",
25
+ "preview_edit",
26
+ "resolve_workspace"
27
+ ].includes(command);
28
+ const target = mode === "task_run" ? "tasks" : [
29
+ "note",
30
+ "task",
31
+ "project",
32
+ "automation"
33
+ ].includes(mode) ? `${mode}s` : "work";
34
+ return `${inspect ? "inspect" : "manage"}_${target}`;
35
+ }
36
+ if (key.includes("search")) return "search";
37
+ if (key === "read_file" || key === "read_media" || key === "image") return "read";
38
+ if (key === "exec_command" || key === "run_command") return "command";
39
+ if (key === "write_file") return "write";
40
+ if (key === "apply_patch" || key === "edit_file") return "edit";
41
+ if ([
42
+ "web_fetch",
43
+ "web_extract",
44
+ "open_url",
45
+ "browser_use"
46
+ ].includes(key)) return "fetch";
47
+ if (key === "create_share") return "share";
48
+ if (key === "text_to_speech") return "speech";
49
+ if (key === "publish_artifacts") return "publish";
50
+ if (key === "update_plan") return "plan";
51
+ return "other";
52
+ }
53
+ function publicInputPreview(name, args) {
54
+ if (!args || typeof args !== "object" || Array.isArray(args)) return void 0;
55
+ const input = args;
56
+ const category = toolCategory(name, args);
57
+ const keys = category === "search" ? ["query"] : category === "read" ? ["path", "file_path"] : category === "fetch" ? ["url"] : [];
58
+ for (const key of keys) {
59
+ const value = input[key];
60
+ if (typeof value === "string" && value.trim()) {
61
+ if (key === "url") try {
62
+ const url = new URL(value);
63
+ return `${url.origin}${url.pathname}`.slice(0, 160);
64
+ } catch {
65
+ return;
66
+ }
67
+ return redactSensitiveOutput(value.trim().slice(0, 160));
68
+ }
69
+ }
70
+ }
71
+ function publicFailure(details) {
72
+ if (!details || typeof details !== "object" || Array.isArray(details)) return void 0;
73
+ const record = details;
74
+ for (const key of [
75
+ "errorMessage",
76
+ "reason",
77
+ "error"
78
+ ]) {
79
+ const value = record[key];
80
+ if (typeof value === "string" && value.trim()) return redactSensitiveOutput(value.trim().split("\n")[0].slice(0, 240));
81
+ }
82
+ }
83
+ /** A bounded, public projection of stored activity. Never forwards raw reasoning or tool output. */
84
+ function publicExecutionDetail(messages, turnId) {
85
+ const selected = messages.filter((message) => message.role === "assistant" && (message.turnId === turnId || message.id === turnId));
86
+ if (!selected.length) return null;
87
+ const steps = [];
88
+ const seenTools = /* @__PURE__ */ new Set();
89
+ for (const message of selected) {
90
+ const calls = new Map((message.toolCalls ?? []).map((call) => [call.id, call]));
91
+ const raw = Array.isArray(message.rawContent) ? message.rawContent : [];
92
+ for (let index = 0; index < raw.length; index++) {
93
+ const block = raw[index];
94
+ if (!block || typeof block !== "object" || Array.isArray(block)) continue;
95
+ const item = block;
96
+ if (item.type === "thinking") {
97
+ if (steps.at(-1)?.kind !== "thinking") steps.push({
98
+ id: `${message.id}:thinking:${index}`,
99
+ kind: "thinking"
100
+ });
101
+ continue;
102
+ }
103
+ if (item.type === "text" && item.presentation === "narration" && typeof item.text === "string" && item.text.trim()) {
104
+ steps.push({
105
+ id: `${message.id}:progress:${index}`,
106
+ kind: "progress",
107
+ text: item.text.trim().slice(0, 500)
108
+ });
109
+ continue;
110
+ }
111
+ if (![
112
+ "toolCall",
113
+ "tool_use",
114
+ "tool_call"
115
+ ].includes(String(item.type))) continue;
116
+ const id = typeof item.id === "string" ? item.id : `${message.id}:tool:${index}`;
117
+ if (seenTools.has(id)) continue;
118
+ seenTools.add(id);
119
+ const call = calls.get(id);
120
+ const name = call?.name ?? (typeof item.name === "string" ? item.name : "");
121
+ steps.push({
122
+ id,
123
+ kind: "tool",
124
+ category: toolCategory(name, call?.args ?? item.input ?? item.args),
125
+ preview: publicInputPreview(name, call?.args ?? item.input ?? item.args),
126
+ failure: call?.isError ? publicFailure(call.details) : void 0,
127
+ status: call?.isError ? "error" : call?.result !== void 0 ? "done" : "running"
128
+ });
129
+ }
130
+ for (const call of message.toolCalls ?? []) {
131
+ const id = call.id ?? `${message.id}:tool:${steps.length}`;
132
+ if (seenTools.has(id)) continue;
133
+ seenTools.add(id);
134
+ steps.push({
135
+ id,
136
+ kind: "tool",
137
+ category: toolCategory(call.name, call.args),
138
+ preview: publicInputPreview(call.name, call.args),
139
+ failure: call.isError ? publicFailure(call.details) : void 0,
140
+ status: call.isError ? "error" : call.result !== void 0 ? "done" : "running"
141
+ });
142
+ }
143
+ }
144
+ return {
145
+ turnId,
146
+ steps
147
+ };
148
+ }
149
+ //#endregion
150
+ export { publicExecutionDetail };
@@ -13,6 +13,7 @@ import { renderWorkflowFinalSummary, renderWorkflowPanel } from "../agent/workfl
13
13
  import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
14
14
  import "../config/index.js";
15
15
  import { runViewToSnapshot } from "../workflows/service/run-view-to-snapshot.js";
16
+ import { resolveTuiConversationId, resolveTuiStartupConversationId } from "../routing/resolve-tui-session-key.js";
16
17
  import { applyThemeById, getBashExcludeBorderColor, getBashModeBorderColor, getCustomThemesDir, getThemeExports, getThinkingBorderColor, initTuiTheme, listAvailableThemeIds, resolveThemePalette } from "./theme-manager.js";
17
18
  import { editorTheme, theme } from "./theme.js";
18
19
  import { extensionForImageMimeType, readClipboardImage } from "./clipboard-image.js";
@@ -44,7 +45,6 @@ import { createEditorSubmitHandler, createSubmitBurstCoalescer, shouldEnableWind
44
45
  import { withTuiSuspended } from "./tui-suspend.js";
45
46
  import { createInitialState } from "./tui-types.js";
46
47
  import { TuiDraftFileStore } from "./backends/embedded-drafts.js";
47
- import { resolveTuiConversationId, resolveTuiStartupConversationId } from "../routing/resolve-tui-session-key.js";
48
48
  import { EmbeddedBackend } from "./backends/embedded-backend.js";
49
49
  import { GatewayRealtimeBackend } from "./backends/gateway-realtime-backend.js";
50
50
  import { ChatLog } from "./components/chat-log.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.346",
3
+ "version": "0.0.347",
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",
@@ -159,11 +159,11 @@
159
159
  "vitest": "4.1.5",
160
160
  "vue": "^3.5.35",
161
161
  "@xopcai/browser-control-contract": "0.1.0",
162
- "@xopcai/endpoint-tools-client": "0.0.0",
163
162
  "@xopcai/computer-control-contract": "0.1.0",
163
+ "@xopcai/endpoint-tools-client": "0.0.0",
164
164
  "@xopcai/endpoint-tools-protocol": "0.0.0",
165
- "@xopcai/realtime-client": "0.0.0",
166
165
  "@xopcai/gateway-contract": "0.0.0",
166
+ "@xopcai/realtime-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"./globe-DSSGFWFn.js";import{t as o}from"./messages-aVTaD9Mj.js";import{a as s,n as c,r as l}from"./locale-store-B008NR-f.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-ukBQYwfH.js";import{n as p,t as m}from"./registry-api-EPj5O77m.js";import{t as h}from"./skeleton-BwbyijEw.js";import{t as g}from"./electron-env-Dit0bHgy.js";import{Lc as _,Mi as v,Oc as y,Sn as b,gl as x,hl as S,xn as C}from"./index-DsIQD44S.js";import{n as w,r as T}from"./settings-page-layout-X1x-2Cp9.js";var E=n(),D=e(t(),1),O=r();function k({zh:e}){let t=o(e?`zh`:`en`).computerSettings,n=u(`settings-agent-defaults`,C),r=u(m,p),a=n.data?.defaults.models.computerUse?.primary??``,[s,c]=(0,D.useState)(a),[l,f]=(0,D.useState)(!1),[g,_]=(0,D.useState)(``),[y,x]=(0,D.useState)(!1);(0,D.useEffect)(()=>{c(a)},[a]);let S=!s||r.data?.some(e=>e.id===s&&e.computerUse),w=async()=>{f(!0),_(``),x(!1);try{if(!S)throw Error(t.modelUnavailable);let e=await C(),r={...e.defaults.models};s?r.computerUse={primary:s,fallbacks:[]}:delete r.computerUse;let i=await b({...e.defaults,models:r});await n.mutate(i,!1),x(!0)}catch(e){_(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,O.jsxs)(`section`,{"aria-label":t.model,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.model}),!n.data&&!n.error?(0,O.jsx)(h,{className:`h-52 w-full rounded-xl`}):n.error?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-danger`,children:[String(n.error),(0,O.jsx)(d,{onClick:()=>{n.mutate().catch(()=>{})},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-hover/25 p-4 sm:p-5`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.modelDescription}),(0,O.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t.modelScope}),r.isLoading?(0,O.jsx)(h,{className:`h-10 w-full rounded-lg`}):(0,O.jsx)(v,{value:s,onChange:e=>{c(e),x(!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`}),!S&&!r.isLoading&&!r.error&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:t.modelUnavailable}),r.error&&(0,O.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[String(r.error),(0,O.jsx)(d,{onClick:()=>{r.mutate().catch(()=>{})},children:t.retry})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(d,{variant:`primary`,disabled:l||s===a||!S||!!r.error||r.isLoading,onClick:()=>{w()},children:t.saveModel}),(0,O.jsx)(d,{asChild:!0,variant:`ghost`,children:(0,O.jsx)(i,{to:`/settings/capabilities/models?add=1`,children:t.manageModels})}),y&&(0,O.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:t.modelSaved})]}),g&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:g})]}),(0,O.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t.modelPrivacy})]})}function A(e){let t=(0,E.c)(15),{icon:n,title:r,description:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n&&(0,O.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,O.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,O.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,O.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,O.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,O.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 j(){let e=(0,E.c)(2),t=c(M)===`zh`,n;return e[0]===t?n=e[1]:(n=(0,O.jsx)(N,{zh:t}),e[0]=t,e[1]=n),n}function M(e){return e.language}function N({zh:e}){let t=o(e?`zh`:`en`).computerSettings,{data:n,mutate:r,error:c}=f(!0),u=n?.payload?.config,[p,m]=(0,D.useState)(!1),[v,b]=(0,D.useState)(``),[C,E]=(0,D.useState)(!1),[j,M]=(0,D.useState)(null),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(null),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(``),V=window.electronAPI?.platform===`darwin`?window.electronAPI.computer:void 0,H=window.electronAPI?.platform===`darwin`?window.electronAPI.system:void 0;(0,D.useEffect)(()=>{if(!V)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await V.status();e||(M(t),P(!1))}catch{e||(M(null),P(!0))}finally{t=!1}}};n();let r=window.setInterval(()=>{n()},2e3);return()=>{e=!0,window.clearInterval(r)}},[V]),(0,D.useEffect)(()=>{if(!V?.access)return;let e=!1;return V.access().then(t=>{e||(I(t),R(!1))}).catch(()=>{e||R(!0)}),()=>{e=!0}},[V]);let U=async e=>{m(!0),b(``);try{await e()}catch(e){b(e instanceof Error?e.message:String(e))}finally{m(!1)}},W=e=>U(async()=>{g()&&(await s(l(`/api/config`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({computer:{enabled:e}})}),await r())}),G=async()=>{b(``),E(!1);try{await V?.stop(),E(!0),V&&M(await V.status())}catch(e){b(e instanceof Error?e.message:String(e))}},K=j?.session?.status??`idle`,q=t.states[K]??K,J=g()&&u?.computer?.enabled===!0;return(0,O.jsxs)(T,{gap:`gap-7`,children:[(0,O.jsx)(w,{title:t.title,subtitle:t.subtitle,meta:(0,O.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,O.jsx)(`span`,{className:`inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.experimental}),(0,O.jsx)(`span`,{className:`inline-flex rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:t.preview})]}),(0,O.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:t.experimentalDescription})]}),actions:V&&(0,O.jsxs)(d,{onClick:()=>{G()},children:[(0,O.jsx)(y,{className:`size-3.5`}),t.stop]})}),v&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:v}),C&&(0,O.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t.stoppedNotice}),j?.controlPaused&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-warning-soft p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.pausedNotice}),(0,O.jsx)(d,{disabled:p,onClick:()=>{U(async()=>{V&&M(await V.resume()),E(!1)})},children:t.resume})]}),(0,O.jsx)(k,{zh:e}),(0,O.jsxs)(`section`,{"aria-labelledby":`computer-control-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-control-title`,className:`text-sm font-semibold text-fg`,children:t.control}),!u&&!c?(0,O.jsx)(h,{className:`h-40 w-full rounded-xl`}):c?(0,O.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[String(c),` `,(0,O.jsx)(d,{onClick:()=>{U(()=>r())},children:t.retry})]}):(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[(0,O.jsx)(A,{icon:(0,O.jsx)(S,{className:`size-5`}),title:t.desktop,description:t.desktopDescription,children:(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":t.desktop,"aria-checked":J,disabled:p||!g(),onClick:()=>{W(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,O.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors ${J?`bg-accent`:`bg-fg-muted/30`}`,children:(0,O.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform ${J?`translate-x-5`:`translate-x-0`}`})})})}),(0,O.jsx)(A,{icon:(0,O.jsx)(a,{className:`size-5`}),title:t.browser,description:(0,O.jsxs)(O.Fragment,{children:[t.browserDescription,(0,O.jsx)(`span`,{className:`mt-1 block text-xs`,children:u?.browser?.enabled?t.browserEnabled:t.browserDisabled})]}),children:(0,O.jsx)(d,{asChild:!0,children:(0,O.jsx)(i,{to:`/settings/agent-browser`,children:t.manage})})})]}),(0,O.jsxs)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:[t.safety,` `,t.lockedDescription]})]}),V?.access&&(0,O.jsxs)(`section`,{"aria-labelledby":`computer-app-access-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-app-access-title`,className:`text-sm font-semibold text-fg`,children:t.appAccess}),(0,O.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:t.appAccessDescription}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":t.searchApps,value:z,onChange:e=>B(e.target.value),placeholder:t.searchApps,className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`}),(0,O.jsx)(d,{disabled:p,onClick:()=>{U(async()=>{I(await V.access()),R(!1)})},children:t.refreshApps})]}),F?(0,O.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-xl border border-edge`,children:F.apps.filter(e=>`${e.name} ${e.appId}`.toLocaleLowerCase().includes(z.toLocaleLowerCase())).map(e=>{let n=F.authorizedAppIds.includes(e.appId);return(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle p-3 last:border-b-0`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.appId})]}),(0,O.jsx)(d,{disabled:p,variant:n?`secondary`:`primary`,onClick:()=>{U(async()=>{let t=await V.setAppAccess(e.appId,!n);I(e=>e&&{...e,authorizedAppIds:t.authorizedAppIds})})},children:n?t.revokeApp:t.authorizeApp})]},e.appId)})}):L?(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.appListError}):(0,O.jsx)(h,{className:`h-28 w-full rounded-xl`})]}),(0,O.jsxs)(`section`,{"aria-labelledby":`computer-permissions-title`,className:`space-y-3`,children:[(0,O.jsx)(`h2`,{id:`computer-permissions-title`,className:`text-sm font-semibold text-fg`,children:t.permissions}),V?N?(0,O.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-5 text-sm text-danger`,children:t.nativeError}):j?(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[(0,O.jsx)(A,{icon:(0,O.jsx)(x,{className:`size-5`}),title:t.device,description:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`span`,{"aria-live":`polite`,children:[j.connected?t.connected:t.disconnected,` · `,q]}),j.reenrollmentRequired&&(0,O.jsx)(`p`,{className:`mt-1`,children:t.revoked})]}),children:j.reenrollmentRequired&&(0,O.jsx)(d,{disabled:p,onClick:()=>{U(async()=>{M(await V.reenroll())})},children:t.reenroll})}),H&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(A,{icon:(0,O.jsx)(_,{className:`size-5`}),title:t.accessibility,description:t.accessibilityDescription,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:j.permissions.accessibility?t.granted:t.notGranted}),!j.permissions.accessibility&&(0,O.jsx)(d,{disabled:p,"aria-label":`${t.openSettings}: ${t.accessibility}`,onClick:()=>{U(()=>H.requestAccessibility())},children:t.openSettings})]}),(0,O.jsxs)(A,{icon:(0,O.jsx)(x,{className:`size-5`}),title:t.screen,description:t.screenDescription,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-muted`,children:j.permissions.screenRecording===`granted`?t.granted:t.notGranted}),j.permissions.screenRecording!==`granted`&&(0,O.jsx)(d,{disabled:p,"aria-label":`${t.openSettings}: ${t.screen}`,onClick:()=>{U(()=>H.requestScreen())},children:t.openSettings})]})]})]}):(0,O.jsx)(`div`,{"aria-label":t.checking,children:(0,O.jsx)(h,{className:`h-52 w-full rounded-xl`})}):(0,O.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}),(j?.error||j?.session?.errorCode)&&(0,O.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-red-600`,children:j.error||j.session?.errorCode})]})]})}export{j as ComputerSettingsPage,N as ComputerSettingsPanel};
@@ -1 +0,0 @@
1
- import{p as e}from"./locale-store-B008NR-f.js";var t=e(()=>({connectionState:`idle`,error:null}));function n(e){t.setState(e)}export{t as n,n as t};