@tpsdev-ai/flair 0.3.11 → 0.3.13
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/config.yaml +4 -0
- package/dist/cli.js +2 -2
- package/dist/resources/embeddings-provider.js +17 -8
- package/package.json +1 -1
- package/resources/embeddings-provider.ts +17 -7
package/config.yaml
CHANGED
|
@@ -10,6 +10,10 @@ graphqlSchema:
|
|
|
10
10
|
jsResource:
|
|
11
11
|
files: dist/resources/*.js
|
|
12
12
|
|
|
13
|
+
'harper-fabric-embeddings':
|
|
14
|
+
package: 'harper-fabric-embeddings'
|
|
15
|
+
modelName: nomic-embed-text
|
|
16
|
+
|
|
13
17
|
authentication:
|
|
14
18
|
# Default secure. Set to false for local development only.
|
|
15
19
|
authorizeLocal: true
|
package/dist/cli.js
CHANGED
|
@@ -83,8 +83,8 @@ async function api(method, path, body) {
|
|
|
83
83
|
if (keyPath) {
|
|
84
84
|
try {
|
|
85
85
|
// Sign the path without query params — auth middleware verifies the clean path
|
|
86
|
-
|
|
87
|
-
authHeader = buildEd25519Auth(agentId, method,
|
|
86
|
+
// Auth middleware verifies the full request path including query params
|
|
87
|
+
authHeader = buildEd25519Auth(agentId, method, path, keyPath);
|
|
88
88
|
}
|
|
89
89
|
catch (err) {
|
|
90
90
|
// Key exists but auth build failed — warn and continue without auth
|
|
@@ -20,15 +20,24 @@ export async function initEmbeddings() {
|
|
|
20
20
|
const state = getState();
|
|
21
21
|
if (state.initialized)
|
|
22
22
|
return;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
// harper-fabric-embeddings is initialized by Harper as a sub-component
|
|
24
|
+
// (declared in config.yaml). It inits in the background so it may not
|
|
25
|
+
// be ready when resources first load. Retry a few times before giving up.
|
|
26
|
+
for (let attempt = 1; attempt <= 10; attempt++) {
|
|
27
|
+
try {
|
|
28
|
+
const dims = hfe.dimensions();
|
|
29
|
+
state.available = true;
|
|
30
|
+
state.initialized = true;
|
|
31
|
+
console.log(`[embeddings] ready (${dims} dims, attempt ${attempt})`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
if (attempt < 10)
|
|
36
|
+
await new Promise(r => setTimeout(r, 500));
|
|
37
|
+
}
|
|
31
38
|
}
|
|
39
|
+
console.log("[embeddings] not available after 10 attempts — search will be keyword-only");
|
|
40
|
+
state.available = false;
|
|
32
41
|
state.initialized = true;
|
|
33
42
|
}
|
|
34
43
|
export async function getEmbedding(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpsdev-ai/flair",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"description": "Identity, memory, and soul for AI agents. Cryptographic identity (Ed25519), semantic memory with local embeddings, and persistent personality — all in a single process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,24 @@ function getState(): ProviderState {
|
|
|
28
28
|
export async function initEmbeddings(): Promise<void> {
|
|
29
29
|
const state = getState();
|
|
30
30
|
if (state.initialized) return;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
|
|
32
|
+
// harper-fabric-embeddings is initialized by Harper as a sub-component
|
|
33
|
+
// (declared in config.yaml). It inits in the background so it may not
|
|
34
|
+
// be ready when resources first load. Retry a few times before giving up.
|
|
35
|
+
for (let attempt = 1; attempt <= 10; attempt++) {
|
|
36
|
+
try {
|
|
37
|
+
const dims = hfe.dimensions();
|
|
38
|
+
state.available = true;
|
|
39
|
+
state.initialized = true;
|
|
40
|
+
console.log(`[embeddings] ready (${dims} dims, attempt ${attempt})`);
|
|
41
|
+
return;
|
|
42
|
+
} catch {
|
|
43
|
+
if (attempt < 10) await new Promise(r => setTimeout(r, 500));
|
|
44
|
+
}
|
|
38
45
|
}
|
|
46
|
+
|
|
47
|
+
console.log("[embeddings] not available after 10 attempts — search will be keyword-only");
|
|
48
|
+
state.available = false;
|
|
39
49
|
state.initialized = true;
|
|
40
50
|
}
|
|
41
51
|
|