@tpsdev-ai/flair-client 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -52,6 +52,7 @@ declare class MemoryApi {
52
52
  search(query: string, opts?: {
53
53
  limit?: number;
54
54
  minScore?: number;
55
+ scoring?: "composite" | "raw";
55
56
  }): Promise<SearchResult[]>;
56
57
  /** Get a memory by ID. */
57
58
  get(id: string): Promise<Memory | null>;
package/dist/client.js CHANGED
@@ -93,7 +93,9 @@ class MemoryApi {
93
93
  // is unreliable (e.g., "ok", "thanks" would match each other)
94
94
  if (opts.dedup && content.length >= 20) {
95
95
  const threshold = opts.dedupThreshold ?? 0.95;
96
- const existing = await this.search(content, { limit: 1, minScore: threshold });
96
+ // Use raw scoring to avoid retrieval-boost feedback loop where repeated
97
+ // dedup checks inflate scores above the threshold.
98
+ const existing = await this.search(content, { limit: 1, minScore: threshold, scoring: "raw" });
97
99
  if (existing.length > 0) {
98
100
  // Return the existing memory instead of creating a duplicate
99
101
  const match = await this.get(existing[0].id);
@@ -118,7 +120,7 @@ class MemoryApi {
118
120
  }
119
121
  /** Search memories by meaning. */
120
122
  async search(query, opts = {}) {
121
- const result = await this.client.request("POST", "/SemanticSearch", { agentId: this.client.agentId, q: query, limit: opts.limit ?? 5 });
123
+ const result = await this.client.request("POST", "/SemanticSearch", { agentId: this.client.agentId, q: query, limit: opts.limit ?? 5, scoring: opts.scoring });
122
124
  const minScore = opts.minScore ?? 0;
123
125
  return (result.results ?? [])
124
126
  .map((r) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/flair-client",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Lightweight client for Flair — identity, memory, and soul for AI agents. Zero heavy dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",