Refactor to QuickJS Integration and Update Documentation

- Replaced TDLib references with QuickJS in the CLAUDE.md documentation.
- Updated service paths and imports in the Rust codebase to reflect the transition to QuickJS.
- Added a new bootstrap.js file for QuickJS runtime, providing necessary browser-like API shims.
- Enhanced the TODO list with tasks for allowing bundling of unverified skills and coding new skills independently.
- Introduced a new storage layer for IndexedDB emulation and updated related operations for QuickJS compatibility.
This commit is contained in:
Steven Enamakel
2026-02-06 11:24:57 +05:30
parent 5ea8aaabef
commit 890b20e876
17 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ Advanced JavaScript execution engine for skills using V8 (via deno_core):
- `log_bridge.rs` — Structured logging from skills
- `cron_bridge.rs` — Cron job scheduling and management
**TDLib Integration (`src-tauri/src/services/tdlib_v8/`):**
**Quickjs Integration (`src-tauri/src/services/quickjs/`):**
- `service.rs` — High-level TDLib client management with V8 integration
- `bootstrap.js` — V8 JavaScript bootstrap environment
+2
View File
@@ -12,3 +12,5 @@ todo
[] - get background proceeses done
[] - get ai to summarize messages in the device and upload to the cloud
[] - get all the remaining skills working
[] - allow bundling of unverified skills
[] - allow for new skills to be coded on their own
+1 -1
View File
@@ -15,7 +15,7 @@ use crate::runtime::preferences::PreferencesStore;
use crate::runtime::skill_registry::SkillRegistry;
use crate::runtime::types::{events, SkillSnapshot, SkillStatus, ToolResult};
use crate::runtime::qjs_skill_instance::{BridgeDeps, QjsSkillInstance};
use crate::services::tdlib_v8::storage::IdbStorage;
use crate::services::quickjs_libs::storage::IdbStorage;
/// The central runtime engine using QuickJS.
pub struct RuntimeEngine {
+3 -3
View File
@@ -21,7 +21,7 @@ use crate::runtime::skill_registry::SkillRegistry;
use crate::runtime::types::{
SkillConfig, SkillMessage, SkillSnapshot, SkillStatus, ToolContent, ToolDefinition, ToolResult,
};
use crate::services::tdlib_v8::{qjs_ops, IdbStorage};
use crate::services::quickjs_libs::{qjs_ops, IdbStorage};
/// Dependencies passed to a skill instance for bridge installation.
#[allow(dead_code)]
@@ -109,7 +109,7 @@ impl QjsSkillInstance {
state.write().status = SkillStatus::Initializing;
// Create storage
let storage = match IdbStorage::new(&data_dir) {
let storage: IdbStorage = match IdbStorage::new(&data_dir) {
Ok(s) => s,
Err(e) => {
let mut s = state.write();
@@ -191,7 +191,7 @@ impl QjsSkillInstance {
}
// Load bootstrap
let bootstrap_code = include_str!("../services/tdlib_v8/bootstrap.js");
let bootstrap_code = include_str!("../services/quickjs-libs/bootstrap.js");
if let Err(e) = js_ctx.eval::<rquickjs::Value, _>(bootstrap_code) {
let detail = format_js_exception(&js_ctx, &e);
return Err(format!("Bootstrap failed: {detail}"));
+2 -1
View File
@@ -5,7 +5,8 @@ pub mod socket_service;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub mod tdlib;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub mod tdlib_v8;
#[path = "quickjs-libs/mod.rs"]
pub mod quickjs_libs;
#[cfg(desktop)]
pub mod notification_service;
@@ -976,7 +976,8 @@ globalThis.tdlib = {
* @returns {Promise<object>} TDLib response object.
*/
send: async function (request) {
return await __ops.tdlib_send(request);
const resultJson = await __ops.tdlib_send(JSON.stringify(request));
return JSON.parse(resultJson);
},
/**
@@ -985,7 +986,8 @@ globalThis.tdlib = {
* @returns {Promise<object|null>} Update object or null if timeout.
*/
receive: async function (timeoutMs = 1000) {
return await __ops.tdlib_receive(timeoutMs);
const resultJson = await __ops.tdlib_receive(timeoutMs);
return resultJson ? JSON.parse(resultJson) : null;
},
/**
@@ -24,7 +24,7 @@ use parking_lot::RwLock;
use rquickjs::{Ctx, Object, Result as JsResult};
use std::sync::Arc;
use crate::services::tdlib_v8::storage::IdbStorage;
use crate::services::quickjs_libs::storage::IdbStorage;
use types::SkillContext as SC;
/// Register all ops on `globalThis.__ops`.
@@ -3,7 +3,7 @@
use rquickjs::{Ctx, Function, Object};
use super::types::{js_err, SkillContext};
use crate::services::tdlib_v8::storage::IdbStorage;
use crate::services::quickjs_libs::storage::IdbStorage;
pub fn register<'js>(ctx: &Ctx<'js>, ops: &Object<'js>, storage: IdbStorage, skill_context: SkillContext) -> rquickjs::Result<()> {
// ========================================================================