The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix: preserve skill compatibility during tinyskills extraction
Steven Enamakel77003e627625
diff --cc crates/openhuman-core/src/skills/bundled/mod.rsindex 4558058772,7d381b9c1c..132a181a35--- a/crates/openhuman-core/src/skills/bundled/mod.rs+++ b/crates/openhuman-core/src/skills/bundled/mod.rs@@@ -2,9 -36,114 +2,13 @@@use std::path::{Path, PathBuf};-use sha2::{Digest, Sha256};+pub use tinyskills::{BundledFile, BundledSkill, InstallReport};-/// One file inside a bundled skill, relative to the bundle directory.-#[derive(Debug, Clone, Copy)]-pub struct BundledFile {- /// Slash-separated path relative to the bundle root (`WORKFLOW.md`,- /// `references/expressions.md`). Validated by- /// [`BundledSkill::validate`] — see the test module.- pub path: &'static str,- pub contents: &'static str,-}--/// A skill compiled into the binary.-#[derive(Debug, Clone, Copy)]-pub struct BundledSkill {- /// The on-disk directory name, and the id the model names in `run_skill` /- /// `describe_workflow`.- pub dir_name: &'static str,- pub files: &'static [BundledFile],-}--impl BundledSkill {- /// A digest over the bundle's full contents, used to decide whether the- /// materialised copy on disk is current.- ///- /// Both the path and the contents of every file are hashed, each- /// length-prefixed, so that renaming a file or moving a byte between two- /// files changes the digest. Without the length prefix the concatenation- /// `("ab", "c")` and `("a", "bc")` would hash identically.- pub fn digest(&self) -> String {- let mut hasher = Sha256::new();- for file in self.files {- hasher.update((file.path.len() as u64).to_le_bytes());- hasher.update(file.path.as_bytes());- hasher.update((file.contents.len() as u64).to_le_bytes());- hasher.update(file.contents.as_bytes());- }- format!("{:x}", hasher.finalize())- }-- /// Reject a bundle this host will not write out.- ///- /// These are compile-time constants from this repository, so none of this- /// can fire in a shipped build — which is exactly why it is checked by a- /// test rather than trusted. The cost of being wrong is writing outside the- /// workspace, and "our own constants are fine" is the assumption that makes- /// that mistake survivable for one refactor too long.- pub fn validate(&self) -> Result<(), String> {- if self.dir_name.is_empty()- || self.dir_name.starts_with('.')- || self.dir_name.contains('/')- || self.dir_name.contains('\\')- {- return Err(format!(- "invalid bundled skill dir_name `{}`",- self.dir_name- ));- }- if self.files.is_empty() {- return Err(format!("bundled skill `{}` has no files", self.dir_name));- }- let has_manifest = self.files.iter().any(|f| {- f.path == super::ops_types::WORKFLOW_MD || f.path == super::ops_types::SKILL_MD- });- if !has_manifest {- return Err(format!(- "bundled skill `{}` has no WORKFLOW.md or SKILL.md; discovery would skip it",- self.dir_name- ));- }- for file in self.files {- validate_relative_path(self.dir_name, file.path)?;- }- Ok(())- }-}--fn validate_relative_path(dir_name: &str, path: &str) -> Result<(), String> {- if path.is_empty() {- return Err(format!("bundled skill `{dir_name}` has an empty file path"));- }- if path.starts_with('/') || path.starts_with('\\') || path.contains(':') {- return Err(format!(- "bundled skill `{dir_name}` file `{path}` is not workspace-relative"- ));- }- for component in path.split('/') {- if component.is_empty() || component == "." || component == ".." {- return Err(format!(- "bundled skill `{dir_name}` file `{path}` has a traversal component"- ));- }- if component.starts_with('.') {- return Err(format!(- "bundled skill `{dir_name}` file `{path}` has a dotfile component; \- discovery skips those"- ));- }- }- Ok(())-}++#[cfg(test)]++#[path = "mod_tests.rs"]++mod mod_tests;+-/// The compiled-in table.-///-/// Gated per entry, not as a whole: `flow-authoring` teaches the flows node-/// vocabulary, and in a build without the `flows` feature there is nothing for-/// it to author. Shipping it anyway would put a manual for absent tools in-/// front of the model — the same failure the `Off` tool mode exists to avoid.+/// Skills compiled into this product build.pub const BUNDLED: &[BundledSkill] = &[#[cfg(feature = "flows")]crate::flows::skills::FLOW_AUTHORING,diff --cc crates/openhuman-core/src/skills/ops_discover/collision.rsindex 6eece955e2,30b0bac948..d694985e2f--- a/crates/openhuman-core/src/skills/ops_discover/collision.rs+++ b/crates/openhuman-core/src/skills/ops_discover/collision.rs@@@ -1,7 -1,92 +1,14 @@@-//! Cross-scope name-collision resolution for discovered workflows: which-//! scope wins on a same-name (or same-`dir_name`) hit, and the warning left-//! on the survivor / shadowed entries.+//! Compatibility helper for scope precedence tests.-use std::collections::HashMap;+use crate::skills::ops_types::WorkflowScope;-use crate::skills::ops_types::{Workflow, WorkflowScope};--pub(super) fn absorb(by_name: &mut HashMap<String, Workflow>, incoming: Vec<Workflow>) {- for mut skill in incoming {- let key = skill.name.clone();- // A workflow's runnable identity is `dir_name`, while `name` is only- // display metadata. Collapse on either so a profile-local `foo/` also- // shadows a global `foo/` whose frontmatter happens to use a different- // display name. Otherwise registry lookup by slug could nondeterministically- // select the global copy.- let collision_keys: Vec<String> = by_name- .iter()- .filter(|(existing_name, existing)| {- existing_name.as_str() == key || existing.dir_name == skill.dir_name- })- .map(|(existing_name, _)| existing_name.clone())- .collect();-- if let Some((_, highest_name, highest_scope)) = collision_keys- .iter()- .filter_map(|collision_key| by_name.get(collision_key))- .map(|existing| {- (- precedence(existing.scope),- existing.name.clone(),- existing.scope,- )- })- .max_by_key(|(rank, _, _)| *rank)- {- if precedence(skill.scope) < precedence(highest_scope) {- if let Some(kept) = by_name.get_mut(&highest_name) {- kept.warnings.push(format!(- "workflow id '{}' or name '{}' also declared in {:?} scope at {} (ignored)",- skill.dir_name,- skill.name,- skill.scope,- skill- .location- .as_deref()- .map(|p| p.display().to_string())- .unwrap_or_else(|| "<unknown>".to_string())- ));- }- continue;- }- }-- for collision_key in collision_keys {- if let Some(loser) = by_name.remove(&collision_key) {- skill.warnings.push(format!(- "shadowed {:?}-scope skill '{}' (workflow id '{}') at {}",- loser.scope,- loser.name,- loser.dir_name,- loser- .location- .as_deref()- .map(|p| p.display().to_string())- .unwrap_or_else(|| "<unknown>".to_string())- ));- }- }- by_name.insert(key, skill);- }-}--pub(super) fn precedence(scope: WorkflowScope) -> u8 {+pub(super) const fn precedence(scope: WorkflowScope) -> u8 {- scope.precedence()+ match scope {- // Builtin sits below everything, including Legacy: a bundle that ships- // with the binary must never shadow something the user installed or- // wrote. Adding a builtin skill is then a change that cannot take a- // name away from an existing workspace.+ WorkflowScope::Builtin => 0,+ WorkflowScope::Legacy => 1,+ WorkflowScope::User => 2,+ WorkflowScope::Project => 3,- // Profile-local skills win against every global scope for their owner.+ WorkflowScope::Profile => 4,- // Flows are never discovered by this scanner, so they never take part- // in a name collision resolved here. Ranked above everything so that- // if one ever reaches this function the answer is deterministic rather- // than accidental.+ WorkflowScope::Flow => 5,+ }}