@tpsdev-ai/flair-client 0.4.2 → 0.5.0

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
@@ -25,6 +25,10 @@ export declare class FlairClient {
25
25
  /** Cold-start bootstrap — get soul + recent memories as a formatted context block. */
26
26
  bootstrap(opts?: {
27
27
  maxTokens?: number;
28
+ currentTask?: string;
29
+ channel?: string;
30
+ surface?: string;
31
+ subjects?: string[];
28
32
  }): Promise<BootstrapResult>;
29
33
  /** Health check. */
30
34
  health(): Promise<{
@@ -48,10 +52,12 @@ declare class MemoryApi {
48
52
  /** Similarity threshold for dedup. Default: 0.95 */
49
53
  dedupThreshold?: number;
50
54
  }): Promise<Memory>;
51
- /** Search memories by meaning. */
55
+ /** Search memories by meaning. Optionally filter to facts valid at a specific point in time. */
52
56
  search(query: string, opts?: {
53
57
  limit?: number;
54
58
  minScore?: number;
59
+ scoring?: "composite" | "raw";
60
+ asOf?: string;
55
61
  }): Promise<SearchResult[]>;
56
62
  /** Get a memory by ID. */
57
63
  get(id: string): Promise<Memory | null>;
package/dist/client.js CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { loadPrivateKey, resolveKeyPath, signRequest } from "./auth.js";
11
11
  const DEFAULT_URL = "http://localhost:19926";
12
- const DEFAULT_TIMEOUT = 10_000;
12
+ const DEFAULT_TIMEOUT = 30_000;
13
13
  export class FlairClient {
14
14
  url;
15
15
  agentId;
@@ -74,6 +74,10 @@ export class FlairClient {
74
74
  return this.request("POST", "/BootstrapMemories", {
75
75
  agentId: this.agentId,
76
76
  maxTokens: opts.maxTokens ?? 4000,
77
+ currentTask: opts.currentTask,
78
+ channel: opts.channel,
79
+ surface: opts.surface,
80
+ subjects: opts.subjects,
77
81
  });
78
82
  }
79
83
  /** Health check. */
@@ -93,7 +97,9 @@ class MemoryApi {
93
97
  // is unreliable (e.g., "ok", "thanks" would match each other)
94
98
  if (opts.dedup && content.length >= 20) {
95
99
  const threshold = opts.dedupThreshold ?? 0.95;
96
- const existing = await this.search(content, { limit: 1, minScore: threshold });
100
+ // Use raw scoring to avoid retrieval-boost feedback loop where repeated
101
+ // dedup checks inflate scores above the threshold.
102
+ const existing = await this.search(content, { limit: 1, minScore: threshold, scoring: "raw" });
97
103
  if (existing.length > 0) {
98
104
  // Return the existing memory instead of creating a duplicate
99
105
  const match = await this.get(existing[0].id);
@@ -116,9 +122,9 @@ class MemoryApi {
116
122
  // Harper PUT returns {} — return the record we constructed
117
123
  return record;
118
124
  }
119
- /** Search memories by meaning. */
125
+ /** Search memories by meaning. Optionally filter to facts valid at a specific point in time. */
120
126
  async search(query, opts = {}) {
121
- const result = await this.client.request("POST", "/SemanticSearch", { agentId: this.client.agentId, q: query, limit: opts.limit ?? 5 });
127
+ const result = await this.client.request("POST", "/SemanticSearch", { agentId: this.client.agentId, q: query, limit: opts.limit ?? 5, scoring: opts.scoring, asOf: opts.asOf });
122
128
  const minScore = opts.minScore ?? 0;
123
129
  return (result.results ?? [])
124
130
  .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.5.0",
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",