profile: remove lua profile resolver

This commit is contained in:
Keisuke Hirata 2026-07-11 04:44:32 +09:00
parent 156f8ad044
commit 254360f1ab
No known key found for this signature in database
24 changed files with 473 additions and 980 deletions

102
Cargo.lock generated
View File

@ -1060,17 +1060,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "erased-serde"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec"
dependencies = [
"serde",
"serde_core",
"typeid",
]
[[package]]
name = "errno"
version = "0.3.14"
@ -2206,25 +2195,6 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
[[package]]
name = "lua-src"
version = "550.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e836dc8ae16806c9bdcf42003a88da27d163433e3f9684c52f0301258004a4fb"
dependencies = [
"cc",
]
[[package]]
name = "luajit-src"
version = "210.6.6+707c12b"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a86cc925d4053d0526ae7f5bc765dbd0d7a5d1a63d43974f4966cb349ca63295"
dependencies = [
"cc",
"which",
]
[[package]]
name = "mac"
version = "0.1.1"
@ -2256,7 +2226,6 @@ version = "0.1.0"
dependencies = [
"arc-swap",
"llm-engine",
"mlua",
"protocol",
"secrets",
"serde",
@ -2444,39 +2413,6 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "mlua"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccd36acfa49ce6ee56d1307a061dd302c564eee757e6e4cd67eb4f7204846fab"
dependencies = [
"bstr",
"either",
"erased-serde",
"libc",
"mlua-sys",
"num-traits",
"parking_lot",
"rustc-hash",
"rustversion",
"serde",
"serde-value",
]
[[package]]
name = "mlua-sys"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f1c3a7fc7580227ece249fd90aa2fa3b39eb2b49d3aec5e103b3e85f2c3dfc8"
dependencies = [
"cc",
"cfg-if",
"libc",
"lua-src",
"luajit-src",
"pkg-config",
]
[[package]]
name = "native-tls"
version = "0.2.18"
@ -2671,15 +2607,6 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ordered-float"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c"
dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "4.6.0"
@ -3683,16 +3610,6 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde-value"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
dependencies = [
"ordered-float 2.10.1",
"serde",
]
[[package]]
name = "serde_core"
version = "1.0.228"
@ -4228,7 +4145,7 @@ dependencies = [
"nix",
"num-derive",
"num-traits",
"ordered-float 4.6.0",
"ordered-float",
"pest",
"pest_derive",
"phf 0.11.3",
@ -4744,12 +4661,6 @@ dependencies = [
"pom",
]
[[package]]
name = "typeid"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
[[package]]
name = "typenum"
version = "1.19.0"
@ -5428,7 +5339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac"
dependencies = [
"log",
"ordered-float 4.6.0",
"ordered-float",
"strsim",
"thiserror 1.0.69",
"wezterm-dynamic-derive",
@ -5458,15 +5369,6 @@ dependencies = [
"wezterm-dynamic",
]
[[package]]
name = "which"
version = "8.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81995fafaaaf6ae47a7d0cc83c67caf92aeb7e5331650ae6ff856f7c0c60c459"
dependencies = [
"libc",
]
[[package]]
name = "winapi"
version = "0.3.9"

View File

@ -1227,7 +1227,7 @@ workflow = "ticket-review-workflow"
temp.path(),
r#"
[roles.coder]
profile = "./coder.lua"
profile = "./coder.toml"
"#,
);
let context = TicketRoleLaunchContext::new(temp.path(), TicketRole::Coder);

View File

@ -7,7 +7,6 @@ license.workspace = true
[dependencies]
arc-swap = "1"
llm-engine = { workspace = true }
mlua = { version = "0.11.4", features = ["lua54", "vendored", "serialize"] }
protocol = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

View File

@ -1193,9 +1193,9 @@ model_id = "claude-sonnet-4-20250514"
let toml = MINIMAL_REQUIRED.replace(
"[engine]\n",
"[engine]\n\
[worker.tool_output]\n\
[engine.tool_output]\n\
default_max_bytes = 8192\n\n\
[worker.tool_output.per_tool]\n\
[engine.tool_output.per_tool]\n\
Read = 32768\n\
Grep = 4096\n\n\
[engine.file_upload]\n\
@ -1215,7 +1215,7 @@ model_id = "claude-sonnet-4-20250514"
let toml = MINIMAL_REQUIRED.replace(
"[engine]\n",
"[engine]\n\
[worker.tool_output]\n",
[engine.tool_output]\n",
);
let manifest = WorkerManifest::from_toml(&toml).unwrap();
let limits = &manifest.engine.tool_output;

File diff suppressed because it is too large Load Diff

View File

@ -497,7 +497,7 @@ mod tests {
);
metadata.resolved_manifest_snapshot = Some(serde_json::json!({
"worker": { "name": "profile-worker" },
"profile": { "source": { "kind": "path", "path": "/profiles/coder.lua" } }
"profile": { "source": { "kind": "path", "path": "/profiles/coder.toml" } }
}));
let json = serde_json::to_string(&metadata).unwrap();

View File

@ -526,7 +526,9 @@ impl ProfileSelectorRef {
if value.starts_with("path:")
|| value.starts_with('.')
|| value.contains('/')
|| value.ends_with(".lua")
|| value.ends_with(".dcdl")
|| value.ends_with(".json")
|| value.ends_with(".toml")
|| value.ends_with(".nix")
{
return Err("profile selector must be `inherit`, `default`, a source-qualified registry selector, or an unqualified registry selector; path selectors are not supported".to_string());
@ -1347,7 +1349,7 @@ profile = "legacy.nix"
temp.path(),
r#"
[roles.coder]
profile = "./coder.lua"
profile = "./coder.toml"
"#,
);

View File

@ -34,7 +34,7 @@
//! let fs = ScopedFs::new(scope, PathBuf::from("/workspace")); // worker lifetime
//! let tracker = Tracker::new(); // session lifetime
//! let bash_outputs = PathBuf::from("/run/yoi/bash-output");
//! let defs = core_builtin_tools(fs, tracker, bash_outputs, None);
//! let defs = core_builtin_tools(fs, tracker, bash_outputs);
//! ```
use std::collections::{HashMap, VecDeque};

View File

@ -8,7 +8,7 @@ use toml::Value;
use toml::map::Map;
const GENERATED_PROFILE_NAME: &str = "default";
const GENERATED_PROFILE_PATH: &str = "profiles/default.lua";
const GENERATED_PROFILE_PATH: &str = "profiles/default.toml";
const GENERATED_PROFILE_DESCRIPTION: &str = "Generated by yoi setup-model";
#[derive(Debug, Clone, PartialEq, Eq)]
@ -149,7 +149,7 @@ pub fn write_default_profile_config(
std::fs::create_dir_all(&profiles_dir)?;
let profile_path = config_dir.join(GENERATED_PROFILE_PATH);
std::fs::write(&profile_path, generated_profile_lua(model_ref))?;
std::fs::write(&profile_path, generated_profile_toml(model_ref))?;
let registry_path = config_dir.join("profiles.toml");
let mut document = read_registry_document(&registry_path)?;
@ -203,65 +203,63 @@ fn set_default_profile_entry(document: &mut Value) -> Result<(), Box<dyn std::er
Ok(())
}
fn generated_profile_lua(model_ref: &str) -> String {
fn generated_profile_toml(model_ref: &str) -> String {
format!(
r#"local profile = require("yoi.profile")
local scope = require("yoi.scope")
local compact = require("yoi.compact")
r#"slug = "default"
description = "Generated by yoi setup-model"
scope = "workspace_write"
return profile {{
slug = "default",
description = "Generated by yoi setup-model",
[model]
ref = "{}"
scope = scope.workspace_write(),
[session]
record_event_trace = true
session = {{
record_event_trace = true,
}},
[engine]
reasoning = "high"
worker = {{
reasoning = "high",
}},
[compaction]
kind = "tokens"
threshold = 240000
request_threshold = 270000
worker_context_max_tokens = 100000
model = {{
ref = "{}",
}},
[feature.task]
enabled = true
compaction = compact.tokens {{
threshold = 240000,
request_threshold = 270000,
worker_context_max_tokens = 100000,
}},
[feature.memory]
enabled = true
feature = {{
task = {{ enabled = true }},
memory = {{ enabled = true }},
web = {{ enabled = true }},
workers = {{ enabled = false }},
ticket = {{ enabled = false, access = "lifecycle" }},
ticket_orchestration = {{ enabled = false }},
}},
[feature.web]
enabled = true
memory = {{
extract_threshold = 50000,
consolidation_threshold_files = 5,
consolidation_threshold_bytes = 50000,
}},
[feature.workers]
enabled = false
web = {{
enabled = true,
search = {{
provider = "brave",
api_key_secret = "web/brave/default",
}},
}},
}}
[feature.ticket]
enabled = false
access = "lifecycle"
[feature.ticket_orchestration]
enabled = false
[memory]
extract_threshold = 50000
consolidation_threshold_files = 5
consolidation_threshold_bytes = 50000
[web]
enabled = true
[web.search]
provider = "brave"
api_key_secret = "web/brave/default"
"#,
escape_lua_string(model_ref)
escape_toml_string(model_ref)
)
}
fn escape_lua_string(value: &str) -> String {
fn escape_toml_string(value: &str) -> String {
value
.chars()
.flat_map(|c| match c {
@ -288,18 +286,18 @@ mod tests {
assert_eq!(written.registry_path, dir.path().join("profiles.toml"));
assert_eq!(
written.profile_path,
dir.path().join("profiles/default.lua")
dir.path().join("profiles/default.toml")
);
let registry = std::fs::read_to_string(&written.registry_path).unwrap();
assert!(registry.contains("default = \"user:default\""));
assert!(registry.contains("[profile.default]"));
assert!(registry.contains("path = \"profiles/default.lua\""));
assert!(registry.contains("path = \"profiles/default.toml\""));
let profile = std::fs::read_to_string(&written.profile_path).unwrap();
assert!(profile.contains("slug = \"default\""));
assert!(profile.contains("ref = \"codex-oauth/gpt-5.5\""));
assert!(profile.contains("scope = scope.workspace_write()"));
assert!(profile.contains("scope = \"workspace_write\""));
}
#[test]
@ -308,7 +306,7 @@ mod tests {
std::fs::write(
dir.path().join("profiles.toml"),
r#"[profile.other]
path = "profiles/other.lua"
path = "profiles/other.toml"
description = "keep me"
"#,
)
@ -318,13 +316,13 @@ description = "keep me"
let registry = std::fs::read_to_string(dir.path().join("profiles.toml")).unwrap();
assert!(registry.contains("[profile.other]"));
assert!(registry.contains("path = \"profiles/other.lua\""));
assert!(registry.contains("path = \"profiles/other.toml\""));
assert!(registry.contains("[profile.default]"));
assert!(registry.contains("default = \"user:default\""));
}
#[test]
fn escape_lua_string_escapes_quotes_and_slashes() {
assert_eq!(escape_lua_string("a\\b\"c"), "a\\\\b\\\"c");
fn escape_toml_string_escapes_quotes_and_slashes() {
assert_eq!(escape_toml_string("a\\b\"c"), "a\\\\b\\\"c");
}
}

View File

@ -664,7 +664,7 @@ mod tests {
r#"
default = "coder"
[profile]
coder = "profiles/coder.lua"
coder = "profiles/coder.toml"
"#,
)
.unwrap();
@ -692,7 +692,7 @@ coder = "profiles/coder.lua"
r#"
default = "coder"
[profile.coder]
path = "profiles/coder.lua"
path = "profiles/coder.toml"
description = "Project coder"
"#,
)

View File

@ -845,15 +845,15 @@ recursive = true
external.display()
),
);
let profile = tmp.path().join("profile.lua");
let profile = tmp.path().join("profile.toml");
write(
&profile,
r#"
local yoi = require("yoi")
return yoi.profile {
slug = "override-scope",
model = { scheme = "anthropic", model_id = "test-model" },
}
slug = "override-scope"
[model]
scheme = "anthropic"
model_id = "test-model"
"#,
);
let cli = Cli::try_parse_from([
@ -889,7 +889,7 @@ return yoi.profile {
#[test]
fn profile_uses_selected_profile() {
let tmp = TempDir::new().unwrap();
let profile = tmp.path().join("profile.lua");
let profile = tmp.path().join("profile.toml");
let cli = Cli::try_parse_from([
"yoi worker",
"--profile",
@ -1223,8 +1223,14 @@ permission = "write"
fn profile_conflicts_with_manifest_and_restore_modes() {
let segment_id = session_store::new_segment_id().to_string();
for args in [
vec!["yoi worker", "--profile", "p.lua", "--manifest", "m.toml"],
vec!["yoi worker", "--profile", "p.lua", "--session", &segment_id],
vec!["yoi worker", "--profile", "p.toml", "--manifest", "m.toml"],
vec![
"yoi worker",
"--profile",
"p.toml",
"--session",
&segment_id,
],
] {
let err = Cli::try_parse_from(args).unwrap_err();
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
@ -1233,9 +1239,9 @@ permission = "write"
#[test]
fn profile_and_worker_are_independent_startup_inputs() {
let cli =
Cli::try_parse_from(["yoi worker", "--profile", "p.lua", "--worker", "agent"]).unwrap();
assert_eq!(cli.profile.as_deref(), Some("p.lua"));
let cli = Cli::try_parse_from(["yoi worker", "--profile", "p.toml", "--worker", "agent"])
.unwrap();
assert_eq!(cli.profile.as_deref(), Some("p.toml"));
assert_eq!(cli.worker.as_deref(), Some("agent"));
}

View File

@ -243,7 +243,7 @@ impl ProtocolProviderContribution {
#[serde(rename_all = "snake_case")]
pub enum FeatureRuntimeKind {
Builtin,
LuaProfile,
Profile,
ExternalPlugin,
ProtocolProvider,
}

View File

@ -183,7 +183,9 @@ fn parse_spawn_profile_selector(raw: Option<&str>) -> Result<SpawnProfileSelecto
|| raw.starts_with("./")
|| raw.starts_with("../")
|| raw.contains('/')
|| raw.ends_with(".lua")
|| raw.ends_with(".dcdl")
|| raw.ends_with(".json")
|| raw.ends_with(".toml")
|| raw.ends_with(".nix")
{
return Err(format!(
@ -1181,25 +1183,31 @@ mod tests {
}
const CODER_PROFILE: &str = r#"
local profile = require("yoi.profile")
local scope = require("yoi.scope")
return profile {
slug = "coder",
model = { scheme = "anthropic", model_id = "coder-model" },
engine = { instruction = "$yoi/coder", language = "Coderish", max_tokens = 2222 },
scope = scope.workspace_write(),
}
slug = "coder"
scope = "workspace_write"
[model]
scheme = "anthropic"
model_id = "coder-model"
[engine]
instruction = "$yoi/coder"
language = "Coderish"
max_tokens = 2222
"#;
const REVIEWER_PROFILE: &str = r#"
local profile = require("yoi.profile")
local scope = require("yoi.scope")
return profile {
slug = "reviewer",
model = { scheme = "anthropic", model_id = "reviewer-model" },
engine = { instruction = "$yoi/reviewer", language = "Reviewerish", max_tokens = 3333 },
scope = scope.workspace_write(),
}
slug = "reviewer"
scope = "workspace_write"
[model]
scheme = "anthropic"
model_id = "reviewer-model"
[engine]
instruction = "$yoi/reviewer"
language = "Reviewerish"
max_tokens = 3333
"#;
#[test]
@ -1297,8 +1305,8 @@ return profile {
&project,
Some("reviewer"),
&[
("coder", "coder.lua", CODER_PROFILE),
("reviewer", "reviewer.lua", REVIEWER_PROFILE),
("coder", "coder.toml", CODER_PROFILE),
("reviewer", "reviewer.toml", REVIEWER_PROFILE),
],
);
let parent = parent_manifest(&project, None);
@ -1333,8 +1341,8 @@ return profile {
&project,
Some("coder"),
&[
("coder", "coder.lua", CODER_PROFILE),
("reviewer", "reviewer.lua", REVIEWER_PROFILE),
("coder", "coder.toml", CODER_PROFILE),
("reviewer", "reviewer.toml", REVIEWER_PROFILE),
],
);
let parent = parent_manifest(&project, None);
@ -1414,7 +1422,7 @@ return profile {
let available = write_project_profile_registry(
&project,
Some("reviewer"),
&[("reviewer", "reviewer.lua", REVIEWER_PROFILE)],
&[("reviewer", "reviewer.toml", REVIEWER_PROFILE)],
);
let parent = parent_manifest(&project, None);
let scope = vec![abs_rule(&delegated, Permission::Write)];
@ -1451,7 +1459,7 @@ return profile {
let available = write_project_profile_registry(
&project,
Some("reviewer"),
&[("reviewer", "reviewer.lua", REVIEWER_PROFILE)],
&[("reviewer", "reviewer.toml", REVIEWER_PROFILE)],
);
let parent = parent_manifest(&parent_root, Some(&parent_root.join("deny")));
let scope = vec![abs_rule(&delegated, Permission::Read)];
@ -1497,12 +1505,12 @@ return profile {
let available = write_project_profile_registry(
&project,
None,
&[("coder", "coder.lua", CODER_PROFILE)],
&[("coder", "coder.toml", CODER_PROFILE)],
);
let parent = parent_manifest(&project, None);
let scope = vec![abs_rule(&project, Permission::Read)];
let invalid = parse_spawn_profile_selector(Some("./reviewer.lua"))
let invalid = parse_spawn_profile_selector(Some("./reviewer.toml"))
.map_err(|msg| format!("{msg}{}", available.error_suffix()))
.unwrap_err();
assert!(invalid.contains("Use `default`, `inherit`"));
@ -1521,7 +1529,7 @@ return profile {
assert!(default_config.contains("\"name\":\"child\""));
let user_config = tmp.path().join("user-profiles.toml");
std::fs::write(&user_config, "[profile]\ncoder = \"user-coder.lua\"\n").unwrap();
std::fs::write(&user_config, "[profile]\ncoder = \"user-coder.toml\"\n").unwrap();
let project_config = project.join(".yoi/profiles.toml");
let ambiguous = AvailableProfiles {
registry: Some(
@ -1550,9 +1558,9 @@ return profile {
#[test]
fn spawn_profile_selector_rejects_path_like_values() {
for raw in [
"./reviewer.lua",
"path:./reviewer.lua",
"/tmp/reviewer.lua",
"./reviewer.toml",
"path:./reviewer.toml",
"/tmp/reviewer.toml",
"legacy.nix",
] {
let err = parse_spawn_profile_selector(Some(raw)).unwrap_err();

View File

@ -1528,7 +1528,7 @@ mod tests {
(
vec![
"--profile".to_string(),
"p.lua".to_string(),
"p.toml".to_string(),
"--session".to_string(),
segment_id,
],
@ -1537,7 +1537,7 @@ mod tests {
(
vec![
"--profile".to_string(),
"p.lua".to_string(),
"p.toml".to_string(),
"--socket".to_string(),
"/tmp/yoi/sock".to_string(),
],

View File

@ -1076,34 +1076,37 @@ mod tests {
let tmp = TempDir::new().unwrap();
let workspace = tmp.path().join("workspace");
std::fs::create_dir(&workspace).unwrap();
let profile = write_profile(tmp.path(), "mcp.lua", body);
let profile = write_profile(tmp.path(), "mcp.toml", body);
(tmp, workspace, profile)
}
fn mcp_profile() -> String {
r#"
local profile = require("yoi.profile")
return profile {
slug = "mcp-test",
model = { scheme = "anthropic", model_id = "claude-sonnet-4-20250514" },
mcp = {
stdio_server = {
{
name = "filesystem",
command = "definitely-not-spawned-during-cli-inspection",
args = { "--root", ".", "--token", "ARG_SECRET_DO_NOT_PRINT" },
env = {
inherit = { "PATH" },
set = {
SAFE_MODE = { kind = "literal", value = "SUPER_SECRET_LITERAL_DO_NOT_PRINT" },
API_TOKEN = { kind = "secret_ref", ref = "providers/mcp-token" },
FROM_ENV = { kind = "env_ref", name = "SECRET_ENV_NAME_DO_NOT_PRINT" },
},
},
},
},
},
}
slug = "mcp-test"
[model]
scheme = "anthropic"
model_id = "claude-sonnet-4-20250514"
[[mcp.stdio_server]]
name = "filesystem"
command = "definitely-not-spawned-during-cli-inspection"
args = ["--root", ".", "--token", "ARG_SECRET_DO_NOT_PRINT"]
[mcp.stdio_server.env]
inherit = ["PATH"]
[mcp.stdio_server.env.set.SAFE_MODE]
kind = "literal"
value = "SUPER_SECRET_LITERAL_DO_NOT_PRINT"
[mcp.stdio_server.env.set.API_TOKEN]
kind = "secret_ref"
ref = "providers/mcp-token"
[mcp.stdio_server.env.set.FROM_ENV]
kind = "env_ref"
name = "SECRET_ENV_NAME_DO_NOT_PRINT"
"#
.to_string()
}
@ -1194,17 +1197,19 @@ return profile {
#[test]
fn invalid_config_is_reported_as_invalid_not_silently_empty() {
let body = r#"
local profile = require("yoi.profile")
return profile {
slug = "bad-mcp",
model = { scheme = "anthropic", model_id = "claude-sonnet-4-20250514" },
mcp = {
stdio_server = {
{ name = "dup", command = "one" },
{ name = "dup", command = "two" },
},
},
}
slug = "bad-mcp"
[model]
scheme = "anthropic"
model_id = "claude-sonnet-4-20250514"
[[mcp.stdio_server]]
name = "dup"
command = "one"
[[mcp.stdio_server]]
name = "dup"
command = "two"
"#;
let (_tmp, workspace, profile) = workspace_and_profile(body);
let output = render_list(&args(&workspace, &profile, true)).unwrap();
@ -1218,11 +1223,11 @@ return profile {
#[test]
fn human_output_distinguishes_empty_and_unavailable() {
let body = r#"
local profile = require("yoi.profile")
return profile {
slug = "empty-mcp",
model = { scheme = "anthropic", model_id = "claude-sonnet-4-20250514" },
}
slug = "empty-mcp"
[model]
scheme = "anthropic"
model_id = "claude-sonnet-4-20250514"
"#;
let (_tmp, workspace, profile) = workspace_and_profile(body);
let output = render_list(&args(&workspace, &profile, false)).unwrap();

View File

@ -17,7 +17,7 @@ A Profile should not contain runtime-bound fields:
Those fields depend on one run, one parent, or one machine. Putting them in a reusable Profile makes reuse unsafe.
Yoi is Lua Profile first. Lua gives project/user authors a controlled recipe layer through host-provided `require("yoi")` modules without treating Nix as runtime authoring. Nix remains useful for packaging and development records.
Yoi Profiles are data artifacts resolved from builtin profile definitions, `profiles.toml`, Decodal source archives, or explicit JSON/TOML artifacts. Decodal is the authoring syntax used by the Workspace profile editor and Backend Runtime archive path; JSON/TOML artifacts are the low-level resolver interchange format. Runtime launch should not depend on executable profile scripts.
## Manifests
@ -33,27 +33,32 @@ For normal Profile/default startup, a workspace may add `.yoi/override.local.tom
Profiles and manifest layers may declare named local stdio MCP servers under `mcp.stdio_server`. This is a typed configuration surface only. Declaring a server does not start a subprocess, discover packages, negotiate MCP capabilities, or register tools/resources/prompts.
Example Lua Profile fragment:
Example TOML artifact fragment:
```lua
mcp = {
stdio_server = {
{
name = "filesystem",
command = "node",
args = { "server.js", "--root", "." },
cwd = { kind = "path", path = "./mcp" },
env = {
inherit = { "PATH" },
set = {
SAFE_MODE = { kind = "literal", value = "1" },
API_TOKEN = { kind = "secret_ref", ref = "providers/mcp-token" },
UPSTREAM_TOKEN = { kind = "env_ref", name = "MCP_UPSTREAM_TOKEN" },
},
},
},
},
}
```toml
[[mcp.stdio_server]]
name = "filesystem"
command = "node"
args = ["server.js", "--root", "."]
[mcp.stdio_server.cwd]
kind = "path"
path = "./mcp"
[mcp.stdio_server.env]
inherit = ["PATH"]
[mcp.stdio_server.env.set.SAFE_MODE]
kind = "literal"
value = "1"
[mcp.stdio_server.env.set.API_TOKEN]
kind = "secret_ref"
ref = "providers/mcp-token"
[mcp.stdio_server.env.set.UPSTREAM_TOKEN]
kind = "env_ref"
name = "MCP_UPSTREAM_TOKEN"
```
`command` is a direct executable name/path, not a shell string. `args` are passed as argv entries by future lifecycle code. `cwd.kind = "path"` is resolved relative to the Profile or manifest layer; omit `cwd` or use `{ kind = "inherit" }` when the lifecycle caller should choose. Environment handling is explicit: future spawn code should inherit only names listed in `env.inherit` and set only variables in `env.set`. `literal` values are for non-secret data; credentials should use `secret_ref` or explicit `env_ref`. Diagnostics and Debug output must redact env literal values and must not print secret plaintext.

View File

@ -34,12 +34,12 @@
- canonicalization/relative-path normalization;
- delegation subset checks;
- shared-scope add/remove/clear operations。
- `profile.rs` は、Lua profile behavior について特に広いカバレッジを持つ:
- 意図された `yoi.profile` API 経由の profile registration;
- legacy/global APIs の明示的な rejection;
- `profile.rs` は、profile artifact behavior について特に広いカバレッジを持つ:
- typed profile artifact registration;
- manifest-shaped/runtime authority fields の明示的な rejection;
- builtin role profile defaults と tool-policy boundaries;
- workspace/profile override precedence;
- `extend`、helper APIs、TOML loading、model catalog access、Lua module loading;
- TOML/JSON artifact loading、model catalog access;
- multiple-profile discovery、selector handling、ambiguity、exact/unique match behavior。
- `paths.rs` のテストは、pure resolver functions によって XDG/Yoi directory precedence rules をカバーしており、global environment races を避けている。
- いくつかのテストは、単なる実装機構ではなく、重要な product decisions を regression checks として符号化している。manifest/profile semantics は durable contract なので、この crate ではそれが適切である。

View File

@ -43,7 +43,7 @@ rustPlatform.buildRustPackage rec {
filter = sourceFilter;
};
cargoHash = "sha256-Pk6pRrtQlMAw2Shl+nQyX81FHQsHlKYAsxtg0M4Ya8Y=";
cargoHash = "sha256-vM2ea6W3hqnmzqOXfzQo+ZYrQBoy2Kh69vz1fkU+DIs=";
depsExtraArgs = {
# Older fetchCargoVendor utilities used crates.io's API download endpoint,

View File

@ -1,15 +0,0 @@
local p = yoi.profile.import("builtin:default")
p.slug = "coder"
p.description = "Coder role profile with bundled reusable policy"
p.worker.instruction = "$yoi/role/coder"
p.feature = {
task = { enabled = true },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = false },
ticket = { enabled = false, access = "lifecycle" },
ticket_orchestration = { enabled = false },
}
return p

View File

@ -1,14 +0,0 @@
local p = yoi.profile.import("builtin:default")
p.slug = "companion"
p.description = "Companion role profile with bundled reusable policy"
p.feature = {
task = { enabled = true },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = true },
ticket = { enabled = true, access = "lifecycle" },
ticket_orchestration = { enabled = false },
}
return p

View File

@ -1,44 +0,0 @@
return yoi.profile {
slug = "default",
description = "Default Yoi coding profile",
session = {
record_event_trace = true,
},
engine = {
reasoning = "high",
},
model = yoi.models.catalog("codex-oauth/gpt-5.5"),
compaction = yoi.compact.tokens {
threshold = 240000,
request_threshold = 270000,
worker_context_max_tokens = 100000,
},
feature = {
task = { enabled = true },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = true },
ticket = { enabled = false, access = "lifecycle" },
ticket_orchestration = { enabled = false },
},
memory = {
extract_threshold = 50000,
consolidation_threshold_files = 5,
consolidation_threshold_bytes = 50000,
},
web = {
enabled = true,
search = {
provider = "brave",
api_key_secret = "web/brave/default",
},
},
}

View File

@ -1,15 +0,0 @@
local p = yoi.profile.import("builtin:default")
p.slug = "intake"
p.description = "Intake role profile with bundled reusable policy"
p.worker.instruction = "$yoi/role/intake"
p.feature = {
task = { enabled = false },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = false },
ticket = { enabled = true, access = "lifecycle" },
ticket_orchestration = { enabled = false },
}
return p

View File

@ -1,15 +0,0 @@
local p = yoi.profile.import("builtin:default")
p.slug = "orchestrator"
p.description = "Orchestrator role profile with bundled reusable policy"
p.worker.instruction = "$yoi/role/orchestrator"
p.feature = {
task = { enabled = false },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = true },
ticket = { enabled = true, access = "lifecycle" },
ticket_orchestration = { enabled = true },
}
return p

View File

@ -1,15 +0,0 @@
local p = yoi.profile.import("builtin:default")
p.slug = "reviewer"
p.description = "Reviewer role profile with bundled reusable policy"
p.worker.instruction = "$yoi/role/reviewer"
p.feature = {
task = { enabled = false },
memory = { enabled = true },
web = { enabled = true },
workers = { enabled = false },
ticket = { enabled = false, access = "lifecycle" },
ticket_orchestration = { enabled = false },
}
return p