@xopcai/xopc 0.0.395 → 0.0.397

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 (192) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BRtkz-ZU.js → agent-avatar-dicebear-CIEGrioy.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Dqg2NOn-.js → agent-defaults-settings-panel-CzKNVkRn.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-plugin-dialog-mpA9rwYd.js +1 -0
  7. package/dist/gateway/static/root/assets/{agents-0zgLsfVA.js → agents-7VMa7Rzo.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BZS8FvoL.js → app-management-settings-panel-DIJ0ii-n.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-RxXMAxiB.js → appearance-settings-BGnyHS-p.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-CvqDUvof.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DEnHq3OR.js → archive-plugin-CR8FcRAa.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-BwkugzB8.js → automations-page-BLInZo7N.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-K8aDhoYt.js → automations-workspace-DvTSHLt3.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-NWeXhh1k.js → binary-plugins-DW9pu205.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-D_bKN3BN.js → block-editor-ClgTc5v8.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-vtPkXfJ8.js → browser-automation-inputs-Bn7kDuUB.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-automations-page-DBPbwOG8.js → browser-automations-page-CJGBhDnv.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-settings-page-VBZDYoXD.js → browser-settings-page-tsi5W-cJ.js} +1 -1
  19. package/dist/gateway/static/root/assets/capabilities-page-CfbGk8q_.js +2 -0
  20. package/dist/gateway/static/root/assets/{capabilities-settings-panel-C_OMsW_8.js → capabilities-settings-panel-BkO7QEyA.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-header-actions-CMJXWq8a.js → capability-header-actions-9ZG71-BO.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-C_TVCc1N.js → channels-D0CwJktG.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-9YRAokOl.js → chat-terminal-dock-x1W2_hwc.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-BPYAZ4ks.js → computer-settings-page-D_b_bFVz.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-B81cEAEX.js → connector-service-page-Kf8kaNm_.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-C0NvAP2V.js → connectors-page-DlpfL2Rc.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-BvKP4P3n.js → date-picker-d5kiPUG0.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-TvrNaf8y.js → dependency-picker-BcH76tQC.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-De-_QNSD.js → desktop-pet-B-925tPX.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CRSRTIwT.js → desktop-pet-settings-3XJ4qR65.js} +1 -1
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-12m5Z9-8.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-DOPXwYNR.js → directory-picker-path-field-B-qZCjGR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-DzXvpUwj.js → extension-debug-page-BlQu1u6X.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-C0S1zNeP.js → extension-page-CXxM1M62.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-C3Z7bFjy.js → extension-settings-page-AF5nvsPP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-Btc2wTQe.js → gateway-settings-ABXvW_yL.js} +1 -1
  37. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BFYBbh1P.js → highlighted-body-KQOG7T2V-Czdbbi0H.js} +1 -1
  38. package/dist/gateway/static/root/assets/{home-page-C5sLR47Q.js → home-page-LXGxGwVl.js} +1 -1
  39. package/dist/gateway/static/root/assets/{image-generation-api-Vqcyqnzb.js → image-generation-api-DPFPJ2ps.js} +1 -1
  40. package/dist/gateway/static/root/assets/{imports-page-BJGHrzhX.js → imports-page-Bwyotfbt.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-BKHxJaGD.css +1 -0
  42. package/dist/gateway/static/root/assets/{index-BNRLzxpH.js → index-Dsp_gNdl.js} +116 -116
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BQkQoPmm.js → keyboard-shortcuts-settings-C20gl-l7.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-DbxLz9Ms.js → local-app-workbench-page-o0M_OSjC.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-CaatwSrK.js → local-apps-page-DoWJCmOq.js} +1 -1
  46. package/dist/gateway/static/root/assets/{logs-page-3Wo4Lmts.js → logs-page-BFTL93RX.js} +1 -1
  47. package/dist/gateway/static/root/assets/{management-settings-BHlbM8IM.js → management-settings-C52cuMg1.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-Cq1uLrd8.js → media-plugins-DLrTRF0a.js} +1 -1
  49. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CPYJsRUJ.js +1 -0
  50. package/dist/gateway/static/root/assets/{note-detail-panel-MjKND8HC.js → note-detail-panel-CNN41byS.js} +3 -3
  51. package/dist/gateway/static/root/assets/{notes-page-Cv040hVD.js → notes-page-BsfBp_8z.js} +1 -1
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-Cp71nTq2.js → page-context-capture-button-YTVWZ02-.js} +1 -1
  53. package/dist/gateway/static/root/assets/{personal-page-CyEUWV2n.js → personal-page-N4KoCZYG.js} +1 -1
  54. package/dist/gateway/static/root/assets/plugin-details-page-DcrrzQI-.js +1 -0
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-gzCecXc4.js → preview-open-alternatives-DzA__S54.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-CWFT7VuQ.js → product-open-page-DvlMKj0T.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-preview-content-Dh111Kca.js → product-preview-content-qdFyo4NG.js} +1 -1
  58. package/dist/gateway/static/root/assets/{project-detail-page-CyhyZiTi.js → project-detail-page-y67s_fA8.js} +1 -1
  59. package/dist/gateway/static/root/assets/{projects-page-QUdyJino.js → projects-page-D5iYgi0O.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-Cd8P0Dxs.js → remote-access-hub-DeFF7Re-.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bTjVfYm5.js → runtime-tools-settings-panel-BCHLh-KQ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-BGOzfVyj.js → schema-form-CJvaVHkx.js} +1 -1
  63. package/dist/gateway/static/root/assets/{sessions-page-BGMemJF6.js → sessions-page-DZ93_D5M.js} +1 -1
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-F1WX7vxq.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-Bqm1IKvR.js → settings-form-section-B3eODxNv.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-CniJVL-o.js → settings-page-Dg86uCnr.js} +1 -1
  67. package/dist/gateway/static/root/assets/{setup-status-panel-JPs4-QRw.js → setup-status-panel-ruFzAArp.js} +1 -1
  68. package/dist/gateway/static/root/assets/{share-preview-page-BnDGFgBR.js → share-preview-page-DCy1f25V.js} +1 -1
  69. package/dist/gateway/static/root/assets/{shares-settings-Cgp5BuLt.js → shares-settings-DeIVZvpJ.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-api-CFdrz6tl.js → skill-api-RisyPAMA.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skill-reload-api-Cy5jVfms.js → skill-reload-api-Dwkm1Fof.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page-CxaA3P5E.js → skills-page-UiTLsrFc.js} +1 -1
  73. package/dist/gateway/static/root/assets/{style-C_MAnir7.js → style-CwMX73G7.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-BjnIlilP.js → system-settings-panel-Cma37Pfm.js} +1 -1
  75. package/dist/gateway/static/root/assets/{task-detail-page-Bg79rPnF.js → task-detail-page-BKOF_kxS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{tracing-settings-page-BCI0tUbe.js → tracing-settings-page-DC-kLysq.js} +1 -1
  77. package/dist/gateway/static/root/assets/{tunnel-api-0knnta9z.js → tunnel-api-BgdhbR1L.js} +1 -1
  78. package/dist/gateway/static/root/assets/{usage-page-D5aT1eie.js → usage-page-BSlFg3Xj.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-Ds_mbAfe.js → use-autosave-iKvZ1pvC.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-model-page-D7L0-pDt.js → user-model-page-D4GB8QsM.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CPoGdarN.js → voice-api-key-field-CESbtuwM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CWNguy2Z.js → work-discovery-overlay-dtPpmYyh.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BcDMFfkT.js → workflow-run-setup-panel-DmFn3E_B.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflows-page-BwZB-s4N.js → workflows-page-DEtaRuxH.js} +1 -1
  85. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DlKr98VO.js → xopc-cloud-account-card-DTZnabfg.js} +1 -1
  86. package/dist/gateway/static/root/index.html +2 -2
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
  89. package/dist/src/agent/embedded/codemode-extension.js +6 -1
  90. package/dist/src/agent/embedded/run-for-session.js +1 -1
  91. package/dist/src/agent/embedded/run-turn.js +34 -2
  92. package/dist/src/agent/embedded/session-runner.js +1 -1
  93. package/dist/src/agent/mcp/config.d.ts +2 -0
  94. package/dist/src/agent/mcp/config.js +2 -2
  95. package/dist/src/agent/mcp/connection-setup.js +13 -1
  96. package/dist/src/agent/mcp/effective-server.d.ts +3 -0
  97. package/dist/src/agent/mcp/effective-server.js +27 -0
  98. package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
  99. package/dist/src/agent/mcp/native-mcp.js +13 -4
  100. package/dist/src/agent/mcp/tool-catalog.js +2 -1
  101. package/dist/src/agent/skills/index.d.ts +1 -0
  102. package/dist/src/agent/skills/index.js +6 -2
  103. package/dist/src/agent/skills/skill-manager.d.ts +1 -0
  104. package/dist/src/agent/skills/skill-manager.js +6 -1
  105. package/dist/src/agent/skills/skill-sources.d.ts +1 -0
  106. package/dist/src/agent/skills/skill-sources.js +4 -3
  107. package/dist/src/agent/skills/types.d.ts +1 -0
  108. package/dist/src/agent/workspace-runtime/registry.js +6 -2
  109. package/dist/src/browser/native-messaging-host.js +1 -1
  110. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  111. package/dist/src/channels/index.js +1 -1
  112. package/dist/src/channels/manager.js +1 -1
  113. package/dist/src/cli/commands/channels.js +1 -1
  114. package/dist/src/cli/commands/connectors.js +1 -1
  115. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  116. package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
  117. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  118. package/dist/src/cli/commands/extension.js +1 -1
  119. package/dist/src/cli/commands/mcp.js +6 -4
  120. package/dist/src/cli/commands/models.js +1 -1
  121. package/dist/src/cli/commands/onboard/model.js +1 -1
  122. package/dist/src/cli/commands/onboard.js +1 -1
  123. package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
  124. package/dist/src/extensions/agent-plugins/auth.js +53 -12
  125. package/dist/src/extensions/agent-plugins/branding.d.ts +6 -0
  126. package/dist/src/extensions/agent-plugins/branding.js +44 -0
  127. package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +22 -0
  128. package/dist/src/extensions/agent-plugins/cli-authorization.js +198 -0
  129. package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
  130. package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
  131. package/dist/src/extensions/agent-plugins/credentials.js +24 -1
  132. package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
  133. package/dist/src/extensions/agent-plugins/formats.js +208 -0
  134. package/dist/src/extensions/agent-plugins/inventory.d.ts +142 -2
  135. package/dist/src/extensions/agent-plugins/inventory.js +39 -5
  136. package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
  137. package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
  138. package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
  139. package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
  140. package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
  141. package/dist/src/extensions/agent-plugins/resources.js +112 -0
  142. package/dist/src/extensions/agent-plugins/setup-contract.d.ts +54 -0
  143. package/dist/src/extensions/agent-plugins/setup-contract.js +58 -0
  144. package/dist/src/extensions/agent-plugins/setup.d.ts +119 -0
  145. package/dist/src/extensions/agent-plugins/setup.js +491 -0
  146. package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
  147. package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
  148. package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
  149. package/dist/src/extensions/agent-plugins/sources.js +12 -3
  150. package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
  151. package/dist/src/extensions/agent-plugins/store.js +175 -25
  152. package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
  153. package/dist/src/extensions/agent-plugins/user-config.js +49 -0
  154. package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
  155. package/dist/src/extensions/agent-plugins/validation.js +142 -27
  156. package/dist/src/extensions/sdk/index.js +1 -1
  157. package/dist/src/gateway/hono/app.js +1 -1
  158. package/dist/src/gateway/hono/routes/agent-plugins.js +120 -9
  159. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  160. package/dist/src/gateway/hono/routes/composer-history.js +22 -4
  161. package/dist/src/gateway/hono/routes/mcp.js +6 -4
  162. package/dist/src/gateway/hono/routes/provider-setup.js +7 -0
  163. package/dist/src/gateway/service.js +11 -9
  164. package/dist/src/gateway/session-context-summary.js +1 -1
  165. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +4 -0
  166. package/dist/src/gateway/xopc-cloud-capability-setup.js +90 -26
  167. package/dist/src/home-intelligence/host.js +2 -2
  168. package/dist/src/providers/setup/engine.js +12 -10
  169. package/dist/src/providers/setup/voice.js +24 -6
  170. package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
  171. package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
  172. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  173. package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
  174. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  175. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  176. package/dist/src/storage/sqlite/schema.js +1 -1
  177. package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
  178. package/dist/src/tui/backends/embedded-backend.js +4 -4
  179. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
  180. package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
  181. package/dist/src/tui/composer-history.d.ts +14 -0
  182. package/dist/src/tui/composer-history.js +85 -0
  183. package/dist/src/tui/tui-backend.d.ts +4 -3
  184. package/dist/src/tui/tui.js +19 -46
  185. package/package.json +12 -4
  186. package/dist/gateway/static/root/assets/agent-plugin-dialog-CKK95Jmr.js +0 -1
  187. package/dist/gateway/static/root/assets/apps-page-mGU9WLjP.js +0 -1
  188. package/dist/gateway/static/root/assets/capabilities-page-CQsGp9Sx.js +0 -2
  189. package/dist/gateway/static/root/assets/device-pairing-wizard-DnyJ8Bja.js +0 -1
  190. package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
  191. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-XhlIBp5t.js +0 -1
  192. package/dist/gateway/static/root/assets/settings-advanced-gate-BiySFw1N.js +0 -1
