@yuriai/web 0.2.31 → 0.2.32-beta.2

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 (108) hide show
  1. package/dist/assets/{AgentAvatar-DLAQkFQe.js → AgentAvatar-DG1RbFtI.js} +1 -1
  2. package/dist/assets/{AssistantContactStatus-DZGGspw4.js → AssistantContactStatus-DKbVOZjo.js} +3 -3
  3. package/dist/assets/{AssistantUnreadBadge-BynxNQMk.js → AssistantUnreadBadge-ftPNMymo.js} +1 -1
  4. package/dist/assets/{AssistantView-CDZyA9ft.js → AssistantView-CblJ2zy9.js} +1 -1
  5. package/dist/assets/{DiagramView-DdVFGHQQ.js → DiagramView-DXqhOl9l.js} +1 -1
  6. package/dist/assets/{FadeInOnReveal-C9a7XnAh.js → FadeInOnReveal-Bmxvkrf4.js} +1 -1
  7. package/dist/assets/{GuiPluginSurface-v8r-Hex5.js → GuiPluginSurface-m-Noj3aa.js} +1 -1
  8. package/dist/assets/{GuiPluginWindow-Ba1HfrjQ.js → GuiPluginWindow-CwP_vUoC.js} +1 -1
  9. package/dist/assets/{Icon-Bh3TaKoN.js → Icon-BOYrvHyJ.js} +1 -1
  10. package/dist/assets/{ImageLoadingPlaceholder-Dcy5lc7F.js → ImageLoadingPlaceholder-DlosWH_9.js} +1 -1
  11. package/dist/assets/{LoadingImage-BxjJ_Xyj.js → LoadingImage-D9r0ukc0.js} +1 -1
  12. package/dist/assets/MarkdownRenderer-DoXuuJkV.js +2 -0
  13. package/dist/assets/{MarkdownRendererImpl-Bdwe3qUr.js → MarkdownRendererImpl-BYuuFNfa.js} +1 -1
  14. package/dist/assets/{MarkstreamRendererImpl-CCQj9IkL.js → MarkstreamRendererImpl-IKDf9jte.js} +1 -1
  15. package/dist/assets/{MobileDetailNavigation-o54juFXD.js → MobileDetailNavigation-sEqCaRnY.js} +1 -1
  16. package/dist/assets/{MobileResizableSheet-sV9XR-0k.js → MobileResizableSheet-vAenroLZ.js} +1 -1
  17. package/dist/assets/{MobileShareBridge-oqBZ_f6M.js → MobileShareBridge-G3-CumcS.js} +1 -1
  18. package/dist/assets/{MobileTabPageHeader-CptcDWNS.js → MobileTabPageHeader-C8RbWBKV.js} +1 -1
  19. package/dist/assets/{MultiRunWindow-7W_86vL6.js → MultiRunWindow-CDpvE-zO.js} +1 -1
  20. package/dist/assets/{OnboardingScreen-CnkijSLE.js → OnboardingScreen-DNlK3zfZ.js} +1 -1
  21. package/dist/assets/{OverlayScrollbar-CCtBTJQj.js → OverlayScrollbar-W17unuIx.js} +1 -1
  22. package/dist/assets/{SettingsView-CkJpYIMe.js → SettingsView-Das1IHAu.js} +14 -14
  23. package/dist/assets/{SettingsWindow-C0HiNvXh.js → SettingsWindow-C7rgO3qt.js} +1 -1
  24. package/dist/assets/SetupTourDialog-BkbTIz8M.js +1 -0
  25. package/dist/assets/{TerminalView-y36H_fIe.js → TerminalView-DsIVQDlk.js} +1 -1
  26. package/dist/assets/{ToolOutputDialog-BfjBeqGS.js → ToolOutputDialog-BH3bOjDw.js} +1 -1
  27. package/dist/assets/{VoiceSettings-BONwzGgR.js → VoiceSettings-BlU2CJhd.js} +2 -2
  28. package/dist/assets/{YuriLogo-BA5FWp-g.js → YuriLogo-XH6UGXtF.js} +1 -1
  29. package/dist/assets/{appThemeRegistry-BsLMp3bc.js → appThemeRegistry-DMSk1I5B.js} +1 -1
  30. package/dist/assets/{button-CBjOhOI0.js → button-CyJvQsp5.js} +1 -1
  31. package/dist/assets/{capgoAdapter-DjlyVxy_.js → capgoAdapter-D8I8oJcn.js} +1 -1
  32. package/dist/assets/{collapsible-B0j5IQ0T.js → collapsible-CXjDO6DW.js} +1 -1
  33. package/dist/assets/{context-menu-C4e_bpls.js → context-menu-BajfnPcW.js} +1 -1
  34. package/dist/assets/{desktopRelayRestore-AE3_TnQz.js → desktopRelayRestore-DS44uXtb.js} +1 -1
  35. package/dist/assets/{diagram-WPmk0Qh6.js → diagram-_Js3imTf.js} +1 -1
  36. package/dist/assets/{dialog-Dx3IT7dQ.js → dialog-Bapd6e10.js} +1 -1
  37. package/dist/assets/{es-JU--16Gd.js → es-CBhZ80Z7.js} +2 -2
  38. package/dist/assets/{fileMentionTouchSelection-Bizsisaj.js → fileMentionTouchSelection-BqGxOZhB.js} +1 -1
  39. package/dist/assets/{fr-BUZcRuMk.js → fr-D9s0sHDF.js} +2 -2
  40. package/dist/assets/{gitApi-CNgEj6X5.js → gitApi-D92RH8FG.js} +1 -1
  41. package/dist/assets/{input-CEJGM-TS.js → input-SCAHBeSU.js} +1 -1
  42. package/dist/assets/{insertionBoundaries-CgYf6gys.js → insertionBoundaries-tD7rJ-pN.js} +1 -1
  43. package/dist/assets/{ja-BwtVLTXD.js → ja-BXQ3ox8H.js} +2 -2
  44. package/dist/assets/{ko--sLsRFpA.js → ko-DlUti1wK.js} +2 -2
  45. package/dist/assets/{main-DrqtyqDc.js → main-2gplybqp.js} +2 -2
  46. package/dist/assets/{main-B8FcBwPM.js → main-BalwAS4v.js} +4 -4
  47. package/dist/assets/{markdownHeightCache-D6iSNJG2.js → markdownHeightCache-B3MTnGA8.js} +1 -1
  48. package/dist/assets/{mcpQueries-DVSsZeuk.js → mcpQueries-Bvd8i21K.js} +1 -1
  49. package/dist/assets/{miniChat-CgeCl4RY.js → miniChat-CDgmbnvp.js} +2 -2
  50. package/dist/assets/{mobile-DAhJKHUq.js → mobile-B7XDs1Ej.js} +2 -2
  51. package/dist/assets/{mobileBackNavigation-Dmbf0kw1.js → mobileBackNavigation-AlDzsLZE.js} +1 -1
  52. package/dist/assets/{multirun-BbWnHeaY.js → multirun-Dvx2CH5O.js} +1 -1
  53. package/dist/assets/{native-config-BaRHaY4y.js → native-config-BfwOD9gu.js} +1 -1
  54. package/dist/assets/{pl-C4_4J5yA.js → pl-B7LIbV2C.js} +2 -2
  55. package/dist/assets/{projectMeta-rrpZdm8D.js → projectMeta-CDOI8wVV.js} +1 -1
  56. package/dist/assets/{pt-BR-DvNC5K1q.js → pt-BR-DyusczdZ.js} +2 -2
  57. package/dist/assets/{pwa-Dm_DJEr9.js → pwa-SCu_PpmX.js} +1 -1
  58. package/dist/assets/{queue-abort-optimistic-CSkERbr4.js → queue-abort-optimistic-C-AN4RTx.js} +1 -1
  59. package/dist/assets/{readiness-BnO7IaZV.js → readiness-CrZ59Om9.js} +1 -1
  60. package/dist/assets/{renderElectronMiniChatApp-Bq3iNKtr.js → renderElectronMiniChatApp-D9PyhLc-.js} +2 -2
  61. package/dist/assets/{renderMobileApp-DiNeMgwp.js → renderMobileApp-JQguy_5y.js} +4 -4
  62. package/dist/assets/{runtimeConfig-BHOiBANF.js → runtimeConfig-DfLCc7A9.js} +1 -1
  63. package/dist/assets/runtimeEndpointReset-B--BY0YO.js +149 -0
  64. package/dist/assets/{select-bKMw5JE8.js → select-BCLecCtX.js} +1 -1
  65. package/dist/assets/{sessionLookup-DGNxfDsP.js → sessionLookup-cyEN12a0.js} +1 -1
  66. package/dist/assets/{sortable-tabs-strip-3sKiA7T1.js → sortable-tabs-strip-D474PwS8.js} +1 -1
  67. package/dist/assets/{speechSettingsQueries-BDDxw8LP.js → speechSettingsQueries-DHdSg2sh.js} +1 -1
  68. package/dist/assets/{src-PTWgTO6W.css → src-BqubNQyD.css} +1 -1
  69. package/dist/assets/{store-X3lU0obe.js → store-Diaywtmi.js} +4 -4
  70. package/dist/assets/{textarea-EsaDD051.js → textarea-CWQIq-Mn.js} +1 -1
  71. package/dist/assets/{tooltip-LLDL5nIZ.js → tooltip-D3WmiZ7G.js} +1 -1
  72. package/dist/assets/tour-DeA0Ksvj.js +1 -0
  73. package/dist/assets/types-DXHiIS-0.js +2 -0
  74. package/dist/assets/{uk-Dvj0JjiC.js → uk-BrwM67Dh.js} +2 -2
  75. package/dist/assets/{useAppFontEffects-wIWWE59b.js → useAppFontEffects-DdgYioGO.js} +13 -13
  76. package/dist/assets/{useDesktopWindowControlsLayout-CdUr9mCZ.js → useDesktopWindowControlsLayout-CZryTaVG.js} +1 -1
  77. package/dist/assets/{useDictation-DlEHSN6P.js → useDictation-C-waWdAq.js} +1 -1
  78. package/dist/assets/{useEffectiveDirectory-DzqpWUC3.js → useEffectiveDirectory-DkFV660l.js} +1 -1
  79. package/dist/assets/{useMobileNavigationStore-BWLhXqci.js → useMobileNavigationStore-BUlbm442.js} +7 -7
  80. package/dist/assets/usePluginsStore-cBba-pcU.js +1 -0
  81. package/dist/assets/{useWorkerHighlightedLines-DMS69wKa.js → useWorkerHighlightedLines-CdxTrkgu.js} +1 -1
  82. package/dist/assets/{zh-CN-2Y6u8t24.js → zh-CN-D9NAFloZ.js} +2 -2
  83. package/dist/assets/{zh-TW-Z5wVv4Fb.js → zh-TW-tuUKOuhs.js} +2 -2
  84. package/dist/index.html +7 -7
  85. package/dist/mini-chat.html +7 -7
  86. package/dist/mobile.html +7 -7
  87. package/package.json +1 -1
  88. package/server/lib/config-sync/DOCUMENTATION.md +8 -4
  89. package/server/lib/config-sync/index.js +1 -1
  90. package/server/lib/config-sync/magpie-auth.js +10 -4
  91. package/server/lib/config-sync/magpie-auth.test.js +4 -0
  92. package/server/lib/config-sync/magpie.js +28 -22
  93. package/server/lib/config-sync/magpie.test.js +127 -2
  94. package/server/lib/config-sync/plugins.js +44 -0
  95. package/server/lib/config-sync/plugins.test.js +64 -0
  96. package/server/lib/config-sync/tar.js +61 -1
  97. package/server/lib/opencode/DOCUMENTATION.md +2 -0
  98. package/server/lib/opencode/plugin-routes.test.js +1 -0
  99. package/server/lib/opencode/plugins.js +1 -1
  100. package/server/lib/opencode/plugins.test.js +3 -2
  101. package/server/lib/opencode/settings-runtime.js +8 -6
  102. package/server/lib/opencode/settings-runtime.test.js +44 -0
  103. package/dist/assets/MarkdownRenderer-CS6Pia5D.js +0 -2
  104. package/dist/assets/SetupTourDialog-BcEbaEO3.js +0 -1
  105. package/dist/assets/runtimeEndpointReset-DGxT24oE.js +0 -149
  106. package/dist/assets/tour-Db44qwfs.js +0 -1
  107. package/dist/assets/types-Cl7nTpsb.js +0 -2
  108. package/dist/assets/usePluginsStore-aZl0WTK8.js +0 -1
