-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(visual-chat): harden vision-text pipeline and packaged desktop runtime #1579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Joker-of-Gotham
wants to merge
9
commits into
moeru-ai:main
Choose a base branch
from
Joker-of-Gotham:joker-of-gotham/feature/ai-visual-chat-multisource-realtime-pipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9412027
feat(visual-chat): add shared protocol and storage foundations
9f1e352
feat(visual-chat): add media core and worker runtime layers
5c64cd3
feat(visual-chat): add gateway and worker bridge services
78e99c9
feat(visual-chat): add sdk, ops tooling, and bridge plugins
25761c7
feat(visual-chat): harden vision-text pipeline and packaged desktop r…
4a3346b
Merge branch 'main' into joker-of-gotham/feature/ai-visual-chat-multi…
Joker-of-Gotham 55cc0f1
[autofix.ci] apply automated fixes
autofix-ci[bot] ab7c572
Merge remote-tracking branch 'upstream/main' into joker-of-gotham/fea…
Joker-of-Gotham 83497f1
Merge remote-tracking branch 'upstream/main' into joker-of-gotham/fea…
Joker-of-Gotham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import process from 'node:process' | ||
|
|
||
| import { spawn } from 'node:child_process' | ||
|
|
||
| const env = { ...process.env } | ||
|
|
||
| // Some Windows setups leak `ELECTRON_RUN_AS_NODE=1` into child processes. | ||
| // When that reaches `electron-vite dev`, Electron starts as plain Node.js, | ||
| // so imports like `import { BrowserWindow } from "electron"` fail at runtime. | ||
| delete env.ELECTRON_RUN_AS_NODE | ||
|
|
||
| const child = spawn('pnpm', ['exec', 'electron-vite', 'dev'], { | ||
| cwd: process.cwd(), | ||
| env, | ||
| stdio: 'inherit', | ||
| shell: true, | ||
| }) | ||
|
|
||
| let exiting = false | ||
|
|
||
| function shutdown() { | ||
| if (exiting) | ||
| return | ||
| exiting = true | ||
|
|
||
| if (process.platform === 'win32') { | ||
| // On Windows, child.kill() only kills the shell wrapper, not the | ||
| // process tree underneath. `taskkill /T` terminates the whole tree. | ||
| try { | ||
| spawn('taskkill', ['/T', '/F', '/PID', String(child.pid)], { stdio: 'ignore' }) | ||
| } | ||
| catch {} | ||
| } | ||
| else { | ||
| try { | ||
| // Negative PID sends signal to the entire process group | ||
| process.kill(-child.pid!, 'SIGTERM') | ||
| } | ||
| catch { | ||
| child.kill('SIGTERM') | ||
| } | ||
| } | ||
|
|
||
| setTimeout(() => process.exit(1), 2000).unref() | ||
| } | ||
|
|
||
| process.on('SIGINT', shutdown) | ||
| process.on('SIGTERM', shutdown) | ||
|
|
||
| child.once('error', (error) => { | ||
| console.error(error) | ||
| process.exit(1) | ||
| }) | ||
|
|
||
| child.once('exit', (code, signal) => { | ||
| if (exiting) | ||
| return process.exit(code ?? 0) | ||
|
|
||
| if (signal) { | ||
| process.kill(process.pid, signal) | ||
| return | ||
| } | ||
|
|
||
| process.exit(code ?? 1) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On non-Windows platforms,
process.kill(-child.pid!, 'SIGTERM')is used to terminate the entire process group. For this to work correctly, the child process must be spawned as a process group leader using thedetached: trueoption. Without it,child.pidis not a valid process group ID, and the signal might fail or be sent to the parent's process group.