@steno-ai/engine 0.1.14 → 0.1.16
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/adapters/storage.d.ts +29 -2
- package/dist/adapters/storage.d.ts.map +1 -1
- package/dist/extraction/pipeline.d.ts.map +1 -1
- package/dist/extraction/pipeline.js +165 -0
- package/dist/extraction/pipeline.js.map +1 -1
- package/dist/extraction/types.d.ts +2 -0
- package/dist/extraction/types.d.ts.map +1 -1
- package/dist/identity/index.d.ts +2 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +2 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/resolver.d.ts +31 -0
- package/dist/identity/resolver.d.ts.map +1 -0
- package/dist/identity/resolver.js +122 -0
- package/dist/identity/resolver.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models/entity.d.ts +32 -0
- package/dist/models/entity.d.ts.map +1 -1
- package/dist/models/entity.js +11 -0
- package/dist/models/entity.js.map +1 -1
- package/dist/retrieval/graph-traversal.d.ts +4 -1
- package/dist/retrieval/graph-traversal.d.ts.map +1 -1
- package/dist/retrieval/graph-traversal.js +6 -3
- package/dist/retrieval/graph-traversal.js.map +1 -1
- package/dist/retrieval/search.d.ts.map +1 -1
- package/dist/retrieval/search.js +56 -3
- package/dist/retrieval/search.js.map +1 -1
- package/dist/retrieval/types.d.ts +1 -0
- package/dist/retrieval/types.d.ts.map +1 -1
- package/dist/retrieval/types.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/storage.ts +35 -2
- package/src/extraction/pipeline.ts +213 -0
- package/src/extraction/types.ts +2 -0
- package/src/identity/index.ts +1 -0
- package/src/identity/resolver.ts +149 -0
- package/src/index.ts +1 -0
- package/src/models/entity.ts +13 -0
- package/src/retrieval/graph-traversal.ts +7 -4
- package/src/retrieval/search.ts +58 -3
- package/src/retrieval/types.ts +1 -0
- package/src/adapters/cache.d.ts +0 -9
- package/src/adapters/cache.d.ts.map +0 -1
- package/src/adapters/cache.js +0 -2
- package/src/adapters/cache.js.map +0 -1
- package/src/adapters/embedding.d.ts +0 -7
- package/src/adapters/embedding.d.ts.map +0 -1
- package/src/adapters/embedding.js +0 -2
- package/src/adapters/embedding.js.map +0 -1
- package/src/adapters/llm.d.ts +0 -19
- package/src/adapters/llm.d.ts.map +0 -1
- package/src/adapters/llm.js +0 -2
- package/src/adapters/llm.js.map +0 -1
- package/src/adapters/perplexity-embedding.d.ts +0 -24
- package/src/adapters/perplexity-embedding.d.ts.map +0 -1
- package/src/adapters/perplexity-embedding.js +0 -78
- package/src/adapters/perplexity-embedding.js.map +0 -1
- package/src/adapters/storage.d.ts +0 -173
- package/src/adapters/storage.d.ts.map +0 -1
- package/src/adapters/storage.js +0 -2
- package/src/adapters/storage.js.map +0 -1
- package/src/config.d.ts +0 -296
- package/src/config.d.ts.map +0 -1
- package/src/config.js +0 -92
- package/src/config.js.map +0 -1
- package/src/extraction/contradiction.d.ts +0 -15
- package/src/extraction/contradiction.d.ts.map +0 -1
- package/src/extraction/contradiction.js +0 -23
- package/src/extraction/contradiction.js.map +0 -1
- package/src/extraction/cross-linker.d.ts +0 -23
- package/src/extraction/cross-linker.d.ts.map +0 -1
- package/src/extraction/cross-linker.js +0 -146
- package/src/extraction/cross-linker.js.map +0 -1
- package/src/extraction/dedup.d.ts +0 -12
- package/src/extraction/dedup.d.ts.map +0 -1
- package/src/extraction/dedup.js +0 -93
- package/src/extraction/dedup.js.map +0 -1
- package/src/extraction/entity-extractor.d.ts +0 -30
- package/src/extraction/entity-extractor.d.ts.map +0 -1
- package/src/extraction/entity-extractor.js +0 -145
- package/src/extraction/entity-extractor.js.map +0 -1
- package/src/extraction/hasher.d.ts +0 -5
- package/src/extraction/hasher.d.ts.map +0 -1
- package/src/extraction/hasher.js +0 -8
- package/src/extraction/hasher.js.map +0 -1
- package/src/extraction/heuristic.d.ts +0 -3
- package/src/extraction/heuristic.d.ts.map +0 -1
- package/src/extraction/heuristic.js +0 -282
- package/src/extraction/heuristic.js.map +0 -1
- package/src/extraction/llm-extractor.d.ts +0 -23
- package/src/extraction/llm-extractor.d.ts.map +0 -1
- package/src/extraction/llm-extractor.js +0 -240
- package/src/extraction/llm-extractor.js.map +0 -1
- package/src/extraction/pipeline.d.ts +0 -30
- package/src/extraction/pipeline.d.ts.map +0 -1
- package/src/extraction/pipeline.js +0 -413
- package/src/extraction/pipeline.js.map +0 -1
- package/src/extraction/prompts.d.ts +0 -28
- package/src/extraction/prompts.d.ts.map +0 -1
- package/src/extraction/prompts.js +0 -205
- package/src/extraction/prompts.js.map +0 -1
- package/src/extraction/sliding-window.d.ts +0 -41
- package/src/extraction/sliding-window.d.ts.map +0 -1
- package/src/extraction/sliding-window.js +0 -84
- package/src/extraction/sliding-window.js.map +0 -1
- package/src/extraction/types.d.ts +0 -80
- package/src/extraction/types.d.ts.map +0 -1
- package/src/extraction/types.js +0 -2
- package/src/extraction/types.js.map +0 -1
- package/src/feedback/tracker.d.ts +0 -25
- package/src/feedback/tracker.d.ts.map +0 -1
- package/src/feedback/tracker.js +0 -90
- package/src/feedback/tracker.js.map +0 -1
- package/src/models/api-key.d.ts +0 -54
- package/src/models/api-key.d.ts.map +0 -1
- package/src/models/api-key.js +0 -21
- package/src/models/api-key.js.map +0 -1
- package/src/models/edge.d.ts +0 -78
- package/src/models/edge.d.ts.map +0 -1
- package/src/models/edge.js +0 -29
- package/src/models/edge.js.map +0 -1
- package/src/models/entity.d.ts +0 -60
- package/src/models/entity.d.ts.map +0 -1
- package/src/models/entity.js +0 -22
- package/src/models/entity.js.map +0 -1
- package/src/models/extraction.d.ts +0 -111
- package/src/models/extraction.d.ts.map +0 -1
- package/src/models/extraction.js +0 -40
- package/src/models/extraction.js.map +0 -1
- package/src/models/fact-entity.d.ts +0 -33
- package/src/models/fact-entity.d.ts.map +0 -1
- package/src/models/fact-entity.js +0 -14
- package/src/models/fact-entity.js.map +0 -1
- package/src/models/fact.d.ts +0 -191
- package/src/models/fact.d.ts.map +0 -1
- package/src/models/fact.js +0 -72
- package/src/models/fact.js.map +0 -1
- package/src/models/index.d.ts +0 -13
- package/src/models/index.d.ts.map +0 -1
- package/src/models/index.js +0 -13
- package/src/models/index.js.map +0 -1
- package/src/models/memory-access.d.ts +0 -89
- package/src/models/memory-access.d.ts.map +0 -1
- package/src/models/memory-access.js +0 -33
- package/src/models/memory-access.js.map +0 -1
- package/src/models/session.d.ts +0 -60
- package/src/models/session.d.ts.map +0 -1
- package/src/models/session.js +0 -23
- package/src/models/session.js.map +0 -1
- package/src/models/tenant.d.ts +0 -448
- package/src/models/tenant.d.ts.map +0 -1
- package/src/models/tenant.js +0 -23
- package/src/models/tenant.js.map +0 -1
- package/src/models/trigger.d.ts +0 -87
- package/src/models/trigger.d.ts.map +0 -1
- package/src/models/trigger.js +0 -41
- package/src/models/trigger.js.map +0 -1
- package/src/models/usage-record.d.ts +0 -37
- package/src/models/usage-record.d.ts.map +0 -1
- package/src/models/usage-record.js +0 -14
- package/src/models/usage-record.js.map +0 -1
- package/src/models/webhook.d.ts +0 -50
- package/src/models/webhook.d.ts.map +0 -1
- package/src/models/webhook.js +0 -25
- package/src/models/webhook.js.map +0 -1
- package/src/retrieval/compound-search.d.ts +0 -13
- package/src/retrieval/compound-search.d.ts.map +0 -1
- package/src/retrieval/compound-search.js +0 -87
- package/src/retrieval/compound-search.js.map +0 -1
- package/src/retrieval/contradiction-surfacer.d.ts +0 -18
- package/src/retrieval/contradiction-surfacer.d.ts.map +0 -1
- package/src/retrieval/contradiction-surfacer.js +0 -64
- package/src/retrieval/contradiction-surfacer.js.map +0 -1
- package/src/retrieval/embedding-cache.d.ts +0 -17
- package/src/retrieval/embedding-cache.d.ts.map +0 -1
- package/src/retrieval/embedding-cache.js +0 -56
- package/src/retrieval/embedding-cache.js.map +0 -1
- package/src/retrieval/fusion.d.ts +0 -27
- package/src/retrieval/fusion.d.ts.map +0 -1
- package/src/retrieval/fusion.js +0 -87
- package/src/retrieval/fusion.js.map +0 -1
- package/src/retrieval/graph-traversal.d.ts +0 -29
- package/src/retrieval/graph-traversal.d.ts.map +0 -1
- package/src/retrieval/graph-traversal.js +0 -208
- package/src/retrieval/graph-traversal.js.map +0 -1
- package/src/retrieval/query-expansion.d.ts +0 -20
- package/src/retrieval/query-expansion.d.ts.map +0 -1
- package/src/retrieval/query-expansion.js +0 -76
- package/src/retrieval/query-expansion.js.map +0 -1
- package/src/retrieval/reranker.d.ts +0 -15
- package/src/retrieval/reranker.d.ts.map +0 -1
- package/src/retrieval/reranker.js +0 -47
- package/src/retrieval/reranker.js.map +0 -1
- package/src/retrieval/salience-scorer.d.ts +0 -15
- package/src/retrieval/salience-scorer.d.ts.map +0 -1
- package/src/retrieval/salience-scorer.js +0 -41
- package/src/retrieval/salience-scorer.js.map +0 -1
- package/src/retrieval/search.d.ts +0 -21
- package/src/retrieval/search.d.ts.map +0 -1
- package/src/retrieval/search.js +0 -228
- package/src/retrieval/search.js.map +0 -1
- package/src/retrieval/temporal-scorer.d.ts +0 -18
- package/src/retrieval/temporal-scorer.d.ts.map +0 -1
- package/src/retrieval/temporal-scorer.js +0 -106
- package/src/retrieval/temporal-scorer.js.map +0 -1
- package/src/retrieval/trigger-matcher.d.ts +0 -18
- package/src/retrieval/trigger-matcher.d.ts.map +0 -1
- package/src/retrieval/trigger-matcher.js +0 -134
- package/src/retrieval/trigger-matcher.js.map +0 -1
- package/src/retrieval/types.d.ts +0 -70
- package/src/retrieval/types.d.ts.map +0 -1
- package/src/retrieval/types.js +0 -9
- package/src/retrieval/types.js.map +0 -1
- package/src/retrieval/vector-search.d.ts +0 -5
- package/src/retrieval/vector-search.d.ts.map +0 -1
- package/src/retrieval/vector-search.js +0 -24
- package/src/retrieval/vector-search.js.map +0 -1
- package/src/salience/decay.d.ts +0 -9
- package/src/salience/decay.d.ts.map +0 -1
- package/src/salience/decay.js +0 -15
- package/src/salience/decay.js.map +0 -1
- package/src/scratchpad/scratchpad.d.ts +0 -23
- package/src/scratchpad/scratchpad.d.ts.map +0 -1
- package/src/scratchpad/scratchpad.js +0 -137
- package/src/scratchpad/scratchpad.js.map +0 -1
- package/src/sessions/manager.d.ts +0 -11
- package/src/sessions/manager.d.ts.map +0 -1
- package/src/sessions/manager.js +0 -63
- package/src/sessions/manager.js.map +0 -1
package/src/models/webhook.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const WEBHOOK_EVENTS: readonly ["extraction.completed", "extraction.failed", "trigger.fired", "usage.limit_approaching", "usage.limit_exceeded"];
|
|
3
|
-
export type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
|
|
4
|
-
export declare const WebhookSchema: z.ZodObject<{
|
|
5
|
-
id: z.ZodString;
|
|
6
|
-
tenantId: z.ZodString;
|
|
7
|
-
url: z.ZodString;
|
|
8
|
-
events: z.ZodArray<z.ZodEnum<["extraction.completed", "extraction.failed", "trigger.fired", "usage.limit_approaching", "usage.limit_exceeded"]>, "many">;
|
|
9
|
-
secretHash: z.ZodString;
|
|
10
|
-
signingKey: z.ZodString;
|
|
11
|
-
active: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
-
createdAt: z.ZodDate;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
active: boolean;
|
|
15
|
-
url: string;
|
|
16
|
-
id: string;
|
|
17
|
-
tenantId: string;
|
|
18
|
-
createdAt: Date;
|
|
19
|
-
events: ("extraction.completed" | "extraction.failed" | "trigger.fired" | "usage.limit_approaching" | "usage.limit_exceeded")[];
|
|
20
|
-
secretHash: string;
|
|
21
|
-
signingKey: string;
|
|
22
|
-
}, {
|
|
23
|
-
url: string;
|
|
24
|
-
id: string;
|
|
25
|
-
tenantId: string;
|
|
26
|
-
createdAt: Date;
|
|
27
|
-
events: ("extraction.completed" | "extraction.failed" | "trigger.fired" | "usage.limit_approaching" | "usage.limit_exceeded")[];
|
|
28
|
-
secretHash: string;
|
|
29
|
-
signingKey: string;
|
|
30
|
-
active?: boolean | undefined;
|
|
31
|
-
}>;
|
|
32
|
-
export type Webhook = z.infer<typeof WebhookSchema>;
|
|
33
|
-
export declare const CreateWebhookSchema: z.ZodObject<{
|
|
34
|
-
tenantId: z.ZodString;
|
|
35
|
-
url: z.ZodString;
|
|
36
|
-
events: z.ZodArray<z.ZodEnum<["extraction.completed", "extraction.failed", "trigger.fired", "usage.limit_approaching", "usage.limit_exceeded"]>, "many">;
|
|
37
|
-
secret: z.ZodString;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
url: string;
|
|
40
|
-
tenantId: string;
|
|
41
|
-
events: ("extraction.completed" | "extraction.failed" | "trigger.fired" | "usage.limit_approaching" | "usage.limit_exceeded")[];
|
|
42
|
-
secret: string;
|
|
43
|
-
}, {
|
|
44
|
-
url: string;
|
|
45
|
-
tenantId: string;
|
|
46
|
-
events: ("extraction.completed" | "extraction.failed" | "trigger.fired" | "usage.limit_approaching" | "usage.limit_exceeded")[];
|
|
47
|
-
secret: string;
|
|
48
|
-
}>;
|
|
49
|
-
export type CreateWebhook = z.infer<typeof CreateWebhookSchema>;
|
|
50
|
-
//# sourceMappingURL=webhook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,4HAMjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/src/models/webhook.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const WEBHOOK_EVENTS = [
|
|
3
|
-
'extraction.completed',
|
|
4
|
-
'extraction.failed',
|
|
5
|
-
'trigger.fired',
|
|
6
|
-
'usage.limit_approaching',
|
|
7
|
-
'usage.limit_exceeded',
|
|
8
|
-
];
|
|
9
|
-
export const WebhookSchema = z.object({
|
|
10
|
-
id: z.string().uuid(),
|
|
11
|
-
tenantId: z.string().uuid(),
|
|
12
|
-
url: z.string().url(),
|
|
13
|
-
events: z.array(z.enum(WEBHOOK_EVENTS)),
|
|
14
|
-
secretHash: z.string(),
|
|
15
|
-
signingKey: z.string(), // raw secret for HMAC signing — stored encrypted at rest in production
|
|
16
|
-
active: z.boolean().default(true),
|
|
17
|
-
createdAt: z.coerce.date(),
|
|
18
|
-
});
|
|
19
|
-
export const CreateWebhookSchema = z.object({
|
|
20
|
-
tenantId: z.string().uuid(),
|
|
21
|
-
url: z.string().url(),
|
|
22
|
-
events: z.array(z.enum(WEBHOOK_EVENTS)).min(1),
|
|
23
|
-
secret: z.string().min(16),
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,yBAAyB;IACzB,sBAAsB;CACd,CAAC;AAGX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,uEAAuE;IAC/F,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;CAC3B,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { StorageAdapter } from '../adapters/storage.js';
|
|
2
|
-
import type { EmbeddingAdapter } from '../adapters/embedding.js';
|
|
3
|
-
import type { Candidate } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Compound search: embeds the query, then calls storage.compoundSearch
|
|
6
|
-
* (ONE database call for both vector + keyword), and splits results
|
|
7
|
-
* into Candidate format.
|
|
8
|
-
*/
|
|
9
|
-
export declare function compoundSearchSignal(storage: StorageAdapter, embedding: EmbeddingAdapter, query: string, tenantId: string, scope: string, scopeId: string, limit: number): Promise<{
|
|
10
|
-
vectorCandidates: Candidate[];
|
|
11
|
-
keywordCandidates: Candidate[];
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=compound-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compound-search.d.ts","sourceRoot":"","sources":["compound-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AA2B3D;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;IAAC,iBAAiB,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,CA6D5E"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Words to strip from search queries before keyword matching.
|
|
3
|
-
* Only question/function words that appear in queries but rarely in stored facts.
|
|
4
|
-
*
|
|
5
|
-
* NOTE: We intentionally do NOT strip "user" even though it appears in most facts.
|
|
6
|
-
* PostgreSQL's ts_rank uses IDF (inverse document frequency) weighting internally,
|
|
7
|
-
* so "user" gets near-zero weight when it appears in most documents. This is the
|
|
8
|
-
* correct behavior — ts_rank("user | hono") will score a fact containing "hono"
|
|
9
|
-
* much higher than one containing only "user", even though both match the tsquery.
|
|
10
|
-
*/
|
|
11
|
-
const QUERY_STOP_WORDS = new Set([
|
|
12
|
-
// Question words
|
|
13
|
-
'what', 'when', 'where', 'who', 'why', 'how', 'which',
|
|
14
|
-
// Auxiliary verbs from questions
|
|
15
|
-
'is', 'are', 'was', 'were', 'did', 'does', 'do', 'will', 'can', 'could', 'would', 'should',
|
|
16
|
-
'have', 'has', 'had', 'been', 'be',
|
|
17
|
-
// Articles and prepositions
|
|
18
|
-
'the', 'a', 'an', 'in', 'on', 'at', 'to', 'for', 'of', 'with',
|
|
19
|
-
// Conjunctions
|
|
20
|
-
'and', 'or', 'but', 'not', 'if', 'still',
|
|
21
|
-
// Pronouns
|
|
22
|
-
'it', 'its', 'her', 'his', 'she', 'he', 'they', 'them', 'their', 'my', 'your', 'our',
|
|
23
|
-
'that', 'this',
|
|
24
|
-
]);
|
|
25
|
-
/**
|
|
26
|
-
* Compound search: embeds the query, then calls storage.compoundSearch
|
|
27
|
-
* (ONE database call for both vector + keyword), and splits results
|
|
28
|
-
* into Candidate format.
|
|
29
|
-
*/
|
|
30
|
-
export async function compoundSearchSignal(storage, embedding, query, tenantId, scope, scopeId, limit) {
|
|
31
|
-
const queryEmbedding = await embedding.embed(query);
|
|
32
|
-
// Extract content words, join with OR for to_tsquery
|
|
33
|
-
// ts_rank handles IDF weighting — high-frequency terms get low scores automatically
|
|
34
|
-
const keywordQuery = query.toLowerCase()
|
|
35
|
-
.replace(/[^a-z0-9\s]/g, ' ')
|
|
36
|
-
.split(/\s+/)
|
|
37
|
-
.filter(w => w.length >= 2 && !QUERY_STOP_WORDS.has(w))
|
|
38
|
-
.join(' | ');
|
|
39
|
-
const results = await storage.compoundSearch({
|
|
40
|
-
embedding: queryEmbedding,
|
|
41
|
-
query: keywordQuery || query,
|
|
42
|
-
tenantId,
|
|
43
|
-
scope,
|
|
44
|
-
scopeId,
|
|
45
|
-
limit,
|
|
46
|
-
minSimilarity: 0.25, // low threshold — let fusion scoring handle ranking, not hard cutoffs
|
|
47
|
-
});
|
|
48
|
-
const vectorCandidates = [];
|
|
49
|
-
const keywordCandidates = [];
|
|
50
|
-
for (const r of results) {
|
|
51
|
-
if (r.source === 'vector') {
|
|
52
|
-
vectorCandidates.push({
|
|
53
|
-
fact: r.fact,
|
|
54
|
-
vectorScore: r.relevanceScore,
|
|
55
|
-
keywordScore: 0,
|
|
56
|
-
graphScore: 0,
|
|
57
|
-
recencyScore: 0,
|
|
58
|
-
salienceScore: 0,
|
|
59
|
-
temporalScore: 0,
|
|
60
|
-
source: 'vector',
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
keywordCandidates.push({
|
|
65
|
-
fact: r.fact,
|
|
66
|
-
vectorScore: 0,
|
|
67
|
-
keywordScore: r.relevanceScore,
|
|
68
|
-
graphScore: 0,
|
|
69
|
-
recencyScore: 0,
|
|
70
|
-
salienceScore: 0,
|
|
71
|
-
temporalScore: 0,
|
|
72
|
-
source: 'keyword',
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Normalize keyword scores to [0, 1] range
|
|
77
|
-
if (keywordCandidates.length > 0) {
|
|
78
|
-
const maxRank = Math.max(...keywordCandidates.map(c => c.keywordScore));
|
|
79
|
-
if (maxRank > 0) {
|
|
80
|
-
for (const c of keywordCandidates) {
|
|
81
|
-
c.keywordScore = c.keywordScore / maxRank;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return { vectorCandidates, keywordCandidates };
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=compound-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compound-search.js","sourceRoot":"","sources":["compound-search.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,iBAAiB;IACjB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO;IACrD,iCAAiC;IACjC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAA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,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { StorageAdapter } from '../adapters/storage.js';
|
|
2
|
-
import type { FusionResult } from './fusion.js';
|
|
3
|
-
import type { SearchResult } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Enrich fusion results with contradiction context.
|
|
6
|
-
* For each result where the fact has an active contradiction,
|
|
7
|
-
* fetch the contradicted fact and build a timeline description.
|
|
8
|
-
*/
|
|
9
|
-
export declare function surfaceContradictions(storage: StorageAdapter, tenantId: string, results: FusionResult[]): Promise<SearchResult[]>;
|
|
10
|
-
/**
|
|
11
|
-
* Build a human-readable timeline description of a contradiction.
|
|
12
|
-
* Examples:
|
|
13
|
-
* - "Opinion changed over ~2 months"
|
|
14
|
-
* - "Updated after 3 days"
|
|
15
|
-
* - "Superseded on the same day"
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildTimeline(oldValidFrom: Date, _oldValidUntil: Date | null, newValidFrom: Date): string;
|
|
18
|
-
//# sourceMappingURL=contradiction-surfacer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contradiction-surfacer.d.ts","sourceRoot":"","sources":["contradiction-surfacer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,YAAY,EAAE,CAAC,CAyCzB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,IAAI,EAClB,cAAc,EAAE,IAAI,GAAG,IAAI,EAC3B,YAAY,EAAE,IAAI,GACjB,MAAM,CAmBR"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enrich fusion results with contradiction context.
|
|
3
|
-
* For each result where the fact has an active contradiction,
|
|
4
|
-
* fetch the contradicted fact and build a timeline description.
|
|
5
|
-
*/
|
|
6
|
-
export async function surfaceContradictions(storage, tenantId, results) {
|
|
7
|
-
const enriched = [];
|
|
8
|
-
for (const result of results) {
|
|
9
|
-
const { fact } = result;
|
|
10
|
-
let contradiction;
|
|
11
|
-
if (fact.contradictionStatus !== 'none' &&
|
|
12
|
-
fact.contradictsId) {
|
|
13
|
-
const contradictedFact = await storage.getFact(tenantId, fact.contradictsId);
|
|
14
|
-
if (contradictedFact) {
|
|
15
|
-
const timeline = buildTimeline(contradictedFact.validFrom, contradictedFact.validUntil, fact.validFrom);
|
|
16
|
-
contradiction = {
|
|
17
|
-
contradicts: contradictedFact,
|
|
18
|
-
status: fact.contradictionStatus,
|
|
19
|
-
timeline,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// If contradicted fact was deleted (GDPR purge), gracefully omit contradiction context
|
|
23
|
-
}
|
|
24
|
-
enriched.push({
|
|
25
|
-
fact: result.fact,
|
|
26
|
-
score: result.score,
|
|
27
|
-
signals: result.signals,
|
|
28
|
-
triggeredBy: result.triggeredBy,
|
|
29
|
-
contradiction,
|
|
30
|
-
// graph and history are filled in by the search orchestrator later
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return enriched;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Build a human-readable timeline description of a contradiction.
|
|
37
|
-
* Examples:
|
|
38
|
-
* - "Opinion changed over ~2 months"
|
|
39
|
-
* - "Updated after 3 days"
|
|
40
|
-
* - "Superseded on the same day"
|
|
41
|
-
*/
|
|
42
|
-
export function buildTimeline(oldValidFrom, _oldValidUntil, newValidFrom) {
|
|
43
|
-
const oldDate = new Date(oldValidFrom);
|
|
44
|
-
const newDate = new Date(newValidFrom);
|
|
45
|
-
const diffMs = newDate.getTime() - oldDate.getTime();
|
|
46
|
-
const diffDays = Math.abs(Math.round(diffMs / (1000 * 60 * 60 * 24)));
|
|
47
|
-
if (diffDays === 0)
|
|
48
|
-
return 'Superseded on the same day';
|
|
49
|
-
if (diffDays === 1)
|
|
50
|
-
return 'Updated after 1 day';
|
|
51
|
-
if (diffDays < 7)
|
|
52
|
-
return `Updated after ${diffDays} days`;
|
|
53
|
-
if (diffDays < 30) {
|
|
54
|
-
const weeks = Math.round(diffDays / 7);
|
|
55
|
-
return `Changed over ~${weeks} week${weeks === 1 ? '' : 's'}`;
|
|
56
|
-
}
|
|
57
|
-
if (diffDays < 365) {
|
|
58
|
-
const months = Math.round(diffDays / 30);
|
|
59
|
-
return `Changed over ~${months} month${months === 1 ? '' : 's'}`;
|
|
60
|
-
}
|
|
61
|
-
const years = Math.round(diffDays / 365);
|
|
62
|
-
return `Changed over ~${years} year${years === 1 ? '' : 's'}`;
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=contradiction-surfacer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contradiction-surfacer.js","sourceRoot":"","sources":["contradiction-surfacer.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAuB,EACvB,QAAgB,EAChB,OAAuB;IAEvB,MAAM,QAAQ,GAAmB,EAAE,CAAC;IAEpC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,IAAI,aAAwD,CAAC;QAE7D,IACE,IAAI,CAAC,mBAAmB,KAAK,MAAM;YACnC,IAAI,CAAC,aAAa,EAClB,CAAC;YACD,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YAE7E,IAAI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CAAC;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACvC,OAAO,iBAAiB,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAChE,CAAC;IACD,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;QACzC,OAAO,iBAAiB,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;IACzC,OAAO,iBAAiB,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { EmbeddingAdapter } from '../adapters/embedding.js';
|
|
2
|
-
import type { CacheAdapter } from '../adapters/cache.js';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps an EmbeddingAdapter with caching.
|
|
5
|
-
* Same query text -> cached embedding (skip OpenAI call).
|
|
6
|
-
*/
|
|
7
|
-
export declare class CachedEmbeddingAdapter implements EmbeddingAdapter {
|
|
8
|
-
private inner;
|
|
9
|
-
private cache;
|
|
10
|
-
private ttlSeconds;
|
|
11
|
-
readonly model: string;
|
|
12
|
-
readonly dimensions: number;
|
|
13
|
-
constructor(inner: EmbeddingAdapter, cache: CacheAdapter, ttlSeconds?: number);
|
|
14
|
-
embed(text: string): Promise<number[]>;
|
|
15
|
-
embedBatch(texts: string[]): Promise<number[][]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=embedding-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-cache.d.ts","sourceRoot":"","sources":["embedding-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,gBAAgB;IAK3D,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,UAAU;IANpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAGlB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,YAAY,EACnB,UAAU,GAAE,MAAa;IAM7B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAUtC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;CA0BvD"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps an EmbeddingAdapter with caching.
|
|
3
|
-
* Same query text -> cached embedding (skip OpenAI call).
|
|
4
|
-
*/
|
|
5
|
-
export class CachedEmbeddingAdapter {
|
|
6
|
-
inner;
|
|
7
|
-
cache;
|
|
8
|
-
ttlSeconds;
|
|
9
|
-
model;
|
|
10
|
-
dimensions;
|
|
11
|
-
constructor(inner, cache, ttlSeconds = 3600) {
|
|
12
|
-
this.inner = inner;
|
|
13
|
-
this.cache = cache;
|
|
14
|
-
this.ttlSeconds = ttlSeconds;
|
|
15
|
-
this.model = inner.model;
|
|
16
|
-
this.dimensions = inner.dimensions;
|
|
17
|
-
}
|
|
18
|
-
async embed(text) {
|
|
19
|
-
const key = `emb:${this.model}:${await hashText(text)}`;
|
|
20
|
-
const cached = await this.cache.get(key);
|
|
21
|
-
if (cached)
|
|
22
|
-
return cached;
|
|
23
|
-
const result = await this.inner.embed(text);
|
|
24
|
-
await this.cache.set(key, result, this.ttlSeconds);
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
async embedBatch(texts) {
|
|
28
|
-
// For batch, check cache for each, only embed uncached ones
|
|
29
|
-
const results = [];
|
|
30
|
-
const uncachedIndices = [];
|
|
31
|
-
for (let i = 0; i < texts.length; i++) {
|
|
32
|
-
const key = `emb:${this.model}:${await hashText(texts[i])}`;
|
|
33
|
-
const cached = await this.cache.get(key);
|
|
34
|
-
results.push(cached);
|
|
35
|
-
if (!cached)
|
|
36
|
-
uncachedIndices.push(i);
|
|
37
|
-
}
|
|
38
|
-
if (uncachedIndices.length > 0) {
|
|
39
|
-
const uncachedTexts = uncachedIndices.map(i => texts[i]);
|
|
40
|
-
const freshEmbeddings = await this.inner.embedBatch(uncachedTexts);
|
|
41
|
-
for (let j = 0; j < uncachedIndices.length; j++) {
|
|
42
|
-
const idx = uncachedIndices[j];
|
|
43
|
-
results[idx] = freshEmbeddings[j];
|
|
44
|
-
const key = `emb:${this.model}:${await hashText(texts[idx])}`;
|
|
45
|
-
await this.cache.set(key, freshEmbeddings[j], this.ttlSeconds);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return results;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function hashText(text) {
|
|
52
|
-
const encoded = new TextEncoder().encode(text);
|
|
53
|
-
const hash = await crypto.subtle.digest('SHA-256', encoded);
|
|
54
|
-
return Array.from(new Uint8Array(hash)).map(b => b.toString(16).padStart(2, '0')).join('').slice(0, 16);
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=embedding-cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-cache.js","sourceRoot":"","sources":["embedding-cache.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAKvB;IACA;IACA;IAND,KAAK,CAA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AE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1G,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Candidate, FusionWeights } from './types.js';
|
|
2
|
-
import type { Fact } from '../models/fact.js';
|
|
3
|
-
export interface FusionResult {
|
|
4
|
-
fact: Fact;
|
|
5
|
-
score: number;
|
|
6
|
-
signals: {
|
|
7
|
-
vectorScore: number;
|
|
8
|
-
keywordScore: number;
|
|
9
|
-
graphScore: number;
|
|
10
|
-
recencyScore: number;
|
|
11
|
-
salienceScore: number;
|
|
12
|
-
temporalScore: number;
|
|
13
|
-
};
|
|
14
|
-
source: string;
|
|
15
|
-
triggeredBy?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Fuse candidates from multiple retrieval signals into a single ranked list.
|
|
19
|
-
*
|
|
20
|
-
* 1. Normalizes weights so they sum to 1.0
|
|
21
|
-
* 2. Deduplicates by fact ID, keeping the highest score per signal
|
|
22
|
-
* 3. Computes a weighted sum for each unique fact
|
|
23
|
-
* 4. Sorts by score descending
|
|
24
|
-
* 5. Returns the top `limit` results
|
|
25
|
-
*/
|
|
26
|
-
export declare function fuseAndRank(candidates: Candidate[], weights: FusionWeights, limit: number): FusionResult[];
|
|
27
|
-
//# sourceMappingURL=fusion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion.d.ts","sourceRoot":"","sources":["fusion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,MAAM,GACZ,YAAY,EAAE,CAiGhB"}
|
package/src/retrieval/fusion.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fuse candidates from multiple retrieval signals into a single ranked list.
|
|
3
|
-
*
|
|
4
|
-
* 1. Normalizes weights so they sum to 1.0
|
|
5
|
-
* 2. Deduplicates by fact ID, keeping the highest score per signal
|
|
6
|
-
* 3. Computes a weighted sum for each unique fact
|
|
7
|
-
* 4. Sorts by score descending
|
|
8
|
-
* 5. Returns the top `limit` results
|
|
9
|
-
*/
|
|
10
|
-
export function fuseAndRank(candidates, weights, limit) {
|
|
11
|
-
if (candidates.length === 0)
|
|
12
|
-
return [];
|
|
13
|
-
// 1. Normalize weights so they sum to 1.0
|
|
14
|
-
const sum = weights.vector +
|
|
15
|
-
weights.keyword +
|
|
16
|
-
weights.graph +
|
|
17
|
-
weights.recency +
|
|
18
|
-
weights.salience +
|
|
19
|
-
weights.temporal;
|
|
20
|
-
const w = sum === 0
|
|
21
|
-
? { vector: 1 / 6, keyword: 1 / 6, graph: 1 / 6, recency: 1 / 6, salience: 1 / 6, temporal: 1 / 6 }
|
|
22
|
-
: {
|
|
23
|
-
vector: weights.vector / sum,
|
|
24
|
-
keyword: weights.keyword / sum,
|
|
25
|
-
graph: weights.graph / sum,
|
|
26
|
-
recency: weights.recency / sum,
|
|
27
|
-
salience: weights.salience / sum,
|
|
28
|
-
temporal: weights.temporal / sum,
|
|
29
|
-
};
|
|
30
|
-
// 2. Deduplicate by fact ID — keep highest score per signal
|
|
31
|
-
const factMap = new Map();
|
|
32
|
-
for (const c of candidates) {
|
|
33
|
-
const existing = factMap.get(c.fact.id);
|
|
34
|
-
if (existing) {
|
|
35
|
-
existing.vectorScore = Math.max(existing.vectorScore, c.vectorScore);
|
|
36
|
-
existing.keywordScore = Math.max(existing.keywordScore, c.keywordScore);
|
|
37
|
-
existing.graphScore = Math.max(existing.graphScore, c.graphScore);
|
|
38
|
-
existing.recencyScore = Math.max(existing.recencyScore, c.recencyScore);
|
|
39
|
-
existing.salienceScore = Math.max(existing.salienceScore, c.salienceScore);
|
|
40
|
-
existing.temporalScore = Math.max(existing.temporalScore, c.temporalScore);
|
|
41
|
-
if (c.triggeredBy)
|
|
42
|
-
existing.triggeredBy = c.triggeredBy;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
factMap.set(c.fact.id, {
|
|
46
|
-
fact: c.fact,
|
|
47
|
-
vectorScore: c.vectorScore,
|
|
48
|
-
keywordScore: c.keywordScore,
|
|
49
|
-
graphScore: c.graphScore,
|
|
50
|
-
recencyScore: c.recencyScore,
|
|
51
|
-
salienceScore: c.salienceScore,
|
|
52
|
-
temporalScore: c.temporalScore,
|
|
53
|
-
source: c.source,
|
|
54
|
-
triggeredBy: c.triggeredBy,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// 3. Compute final score for each unique fact
|
|
59
|
-
const results = [];
|
|
60
|
-
for (const entry of factMap.values()) {
|
|
61
|
-
const score = entry.vectorScore * w.vector +
|
|
62
|
-
entry.keywordScore * w.keyword +
|
|
63
|
-
entry.graphScore * w.graph +
|
|
64
|
-
entry.recencyScore * w.recency +
|
|
65
|
-
entry.salienceScore * w.salience +
|
|
66
|
-
entry.temporalScore * w.temporal;
|
|
67
|
-
results.push({
|
|
68
|
-
fact: entry.fact,
|
|
69
|
-
score,
|
|
70
|
-
signals: {
|
|
71
|
-
vectorScore: entry.vectorScore,
|
|
72
|
-
keywordScore: entry.keywordScore,
|
|
73
|
-
graphScore: entry.graphScore,
|
|
74
|
-
recencyScore: entry.recencyScore,
|
|
75
|
-
salienceScore: entry.salienceScore,
|
|
76
|
-
temporalScore: entry.temporalScore,
|
|
77
|
-
},
|
|
78
|
-
source: entry.source,
|
|
79
|
-
triggeredBy: entry.triggeredBy,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
// 4. Sort by score descending
|
|
83
|
-
results.sort((a, b) => b.score - a.score);
|
|
84
|
-
// 5. Take top N
|
|
85
|
-
return results.slice(0, limit);
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=fusion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fusion.js","sourceRoot":"","sources":["fusion.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,UAAuB,EACvB,OAAsB,EACtB,KAAa;IAEb,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,0CAA0C;IAC1C,MAAM,GAAG,GACP,OAAO,CAAC,MAAM;QACd,OAAO,CAAC,OAAO;QACf,OAAO,CAAC,KAAK;QACb,OAAO,CAAC,OAAO;QACf,OAAO,CAAC,QAAQ;QAChB,OAAO,CAAC,QAAQ,CAAC;IAEnB,MAAM,CAAC,GACL,GAAG,KAAK,CAAC;QACP,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAC,CAAC,EAAE;QACvF,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,CAAC,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ClC,aAAa,EAAE,KAAK,CAAC,aAAa;aACnC;YACD,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,8BAA8B;IAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAE1C,gBAAgB;IAChB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { StorageAdapter } from '../adapters/storage.js';
|
|
2
|
-
import type { EmbeddingAdapter } from '../adapters/embedding.js';
|
|
3
|
-
import type { Candidate } from './types.js';
|
|
4
|
-
export interface GraphSearchConfig {
|
|
5
|
-
maxDepth: number;
|
|
6
|
-
maxEntities: number;
|
|
7
|
-
asOf?: Date;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Tokenize query into candidate entity names.
|
|
11
|
-
* Splits on whitespace and dots, filters short words (< 2 chars), lowercases for canonical lookup.
|
|
12
|
-
* Also preserves dot-separated names as candidate names (e.g., "clean.ai" → tokens ["clean", "ai"] + candidate "clean.ai")
|
|
13
|
-
*/
|
|
14
|
-
export declare function tokenizeQuery(query: string): string[];
|
|
15
|
-
/**
|
|
16
|
-
* Graph-based retrieval module.
|
|
17
|
-
*
|
|
18
|
-
* 1. Extracts potential entity names from query (simple tokenization)
|
|
19
|
-
* 2. For each token, tries to find matching entities by canonical name
|
|
20
|
-
* 3. Uses found entity IDs as seeds for graphTraversal
|
|
21
|
-
* 4. Gets facts connected to discovered entities via getFactsForEntity
|
|
22
|
-
* 5. Assigns graphScore based on hop distance: 1/(2^hop_depth)
|
|
23
|
-
* - 0-hop (seed) = 1.0
|
|
24
|
-
* - 1-hop = 0.5
|
|
25
|
-
* - 2-hop = 0.25
|
|
26
|
-
* - 3-hop = 0.125
|
|
27
|
-
*/
|
|
28
|
-
export declare function graphSearch(storage: StorageAdapter, embedding: EmbeddingAdapter, query: string, tenantId: string, _scope: string, _scopeId: string, limit: number, config?: Partial<GraphSearchConfig>): Promise<Candidate[]>;
|
|
29
|
-
//# sourceMappingURL=graph-traversal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-traversal.d.ts","sourceRoot":"","sources":["graph-traversal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAUD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAMrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAqLtB"}
|