@tpsdev-ai/flair-client 0.22.1 → 0.23.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 +4 -0
- package/dist/client.js +17 -0
- package/dist/types.d.ts +12 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export declare class FlairClient {
|
|
|
14
14
|
readonly memory: MemoryApi;
|
|
15
15
|
readonly relationship: RelationshipApi;
|
|
16
16
|
readonly soul: SoulApi;
|
|
17
|
+
/** flair#718 authorship-provenance — see FlairClientConfig.claimedClient's
|
|
18
|
+
* doc (types.ts). `undefined` when neither config nor FLAIR_CLIENT is set;
|
|
19
|
+
* MemoryApi reads this to (optionally) stamp memory write payloads. */
|
|
20
|
+
readonly claimedClient: string | undefined;
|
|
17
21
|
private privateKey;
|
|
18
22
|
private keyResolved;
|
|
19
23
|
private keyPath;
|
package/dist/client.js
CHANGED
|
@@ -17,6 +17,10 @@ export class FlairClient {
|
|
|
17
17
|
memory;
|
|
18
18
|
relationship;
|
|
19
19
|
soul;
|
|
20
|
+
/** flair#718 authorship-provenance — see FlairClientConfig.claimedClient's
|
|
21
|
+
* doc (types.ts). `undefined` when neither config nor FLAIR_CLIENT is set;
|
|
22
|
+
* MemoryApi reads this to (optionally) stamp memory write payloads. */
|
|
23
|
+
claimedClient;
|
|
20
24
|
privateKey = null;
|
|
21
25
|
keyResolved = false;
|
|
22
26
|
keyPath;
|
|
@@ -30,6 +34,7 @@ export class FlairClient {
|
|
|
30
34
|
if (config.privateKey !== undefined) {
|
|
31
35
|
this.rawPrivateKey = config.privateKey;
|
|
32
36
|
}
|
|
37
|
+
this.claimedClient = config.claimedClient || process.env.FLAIR_CLIENT || undefined;
|
|
33
38
|
this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT;
|
|
34
39
|
// Basic auth fallback for standalone deployments without Ed25519 keys
|
|
35
40
|
const adminUser = config.adminUser ?? process.env.FLAIR_ADMIN_USER;
|
|
@@ -143,6 +148,12 @@ class MemoryApi {
|
|
|
143
148
|
record.dedup = opts.dedup;
|
|
144
149
|
if (opts.dedupThreshold !== undefined)
|
|
145
150
|
record.dedupThreshold = opts.dedupThreshold;
|
|
151
|
+
// flair#718 authorship-provenance: forward this process's claimed client
|
|
152
|
+
// label (config.claimedClient / FLAIR_CLIENT env) only when set — the
|
|
153
|
+
// server folds it into provenance.claimed.client and strips it from the
|
|
154
|
+
// row (resources/Memory.ts). Absent = omitted, zero behavior change.
|
|
155
|
+
if (this.client.claimedClient)
|
|
156
|
+
record.claimedClient = this.client.claimedClient;
|
|
146
157
|
const response = await this.client.request("PUT", `/Memory/${id}`, record);
|
|
147
158
|
// Merge the server response (deduplicated/matchedId/matchConfidence/
|
|
148
159
|
// written, plus any echoed fields) over the locally-constructed record —
|
|
@@ -191,6 +202,9 @@ class MemoryApi {
|
|
|
191
202
|
delete record.validTo;
|
|
192
203
|
delete record.archivedAt;
|
|
193
204
|
delete record.deduped;
|
|
205
|
+
// flair#718 authorship-provenance — see write()'s identical comment above.
|
|
206
|
+
if (this.client.claimedClient)
|
|
207
|
+
record.claimedClient = this.client.claimedClient;
|
|
194
208
|
// The Memory schema does not expose a working HTTP POST route (see
|
|
195
209
|
// resources/Memory.ts) — Memory.post() is only reachable in-process
|
|
196
210
|
// (resources/mcp-tools.ts). So the supersede-link write goes through
|
|
@@ -208,6 +222,9 @@ class MemoryApi {
|
|
|
208
222
|
delete merged.embedding;
|
|
209
223
|
delete merged.embeddingModel;
|
|
210
224
|
delete merged.deduped;
|
|
225
|
+
// flair#718 authorship-provenance — see write()'s identical comment above.
|
|
226
|
+
if (this.client.claimedClient)
|
|
227
|
+
merged.claimedClient = this.client.claimedClient;
|
|
211
228
|
const response = await this.client.request("PUT", `/Memory/${id}`, merged);
|
|
212
229
|
return { ...merged, id, ...(response ?? {}) };
|
|
213
230
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export interface Relationship {
|
|
|
77
77
|
createdAt: string;
|
|
78
78
|
updatedAt?: string;
|
|
79
79
|
/** JSON blob, same shape as Memory.provenance — { v, verified: { agentId,
|
|
80
|
-
* timestamp }, claimed?: { model } }. Absent on rows written before this
|
|
80
|
+
* timestamp }, claimed?: { model, client } }. Absent on rows written before this
|
|
81
81
|
* field existed (migration-equivalence: additive/nullable). */
|
|
82
82
|
provenance?: string;
|
|
83
83
|
/** Always true after a successful write() — the server never suppresses a
|
|
@@ -137,4 +137,15 @@ export interface FlairClientConfig {
|
|
|
137
137
|
adminUser?: string;
|
|
138
138
|
/** Admin password for Basic auth fallback (standalone deployments). Falls back to FLAIR_ADMIN_PASSWORD env var. */
|
|
139
139
|
adminPassword?: string;
|
|
140
|
+
/**
|
|
141
|
+
* flair#718 authorship-provenance: a label identifying WHICH CLIENT this
|
|
142
|
+
* process is (e.g. "claude-code", "codex", "gemini", "cursor") — recorded
|
|
143
|
+
* as unverified `provenance.claimed.client` on memory writes, distinct from
|
|
144
|
+
* `agentId` (ownership) and ungoverned by any authority (never enters
|
|
145
|
+
* read-scope, attribution, or dedup decisions — server-enforced in
|
|
146
|
+
* resources/provenance.ts). Falls back to the `FLAIR_CLIENT` env var.
|
|
147
|
+
* Absent (both here and in the env) = omitted entirely; zero behavior
|
|
148
|
+
* change for existing installs.
|
|
149
|
+
*/
|
|
150
|
+
claimedClient?: string;
|
|
140
151
|
}
|
package/package.json
CHANGED