@memnexus-ai/typescript-sdk 1.55.13 → 1.56.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.cjs CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  UsersService: () => UsersService,
50
50
  addMemoryToNarrativeRequest: () => addMemoryToNarrativeRequest,
51
51
  apiKey: () => apiKey,
52
+ appendNamedMemoryRequest: () => appendNamedMemoryRequest,
52
53
  artifact: () => artifact,
53
54
  batchGetMemoriesMeta: () => batchGetMemoriesMeta,
54
55
  batchGetMemoriesRequest: () => batchGetMemoriesRequest,
@@ -3492,6 +3493,49 @@ var MemoriesService = class extends BaseService {
3492
3493
  }
3493
3494
  return this.client.call(request);
3494
3495
  }
3496
+ /**
3497
+ * Atomically append a block to a named memory
3498
+ * Atomically appends a text block to a named memory, eliminating the
3499
+ read-modify-write clobber that concurrent full-content updates cause on
3500
+ shared named memories. The server reads the current head, concatenates
3501
+ `existing + separator + block`, and writes a new version under the
3502
+ NameLock with an internal compare-and-swap + bounded retry — so
3503
+ simultaneous appends all survive and the client needs no retry logic.
3504
+ Content is decrypted, assembled, size-checked, and re-encrypted
3505
+ server-side; plaintext is never returned to other callers.
3506
+
3507
+ * @param name - Memory name (kebab-case, 2-64 chars)
3508
+ * @param body - Request body
3509
+ */
3510
+ async appendNamedMemory(name, body) {
3511
+ const request = new Request({
3512
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3513
+ method: "POST",
3514
+ path: "/api/memories/named/{name}/append",
3515
+ config: this.config,
3516
+ retry: {
3517
+ attempts: 3,
3518
+ delayMs: 150,
3519
+ maxDelayMs: 5e3,
3520
+ jitterMs: 50,
3521
+ backoffFactor: 2
3522
+ }
3523
+ });
3524
+ request.addPathParam("name", {
3525
+ key: "name",
3526
+ value: name,
3527
+ explode: false,
3528
+ encode: true,
3529
+ style: "simple",
3530
+ isLimit: false,
3531
+ isOffset: false,
3532
+ isCursor: false
3533
+ });
3534
+ if (body !== void 0) {
3535
+ request.addBody(body);
3536
+ }
3537
+ return this.client.call(request);
3538
+ }
3495
3539
  /**
3496
3540
  * Bulk delete multiple memories
3497
3541
  * Soft-delete multiple memories at once. Requires confirmDeletion=true.
@@ -4158,11 +4202,18 @@ var HealthService = class extends BaseService {
4158
4202
  return this.client.call(request);
4159
4203
  }
4160
4204
  /**
4161
- * API health check endpoint
4162
- * Returns the health status and uptime of the API service.
4163
- This endpoint is public and requires no authentication.
4164
- Use this endpoint for monitoring, health checks, and service availability verification.
4165
- Returns 200 when healthy, 503 when the database is unreachable.
4205
+ * API readiness check endpoint
4206
+ * Returns the readiness status of the API service, based on database
4207
+ connectivity. This endpoint is public and requires no authentication.
4208
+ Returns 200 when the database is reachable, 503 when it is not.
4209
+
4210
+ v2.35: the database status is served from a CACHE refreshed by a
4211
+ background loop every HEALTH_DB_CHECK_INTERVAL_MS — this endpoint does
4212
+ NOT query the database per request, so probe latency is decoupled from
4213
+ query latency (the 07-03 dual-pod ejection fix). If the cache is older
4214
+ than HEALTH_DB_STALENESS_CEILING_MS (the background checker is wedged,
4215
+ e.g. a hung query), readiness reports NOT-READY (503) — a genuinely
4216
+ dead/hung database is never masked by a stale "ok".
4166
4217
 
4167
4218
  */
