Skip to content

Commit fc63fdc

Browse files
committed
fix(tools-runner): Replace SHINKAI env vars with HANZO branding
- SHINKAI_NODE_LOCATION → HANZO_NODE_LOCATION - SHINKAI_HOME → HANZO_HOME - SHINKAI_ASSETS → HANZO_ASSETS - SHINKAI_MOUNT → HANZO_MOUNT - SHINKAI_CONTEXT_ID → HANZO_CONTEXT_ID - SHINKAI_EXECUTION_ID → HANZO_EXECUTION_ID Fixes wallet creation errors in Zoo Desktop that showed confusing SHINKAI paths in error messages.
1 parent e1c0e98 commit fc63fdc

7 files changed

Lines changed: 55 additions & 43 deletions

File tree

hanzo-bin/hanzo-node/src/network/v2_api/api_v2_commands_jobs.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,14 @@ impl Node {
112112
}
113113
};
114114

115+
// Sanitize llm_provider to only allow alphanumeric and underscore
116+
let sanitized_provider = llm_provider.replace("-", "_").replace(" ", "_");
117+
115118
let recipient = match HanzoName::from_node_and_profile_names_and_type_and_name(
116119
node_name.node_name,
117120
"main".to_string(),
118121
HanzoSubidentityType::Agent,
119-
llm_provider,
122+
sanitized_provider,
120123
) {
121124
Ok(name) => name,
122125
Err(err) => {
@@ -233,11 +236,14 @@ impl Node {
233236
}
234237
};
235238

239+
// Sanitize llm_provider to only allow alphanumeric and underscore
240+
let sanitized_provider = llm_provider.replace("-", "_").replace(" ", "_");
241+
236242
let recipient = match HanzoName::from_node_and_profile_names_and_type_and_name(
237243
node_name.node_name,
238244
"main".to_string(),
239245
HanzoSubidentityType::Agent,
240-
llm_provider,
246+
sanitized_provider,
241247
) {
242248
Ok(name) => name,
243249
Err(err) => {

hanzo-bin/hanzo-node/src/network/v2_api/api_v2_commands_tools.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,11 +2333,14 @@ impl Node {
23332333
}
23342334
};
23352335

2336+
// Sanitize llm_provider to only allow alphanumeric and underscore
2337+
let sanitized_provider = llm_provider.replace("-", "_").replace(" ", "_");
2338+
23362339
let recipient = match HanzoName::from_node_and_profile_names_and_type_and_name(
23372340
node_name.node_name.clone(),
23382341
"main".to_string(),
23392342
HanzoSubidentityType::Agent,
2340-
llm_provider,
2343+
sanitized_provider,
23412344
) {
23422345
Ok(name) => name,
23432346
Err(err) => {

hanzo-bin/hanzo-node/src/utils/environment.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,23 @@ pub fn fetch_llm_provider_env(global_identity: String) -> Vec<SerializedLLMProvi
4949
.or_else(|_| env::var("INITIAL_LLM_PROVIDER_API_KEYS"))
5050
.unwrap_or_else(|_| "".to_string())
5151
.split(',')
52+
.filter(|s| !s.is_empty())
5253
.map(|s| s.to_string())
5354
.collect();
5455

5556
let initial_agent_urls: Vec<String> = env::var("INITIAL_AGENT_URLS")
5657
.or_else(|_| env::var("INITIAL_LLM_PROVIDER_URLS"))
5758
.unwrap_or_else(|_| "".to_string())
5859
.split(',')
60+
.filter(|s| !s.is_empty())
5961
.map(|s| s.to_string())
6062
.collect();
6163

6264
let initial_agent_models: Vec<String> = env::var("INITIAL_AGENT_MODELS")
6365
.or_else(|_| env::var("INITIAL_LLM_PROVIDER_MODELS"))
6466
.unwrap_or_else(|_| "".to_string())
6567
.split(',')
68+
.filter(|s| !s.is_empty())
6669
.map(|s| s.to_string())
6770
.collect();
6871

hanzo-libs/hanzo-tools-runner/src/tools/deno_runner.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,24 +306,24 @@ impl DenoRunner {
306306

307307
container_envs.push(String::from("-e"));
308308
container_envs.push(format!(
309-
"SHINKAI_NODE_LOCATION={}://host.docker.internal:{}",
309+
"HANZO_NODE_LOCATION={}://host.docker.internal:{}",
310310
self.options.hanzo_node_location.protocol, self.options.hanzo_node_location.port
311311
));
312312

313313
container_envs.push(String::from("-e"));
314-
container_envs.push(String::from("SHINKAI_HOME=/app/home"));
314+
container_envs.push(String::from("HANZO_HOME=/app/home"));
315315
container_envs.push(String::from("-e"));
316-
container_envs.push(format!("SHINKAI_ASSETS={}", mount_assets_env));
316+
container_envs.push(format!("HANZO_ASSETS={}", mount_assets_env));
317317
container_envs.push(String::from("-e"));
318-
container_envs.push(format!("SHINKAI_MOUNT={}", mount_env));
318+
container_envs.push(format!("HANZO_MOUNT={}", mount_env));
319319
container_envs.push(String::from("-e"));
320320
container_envs.push(format!(
321-
"SHINKAI_CONTEXT_ID={}",
321+
"HANZO_CONTEXT_ID={}",
322322
self.options.context.context_id
323323
));
324324
container_envs.push(String::from("-e"));
325325
container_envs.push(format!(
326-
"SHINKAI_EXECUTION_ID={}",
326+
"HANZO_EXECUTION_ID={}",
327327
self.options.context.execution_id
328328
));
329329

@@ -520,7 +520,7 @@ impl DenoRunner {
520520
.clone(),
521521
);
522522
command.env(
523-
"SHINKAI_NODE_LOCATION",
523+
"HANZO_NODE_LOCATION",
524524
format!(
525525
"{}://{}:{}",
526526
self.options.hanzo_node_location.protocol,
@@ -529,9 +529,9 @@ impl DenoRunner {
529529
),
530530
);
531531

532-
command.env("SHINKAI_HOME", execution_storage.home_folder_path.clone());
532+
command.env("HANZO_HOME", execution_storage.home_folder_path.clone());
533533
command.env(
534-
"SHINKAI_ASSETS",
534+
"HANZO_ASSETS",
535535
self.options
536536
.context
537537
.assets_files
@@ -541,7 +541,7 @@ impl DenoRunner {
541541
.join(","),
542542
);
543543
command.env(
544-
"SHINKAI_MOUNT",
544+
"HANZO_MOUNT",
545545
self.options
546546
.context
547547
.mount_files
@@ -552,11 +552,11 @@ impl DenoRunner {
552552
);
553553

554554
command.env(
555-
"SHINKAI_CONTEXT_ID",
555+
"HANZO_CONTEXT_ID",
556556
self.options.context.context_id.clone(),
557557
);
558558
command.env(
559-
"SHINKAI_EXECUTION_ID",
559+
"HANZO_EXECUTION_ID",
560560
self.options.context.execution_id.clone(),
561561
);
562562

hanzo-libs/hanzo-tools-runner/src/tools/deno_runner.test.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ async fn run_with_hanzo_node_location_host(
222222
"main.ts".to_string(),
223223
r#"
224224
async function run(configurations, params) {
225-
return process.env.SHINKAI_NODE_LOCATION;
225+
return process.env.HANZO_NODE_LOCATION;
226226
}
227227
"#
228228
.to_string(),
@@ -763,7 +763,7 @@ async fn file_persistence_in_home(#[case] runner_type: RunnerType) {
763763
for await (const entry of Deno.readDir("./")) {
764764
console.log(entry.name);
765765
}
766-
await Deno.writeTextFile(`${process.env.SHINKAI_HOME}/test.txt`, content);
766+
await Deno.writeTextFile(`${process.env.HANZO_HOME}/test.txt`, content);
767767
const data = { success: true };
768768
return data;
769769
}
@@ -817,7 +817,7 @@ async fn mount_file_in_mount(#[case] runner_type: RunnerType) {
817817

818818
let js_code = r#"
819819
async function run (c, p) {
820-
const mount = Deno.env.get("SHINKAI_MOUNT").split(',');
820+
const mount = Deno.env.get("HANZO_MOUNT").split(',');
821821
for await (const file of mount) {
822822
console.log("file in mount: ", file);
823823
}
@@ -877,7 +877,7 @@ async fn mount_and_edit_file_in_mount(#[case] runner_type: RunnerType) {
877877

878878
let js_code = r#"
879879
async function run (c, p) {
880-
const mount = Deno.env.get("SHINKAI_MOUNT").split(',');
880+
const mount = Deno.env.get("HANZO_MOUNT").split(',');
881881
console.log("mount", mount);
882882
await Deno.writeTextFile(mount[0], "2");
883883
return;
@@ -939,7 +939,7 @@ async fn mount_file_in_assets(#[case] runner_type: RunnerType) {
939939
"main.ts".to_string(),
940940
r#"
941941
async function run (c, p) {
942-
const assets = Deno.env.get("SHINKAI_ASSETS").split(',');
942+
const assets = Deno.env.get("HANZO_ASSETS").split(',');
943943
const content = await Deno.readTextFile(assets[0]);
944944
console.log(content);
945945
return content;
@@ -1002,7 +1002,7 @@ async fn fail_when_try_write_assets(#[case] runner_type: RunnerType) {
10021002
"main.ts".to_string(),
10031003
r#"
10041004
async function run (c, p) {
1005-
const assets = Deno.env.get("SHINKAI_ASSETS").split(',');
1005+
const assets = Deno.env.get("HANZO_ASSETS").split(',');
10061006
console.log('writing', assets[0]);
10071007
await Deno.writeTextFile(assets[0], "2");
10081008
return;
@@ -1169,8 +1169,8 @@ async fn context_and_execution_id(#[case] runner_type: RunnerType) {
11691169
let code = r#"
11701170
function run() {
11711171
return {
1172-
contextId: Deno.env.get("SHINKAI_CONTEXT_ID"),
1173-
executionId: Deno.env.get("SHINKAI_EXECUTION_ID")
1172+
contextId: Deno.env.get("HANZO_CONTEXT_ID"),
1173+
executionId: Deno.env.get("HANZO_EXECUTION_ID")
11741174
};
11751175
}
11761176
"#;

hanzo-libs/hanzo-tools-runner/src/tools/python_runner.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -629,24 +629,24 @@ print("</hanzo-code-result>")
629629

630630
container_envs.push(String::from("-e"));
631631
container_envs.push(format!(
632-
"SHINKAI_NODE_LOCATION={}://host.docker.internal:{}",
632+
"HANZO_NODE_LOCATION={}://host.docker.internal:{}",
633633
self.options.hanzo_node_location.protocol, self.options.hanzo_node_location.port
634634
));
635635

636636
container_envs.push(String::from("-e"));
637-
container_envs.push(String::from("SHINKAI_HOME=/app/home"));
637+
container_envs.push(String::from("HANZO_HOME=/app/home"));
638638
container_envs.push(String::from("-e"));
639-
container_envs.push(format!("SHINKAI_ASSETS={}", mount_assets_env));
639+
container_envs.push(format!("HANZO_ASSETS={}", mount_assets_env));
640640
container_envs.push(String::from("-e"));
641-
container_envs.push(format!("SHINKAI_MOUNT={}", mount_env));
641+
container_envs.push(format!("HANZO_MOUNT={}", mount_env));
642642
container_envs.push(String::from("-e"));
643643
container_envs.push(format!(
644-
"SHINKAI_CONTEXT_ID={}",
644+
"HANZO_CONTEXT_ID={}",
645645
self.options.context.context_id
646646
));
647647
container_envs.push(String::from("-e"));
648648
container_envs.push(format!(
649-
"SHINKAI_EXECUTION_ID={}",
649+
"HANZO_EXECUTION_ID={}",
650650
self.options.context.execution_id
651651
));
652652
container_envs.push(String::from("-e"));
@@ -845,7 +845,7 @@ print("</hanzo-code-result>")
845845
);
846846

847847
command.env(
848-
"SHINKAI_NODE_LOCATION",
848+
"HANZO_NODE_LOCATION",
849849
format!(
850850
"{}://{}:{}",
851851
self.options.hanzo_node_location.protocol,
@@ -854,9 +854,9 @@ print("</hanzo-code-result>")
854854
),
855855
);
856856

857-
command.env("SHINKAI_HOME", execution_storage.home_folder_path.clone());
857+
command.env("HANZO_HOME", execution_storage.home_folder_path.clone());
858858
command.env(
859-
"SHINKAI_ASSETS",
859+
"HANZO_ASSETS",
860860
self.options
861861
.context
862862
.assets_files
@@ -866,7 +866,7 @@ print("</hanzo-code-result>")
866866
.join(","),
867867
);
868868
command.env(
869-
"SHINKAI_MOUNT",
869+
"HANZO_MOUNT",
870870
self.options
871871
.context
872872
.mount_files
@@ -876,11 +876,11 @@ print("</hanzo-code-result>")
876876
.join(","),
877877
);
878878
command.env(
879-
"SHINKAI_CONTEXT_ID",
879+
"HANZO_CONTEXT_ID",
880880
self.options.context.context_id.clone(),
881881
);
882882
command.env(
883-
"SHINKAI_EXECUTION_ID",
883+
"HANZO_EXECUTION_ID",
884884
self.options.context.execution_id.clone(),
885885
);
886886

hanzo-libs/hanzo-tools-runner/src/tools/python_runner.test.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async fn run_with_hanzo_node_location_host(
111111
let code = r#"
112112
import os
113113
def run(configurations, parameters):
114-
return os.getenv('SHINKAI_NODE_LOCATION')
114+
return os.getenv('HANZO_NODE_LOCATION')
115115
"#;
116116

117117
let code_files = CodeFiles {
@@ -562,7 +562,7 @@ async def run(c, p):
562562
for entry in os.listdir("./"):
563563
print(entry)
564564
565-
home_path = pathlib.Path(os.environ["SHINKAI_HOME"]) / "test.txt"
565+
home_path = pathlib.Path(os.environ["HANZO_HOME"]) / "test.txt"
566566
with open(home_path, "w") as f:
567567
f.write(content)
568568
@@ -622,7 +622,7 @@ async fn mount_file_in_mount(#[case] runner_type: RunnerType) {
622622
import os
623623
624624
def run(c, p):
625-
mount = os.environ["SHINKAI_MOUNT"].split(',')
625+
mount = os.environ["HANZO_MOUNT"].split(',')
626626
for file in mount:
627627
print("file in mount: ", file)
628628
with open(mount[0]) as f:
@@ -688,7 +688,7 @@ async fn mount_and_edit_file_in_mount(#[case] runner_type: RunnerType) {
688688
import os
689689
690690
def run(c, p):
691-
mount = os.environ["SHINKAI_MOUNT"].split(',')
691+
mount = os.environ["HANZO_MOUNT"].split(',')
692692
with open(mount[0], 'w') as f:
693693
f.write("2")
694694
return None
@@ -750,7 +750,7 @@ async fn mount_file_in_assets(#[case] runner_type: RunnerType) {
750750
import os
751751
752752
def run(c, p):
753-
assets = os.environ["SHINKAI_ASSETS"].split(',')
753+
assets = os.environ["HANZO_ASSETS"].split(',')
754754
with open(assets[0]) as f:
755755
content = f.read()
756756
print(content)
@@ -924,8 +924,8 @@ import os
924924
925925
def run(configurations, params):
926926
return {
927-
'contextId': os.environ['SHINKAI_CONTEXT_ID'],
928-
'executionId': os.environ['SHINKAI_EXECUTION_ID']
927+
'contextId': os.environ['HANZO_CONTEXT_ID'],
928+
'executionId': os.environ['HANZO_EXECUTION_ID']
929929
}
930930
"#
931931
.to_string(),
@@ -1375,7 +1375,7 @@ async def run(c: CONFIG, p: INPUTS) -> OUTPUT:
13751375
from urllib.parse import urlparse
13761376
13771377
# Get home path from environment variable
1378-
home_path = os.environ.get('SHINKAI_HOME')
1378+
home_path = os.environ.get('HANZO_HOME')
13791379
output_path = os.path.join(home_path, 'output.png')
13801380
13811381
print(f"Home path: {home_path}")

0 commit comments

Comments
 (0)