@grackle-ai/knowledge 0.62.2 → 0.64.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/index.d.ts +4 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -16
- package/dist/index.js.map +1 -1
- package/dist/reference-sync.d.ts +1 -2
- package/dist/reference-sync.d.ts.map +1 -1
- package/dist/reference-sync.js +1 -5
- package/dist/reference-sync.js.map +1 -1
- package/package.json +2 -5
- package/dist/chunker.d.ts +0 -20
- package/dist/chunker.d.ts.map +0 -1
- package/dist/chunker.js +0 -7
- package/dist/chunker.js.map +0 -1
- package/dist/client.d.ts +0 -68
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -150
- package/dist/client.js.map +0 -1
- package/dist/constants.d.ts +0 -33
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -33
- package/dist/constants.js.map +0 -1
- package/dist/edge-store.d.ts +0 -32
- package/dist/edge-store.d.ts.map +0 -1
- package/dist/edge-store.js +0 -145
- package/dist/edge-store.js.map +0 -1
- package/dist/embedder.d.ts +0 -35
- package/dist/embedder.d.ts.map +0 -1
- package/dist/embedder.js +0 -7
- package/dist/embedder.js.map +0 -1
- package/dist/expand.d.ts +0 -42
- package/dist/expand.d.ts.map +0 -1
- package/dist/expand.js +0 -150
- package/dist/expand.js.map +0 -1
- package/dist/ingest.d.ts +0 -23
- package/dist/ingest.d.ts.map +0 -1
- package/dist/ingest.js +0 -27
- package/dist/ingest.js.map +0 -1
- package/dist/local-embedder.d.ts +0 -25
- package/dist/local-embedder.d.ts.map +0 -1
- package/dist/local-embedder.js +0 -88
- package/dist/local-embedder.js.map +0 -1
- package/dist/logger.d.ts +0 -9
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -15
- package/dist/logger.js.map +0 -1
- package/dist/node-store.d.ts +0 -116
- package/dist/node-store.d.ts.map +0 -1
- package/dist/node-store.js +0 -268
- package/dist/node-store.js.map +0 -1
- package/dist/pass-through-chunker.d.ts +0 -16
- package/dist/pass-through-chunker.d.ts.map +0 -1
- package/dist/pass-through-chunker.js +0 -21
- package/dist/pass-through-chunker.js.map +0 -1
- package/dist/schema.d.ts +0 -23
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -73
- package/dist/schema.js.map +0 -1
- package/dist/search.d.ts +0 -43
- package/dist/search.d.ts.map +0 -1
- package/dist/search.js +0 -123
- package/dist/search.js.map +0 -1
- package/dist/transcript-chunker.d.ts +0 -29
- package/dist/transcript-chunker.d.ts.map +0 -1
- package/dist/transcript-chunker.js +0 -142
- package/dist/transcript-chunker.js.map +0 -1
- package/dist/types.d.ts +0 -102
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -61
- package/dist/types.js.map +0 -1
package/dist/search.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vector-based semantic search across the knowledge graph.
|
|
3
|
-
*
|
|
4
|
-
* Embeds a text query, runs k-NN vector search against Neo4j's vector index,
|
|
5
|
-
* and returns ranked results with similarity scores and immediate edges.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import { getSession } from "./client.js";
|
|
10
|
-
import { logger } from "./logger.js";
|
|
11
|
-
import { NODE_LABEL, VECTOR_INDEX_NAME } from "./constants.js";
|
|
12
|
-
import { recordToNode, recordToEdge } from "./node-store.js";
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// Constants
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
/** Default number of results to return. */
|
|
17
|
-
const DEFAULT_LIMIT = 10;
|
|
18
|
-
/** Default minimum similarity score. */
|
|
19
|
-
const DEFAULT_MIN_SCORE = 0;
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
// Cypher
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
/**
|
|
24
|
-
* Build the Cypher query for vector search with optional filters.
|
|
25
|
-
*
|
|
26
|
-
* Neo4j's `db.index.vector.queryNodes` does not support WHERE clauses
|
|
27
|
-
* directly, so we apply post-filters on the yielded results.
|
|
28
|
-
*/
|
|
29
|
-
function buildSearchCypher(options) {
|
|
30
|
-
const filters = ["score >= $minScore"];
|
|
31
|
-
if (options.nodeKinds && options.nodeKinds.length > 0) {
|
|
32
|
-
filters.push("node.kind IN $nodeKinds");
|
|
33
|
-
}
|
|
34
|
-
if (options.workspaceId !== undefined) {
|
|
35
|
-
filters.push("node.workspaceId = $workspaceId");
|
|
36
|
-
}
|
|
37
|
-
const whereClause = filters.length > 0
|
|
38
|
-
? `WHERE ${filters.join(" AND ")}`
|
|
39
|
-
: "";
|
|
40
|
-
// Neo4j requires integer literals for LIMIT and the vector query count.
|
|
41
|
-
return `
|
|
42
|
-
CALL db.index.vector.queryNodes($indexName, ${options.candidateLimit}, $queryVector)
|
|
43
|
-
YIELD node, score
|
|
44
|
-
${whereClause}
|
|
45
|
-
WITH node, score
|
|
46
|
-
ORDER BY score DESC
|
|
47
|
-
LIMIT ${options.limit}
|
|
48
|
-
OPTIONAL MATCH (node)-[r]-(m:${NODE_LABEL})
|
|
49
|
-
RETURN node, score,
|
|
50
|
-
collect(DISTINCT {
|
|
51
|
-
fromId: CASE WHEN startNode(r) = node THEN node.id ELSE m.id END,
|
|
52
|
-
toId: CASE WHEN endNode(r) = node THEN node.id ELSE m.id END,
|
|
53
|
-
type: type(r),
|
|
54
|
-
metadata: r.metadata,
|
|
55
|
-
createdAt: r.createdAt
|
|
56
|
-
}) AS edges`;
|
|
57
|
-
}
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
// Public API
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
/**
|
|
62
|
-
* Search the knowledge graph by semantic similarity.
|
|
63
|
-
*
|
|
64
|
-
* Embeds the query text, runs k-NN vector search in Neo4j, and returns
|
|
65
|
-
* ranked results with similarity scores and immediate edges.
|
|
66
|
-
*
|
|
67
|
-
* @param query - The text to search for.
|
|
68
|
-
* @param embedder - Produces the query embedding vector.
|
|
69
|
-
* @param options - Optional search filters and limits.
|
|
70
|
-
* @returns Ranked search results, highest similarity first.
|
|
71
|
-
*/
|
|
72
|
-
export async function knowledgeSearch(query, embedder, options) {
|
|
73
|
-
const limit = options?.limit ?? DEFAULT_LIMIT;
|
|
74
|
-
const minScore = options?.minScore ?? DEFAULT_MIN_SCORE;
|
|
75
|
-
// Embed the query
|
|
76
|
-
const { vector: queryVector } = await embedder.embed(query);
|
|
77
|
-
// Over-fetch when filtering so we still get enough results after post-filter
|
|
78
|
-
const hasFilters = !!(options?.nodeKinds?.length || options?.workspaceId !== undefined);
|
|
79
|
-
const candidateLimit = hasFilters ? limit * 3 : limit;
|
|
80
|
-
const cypher = buildSearchCypher({
|
|
81
|
-
limit,
|
|
82
|
-
candidateLimit,
|
|
83
|
-
nodeKinds: options?.nodeKinds,
|
|
84
|
-
workspaceId: options?.workspaceId,
|
|
85
|
-
});
|
|
86
|
-
const params = {
|
|
87
|
-
indexName: VECTOR_INDEX_NAME,
|
|
88
|
-
queryVector,
|
|
89
|
-
minScore,
|
|
90
|
-
...(options?.nodeKinds ? { nodeKinds: options.nodeKinds } : {}),
|
|
91
|
-
...(options?.workspaceId !== undefined ? { workspaceId: options.workspaceId } : {}),
|
|
92
|
-
};
|
|
93
|
-
const session = getSession();
|
|
94
|
-
try {
|
|
95
|
-
const result = await session.run(cypher, params);
|
|
96
|
-
const searchResults = result.records.map((record) => {
|
|
97
|
-
const neo4jNode = record.get("node");
|
|
98
|
-
const nodeProps = neo4jNode.properties;
|
|
99
|
-
const score = record.get("score");
|
|
100
|
-
const rawEdges = record.get("edges");
|
|
101
|
-
// Filter out null edges (from OPTIONAL MATCH with no relationships)
|
|
102
|
-
const edges = rawEdges
|
|
103
|
-
.filter((e) => e.fromId !== null && e.toId !== null)
|
|
104
|
-
.map(recordToEdge);
|
|
105
|
-
return {
|
|
106
|
-
node: recordToNode(nodeProps),
|
|
107
|
-
score,
|
|
108
|
-
edges,
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
logger.debug({ query: query.substring(0, 50), results: searchResults.length, limit }, "Knowledge search completed");
|
|
112
|
-
return searchResults;
|
|
113
|
-
}
|
|
114
|
-
finally {
|
|
115
|
-
try {
|
|
116
|
-
await session.close();
|
|
117
|
-
}
|
|
118
|
-
catch (closeError) {
|
|
119
|
-
logger.warn({ err: closeError }, "Failed to close session after knowledgeSearch");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=search.js.map
|
package/dist/search.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8B7D,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,2CAA2C;AAC3C,MAAM,aAAa,GAAW,EAAE,CAAC;AAEjC,wCAAwC;AACxC,MAAM,iBAAiB,GAAW,CAAC,CAAC;AAEpC,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,OAK1B;IACC,MAAM,OAAO,GAAa,CAAC,oBAAoB,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,WAAW,KAAK,SAA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C;QAEF,OAAO,aAAa,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,+CAA+C,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session transcript chunker that splits JSONL session logs by conversation turn.
|
|
3
|
-
*
|
|
4
|
-
* Accepts the raw JSONL content of a session's `stream.jsonl` file and groups
|
|
5
|
-
* events into semantic turns (user input → agent response) for embedding.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import type { Chunker } from "./chunker.js";
|
|
10
|
-
/** Options for the session transcript chunker. */
|
|
11
|
-
export interface TranscriptChunkerOptions {
|
|
12
|
-
/** Max characters per chunk before splitting (default 4000). */
|
|
13
|
-
maxChunkSize?: number;
|
|
14
|
-
/** Event types to skip (default: status, signal, usage, system). */
|
|
15
|
-
skipEventTypes?: string[];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Create a chunker that splits JSONL session transcripts by conversation turn.
|
|
19
|
-
*
|
|
20
|
-
* A "turn" starts at a `user_input` event and includes all subsequent events
|
|
21
|
-
* until the next `user_input`. Events before the first `user_input` are grouped
|
|
22
|
-
* into an initial turn (turn 0). Turns exceeding {@link TranscriptChunkerOptions.maxChunkSize}
|
|
23
|
-
* are split into sub-chunks.
|
|
24
|
-
*
|
|
25
|
-
* @param options - Optional chunker configuration.
|
|
26
|
-
* @returns A {@link Chunker} for session transcript JSONL content.
|
|
27
|
-
*/
|
|
28
|
-
export declare function createTranscriptChunker(options?: TranscriptChunkerOptions): Chunker;
|
|
29
|
-
//# sourceMappingURL=transcript-chunker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-chunker.d.ts","sourceRoot":"","sources":["../src/transcript-chunker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAS,OAAO,EAAE,MAAM,cAAc,CAAC;AAgBnD,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAmBD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAkDnF"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session transcript chunker that splits JSONL session logs by conversation turn.
|
|
3
|
-
*
|
|
4
|
-
* Accepts the raw JSONL content of a session's `stream.jsonl` file and groups
|
|
5
|
-
* events into semantic turns (user input → agent response) for embedding.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
/** Default event types that are excluded from chunks. */
|
|
10
|
-
const DEFAULT_SKIP_TYPES = ["status", "signal", "usage", "system"];
|
|
11
|
-
/** Default maximum characters per chunk. */
|
|
12
|
-
const DEFAULT_MAX_CHUNK_SIZE = 4000;
|
|
13
|
-
/** Labels used when rendering events into readable text. */
|
|
14
|
-
const EVENT_LABELS = {
|
|
15
|
-
user_input: "User",
|
|
16
|
-
text: "Assistant",
|
|
17
|
-
tool_use: "Tool",
|
|
18
|
-
tool_result: "Result",
|
|
19
|
-
error: "Error",
|
|
20
|
-
finding: "Finding",
|
|
21
|
-
subtask_create: "Subtask",
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Create a chunker that splits JSONL session transcripts by conversation turn.
|
|
25
|
-
*
|
|
26
|
-
* A "turn" starts at a `user_input` event and includes all subsequent events
|
|
27
|
-
* until the next `user_input`. Events before the first `user_input` are grouped
|
|
28
|
-
* into an initial turn (turn 0). Turns exceeding {@link TranscriptChunkerOptions.maxChunkSize}
|
|
29
|
-
* are split into sub-chunks.
|
|
30
|
-
*
|
|
31
|
-
* @param options - Optional chunker configuration.
|
|
32
|
-
* @returns A {@link Chunker} for session transcript JSONL content.
|
|
33
|
-
*/
|
|
34
|
-
export function createTranscriptChunker(options) {
|
|
35
|
-
const maxChunkSize = options?.maxChunkSize ?? DEFAULT_MAX_CHUNK_SIZE;
|
|
36
|
-
const skipTypes = new Set(options?.skipEventTypes ?? DEFAULT_SKIP_TYPES);
|
|
37
|
-
return {
|
|
38
|
-
chunk(content, metadata) {
|
|
39
|
-
const entries = parseJsonl(content);
|
|
40
|
-
if (entries.length === 0) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
// Group on all entries first so user_input boundaries are preserved
|
|
44
|
-
// even if user_input is in skipTypes. Filter when rendering.
|
|
45
|
-
const turns = groupByTurn(entries);
|
|
46
|
-
const chunks = [];
|
|
47
|
-
for (let turnIndex = 0; turnIndex < turns.length; turnIndex++) {
|
|
48
|
-
const turnEntries = turns[turnIndex];
|
|
49
|
-
const visible = turnEntries.filter((e) => !skipTypes.has(e.type));
|
|
50
|
-
if (visible.length === 0) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const text = renderTurn(visible);
|
|
54
|
-
const timestamps = visible.map((e) => e.timestamp);
|
|
55
|
-
const eventTypes = [...new Set(visible.map((e) => e.type))];
|
|
56
|
-
const turnMetadata = {
|
|
57
|
-
...metadata,
|
|
58
|
-
turnIndex,
|
|
59
|
-
timestampStart: timestamps[0],
|
|
60
|
-
timestampEnd: timestamps[timestamps.length - 1],
|
|
61
|
-
eventTypes,
|
|
62
|
-
};
|
|
63
|
-
if (text.length <= maxChunkSize) {
|
|
64
|
-
chunks.push({ text, index: chunks.length, metadata: turnMetadata });
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const subChunks = splitText(text, maxChunkSize);
|
|
68
|
-
for (const subChunk of subChunks) {
|
|
69
|
-
chunks.push({ text: subChunk, index: chunks.length, metadata: turnMetadata });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return chunks;
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/** Parse a JSONL string into an array of log entries, skipping malformed lines. */
|
|
78
|
-
function parseJsonl(content) {
|
|
79
|
-
const entries = [];
|
|
80
|
-
for (const line of content.split("\n")) {
|
|
81
|
-
const trimmed = line.trim();
|
|
82
|
-
if (!trimmed) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
entries.push(JSON.parse(trimmed));
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
// Skip malformed lines
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return entries;
|
|
93
|
-
}
|
|
94
|
-
/** Group log entries into turns, splitting on `user_input` events. */
|
|
95
|
-
function groupByTurn(entries) {
|
|
96
|
-
const turns = [];
|
|
97
|
-
let current = [];
|
|
98
|
-
for (const entry of entries) {
|
|
99
|
-
if (entry.type === "user_input" && current.length > 0) {
|
|
100
|
-
turns.push(current);
|
|
101
|
-
current = [];
|
|
102
|
-
}
|
|
103
|
-
current.push(entry);
|
|
104
|
-
}
|
|
105
|
-
if (current.length > 0) {
|
|
106
|
-
turns.push(current);
|
|
107
|
-
}
|
|
108
|
-
return turns;
|
|
109
|
-
}
|
|
110
|
-
/** Render a turn's events into human-readable text. */
|
|
111
|
-
function renderTurn(entries) {
|
|
112
|
-
return entries
|
|
113
|
-
.map((e) => {
|
|
114
|
-
const label = EVENT_LABELS[e.type] ?? e.type;
|
|
115
|
-
return `${label}: ${e.content}`;
|
|
116
|
-
})
|
|
117
|
-
.join("\n");
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Split text into sub-chunks at line boundaries, targeting at most maxSize characters.
|
|
121
|
-
* A single line longer than maxSize will be emitted as-is (not split mid-line).
|
|
122
|
-
*/
|
|
123
|
-
function splitText(text, maxSize) {
|
|
124
|
-
const lines = text.split("\n");
|
|
125
|
-
const subChunks = [];
|
|
126
|
-
let current = "";
|
|
127
|
-
for (const line of lines) {
|
|
128
|
-
const candidate = current ? current + "\n" + line : line;
|
|
129
|
-
if (candidate.length > maxSize && current) {
|
|
130
|
-
subChunks.push(current);
|
|
131
|
-
current = line;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
current = candidate;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (current) {
|
|
138
|
-
subChunks.push(current);
|
|
139
|
-
}
|
|
140
|
-
return subChunks;
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=transcript-chunker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-chunker.js","sourceRoot":"","sources":["../src/transcript-chunker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH,yDAAyD;AACzD,MAAM,kBAAkB,GAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE7E,4CAA4C;AAC5C,MAAM,sBAAsB,GAAW,IAAI,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,YAAY,GAA2B;IAC3C,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,SAAS;CAC1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAkC;IACxE,MAAM,YAAY,GAAW,OAAO,EAAE,YAAY,IAAI,sBAAsB,CAAC;IAC7E,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,OAAO,EAAE,cAAc,IAAI,kBAAkB,CAAC,CAAC;IAEtF,OAAO;QACL,KAAK,CAAC,OAAe,EAAE,QAA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OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core domain types for the knowledge graph.
|
|
3
|
-
*
|
|
4
|
-
* Defines the two node kinds (reference and native), edge types, and
|
|
5
|
-
* runtime type guards for discriminating between node variants.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
/** Discriminator for knowledge graph node kinds. */
|
|
10
|
-
export declare const NODE_KIND: {
|
|
11
|
-
/** Points to an entity in Grackle's relational DB. No duplicated content. */
|
|
12
|
-
readonly REFERENCE: "reference";
|
|
13
|
-
/** Exists only in the graph. Owns its content. */
|
|
14
|
-
readonly NATIVE: "native";
|
|
15
|
-
};
|
|
16
|
-
/** Union of all node kind values. */
|
|
17
|
-
export type NodeKind = (typeof NODE_KIND)[keyof typeof NODE_KIND];
|
|
18
|
-
/** Entity types that a reference node can point to. */
|
|
19
|
-
export declare const REFERENCE_SOURCE: {
|
|
20
|
-
readonly TASK: "task";
|
|
21
|
-
readonly SESSION: "session";
|
|
22
|
-
readonly FINDING: "finding";
|
|
23
|
-
readonly WORKSPACE: "workspace";
|
|
24
|
-
};
|
|
25
|
-
/** Union of all reference source values. */
|
|
26
|
-
export type ReferenceSource = (typeof REFERENCE_SOURCE)[keyof typeof REFERENCE_SOURCE];
|
|
27
|
-
/** Categories for native nodes that exist only in the knowledge graph. */
|
|
28
|
-
export declare const NATIVE_CATEGORY: {
|
|
29
|
-
readonly DECISION: "decision";
|
|
30
|
-
readonly INSIGHT: "insight";
|
|
31
|
-
readonly CONCEPT: "concept";
|
|
32
|
-
readonly SNIPPET: "snippet";
|
|
33
|
-
};
|
|
34
|
-
/** Union of all native category values. */
|
|
35
|
-
export type NativeCategory = (typeof NATIVE_CATEGORY)[keyof typeof NATIVE_CATEGORY];
|
|
36
|
-
/** Relationship types between knowledge graph nodes. */
|
|
37
|
-
export declare const EDGE_TYPE: {
|
|
38
|
-
readonly RELATES_TO: "RELATES_TO";
|
|
39
|
-
readonly DEPENDS_ON: "DEPENDS_ON";
|
|
40
|
-
readonly DERIVED_FROM: "DERIVED_FROM";
|
|
41
|
-
readonly MENTIONS: "MENTIONS";
|
|
42
|
-
readonly PART_OF: "PART_OF";
|
|
43
|
-
};
|
|
44
|
-
/** Union of all edge type values. */
|
|
45
|
-
export type EdgeType = (typeof EDGE_TYPE)[keyof typeof EDGE_TYPE];
|
|
46
|
-
/** Properties common to all knowledge graph nodes. */
|
|
47
|
-
export interface KnowledgeNodeBase {
|
|
48
|
-
/** Unique node identifier (UUID). */
|
|
49
|
-
id: string;
|
|
50
|
-
/** Which kind of node this is. */
|
|
51
|
-
kind: NodeKind;
|
|
52
|
-
/** Dense vector embedding for similarity search. */
|
|
53
|
-
embedding: number[];
|
|
54
|
-
/** ISO 8601 creation timestamp. */
|
|
55
|
-
createdAt: string;
|
|
56
|
-
/** ISO 8601 last-updated timestamp. */
|
|
57
|
-
updatedAt: string;
|
|
58
|
-
/** Workspace scope (empty string = global). */
|
|
59
|
-
workspaceId: string;
|
|
60
|
-
}
|
|
61
|
-
/** A reference node — points to an entity in Grackle's relational DB. */
|
|
62
|
-
export interface ReferenceNode extends KnowledgeNodeBase {
|
|
63
|
-
kind: typeof NODE_KIND.REFERENCE;
|
|
64
|
-
/** Which entity type this refers to. */
|
|
65
|
-
sourceType: ReferenceSource;
|
|
66
|
-
/** The ID of the entity in Grackle's relational DB. */
|
|
67
|
-
sourceId: string;
|
|
68
|
-
/** Human-readable label derived from the source (e.g., task title). */
|
|
69
|
-
label: string;
|
|
70
|
-
}
|
|
71
|
-
/** A native node — owns its content directly. */
|
|
72
|
-
export interface NativeNode extends KnowledgeNodeBase {
|
|
73
|
-
kind: typeof NODE_KIND.NATIVE;
|
|
74
|
-
/** Subcategory of the native node. */
|
|
75
|
-
category: NativeCategory;
|
|
76
|
-
/** Title or summary. */
|
|
77
|
-
title: string;
|
|
78
|
-
/** Full content owned by this node. */
|
|
79
|
-
content: string;
|
|
80
|
-
/** Free-form tags for categorization. */
|
|
81
|
-
tags: string[];
|
|
82
|
-
}
|
|
83
|
-
/** Discriminated union of all knowledge graph node types. */
|
|
84
|
-
export type KnowledgeNode = ReferenceNode | NativeNode;
|
|
85
|
-
/** An edge (relationship) in the knowledge graph. */
|
|
86
|
-
export interface KnowledgeEdge {
|
|
87
|
-
/** Source node ID. */
|
|
88
|
-
fromId: string;
|
|
89
|
-
/** Target node ID. */
|
|
90
|
-
toId: string;
|
|
91
|
-
/** Relationship type. */
|
|
92
|
-
type: EdgeType;
|
|
93
|
-
/** Optional metadata (e.g., confidence score, context snippet). */
|
|
94
|
-
metadata?: Record<string, unknown>;
|
|
95
|
-
/** ISO 8601 timestamp when the edge was created. */
|
|
96
|
-
createdAt: string;
|
|
97
|
-
}
|
|
98
|
-
/** Returns true if the node is a {@link ReferenceNode}. */
|
|
99
|
-
export declare function isReferenceNode(node: KnowledgeNode): node is ReferenceNode;
|
|
100
|
-
/** Returns true if the node is a {@link NativeNode}. */
|
|
101
|
-
export declare function isNativeNode(node: KnowledgeNode): node is NativeNode;
|
|
102
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,oDAAoD;AACpD,eAAO,MAAM,SAAS;IACpB,6EAA6E;;IAE7E,kDAAkD;;CAE1C,CAAC;AAEX,qCAAqC;AACrC,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAMlE,uDAAuD;AACvD,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,gBAAgB,CAAC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AA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,UAAU,CAAC;AAMvD,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,IAAI,aAAa,CAE1E;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,IAAI,UAAU,CAEpE"}
|
package/dist/types.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core domain types for the knowledge graph.
|
|
3
|
-
*
|
|
4
|
-
* Defines the two node kinds (reference and native), edge types, and
|
|
5
|
-
* runtime type guards for discriminating between node variants.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Node kind discriminator
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
/** Discriminator for knowledge graph node kinds. */
|
|
13
|
-
export const NODE_KIND = {
|
|
14
|
-
/** Points to an entity in Grackle's relational DB. No duplicated content. */
|
|
15
|
-
REFERENCE: "reference",
|
|
16
|
-
/** Exists only in the graph. Owns its content. */
|
|
17
|
-
NATIVE: "native",
|
|
18
|
-
};
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
// Reference node source types
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
/** Entity types that a reference node can point to. */
|
|
23
|
-
export const REFERENCE_SOURCE = {
|
|
24
|
-
TASK: "task",
|
|
25
|
-
SESSION: "session",
|
|
26
|
-
FINDING: "finding",
|
|
27
|
-
WORKSPACE: "workspace",
|
|
28
|
-
};
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// Native node categories
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
/** Categories for native nodes that exist only in the knowledge graph. */
|
|
33
|
-
export const NATIVE_CATEGORY = {
|
|
34
|
-
DECISION: "decision",
|
|
35
|
-
INSIGHT: "insight",
|
|
36
|
-
CONCEPT: "concept",
|
|
37
|
-
SNIPPET: "snippet",
|
|
38
|
-
};
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
// Edge types
|
|
41
|
-
// ---------------------------------------------------------------------------
|
|
42
|
-
/** Relationship types between knowledge graph nodes. */
|
|
43
|
-
export const EDGE_TYPE = {
|
|
44
|
-
RELATES_TO: "RELATES_TO",
|
|
45
|
-
DEPENDS_ON: "DEPENDS_ON",
|
|
46
|
-
DERIVED_FROM: "DERIVED_FROM",
|
|
47
|
-
MENTIONS: "MENTIONS",
|
|
48
|
-
PART_OF: "PART_OF",
|
|
49
|
-
};
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Type guards
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
/** Returns true if the node is a {@link ReferenceNode}. */
|
|
54
|
-
export function isReferenceNode(node) {
|
|
55
|
-
return node.kind === NODE_KIND.REFERENCE;
|
|
56
|
-
}
|
|
57
|
-
/** Returns true if the node is a {@link NativeNode}. */
|
|
58
|
-
export function isNativeNode(node) {
|
|
59
|
-
return node.kind === NODE_KIND.NATIVE;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,0BAA0B;AAC1B,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