@grackle-ai/knowledge 0.58.0 → 0.59.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.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Neo4j driver singleton — connection management, health checks, and shutdown.
3
+ *
4
+ * Follows the same singleton pattern as `packages/server/src/db.ts`.
5
+ * Call {@link openNeo4j} once at startup, then use {@link getDriver} or
6
+ * {@link getSession} for queries, and {@link closeNeo4j} on shutdown.
7
+ *
8
+ * @module
9
+ */
10
+ import { type Driver, type Session } from "neo4j-driver";
11
+ /** Configuration for the Neo4j connection. */
12
+ export interface Neo4jClientConfig {
13
+ /** Bolt URL (default: bolt://localhost:7687). */
14
+ url?: string;
15
+ /** Username (default: neo4j). */
16
+ username?: string;
17
+ /** Password (default: grackle-dev). */
18
+ password?: string;
19
+ /** Neo4j database name (default: neo4j). */
20
+ database?: string;
21
+ }
22
+ /**
23
+ * Open a connection to Neo4j.
24
+ *
25
+ * Reads configuration from environment variables first, then from the
26
+ * provided {@link Neo4jClientConfig}, then from built-in defaults.
27
+ *
28
+ * Idempotent — returns silently if a connection is already open.
29
+ *
30
+ * | Env Variable | Fallback |
31
+ * |--------------------------|---------------------|
32
+ * | `GRACKLE_NEO4J_URL` | `config.url` |
33
+ * | `GRACKLE_NEO4J_USER` | `config.username` |
34
+ * | `GRACKLE_NEO4J_PASSWORD` | `config.password` |
35
+ * | `GRACKLE_NEO4J_DATABASE` | `config.database` |
36
+ */
37
+ export declare function openNeo4j(config?: Neo4jClientConfig): Promise<void>;
38
+ /**
39
+ * Get a Neo4j session for running queries.
40
+ *
41
+ * Sessions are lightweight and should be short-lived — open one per
42
+ * logical unit of work and close it when done.
43
+ *
44
+ * @throws If {@link openNeo4j} has not been called.
45
+ */
46
+ export declare function getSession(): Session;
47
+ /**
48
+ * Get the raw Neo4j driver instance.
49
+ *
50
+ * Prefer {@link getSession} for most use cases. Use the driver directly
51
+ * only when you need `driver.executeQuery()` for simple one-shot queries.
52
+ *
53
+ * @throws If {@link openNeo4j} has not been called.
54
+ */
55
+ export declare function getDriver(): Driver;
56
+ /**
57
+ * Check Neo4j connectivity.
58
+ *
59
+ * @returns `true` if the connection is healthy, `false` otherwise.
60
+ */
61
+ export declare function healthCheck(): Promise<boolean>;
62
+ /**
63
+ * Gracefully close the Neo4j connection and release resources.
64
+ *
65
+ * Safe to call multiple times or when no connection is open.
66
+ */
67
+ export declare function closeNeo4j(): Promise<void>;
68
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAc,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAehE,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAmBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAgDD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAKpC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED;;;;GAIG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAUpD;AAED;;;;GAIG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAYhD"}
package/dist/client.js ADDED
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Neo4j driver singleton — connection management, health checks, and shutdown.
3
+ *
4
+ * Follows the same singleton pattern as `packages/server/src/db.ts`.
5
+ * Call {@link openNeo4j} once at startup, then use {@link getDriver} or
6
+ * {@link getSession} for queries, and {@link closeNeo4j} on shutdown.
7
+ *
8
+ * @module
9
+ */
10
+ import neo4j from "neo4j-driver";
11
+ import { logger } from "./logger.js";
12
+ import { DEFAULT_NEO4J_URL, DEFAULT_NEO4J_USER, DEFAULT_NEO4J_PASSWORD, DEFAULT_NEO4J_DATABASE, NEO4J_MAX_POOL_SIZE, NEO4J_CONNECTION_ACQUISITION_TIMEOUT, } from "./constants.js";
13
+ // ---------------------------------------------------------------------------
14
+ // Singleton state
15
+ // ---------------------------------------------------------------------------
16
+ /** Module-level singleton driver instance. */
17
+ let driver;
18
+ /** Promise that resolves when initialization is complete (guards concurrent calls). */
19
+ let initPromise;
20
+ /** The database name used when creating sessions. */
21
+ let databaseName = DEFAULT_NEO4J_DATABASE;
22
+ // ---------------------------------------------------------------------------
23
+ // Public API
24
+ // ---------------------------------------------------------------------------
25
+ /**
26
+ * Open a connection to Neo4j.
27
+ *
28
+ * Reads configuration from environment variables first, then from the
29
+ * provided {@link Neo4jClientConfig}, then from built-in defaults.
30
+ *
31
+ * Idempotent — returns silently if a connection is already open.
32
+ *
33
+ * | Env Variable | Fallback |
34
+ * |--------------------------|---------------------|
35
+ * | `GRACKLE_NEO4J_URL` | `config.url` |
36
+ * | `GRACKLE_NEO4J_USER` | `config.username` |
37
+ * | `GRACKLE_NEO4J_PASSWORD` | `config.password` |
38
+ * | `GRACKLE_NEO4J_DATABASE` | `config.database` |
39
+ */
40
+ export function openNeo4j(config) {
41
+ if (driver) {
42
+ return Promise.resolve();
43
+ }
44
+ // Guard against concurrent calls: if an init is already in flight, await it.
45
+ if (initPromise) {
46
+ return initPromise;
47
+ }
48
+ // Wrap the async work so initPromise is cleared synchronously after settlement.
49
+ initPromise = doOpen(config).finally(() => {
50
+ initPromise = undefined;
51
+ });
52
+ return initPromise;
53
+ }
54
+ /**
55
+ * Internal init logic — separated so {@link openNeo4j} can guard concurrency
56
+ * with a shared promise.
57
+ */
58
+ async function doOpen(config) {
59
+ const url = process.env.GRACKLE_NEO4J_URL || config?.url || DEFAULT_NEO4J_URL;
60
+ const username = process.env.GRACKLE_NEO4J_USER || config?.username || DEFAULT_NEO4J_USER;
61
+ const explicitPassword = process.env.GRACKLE_NEO4J_PASSWORD || config?.password;
62
+ if (!explicitPassword && process.env.NODE_ENV === "production") {
63
+ throw new Error("GRACKLE_NEO4J_PASSWORD must be set in production. " +
64
+ "Refusing to use the default development password.");
65
+ }
66
+ const password = explicitPassword || DEFAULT_NEO4J_PASSWORD;
67
+ databaseName =
68
+ process.env.GRACKLE_NEO4J_DATABASE ||
69
+ config?.database ||
70
+ DEFAULT_NEO4J_DATABASE;
71
+ logger.info({ url, database: databaseName }, "Connecting to Neo4j");
72
+ const newDriver = neo4j.driver(url, neo4j.auth.basic(username, password), {
73
+ disableLosslessIntegers: true,
74
+ maxConnectionPoolSize: NEO4J_MAX_POOL_SIZE,
75
+ connectionAcquisitionTimeout: NEO4J_CONNECTION_ACQUISITION_TIMEOUT,
76
+ });
77
+ try {
78
+ await newDriver.verifyConnectivity({ database: databaseName });
79
+ logger.info("Neo4j connectivity verified");
80
+ }
81
+ catch (error) {
82
+ await newDriver.close().catch(() => { });
83
+ throw new Error(`Failed to connect to Neo4j at ${url}: ${error instanceof Error ? error.message : String(error)}. ` +
84
+ "Ensure Neo4j is running and the credentials are correct.", { cause: error });
85
+ }
86
+ driver = newDriver;
87
+ }
88
+ /**
89
+ * Get a Neo4j session for running queries.
90
+ *
91
+ * Sessions are lightweight and should be short-lived — open one per
92
+ * logical unit of work and close it when done.
93
+ *
94
+ * @throws If {@link openNeo4j} has not been called.
95
+ */
96
+ export function getSession() {
97
+ if (!driver) {
98
+ throw new Error("Neo4j not initialized. Call openNeo4j() first.");
99
+ }
100
+ return driver.session({ database: databaseName });
101
+ }
102
+ /**
103
+ * Get the raw Neo4j driver instance.
104
+ *
105
+ * Prefer {@link getSession} for most use cases. Use the driver directly
106
+ * only when you need `driver.executeQuery()` for simple one-shot queries.
107
+ *
108
+ * @throws If {@link openNeo4j} has not been called.
109
+ */
110
+ export function getDriver() {
111
+ if (!driver) {
112
+ throw new Error("Neo4j not initialized. Call openNeo4j() first.");
113
+ }
114
+ return driver;
115
+ }
116
+ /**
117
+ * Check Neo4j connectivity.
118
+ *
119
+ * @returns `true` if the connection is healthy, `false` otherwise.
120
+ */
121
+ export async function healthCheck() {
122
+ if (!driver) {
123
+ return false;
124
+ }
125
+ try {
126
+ await driver.verifyConnectivity({ database: databaseName });
127
+ return true;
128
+ }
129
+ catch {
130
+ return false;
131
+ }
132
+ }
133
+ /**
134
+ * Gracefully close the Neo4j connection and release resources.
135
+ *
136
+ * Safe to call multiple times or when no connection is open.
137
+ */
138
+ export async function closeNeo4j() {
139
+ // Wait for any in-flight initialization to settle before closing.
140
+ if (initPromise) {
141
+ await initPromise.catch(() => { });
142
+ }
143
+ const current = driver;
144
+ if (current) {
145
+ driver = undefined;
146
+ logger.info("Closing Neo4j connection");
147
+ await current.close();
148
+ }
149
+ }
150
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAoC,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,oCAAoC,GACrC,MAAM,gBAAgB,CAAC;AAkBxB,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,8CAA8C;AAC9C,IAAI,MAA0B,CAAC;AAE/B,uFAAuF;AACvF,IAAI,WAAsC,CAAC;AAE3C,qDAAqD;AACrD,IAAI,YAAY,GAAW,sBAAsB,CAAC;AAElD,8EAA8E;AAC9E,aAAa;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AAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,kEAAkE;IAClE,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC;IACvB,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,GAAG,SAAS,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Constants for the Neo4j knowledge graph subsystem.
3
+ *
4
+ * @module
5
+ */
6
+ /** Default Neo4j Bolt connection URL. */
7
+ export declare const DEFAULT_NEO4J_URL: string;
8
+ /** Default Neo4j username. */
9
+ export declare const DEFAULT_NEO4J_USER: string;
10
+ /**
11
+ * Default Neo4j password (development only; production should always override).
12
+ *
13
+ * Not re-exported from the package barrel to avoid leaking a credential
14
+ * constant in the public API.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare const DEFAULT_NEO4J_PASSWORD: string;
19
+ /** Default Neo4j database name. */
20
+ export declare const DEFAULT_NEO4J_DATABASE: string;
21
+ /** Maximum number of connections in the Neo4j driver pool. */
22
+ export declare const NEO4J_MAX_POOL_SIZE: number;
23
+ /** Timeout (ms) for acquiring a connection from the Neo4j pool. */
24
+ export declare const NEO4J_CONNECTION_ACQUISITION_TIMEOUT: number;
25
+ /** Neo4j node label applied to all knowledge graph nodes. */
26
+ export declare const NODE_LABEL: string;
27
+ /** Name of the vector index on knowledge node embeddings. */
28
+ export declare const VECTOR_INDEX_NAME: string;
29
+ /** Dimensionality of the embedding vectors (OpenAI text-embedding-3-small). */
30
+ export declare const EMBEDDING_DIMENSIONS: number;
31
+ /** Similarity function used by the vector index. */
32
+ export declare const VECTOR_SIMILARITY_FUNCTION: string;
33
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,EAAE,MAAgC,CAAC;AAEjE,8BAA8B;AAC9B,eAAO,MAAM,kBAAkB,EAAE,MAAgB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAsB,CAAC;AAE5D,mCAAmC;AACnC,eAAO,MAAM,sBAAsB,EAAE,MAAgB,CAAC;AAEtD,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,EAAE,MAAW,CAAC;AAE9C,mEAAmE;AACnE,eAAO,MAAM,oCAAoC,EAAE,MAAe,CAAC;AAEnE,6DAA6D;AAC7D,eAAO,MAAM,UAAU,EAAE,MAAwB,CAAC;AAElD,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,EAAE,MAAoC,CAAC;AAErE,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,MAAa,CAAC;AAEjD,oDAAoD;AACpD,eAAO,MAAM,0BAA0B,EAAE,MAAiB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Constants for the Neo4j knowledge graph subsystem.
3
+ *
4
+ * @module
5
+ */
6
+ /** Default Neo4j Bolt connection URL. */
7
+ export const DEFAULT_NEO4J_URL = "bolt://localhost:7687";
8
+ /** Default Neo4j username. */
9
+ export const DEFAULT_NEO4J_USER = "neo4j";
10
+ /**
11
+ * Default Neo4j password (development only; production should always override).
12
+ *
13
+ * Not re-exported from the package barrel to avoid leaking a credential
14
+ * constant in the public API.
15
+ *
16
+ * @internal
17
+ */
18
+ export const DEFAULT_NEO4J_PASSWORD = "grackle-dev";
19
+ /** Default Neo4j database name. */
20
+ export const DEFAULT_NEO4J_DATABASE = "neo4j";
21
+ /** Maximum number of connections in the Neo4j driver pool. */
22
+ export const NEO4J_MAX_POOL_SIZE = 50;
23
+ /** Timeout (ms) for acquiring a connection from the Neo4j pool. */
24
+ export const NEO4J_CONNECTION_ACQUISITION_TIMEOUT = 30_000;
25
+ /** Neo4j node label applied to all knowledge graph nodes. */
26
+ export const NODE_LABEL = "KnowledgeNode";
27
+ /** Name of the vector index on knowledge node embeddings. */
28
+ export const VECTOR_INDEX_NAME = "knowledge_embedding_index";
29
+ /** Dimensionality of the embedding vectors (OpenAI text-embedding-3-small). */
30
+ export const EMBEDDING_DIMENSIONS = 1536;
31
+ /** Similarity function used by the vector index. */
32
+ export const VECTOR_SIMILARITY_FUNCTION = "cosine";
33
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,iBAAiB,GAAW,uBAAuB,CAAC;AAEjE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,kBAAkB,GAAW,OAAO,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAW,aAAa,CAAC;AAE5D,mCAAmC;AACnC,MAAM,CAAC,MAAM,sBAAsB,GAAW,OAAO,CAAC;AAEtD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAW,EAAE,CAAC;AAE9C,mEAAmE;AACnE,MAAM,CAAC,MAAM,oCAAoC,GAAW,MAAM,CAAC;AAEnE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAW,eAAe,CAAC;AAElD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAW,2BAA2B,CAAC;AAErE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAW,IAAI,CAAC;AAEjD,oDAAoD;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAW,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,23 @@
1
1
  /**
2
2
  * Knowledge graph subsystem for Grackle.
3
3
  *
4
- * Provides pluggable text embedding, content chunking, and an ingestion
5
- * pipeline so that agents can share and reuse contextual information
6
- * across sessions.
4
+ * Provides pluggable text embedding, content chunking, an ingestion
5
+ * pipeline, and structured knowledge storage and retrieval via Neo4j,
6
+ * so that agents can share and reuse contextual information across sessions.
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
+ export { openNeo4j, closeNeo4j, healthCheck, getSession, getDriver } from "./client.js";
11
+ export type { Neo4jClientConfig } from "./client.js";
12
+ export { initSchema, SCHEMA_STATEMENTS } from "./schema.js";
13
+ export * from "./types.js";
14
+ export { DEFAULT_NEO4J_URL, DEFAULT_NEO4J_USER, DEFAULT_NEO4J_DATABASE, NEO4J_MAX_POOL_SIZE, NEO4J_CONNECTION_ACQUISITION_TIMEOUT, NODE_LABEL, VECTOR_INDEX_NAME, EMBEDDING_DIMENSIONS, VECTOR_SIMILARITY_FUNCTION, } from "./constants.js";
10
15
  export type { Embedder, EmbedderOptions, EmbeddingResult } from "./embedder.js";
11
16
  export { createLocalEmbedder } from "./local-embedder.js";
12
17
  export type { Chunk, Chunker } from "./chunker.js";
13
18
  export { createPassThroughChunker } from "./pass-through-chunker.js";
14
19
  export type { EmbeddedChunk } from "./ingest.js";
15
20
  export { ingest } from "./ingest.js";
21
+ export type { TranscriptChunkerOptions } from "./transcript-chunker.js";
22
+ export { createTranscriptChunker } from "./transcript-chunker.js";
16
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;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O,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,18 @@
1
1
  /**
2
2
  * Knowledge graph subsystem for Grackle.
3
3
  *
4
- * Provides pluggable text embedding, content chunking, and an ingestion
5
- * pipeline so that agents can share and reuse contextual information
6
- * across sessions.
4
+ * Provides pluggable text embedding, content chunking, an ingestion
5
+ * pipeline, and structured knowledge storage and retrieval via Neo4j,
6
+ * so that agents can share and reuse contextual information across sessions.
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
+ export { openNeo4j, closeNeo4j, healthCheck, getSession, getDriver } from "./client.js";
11
+ export { initSchema, SCHEMA_STATEMENTS } from "./schema.js";
12
+ export * from "./types.js";
13
+ export { DEFAULT_NEO4J_URL, DEFAULT_NEO4J_USER, DEFAULT_NEO4J_DATABASE, NEO4J_MAX_POOL_SIZE, NEO4J_CONNECTION_ACQUISITION_TIMEOUT, NODE_LABEL, VECTOR_INDEX_NAME, EMBEDDING_DIMENSIONS, VECTOR_SIMILARITY_FUNCTION, } from "./constants.js";
10
14
  export { createLocalEmbedder } from "./local-embedder.js";
11
15
  export { createPassThroughChunker } from "./pass-through-chunker.js";
12
16
  export { ingest } from "./ingest.js";
17
+ export { createTranscriptChunker } from "./transcript-chunker.js";
13
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5D,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,oCAAoC,EACpC,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Structured logger for the knowledge graph subsystem.
3
+ *
4
+ * @module
5
+ */
6
+ import { type Logger } from "pino";
7
+ /** Pino logger instance for the knowledge package. */
8
+ export declare const logger: Logger;
9
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAa,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAEzC,sDAAsD;AACtD,eAAO,MAAM,MAAM,EAAE,MAOnB,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Structured logger for the knowledge graph subsystem.
3
+ *
4
+ * @module
5
+ */
6
+ import pino from "pino";
7
+ /** Pino logger instance for the knowledge package. */
8
+ export const logger = pino({
9
+ name: "grackle-knowledge",
10
+ level: process.env.LOG_LEVEL || "info",
11
+ transport: process.env.NODE_ENV !== "production"
12
+ ? { target: "pino/file", options: { destination: 1 } }
13
+ : undefined,
14
+ });
15
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAqB,MAAM,MAAM,CAAC;AAEzC,sDAAsD;AACtD,MAAM,CAAC,MAAM,MAAM,GAAW,IAAI,CAAC;IACjC,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;IACtC,SAAS,EACP,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACnC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE;QACtD,CAAC,CAAC,SAAS;CAChB,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Neo4j schema initialization — constraints, indexes, and vector index.
3
+ *
4
+ * All statements use `IF NOT EXISTS` for idempotency and are safe to run
5
+ * on every application startup.
6
+ *
7
+ * @module
8
+ */
9
+ /**
10
+ * Cypher statements for schema initialization.
11
+ *
12
+ * Exported so tests can verify the exact statements that will be executed.
13
+ */
14
+ export declare const SCHEMA_STATEMENTS: Record<string, string>;
15
+ /**
16
+ * Initialize the Neo4j schema: constraints, property indexes, and the
17
+ * vector index.
18
+ *
19
+ * All statements are idempotent (`IF NOT EXISTS`). Call once at startup
20
+ * after {@link openNeo4j}.
21
+ */
22
+ export declare function initSchema(): Promise<void>;
23
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4BpD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBhD"}
package/dist/schema.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Neo4j schema initialization — constraints, indexes, and vector index.
3
+ *
4
+ * All statements use `IF NOT EXISTS` for idempotency and are safe to run
5
+ * on every application startup.
6
+ *
7
+ * @module
8
+ */
9
+ import { getSession } from "./client.js";
10
+ import { logger } from "./logger.js";
11
+ import { NODE_LABEL, VECTOR_INDEX_NAME, EMBEDDING_DIMENSIONS, VECTOR_SIMILARITY_FUNCTION, } from "./constants.js";
12
+ /**
13
+ * Cypher statements for schema initialization.
14
+ *
15
+ * Exported so tests can verify the exact statements that will be executed.
16
+ */
17
+ export const SCHEMA_STATEMENTS = {
18
+ /** Uniqueness constraint on node ID. */
19
+ UNIQUE_NODE_ID: `CREATE CONSTRAINT knowledge_node_id_unique IF NOT EXISTS
20
+ FOR (n:${NODE_LABEL}) REQUIRE n.id IS UNIQUE`,
21
+ /** Index on the kind property for efficient filtering. */
22
+ INDEX_KIND: `CREATE INDEX knowledge_node_kind IF NOT EXISTS
23
+ FOR (n:${NODE_LABEL}) ON (n.kind)`,
24
+ /** Index on workspaceId for scoped queries. */
25
+ INDEX_WORKSPACE: `CREATE INDEX knowledge_node_workspace IF NOT EXISTS
26
+ FOR (n:${NODE_LABEL}) ON (n.workspaceId)`,
27
+ /** Composite index for reference node lookups by source. */
28
+ INDEX_SOURCE: `CREATE INDEX knowledge_node_source IF NOT EXISTS
29
+ FOR (n:${NODE_LABEL}) ON (n.sourceType, n.sourceId)`,
30
+ /** Vector index for embedding similarity search. */
31
+ VECTOR_INDEX: [
32
+ `CREATE VECTOR INDEX ${VECTOR_INDEX_NAME} IF NOT EXISTS`,
33
+ `FOR (n:${NODE_LABEL}) ON (n.embedding)`,
34
+ `OPTIONS {`,
35
+ ` indexConfig: {`,
36
+ ` \`vector.dimensions\`: ${EMBEDDING_DIMENSIONS},`,
37
+ ` \`vector.similarity_function\`: '${VECTOR_SIMILARITY_FUNCTION}'`,
38
+ ` }`,
39
+ `}`,
40
+ ].join("\n"),
41
+ };
42
+ /**
43
+ * Initialize the Neo4j schema: constraints, property indexes, and the
44
+ * vector index.
45
+ *
46
+ * All statements are idempotent (`IF NOT EXISTS`). Call once at startup
47
+ * after {@link openNeo4j}.
48
+ */
49
+ export async function initSchema() {
50
+ const session = getSession();
51
+ try {
52
+ for (const [name, cypher] of Object.entries(SCHEMA_STATEMENTS)) {
53
+ logger.debug({ statement: name }, "Running schema statement");
54
+ try {
55
+ await session.run(cypher);
56
+ }
57
+ catch (error) {
58
+ logger.error({ err: error, statement: name }, "Schema statement failed");
59
+ throw new Error(`Schema statement "${name}" failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
60
+ }
61
+ }
62
+ logger.info("Knowledge graph schema initialized");
63
+ }
64
+ finally {
65
+ try {
66
+ await session.close();
67
+ }
68
+ catch (closeError) {
69
+ logger.warn({ err: closeError }, "Failed to close Neo4j session after schema initialization");
70
+ }
71
+ }
72
+ }
73
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,wCAAwC;IACxC,cAAc,EAAE;aACL,UAAU,0BAA0B;IAE/C,0DAA0D;IAC1D,UAAU,EAAE;aACD,UAAU,eAAe;IAEpC,+CAA+C;IAC/C,eAAe,EAAE;aACN,UAAU,sBAAsB;IAE3C,4DAA4D;IAC5D,YAAY,EAAE;aACH,UAAU,iCAAiC;IAEtD,oDAAoD;IACpD,YAAY,EAAE;QACZ,uBAAuB,iBAAiB,gBAAgB;QACxD,UAAU,UAAU,oBAAoB;QACxC,WAAW;Q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cript 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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,142 @@
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
@@ -0,0 +1 @@
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,QAAkC;YACvD,MAAM,OAAO,GAAe,UAAU,CAAC,OAAO,CAAC,CAAC;YAEhD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,oEAAoE;YACpE,6DAA6D;YAC7D,MAAM,KAAK,GAAiB,WAAW,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,MAAM,GAAY,EAAE,CAAC;YAE3B,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE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CAAC,CAAC,EAAE,EAAE;QACT,MAAM,KAAK,GAAW,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QACrD,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,OAAe;IAC9C,MAAM,KAAK,GAAa,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,OAAO,GAAW,EAAE,CAAC;IAEzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAW,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,IAAI,SAAS,CAAC,MAAM,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;YAC1C,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,102 @@
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
@@ -0,0 +1 @@
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;AA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AAC;IAChB,yCAAyC;IACzC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,6DAA6D;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 ADDED
@@ -0,0 +1,61 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,oDAAoD;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,6EAA6E;IAC7E,SAAS,EAAE,WAAW;IACtB,kDAAkD;IAClD,MAAM,EAAE,QAAQ;CACR,CAAC;AAKX,8EAA8E;AAC9E,8BAA8B;AAC9B,8EAA8E;AAE9E,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACd,CAAC;AAMX,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAMX,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;CACV,CAAC;AAsEX,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,IAAmB;IACjD,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,CAAC;AAC3C,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,MAAM,CAAC;AACxC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grackle-ai/knowledge",
3
- "version": "0.58.0",
4
- "description": "Scaffold for the Knowledge Graph subsystem for Grackle",
3
+ "version": "0.59.0",
4
+ "description": "Knowledge graph subsystem for Grackle (Neo4j + vector search)",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,7 +25,9 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@huggingface/transformers": "^3.4.0",
28
- "@grackle-ai/common": "0.58.0"
28
+ "neo4j-driver": "^6.0.1",
29
+ "pino": "^10.3.1",
30
+ "@grackle-ai/common": "0.59.0"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@rushstack/heft": "1.2.4",