@@ -1,5 +1,10 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { OPENCODE_CONFIG_SYNC_TAR_EXCLUDES } from './constants.js';
2
+ import fs from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { OPENCODE_CONFIG_SYNC_ALLOWLIST, OPENCODE_CONFIG_SYNC_TAR_EXCLUDES } from './constants.js';
6
+ import { extractTarGzBuffer } from './local-backup.js';
7
+ import { filterSyncedPluginConfig } from './plugins.js';
3
8
 
4
9
  /**
5
10
  * Collect stdout from a local `tar …` into a Buffer.
@@ -34,3 +39,58 @@ export const collectLocalTarBuffer = (tarArgs, spawnOptions = {}) => new Promise
34
39
  resolve(Buffer.concat(chunks));
35
40
  });
36
41
  });
42
+
43
+ /** Filter only a private archive copy; source and destination files stay untouched on failure. */
44
+ export const filterConfigSyncArchive = async (buffer) => {
45
+ if (!buffer.length) return buffer;
46
+ const staging = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-config-sync-'));
47
+ try {
48
+ await extractTarGzBuffer(buffer, staging);
49
+ let changed = false;
50
+ for (const name of OPENCODE_CONFIG_SYNC_ALLOWLIST.fileGroups.flat()) {
51
+ const file = path.join(staging, name);
52
+ let content;
53
+ try {
54
+ if (!(await fs.lstat(file)).isFile()) throw new Error('Cannot sync plugins: configuration must be a regular file');
55
+ content = await fs.readFile(file, 'utf8');
56
+ } catch (error) {
57
+ if (error.code === 'ENOENT') continue;
58
+ throw error;
59
+ }
60
+ const filtered = filterSyncedPluginConfig(content);
61
+ if (filtered === content) continue;
62
+ await fs.writeFile(file, filtered);
63
+ changed = true;
64
+ }
65
+ if (!changed) return buffer;
66
+ const entries = await fs.readdir(staging);
67
+ return await collectLocalTarBuffer(['-czf', '-', '-C', staging, ...entries], {
68
+ windowsHide: process.platform === 'win32',
69
+ });
70
+ } finally {
71
+ await fs.rm(staging, { recursive: true, force: true });
72
+ }
73
+ };
74
+
75
+ /** SSH collector for the engine's `-C root ...entries` contract; only config files are staged. */
76
+ export const collectSshConfigTarBuffer = async (tarArgs, options = {}) => {
77
+ const rootIndex = tarArgs.indexOf('-C') + 1;
78
+ const root = tarArgs[rootIndex];
79
+ const entries = tarArgs.slice(rootIndex + 1);
80
+ const configs = entries.filter((entry) => OPENCODE_CONFIG_SYNC_ALLOWLIST.fileGroups.flat().includes(entry));
81
+ if (!configs.length) return collectLocalTarBuffer(tarArgs, options);
82
+ const staging = await fs.mkdtemp(path.join(os.tmpdir(), 'yuri-config-sync-'));
83
+ try {
84
+ for (const name of configs) {
85
+ const content = await fs.readFile(path.join(root, name), 'utf8');
86
+ await fs.writeFile(path.join(staging, name), filterSyncedPluginConfig(content), { mode: 0o600 });
87
+ }
88
+ const remaining = entries.filter((entry) => !configs.includes(entry));
89
+ return await collectLocalTarBuffer([
90
+ ...tarArgs.slice(0, rootIndex - 1), '-C', staging, ...configs,
91
+ ...(remaining.length ? ['-C', root, ...remaining] : []),
92
+ ], options);
93
+ } finally {
94
+ await fs.rm(staging, { recursive: true, force: true });
95
+ }
96
+ };
@@ -29,6 +29,7 @@ encoding, not removed V1 endpoints.
29
29
  from the authenticated client context (null for owner UI sessions), allowing
