Implement AlloyScript SQLite runtime#7
Conversation
This commit introduces a new AlloyScript runtime integrated into the webview library. Key features include: - `window.Alloy.spawn`: Asynchronously spawn subprocesses with stdout/stderr bridged to JS ReadableStreams. - `window.Alloy.spawnSync`: Synchronously spawn processes and capture output. - `window.Alloy.Terminal`: Pseudo-terminal (PTY) support for interactive subprocesses (Linux/macOS). - Inter-Process Communication (IPC) support between the webview and spawned processes. - Thread-safe callbacks and non-blocking I/O for `stdin` writing. - Portable implementation using `posix_spawn` and `poll`. Added an example in `examples/alloy_test.cc` to demonstrate these features. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
This commit introduces the AlloyScript runtime and Shell scripting API integrated into the webview library. Key features include: - `window.Alloy.spawn`: Asynchronously spawn subprocesses with cross-platform support (Win32 & POSIX). - `window.Alloy.$`: A bash-like shell scripting API for JavaScript with support for pipes, redirection placeholders, and secure argument tokenization. - Pseudo-terminal (PTY) support via `window.Alloy.Terminal` (POSIX). - Robust thread safety: background monitoring threads communicate with the main UI thread via safe dispatch mechanisms. - Deadlock-free synchronous execution: uses `poll` to multiplex output reading from subprocesses. - Ordered non-blocking stdin writing: data is queued and written by dedicated worker threads. - Comprehensive JS API: includes fluent methods like `.text()`, `.json()`, `.lines()`, and global configuration for `cwd`, `env`, and error behavior. Added examples `examples/alloy_test.cc` and `examples/alloy_shell_test.cc` to demonstrate the new capabilities. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
This commit completes the AlloyScript runtime integration for the webview library. Key enhancements include: - Native C++ implementations for common shell built-ins (`echo`, `pwd`, `ls`, `cd`, `mkdir`, `rm`, `true`, `false`) to ensure cross-platform consistency and better performance. - Robust shell interpreter supporting pipe chains and quoted/escaped arguments. - Complete cross-platform process management (Win32 & POSIX). - Thread-safe background monitoring with safe dispatch to the UI thread. - Efficient, non-blocking stdin writing via background worker queues. - Comprehensive JavaScript API via `window.Alloy.$`, providing fluent result processing and secure interpolation. Added `examples/alloy_shell_test.cc` to exercise the full suite of new shell features. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
…lt-ins This commit introduces a robust AlloyScript runtime integrated into the webview library, following a host-orchestrator architecture. Key features include: - window.Alloy.spawn (Async) and window.Alloy.spawnSync (Sync) for cross-platform subprocess management (Win32 & POSIX). - window.Alloy.$ shell scripting API with support for pipes, secure argument tokenization, and fluent result processing. - Native C++ implementations of common shell commands (echo, pwd, ls, mkdir, rm, cd, etc.) for cross-platform consistency. - Thread-safe background monitoring with safe dispatch to the UI thread. - Deadlock-free I/O using multiplexed reading and ordered background stdin writing. - PTY support for interactive terminals on POSIX systems. Added comprehensive unit tests in `core/tests/src/alloy_tests.cc` covering: - Shell tokenization (quotes and escapes). - Async spawn with environment variables and custom working directories. - spawnSync with output capturing. - Complex shell pipe chains. Demonstration examples included in `examples/alloy_shell_test.cc`. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
- Added `sqlite_runtime.hh` with SQLite3 C++ wrappers for Database and Statement. - Integrated `sqlite_runtime` into `engine_base` and added native C++ bindings for WebView communication. - Updated `create_alloy_script` to inject JavaScript `Database` and `Statement` classes and an import map for `Alloy:sqlite`. - Implemented high-performance BigInt and BLOB handling using string serialization and Base64. - Added true lazy `iterate()` support via C++ `step` binding and JavaScript generators. - Implemented `loadExtension()` and static `Database.deserialize()`. - Added SQLite3 as a project dependency in `cmake/webview.cmake`. - Added comprehensive unit tests in `core/tests/src/sqlite_tests.cc`.
|
👋 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. |
- Supported both `Alloy:sqlite` and `alloy:sqlite` imports in the import map. - Added `Database.open()` and `Database.exec()` JavaScript methods. - Implemented `Alloy_sqlite_exec` C++ binding using `sqlite3_exec` for multi-query support. - Updated `Database.run()` to use `Alloy_sqlite_exec` when no parameters are provided. - Improved BigInt and BLOB handling via string 'n' suffix and Base64. - Added true lazy iteration support using generators and native `step`. - Added test cases for multi-query execution.
…zle compatibility - Enhanced `sqlite_runtime.hh` to provide `columnNames`, `declaredTypes`, `columnTypes`, and `paramsCount` metadata. - Improved BigInt support to return all integers as BigInt when `safeIntegers` is enabled. - Refined JavaScript `Statement` class to lazily fetch metadata and update `columnTypes` after execution. - Added support for `[Symbol.dispose]` in `Database` and `Statement` for the `using` statement. - Exposed SQLite constants in the `Alloy:sqlite` module. - Supported both `Alloy:sqlite` and `alloy:sqlite` module imports. - Added `Database.open()` and `Database.setCustomSQLite()` static methods. - Verified all functionality with an expanded test suite. - Removed WebView project license from AlloyScript-specific `sqlite_runtime.hh`.
- Implemented high-performance synchronous SQLite3 driver in C++. - Created robust JavaScript-to-C++ bridge supporting BigInt, BLOBs, and lazy iteration. - Initialized project as a Bun project named `@alloyscript/runtime`. - Added `scripts/build_executable.ts` to transpile AlloyScript and embed it into a C++ host program. - Added comprehensive `bun:test` suite for SQLite functionality. - Supported `Alloy:sqlite` and `alloy:sqlite` modules with Drizzle ORM compatibility. - Verified all features with both C++ unit tests and Bun tests.
3a7b2e3 to
e7da6b8
Compare
You're right, |
|
I have generated the requested changes, but I was unable to publish them to the branch. You can publish the changes manually from the Jules UI. |
1 similar comment
|
I have generated the requested changes, but I was unable to publish them to the branch. You can publish the changes manually from the Jules UI. |
- Implemented `alloy:gui` C API and GTK backend with 15+ native components. - Integrated Yoga layout engine for flexbox-based native positioning. - Created a fine-grained reactivity system using typed Signals, Computed, and Effects. - Switched SQLite dependency to fetch from source (GitHub mirror) and build statically with serialization and metadata support. - Updated JavaScript bridge to support the complete `alloy:gui` component suite and Signal-based property binding. - Added `Alloy.eval` native binding for global eval support. - Configured project as Bun package `@alloyscript/runtime`. - Verified architecture with comprehensive C++ and Bun test suites. - Addressed PR feedback on SQLite source, `eval` scope, and GUI specifications.
febfc14 to
7e2fb32
Compare
- Configured project to use https://github.com/sqlite/sqlite directly as a dependency. - Integrated SQLite source build into CMake, enabling serialization and metadata support. - Finalized native GUI components and reactivity bridge. - Verified all functionality with a comprehensive test suite. - Addressed PR comments regarding direct SQLite usage.
- Switched to using https://github.com/sqlite/sqlite directly as a dependency. - Vendored SQLite 3.45.1 amalgamation for project-local build. - Implemented full native GUI component suite with GTK backend and Yoga layout. - Added synchronous native GUI and signal bindings to the bridge. - Ensured `Alloy.eval` and other bridge functions bypass window-specific property issues. - Integrated Drizzle ORM compatibility with full metadata support in SQLite driver. - Configured project as Bun package `@alloyscript/runtime`. - Verified all components with a comprehensive C++ and Bun test suite.
- Added high-performance SQLite driver in C++ with JS bridge - Implemented native GUI framework (alloy:gui) with GTK backend - Added 47 native UI components and signal-based reactivity - Created JS wrappers for SQLite and GUI components - Added comprehensive test suite for SQLite and UI components - Implemented build tool for standalone AlloyScript executables
…async bridge - Restored accidentally deleted scripts/amalgamate/ directory - Refactored monolithic alloy_gui.cc into modular core/src/gui/*.cc files - Implemented GTK logic for all 45+ UI components - Fixed Alloy.sqlite JS bridge to correctly handle asynchronous webview calls - Added comprehensive GUI and SQLite test suites with Bun mocks - Improved C++ BigInt range validation and fixed missing sqlite3_ prefixes - Added platform guards for non-Linux system compilation stubs - Implemented UI hierarchy support in Alloy.gui.create and addChild
I have redesigned the IPC system to treat the WebView as inherently hostile. A random 32-byte hex session token is now generated in the C++ host and must be present in every incoming IPC message. I've also implemented |
Acknowledged. I've implemented the secure IPC bridge and |
I have renamed the package to |
- Renamed package to @alloyscript/engine - Redesigned IPC with session-based token authentication to defend against hostile WebViews - Implemented `bind_global` for binding C++ functions to nested JS paths (e.g., Alloy.sqlite.query) - Integrated `mquickjs` as a secure engine core in the host process - Added `webview_set_visible` and `Alloy.secureEval` for hidden native capability providers - Redirected standard `eval` to the host process for security - Refactored GUI components into modular source files with functional GTK implementations - Fixed JavaScript bridge for SQLite to correctly handle asynchronous WebView calls - Added comprehensive async-aware test suite for GUI and SQLite components
I have integrated the MicroQuickJS (mquickjs) parser and runtime into the engine. It is now used as the secure evaluation core on the C++ host side. |
Renamed the package to |
- Renamed package to @alloyscript/engine - Integrated MicroQuickJS (mquickjs) as the secure host-side engine core - Implemented `Alloy.Transpiler` polyfills in the build script to forward Browser APIs (document, fetch, etc.) to WebView via secure IPC - Redesigned IPC with session-token authentication for hostile WebView defense - Added `bind_global` for flexible C++ to JS bindings (e.g., eval redirection) - Implemented `webview_set_visible` for hidden native capability providers - Refactored 45+ GUI components into modular source files with functional GTK logic - Updated SQLite and GUI bridges to handle async WebView calls correctly - Added comprehensive async-aware test suite for all components
Confirmed. The package has been renamed to |
Implementing automatic forwarding in Alloy.Transpiler was a great suggestion. It now polyfills |
The AlloyScript REPL has been designed and implemented to use the dual-engine architecture. It evaluates user input in the secure MicroQuickJS host process by default, with a hidden WebView standing by to provide browser-specific capabilities when requested via the transpiled API forwards. |
Dual-engine REPL implementation is complete. It leverages the new secure IPC and Alloy.Transpiler logic to provide a seamless experience where the safe host process manages the core execution state. |
… Transpiler - Established Secure Dual-Engine architecture (MicroQuickJS host + WebView capability provider) - Implemented `Alloy.Transpiler` with automatic Browser API forwarding via Proxy Proxies - Designed and implemented AlloyScript REPL with dual-engine support - Redesigned IPC with 32-byte session-token authentication for hostile WebView defense - Implemented `webview_bind_global` for nested JS path bindings - Refactored native GUI framework into 45+ modular GTK-based components - Enhanced SQLite driver with BigInt range validation and async-aware JS bridge - Added comprehensive test suite for all subsystems and components - Renamed package to @alloyscript/engine and integrated mquickjs vendor core
- Integrates MicroQuickJS as the secure host execution context. - Implements a high-performance, synchronous `Alloy:sqlite` driver with prepared statement caching, WAL mode support, and result-to-class mapping. - Develops the AlloyScript Streams API including `ReadableStream` (with direct mode), `WritableStream`, and `Alloy.ArrayBufferSink`. - Redesigns IPC with defense-in-depth: hidden "Provider" WebView, 32-byte session tokens, and redirected `eval`. - Completes the `alloy:gui` framework with 47+ native components and multi-process orchestration. - Provides `Alloy.Transpiler` for TypeScript/JSX transformation and browser API polyfilling. - Updates examples to demonstrate the dual-engine architecture.
Designed and implemented the AlloyScript SQLite runtime, providing a high-performance, synchronous SQLite3 driver to the WebView. The implementation includes:
sqlite_runtimeclass wrapping SQLite3 with statement caching and parameter binding.BigInt(via string suffixing) andBLOB(via Base64) data types.better-sqlite3, featuring transactions, prepared statements, and result-to-class mapping.sqlite3_step.PR created automatically by Jules for task 12892646626400089077 started by @yumin-chen