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
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/kcl-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ kcl-error = { version = "=0.2.193", path = "../kcl-error" }
kcl-syntax = { version = "=0.2.193", path = "../kcl-syntax" }
ezpz = { workspace = true }
kittycad = { workspace = true }
kittycad-modeling-cmds = { workspace = true }
kittycad-modeling-cmds = { workspace = true, features = ["exec-kcl"] }
lazy_static = { workspace = true }
libm = "0.2.16"
miette = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rust/kcl-lib/src/engine/engine_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ impl EngineManager {
})
}

fn parse_websocket_response(
pub(crate) fn parse_websocket_response(
&self,
response: WebSocketResponse,
source_range: SourceRange,
Expand Down
6 changes: 4 additions & 2 deletions rust/kcl-lib/src/engine/engine_manager/ws_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,15 @@ impl WebSocketTransport {
Some(ToEngineReq { req, request_sent }) => {
// Decide whether to send as binary or text,
// then send to the engine.
let res = if matches!(
let send_via_binary = matches!(
&req,
WebSocketRequest::ModelingCmdReq(ModelingCmdReq {
cmd: ModelingCmd::ImportFiles { .. },
cmd_id: _,
})
) {
| WebSocketRequest::ExecKclProject { .. }
);
let res = if send_via_binary {
Self::inner_send_to_engine_binary(req, &mut tcp_write).await
} else {
Self::inner_send_to_engine(req, &mut tcp_write).await
Expand Down
19 changes: 17 additions & 2 deletions rust/kcl-lib/src/execution/id_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@ const NAMESPACE_KCL: uuid::Uuid = uuid::uuid!("8bda3118-75eb-58c7-a866-bef1dcb49
pub struct IdGenerator {
module_id: Option<ModuleId>,
next_id: u64,
namespace: Option<uuid::Uuid>,
}

impl IdGenerator {
pub fn new(module_id: Option<ModuleId>) -> Self {
Self { module_id, next_id: 0 }
Self {
module_id,
next_id: 0,
namespace: None,
}
}

/// A stable client namespace makes follow-up command IDs repeatable without
/// reusing IDs allocated by the remote interpreter.
#[cfg(not(target_arch = "wasm32"))]
pub(super) fn remote_session() -> Self {
Self {
namespace: Some(uuid::Uuid::new_v5(&NAMESPACE_KCL, b"remote-client")),
..Self::default()
}
}

pub fn next_uuid(&mut self) -> uuid::Uuid {
Expand All @@ -25,7 +40,7 @@ impl IdGenerator {
self.module_id.map(|id| id.to_string()).unwrap_or("none".to_string()),
next_id
);
let next_uuid = uuid::Uuid::new_v5(&NAMESPACE_KCL, next.as_bytes());
let next_uuid = uuid::Uuid::new_v5(self.namespace.as_ref().unwrap_or(&NAMESPACE_KCL), next.as_bytes());

self.next_id += 1;

Expand Down
2 changes: 2 additions & 0 deletions rust/kcl-lib/src/execution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ pub(crate) mod kcl_value_view;
pub(crate) mod machine;
mod memory;
mod modeling;
#[cfg(not(target_arch = "wasm32"))]
mod remote;
mod sketch_solve;
mod solver_arc;
mod state;
Expand Down
Loading
Loading