diff --git a/Cargo.lock b/Cargo.lock index d2ac59f1..52d2957c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1617,7 +1617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2541,7 +2541,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2718,8 +2718,7 @@ dependencies = [ [[package]] name = "kcl-api" version = "0.2.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f686362cc0bfa733c00a3ba587a922a1e4e2e86c70c88fc862b4be293ecd592e" +source = "git+https://github.com/KittyCAD/modeling-app?branch=achalmers/kcl-193-beta1#f39347b5f46e02a067f752580662a6b4128700bb" dependencies = [ "arbitrary", "euler", @@ -2734,14 +2733,14 @@ dependencies = [ "serde", "serde_json", "ts-rs", + "typed-path", "uuid", ] [[package]] name = "kcl-error" version = "0.2.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3b814c9588b41bee841bf292fa63cd2367384e3ccf056199b464e19be217f5" +source = "git+https://github.com/KittyCAD/modeling-app?branch=achalmers/kcl-193-beta1#f39347b5f46e02a067f752580662a6b4128700bb" dependencies = [ "miette", "schemars 0.8.22", @@ -4539,7 +4538,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -4607,7 +4606,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -5216,7 +5215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -5449,7 +5448,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix 1.1.2", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -5458,7 +5457,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6579,7 +6578,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 741f4adb..bae67aa6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ syn = "3.0.3" [patch.crates-io] kittycad-unit-conversion-derive = { path = "unit-conversion-derive" } -# kcl-api = { git = "https://github.com/KittyCAD/modeling-app", branch = "main" } -# kcl-error = { git = "https://github.com/KittyCAD/modeling-app", branch = "main" } +kcl-api = { git = "https://github.com/KittyCAD/modeling-app", branch = "achalmers/kcl-193-beta1" } +kcl-error = { git = "https://github.com/KittyCAD/modeling-app", branch = "achalmers/kcl-193-beta1" } [profile.bench] debug = true diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 2529ea6d..b3be7f12 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -2577,11 +2577,11 @@ ] }, "KclFile": { - "description": "Region-creation algorithm version.", + "description": "A file uploaded with a KCL project.", "type": "object", "properties": { "contents": { - "description": "Contents of the file, as UTF-8 encoded bytes.", + "description": "Raw file contents. KCL source is UTF-8; imported assets may be binary.", "type": "array", "items": { "type": "integer", diff --git a/modeling-cmds/src/exec_kcl.rs b/modeling-cmds/src/exec_kcl.rs index 8adedf8f..ed9921d6 100644 --- a/modeling-cmds/src/exec_kcl.rs +++ b/modeling-cmds/src/exec_kcl.rs @@ -2,7 +2,7 @@ use bon::Builder; use indexmap::IndexMap; #[cfg(feature = "websocket")] use kcl_api::artifact::ArtifactGraph; -use kcl_api::{kcl_value_view::KclValueView, DefaultPlanes}; +use kcl_api::{kcl_value_view::KclValueView, DefaultPlanes, Object}; use kcl_error::{CompilationIssue, KclError}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -31,7 +31,7 @@ impl KclProject { } } -/// Region-creation algorithm version. +/// A file uploaded with a KCL project. #[derive(Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default, Builder)] #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -40,7 +40,7 @@ impl KclProject { pub struct KclFile { /// Where is the file, relative to the project directory? pub path: SafeFilepath, - /// Contents of the file, as UTF-8 encoded bytes. + /// Raw file contents. KCL source is UTF-8; imported assets may be binary. #[serde( serialize_with = "serde_bytes::serialize", deserialize_with = "serde_bytes::deserialize" @@ -83,6 +83,10 @@ pub struct ExecKclProjectOk { pub issues: Vec, /// IDs of the standard planes created for this execution. pub default_planes: Option>, + /// All objects in all sketches. + pub scene_objects: Vec, + /// Which module ID was assigned to each KCL file in the project? + pub filenames: IndexMap, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)] @@ -106,13 +110,17 @@ pub struct ExecKclProjectErr { pub artifact_graph: ArtifactGraph, /// IDs of the standard planes created before execution failed. pub default_planes: Option>, - // TODO: Add fields to this as we make KCL data serializable. - // Should be a usable subset of `KclErrorWithOutputs`. + /// All objects in all sketches. + pub scene_objects: Vec, + /// Which module ID was assigned to each KCL file in the project? + pub filenames: IndexMap, } impl ExecKclProjectErr { - /// Used when the project execution had a fatal error. - pub fn fatal_error(error: KclError) -> Self { + /// Be careful using this. If you have executed a KCL program, + /// you should be building the full ExecKclProjectErr via its `build()` + /// method. This is only for errors that happen before execution. + pub fn error_before_execution(error: KclError) -> Self { Self { error: Some(error), non_fatal: Default::default(), @@ -120,6 +128,8 @@ impl ExecKclProjectErr { variables: Default::default(), artifact_graph: Default::default(), default_planes: Default::default(), + filenames: Default::default(), + scene_objects: Default::default(), } } } @@ -137,6 +147,8 @@ impl<'a> arbitrary::Arbitrary<'a> for ExecKclProjectOk { #[cfg(feature = "websocket")] variables: Default::default(), default_planes: Default::default(), + filenames: Default::default(), + scene_objects: Default::default(), }) } } @@ -151,6 +163,8 @@ impl<'a> arbitrary::Arbitrary<'a> for ExecKclProjectErr { variables: Default::default(), artifact_graph: Default::default(), default_planes: Default::default(), + scene_objects: Default::default(), + filenames: Default::default(), }) } } diff --git a/modeling-cmds/src/websocket.rs b/modeling-cmds/src/websocket.rs index b22f023a..250b6420 100644 --- a/modeling-cmds/src/websocket.rs +++ b/modeling-cmds/src/websocket.rs @@ -238,7 +238,7 @@ pub enum OkWebSocketResponseData { #[cfg(feature = "exec-kcl")] ExecKclProject { /// Result after executing KCL. - result: Result, + result: Box>, }, /// Request that the client end this connection and establish a new session