aboutsummaryrefslogtreecommitdiff
path: root/src/integration/registry.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-13 18:36:47 +0300
committerGitHub <noreply@github.com>2026-09-13 17:36:47 +0200
commitfc1cb77f0572948552377b23f7754a3016ac7dfa (patch)
tree5412b796aaaa00894fe628b2ffed8d747e6f452d /src/integration/registry.rs
parent3be35231497f33f38aeffd84df02642479995bc6 (diff)
feat: add Letta Code detection and restore (#3107)
refs #3106 Co-authored-by: Cameron <cameron@pfiffer.org>
Diffstat (limited to 'src/integration/registry.rs')
-rw-r--r--src/integration/registry.rs50
1 files changed, 37 insertions, 13 deletions
diff --git a/src/integration/registry.rs b/src/integration/registry.rs
index f3bb8c04..9185c96f 100644
--- a/src/integration/registry.rs
+++ b/src/integration/registry.rs
@@ -441,30 +441,33 @@ fn opencode_tui_integration_is_valid(plugin_path: &Path, expected_version: u32)
.is_some_and(|version| version >= expected_version)))
}
-pub(crate) fn integration_status_at(
- target: crate::api::schema::IntegrationTarget,
- path: PathBuf,
+fn integration_state_for_path(
+ path: &Path,
expected_version: u32,
-) -> super::IntegrationStatus {
+) -> (super::IntegrationStatusKind, Option<u32>) {
if !path.is_file() {
- return super::IntegrationStatus {
- target,
- path,
- state: super::IntegrationStatusKind::NotInstalled,
- installed_version: None,
- expected_version,
- };
+ return (super::IntegrationStatusKind::NotInstalled, None);
}
- let installed_version = fs::read_to_string(&path)
+ let installed_version = fs::read_to_string(path)
.ok()
.and_then(|content| parse_integration_version(&content));
- let mut state = if installed_version.is_some_and(|version| version >= expected_version) {
+ let state = if installed_version.is_some_and(|version| version >= expected_version) {
super::IntegrationStatusKind::Current
} else {
super::IntegrationStatusKind::Outdated
};
+ (state, installed_version)
+}
+
+pub(crate) fn integration_status_at(
+ target: crate::api::schema::IntegrationTarget,
+ path: PathBuf,
+ expected_version: u32,
+) -> super::IntegrationStatus {
+ let (mut state, installed_version) = integration_state_for_path(&path, expected_version);
+
// Grok only invokes the hook when the herdr-owned `hooks/herdr.json`
// registers it, so a current hook script with a missing or broken config
// is a nonfunctional install: report it as outdated so `herdr integration
@@ -491,6 +494,27 @@ pub(crate) fn integration_status_at(
}
}
+/// Letta is intentionally kept out of the frozen client endpoint
+/// `IntegrationTarget` enum so published generation-1 clients never receive an
+/// unknown variant. It is installable and reportable as an experimental
+/// CLI-only target until the agent registry replaces the enum-keyed registry.
+pub(crate) fn experimental_letta_integration_status() -> Option<super::ExperimentalIntegrationStatus>
+{
+ let path = letta_dir()
+ .ok()?
+ .join("hooks")
+ .join(super::LETTA_HOOK_INSTALL_NAME);
+ let (state, installed_version) =
+ integration_state_for_path(&path, super::LETTA_INTEGRATION_VERSION);
+ Some(super::ExperimentalIntegrationStatus {
+ label: "letta",
+ path,
+ state,
+ installed_version,
+ expected_version: super::LETTA_INTEGRATION_VERSION,
+ })
+}
+
pub(crate) fn parse_integration_version(content: &str) -> Option<u32> {
content.lines().find_map(|line| {
let marker_line = line