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: 0 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/rocm-dash-collectors/src/lemonade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ mod tests {
assert!(collector.fetch_stats().await.is_err());
}

/// Integration-gated: scrape a REAL local Lemonade server (start it first via
/// `rocm skill run install-lemonade --apply`). Not run in CI.
/// Integration-gated: scrape a REAL local Lemonade server (install the engine
/// with `rocm engines install lemonade` and start it first). Not run in CI.
#[tokio::test]
#[ignore = "requires a running Lemonade server on :13305"]
async fn live_lemonade_scrape_produces_instance() {
Expand Down
3 changes: 1 addition & 2 deletions crates/rocm-dash-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ path = "src/lib.rs"

[dependencies]
rocm-dash-core = { path = "../rocm-dash-core" }
rocm-deps = { path = "../rocm-deps" }
# Unified dashboard TUI base: ratatui 0.30 + crossterm 0.28. This is the only
# ratatui in the workspace — the `rocm` binary no longer carries a (dead) 0.29
# dependency, so no second major is pulled in. Exact wrapped-row counts must
Expand All @@ -36,7 +35,7 @@ color-eyre = "0.6"
anyhow = "1"
chrono = { version = "0.4", features = ["serde"] }
thiserror = "2"
# Skill manifests are TOML (the external-team contribution contract).
# `app/chat.rs` serializes the chat endpoint back into the dashboard config.
toml = "1.1"
async-trait = "0.1"
# Header types for the custom auth header some gateways require (e.g. APIM's
Expand Down
28 changes: 16 additions & 12 deletions crates/rocm-dash-tui/src/agent/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ where
let fired: FiredLog = Arc::new(Mutex::new(Vec::new()));

let agent = apply_inference_params(agent, params);
// Telemetry + skill registry tools (shared registration site).
// Telemetry tools (shared registration site).
let agent = register_telemetry_tools(agent, &snap, &fired);
// Read-only ROCm machine-inspection tools (forward across the seam).
let agent = register_rocm_read_tools(agent, executor, &fired);
Expand Down Expand Up @@ -1703,11 +1703,11 @@ mod tests {
// `run_agent_request_registers_tool_sets_and_enforces_turn_limit` below
// asserts those tools are actually sent on the wire from that one site.
//
// Telemetry/skill set: register_telemetry_tools registers exactly the
// Telemetry set: register_telemetry_tools registers exactly the
// SKILL_NAMES tools (GpuStatus, ListInstances, BenchSummary,
// TokensPerWatt, ListSkills, SkillPlan). Pinning the size here means the
// telemetry registration can't silently diverge from the canonical set.
assert_eq!(SKILL_NAMES.len(), 6, "canonical telemetry/skill set size");
// TokensPerWatt). Pinning the size here means the telemetry
// registration can't silently diverge from the canonical set.
assert_eq!(SKILL_NAMES.len(), 4, "canonical telemetry set size");
for n in SKILL_NAMES {
assert!(!n.is_empty(), "empty telemetry/skill tool name");
// Telemetry tools are disjoint from both ROCm sets.
Expand Down Expand Up @@ -1803,16 +1803,20 @@ mod tests {
.iter()
.map(|t| t.name.as_str())
.collect();
for expected in SKILL_NAMES
// Exactly the canonical registry reaches the model: nothing registered
// outside the three name tables (the retired `list_skills` and
// `skill_plan` included), and nothing in them left unregistered. A new
// tool is added to its table in the same change, which keeps this true.
let expected_tool_names: std::collections::BTreeSet<&str> = SKILL_NAMES
.iter()
.chain(ROCM_READ_TOOL_NAMES.iter())
.chain(ROCM_MUTATING_TOOL_NAMES.iter())
{
assert!(
sent_tool_names.contains(expected),
"registered tool {expected} missing from the wire request"
);
}
.copied()
.collect();
assert_eq!(
sent_tool_names, expected_tool_names,
"the tool names sent on the wire must equal the canonical registry"
);

// Sanity bound on the request count: enough to have tried every
// scripted turn up to the limit, not an early bail-out or a runaway
Expand Down
7 changes: 3 additions & 4 deletions crates/rocm-dash-tui/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ pub use tools::{
AutomationsRocmTool, BenchSummaryTool, BridgeSnapshotRocmTool, DoctorRocmTool, EnginesRocmTool,
ExamineRocmTool, GpuSnapshotRocmTool, GpuStatusArgs, GpuStatusTool, InstallEngineRocmTool,
InstallSdkDryRunRocmTool, InstallSdkRocmTool, LaunchServerRocmTool, ListInstancesTool,
ListSkillsTool, NaturalLanguagePlanRocmTool, NoArgs, PathExistsRocmTool, PortStatusRocmTool,
NaturalLanguagePlanRocmTool, NoArgs, PathExistsRocmTool, PortStatusRocmTool,
ROCM_MUTATING_TOOL_NAMES, ROCM_READ_TOOL_NAMES, RocmCommandRocmTool, SKILL_NAMES,
ServiceLogsRocmTool, ServicesRocmTool, SkillPlanArgs, SkillPlanTool, StopServerRocmTool,
TokensPerWattTool, ToolError, UpdateCheckRocmTool, WatcherDisableRocmTool,
WatcherEnableRocmTool,
ServiceLogsRocmTool, ServicesRocmTool, StopServerRocmTool, TokensPerWattTool, ToolError,
UpdateCheckRocmTool, WatcherDisableRocmTool, WatcherEnableRocmTool,
};

/// One-shot request budget. A hung backend becomes a timeout error turn, never
Expand Down
170 changes: 25 additions & 145 deletions crates/rocm-dash-tui/src/agent/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,90 +178,12 @@ impl Tool for TokensPerWattTool {
}
}

/// Read-only tool exposing the rocm-dash **skills** registry (auto-config / auto-install).
///
/// The agent can list skills and fetch a skill's dry-run plan;
/// it never executes a skill (execution is `--apply`-gated in the CLI).
pub struct ListSkillsTool {
pub fired: FiredLog,
}

impl Tool for ListSkillsTool {
const NAME: &'static str = "list_skills";
type Error = ToolError;
type Args = NoArgs;
type Output = Value;

async fn definition(&self, _prompt: String) -> ToolDefinition {
ToolDefinition {
name: Self::NAME.to_string(),
description: "List the available rocm-dash skills (auto-config / \
auto-install helpers like install-lemonade and \
auto-config-endpoint) the user can run."
.to_string(),
parameters: json!({ "type": "object", "properties": {} }),
}
}

async fn call(&self, _args: Self::Args) -> Result<Self::Output, Self::Error> {
record(&self.fired, Self::NAME);
let skills: Vec<Value> = crate::skills::builtin_skills()
.iter()
.map(|s| json!({ "name": s.name, "description": s.description }))
.collect();
Ok(json!({ "skills": skills, "skill_count": skills.len() }))
}
}

/// Read-only tool returning a skill's ordered dry-run plan (no execution).
pub struct SkillPlanTool {
pub fired: FiredLog,
}

#[derive(Debug, Deserialize, Default)]
pub struct SkillPlanArgs {
pub name: String,
}

impl Tool for SkillPlanTool {
const NAME: &'static str = "skill_plan";
type Error = ToolError;
type Args = SkillPlanArgs;
type Output = Value;

async fn definition(&self, _prompt: String) -> ToolDefinition {
ToolDefinition {
name: Self::NAME.to_string(),
description: "Show the ordered dry-run step plan for a named skill \
WITHOUT executing it. Use after list_skills."
.to_string(),
parameters: json!({
"type": "object",
"properties": {
"name": { "type": "string", "description": "Skill name, e.g. install-lemonade." }
},
"required": ["name"]
}),
}
}

async fn call(&self, args: Self::Args) -> Result<Self::Output, Self::Error> {
record(&self.fired, Self::NAME);
match crate::skills::builtin_skill(&args.name) {
Some(m) => Ok(json!({ "name": m.name, "plan": crate::skills::build_plan(&m) })),
None => Ok(json!({ "error": format!("unknown skill: {}", args.name) })),
}
}
}

/// All Skill names, for definition/uniqueness checks and docs.
pub const SKILL_NAMES: [&str; 6] = [
pub const SKILL_NAMES: [&str; 4] = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: SKILL_NAMES (and its doc comment above, "All Skill names") now holds only the four telemetry tools, so the name is misleading with the skills subsystem gone. Consider TELEMETRY_TOOL_NAMES in a follow-up; docs/architecture.md also still refers to "Skill" wrappers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the name no longer fits now that the skills subsystem is gone. I kept this PR to the removal and filed the rename plus the remaining "Skill" wording in the docs and comments as ROCMAI-864, so it can go in as one focused change.

On dropping retired_skill_registry_tools_are_not_advertised: I would keep it for now. The wire-level assertion compares what the model receives against the name tables, so if someone re-registered a retired tool and added its name to SKILL_NAMES in the same change, the exact-set check would still pass. The unit test pins the retired names out of the tables themselves. I am happy to fold it into the exact-set check as part of the rename if you would rather have a single assertion.

GpuStatusTool::NAME,
ListInstancesTool::NAME,
BenchSummaryTool::NAME,
TokensPerWattTool::NAME,
ListSkillsTool::NAME,
SkillPlanTool::NAME,
];

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -708,17 +630,15 @@ where
})
}