@@ -0,0 +1,14 @@
1
+ import type { TuiComposerHistoryItem } from './tui-backend.js';
2
+ /** Session-scoped history; late responses never replace another session's editor history. */
3
+ export declare function createTuiComposerHistory(opts: {
4
+ currentConversationId: () => string;
5
+ load: (conversationId: string) => Promise<TuiComposerHistoryItem[]>;
6
+ persist: (conversationId: string, text: string) => Promise<TuiComposerHistoryItem>;
7
+ replace: (texts: string[]) => void;
8
+ }): {
9
+ append: (item: TuiComposerHistoryItem) => void;
10
+ refresh: (id?: string) => Promise<void>;
11
+ switchSession: () => void;
12
+ clear: (id: string) => void;
13
+ record: (text: string, id?: string) => void;
14
+ };
@@ -0,0 +1,85 @@
1
+ //#region src/tui/composer-history.ts
2
+ /** Session-scoped history; late responses never replace another session's editor history. */
3
+ function createTuiComposerHistory(opts) {
4
+ const sessions = /* @__PURE__ */ new Map();
5
+ const stateFor = (id) => {
6
+ let state = sessions.get(id);
7
+ if (!state) {
8
+ state = {
9
+ items: [],
10
+ revision: 0,
11
+ loadVersion: 0,
12
+ clearVersion: 0,
13
+ writeQueue: Promise.resolve()
14
+ };
15
+ sessions.set(id, state);
16
+ }
17
+ return state;
18
+ };
19
+ const publish = (id) => {
20
+ if (id === opts.currentConversationId()) opts.replace(stateFor(id).items.map((item) => item.text));
21
+ };
22
+ const append = (item) => {
23
+ if (typeof item.conversationId !== "string" || !item.conversationId || typeof item.text !== "string" || typeof item.id !== "number") return;
24
+ const state = stateFor(item.conversationId);
25
+ if (state.items.some((entry) => item.id > 0 && entry.id === item.id)) return;
26
+ state.revision += 1;
27
+ const optimisticIndex = state.items.findIndex((entry) => entry.id === 0 && entry.text === item.text);
28
+ if (optimisticIndex >= 0 && item.id > 0) {
29
+ state.items[optimisticIndex] = item;
30
+ return;
31
+ }
32
+ if (state.items[0]?.text === item.text) {
33
+ state.items[0] = item;
34
+ return;
35
+ }
36
+ state.items = [item, ...state.items].slice(0, 100);
37
+ publish(item.conversationId);
38
+ };
39
+ const refresh = async (id = opts.currentConversationId()) => {
40
+ const state = stateFor(id);
41
+ const loadVersion = ++state.loadVersion;
42
+ try {
43
+ await state.writeQueue;
44
+ const revision = state.revision;
45
+ const items = await opts.load(id);
46
+ if (state.revision !== revision || state.loadVersion !== loadVersion) return;
47
+ state.items = items.filter((item) => item.conversationId === id).slice(0, 100);
48
+ publish(id);
49
+ } catch {}
50
+ };
51
+ return {
52
+ append,
53
+ refresh,
54
+ switchSession: () => {
55
+ const id = opts.currentConversationId();
56
+ publish(id);
57
+ refresh(id);
58
+ },
59
+ clear: (id) => {
60
+ const state = stateFor(id);
61
+ state.revision += 1;
62
+ state.clearVersion += 1;
63
+ state.items = [];
64
+ publish(id);
65
+ },
66
+ record: (text, id = opts.currentConversationId()) => {
67
+ text = text.trim();
68
+ if (!text) return;
69
+ const state = stateFor(id);
70
+ const clearVersion = state.clearVersion;
71
+ append({
72
+ conversationId: id,
73
+ id: 0,
74
+ text,
75
+ createdAt: Date.now()
76
+ });
77
+ state.writeQueue = state.writeQueue.then(async () => {
78
+ const item = await opts.persist(id, text);
79
+ if (state.clearVersion === clearVersion && item.conversationId === id) append(item);
80
+ }).catch(() => {});
81
+ }
82
+ };
83
+ }
84
+ //#endregion
85
+ export { createTuiComposerHistory };
@@ -29,6 +29,7 @@ export interface TuiEvent {
29
29
  source?: TuiEventSource;
30
30
  }
