mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
Extend the plugin memory SPI with a three-arg prefetch(agentId, userQuery, ownerKey) default method and forward ownerKey through PluginMemoryBridge, enabling per-owner isolated recall for external providers. Ship mateclaw-plugin-mem0: an optional, zero-extra-dependency plugin that bridges a self-hosted Mem0 service (semantic recall via /memories/search/, async turn sync via /memories/) with full fault isolation — not part of the default stack. Includes 42 tests and bilingual user docs.
39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package vip.mate.plugin.mem0;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
class Mem0ConfigTest {
|
|
|
|
@Test
|
|
void isUsable_false_whenBaseUrlNull() {
|
|
Mem0Config c = new Mem0Config(null, null, true, true, 5, 1000);
|
|
assertThat(c.isUsable()).isFalse();
|
|
}
|
|
|
|
@Test
|
|
void isUsable_false_whenBaseUrlBlank() {
|
|
Mem0Config c = new Mem0Config(" ", null, true, true, 5, 1000);
|
|
assertThat(c.isUsable()).isFalse();
|
|
}
|
|
|
|
@Test
|
|
void isUsable_true_whenBaseUrlSet() {
|
|
Mem0Config c = new Mem0Config("http://localhost:8080", null, true, true, 5, 1000);
|
|
assertThat(c.isUsable()).isTrue();
|
|
}
|
|
|
|
@Test
|
|
void normalizedBaseUrl_stripsTrailingSlashes() {
|
|
Mem0Config c = new Mem0Config("http://localhost:8080///", null, true, true, 5, 1000);
|
|
assertThat(c.normalizedBaseUrl()).isEqualTo("http://localhost:8080");
|
|
}
|
|
|
|
@Test
|
|
void normalizedBaseUrl_keepsUrlWithoutTrailingSlash() {
|
|
Mem0Config c = new Mem0Config("http://localhost:8080", null, true, true, 5, 1000);
|
|
assertThat(c.normalizedBaseUrl()).isEqualTo("http://localhost:8080");
|
|
}
|
|
}
|