30
30
  connection shortcuts to exclude themselves without changing management lists.
31
31
  - `plugins.js`: config entries and plugin-directory files are inventory, not compatibility checks. They do not synthesize `compatibility` or `compatible` fields; Settings uses the OpenCode runtime inventory for actual load status and errors.
32
+ - Host user-scope plugin creation (including the setup tour) supplies `$schema: "https://opencode.ai/config.json"` and `lsp: true` when absent in its target config. Existing explicit values win. Project-scope writes do not introduce global defaults. The tour is not exposed in standalone VS Code.
32
33
  - Reads native V2 `plugins` (strings or `{ package, options }`) with legacy `plugin`/tuple fallback. A native array, including an empty one, wins within each document. Entry mutations write only `plugins`, convert retained legacy tuples, and remove the shadowed legacy key in the touched source file. Options, ordering, unrelated configuration and JSONC comments are preserved through the shared atomic config writer; malformed entries or write failures do not replace the original file. Web, Electron and mobile use this host implementation; VS Code mirrors the same persistence contract.
33
34
  - `session-directory-runtime.js`: Host-side physical directory identity for session index/list/detail/live projection. Uses a runtime-scoped, bounded 256-entry cache (60s success / 5s failed resolution), cleared when the upstream URL changes. Local directory lists use session pages and physical-directory filtering to include legacy symlink sessions without mixing worktrees; they never request `/location` to discover project identity. Startup backfill reads one global session stream rather than one stream per project. One request reads one page and preserves opaque cursors; consumers must follow continuations even after filtered-empty pages. Non-loopback upstreams keep their own path namespace.
