juglans 0.1.0

Compiler and runtime for Juglans Workflow Language (JWL)
Documentation
// src/services/interface.rs
use async_trait::async_trait;
use serde_json::Value;
use anyhow::Result;
use crate::services::jug0::ChatOutput;

/// 定义 JWL 运行时所需的外部能力接口
/// 这使得执行器可以运行在 CLI (通过 HTTP)、Server (直接调用) 或 WASM (通过 JS 回调) 环境中
#[async_trait]
pub trait JuglansRuntime: Send + Sync {
    /// 核心对话能力
    async fn chat(
        &self, 
        agent_config: Value, 
        messages: Vec<Value>, 
        tools: Option<Vec<Value>>,
        chat_id: Option<&str>
    ) -> Result<ChatOutput>;

    /// 资源加载能力:获取提示词内容
    async fn fetch_prompt(&self, slug: &str) -> Result<String>;

    /// 记忆能力:语义搜索
    async fn search_memories(&self, query: &str, limit: u64) -> Result<Vec<Value>>;
}