Conversation
This commit introduces a comprehensive `window.meta` runtime that allows managing child processes, terminal sessions (PTY), and inter-process communication directly from JavaScript within a WebView. Key features implemented: - Asynchronous and synchronous process spawning (`meta.spawn`, `meta.spawnSync`). - Standard I/O redirection with `ReadableStream` for output and `FileSink`/`ReadableStream` support for input. - Pseudo-terminal (PTY) support on POSIX platforms using `forkpty`. - Inter-process communication (IPC) channel via specialized file descriptors. - Resource usage reporting after process exit. - Support for `cwd` and environment variable configuration. - Robust bridge architecture using Base64 encoding for binary-safe I/O data transfer. - Cross-platform C++ backend for both POSIX and Windows. Integration: - The runtime is automatically initialized for all WebView instances. - Standard internal bindings are registered to bridge high-level JS calls to native implementation. - Injected bootstrap script defines the full MetaScript API surface. Testing: - Added a new example `examples/meta_demo.cc` demonstrating real-world usage. - Added unit tests for MetaScript-related JSON parsing logic. - Verified low-level logic with standalone test drivers.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Introduces AlloyScript, a powerful runtime for process management, terminal emulation, and inter-process communication within WebView. Key Changes: - Renamed MetaScript to AlloyScript across the entire codebase. - Initialized the repository as a Bun project named @alloyscript/runtime. - Implemented `alloy.spawn` and `alloy.spawnSync` (returning Promises) with full standard I/O redirection support. - Added POSIX PTY support via `forkpty` and Windows process support via `CreateProcess`. - Ensured binary safety for I/O data by using Base64 encoding across the JavaScript bridge. - Implemented resource usage reporting with unit normalization for macOS. - Provided `scripts/build_alloy.ts` to transpile source code using `Bun.build` and embed it into a C++ host program. - Added comprehensive test suites for `spawn` and `sqlite` using `bun:test`. - Integrated the runtime into `webview::webview` with automatic bootstrap injection. The runtime allows developers to build high-performance desktop applications using standard web technologies and powerful native capabilities.
e7da6b8 to
cbbdee4
Compare
The MetaScript runtime provides a powerful set of APIs for child process management within the WebView. It uses
posix_spawnandforkptyon POSIX systems andCreateProcesson Windows. The JavaScript API is designed to be modern, usingReadableStreamfor data handling and providing both async and sync (via promise) interfaces for process spawning. Binary data safety is ensured by encoding process output to Base64 before passing it through the JavaScript bridge.PR created automatically by Jules for task 779065255095859415 started by @yumin-chen