@neo4j-labs/agent-memory 0.3.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -9,6 +9,35 @@ appear in minor versions with a callout in this file.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## 0.4.0 — NAMS alignment
13
+
14
+ Adds workspace addressing, a first-class ontology surface
15
+ (`client.ontology`), a `conversationId` alias on the short-term methods,
16
+ and an explicit `longTerm.waitForExtraction(...)` await for the
17
+ asynchronous NAMS extraction pipeline. First release cut from the
18
+ polyglot `neo4j-labs/agent-memory` repository, published under
19
+ namespaced `typescript-v*` tags.
20
+
21
+ ### Added
22
+
23
+ - **Workspace addressing.** `MemoryClientOptions.workspaceId` (and the
24
+ `MEMORY_WORKSPACE_ID` environment variable) is transmitted automatically as
25
+ the `X-Workspace-Id` header on every request — required by header-scoped
26
+ deployments (e.g. the development/staging service). An explicit
27
+ `X-Workspace-Id` entry in `headers` wins; unset is harmless on production.
28
+ - **Ontology surface (`client.ontology`).** `list()`, `get()`, `getActive()`,
29
+ `clone()`, `create()`, `update()`, `activate()`, `delete()` over the NAMS
30
+ domain-ontology engine, with typed models (`OntologySummary`,
31
+ `OntologyVersion`, `OntologyDocument`, …) and `permissive`/`strict`
32
+ validation modes. `getActive()` surfaces the active version's
33
+ `validationMode`.
34
+ - **`conversationId` alias** on short-term methods (`addMessage`,
35
+ `getConversation`, `searchMessages`, `clearSession`) as an alias for
36
+ `sessionId` (`sessionId` wins).
37
+ - **`longTerm.waitForExtraction(...)`** — await the asynchronous NAMS
38
+ extraction pipeline explicitly (polls entity search for `expectedNames` /
39
+ a `predicate`; returns a boolean).
40
+
12
41
  ### Changed
13
42
 
14
43
  - Repository moved from