34
35
  - `packages/web/server/lib/opencode/index.js`: public entrypoint (currently baseline placeholder).
@@ -74,6 +75,7 @@ encoding, not removed V1 endpoints.
74
75
  - `packages/web/server/lib/opencode/project-icon-routes.js`: project icon upload/read/discovery route registration and icon storage orchestration.
75
76
  - `packages/web/server/lib/opencode/skill-routes.js`: route registration for skill config CRUD, supporting files, and skills catalog scan/install flows.
76
77
  - `packages/web/server/lib/opencode/settings-runtime.js`: Settings persistence runtime (disk IO, migrations, normalization, project validation, and persisted update serialization).
78
+ - The absence of a `projects` property identifies pre-registry settings: migrate a previously saved `lastDirectory` once, otherwise initialize `projects: []`. An explicit empty registry is authoritative and never repopulated from `lastDirectory`. Writes establish this baseline from the stored settings before merging incoming changes, so first-launch home-directory persistence cannot register `/root`, `/`, or any other home as a project or suppress the setup tour. The registry is Yuri-owned, independent of OpenCode's discovered projects.
77
79
  - Trusted resource owners can pass a functional update to `persistSettings`; it strictly reads and derives the patch inside the same Host/Electron lock, preserving concurrent writes. These callers validate their affected resource instead of sweeping unrelated offline projects. `projects/registry.js` shares project registration between the existing directory HTTP API and assistant tools; ordinary object-based settings updates retain their existing full-list validation behavior.
78
80
  - Missing theme preferences use `carbonfox-light` / `cursor-dark`, matching the shared UI defaults. Existing per-variant IDs and legacy explicitly selected theme IDs remain authoritative; changing the default does not rewrite a user's saved theme.
79
81
  - Project registry order and `projectSortOrder` are shared Host authority. After a successful changed write, `onProjectOrderChanged` emits `yuri:project-order-changed` on the existing Yuri SSE channel. Clients GET settings on initial mount, tip, and reconnect. Unchanged and failed writes emit no tip; older settings without a sort mode use `manual`.