4168
4219
  async healthCheck() {
@@ -6416,6 +6467,8 @@ var getMemoryResponse = import_zod.z.lazy(() => import_zod.z.object({
6416
6467
  var updateNamedMemoryRequest = import_zod.z.object({
6417
6468
  /** New content for the named memory version */
6418
6469
  content: import_zod.z.string().min(1).max(5e4),
6470
+ /** Optimistic concurrency (compare-and-swap): if provided, the update only succeeds when the current head version's id matches this value. On mismatch the server returns 409 Conflict with the current head id, so the caller can re-read, re-merge, and retry. When omitted, the update is an unconditional replace (backward compatible). */
6471
+ expectedHeadId: import_zod.z.string().uuid().optional(),
6419
6472
  /** Type of memory (defaults to previous version's type) */
6420
6473
  memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]).optional(),
6421
6474
  /** Context or domain */
@@ -6443,6 +6496,36 @@ var updateNamedMemoryRequest = import_zod.z.object({
6443
6496
  /** Additional memory ID that this version supersedes (beyond the implicit version chain) */
6444
6497
  supersedes: import_zod.z.string().uuid().optional()
6445
6498
  });
6499
+ var appendNamedMemoryRequest = import_zod.z.object({
6500
+ /** Text block to append to the named memory's current content. The total (existing + separator + block) must not exceed the maximum content length or the request is rejected with 413. */
6501
+ block: import_zod.z.string().min(1).max(5e4),
6502
+ /** Separator inserted between the existing content and the appended block. Defaults to a blank line ("\n\n"). */
6503
+ separator: import_zod.z.string().max(100).optional(),
6504
+ /** Type of memory (defaults to previous version's type) */
6505
+ memoryType: import_zod.z.enum(["episodic", "semantic", "procedural"]).optional(),
6506
+ /** Context or domain */
6507
+ context: import_zod.z.string().max(200).optional(),
6508
+ /** Associated topics */
6509
+ topics: import_zod.z.array(import_zod.z.string().max(100)).max(50).optional(),
6510
+ /** Conversation to group this version with (overrides previous version's conversation) */
6511
+ conversationId: import_zod.z.string().max(200).optional(),
6512
+ codeContext: import_zod.z.object({
6513
+ /** Product name (e.g. 'memnexus', 'spearmint') */
6514
+ product: import_zod.z.string().max(200).optional(),
6515
+ /** Repository name, if different from product */
6516
+ repo: import_zod.z.string().max(200).optional(),
6517
+ /** Service or package name (e.g. 'core-api', 'mcp-server', 'cli') */
6518
+ service: import_zod.z.string().max(200).optional(),
6519
+ /** Subsystem or component (e.g. 'extraction-pipeline', 'search', 'billing') */
6520
+ component: import_zod.z.string().max(200).optional(),
6521
+ /** Team that produced this knowledge (e.g. 'extraction', 'mcp', 'platform') */
6522
+ team: import_zod.z.string().max(200).optional(),
6523
+ /** Agent role or persona (e.g. 'team-lead', 'implementer', 'reviewer') */
6524
+ role: import_zod.z.string().max(200).optional(),
6525
+ /** Additional project-specific scope tags */
6526
+ extra: import_zod.z.object({}).catchall(import_zod.z.string().max(500)).optional()
6527
+ }).optional()
6528
+ });
6446
6529
  var namedMemoryHistoryResponse = import_zod.z.object({
6447
6530
  /** Human-readable name for deterministic retrieval (kebab-case, 2-64 chars) */
6448
6531
  name: import_zod.z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/),
@@ -7928,6 +8011,7 @@ var index_default = Memnexus;
7928
8011
  UsersService,
7929
8012
  addMemoryToNarrativeRequest,
7930
8013
  apiKey,
8014
+ appendNamedMemoryRequest,
7931
8015
  artifact,
7932
8016
  batchGetMemoriesMeta,
7933
8017
  batchGetMemoriesRequest,