/// Register the telemetry + skill registry tools (GpuStatus, ListInstances,
/// BenchSummary, TokensPerWatt — snapshot-backed; ListSkills, SkillPlan —
/// read-only registry) on a fresh Rig `AgentBuilder`, cloning the snapshot +
/// shared `fired` log into each. Kept generic over the builder's completion
/// model + preamble so all three backends (RigAgentClient, ChatGptAgentClient,
/// AnthropicAgentClient) reuse one registration site (DRY — the tool list lives
/// in exactly one place, mirroring [`register_rocm_read_tools`]). Takes the base
/// builder (`NoToolConfig`) and returns it in `WithBuilderTools` because the
/// first `.tool()` transitions the type-state; the ROCm read/mutating
/// registrations chain after it. Note: ListSkillsTool/SkillPlanTool take only
/// `fired`; the other four take `snap` + `fired`.
/// Register the telemetry tools (GpuStatus, ListInstances, BenchSummary,
/// TokensPerWatt — all snapshot-backed) on a fresh Rig `AgentBuilder`, cloning
/// the snapshot + shared `fired` log into each. Kept generic over the builder's
/// completion model + preamble so all three backends (RigAgentClient,
/// ChatGptAgentClient, AnthropicAgentClient) reuse one registration site (DRY —
/// the tool list lives in exactly one place, mirroring
/// [`register_rocm_read_tools`]). Takes the base builder (`NoToolConfig`) and
/// returns it in `WithBuilderTools` because the first `.tool()` transitions the
/// type-state; the ROCm read/mutating registrations chain after it.
pub(super) fn register_telemetry_tools<M, P>(
builder: rig::agent::AgentBuilder<M, P>,
snap: &Arc<StateSnapshot>,
Expand All @@ -745,22 +665,15 @@ where
snap: snap.clone(),
fired: fired.clone(),
})
// Skills registry tools (read-only: list + dry-run plan; never execute).
.tool(ListSkillsTool {
fired: fired.clone(),
})
.tool(SkillPlanTool {
fired: fired.clone(),
})
}

