From 4c9c0fe343a13aefc741f749033ce7998afdcbb7 Mon Sep 17 00:00:00 2001 From: Farewell Date: Tue, 10 Mar 2026 10:38:47 +0800 Subject: [PATCH 1/5] fix: prevent Chinese IME Enter from triggering message send On macOS native Chinese IME, compositionend fires before keydown(Enter) when confirming English text, causing isComposing to be false when Enter is handled. Delay the compositionend state reset with setTimeout(0) so the Enter keydown in the same event loop is still suppressed. --- src/components/ai-elements/prompt-input.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/ai-elements/prompt-input.tsx b/src/components/ai-elements/prompt-input.tsx index 599de7c0..3a9f54e9 100644 --- a/src/components/ai-elements/prompt-input.tsx +++ b/src/components/ai-elements/prompt-input.tsx @@ -678,7 +678,7 @@ export const PromptInput = ({ } } }, - // eslint-disable-next-line react-hooks/exhaustive-deps -- cleanup only on unmount; filesRef always current + [usingProvider] ); @@ -920,7 +920,12 @@ export const PromptInputTextarea = ({ [attachments] ); - const handleCompositionEnd = useCallback(() => setIsComposing(false), []); + const handleCompositionEnd = useCallback(() => { + // Delay resetting isComposing so that the Enter keydown fired + // right after compositionend (macOS Chinese IME confirming + // English text) is still suppressed. + setTimeout(() => setIsComposing(false), 0); + }, []); const handleCompositionStart = useCallback(() => setIsComposing(true), []); const controlledProps = controller From 093f66dac57bf74a1c3bd697f96d6428655a6327 Mon Sep 17 00:00:00 2001 From: Farewell Date: Tue, 10 Mar 2026 18:30:49 +0800 Subject: [PATCH 2/5] chore: ignore runtime logs and local fork icons --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 49e282b5..52145f71 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,10 @@ next-env.d.ts # user uploads (runtime data) .codepilot-uploads/ + +# runtime logs +/logs/ + +# local fork icons (not upstream) +src/app/apple-icon.png +src/app/icon.png From bee1aebcd004f695772cf7b93bfee7b2d23b54af Mon Sep 17 00:00:00 2001 From: Farewell Date: Sun, 15 Mar 2026 20:27:40 +0800 Subject: [PATCH 3/5] fix: bridge auto-start not working in web server deployment Add Next.js instrumentation hook to trigger bridge auto-start on server startup. Previously auto-start only worked in Electron (main process sent POST to /api/bridge), so launchd/web deployments required manual start. --- src/instrumentation.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/instrumentation.ts diff --git a/src/instrumentation.ts b/src/instrumentation.ts new file mode 100644 index 00000000..3b8bdea1 --- /dev/null +++ b/src/instrumentation.ts @@ -0,0 +1,17 @@ +/** + * Next.js instrumentation hook — runs once when the server starts. + * Used to trigger bridge auto-start without relying on Electron. + */ +export async function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + // Delay to let the database and other infrastructure initialize + setTimeout(async () => { + try { + const { tryAutoStart } = await import('@/lib/bridge/bridge-manager'); + tryAutoStart(); + } catch (err) { + console.error('[instrumentation] Bridge auto-start failed:', err); + } + }, 3000); + } +} From b6da4780bc0b4cdf47781bd1516c4637af8295ce Mon Sep 17 00:00:00 2001 From: Farewell Date: Tue, 10 Mar 2026 10:38:47 +0800 Subject: [PATCH 4/5] fix: prevent Chinese IME Enter from triggering message send On macOS native Chinese IME, compositionend fires before keydown(Enter) when confirming English text, causing isComposing to be false when Enter is handled. Delay the compositionend state reset with setTimeout(0) so the Enter keydown in the same event loop is still suppressed. --- src/components/ai-elements/prompt-input.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/ai-elements/prompt-input.tsx b/src/components/ai-elements/prompt-input.tsx index 8acb21d8..cc4e796a 100644 --- a/src/components/ai-elements/prompt-input.tsx +++ b/src/components/ai-elements/prompt-input.tsx @@ -678,7 +678,7 @@ export const PromptInput = ({ } } }, - // eslint-disable-next-line react-hooks/exhaustive-deps -- cleanup only on unmount; filesRef always current + [usingProvider] ); @@ -920,7 +920,12 @@ export const PromptInputTextarea = ({ [attachments] ); - const handleCompositionEnd = useCallback(() => setIsComposing(false), []); + const handleCompositionEnd = useCallback(() => { + // Delay resetting isComposing so that the Enter keydown fired + // right after compositionend (macOS Chinese IME confirming + // English text) is still suppressed. + setTimeout(() => setIsComposing(false), 0); + }, []); const handleCompositionStart = useCallback(() => setIsComposing(true), []); const controlledProps = controller From 37c8720e30de81ab1bc8996d1e560389c95bcc0d Mon Sep 17 00:00:00 2001 From: Farewell Date: Sun, 15 Mar 2026 20:27:40 +0800 Subject: [PATCH 5/5] fix: bridge auto-start not working in web server deployment Add Next.js instrumentation hook to trigger bridge auto-start on server startup. Previously auto-start only worked in Electron (main process sent POST to /api/bridge), so launchd/web deployments required manual start. --- src/instrumentation.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/instrumentation.ts diff --git a/src/instrumentation.ts b/src/instrumentation.ts new file mode 100644 index 00000000..3b8bdea1 --- /dev/null +++ b/src/instrumentation.ts @@ -0,0 +1,17 @@ +/** + * Next.js instrumentation hook — runs once when the server starts. + * Used to trigger bridge auto-start without relying on Electron. + */ +export async function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + // Delay to let the database and other infrastructure initialize + setTimeout(async () => { + try { + const { tryAutoStart } = await import('@/lib/bridge/bridge-manager'); + tryAutoStart(); + } catch (err) { + console.error('[instrumentation] Bridge auto-start failed:', err); + } + }, 3000); + } +}