31
31
  export interface TuiComposerHistoryItem {
32
+ conversationId: string;
32
33
  id: number;
33
34
  text: string;
34
35
  createdAt: number;
@@ -190,11 +191,11 @@ export interface TuiBackend {
190
191
  stop(): void;
191
192
  /** Current active chat abort signal, if a run is in progress. */
192
193
  getActiveSignal?(): AbortSignal | undefined;
193
- /** Global composer history, shared across sessions and clients. */
194
- getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
194
+ /** Composer history for one conversation, shared across its clients. */
195
+ getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
195
196
  getComposerDraftDirectory(): Promise<string>;
196
197
  /** Persist one submitted chat input. */
197
- recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
198
+ recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
198
199
  /** Send a chat message, returns the run id. */
199
200
  sendChat(opts: ChatSendOptions): Promise<{
200
201
  runId: string;
@@ -18,6 +18,7 @@ import { applyThemeById, getBashExcludeBorderColor, getBashModeBorderColor, getC
18
18
  import { editorTheme, theme } from "./theme.js";
19
19
  import { extensionForImageMimeType, readClipboardImage } from "./clipboard-image.js";
20
20
  import { copyTextToClipboard } from "./clipboard-text.js";
21
+ import { createTuiComposerHistory } from "./composer-history.js";
21
22
  import { createXopcTuiKeybindingsManager } from "./tui-keybindings-file.js";
22
23
  import { isActiveRunStreamStale, markActiveRunStalled, markRunRecovering, markRunRecoveryComplete, markRunSending } from "./tui-run-state.js";
23
24
  import { clearSeenStreamEvents, clearSeenStreamEventsForRun, dispatchAgentEvent } from "./tui-agent-events.js";
@@ -1863,45 +1864,25 @@ async function runTui(opts) {
1863
1864
  updateFooter();
1864
1865
  tui.requestRender();
1865
1866
  };
1866
- let composerHistory = [];
1867
- let composerHistoryWriteQueue = Promise.resolve();
1868
- const applyComposerHistory = (next) => {
1869
- composerHistory = next.slice(0, 100);
1870
- composerHistoryTexts = composerHistory.map((item) => item.text);
1871
- if (editor === defaultEditor) {
1872
- defaultEditor.replaceHistory(composerHistory.map((item) => item.text));
1873
- return;
1867
+ const composerHistory = createTuiComposerHistory({
1868
+ currentConversationId: () => state.currentConversationId,
1869
+ load: (id) => client.getComposerInputHistory(id),
1870
+ persist: (id, text) => client.recordComposerInputHistory(id, text),
1871
+ replace: (texts) => {
1872
+ composerHistoryTexts = texts;
1873
+ defaultEditor.replaceHistory(texts);
1874
+ if (editor !== defaultEditor) setEditorComponent(editorComponentFactory);
1875
+ tui.requestRender();
1874
1876
  }
1875
- for (const item of composerHistory.slice().reverse()) editor.addToHistory?.(item.text);
1876
- };
1877
- const refreshComposerHistory = async () => {
1878
- try {
1879
- await composerHistoryWriteQueue;
1880
- applyComposerHistory(await client.getComposerInputHistory());
1881
- } catch {}
1882
- };
1877
+ });
1878
+ const refreshComposerHistory = () => composerHistory.refresh();
1883
1879
  const refreshChatInputState = async (conversationId = state.currentConversationId) => {
1884
1880
  try {
1885
1881
  applyChatInputState(await client.getChatInputState(conversationId));
1886
1882
  } catch {}
1887
1883
  };
1888
- const recordChatHistory = (value) => {
1889
- const text = value.trim();
1890
- if (!text) return;
1891
- editor.addToHistory?.(text);
1892
- if (composerHistory[0]?.text !== text) {
1893
- composerHistory = [{
1894
- id: 0,
1895
- text,
1896
- createdAt: Date.now()
1897
- }, ...composerHistory].slice(0, 100);
1898
- composerHistoryTexts = composerHistory.map((item) => item.text);
1899
- }
1900
- composerHistoryWriteQueue = composerHistoryWriteQueue.then(async () => {
1901
- const item = await client.recordComposerInputHistory(text);
1902
- const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
1903
- if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
1904
- }).catch(() => {});
1884
+ const recordChatHistory = (value, conversationId = state.currentConversationId) => {
1885
+ composerHistory.record(value, conversationId);
1905
1886
  };
1906
1887
  const submitBurst = createSubmitBurstCoalescer({
1907
1888
  submit: createEditorSubmitHandler({
@@ -1939,7 +1920,7 @@ async function runTui(opts) {
1939
1920
  if (!ok) throw new Error("Queued input changed; refreshed latest state");
1940
1921
  editingQueuedInput = void 0;
1941
1922
  if (state.currentConversationId === conversationId && editor.getText().trim() === content) editor.setText("");
1942
- recordChatHistory(content);
1923
+ recordChatHistory(content, conversationId);
1943
1924
  tui.requestRender();
1944
1925
  }).catch((error) => {
1945
1926
  chatLog.addSystem(theme.dim(`Edit failed: ${error instanceof Error ? error.message : String(error)}`));
@@ -1967,7 +1948,7 @@ async function runTui(opts) {
1967
1948
  delivery: "next"
1968
1949
  }).then(({ ok, state: inputState }) => {
1969
1950
  if (!ok) throw new Error("Gateway did not accept the message");
1970
- recordChatHistory(text);
1951
+ recordChatHistory(text, conversationId);
1971
1952
  if (state.currentConversationId === conversationId && editor.getText().trim() === text) editor.setText("");
1972
1953
  if (inputState) applyChatInputState(inputState);
1973
1954
  else refreshChatInputState(conversationId);
@@ -1982,6 +1963,7 @@ async function runTui(opts) {
1982
1963
  };
1983
1964
  const setConversationId = (key) => {
1984
1965
  state.currentConversationId = resolveConversationId(key);
1966
+ composerHistory.switchSession();
1985
1967
  state.chatInputState = createEmptyChatInputState(state.currentConversationId);
1986
1968
  editingQueuedInput = void 0;
1987
1969
  refreshChatInputState(state.currentConversationId);
@@ -2280,20 +2262,11 @@ async function runTui(opts) {
2280
2262
  return;
2281
2263
  }
2282
2264
  if (evt.event === "composer-history.appended") {
2283
- const item = data;
2284
- if (typeof item.text === "string" && typeof item.id === "number") {
2285
- const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
2286
- if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
2287
- else if (composerHistory[0]?.text !== item.text) {
2288
- composerHistory = [item, ...composerHistory].slice(0, 100);
2289
- composerHistoryTexts = composerHistory.map((entry) => entry.text);
2290
- editor.addToHistory?.(item.text);
2291
- } else composerHistory[0] = item;
2292
- }
2265
+ composerHistory.append(data);
2293
2266
  return;
2294
2267
  }
2295
2268
  if (evt.event === "composer-history.cleared") {
2296
- applyComposerHistory([]);
2269
+ if (typeof data.conversationId === "string") composerHistory.clear(data.conversationId);
2297
2270
  return;
2298
2271
  }
2299
2272
  if (evt.event === "workflow.run.updated" && handleWorkflowRunUpdated(data)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.395",
3
+ "version": "0.0.397",
4
4
  "description": "Local-first personal AI with Ada, task delegation, files, projects, workflows, and automations. Use cloud or local models.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -168,12 +168,12 @@
168
168
  "vitest": "4.1.5",
169
169
  "vue": "^3.5.35",
170
170
  "xlsx": "file:web/vendor/xlsx-0.20.3.tgz",
171
- "@xopcai/computer-control-contract": "0.1.0",
172
171
  "@xopcai/browser-control-contract": "0.1.0",
172
+ "@xopcai/computer-control-contract": "0.1.0",
173
173
  "@xopcai/endpoint-tools-client": "0.0.0",
174
- "@xopcai/gateway-contract": "0.0.0",
175
174
  "@xopcai/endpoint-tools-protocol": "0.0.0",
176
175
  "@xopcai/image-providers": "0.1.0",
176
+ "@xopcai/gateway-contract": "0.0.0",
177
177
  "@xopcai/realtime-client": "0.0.0",
178
178
  "@xopcai/realtime-protocol": "0.0.0"
179
179
  },
@@ -222,6 +222,11 @@
222
222
  "test:extensions": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=extensions",
223
223
  "test:web": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=web",
224
224
  "test:packages": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=packages",
225
+ "test:plugins:e2e": "pnpm run build:node && pnpm run build:web && pnpm run test:plugins:store:e2e && pnpm run test:plugins:app:e2e && pnpm run test:plugins:authorization:e2e && pnpm run test:plugins:browser",
226
+ "test:plugins:app:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-app-e2e.mts",
227
+ "test:plugins:store:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-store-plugin-e2e.mts",
228
+ "test:plugins:fixtures": "tsx scripts/build-store-plugin-lab.mts",
229
+ "test:plugins:browser": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-setup-browser.mts",
225
230
  "test:web:onboarding-visual": "node scripts/test-onboarding-visual.mjs",
226
231
  "test:web:onboarding-visual:update": "node scripts/test-onboarding-visual.mjs --update",
227
232
  "test:quick-understanding": "XOPC_LOG_LEVEL=fatal vitest run src/work-discovery/__tests__/evaluation.test.ts src/user-context/sources/__tests__/activity-clustering.test.ts src/knowledge/__tests__/quick-understanding.e2e.test.ts src/connectors/__tests__/content-enrichment.test.ts src/connectors/__tests__/connected-source-ingestion.test.ts",
@@ -285,6 +290,9 @@
285
290
  "eval:benchmark": "tsx evals/coder/apps/cli/src/benchmark.ts",
286
291
  "eval:benchmark:check": "pnpm -C evals/coder run typecheck && pnpm -C evals/coder exec vitest run --configLoader native tests/benchmark-v1.test.ts tests/xopc-adapter.test.ts tests/suite-loader.test.ts",
287
292
  "eval:benchmark:live": "node --import tsx evals/coder/scripts/run-benchmark-live.mjs",
288
- "eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts"
293
+ "eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts",
294
+ "test:plugins:authorization:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-authorization-e2e.mts",
295
+ "test:plugins:production:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-catalog.mts && cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-browser.mts",
296
+ "test:plugins:dingtalk:live": "tsx scripts/verify-dingtalk-live-e2e.mts"
289
297
  }
290
298
  }
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as ee}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./messages-DPxcWxfD.js";import{t as s}from"./cn-0WouolD0.js";import{a as c,n as te,r as l}from"./locale-store-Djl2FW6_.js";import{a as ne,i as u,o as d,r as f,s as re,t as p}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{$a as m,El as h,Pd as g,Wc as _,Wu as v,Xl as y,lf as b}from"./index-BNRLzxpH.js";var x=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function T(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function E(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function D(e,t,n){let r=await c(l(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function O(e){let t=(0,x.c)(49),{pluginId:n,server:r,enabled:ee}=e,i=te(ae),a;t[0]===i?a=t[1]:(a=i.startsWith(`zh`),t[0]=i,t[1]=a);let o=a,[s,c]=(0,S.useState)(``),[l,ne]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,re]=(0,S.useState)(r.type===`stdio`?`API_KEY`:`Authorization`),[p,ie]=(0,S.useState)(r.type===`stdio`?``:`Bearer `),m;t[2]!==r.name||t[3]!==r.type?(m=(0,C.jsxs)(`p`,{className:`font-medium`,children:[r.name,` · `,r.type]}),t[2]=r.name,t[3]=r.type,t[4]=m):m=t[4];let h=r.type===`stdio`?`xopc mcp list`:`xopc mcp login ${r.id}`,g;t[5]===h?g=t[6]:(g=(0,C.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:h}),t[5]=h,t[6]=g);let v;t[7]!==f||t[8]!==n||t[9]!==p||t[10]!==s||t[11]!==r.name||t[12]!==r.type||t[13]!==o?(v=e=>{e.preventDefault(),ne(!0),d(``),D(`/api/extensions/agent-plugins/${encodeURIComponent(n)}/mcp/${encodeURIComponent(r.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:r.type===`stdio`?`env`:`headers`,key:f,value:s,prefix:p}]}).then(()=>{c(``),d(o?`已保存`:`Saved`)}).catch(e=>d(String(e))).finally(()=>ne(!1))},t[7]=f,t[8]=n,t[9]=p,t[10]=s,t[11]=r.name,t[12]=r.type,t[13]=o,t[14]=v):v=t[14];let y=o?`字段名`:`Field name`,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>re(e.target.value),t[15]=b):b=t[15];let T;t[16]===f?T=t[17]:(T=(0,C.jsx)(`input`,{className:w,value:f,onChange:b,required:!0}),t[16]=f,t[17]=T);let E;t[18]!==y||t[19]!==T?(E=(0,C.jsxs)(`label`,{className:`block`,children:[y,T]}),t[18]=y,t[19]=T,t[20]=E):E=t[20];let O=o?`前缀`:`Prefix`,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>ie(e.target.value),t[21]=k):k=t[21];let A;t[22]===p?A=t[23]:(A=(0,C.jsx)(`input`,{className:w,value:p,onChange:k}),t[22]=p,t[23]=A);let j;t[24]!==O||t[25]!==A?(j=(0,C.jsxs)(`label`,{className:`block`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M=o?`密钥`:`Secret`,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>c(e.target.value),t[27]=N):N=t[27];let P;t[28]===s?P=t[29]:(P=(0,C.jsx)(`input`,{type:`password`,autoComplete:`off`,className:w,value:s,onChange:N,required:!0}),t[28]=s,t[29]=P);let F;t[30]!==M||t[31]!==P?(F=(0,C.jsxs)(`label`,{className:`block`,children:[M,P]}),t[30]=M,t[31]=P,t[32]=F):F=t[32];let I=!ee||l||!s,L=o?`保存密钥`:`Save API key`,R;t[33]!==I||t[34]!==L?(R=(0,C.jsx)(_,{type:`submit`,disabled:I,children:L}),t[33]=I,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==E||t[37]!==j||t[38]!==F||t[39]!==R||t[40]!==v?(z=(0,C.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:v,children:[E,j,F,R]}),t[36]=E,t[37]=j,t[38]=F,t[39]=R,t[40]=v,t[41]=z):z=t[41];let B;t[42]===u?B=t[43]:(B=u?(0,C.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:u}):null,t[42]=u,t[43]=B);let V;return t[44]!==z||t[45]!==B||t[46]!==m||t[47]!==g?(V=(0,C.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[m,g,z,B]}),t[44]=z,t[45]=B,t[46]=m,t[47]=g,t[48]=V):V=t[48],V}function ae(e){return e.language}function k({extension:e,onClose:t,initialSource:n=``,marketplace:r,autoInstall:c=!1}){let l=te(e=>e.language),x=l.startsWith(`zh`),ae=r?.localizations?.[x?`zh-CN`:`en`],k=ae?.displayName??r?.name,A=ae?.description??r?.description,j=(0,S.useId)(),{mutate:M}=ie(),[N,P]=(0,S.useState)(e),[F,I]=(0,S.useState)(n),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(``),[oe,se]=(0,S.useState)(!1),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(!1),[fe,U]=(0,S.useState)(!1),[pe,W]=(0,S.useState)(!1),[G,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(!1),_e=(0,S.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(N?.pluginId??``)}`,q=F.trim().startsWith(`store:`),J=()=>M(`gateway-extensions-list`);async function Y(e){B(!0),H(``);try{await e()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}function X(e){I(e),R(null),H(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function ve(){if(!Z?.openDirectory){W(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){W(!0);return}let e=await Z.openFile({...Q?{defaultPath:Q}:{},extensions:[`zip`]});e&&X(e)}function be(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!be(e))return;e.preventDefault(),U(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){H(x?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):H(x?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&X(n.trim().split(/\r?\n/)[0])}async function Se(e){P(await D(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!N,n=await D(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:F,reviewHash:e.reviewHash});P(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await D(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),P(n),await J()),R(null),ge(t&&n.activationEligible===!0)}async function we(){let e=await D(`/api/extensions/inspect`,`POST`,{source:F});if(E(e,r)){R(e);return}await Ce(e)}(0,S.useEffect)(()=>{e&&P(e)},[e]),(0,S.useEffect)(()=>{!c||N||!q||_e.current||(_e.current=!0,Y(we))},[c,N,q]);let Te=c&&!N&&q&&!_e.current,$=N?.components;return(0,C.jsx)(p,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,C.jsxs)(d,{children:[(0,C.jsx)(ne,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,C.jsxs)(f,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,C.jsx)(re,{className:`font-semibold`,children:N?.name??k??(x?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,C.jsx)(_,{variant:`ghost`,onClick:t,children:x?`关闭`:`Close`})]}),(0,C.jsx)(u,{className:`sr-only`,children:x?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,C.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!N&&q?(0,C.jsxs)(`section`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:k??L?.manifest.name??F.slice(6)}),A?(0,C.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:A}):null,(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r?.publisher?.verification===`verified`?x?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:x?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),L?null:(0,C.jsxs)(_,{className:`w-full`,disabled:z||Te,onClick:()=>void Y(we),children:[z||Te?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,z||Te?x?`正在安全检查并安装…`:`Checking and installing…`:x?`一键安装`:`Install`]})]}):null,N?(0,C.jsxs)(C.Fragment,{children:[he?(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,C.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:x?`插件已安装并启用`:`Plugin installed and enabled`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,N.activationEligible?null:(0,C.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-accent-fg`,children:x?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,C.jsx)(_,{disabled:z||N.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:x?`启用插件`:`Enable plugin`})]}),(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,N.version,` · `,N.readiness&&{ready:x?`已就绪`:`Ready`,setup_required:x?`待连接`:`Setup required`,degraded:x?`部分不可用`:`Partially available`,blocked:x?`已阻止`:`Blocked`}[N.readiness]]}),N.provenance?(0,C.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[N.provenance.publisherVerification===`verified`?x?`已认证发布者`:`Verified publisher`:x?`社区发布者`:`Community publisher`,` · `,N.provenance.packageName,`@`,N.provenance.version,` · SHA-256 `,N.provenance.sha256.slice(0,12),`…`,N.provenance.riskTier?` · ${N.provenance.riskTier}`:``]}):null,(0,C.jsx)(`p`,{className:`text-sm`,children:N.description}),N.activationEligible?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:x?`停用`:`Disable`}):null,N.canRollback?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(async()=>{P(await D(`${K}/rollback`,`POST`)),await J()}),children:x?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,C.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:x?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/skills?source=plugin`,children:x?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/connectors?tab=connected`,children:x?`管理连接`:`Manage connections`})}):null]})]}):null,N.components?.mcp.length?(0,C.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,C.jsx)(`span`,{children:x?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,C.jsx)(b,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:x?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,C.jsx)(`div`,{className:`mt-3 space-y-3`,children:N.components.mcp.map(e=>(0,C.jsx)(O,{pluginId:N.pluginId,server:e,enabled:N.active},e.id))})]}):null,N.diagnostics?.map((e,t)=>(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&N?(0,C.jsxs)(_,{variant:`ghost`,className:`px-0`,"aria-expanded":G,onClick:()=>me(e=>!e),children:[(0,C.jsx)(b,{className:s(`size-4 transition-transform motion-reduce:transition-none`,G&&`rotate-180`),"aria-hidden":!0}),x?`高级操作`:`Advanced actions`]}):null,!q||G?(0,C.jsxs)(`form`,{className:s(`space-y-3`,N&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{R(await D(`/api/extensions/inspect`,`POST`,{source:F}))})},children:[(0,C.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:s(`rounded-xl border border-dashed p-3 transition-colors`,fe?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),U(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||U(!1)},onDrop:xe,children:[(0,C.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,C.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:j,className:`block text-sm font-medium`,children:N?x?`更新包来源`:`Update package source`:x?`安装包来源`:`Package source`}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:x?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,C.jsx)(`input`,{id:j,className:w,value:F,onChange:e=>X(e.target.value),placeholder:x?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ve),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择目录`:`Choose directory`]}),(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ye),children:[(0,C.jsx)(g,{className:`size-4`,"aria-hidden":!0}),x?`选择 ZIP`:`Choose ZIP`]})]}):(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>W(!0),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择文件或目录`:`Choose file or folder`]})})]}),(0,C.jsx)(_,{type:`submit`,variant:`secondary`,disabled:z||!F,children:x?`检查安装包`:`Inspect package`})]}):null,L?(0,C.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:x?`需要你的授权`:`Your authorization is required`}),(0,C.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:x?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,C.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:L.addedCapabilities.map(e=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,C.jsx)(`span`,{children:T(e,x)})]},e))}),L.diagnostics.map((e,t)=>(0,C.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsxs)(_,{disabled:z||!!N&&L.manifest.name!==N.pluginId,onClick:()=>void Y(()=>Ce(L)),children:[z?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x?`授权并安装`:`Authorize and install`]}),(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>R(null),children:x?`取消`:`Cancel`})]})]}):null,N&&(!q||G)?(0,C.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ue?(0,C.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,C.jsx)(`p`,{children:x?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:oe,onChange:e=>se(e.target.checked)}),x?`同时删除插件数据`:`Also delete plugin data`]}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.target.checked)}),x?`同时删除本地凭据`:`Also delete local credentials`]}),(0,C.jsx)(_,{disabled:z,onClick:()=>void Y(async()=>{await D(K,`DELETE`,{removeData:oe,removeCredentials:ce}),await J(),t()}),children:x?`确认卸载`:`Confirm uninstall`})]}):(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>de(!0),children:x?`卸载插件`:`Uninstall`})}):null,V?(0,C.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:V}):null]})]}),Z?null:(0,C.jsx)(m,{open:pe,onOpenChange:W,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:o(l).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:x?`选择插件安装包`:`Choose plugin package`,description:x?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:x?`使用此来源`:`Use this source`,nested:!0})]})})}export{O as n,k as t};
@@ -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{g as i,t as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./ellipsis-0k4rZLoy.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./markdown-view-DyO7Q0Ms.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-DPxcWxfD.js";import{t as p}from"./cn-0WouolD0.js";import{c as m,i as h,n as g,r as _}from"./locale-store-Djl2FW6_.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{a as w,i as T}from"./vendor-swr-BIWyz7Rc.js";import{o as E}from"./gateway-realtime-2-o7qk92.js";import{Al as D,Bo as O,Ef as k,Eu as A,Go as j,Ho as M,Ic as N,Ql as P,Rc as F,Vo as I,Wc as L,Wu as ee,Xl as te,af as R,ar as z,er as B,hf as V,is as H,jo as ne,kl as re,no as U,nr as W,rr as G,tr as K,zo as q}from"./index-BNRLzxpH.js";import{n as J,t as Y}from"./capability-header-actions-CMJXWq8a.js";import{t as ie}from"./agent-plugin-dialog-CKK95Jmr.js";import{t as X}from"./capability-icon-DVoZxEgW.js";var Z=e(t(),1),ae=n();function Q(e){return e===`builtin`||e===`user`?e:`marketplace`}async function oe(e=``){let t=await h(_(`/api/marketplace${e.trim()?`?q=${encodeURIComponent(e.trim())}`:``}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!Array.isArray(n.extensions))throw Error(n.error??`Invalid response`);return n.extensions}async function se(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function ce(e){let t=await h(_(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function le(e){let t=await h(_(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function ue(e){let t=await h(_(`/api/extensions/${encodeURIComponent(e.extensionId.trim())}/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e.enabled})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function de(e){let t=await h(_(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await se(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var $=r();function fe(e,t){let n=e.find(e=>e.id===t||e.pluginId===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var pe={debounced:``,detailPkg:null,quickInstallPkg:null,rowBusy:null,actionError:null,restartHint:null};function me({className:e,query:t}){let n=g(e=>e.language),r=f(n).extensionsPage,i=m(e=>!!e.conversationId),a=q(),{mutate:o}=w(),[s,c]=(0,Z.useReducer)(U,pe),{debounced:l,detailPkg:u,quickInstallPkg:d,rowBusy:h,actionError:_,restartHint:v}=s,y=i?`marketplace-${l}`:null;(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>c({type:`patch`,patch:{debounced:t.trim()}}),300);return()=>window.clearTimeout(e)},[t]);let{data:b,isLoading:x,error:S}=T(y,()=>oe(l),{revalidateOnFocus:!1}),C=(0,Z.useCallback)(()=>{o(`gateway-extensions-list`),E()},[o]),O=(0,Z.useCallback)(async(e,t)=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await le({name:e,overwrite:t});C(),n.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceInstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceInstallFailed,r.marketplaceRestartHint,C]),k=(0,Z.useCallback)(async e=>{c({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let t=await de(e);C(),t.requiresGatewayRestart&&c({type:`patch`,patch:{restartHint:r.marketplaceRestartHint}})}catch(e){throw c({type:`patch`,patch:{actionError:e instanceof Error?e.message:r.marketplaceUninstallFailed}}),e}finally{c({type:`patch`,patch:{rowBusy:null}})}},[r.marketplaceRestartHint,r.marketplaceUninstallFailed,C]),j=b??[];return(0,$.jsxs)(`div`,{className:p(`flex flex-col gap-4`,e),children:[S?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S instanceof Error?S.message:r.marketplaceLoadFailed}):null,_?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:_}):null,v?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v}):null,x&&!b?(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":r.marketplaceLoading,children:[0,1,2].map(e=>(0,$.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,$.jsx)(F,{className:`h-5 w-40`}),(0,$.jsx)(F,{className:`h-4 w-full max-w-xl`}),(0,$.jsx)(F,{className:`h-4 w-2/3 max-w-md`})]}),(0,$.jsx)(F,{className:`h-8 w-20`})]})},e))}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,$.jsx)(`li`,{className:`text-sm text-fg-muted`,children:r.marketplaceEmpty}):j.map(e=>{let t=fe(a,e.id),i=h===e.id,o=e.localizations?.[n.startsWith(`zh`)?`zh-CN`:`en`],s=o?.displayName??e.name,l=o?.description??e.description;return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${s}, ${r.marketplaceDetailTitle}`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),c({type:`patch`,patch:{detailPkg:e.id}}))},className:p(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,$.jsx)(X,{iconUrl:e.branding?.iconUrl,fallback:A}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`truncate font-semibold text-fg`,children:s}),s===e.id?null:(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-fg-subtle`,children:e.id})]}),e.verified?(0,$.jsx)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),l?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:l}):null,(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,$.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,$.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,$.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:t===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:r.marketplaceBuiltin}):t===`user`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:r.marketplaceInstalled}),e.packageType===`plugin`?(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:{detailPkg:e.id,quickInstallPkg:null}}),className:p(`inline-flex items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:n.startsWith(`zh`)?`管理`:`Manage`}):(0,$.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&k(e.id).catch(()=>{})},className:p(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,$.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(D,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),r.marketplaceUninstall]})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>c({type:`patch`,patch:e.packageType===`plugin`?{detailPkg:e.id,quickInstallPkg:e.id}:{detailPkg:e.id,quickInstallPkg:null}}),className:p(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:e.packageType===`plugin`?n.startsWith(`zh`)?`安装`:`Install`:r.marketplaceReview})})]})},e.id)})}),u?(0,$.jsx)(he,{packageName:u,autoInstall:d===u,copy:r,extensions:a,onClose:()=>c({type:`patch`,patch:{detailPkg:null,quickInstallPkg:null}}),onInstall:O,onUninstall:k}):null]})}function he(e){let t=(0,ae.c)(96),{packageName:n,autoInstall:r,copy:i,extensions:o,onClose:s,onInstall:c,onUninstall:u}=e,[f,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),y=m(be)?`ext-mp-detail-${n}`:null,w;t[0]===n?w=t[1]:(w=async()=>ce(n),t[0]=n,t[1]=w);let E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},t[2]=E):E=t[2];let{data:O,error:A,isLoading:j}=T(y,w,E),M;t[3]!==o||t[4]!==n?(M=fe(o,n),t[3]=o,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,I=O?.manifest?.permissions,L,R,z,B,V,H,ne,U,W,G,K,q;if(t[6]!==r||t[7]!==i||t[8]!==O||t[9]!==A||t[10]!==o||t[11]!==N||t[12]!==j||t[13]!==s||t[14]!==n||t[15]!==I||t[16]!==g){H=Symbol.for(`react.early_return_sentinel`);bb0:{let e=I&&typeof I==`object`&&!Array.isArray(I)?Object.entries(I):[],a;t[29]!==i||t[30]!==O?(a=O?.readme?.trim()||(O?.description?.trim()?`### ${O.name}\n\n${O.description}`:`*${i.marketplaceNoReadme}*`),t[29]=i,t[30]=O,t[31]=a):a=t[31];let c=a;if(O?.format===`agent-plugin`){let e;if(t[32]!==O||t[33]!==o){let n;t[35]===O?n=t[36]:(n=e=>e.pluginId===O.manifest?.name,t[35]=O,t[36]=n),e=o.find(n),t[32]=O,t[33]=o,t[34]=e}else e=t[34];let i=`store:${n}`,a;t[37]!==r||t[38]!==O||t[39]!==s||t[40]!==e||t[41]!==i?(a=(0,$.jsx)(ie,{extension:e,initialSource:i,marketplace:O,autoInstall:r,onClose:s}),t[37]=r,t[38]=O,t[39]=s,t[40]=e,t[41]=i,t[42]=a):a=t[42],H=a;break bb0}z=C,B=!0,t[43]===s?V=t[44]:(V=e=>!e&&s(),t[43]=s,t[44]=V),R=b,t[45]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[45]=q):q=t[45],L=x,W=`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,G=ye;let u;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(k,{className:`size-5`}),t[46]=u):u=t[46];let f;t[47]!==i.detailBack||t[48]!==s?(f=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailBack,children:u}),t[47]=i.detailBack,t[48]=s,t[49]=f):f=t[49];let p;t[50]===i.marketplaceDetailTitle?p=t[51]:(p=(0,$.jsx)(S,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:i.marketplaceDetailTitle}),t[50]=i.marketplaceDetailTitle,t[51]=p);let m;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(d,{className:`size-5`}),t[52]=m):m=t[52];let h;t[53]!==i.detailClose||t[54]!==s?(h=(0,$.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i.detailClose,children:m}),t[53]=i.detailClose,t[54]=s,t[55]=h):h=t[55],t[56]!==f||t[57]!==p||t[58]!==h?(K=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[f,p,h]}),t[56]=f,t[57]=p,t[58]=h,t[59]=K):K=t[59],ne=`min-h-0 flex-1 overflow-y-auto p-5`,U=j&&!O?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":i.marketplaceLoading,children:[(0,$.jsx)(F,{className:`h-6 w-48`}),(0,$.jsx)(F,{className:`h-4 w-28`}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(F,{className:`h-12`}),(0,$.jsx)(F,{className:`h-12`})]}),(0,$.jsx)(F,{className:`h-28 w-full`}),(0,$.jsx)(F,{className:`h-36 w-full`})]}):A?(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,$.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:i.marketplaceDetailLoadFailed}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:i.marketplaceLoadFailed})]}):O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:O.name}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:O.id})}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceAuthor}),(0,$.jsx)(`dd`,{children:O.author.username})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceVersion}),(0,$.jsx)(`dd`,{children:O.latestVersion.version})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDownloads}),(0,$.jsx)(`dd`,{children:O.downloads})]})]}),N===`bundled`?null:(0,$.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[O.installability.available?(0,$.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:O.installability.available?i.marketplaceRiskTitle:i.marketplaceUnavailableTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:O.installability.available?i.marketplaceCodeRisk:O.installability.reason??i.marketplaceUnavailableBody})]})]}),O.installability.available?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceIntegrity}),(0,$.jsx)(`dd`,{children:i.marketplaceIntegrityVerified})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`font-medium text-fg`,children:i.marketplaceDependencies}),(0,$.jsx)(`dd`,{children:O.packageSummary?.dependencyCount??0})]})]}),(0,$.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.marketplacePermissions}),e.length>0?(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ve)}):(0,$.jsx)(`p`,{className:`mt-1`,children:i.marketplacePermissionsNone})]}),(O.packageSummary?.lifecycleScripts.length??0)>0?(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[i.marketplaceLifecycleScripts,`: `,O.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,$.jsx)(`span`,{children:i.marketplaceRiskConfirm})]})]}):null]}),O.readme?.trim()?(0,$.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:i.marketplaceDetailReadmeHeading}):null,(0,$.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,$.jsx)(l,{content:c})})]}):null}t[6]=r,t[7]=i,t[8]=O,t[9]=A,t[10]=o,t[11]=N,t[12]=j,t[13]=s,t[14]=n,t[15]=I,t[16]=g,t[17]=L,t[18]=R,t[19]=z,t[20]=B,t[21]=V,t[22]=H,t[23]=ne,t[24]=U,t[25]=W,t[26]=G,t[27]=K,t[28]=q}else L=t[17],R=t[18],z=t[19],B=t[20],V=t[21],H=t[22],ne=t[23],U=t[24],W=t[25],G=t[26],K=t[27],q=t[28];if(H!==Symbol.for(`react.early_return_sentinel`))return H;let J;t[60]!==ne||t[61]!==U?(J=(0,$.jsx)(`div`,{className:ne,children:U}),t[60]=ne,t[61]=U,t[62]=J):J=t[62];let Y;t[63]!==f||t[64]!==i.marketplaceBuiltinGoBuiltin||t[65]!==i.marketplaceBuiltinManageHint||t[66]!==i.marketplaceInstall||t[67]!==i.marketplaceReinstall||t[68]!==i.marketplaceReinstallConfirm||t[69]!==i.marketplaceUninstall||t[70]!==i.marketplaceUninstallConfirm||t[71]!==O||t[72]!==N||t[73]!==s||t[74]!==c||t[75]!==u||t[76]!==n||t[77]!==g||t[78]!==P?(Y=O?(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i.marketplaceBuiltinManageHint}),(0,$.jsx)(a,{to:`/capabilities/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:i.marketplaceBuiltinGoBuiltin})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,disabled:f||!O.installability.available||!g,onClick:()=>{P&&!window.confirm(i.marketplaceReinstallConfirm)||(h(!0),c(n,P).catch(_e).finally(()=>h(!1)))},className:p(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-on-accent shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[f?(0,$.jsx)(ee,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?i.marketplaceReinstall:i.marketplaceInstall]}),P?(0,$.jsxs)(`button`,{type:`button`,disabled:f,onClick:()=>{window.confirm(i.marketplaceUninstallConfirm)&&(h(!0),u(n).then(()=>s()).catch(ge).finally(()=>h(!1)))},className:p(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,$.jsx)(D,{className:`size-4 shrink-0`,"aria-hidden":!0}),i.marketplaceUninstall]}):null]})}):null,t[63]=f,t[64]=i.marketplaceBuiltinGoBuiltin,t[65]=i.marketplaceBuiltinManageHint,t[66]=i.marketplaceInstall,t[67]=i.marketplaceReinstall,t[68]=i.marketplaceReinstallConfirm,t[69]=i.marketplaceUninstall,t[70]=i.marketplaceUninstallConfirm,t[71]=O,t[72]=N,t[73]=s,t[74]=c,t[75]=u,t[76]=n,t[77]=g,t[78]=P,t[79]=Y):Y=t[79];let X;t[80]!==L||t[81]!==J||t[82]!==Y||t[83]!==W||t[84]!==G||t[85]!==K?(X=(0,$.jsxs)(L,{className:W,onOpenAutoFocus:G,children:[K,J,Y]}),t[80]=L,t[81]=J,t[82]=Y,t[83]=W,t[84]=G,t[85]=K,t[86]=X):X=t[86];let Q;t[87]!==R||t[88]!==X||t[89]!==q?(Q=(0,$.jsxs)(R,{children:[q,X]}),t[87]=R,t[88]=X,t[89]=q,t[90]=Q):Q=t[90];let oe;return t[91]!==z||t[92]!==B||t[93]!==V||t[94]!==Q?(oe=(0,$.jsx)(z,{defaultOpen:B,onOpenChange:V,children:Q}),t[91]=z,t[92]=B,t[93]=V,t[94]=Q,t[95]=oe):oe=t[95],oe}function ge(){}function _e(){}function ve(e){let[t,n]=e;return(0,$.jsxs)(`li`,{className:`break-words`,children:[(0,$.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function ye(e){return e.preventDefault()}function be(e){return!!e.conversationId}function xe({embedded:e=!1,onHeaderActionChange:t}){let n=g(e=>e.language),r=f(n),o=j(e=>e.setPageHeader),c=j(e=>e.clearPageHeader),l=q(),d=O(),[m,h]=i(),_=Q(m.get(`tab`)),v=m.get(`q`)??``,[y,b]=(0,Z.useState)(_),[x,S]=(0,Z.useState)(v),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),D=m.toString(),k=(0,Z.useRef)(D);if(k.current!==D){k.current=D;let e=Q(m.get(`tab`)),t=m.get(`q`)??``;b(t=>t===e?t:e),S(e=>e===t?e:t)}(0,Z.useEffect)(()=>{h(e=>{let t=new URLSearchParams(e),n=x.trim();return n?t.set(`q`,n):t.delete(`q`),y===`marketplace`?t.delete(`tab`):t.set(`tab`,y),t.toString()===e.toString()?e:t},{replace:!0})},[y,x,h]);let A=(0,Z.useMemo)(()=>l.filter(e=>e.source===`bundled`),[l]),M=(0,Z.useMemo)(()=>l.filter(e=>e.source!==`bundled`),[l]),P=y===`builtin`?A:M,F=(0,Z.useMemo)(()=>{let e=x.trim().toLowerCase(),t=P;return e&&(t=t.filter(t=>(t.name??``).toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e))),t.toSorted((e,t)=>e.hasUi===t.hasUi?(e.name||e.id).localeCompare(t.name||t.id,n):e.hasUi?-1:1)},[P,x,n]);(0,Z.useEffect)(()=>{w(e=>{if(!e)return e;let t=l.find(t=>t.id===e.id);return t?Se(e)===Se(t)&&e.active===t.active&&JSON.stringify(e)===JSON.stringify(t)?e:t:null})},[l]);let I=(0,Z.useMemo)(()=>({searchLabel:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder,search:(0,$.jsx)(J,{value:x,onChange:S,placeholder:y===`marketplace`?r.extensionsPage.marketplaceSearchPlaceholder:r.extensionsPage.searchPlaceholder}),overflow:(0,$.jsxs)(G,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(L,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":r.capabilitiesHub.moreActions,title:r.capabilitiesHub.moreActions,children:(0,$.jsx)(s,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(W,{children:(0,$.jsxs)(B,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(K,{className:p(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,N.transition),onSelect:()=>E(!0),children:[(0,$.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),n.startsWith(`zh`)?`安装插件`:`Install plugin`]}),(0,$.jsx)(K,{asChild:!0,children:(0,$.jsxs)(a,{to:`/local-apps`,className:p(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,N.transition),children:[(0,$.jsx)(V,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r.extensionsPage.openLocalApps]})})]})})]}),primary:(0,$.jsx)(L,{asChild:!0,variant:`primary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(a,{to:`/local-apps/new`,"aria-label":r.extensionsPage.createLocalApp,children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r.extensionsPage.createLocalApp})]})})}),[n,r.capabilitiesHub.moreActions,r.extensionsPage,y,x]);(0,Z.useLayoutEffect)(()=>e?(t?.(I),()=>t?.(null)):(o({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.extensionsPage.title})}),end:(0,$.jsx)(Y,{contribution:I})}),()=>c()),[c,e,I,r.extensionsPage.title,t,o]);let ee=[{id:`marketplace`,label:r.extensionsPage.tabMarketplace},{id:`builtin`,label:r.extensionsPage.tabBuiltin,count:d?void 0:A.length},{id:`user`,label:r.extensionsPage.tabUser,count:d?void 0:M.length}];return(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:p(`mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8`,`pb-7 pt-3 lg:pb-9 lg:pt-4`),children:[(0,$.jsx)(`div`,{className:`mb-6 border-b border-edge-subtle pb-3`,children:(0,$.jsx)(H,{items:ee,activeTab:y,onChange:b,ariaLabel:r.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`})}),y===`marketplace`?(0,$.jsx)(me,{query:x}):d?(0,$.jsx)(ke,{}):y===`builtin`&&A.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyBuiltin}):y===`user`&&M.length===0?(0,$.jsx)(je,{message:r.extensionsPage.emptyUser}):F.length===0?(0,$.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.extensionsPage.noSearchResults}):(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:F.map(e=>(0,$.jsx)(Ee,{extension:e,copy:r.extensionsPage,showSourceBadge:y===`user`,onOpen:()=>w(e)},e.id))})]}),C?C.format===`agent-plugin`?(0,$.jsx)(ie,{extension:C,onClose:()=>w(null)},C.id):(0,$.jsx)(De,{extension:C,copy:r.extensionsPage,onClose:()=>w(null)},C.id):null,T?(0,$.jsx)(ie,{onClose:()=>E(!1)}):null]})}function Se(e){return e.activationEligible??e.active}function Ce(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function we(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function Te(e,t){let n=Se(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function Ee(e){let t=(0,ae.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=Se(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=p(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let f=n.name||n.id,m;t[3]===f?m=t[4]:(m=f.charAt(0).toUpperCase(),t[3]=f,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,$.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,$.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,$.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.format===`agent-plugin`?`Agent Plugin`:n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,$.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,$.jsx)(`span`,{title:Ce(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:we(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function De({extension:e,copy:t,onClose:n}){let{mutate:r}=w(),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(null),[u,f]=(0,Z.useState)(!1),m=e.activationEligible===!0,h=(0,Z.useCallback)(async()=>{l(null),f(!1),o(`toggle`);try{let{requiresGatewayRestart:t}=await ue({extensionId:e.id,enabled:!m});await r(`gateway-extensions-list`),E(),f(t)}catch(e){l(e instanceof Error?e.message:t.extensionToggleFailed)}finally{o(null)}},[m,t.extensionToggleFailed,e.id,r]),g=(0,Z.useCallback)(async()=>{if(!(e.source===`bundled`||!window.confirm(t.extensionUninstallConfirm))){l(null),f(!1),o(`uninstall`);try{await de(e.id),await r(`gateway-extensions-list`),E(),n()}catch(e){l(e instanceof Error?e.message:t.marketplaceUninstallFailed),o(null)}}},[t.extensionUninstallConfirm,t.marketplaceUninstallFailed,e.id,e.source,r,n]),_=e.ui?.contributions?.pages??[],T=e.ui?.contributions?.settingsPanels??[],O=e.ui?.contributions?.chatWidgets??[],A=_.find(e=>e.showInNav)??_[0],j=T[0],N=A?ne(e.id,A):null,F=j?`/settings/ext/${e.id}/${j.id}`:e.hasConfigSchema||I(e)?`/settings/ext/${e.id}`:null;return(0,$.jsx)(C,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,$.jsxs)(b,{children:[(0,$.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,$.jsxs)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,$.jsx)(k,{className:`size-5`})}),(0,$.jsx)(S,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,$.jsxs)(y,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,$.jsx)(d,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Ce(e,t)]}),e.version?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,$.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Te(e,t)}),e.source===`bundled`?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}):null,(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,$.jsx)(L,{type:`button`,variant:`secondary`,disabled:i!==null,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:i===`toggle`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ee,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):m?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null,e.source===`bundled`?null:(0,$.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,$.jsxs)(L,{type:`button`,variant:`ghost`,disabled:i!==null,onClick:()=>void g(),className:`text-danger hover:bg-danger-soft hover:text-danger`,children:[i===`uninstall`?(0,$.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceUninstall]})})]}),e.hasUi&&(_.length>0||T.length>0||O.length>0)?(0,$.jsxs)(`section`,{className:`mt-8`,children:[(0,$.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,$.jsx)(Oe,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,$.jsx)(Oe,{template:t.badgeSettings,count:T.length,hidden:T.length===0}),(0,$.jsx)(Oe,{template:t.badgeWidgets,count:O.length,hidden:O.length===0})]})]}):null,M(e)&&(N||F)?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[N?(0,$.jsxs)(a,{to:N,onClick:n,className:p(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(c,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,F?(0,$.jsxs)(a,{to:F,onClick:n,className:p(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(P,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,$.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function Oe(e){let t=(0,ae.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ke(){let e=(0,ae.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,children:Array.from({length:6},Ae)}),e[0]=t):t=e[0],t}function Ae(e,t){return(0,$.jsx)(F,{className:`h-36 rounded-xl`},t)}function je(e){let t=(0,ae.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{xe as ExtensionsPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-CxaA3P5E.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BNRLzxpH.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Djl2FW6_.js","assets/messages-DPxcWxfD.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DyO7Q0Ms.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-DfVviLTK.js","assets/gateway-realtime-2-o7qk92.js","assets/gateway-realtime-store-DQ6-whg-.js","assets/local-session-drafts-BjwlkAKA.js","assets/session-api-DbNNQps9.js","assets/gateway-startup-retry-BCUswcVy.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BwR2CiR5.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-BjGOUrAf.js","assets/gateway-config-swr-Di9g6pE8.js","assets/capabilities-CTfLd_UE.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/sliding-indicator-hwz0sx3h.js","assets/index-zIgp-ZTu.css","assets/capability-header-actions-CMJXWq8a.js","assets/capability-icon-DVoZxEgW.js","assets/skill-api-CFdrz6tl.js","assets/skill-reload-api-Cy5jVfms.js","assets/connectors-page-C0NvAP2V.js","assets/number-input-DDeqHK-G.js","assets/connector-service-page-B81cEAEX.js","assets/agent-plugin-dialog-CKK95Jmr.js","assets/apps-page-mGU9WLjP.js","assets/agents-0zgLsfVA.js","assets/directory-picker-path-field-DOPXwYNR.js","assets/image-generation-api-Vqcyqnzb.js","assets/settings-page-layout-Dx5S-Msc.js","assets/channels-C_TVCc1N.js","assets/browser-BLJWD7WI.js","assets/schema-form-BGOzfVyj.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{m as a,r as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./messages-DPxcWxfD.js";import{n as c}from"./locale-store-Djl2FW6_.js";import{Go as l,Rc as u,_l as d}from"./index-BNRLzxpH.js";import{t as f}from"./capability-header-actions-CMJXWq8a.js";var p=n(),m=e(t(),1),h=r(),g=(0,m.lazy)(()=>i(()=>import(`./skills-page-CxaA3P5E.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58]))),_=(0,m.lazy)(()=>i(()=>import(`./connectors-page-C0NvAP2V.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,60,55,61,62]))),v=(0,m.lazy)(()=>i(()=>import(`./apps-page-mGU9WLjP.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,62]))),y=(0,m.lazy)(()=>i(()=>import(`./agents-0zgLsfVA.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,60,65,66,67]))),b=(0,m.lazy)(()=>i(()=>import(`./channels-C_TVCc1N.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,69,70,60,67])));function x(e){return d.includes(e)?e:null}function S(e){let t=(0,p.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},C),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,h.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function C(e,t){return(0,h.jsx)(u,{className:`h-40 rounded-xl`},t)}function w(){let e=(0,p.c)(42),t=c(D),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:u,detailId:d}=a(),C;e[2]===u?C=e[3]:(C=x(u),e[2]=u,e[3]=C);let w=C,O=w??`skills`,k=r.productNavigation.sections[`capabilities-${O}`],A=l(E),j=l(T),M;e[4]===O?M=e[5]:(M={section:O,value:null},e[4]=O,e[5]=M);let[N,P]=(0,m.useState)(M),F=N.section===O?N.value:null,I;e[6]===O?I=e[7]:(I=e=>{P({section:O,value:e})},e[6]=O,e[7]=I);let L=I,R,z;if(e[8]!==j||e[9]!==F||e[10]!==k||e[11]!==A?(R=()=>(A({startExtra:null,main:(0,h.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k}),end:(0,h.jsx)(f,{contribution:F})}),()=>j()),z=[j,F,k,A],e[8]=j,e[9]=F,e[10]=k,e[11]=A,e[12]=R,e[13]=z):(R=e[12],z=e[13]),(0,m.useLayoutEffect)(R,z),!w){let t;return e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsx)(o,{to:`/capabilities/skills`,replace:!0}),e[14]=t):t=e[14],t}let B;e[15]===i.discoverLoading?B=e[16]:(B=(0,h.jsx)(S,{label:i.discoverLoading}),e[15]=i.discoverLoading,e[16]=B);let V;e[17]!==d||e[18]!==L||e[19]!==O?(V=O===`agents`?(0,h.jsx)(y,{agentId:d,onHeaderActionChange:L}):null,e[17]=d,e[18]=L,e[19]=O,e[20]=V):V=e[20];let H;e[21]!==L||e[22]!==O?(H=O===`skills`?(0,h.jsx)(g,{embedded:!0,onHeaderActionChange:L}):null,e[21]=L,e[22]=O,e[23]=H):H=e[23];let U;e[24]!==L||e[25]!==O?(U=O===`connectors`?(0,h.jsx)(_,{embedded:!0,onHeaderActionChange:L}):null,e[24]=L,e[25]=O,e[26]=U):U=e[26];let W;e[27]!==d||e[28]!==L||e[29]!==O?(W=O===`channels`?(0,h.jsx)(b,{channelId:d,onHeaderActionChange:L}):null,e[27]=d,e[28]=L,e[29]=O,e[30]=W):W=e[30];let G;e[31]!==L||e[32]!==O?(G=O===`extensions`?(0,h.jsx)(v,{embedded:!0,onHeaderActionChange:L}):null,e[31]=L,e[32]=O,e[33]=G):G=e[33];let K;return e[34]!==O||e[35]!==W||e[36]!==G||e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==U?(K=(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,h.jsxs)(m.Suspense,{fallback:B,children:[V,H,U,W,G]},O)}),e[34]=O,e[35]=W,e[36]=G,e[37]=B,e[38]=V,e[39]=H,e[40]=U,e[41]=K):K=e[41],K}function T(e){return e.clearPageHeader}function E(e){return e.setPageHeader}function D(e){return e.language}export{w as CapabilitiesPage};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{f as a}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./messages-DPxcWxfD.js";import{t as d}from"./cn-0WouolD0.js";import{n as f}from"./locale-store-Djl2FW6_.js";import{a as p,i as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{n as y}from"./app-link-BV_eGr7l.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{F as x,I as S,Jd as C,Kl as w,L as T,Rc as E,Rt as D,Vt as O,Wc as k,Wo as A,ad as j,ja as M,sf as N,vs as ee,wu as P,ys as te,zt as F}from"./index-BNRLzxpH.js";import{_ as ne,a as re,d as ie,f as ae,g as oe,h as se,i as ce,l as I,m as le,n as L,p as ue,r as R,s as z,t as B,u as de,v as fe}from"./tunnel-api-0knnta9z.js";import{t as V}from"./browser-BLJWD7WI.js";var H=e(n(),1),U=r(),W=e(V(),1),G={width:240,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function pe(e){let t=await W.toString(e,{...G,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var K=i();function me(){let e=u(f(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=b(`tunnel-status`,L,{refreshInterval:1500}),[o,s]=(0,H.useState)(!1),[l,d]=(0,H.useState)(!1),[p,m]=(0,H.useState)(!0),[h,g]=(0,H.useState)(`idle`),[_,v]=(0,H.useState)(null),[C,w]=(0,H.useState)(``),A=(0,H.useRef)(!0);(0,H.useEffect)(()=>(A.current=!0,()=>{A.current=!1}),[]);let j=async()=>{if(!r)return;if(r.consentRequired&&!o){d(!0);return}let e=r.registrationSecret?.configured?null:T(),t,n=!1;v(null);try{if(r.consentRequired&&await re(),!r.registrationSecret?.configured){g(`provisioning`);let r=!1;try{await ce()}catch(e){if(!de(e))throw e;r=!0}if(r){g(`authorizing`);let r=sessionStorage.getItem(`device-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await O(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;A.current&&Date.now()<o;){let r=await F(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await S(a,e)||w(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!A.current)return;if(!s)throw Error(`Authorization expired`);await ce()}await a()}if(!A.current)return;g(`starting`),await z(),p&&await R({autoStart:!0}),await a(),n=!0}catch(e){n=!0,A.current&&v(I(e)===`tunnel_key_limit_reached`?`key-limit`:`failed`)}finally{x(e),n&&(sessionStorage.removeItem(`device-pairing-oauth`),t&&D(t).catch(()=>{})),A.current&&(g(`idle`),w(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(E,{className:`h-5 w-4/5`}),(0,K.jsx)(E,{className:`h-24 w-full`})]});let M=h===`provisioning`||h===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,K.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:M?t.preparingHint:h===`authorizing`?t.authorizing:t.enableHint}),C&&h===`authorizing`?(0,K.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,M?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(E,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(l||r?.consentRequired)&&h===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:l,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,_===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(k,{variant:`secondary`,className:`mt-3`,onClick:()=>void y(B),children:[t.manageTunnelKeys,(0,K.jsx)(c,{className:`size-3`})]})]}):_||i||r?.state===`error`?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.routeSetupFailed}):null,(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:p,disabled:h!==`idle`,onChange:e=>m(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,K.jsx)(k,{className:`w-full`,variant:`primary`,disabled:!r||h!==`idle`||M||l&&!o,onClick:()=>void j(),children:h===`authorizing`?t.authorizing:M?t.preparing:_?t.retry:t.enable}),i&&!r?(0,K.jsx)(k,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,U.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,H.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,H.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let p=f,m;t[6]!==p||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(m=n?c?(0,K.jsx)(ge,{targetKind:c,onClose:()=>p(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{p(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>p(!1)}):null,t[6]=p,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==p||t[13]!==n||t[14]!==m?(h=(0,K.jsx)(v,{open:n,onOpenChange:p,children:m}),t[12]=p,t[13]=n,t[14]=m,t[15]=h):h=t[15],h}function Y(e){let t=(0,U.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{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]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(N,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,U.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=f(he),o;t[0]===a?o=t[1]:(o=u(a),t[0]=a,t[1]=o);let s=o.endpointToolsSettings.deviceAccess,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(p,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,te)}),t[2]=c):c=t[2];let v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,ee),t[3]=v):v=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=y):y=t[4];let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(l,{className:`size-4`}),t[5]=b):b=t[5];let x;t[6]!==s.cancel||t[7]!==i?(x=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[y,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":s.cancel,onClick:i,children:b})]}),t[6]=s.cancel,t[7]=i,t[8]=x):x=t[8];let S;t[9]===s.chooseTitle?S=t[10]:(S=(0,K.jsx)(_,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:s.chooseTitle}),t[9]=s.chooseTitle,t[10]=S);let C;t[11]===s.chooseHint?C=t[12]:(C=(0,K.jsx)(m,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:s.chooseHint}),t[11]=s.chooseHint,t[12]=C);let T;t[13]!==s.localBrowserHint||t[14]!==s.localBrowserTitle||t[15]!==r?(T=(0,K.jsx)(Y,{icon:j,title:s.localBrowserTitle,hint:s.localBrowserHint,onClick:r}),t[13]=s.localBrowserHint,t[14]=s.localBrowserTitle,t[15]=r,t[16]=T):T=t[16];let E;t[17]===n?E=t[18]:(E=()=>n(`mobile`),t[17]=n,t[18]=E);let D;t[19]!==s.mobileHint||t[20]!==s.mobileTitle||t[21]!==E?(D=(0,K.jsx)(Y,{icon:w,title:s.mobileTitle,hint:s.mobileHint,onClick:E}),t[19]=s.mobileHint,t[20]=s.mobileTitle,t[21]=E,t[22]=D):D=t[22];let O;t[23]===n?O=t[24]:(O=()=>n(`browser`),t[23]=n,t[24]=O);let k;t[25]!==s.remoteBrowserHint||t[26]!==s.remoteBrowserTitle||t[27]!==O?(k=(0,K.jsx)(Y,{icon:P,title:s.remoteBrowserTitle,hint:s.remoteBrowserHint,onClick:O}),t[25]=s.remoteBrowserHint,t[26]=s.remoteBrowserTitle,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==D||t[30]!==k||t[31]!==T?(A=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[T,D,k]}),t[29]=D,t[30]=k,t[31]=T,t[32]=A):A=t[32];let M;t[33]!==A||t[34]!==S||t[35]!==C?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[S,C,A]}),t[33]=A,t[34]=S,t[35]=C,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==x?(N=(0,K.jsxs)(h,{children:[c,(0,K.jsxs)(g,{className:v,children:[x,M]})]}),t[37]=M,t[38]=x,t[39]=N):N=t[39],N}function he(e){return e.language}function ge({targetKind:e,onClose:t,onPaired:n}){let r=f(e=>e.language),i=u(r),a=i.endpointToolsSettings.deviceAccess,v=a.flow,[x,S]=(0,H.useState)(!1),w=b(x?`device-pairing-readiness`:null,se,{refreshInterval:1500}),[T,D]=(0,H.useState)(),[O,j]=(0,H.useState)(null),[P,F]=(0,H.useState)(!1),[re,ce]=(0,H.useState)(Date.now()),[I,L]=(0,H.useState)(null),R=(0,H.useRef)(!0),z=(0,H.useRef)(null),B=(0,H.useRef)(!1),de=(0,H.useRef)(!1),V=b(T?[`device-pairing-setup`,T.id]:null,()=>oe(T.id),{refreshInterval:1500}),U=V.data?.request,W=U?.status===`completed`,G=W&&U.connectedAt!==void 0,q=b(G&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T?.targetKind===`mobile`?T.universalLink:``,Y=A(()=>pe(J),[J],{enabled:!!J,initial:null,errorData:null}),X=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,he=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,ge=A(()=>pe(X),[X],{enabled:!x&&e===`mobile`,initial:null,errorData:null});(0,H.useEffect)(()=>{R.current=!0;let e=setInterval(()=>ce(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&ie(z.current).catch(()=>{})}},[]);let Z=(0,H.useCallback)(async()=>{if(!B.current){B.current=!0,F(!0),j(null);try{z.current&&await ie(z.current),z.current=null,D(void 0);let t=await ae(e);if(t.kind===`ready`){if(!R.current){await ie(t.setup.id);return}z.current=t.setup.id,D(t.setup)}else await w.mutate()}catch{R.current&&j(`create`)}finally{B.current=!1,R.current&&F(!1)}}},[w,e]);(0,H.useEffect)(()=>{w.data?.ready&&!T&&O!==`create`&&!B.current&&Z()},[w.data,T,O,Z]),(0,H.useEffect)(()=>{G&&!de.current&&(de.current=!0,n?.())},[G,n]);let _e=async e=>{if(U){F(!0),j(null);try{await ue(U,e),await V.mutate()}catch{j(`decision`),await V.mutate()}finally{R.current&&F(!1)}}},ve=(0,H.useRef)(0);(0,H.useEffect)(()=>{V.data&&(ve.current=V.data.serverTime-Date.now())},[V.data]);let Q=re+ve.current,ye=T&&Q>=T.expiresAt&&!U,be=U&&[`expired`,`rejected`,`cancelled`].includes(U.status),xe=T?T.expiresAt-Q<6e4:!1,Se=T?xe?`${Math.max(0,Math.ceil((T.expiresAt-Q)/1e3))}s`:v.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ce=e===`mobile`?a.mobilePrepareTitle:a.browserPrepareTitle,we=e===`mobile`?a.mobilePrepareHint:a.browserPrepareHint,Te=x?G?$.success:U?.status===`pending`?$.allowTitle:W||U?.status===`approved`?v.waiting:T?$.connect:v.title:Ce,Ee=O===`create`?v.createFailed:O===`decision`?v.decisionFailed:O===`background`?v.backgroundFailed:O===`download`?a.browserDownloadFailed:null,De=async()=>{F(!0),j(null);try{await le()}catch{j(`download`)}finally{R.current&&F(!1)}};return(0,K.jsxs)(h,{children:[(0,K.jsx)(p,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,te)}),(0,K.jsxs)(g,{className:d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,ee),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":v.cancel,onClick:t,children:(0,K.jsx)(l,{className:`size-4`})})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[G?(0,K.jsx)(o,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(_,{className:`text-xl font-semibold tracking-tight text-fg`,children:Te}),(0,K.jsx)(m,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:x?G?$.successHint:W?v.waitingForDevice:U?U.displayName:T?$.connectHint:v.intro:we}),Ee?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ee}):null,x&&w.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:v.readinessFailed}):null,x&&V.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:v.statusUnavailable}):null,x?w.data?G?(0,K.jsxs)(K.Fragment,{children:[q.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>j(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):be||ye?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ye||U?.status===`expired`?v.expired:v.declined}),(0,K.jsx)(k,{variant:`primary`,onClick:()=>void Z(),disabled:P,children:v.refresh})]}):U?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:v.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[U.confirmationCode.slice(0,3),` `,U.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:v.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:v.access}),(0,K.jsx)(`p`,{children:v.accessHint})]})]}):T?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Y.data?(0,K.jsx)(`img`,{src:Y.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Y.error?null:(0,K.jsx)(E,{className:`size-[240px] rounded-xl`})})}),Y.error?null:(0,K.jsxs)(`p`,{className:d(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,xe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`}),Se]})]}),Y.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:v.qrFailed}):null,Y.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(M,{text:T.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:v.fallback}),(0,K.jsx)(N,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(M,{text:T.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):T?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(M,{text:T.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:T.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((T.expiresAt-Q)/1e3))}s`:v.valid})]}):w.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(E,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,K.jsx)(fe,{embedded:!0}):I===`https`?(0,K.jsx)(ne,{}):I===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(k,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:a.useTailscale}),(0,K.jsx)(k,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(me,{}),(0,K.jsx)(k,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?v.back:v.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(E,{className:`h-5 w-3/4`}),(0,K.jsx)(E,{className:`h-40 w-full`})]}):e===`mobile`?(0,K.jsxs)(`div`,{className:`mt-7 flex flex-col items-center`,children:[ge.data?(0,K.jsx)(`img`,{src:ge.data,alt:a.mobileDownloadQrAlt,width:144,height:144,className:`size-36 rounded-lg bg-white`}):(0,K.jsx)(E,{className:`size-36`}),(0,K.jsxs)(k,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void y(X),children:[(0,K.jsx)(c,{className:`size-4`}),a.mobileDownload]}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs leading-5 text-fg-muted`,children:a.mobileDownloadHint})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(k,{variant:`secondary`,className:`w-full`,disabled:P,onClick:()=>void De(),children:[(0,K.jsx)(s,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void y(he),children:[a.browserInstallHelp,(0,K.jsx)(c,{className:`size-3`})]})]})]}),!x||w.error||G||U?.status===`pending`||O===`create`||O===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:x?G?(0,K.jsx)(k,{className:`w-full`,variant:`primary`,onClick:t,children:v.done}):U?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(k,{className:`w-full`,variant:`primary`,disabled:P,onClick:()=>void _e(`approve`),children:v.allow}),(0,K.jsx)(k,{className:`w-full`,variant:`ghost`,disabled:P,onClick:()=>void _e(`reject`),children:v.cancel})]}):w.error?(0,K.jsx)(k,{className:`w-full`,variant:`primary`,onClick:()=>void w.mutate(),children:v.retry}):(0,K.jsx)(k,{className:`w-full`,variant:`primary`,disabled:P,onClick:()=>void Z(),children:v.retry}):(0,K.jsx)(k,{className:`w-full`,variant:`primary`,onClick:()=>{j(null),S(!0)},children:e===`mobile`?a.mobileReady:a.browserReady})}):null]})]})}export{q as n,J as t};