/// Register every read-only ROCm tool on a Rig `AgentBuilder`, cloning the
/// optional executor + the shared `fired` log into each. Kept generic over the
/// builder's completion model + preamble so all three backends (the
/// OpenAI-compatible, ChatGPT, and Anthropic paths) reuse one registration
/// site (DRY — the tool list lives in exactly one place). The builder is
/// already in the `WithBuilderTools` state because the telemetry/skill tools
/// were registered first.
/// already in the `WithBuilderTools` state because the telemetry tools were
/// registered first.
pub(super) fn register_rocm_read_tools<M, P>(
builder: rig::agent::AgentBuilder<M, P, rig::agent::WithBuilderTools>,
executor: Option<&SharedRocmToolExecutor>,
Expand Down Expand Up @@ -902,53 +815,20 @@ mod tests {
}
}

#[tokio::test]
async fn skill_tools_expose_both_demo_skills() {
// list_skills returns both demo skills (the agent can see them).
let list = ListSkillsTool {
fired: Arc::new(Mutex::new(Vec::new())),
};
let def = list.definition(String::new()).await;
assert_eq!(def.name, "list_skills");
let out = list.call(NoArgs::default()).await.expect("list ok");
let names: Vec<String> = out["skills"]
.as_array()
.unwrap()
.iter()
.map(|s| s["name"].as_str().unwrap().to_string())
.collect();
assert!(names.contains(&"install-lemonade".to_string()));
assert!(names.contains(&"auto-config-endpoint".to_string()));

// skill_plan returns the ordered dry-run plan for a named skill.
let plan_tool = SkillPlanTool {
fired: Arc::new(Mutex::new(Vec::new())),
};
let out = plan_tool
.call(SkillPlanArgs {
name: "install-lemonade".to_string(),
})
.await
.expect("plan ok");
let plan = out["plan"].as_array().unwrap();
assert!(
plan.iter()
.any(|l| l.as_str().unwrap().contains("lemonade-sdk"))
);
// Unknown skill → graceful error object, not a panic.
let miss = plan_tool
.call(SkillPlanArgs {
name: "nope".to_string(),
})
.await
.unwrap();
assert!(miss["error"].is_string());
}

