Skip to content

Commit 4e5eb2c

Browse files
committed
fix(core): clean up unsplit rebase regressions
1 parent c21ab9a commit 4e5eb2c

5 files changed

Lines changed: 21 additions & 51 deletions

File tree

src-tauri/src/domain/modules/controller/lifecycle.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ impl<'a> LifecycleExecutor<'a> {
337337
let lifecycle_lock = module_lifecycle_lock(&self.module_id).await;
338338
let _lifecycle_guard = lifecycle_lock.lock().await;
339339
tracing::info!("Stopping module: {}", self.module_id);
340+
let script_entry_path = self.resolve_script_entry_path(manifest)?;
340341

341342
// 1. Run stop script if exists
342343
if let Some(stop_cmd) = manifest.lifecycle.as_ref().and_then(|l| l.stop.clone()) {
@@ -441,11 +442,6 @@ impl<'a> LifecycleExecutor<'a> {
441442
tokio::time::sleep(Duration::from_millis(500)).await;
442443
}
443444

444-
let script_entry_path = self.resolve_script_entry_path(manifest)?;
445-
if let Some(entry_path) = script_entry_path.as_ref() {
446-
self.kill_matching_script_processes(entry_path).await?;
447-
}
448-
449445
if self
450446
.controller
451447
.is_running(&self.module_id, self.module_path)

src/features/chat/chat.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ describe('ChatController', () => {
318318
_state: { isSending: boolean };
319319
};
320320

321-
controller.init();
321+
const initPromise = controller.init();
322322
internals._state.isSending = true;
323323
resolvePreview({
324324
data_url: 'data:image/png;base64,abc',
@@ -329,6 +329,7 @@ describe('ChatController', () => {
329329
speed: null,
330330
eta_relative: null,
331331
});
332+
await initPromise;
332333
await Promise.resolve();
333334
await Promise.resolve();
334335

src/features/chat/controllers/ChatSendController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ export class ChatSendController {
179179

180180
let streamingHandle: StreamingMessageHandle | null = null;
181181
let imageHandle: ImageGenerationHandle | null = null;
182-
let streamingHandle: StreamingMessageHandle | null = null;
183182
let shouldStopImageEngine = false;
184183

185184
try {

src/features/settings/ui/ModuleSettingsEngineRenderFlow.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -213,38 +213,4 @@ export class ModuleSettingsEngineRenderFlow {
213213
options.config,
214214
);
215215
}
216-
217-
private _renderTextFields(options: {
218-
container: HTMLElement;
219-
appId: string;
220-
config: EngineConfig | null;
221-
translate: TranslateFn;
222-
getTextFields: ModuleSettingsEngineRenderOptions['getTextFields'];
223-
}): void {
224-
const fieldTargets: Record<string, string> = {
225-
context_size: `#local-engine-context-${options.appId}`,
226-
llamacpp_system_prompt: `#local-engine-system-prompt-${options.appId}`,
227-
};
228-
229-
options.getTextFields(options.translate).forEach((field) => {
230-
const targetSelector = fieldTargets[field.key];
231-
if (targetSelector === undefined) {
232-
// eslint-disable-next-line no-console
233-
console.warn(
234-
`[ModuleSettingsEngineRenderFlow] Missing target for text field "${field.key}" in ${options.appId}`,
235-
);
236-
return;
237-
}
238-
const target = options.container.querySelector(targetSelector);
239-
if (!(target instanceof HTMLElement)) {
240-
return;
241-
}
242-
243-
this._deps.renderFieldRow(target, {
244-
...field,
245-
appId: options.appId,
246-
config: options.config,
247-
});
248-
});
249-
}
250216
}

src/infrastructure/tauri/TauriProvider.test.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,22 @@ function setupWebMode(): {
4343
win: Record<string, unknown>;
4444
origInternals: unknown;
4545
provider: TauriProvider;
46+
openExternal: ReturnType<typeof vi.fn>;
4647
} {
4748
const win = globalThis as unknown as Record<string, unknown>;
4849
const origInternals = win['__TAURI_INTERNALS__'];
4950
delete win['__TAURI_INTERNALS__'];
51+
const openExternal = vi.fn();
5052

51-
return { win, origInternals, provider: new TauriProvider(createTracer()) };
53+
return {
54+
win,
55+
origInternals,
56+
openExternal,
57+
provider: new TauriProvider(createTracer(), {
58+
hasTauriGlobals: () => false,
59+
openExternal,
60+
}),
61+
};
5262
}
5363

5464
import { TauriProvider } from '@/infrastructure/tauri/TauriProvider';
@@ -413,12 +423,11 @@ describe('TauriProvider', () => {
413423
await expect(provider.writeToClipboard('copied text')).rejects.toThrow('denied');
414424
});
415425

416-
it('should reject in web mode', async () => {
426+
it('should use browser clipboard fallback in web mode', async () => {
417427
const { provider: webProvider } = setupWebMode();
418428

419-
await expect(webProvider.writeToClipboard('text')).rejects.toThrow(
420-
'Clipboard write is unavailable outside Tauri',
421-
);
429+
await expect(webProvider.writeToClipboard('text')).resolves.toBeUndefined();
430+
expect(mockedTauriInvoke).not.toHaveBeenCalled();
422431
});
423432
});
424433

@@ -461,12 +470,11 @@ describe('TauriProvider', () => {
461470
});
462471
});
463472

464-
it('should reject outside Tauri', async () => {
465-
const { provider: webProvider } = setupWebMode();
473+
it('should use the runtime fallback outside Tauri', async () => {
474+
const { provider: webProvider, openExternal } = setupWebMode();
466475

467-
await expect(webProvider.openUrl('https://example.com')).rejects.toThrow(
468-
'External URL opening is unavailable outside Tauri',
469-
);
476+
await expect(webProvider.openUrl('https://example.com')).resolves.toBeUndefined();
477+
expect(openExternal).toHaveBeenCalledWith('https://example.com');
470478
});
471479
});
472480

0 commit comments

Comments
 (0)