package/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
  ![Status: Beta](https://img.shields.io/badge/Status-Beta-6366F1)
5
5
  ![Community Supported](https://img.shields.io/badge/Support-Community-6B7280)
6
6
 
7
- > **New home:** this package moved from
8
- > [`neo4j-labs/agent-memory-tck`](https://github.com/neo4j-labs/agent-memory-tck)
9
- > to [`neo4j-labs/agent-memory`](https://github.com/neo4j-labs/agent-memory),
10
- > alongside the Python SDK. Install path, package name, and exports are
11
- > unchanged `npm install @neo4j-labs/agent-memory`.
7
+ > **Now on npm.** Install with `npm install @neo4j-labs/agent-memory`
8
+ > ([package page](https://www.npmjs.com/package/@neo4j-labs/agent-memory)).
9
+ > Source lives alongside the Python SDK at
10
+ > [`neo4j-labs/agent-memory`](https://github.com/neo4j-labs/agent-memory)
11
+ > (relocated from `neo4j-labs/agent-memory-tck`).
12
12
 
13
13
  > TypeScript client for the Neo4j Agent Memory Service — short-term,
14
14
  > long-term, and reasoning memory for AI agents, backed by Neo4j.
@@ -1,7 +1,7 @@
1
1
  import { ConnectionError, AuthenticationError, TransportError } from './chunk-ASQMU7YC.js';
2
2
 
3
3
  // src/version.ts
4
- var VERSION = "0.3.0";
4
+ var VERSION = "0.4.0";
5
5
 
6
6
  // src/observability.ts
7
7
  function defaultUserAgent() {
@@ -222,5 +222,5 @@ var BridgeTransport = class {
222
222
  };
223
223
 
224
224
  export { BridgeTransport, VERSION, defaultUserAgent, extractRequestId, supportsUserAgentHeader };
225
- //# sourceMappingURL=chunk-TGBKROHO.js.map
226
- //# sourceMappingURL=chunk-TGBKROHO.js.map
225
+ //# sourceMappingURL=chunk-E752ALCR.js.map
226
+ //# sourceMappingURL=chunk-E752ALCR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts","../src/observability.ts","../src/transport/bridge.ts"],"names":["durationMs"],"mappings":";;;AAKO,IAAM,OAAA,GAAU;;;ACShB,SAAS,gBAAA,GAA2B;AACzC,EAAA,MAAM,UAAU,aAAA,EAAc;AAC9B,EAAA,OAAO,UACH,CAAA,yBAAA,EAA4B,OAAO,KAAK,OAAO,CAAA,CAAA,CAAA,GAC/C,4BAA4B,OAAO,CAAA,CAAA;AACzC;AA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ync with package.json via a\n * dedicated version-check script run in CI. Imported by the transports to build\n * the default User-Agent header.\n */\nexport const VERSION = \"0.3.0\";\n","/**\n * Observability primitives — User-Agent header building and the typed\n * logger event stream emitted by both transports.\n */\n\nimport { VERSION } from \"./version.js\";\n\n/**\n * Build the default User-Agent string. Mirrors the convention used by other\n * Anthropic / OpenAI SDKs: `<package>/<version> (<runtime>; <platform>)`.\n *\n * Detection is best-effort and silently degrades on edge runtimes where\n * `process` is unavailable.\n */\nexport function defaultUserAgent(): string {\n const runtime = detectRuntime();\n return runtime\n ? `@neo4j-labs/agent-memory/${VERSION} (${runtime})`\n : `@neo4j-labs/agent-memory/${VERSION}`;\n}\n\nexport function supportsUserAgentHeader(): boolean {\n return detectRuntime() !== null;\n}\n\nfunction detectRuntime(): string | null {\n // Deno\n const denoObj = (globalThis as { Deno?: { version?: { deno?: string } } }).Deno;\n if (denoObj?.version?.deno) {\n return `deno/${denoObj.version.deno}`;\n }\n // Bun\n const bunObj = (globalThis as { Bun?: { version?: string } }).Bun;\n if (bunObj?.version) {\n return `bun/${bunObj.version}`;\n }\n // Node\n if (typeof process !== \"undefined\" && process.versions?.node) {\n const platform = process.platform ?? \"unknown\";\n return `node/${process.versions.node}; ${platform}`;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Logger\n// ---------------------------------------------------------------------------\n\n/** Single event emitted to the user-supplied logger. */\nexport type LogEvent =\n | {\n kind: \"request\";\n method: string;\n url: string;\n httpMethod?: string;\n }\n | {\n kind: \"response\";\n method: string;\n url: string;\n status: number;\n requestId?: string;\n durationMs: number;\n }\n | {\n kind: \"error\";\n method: string;\n url: string;\n status?: number;\n requestId?: string;\n durationMs: number;\n message: string;\n };\n\nexport type Logger = (event: LogEvent) => void;\n\n/**\n * Extract a request-id from a Response. The hosted service emits one of\n * `x-request-id`, `request-id`, or `x-amzn-RequestId` depending on the edge\n * the request lands on. Caller-side correlation works as long as one is\n * present.\n */\nexport function extractRequestId(headers: Headers): string | undefined {\n return (\n headers.get(\"x-request-id\") ??\n headers.get(\"request-id\") ??\n headers.get(\"x-amzn-requestid\") ??\n undefined\n );\n}\n","/**\n * BridgeTransport — TCK bridge protocol transport.\n *\n * Speaks the bridge wire format (POST {endpoint}/{snake_case_method}) used by\n * conformance servers and the local reference adapter. Compatible with every\n * fetch-capable runtime (Node 20+, Bun, Deno, Workers, Edge).\n */\n\nimport { AuthenticationError, ConnectionError, TransportError } from \"../errors.js\";\nimport {\n defaultUserAgent,\n extractRequestId,\n supportsUserAgentHeader,\n type Logger,\n} from \"../observability.js\";\nimport type { Transport } from \"./index.js\";\n\n/** Strip trailing `/` from a URL without using a polynomial regex. */\nfunction trimTrailingSlashes(s: string): string {\n let end = s.length;\n while (end > 0 && s.charCodeAt(end - 1) === 47) end--;\n return s.slice(0, end);\n}\n\nfunction nowMs(): number {\n if (typeof performance !== \"undefined\" && typeof performance.now === \"function\") {\n return performance.now();\n }\n return Date.now();\n}\n\nexport interface BridgeTransportOptions {\n /** Base URL of the bridge endpoint (no trailing /v1). */\n endpoint: string;\n\n /** API key for Bearer auth. Optional for local bridge servers. */\n apiKey?: string;\n\n /** Request timeout in milliseconds. Default: 30000. */\n timeout?: number;\n\n /** Additional headers to include in every request. */\n headers?: Record<string, string>;\n\n /** Per-request logger. */\n logger?: Logger;\n}\n\nexport class BridgeTransport implements Transport {\n private readonly endpoint: string;\n private readonly apiKey?: string;\n private readonly timeout: number;\n private readonly headers: Record<string, string>;\n private readonly logger?: Logger;\n\n constructor(options: BridgeTransportOptions) {\n this.endpoint = trimTrailingSlashes(options.endpoint);\n this.apiKey = options.apiKey;\n this.timeout = options.timeout ?? 30_000;\n this.headers = options.headers ?? {};\n this.logger = options.logger;\n }\n\n async connect(): Promise<void> {\n const url = `${this.endpoint}/setup`;\n const start = nowMs();\n this.emit({ kind: \"request\", method: \"connect\", url, httpMethod: \"POST\" });\n let response: Response;\n try {\n response = await fetch(url, {\n method: \"POST\",\n headers: this.buildHeaders(),\n signal: AbortSignal.timeout(this.timeout),\n });\n } catch (error) {\n const durationMs = nowMs() - start;\n if (error instanceof TypeError) {\n const err = new ConnectionError(\n `Failed to connect to ${this.endpoint}: ${(error as Error).message}`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method: \"connect\", url, durationMs, message: err.message });\n throw err;\n }\n if (error instanceof DOMException && error.name === \"TimeoutError\") {\n const err = new ConnectionError(\n `Connection to ${this.endpoint} timed out after ${this.timeout}ms`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method: \"connect\", url, durationMs, message: err.message });\n throw err;\n }\n throw error;\n }\n const durationMs = nowMs() - start;\n const requestId = extractRequestId(response.headers);\n if (response.status === 401 || response.status === 403) {\n const err = new AuthenticationError(\n `Authentication failed: ${response.status} ${response.statusText}`,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method: \"connect\",\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n this.emit({\n kind: \"response\",\n method: \"connect\",\n url,\n status: response.status,\n requestId,\n durationMs,\n });\n }\n\n async close(): Promise<void> {}\n\n async request<T>(method: string, params: Record<string, unknown>): Promise<T> {\n const url = `${this.endpoint}/${method}`;\n\n const body: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n body[key] = value;\n }\n }\n\n const start = nowMs();\n this.emit({ kind: \"request\", method, url, httpMethod: \"POST\" });\n let response: Response;\n try {\n response = await fetch(url, {\n method: \"POST\",\n headers: this.buildHeaders(),\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(this.timeout),\n });\n } catch (error) {\n const durationMs = nowMs() - start;\n if (error instanceof TypeError) {\n const err = new ConnectionError(\n `Request to ${url} failed: ${(error as Error).message}`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method, url, durationMs, message: err.message });\n throw err;\n }\n throw error;\n }\n\n const requestId = extractRequestId(response.headers);\n const durationMs = nowMs() - start;\n\n if (response.status === 401 || response.status === 403) {\n const err = new AuthenticationError(\n `Authentication failed: ${response.status} ${response.statusText}`,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method,\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n\n if (response.status === 204) {\n this.emit({ kind: \"response\", method, url, status: 204, requestId, durationMs });\n return undefined as T;\n }\n\n const text = await response.text();\n\n if (!response.ok) {\n let errorBody: unknown;\n try {\n errorBody = JSON.parse(text);\n } catch {\n errorBody = text;\n }\n const errorMessage =\n typeof errorBody === \"object\" && errorBody !== null && \"error\" in errorBody\n ? String((errorBody as Record<string, unknown>)[\"error\"])\n : `HTTP ${response.status}`;\n const err = new TransportError(\n `${method} failed: ${errorMessage}`,\n response.status,\n errorBody,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method,\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n\n this.emit({ kind: \"response\", method, url, status: response.status, requestId, durationMs });\n\n if (!text) return undefined as T;\n return JSON.parse(text) as T;\n }\n\n private emit(event: Parameters<Logger>[0]): void {\n if (!this.logger) return;\n try {\n this.logger(event);\n } catch {\n // Logger errors must never propagate.\n }\n }\n\n private buildHeaders(): Record<string, string> {\n const headers: Record<string, string> = { \"Content-Type\": \"application/json\" };\n const canSendUserAgent = supportsUserAgentHeader();\n for (const [key, value] of Object.entries(this.headers)) {\n if (key.toLowerCase() === \"user-agent\" && !canSendUserAgent) continue;\n headers[key] = value;\n }\n if (canSendUserAgent && !Object.keys(headers).some((key) => key.toLowerCase() === \"user-agent\")) {\n headers[\"User-Agent\"] = defaultUserAgent();\n }\n if (this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n return headers;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/version.ts","../src/observability.ts","../src/transport/bridge.ts"],"names":["durationMs"],"mappings":";;;AAKO,IAAM,OAAA,GAAU;;;ACShB,SAAS,gBAAA,GAA2B;AACzC,EAAA,MAAM,UAAU,aAAA,EAAc;AAC9B,EAAA,OA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,CAAA;AAAA,IAClD;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AACF","file":"chunk-E752ALCR.js","sourcesContent":["/**\n * Package version constant. Kept in sync with package.json via a\n * dedicated version-check script run in CI. Imported by the transports to build\n * the default User-Agent header.\n */\nexport const VERSION = \"0.4.0\";\n","/**\n * Observability primitives — User-Agent header building and the typed\n * logger event stream emitted by both transports.\n */\n\nimport { VERSION } from \"./version.js\";\n\n/**\n * Build the default User-Agent string. Mirrors the convention used by other\n * Anthropic / OpenAI SDKs: `<package>/<version> (<runtime>; <platform>)`.\n *\n * Detection is best-effort and silently degrades on edge runtimes where\n * `process` is unavailable.\n */\nexport function defaultUserAgent(): string {\n const runtime = detectRuntime();\n return runtime\n ? `@neo4j-labs/agent-memory/${VERSION} (${runtime})`\n : `@neo4j-labs/agent-memory/${VERSION}`;\n}\n\nexport function supportsUserAgentHeader(): boolean {\n return detectRuntime() !== null;\n}\n\nfunction detectRuntime(): string | null {\n // Deno\n const denoObj = (globalThis as { Deno?: { version?: { deno?: string } } }).Deno;\n if (denoObj?.version?.deno) {\n return `deno/${denoObj.version.deno}`;\n }\n // Bun\n const bunObj = (globalThis as { Bun?: { version?: string } }).Bun;\n if (bunObj?.version) {\n return `bun/${bunObj.version}`;\n }\n // Node\n if (typeof process !== \"undefined\" && process.versions?.node) {\n const platform = process.platform ?? \"unknown\";\n return `node/${process.versions.node}; ${platform}`;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Logger\n// ---------------------------------------------------------------------------\n\n/** Single event emitted to the user-supplied logger. */\nexport type LogEvent =\n | {\n kind: \"request\";\n method: string;\n url: string;\n httpMethod?: string;\n }\n | {\n kind: \"response\";\n method: string;\n url: string;\n status: number;\n requestId?: string;\n durationMs: number;\n }\n | {\n kind: \"error\";\n method: string;\n url: string;\n status?: number;\n requestId?: string;\n durationMs: number;\n message: string;\n };\n\nexport type Logger = (event: LogEvent) => void;\n\n/**\n * Extract a request-id from a Response. The hosted service emits one of\n * `x-request-id`, `request-id`, or `x-amzn-RequestId` depending on the edge\n * the request lands on. Caller-side correlation works as long as one is\n * present.\n */\nexport function extractRequestId(headers: Headers): string | undefined {\n return (\n headers.get(\"x-request-id\") ??\n headers.get(\"request-id\") ??\n headers.get(\"x-amzn-requestid\") ??\n undefined\n );\n}\n","/**\n * BridgeTransport — TCK bridge protocol transport.\n *\n * Speaks the bridge wire format (POST {endpoint}/{snake_case_method}) used by\n * conformance servers and the local reference adapter. Compatible with every\n * fetch-capable runtime (Node 20+, Bun, Deno, Workers, Edge).\n */\n\nimport { AuthenticationError, ConnectionError, TransportError } from \"../errors.js\";\nimport {\n defaultUserAgent,\n extractRequestId,\n supportsUserAgentHeader,\n type Logger,\n} from \"../observability.js\";\nimport type { Transport } from \"./index.js\";\n\n/** Strip trailing `/` from a URL without using a polynomial regex. */\nfunction trimTrailingSlashes(s: string): string {\n let end = s.length;\n while (end > 0 && s.charCodeAt(end - 1) === 47) end--;\n return s.slice(0, end);\n}\n\nfunction nowMs(): number {\n if (typeof performance !== \"undefined\" && typeof performance.now === \"function\") {\n return performance.now();\n }\n return Date.now();\n}\n\nexport interface BridgeTransportOptions {\n /** Base URL of the bridge endpoint (no trailing /v1). */\n endpoint: string;\n\n /** API key for Bearer auth. Optional for local bridge servers. */\n apiKey?: string;\n\n /** Request timeout in milliseconds. Default: 30000. */\n timeout?: number;\n\n /** Additional headers to include in every request. */\n headers?: Record<string, string>;\n\n /** Per-request logger. */\n logger?: Logger;\n}\n\nexport class BridgeTransport implements Transport {\n private readonly endpoint: string;\n private readonly apiKey?: string;\n private readonly timeout: number;\n private readonly headers: Record<string, string>;\n private readonly logger?: Logger;\n\n constructor(options: BridgeTransportOptions) {\n this.endpoint = trimTrailingSlashes(options.endpoint);\n this.apiKey = options.apiKey;\n this.timeout = options.timeout ?? 30_000;\n this.headers = options.headers ?? {};\n this.logger = options.logger;\n }\n\n async connect(): Promise<void> {\n const url = `${this.endpoint}/setup`;\n const start = nowMs();\n this.emit({ kind: \"request\", method: \"connect\", url, httpMethod: \"POST\" });\n let response: Response;\n try {\n response = await fetch(url, {\n method: \"POST\",\n headers: this.buildHeaders(),\n signal: AbortSignal.timeout(this.timeout),\n });\n } catch (error) {\n const durationMs = nowMs() - start;\n if (error instanceof TypeError) {\n const err = new ConnectionError(\n `Failed to connect to ${this.endpoint}: ${(error as Error).message}`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method: \"connect\", url, durationMs, message: err.message });\n throw err;\n }\n if (error instanceof DOMException && error.name === \"TimeoutError\") {\n const err = new ConnectionError(\n `Connection to ${this.endpoint} timed out after ${this.timeout}ms`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method: \"connect\", url, durationMs, message: err.message });\n throw err;\n }\n throw error;\n }\n const durationMs = nowMs() - start;\n const requestId = extractRequestId(response.headers);\n if (response.status === 401 || response.status === 403) {\n const err = new AuthenticationError(\n `Authentication failed: ${response.status} ${response.statusText}`,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method: \"connect\",\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n this.emit({\n kind: \"response\",\n method: \"connect\",\n url,\n status: response.status,\n requestId,\n durationMs,\n });\n }\n\n async close(): Promise<void> {}\n\n async request<T>(method: string, params: Record<string, unknown>): Promise<T> {\n const url = `${this.endpoint}/${method}`;\n\n const body: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n body[key] = value;\n }\n }\n\n const start = nowMs();\n this.emit({ kind: \"request\", method, url, httpMethod: \"POST\" });\n let response: Response;\n try {\n response = await fetch(url, {\n method: \"POST\",\n headers: this.buildHeaders(),\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(this.timeout),\n });\n } catch (error) {\n const durationMs = nowMs() - start;\n if (error instanceof TypeError) {\n const err = new ConnectionError(\n `Request to ${url} failed: ${(error as Error).message}`,\n { cause: error },\n );\n this.emit({ kind: \"error\", method, url, durationMs, message: err.message });\n throw err;\n }\n throw error;\n }\n\n const requestId = extractRequestId(response.headers);\n const durationMs = nowMs() - start;\n\n if (response.status === 401 || response.status === 403) {\n const err = new AuthenticationError(\n `Authentication failed: ${response.status} ${response.statusText}`,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method,\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n\n if (response.status === 204) {\n this.emit({ kind: \"response\", method, url, status: 204, requestId, durationMs });\n return undefined as T;\n }\n\n const text = await response.text();\n\n if (!response.ok) {\n let errorBody: unknown;\n try {\n errorBody = JSON.parse(text);\n } catch {\n errorBody = text;\n }\n const errorMessage =\n typeof errorBody === \"object\" && errorBody !== null && \"error\" in errorBody\n ? String((errorBody as Record<string, unknown>)[\"error\"])\n : `HTTP ${response.status}`;\n const err = new TransportError(\n `${method} failed: ${errorMessage}`,\n response.status,\n errorBody,\n { requestId },\n );\n this.emit({\n kind: \"error\",\n method,\n url,\n status: response.status,\n requestId,\n durationMs,\n message: err.message,\n });\n throw err;\n }\n\n this.emit({ kind: \"response\", method, url, status: response.status, requestId, durationMs });\n\n if (!text) return undefined as T;\n return JSON.parse(text) as T;\n }\n\n private emit(event: Parameters<Logger>[0]): void {\n if (!this.logger) return;\n try {\n this.logger(event);\n } catch {\n // Logger errors must never propagate.\n }\n }\n\n private buildHeaders(): Record<string, string> {\n const headers: Record<string, string> = { \"Content-Type\": \"application/json\" };\n const canSendUserAgent = supportsUserAgentHeader();\n for (const [key, value] of Object.entries(this.headers)) {\n if (key.toLowerCase() === \"user-agent\" && !canSendUserAgent) continue;\n headers[key] = value;\n }\n if (canSendUserAgent && !Object.keys(headers).some((key) => key.toLowerCase() === \"user-agent\")) {\n headers[\"User-Agent\"] = defaultUserAgent();\n }\n if (this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n return headers;\n }\n}\n"]}
@@ -236,6 +236,14 @@ interface MemoryClientOptions {
236
236
  endpoint?: string;
237
237
  /** API key for authentication. */
238
238
  apiKey?: string;
239
+ /**
240
+ * NAMS workspace id. When set, transmitted as the `X-Workspace-Id` header on
241
+ * every request — required by deployments that scope by header (e.g. the
242
+ * development/staging service) rather than encoding the workspace in the API
243
+ * key (production). Optional and harmless when unset. Falls back to the
244
+ * `MEMORY_WORKSPACE_ID` environment variable.
245
+ */
246
+ workspaceId?: string;
239
247
  /** Override transport selection. Default: "auto" (REST if endpoint contains /v1). */
240
248
  transport?: TransportMode;
241
249
  /** OAuth refresh-token-aware token provider. Overrides apiKey when supplied. */
@@ -255,15 +263,25 @@ interface MemoryClientOptions {
255
263
  }
256
264
  interface AddMessageOptions {
257
265
  metadata?: Record<string, unknown>;
266
+ /** Alias for the positional `sessionId` (NAMS is conversation-scoped). */
267
+ conversationId?: string;
258
268
  }
259
269
  interface GetConversationOptions {
260
270
  limit?: number;
271
+ /** Alias for the positional `sessionId`. */
272
+ conversationId?: string;
261
273
  }
262
274
  interface SearchMessagesOptions {
263
275
  sessionId?: string;
276
+ /** Alias for `sessionId` (NAMS is conversation-scoped). `sessionId` wins. */
277
+ conversationId?: string;
264
278
  limit?: number;
265
279
  threshold?: number;
266
280
  }
281
+ interface ClearSessionOptions {
282
+ /** Alias for the positional `sessionId`. */
283
+ conversationId?: string;
284
+ }
267
285
  interface ListSessionsOptions {
268
286
  limit?: number;
269
287
  }
@@ -271,6 +289,22 @@ interface SearchEntitiesOptions {
271
289
  limit?: number;
272
290
  type?: string;
273
291
  }
292
+ interface WaitForExtractionOptions {
293
+ /** Search string to poll. Defaults to the first of `expectedNames`. */
294
+ query?: string;
295
+ /** Succeed once every name appears in results (case-insensitive). */
296
+ expectedNames?: string[];
297
+ /** Succeed once at least this many entities match. Default 1. */
298
+ minResults?: number;
299
+ /** Custom predicate over the current results. */
300
+ predicate?: (entities: Entity[]) => boolean;
301
+ /** Max entities to fetch per poll. */
302
+ limit?: number;
303
+ /** Overall timeout in milliseconds. Default 30000. */
304
+ timeoutMs?: number;
305
+ /** Poll interval in milliseconds. Default 1000. */
306
+ intervalMs?: number;
307
+ }
274
308
  interface SearchPreferencesOptions {
275
309
  category?: string;
276
310
  limit?: number;
@@ -377,6 +411,26 @@ declare class LongTermMemory {
377
411
  }): Promise<Preference>;
378
412
  addFact(subject: string, predicate: string, obj: string): Promise<Fact>;
379
413
  searchEntities(query: string, options?: SearchEntitiesOptions): Promise<Entity[]>;
414
+ /**
415
+ * Poll entity search until async extraction has caught up, or time out.
416
+ *
417
+ * NAMS extracts entities in a background pipeline, so writes return before
418
+ * the entities are searchable. This helper lets application and test code
419
+ * await consistency explicitly instead of racing a fixed delay.
420
+ *
421
+ * Provide one of:
422
+ * - `predicate` — called with the current results; return true when satisfied.
423
+ * - `expectedNames` — succeed once every name appears (case-insensitive).
424
+ * **Recommended**: NAMS entity search is vector/nearest-neighbor, so a
425
+ * `minResults` threshold is satisfied almost immediately on a non-empty
426
+ * workspace; prefer `expectedNames`/`predicate` to confirm a *specific*
427
+ * extraction landed.
428
+ * - otherwise — succeed once at least `minResults` entities match.
429
+ *
430
+ * Returns `true` if satisfied within `timeoutMs`, `false` otherwise (it does
431
+ * not throw, so callers can branch or skip gracefully).
432
+ */
433
+ waitForExtraction(options: WaitForExtractionOptions): Promise<boolean>;
380
434
  searchPreferences(query: string, options?: SearchPreferencesOptions): Promise<Preference[]>;
381
435
  getEntityByName(name: string): Promise<Entity | null>;
382
436
  getRelatedEntities(entityId: string, options?: GetRelatedEntitiesOptions): Promise<Entity[]>;
@@ -409,6 +463,120 @@ declare class LongTermMemory {
409
463
  getEntityGraph(): Promise<EntityGraph>;
410
464
  }
411
465
 
466
+ /**
467
+ * NAMS ontology surface — typed, versioned, validated domain schemas
468
+ * extending POLE+O. Mirrors the Python `client.ontology` accessor.
469
+ *
470
+ * The ontology endpoints are a snake_case sub-API verified empirically against
471
+ * staging (absent from the OpenAPI spec). The `RestTransport` routes for these
472
+ * (`*_ontology`) send bodies verbatim via the `snakeBody` flag.
473
+ *
474
+ * GET /ontologies → list (summaries)
475
+ * GET /ontologies/{id} → { record, versions[] }
476
+ * GET /ontologies/active → { ontology, version }
477
+ * POST /ontologies/{name}/clone → version
478
+ * POST /ontologies { ontology, validation_mode? } → version
479
+ * PUT /ontologies/{id} { ontology, validation_mode? } → new revision
480
+ * POST /ontologies/active { version_id } → version
481
+ * DELETE /ontologies/{id} → 204
482
+ */
483
+
484
+ interface PropertyDef {
485
+ name: string;
486
+ type: string;
487
+ required?: boolean;
488
+ unique?: boolean;
489
+ enum?: string[];
490
+ }
491
+ interface EntityTypeDef {
492
+ label: string;
493
+ poleType: string;
494
+ subtype?: string;
495
+ color?: string;
496
+ icon?: string;
497
+ properties: PropertyDef[];
498
+ }
499
+ interface RelationshipDef {
500
+ type: string;
501
+ source: string;
502
+ target: string;
503
+ }
504
+ interface DomainInfo {
505
+ id: string;
506
+ name: string;
507
+ description?: string;
508
+ tagline?: string;
509
+ emoji?: string;
510
+ }
511
+ interface OntologyDocument {
512
+ domain: DomainInfo;
513
+ entityTypes: EntityTypeDef[];
514
+ relationships: RelationshipDef[];
515
+ }
516
+ interface OntologySummary {
517
+ id: string;
518
+ name: string;
519
+ displayName?: string;
520
+ description?: string;
521
+ emoji?: string;
522
+ tagline?: string;
523
+ isSystem: boolean;
524
+ currentRevision?: number;
525
+ isActive: boolean;
526
+ }
527
+ interface OntologyVersion {
528
+ id: string;
529
+ ontologyId: string;
530
+ revision: number;
531
+ validationMode: string;
532
+ document?: OntologyDocument;
533
+ schemaHash?: string;
534
+ createdAt?: string;
535
+ message?: string;
536
+ }
537
+ interface OntologyRecord {
538
+ id: string;
539
+ name: string;
540
+ description?: string;
541
+ workspaceId?: string;
542
+ isSystem: boolean;
543
+ createdAt?: string;
544
+ }
545
+ interface Ontology {
546
+ record: OntologyRecord;
547
+ versions: OntologyVersion[];
548
+ }
549
+ interface ActiveOntology {
550
+ document: OntologyDocument;
551
+ validationMode?: string;
552
+ revision?: number;
553
+ ontologyId?: string;
554
+ versionId?: string;
555
+ }
556
+ interface CreateOntologyOptions {
557
+ /** Identity comes from `schema.domain`; `name` is accepted for symmetry. */
558
+ name: string;
559
+ schema: OntologyDocument;
560
+ validationMode?: string;
561
+ }
562
+ interface UpdateOntologyOptions {
563
+ id: string;
564
+ schema: OntologyDocument;
565
+ validationMode?: string;
566
+ }
567
+ declare class OntologyClient {
568
+ private readonly transport;
569
+ constructor(transport: Transport);
570
+ list(): Promise<OntologySummary[]>;
571
+ get(id: string): Promise<Ontology>;
572
+ getActive(): Promise<ActiveOntology>;
573
+ clone(templateName: string): Promise<OntologyVersion>;
574
+ create(options: CreateOntologyOptions): Promise<OntologyVersion>;
575
+ update(options: UpdateOntologyOptions): Promise<OntologyVersion>;
576
+ activate(versionId: string): Promise<OntologyVersion>;
577
+ delete(id: string): Promise<void>;
578
+ }
579
+
412
580
  /**
413
581
  * Cypher query console — read-only access to the underlying graph.
414
582
  *
@@ -482,12 +650,12 @@ declare class ReasoningMemory {
482
650
  declare class ShortTermMemory {
483
651
  private readonly transport;
484
652
  constructor(transport: Transport);
485
- addMessage(sessionId: string, role: MessageRole, content: string, options?: AddMessageOptions): Promise<Message>;
486
- getConversation(sessionId: string, options?: GetConversationOptions): Promise<Conversation>;
653
+ addMessage(sessionId: string | undefined, role: MessageRole, content: string, options?: AddMessageOptions): Promise<Message>;
654
+ getConversation(sessionId: string | undefined, options?: GetConversationOptions): Promise<Conversation>;
487
655
  searchMessages(query: string, options?: SearchMessagesOptions): Promise<Message[]>;
488
656
  listSessions(options?: ListSessionsOptions): Promise<SessionInfo[]>;
489
657
  deleteMessage(messageId: string): Promise<boolean>;
490
- clearSession(sessionId: string): Promise<void>;
658
+ clearSession(sessionId: string | undefined, options?: ClearSessionOptions): Promise<void>;
491
659
  /** Create a new conversation (hosted service). */
492
660
  createConversation(options: CreateConversationOptions): Promise<Conversation>;
493
661
  /** List conversations the API key has access to. */
@@ -541,6 +709,8 @@ declare class MemoryClient {
541
709
  readonly query: QueryConsole;
542
710
  /** API-key & OAuth management (hosted service only). */
543
711
  readonly auth: AuthClient;
712
+ /** Ontology lifecycle — typed domain schemas (hosted service only). */
713
+ readonly ontology: OntologyClient;
544
714
  private readonly transport;
545
715
  constructor(options?: MemoryClientOptions);
546
716
  constructor(transport: Transport);
@@ -548,4 +718,4 @@ declare class MemoryClient {
548
718
  close(): Promise<void>;
549
719
  }
550
720
 
551
- export { type SessionInfo as $, type AccessTokenPair as A, type BulkMessageInput as B, type CompleteTraceOptions as C, type ListTracesOptions as D, type Entity as E, type Fact as F, type GetConversationOptions as G, type HostedEntityType as H, LongTermMemory as I, type MemoryClientOptions as J, type Message as K, type ListConversationsOptions as L, MemoryClient as M, type MessageRole as N, type Observation as O, type Preference as P, QueryConsole as Q, ReasoningMemory as R, type ReasoningStep as S, type ReasoningTrace as T, type RecordStepInput as U, type RecordToolCallOptions as V, type Reflection as W, type Relationship as X, type SearchEntitiesOptions as Y, type SearchMessagesOptions as Z, type SearchPreferencesOptions as _, type AddMessageOptions as a, type SetEntityFeedbackOptions as a0, ShortTermMemory as a1, type ToolCall as a2, type ToolCallStatus as a3, type ToolStats as a4, type TransportMode as a5, type UpdateEntityOptions as a6, type AddRelationshipOptions as b, type AgentStep as c, type AgentStepExplanation as d, type ApiKey as e, AuthClient as f, type Conversation as g, type ConversationContext as h, type ConversationTrace as i, type CreateApiKeyInput as j, type CreateConversationOptions as k, type CypherResult as l, type EntityFeedbackResult as m, type EntityGraph as n, type EntityGraphEdge as o, type EntityGraphNode as p, type EntityHistory as q, type EntityMention as r, type EntityMergeResult as s, type EntityProvenance as t, type EntityRelationshipRef as u, type EntityType as v, type GetRelatedEntitiesOptions as w, type GetSimilarTracesOptions as x, type ListEntitiesOptions as y, type ListSessionsOptions as z };
721
+ export { QueryConsole as $, type AccessTokenPair as A, type BulkMessageInput as B, type CompleteTraceOptions as C, type DomainInfo as D, type Entity as E, type Fact as F, type GetConversationOptions as G, type GetSimilarTracesOptions as H, type HostedEntityType as I, type ListEntitiesOptions as J, type ListSessionsOptions as K, type ListConversationsOptions as L, type ListTracesOptions as M, LongTermMemory as N, MemoryClient as O, type MemoryClientOptions as P, type Message as Q, type MessageRole as R, type Observation as S, type Ontology as T, OntologyClient as U, type OntologyDocument as V, type OntologyRecord as W, type OntologySummary as X, type OntologyVersion as Y, type Preference as Z, type PropertyDef as _, type ActiveOntology as a, ReasoningMemory as a0, type ReasoningStep as a1, type ReasoningTrace as a2, type RecordStepInput as a3, type RecordToolCallOptions as a4, type Reflection as a5, type Relationship as a6, type RelationshipDef as a7, type SearchEntitiesOptions as a8, type SearchMessagesOptions as a9, type SearchPreferencesOptions as aa, type SessionInfo as ab, type SetEntityFeedbackOptions as ac, ShortTermMemory as ad, type ToolCall as ae, type ToolCallStatus as af, type ToolStats as ag, type TransportMode as ah, type UpdateEntityOptions as ai, type UpdateOntologyOptions as aj, type AddMessageOptions as b, type AddRelationshipOptions as c, type AgentStep as d, type AgentStepExplanation as e, type ApiKey as f, AuthClient as g, type Conversation as h, type ConversationContext as i, type ConversationTrace as j, type CreateApiKeyInput as k, type CreateConversationOptions as l, type CreateOntologyOptions as m, type CypherResult as n, type EntityFeedbackResult as o, type EntityGraph as p, type EntityGraphEdge as q, type EntityGraphNode as r, type EntityHistory as s, type EntityMention as t, type EntityMergeResult as u, type EntityProvenance as v, type EntityRelationshipRef as w, type EntityType as x, type EntityTypeDef as y, type GetRelatedEntitiesOptions as z };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AccessTokenPair, a as AddMessageOptions, b as AddRelationshipOptions, c as AgentStep, d as AgentStepExplanation, e as ApiKey, f as AuthClient, B as BulkMessageInput, C as CompleteTraceOptions, g as Conversation, h as ConversationContext, i as ConversationTrace, j as CreateApiKeyInput, k as CreateConversationOptions, l as CypherResult, E as Entity, m as EntityFeedbackResult, n as EntityGraph, o as EntityGraphEdge, p as EntityGraphNode, q as EntityHistory, r as EntityMention, s as EntityMergeResult, t as EntityProvenance, u as EntityRelationshipRef, v as EntityType, F as Fact, G as GetConversationOptions, w as GetRelatedEntitiesOptions, x as GetSimilarTracesOptions, H as HostedEntityType, L as ListConversationsOptions, y as ListEntitiesOptions, z as ListSessionsOptions, D as ListTracesOptions, I as LongTermMemory, M as MemoryClient, J as MemoryClientOptions, K as Message, N as MessageRole, O as Observation, P as Preference, Q as QueryConsole, R as ReasoningMemory, S as ReasoningStep, T as ReasoningTrace, U as RecordStepInput, V as RecordToolCallOptions, W as Reflection, X as Relationship, Y as SearchEntitiesOptions, Z as SearchMessagesOptions, _ as SearchPreferencesOptions, $ as SessionInfo, a0 as SetEntityFeedbackOptions, a1 as ShortTermMemory, a2 as ToolCall, a3 as ToolCallStatus, a4 as ToolStats, a5 as TransportMode, a6 as UpdateEntityOptions } from './client-DSqbWQoa.js';
1
+ export { A as AccessTokenPair, a as ActiveOntology, b as AddMessageOptions, c as AddRelationshipOptions, d as AgentStep, e as AgentStepExplanation, f as ApiKey, g as AuthClient, B as BulkMessageInput, C as CompleteTraceOptions, h as Conversation, i as ConversationContext, j as ConversationTrace, k as CreateApiKeyInput, l as CreateConversationOptions, m as CreateOntologyOptions, n as CypherResult, D as DomainInfo, E as Entity, o as EntityFeedbackResult, p as EntityGraph, q as EntityGraphEdge, r as EntityGraphNode, s as EntityHistory, t as EntityMention, u as EntityMergeResult, v as EntityProvenance, w as EntityRelationshipRef, x as EntityType, y as EntityTypeDef, F as Fact, G as GetConversationOptions, z as GetRelatedEntitiesOptions, H as GetSimilarTracesOptions, I as HostedEntityType, L as ListConversationsOptions, J as ListEntitiesOptions, K as ListSessionsOptions, M as ListTracesOptions, N as LongTermMemory, O as MemoryClient, P as MemoryClientOptions, Q as Message, R as MessageRole, S as Observation, T as Ontology, U as OntologyClient, V as OntologyDocument, W as OntologyRecord, X as OntologySummary, Y as OntologyVersion, Z as Preference, _ as PropertyDef, $ as QueryConsole, a0 as ReasoningMemory, a1 as ReasoningStep, a2 as ReasoningTrace, a3 as RecordStepInput, a4 as RecordToolCallOptions, a5 as Reflection, a6 as Relationship, a7 as RelationshipDef, a8 as SearchEntitiesOptions, a9 as SearchMessagesOptions, aa as SearchPreferencesOptions, ab as SessionInfo, ac as SetEntityFeedbackOptions, ad as ShortTermMemory, ae as ToolCall, af as ToolCallStatus, ag as ToolStats, ah as TransportMode, ai as UpdateEntityOptions, aj as UpdateOntologyOptions } from './client-DV-lnohj.js';
2
2
  import { T as Transport, L as Logger } from './index-qfRrdQNP.js';
3
3
  export { a as LogEvent } from './index-qfRrdQNP.js';
4
4
 
@@ -88,6 +88,6 @@ declare class NotSupportedError extends MemoryError {
88
88
  * dedicated version-check script run in CI. Imported by the transports to build
89
89
  * the default User-Agent header.
90
90
  */
91
- declare const VERSION = "0.3.0";
91
+ declare const VERSION = "0.4.0";
92
92
 
93
93
  export { AuthenticationError, ConnectionError, Logger, MemoryError, NotFoundError, NotSupportedError, RestTransport, type RestTransportOptions, type TokenProvider, Transport, TransportError, VERSION, ValidationError };