#[test]
fn skill_tool_names_registered_in_skill_names() {
assert!(SKILL_NAMES.contains(&"list_skills"));
assert!(SKILL_NAMES.contains(&"skill_plan"));
fn retired_skill_registry_tools_are_not_advertised() {
// `list_skills` / `skill_plan` described install steps (a GitHub
// releases download plus a `tar` extraction) that are not how the product
// installs an engine, and no executor ever applied their plans. They
// must not come back in any tool set the model is offered.
for gone in ["list_skills", "skill_plan"] {
assert!(!SKILL_NAMES.contains(&gone), "{gone} is retired");
assert!(!ROCM_READ_TOOL_NAMES.contains(&gone), "{gone} is retired");
assert!(
!ROCM_MUTATING_TOOL_NAMES.contains(&gone),
"{gone} is retired"
);
}
}

/// Minimal executor that echoes a fixed JSON value for any tool call.
Expand Down
1 change: 0 additions & 1 deletion crates/rocm-dash-tui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub mod llm;
pub mod reconnect;
pub mod registry_probe;
pub mod replay;
pub mod skills;
pub mod tool_exec;
pub mod transport;
pub mod ui;
26 changes: 15 additions & 11 deletions crates/rocm-dash-tui/src/llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,26 @@ where
})
}

const LOCAL_ENDPOINT_CANDIDATES: [&str; 3] = [
crate::skills::LEMONADE_ENDPOINT,
crate::skills::VLLM_ENDPOINT,
crate::skills::ROCM_SERVE_ENDPOINT,
];
/// Lemonade's default OpenAI-compatible endpoint.
const LEMONADE_ENDPOINT: &str = "http://localhost:13305/v1";
/// vLLM's conventional OpenAI-compatible endpoint.
const VLLM_ENDPOINT: &str = "http://localhost:8000/v1";
/// `rocm serve`'s (non-managed) default vLLM endpoint.
///
/// The port mirrors `rocm_core::DEFAULT_LOCAL_PORT`; duplicated as a literal
/// because this crate deliberately carries no `rocm-core` dependency (see
/// `AppState::model_recipes`).
const ROCM_SERVE_ENDPOINT: &str = "http://localhost:11435/v1";

const LOCAL_ENDPOINT_CANDIDATES: [&str; 3] =
[LEMONADE_ENDPOINT, VLLM_ENDPOINT, ROCM_SERVE_ENDPOINT];

/// Probe the known local serving endpoints (Lemonade, vLLM, then `rocm
/// serve`'s non-managed default) concurrently and return the highest-priority
/// one that answered.
///
/// Used by the TUI's in-app "detect a local engine" action, and by chat
/// startup, so the user need not run the CLI skill first.
/// startup, so the user need not configure an endpoint first.
pub fn detect_local_endpoint() -> Option<&'static str> {
probe_first_reachable(&LOCAL_ENDPOINT_CANDIDATES, probe_endpoint)
}
Expand Down Expand Up @@ -539,11 +547,7 @@ mod tests {
fn local_endpoint_candidates_preserve_supported_order() {
assert_eq!(
LOCAL_ENDPOINT_CANDIDATES,
[
crate::skills::LEMONADE_ENDPOINT,
crate::skills::VLLM_ENDPOINT,
crate::skills::ROCM_SERVE_ENDPOINT,
]
[LEMONADE_ENDPOINT, VLLM_ENDPOINT, ROCM_SERVE_ENDPOINT]
);
}
}
Loading
Loading