@@ -281,6 +281,7 @@ describe('opencode plugin routes', () => {
281
281
  test('POST /entry persists for V2 hot reload without restarting', async () => {
282
282
  const response = await createEntry('a');
283
283
 
284
+ expect(readJson(userConfigPath)).toEqual({ $schema: 'https://opencode.ai/config.json', lsp: true, plugins: ['a'] });
284
285
  expect(response.body).toMatchObject({ success: true, requiresReload: false, application: 'watch' });
285
286
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
286
287
  });
@@ -256,7 +256,7 @@ function createPluginEntry(entry, workingDirectory) {
256
256
  config = fs.existsSync(targetPath) ? readConfigFile(targetPath) : {};
257
257
  } else {
258
258
  targetPath = layers.paths.customPath || layers.paths.userPath;
259
- config = getConfigForPath(layers, targetPath);
259
+ config = { $schema: 'https://opencode.ai/config.json', lsp: true, ...getConfigForPath(layers, targetPath) };
260
260
  }
261
261
 
262
262
  writePluginArray(config, [...readPluginArray(config), serializePluginEntry({ spec, options: entry.options })], targetPath);
@@ -120,7 +120,7 @@ describe('opencode plugins data layer', () => {
120
120
  });
121
121
 
122
122
  test('converts untouched legacy options on save and preserves unrelated JSONC', () => {
123
- fs.writeFileSync(userConfigPath, '// retained comment\n' + JSON.stringify({ model: 'example/model', plugin: [['old', { nested: { enabled: false } }]] }));
123
+ fs.writeFileSync(userConfigPath, '// retained comment\n' + JSON.stringify({ model: 'example/model', lsp: false, plugin: [['old', { nested: { enabled: false } }]] }));
124
124
  plugins.createPluginEntry({ spec: 'new', scope: 'user' }, projectDir);
125
125
  const text = fs.readFileSync(userConfigPath, 'utf8');
126
126
  expect(text).toContain('// retained comment');
@@ -130,6 +130,7 @@ describe('opencode plugins data layer', () => {
130
130
  expect(text).toContain('"plugins"');
131
131
  expect(text).not.toContain('"plugin"');
132
132
  expect(text).toContain('example/model');
133
+ expect(text).toMatch(/"lsp":\s*false/);
133
134
  });
134
135
 
135
136
  test('prefers native plugins over legacy entries including an empty native array', () => {
@@ -141,7 +142,7 @@ describe('opencode plugins data layer', () => {
141
142
  writeJson(userConfigPath, { plugin: ['shadowed'], plugins: [] });
142
143
  expect(plugins.listPluginEntries(projectDir)).toEqual([]);
143
144
  plugins.createPluginEntry({ spec: 'new' }, projectDir);
144
- expect(readJson(userConfigPath)).toEqual({ plugins: ['new'] });
145
+ expect(readJson(userConfigPath)).toEqual({ $schema: 'https://opencode.ai/config.json', lsp: true, plugins: ['new'] });
145
146
  });
146
147
 
147
148
  test('malformed legacy data and failed atomic writes leave original config intact', () => {
@@ -596,15 +596,16 @@ export const createSettingsRuntime = (deps) => {
596
596
  const migrateSettingsFromLegacyLastDirectory = async (current) => {
597
597
  const settings = current && typeof current === 'object' ? current : {};
598
598
  const now = Date.now();
599
+ const hasProjectRegistry = Object.prototype.hasOwnProperty.call(settings, 'projects');
599
600
 
600
601
  const sanitizedProjects = sanitizeProjects(settings.projects) || [];
601
602
  let nextProjects = sanitizedProjects;
602
603
  let nextActiveProjectId =
603
604
  typeof settings.activeProjectId === 'string' ? settings.activeProjectId : undefined;
604
605
 
605
- let changed = false;
606
+ let changed = !hasProjectRegistry;
606
607
 
607
- if (nextProjects.length === 0) {
608
+ if (!hasProjectRegistry) {
608
609
  const legacy = typeof settings.lastDirectory === 'string' ? settings.lastDirectory.trim() : '';
609
610
  const candidate = legacy ? resolveDirectoryCandidate(legacy) : null;
610
611
 
@@ -852,10 +853,11 @@ export const createSettingsRuntime = (deps) => {
852
853
 
853
854
  const persistSettings = async (changes) => runPersistedWrite(async () => {
854
855
  const updateCurrent = typeof changes === 'function';
855
- const current = updateCurrent
856
+ const stored = updateCurrent
856
857
  ? await readSettingsFromDiskStrict()
857
858
  : await readSettingsFromDisk();
858
- if (updateCurrent && Array.isArray(current)) throw new Error('Settings file is malformed (array payload)');
859
+ if (updateCurrent && Array.isArray(stored)) throw new Error('Settings file is malformed (array payload)');
860
+ const { settings: current } = await migrateSettingsFromLegacyLastDirectory(stored);
859
861
  if (typeof changes === 'function') changes = await changes(current);
860
862
  // Log field names only — changes can carry credentials (UI password,
861
863
  // client tokens) that must never reach the log file.
@@ -905,8 +907,8 @@ export const createSettingsRuntime = (deps) => {
905
907
  }
906
908
 
907
909
  await writeSettingsToDiskUnlocked(next);
908
- if (JSON.stringify(current.projects) !== JSON.stringify(next.projects)
909
- || current.projectSortOrder !== next.projectSortOrder) {
910
+ if (JSON.stringify(stored.projects) !== JSON.stringify(next.projects)
911
+ || stored.projectSortOrder !== next.projectSortOrder) {
910
912
  onProjectOrderChanged?.();
911
913
  }
912
914
  return formatSettingsResponse(next);
@@ -36,6 +36,48 @@ const createRuntime = async (overrides = {}) => {
36
36
  };
37
37
 
38
38
  describe('settings runtime', () => {
39
+ it.each(['read-first', 'write-first', 'functional-write-first'])(
40
+ 'keeps a fresh home-directory bootstrap out of the project registry (%s)', async (order) => {
41
+ const { runtime, tempRoot, cleanup } = await createRuntime({
42
+ mergePersistedSettings: (current, changes) => ({ ...current, ...changes }),
43
+ });
44
+ try {
45
+ if (order === 'read-first') await runtime.readSettingsFromDiskMigrated();
46
+ const update = { lastDirectory: tempRoot, homeDirectory: tempRoot };
47
+ await runtime.persistSettings(order === 'functional-write-first' ? () => update : update);
48
+ const settings = await runtime.readSettingsFromDiskMigrated();
49
+ expect(settings.projects).toEqual([]);
50
+ expect(settings.activeProjectId).toBeUndefined();
51
+ expect(settings.lastDirectory).toBe(tempRoot);
52
+ expect((await runtime.readSettingsFromDiskMigrated()).projects).toEqual([]);
53
+ } finally { await cleanup(); }
54
+ },
55
+ );
56
+
57
+ it('does not resurrect a removed last project from the saved directory', async () => {
58
+ const { runtime, tempRoot, cleanup } = await createRuntime({
59
+ mergePersistedSettings: (current, changes) => ({ ...current, ...changes }),
60
+ });
61
+ try {
62
+ await runtime.persistSettings({ projects: [{ id: createProjectIdFromPath(tempRoot), path: tempRoot }], lastDirectory: tempRoot });
63
+ await runtime.persistSettings({ projects: [] });
64
+ expect((await runtime.readSettingsFromDiskMigrated()).projects).toEqual([]);
65
+ } finally { await cleanup(); }
66
+ });
67
+
68
+ it.each([false, true])('still migrates a saved pre-registry directory exactly once (write first=%s)', async (writeFirst) => {
69
+ const { runtime, settingsFilePath, tempRoot, cleanup } = await createRuntime({
70
+ mergePersistedSettings: (current, changes) => ({ ...current, ...changes }),
71
+ });
72
+ try {
73
+ await fsPromises.writeFile(settingsFilePath, JSON.stringify({ lastDirectory: tempRoot }));
74
+ if (writeFirst) await runtime.persistSettings({ homeDirectory: '/home/fixture' });
75
+ const settings = await runtime.readSettingsFromDiskMigrated();
76
+ expect(settings.projects).toEqual([expect.objectContaining({ id: createProjectIdFromPath(tempRoot), path: tempRoot })]);
77
+ expect((await runtime.readSettingsFromDiskMigrated()).projects).toEqual(settings.projects);
78
+ } finally { await cleanup(); }
79
+ });
80
+
39
81
  it.each([
40
82
  [{}, 'cursor-dark'],
41
83
  [{ darkThemeId: 'vitesse-dark-dark' }, 'vitesse-dark-dark'],
@@ -77,6 +119,8 @@ describe('settings runtime', () => {
77
119
  expect((await runtime.readSettingsFromDisk()).projectSortOrder).toBe('recent');
78
120
  fail = false;
79
121
  await runtime.persistSettings({ projects: [] });
122
+ expect(tips).toBe(1);
123
+ await runtime.persistSettings({ projectSortOrder: 'manual' });
80
124
  expect(tips).toBe(2);
81
125
  } finally { await cleanup(); }
82
126
  });
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-CCQj9IkL.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-BerIUSLP.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-auth-DBn9yahL.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-DlzBev0S.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/queryRuntime-2dx7jbt9.js","assets/runtime-fetch-D0YWp3FJ.js","assets/vendor-markstream-react-DfLaSG3W.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-CBjOhOI0.js","assets/desktop-BAmoc_34.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/bootstrap-C8paoQ0j.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/store-X3lU0obe.js","assets/tour-Db44qwfs.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-BWLhXqci.js","assets/gitApiHttp-MWsHNHuo.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/runtime-file-resource-BP4P52ry.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/platform-sEg2IOLZ.js","assets/vendor-sonner-BEHGipm5.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/useThemeSystem-CNzUUkFn.js","assets/tooltip-LLDL5nIZ.js","assets/url-MRa-FtQa.js","assets/useEffectiveDirectory-DzqpWUC3.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/LoadingImage-BxjJ_Xyj.js","assets/ImageLoadingPlaceholder-Dcy5lc7F.js","assets/markdownHeightCache-D6iSNJG2.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-Bdwe3qUr.js","assets/vendor-katex-DNVSTX6g.js","assets/themes-BgDJcxRc.js","assets/FadeInOnReveal-C9a7XnAh.js","assets/markdownTheme-CHNl6tUv.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-COS3jfbf.js","assets/toolHelpers-iEHVHQ9p.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-EpBnVy9J.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-vDaAPGfl.js";import{ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-CBjOhOI0.js";import{t as s}from"./useEffectiveDirectory-DzqpWUC3.js";import{i as c,n as l,t as u}from"./markdownHeightCache-D6iSNJG2.js";var d=i(),f=e(r(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.31:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-CCQj9IkL.js`),__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,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-Bdwe3qUr.js`).then(e=>e.n),__vite__mapDeps([56,1,4,5,24,25,2,3,6,7,8,9,10,11,12,13,14,41,57,20,21,22,23,26,27,28,29,30,16,31,32,33,34,35,36,37,38,39,40,42,43,44,45,55,46,58,48,49,50,51,59,54,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=n(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEZ1K7qW.js";import{ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{s as o}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as s}from"./queryRuntime-2dx7jbt9.js";import{i as c}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as l,r as u,t as d}from"./button-CBjOhOI0.js";import{Oi as f,da as p}from"./useMobileNavigationStore-BWLhXqci.js";import{n as m}from"./Icon-Bh3TaKoN.js";import{a as h,n as g,o as _,t as v}from"./dialog-Dx3IT7dQ.js";import{t as y}from"./YuriLogo-BA5FWp-g.js";import{l as b}from"./select-bKMw5JE8.js";import{n as x}from"./MarkdownRenderer-CS6Pia5D.js";import{n as S}from"./speechSettingsQueries-BDDxw8LP.js";import{n as C,t as w}from"./YuriWordmark-Cr1vkcue.js";import{a as T,c as E,d as D,f as O,g as k,i as A,r as j,t as M}from"./usePluginsStore-aZl0WTK8.js";import{c as ee,i as N,n as P,r as F,s as I,t as te}from"./VoiceSettings-BONwzGgR.js";var L=e(i(),1),R=a(),z=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ne(e,t){return e.some(e=>e.parsedKind===`npm`&&I(e.spec).name===t)}async function B(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ne(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);let r=e.filter(e=>!n.includes(e)),i=r.length?await t.active(r):[];if(!t.current())throw Error(`Runtime changed`);return{failed:n,pending:e.filter(e=>!n.includes(e)&&!i.includes(e))}}function re(e,r,i){let a=t(),o=n(),c=()=>!i.aborted&&o===n()&&a===t();return B(e,{current:c,list:async()=>(await s.fetchQuery({...T(r,a),staleTime:0})).entries,create:e=>M.getState().createEntry({spec:e,scope:`user`}),active:async e=>{let t=[];for(let n=0;n<20;n++){if(!c()||(t=await O(r,i),!c()))throw Error(`Runtime changed`);if(s.setQueryData(A(r,a).queryKey,t),e.every(e=>t.some(t=>t.source.kind===`package`&&I(t.source.target).name===e))||n===19)break;await new Promise((e,t)=>{let n=()=>{clearTimeout(r),i.removeEventListener(`abort`,n),t(Error(`Runtime changed`))},r=setTimeout(()=>{i.removeEventListener(`abort`,n),e()},750);i.addEventListener(`abort`,n,{once:!0}),i.aborted&&n()})}return t.flatMap(e=>e.source.kind===`package`&&e.state.kind===`active`?[I(e.source.target).name]:[])}})}var V=r(),H=z.map(e=>e.spec),ie=[`tour.models`,`tour.plugins`,`tour.voice`],ae=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function oe(e){let t=(0,R.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=l(),f=z[n],p=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=u(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,V.jsx)(m,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,V.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==f.name||t[8]!==a||t[9]!==v?(y=(0,V.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":f.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=f.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=p?.icon,x;t[11]!==f.name||t[12]!==b?(x=(0,V.jsx)(ee,{name:f.name,src:b,size:30}),t[11]=f.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===f.name?S=t[15]:(S=(0,V.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:f.name}),t[14]=f.name,t[15]=S);let C;t[16]===f.spec?C=t[17]:(C=(0,V.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:f.spec}),t[16]=f.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===p?T=t[22]:(T=p?.latestVersion&&(0,V.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:p.latestVersion}),t[21]=p,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,V.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==p?.description||t[29]!==c?(D=p?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=p?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,V.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!p,A;t[33]!==s||t[34]!==k?(A=(0,V.jsx)(d,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,V.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,V.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function se(e){let t=(0,R.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=l(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=P(n,o),u=c(i),d,f;t[1]!==s.saving||t[2]!==u?(d=()=>(u(s.saving),()=>u(!1)),f=[s.saving,u],t[1]=s.saving,t[2]=u,t[3]=d,t[4]=f):(d=t[3],f=t[4]),L.useEffect(d,f);let p;t[5]!==s||t[6]!==r||t[7]!==n.configured?(p=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=p):p=t[8];let m=p,h;t[9]===m?h=t[10]:(h=e=>void m(e),t[9]=m,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,V.jsx)(F,{mode:`tts`,form:s}),v=(0,V.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,V.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,V.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,V.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function U({runtime:e,onClose:r}){let{t:i}=l(),a=E(),c=C(t=>t.progress[e]?.step??0),[T,O]=L.useState(`magpie`),[k,A]=L.useState(),[M,ee]=L.useState(H.slice(1)),[P,F]=L.useState(`tour`),[I,R]=L.useState(null),[B,U]=L.useState(!1),[ce,W]=L.useState(null),le=n(),G=t(),K=L.useRef(null),q=L.useRef(!1);L.useEffect(()=>{let e=new AbortController;return K.current=e,()=>e.abort()},[]);let J=D(),Y=o({...j(a,H.slice(1),!1,G,!0),enabled:c===1}),X=o({...S(G),enabled:c===2}),ue=J.data?.entries??[],de=e=>{let t=f.getState(),n=e&&t.providers.some(t=>t.id===e);O(`other`),A(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Z=()=>!K.current?.signal.aborted&&le===n()&&G===t(),Q=t=>{F(`tour`),W(null),C.getState().move(e,t)},$=()=>{Z()&&r()},fe=()=>{c===2?$():Q(c+1)},pe=async()=>{if(!(q.current||B||!K.current)){q.current=!0,U(!0),W(null);try{let e=c===0?T===`magpie`?[H[0]]:[]:M;if(e.length){let t=await re(e,a,K.current.signal);if(!Z())return;if(t.failed.length){W(i(`tour.installFailed`,{names:t.failed.join(`, `)}));return}if(t.pending.length){W(i(`tour.activationPending`,{names:t.pending.join(`, `)}));return}}if(c===0){let e=await s.fetchQuery({...p(a,G),staleTime:0});if(!Z())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){W(i(T===`magpie`?`tour.magpieSetup`:`tour.noModels`));return}await f.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Z()&&fe()}catch{Z()&&W(i(`tour.operationFailed`))}finally{q.current=!1,Z()&&U(!1)}}},me=()=>{I===null?P===`tour`?c>0&&Q(c-1):F(`tour`):R(null)},he=I===null?void 0:Y.data?.[H[I]],ge=he?.kind===`npm-ok`?he.readme:void 0;return(0,V.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!B&&(I!==null||P!==`tour`?me():$())},children:(0,V.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,V.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,V.jsx)(y,{width:440,height:440})}),(0,V.jsx)(h,{children:(0,V.jsxs)(_,{className:`yuri-tour-title`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,V.jsxs)(L.Fragment,{children:[t>0&&(0,V.jsx)(w,{width:`2.05em`}),(0,V.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,V.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,V.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:ie.map((e,t)=>(0,V.jsxs)(d,{variant:`ghost`,size:`lg`,disabled:B,"aria-current":c===t?`step`:void 0,onClick:()=>{R(null),Q(t)},children:[(0,V.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,V.jsx)(`span`,{children:i(e)})]},e))}),(0,V.jsx)(`div`,{className:u(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,V.jsxs)(`fieldset`,{disabled:B,className:`contents`,children:[I===null?P===`providers`?(0,V.jsx)(N,{initialConnectionId:k}):P===`voice`&&X.data?(0,V.jsx)(se,{settings:X.data,onComplete:$,onBusy:U}):P===`asr`||P===`tts`?(0,V.jsx)(te,{section:P}):(0,V.jsxs)(V.Fragment,{children:[c<2&&(c===1&&Y.isError||J.isError)&&(0,V.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,V.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,V.jsx)(d,{size:`xs`,onClick:()=>{c===1&&Y.refetch(),J.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`section`,{className:u(`yuri-tour-magpie yuri-tour-select-card`,T===`magpie`&&`yuri-tour-card-selected`),children:[(0,V.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":T===`magpie`,onClick:()=>O(T===`magpie`?`other`:`magpie`),children:(0,V.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:T===`magpie`&&(0,V.jsx)(m,{name:`check`,className:`size-5`})})}),(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,V.jsx)(b,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,V.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,V.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,V.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,V.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,V.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,V.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,V.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,V.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ae.map(e=>(0,V.jsxs)(d,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>de(e.id),children:[(0,V.jsx)(b,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,V.jsx)(`span`,{children:e.name})]},e.id))}),(0,V.jsxs)(d,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>de(),children:[i(`tour.otherProvider`),(0,V.jsx)(m,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,V.jsx)(oe,{index:e,info:Y.data?.[H[e]],installed:ne(ue,H[e]),selected:M.includes(H[e]),onSelect:()=>ee(t=>t.includes(H[e])?t.filter(t=>t!==H[e]):[...t,H[e]]),onReadme:()=>R(e)},e))}),(0,V.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,V.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,V.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,V.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,V.jsxs)(`section`,{children:[(0,V.jsx)(m,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,V.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,V.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,V.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(m,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(m,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,V.jsxs)(d,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,V.jsx)(m,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(m,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,V.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,V.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,V.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(b,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(m,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(m,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,V.jsxs)(d,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,V.jsx)(m,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,V.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,V.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,V.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,V.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,V.jsx)(d,{disabled:!X.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),X.isError&&(0,V.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,V.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,V.jsx)(d,{size:`xs`,onClick:()=>void X.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[z[I].name,` · README`]}),ge?(0,V.jsx)(x,{content:ge,enableFileReferences:!1}):(0,V.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),ce&&I===null&&(0,V.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:ce})]})})]}),(0,V.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,V.jsx)(d,{variant:`ghost`,size:`sm`,disabled:B,onClick:me,children:i(`onboarding.common.actions.back`)}),I===null&&(0,V.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,V.jsx)(d,{variant:`ghost`,size:`sm`,disabled:B,onClick:fe,children:i(`tour.later`)}),c===2?(0,V.jsx)(d,{size:`sm`,disabled:B,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:$,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,V.jsxs)(d,{size:`sm`,disabled:B||!J.data||J.isError,"aria-busy":B,onClick:()=>void pe(),children:[B&&(0,V.jsx)(m,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{U as SetupTourDialog};