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
12 changes: 7 additions & 5 deletions crates/ironclaw_host_runtime/src/first_party_tools/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub const MEMORY_TREE_CAPABILITY_ID: &str = "builtin.memory_tree";
const MEMORY_PATH: &str = "MEMORY.md";
const HEARTBEAT_PATH: &str = "HEARTBEAT.md";
const BOOTSTRAP_PATH: &str = "BOOTSTRAP.md";
const MAX_MEMORY_PATCH_RETRIES: usize = 8;
pub(super) const MAX_MEMORY_PATCH_RETRIES: usize = 8;
const MEMORY_PROMPT_SAFETY_EXTENSION_ID: &str = "memory.prompt_safety";

struct MemoryServices {
Expand Down Expand Up @@ -161,7 +161,7 @@ pub(super) fn manifests() -> Result<Vec<CapabilityManifest>, ExtensionError> {
)?,
first_party_capability_manifest(
MEMORY_WRITE_CAPABILITY_ID,
"Write, append, or patch Reborn persistent memory documents in the current tenant/user/agent/project scope",
"Write, append, or patch Reborn persistent memory documents in the current tenant/user/agent/project scope. For structured user facts (timezone, locale, location), use builtin.profile_set instead.",
vec![EffectKind::ReadFilesystem, EffectKind::WriteFilesystem],
PermissionMode::Allow,
resource_profile(),
Expand Down Expand Up @@ -234,7 +234,7 @@ fn memory_services(
}

impl MemoryCapabilityState {
fn backend_for(
pub(super) fn backend_for(
&self,
request: &FirstPartyCapabilityRequest,
) -> Result<Arc<dyn MemoryBackend>, FirstPartyCapabilityError> {
Expand Down Expand Up @@ -298,7 +298,7 @@ fn build_backend(
Arc::new(backend)
}

fn ensure_memory_mount(
pub(super) fn ensure_memory_mount(
request: &FirstPartyCapabilityRequest,
write: bool,
) -> Result<(), FirstPartyCapabilityError> {
Expand Down Expand Up @@ -591,7 +591,9 @@ async fn append_document(
.map_err(|_| operation_error())
}

fn write_options(metadata_overlay: Option<&DocumentMetadata>) -> MemoryBackendWriteOptions {
pub(super) fn write_options(
metadata_overlay: Option<&DocumentMetadata>,
) -> MemoryBackendWriteOptions {
MemoryBackendWriteOptions {
metadata_overlay: metadata_overlay.cloned(),
}
Expand Down
14 changes: 13 additions & 1 deletion crates/ironclaw_host_runtime/src/first_party_tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod http_output;
mod json;
mod memory;
mod model_visible_output;
mod profile_set;
mod schemas;
mod shell;
mod skill_management;
Expand Down Expand Up @@ -52,6 +53,7 @@ pub use memory::{
MEMORY_READ_CAPABILITY_ID, MEMORY_SEARCH_CAPABILITY_ID, MEMORY_TREE_CAPABILITY_ID,
MEMORY_WRITE_CAPABILITY_ID,
};
pub use profile_set::PROFILE_SET_CAPABILITY_ID;
pub use shell::SHELL_CAPABILITY_ID;
pub use skill_management::{
SKILL_INSTALL_CAPABILITY_ID, SKILL_LIST_CAPABILITY_ID, SKILL_REMOVE_CAPABILITY_ID,
Expand Down Expand Up @@ -173,6 +175,7 @@ pub fn builtin_first_party_package() -> Result<ExtensionPackage, ExtensionError>
trace_commons::credits_manifest()?,
trace_commons::profile_token_manifest()?,
Comment thread
henrypark133 marked this conversation as resolved.
trace_commons::profile_set_manifest()?,
profile_set::manifest()?,
];
capabilities.extend(memory::manifests()?);
capabilities.extend(coding_manifests()?);
Expand Down Expand Up @@ -294,8 +297,9 @@ fn builtin_first_party_base_registry() -> Result<FirstPartyCapabilityRegistry, H
);
registry.insert_handler(
CapabilityId::new(TRACE_COMMONS_PROFILE_SET_CAPABILITY_ID)?,
handler,
handler.clone(),
);
registry.insert_handler(CapabilityId::new(PROFILE_SET_CAPABILITY_ID)?, handler);
skill_management::insert_handlers(&mut registry)?;
Ok(registry)
}
Expand Down Expand Up @@ -362,6 +366,14 @@ impl FirstPartyCapabilityHandler for BuiltinFirstPartyTools {
bounded_output_bytes(&result.output, FIRST_PARTY_MAX_OUTPUT_BYTES)?;
return Ok(result);
}
PROFILE_SET_CAPABILITY_ID => {
let mut result = profile_set::dispatch(&self.memory_state, &request).await?;
result.usage.output_bytes =
Comment thread
henrypark133 marked this conversation as resolved.
bounded_output_bytes(&result.output, FIRST_PARTY_MAX_OUTPUT_BYTES)?;
result.usage.wall_clock_ms =
start.elapsed().as_millis().try_into().unwrap_or(u64::MAX);
return Ok(result);
}
SHELL_CAPABILITY_ID => {
let (output, duration) = shell::dispatch(&request).await?;
let wall_clock_ms = duration.as_millis().try_into().unwrap_or(u64::MAX);
Expand Down
Loading
Loading