Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
569 changes: 551 additions & 18 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
zen-engine = { version = "0.29" }
zen-engine = { version = "0.33.0" }
12 changes: 7 additions & 5 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tower_http::trace::TraceLayer;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use zen_engine::model::DecisionContent;
use zen_engine::{DecisionEngine, DecisionGraphResponse, EvaluationError, EvaluationOptions};
use zen_engine::{DecisionEngine, EvaluationError, EvaluationOptions};

const IS_DEVELOPMENT: bool = cfg!(debug_assertions);

Expand Down Expand Up @@ -85,26 +85,28 @@ struct SimulateRequest {
async fn simulate(
Extension(local_pool): Extension<LocalPoolHandle>,
Json(payload): Json<SimulateRequest>,
) -> Result<Json<DecisionGraphResponse>, SimulateError> {
) -> Result<Json<Value>, SimulateError> {
let engine = DecisionEngine::default();
let decision = engine.create_decision(payload.content.into());

let result = local_pool
.spawn_pinned(move || async move {
decision
.evaluate_with_opts(
&payload.context,
payload.context.into(),
EvaluationOptions {
trace: Some(true),
max_depth: None,
},
)
.await
.map(serde_json::to_value)
})
.await
.expect("Thread failed to join")?;
.expect("Thread failed to join")?
.map_err(|_| SimulateError::from(Box::new(EvaluationError::DepthLimitExceeded)))?;

return Ok(Json(result));
Ok(Json(result))
}

struct SimulateError(Box<EvaluationError>);
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,46 @@
"preview": "vite preview"
},
"dependencies": {
"@ant-design/icons": "^5.4.0",
"@gorules/jdm-editor": "^1.17.2",
"@gorules/zen-engine-wasm": "^0.8.2",
"ace-builds": "^1.36.0",
"antd": "^5.20.3",
"axios": "^1.7.5",
"@ant-design/icons": "^5.5.1",
"@gorules/jdm-editor": "^1.22.2",
"@gorules/zen-engine-wasm": "^0.12.0",
"ace-builds": "^1.36.3",
"antd": "^5.21.5",
"axios": "^1.7.7",
"graphology": "^0.25.4",
"graphology-dag": "^0.4.1",
"json5": "^2.2.3",
"react": "^18.3.1",
"react-ace": "^12.0.0",
"react-dom": "^18.3.1",
"react-router": "^6.26.1",
"react-router-dom": "^6.26.1",
"ts-pattern": "^5.3.1",
"vite-plugin-wasm": "^3.3.0"
"react-router": "^6.27.0",
"react-router-dom": "^6.27.0",
"ts-pattern": "^5.5.0",
"vite-plugin-wasm": "^3.3.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.1.7",
"@semantic-release/github": "^11.0.0",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/node": "^22.5.1",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/node": "^22.7.9",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/wicg-file-system-access": "^2023.10.5",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"@vitejs/plugin-react-swc": "^3.7.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.11",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"prettier": "^3.3.3",
"semantic-release": "^24.1.0",
"typescript": "^5.5.4",
"vite": "^5.4.2"
"semantic-release": "^24.1.3",
"typescript": "^5.6.3",
"vite": "^5.4.10"
}
}
Loading