@papr/memory 1.19.0 → 2.0.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +1 -1
  3. package/README.md +13 -1
  4. package/client.d.mts +38 -10
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +38 -10
  7. package/client.d.ts.map +1 -1
  8. package/client.js +17 -2
  9. package/client.js.map +1 -1
  10. package/client.mjs +17 -2
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/internal/tslib.js +22 -22
  19. package/package.json +1 -1
  20. package/resources/document.d.mts +16 -3
  21. package/resources/document.d.mts.map +1 -1
  22. package/resources/document.d.ts +16 -3
  23. package/resources/document.d.ts.map +1 -1
  24. package/resources/index.d.mts +6 -3
  25. package/resources/index.d.mts.map +1 -1
  26. package/resources/index.d.ts +6 -3
  27. package/resources/index.d.ts.map +1 -1
  28. package/resources/index.js +7 -1
  29. package/resources/index.js.map +1 -1
  30. package/resources/index.mjs +3 -0
  31. package/resources/index.mjs.map +1 -1
  32. package/resources/memory.d.mts +527 -95
  33. package/resources/memory.d.mts.map +1 -1
  34. package/resources/memory.d.ts +527 -95
  35. package/resources/memory.d.ts.map +1 -1
  36. package/resources/memory.js +21 -6
  37. package/resources/memory.js.map +1 -1
  38. package/resources/memory.mjs +21 -6
  39. package/resources/memory.mjs.map +1 -1
  40. package/resources/messages/index.d.mts +3 -0
  41. package/resources/messages/index.d.mts.map +1 -0
  42. package/resources/messages/index.d.ts +3 -0
  43. package/resources/messages/index.d.ts.map +1 -0
  44. package/resources/messages/index.js +9 -0
  45. package/resources/messages/index.js.map +1 -0
  46. package/resources/messages/index.mjs +4 -0
  47. package/resources/messages/index.mjs.map +1 -0
  48. package/resources/messages/messages.d.mts +160 -0
  49. package/resources/messages/messages.d.mts.map +1 -0
  50. package/resources/messages/messages.d.ts +160 -0
  51. package/resources/messages/messages.d.ts.map +1 -0
  52. package/resources/messages/messages.js +54 -0
  53. package/resources/messages/messages.js.map +1 -0
  54. package/resources/messages/messages.mjs +49 -0
  55. package/resources/messages/messages.mjs.map +1 -0
  56. package/resources/messages/sessions.d.mts +262 -0
  57. package/resources/messages/sessions.d.mts.map +1 -0
  58. package/resources/messages/sessions.d.ts +262 -0
  59. package/resources/messages/sessions.d.ts.map +1 -0
  60. package/resources/messages/sessions.js +122 -0
  61. package/resources/messages/sessions.js.map +1 -0
  62. package/resources/messages/sessions.mjs +118 -0
  63. package/resources/messages/sessions.mjs.map +1 -0
  64. package/resources/messages.d.mts +2 -0
  65. package/resources/messages.d.mts.map +1 -0
  66. package/resources/messages.d.ts +2 -0
  67. package/resources/messages.d.ts.map +1 -0
  68. package/resources/messages.js +6 -0
  69. package/resources/messages.js.map +1 -0
  70. package/resources/messages.mjs +3 -0
  71. package/resources/messages.mjs.map +1 -0
  72. package/resources/omo.d.mts +98 -0
  73. package/resources/omo.d.mts.map +1 -0
  74. package/resources/omo.d.ts +98 -0
  75. package/resources/omo.d.ts.map +1 -0
  76. package/resources/omo.js +36 -0
  77. package/resources/omo.js.map +1 -0
  78. package/resources/omo.mjs +32 -0
  79. package/resources/omo.mjs.map +1 -0
  80. package/resources/schemas.d.mts +712 -92
  81. package/resources/schemas.d.mts.map +1 -1
  82. package/resources/schemas.d.ts +712 -92
  83. package/resources/schemas.d.ts.map +1 -1
  84. package/resources/schemas.js +23 -10
  85. package/resources/schemas.js.map +1 -1
  86. package/resources/schemas.mjs +23 -10
  87. package/resources/schemas.mjs.map +1 -1
  88. package/resources/shared.d.mts +671 -0
  89. package/resources/shared.d.mts.map +1 -1
  90. package/resources/shared.d.ts +671 -0
  91. package/resources/shared.d.ts.map +1 -1
  92. package/resources/sync.d.mts +142 -0
  93. package/resources/sync.d.mts.map +1 -0
  94. package/resources/sync.d.ts +142 -0
  95. package/resources/sync.d.ts.map +1 -0
  96. package/resources/sync.js +36 -0
  97. package/resources/sync.js.map +1 -0
  98. package/resources/sync.mjs +32 -0
  99. package/resources/sync.mjs.map +1 -0
  100. package/resources/user.d.mts +18 -1
  101. package/resources/user.d.mts.map +1 -1
  102. package/resources/user.d.ts +18 -1
  103. package/resources/user.d.ts.map +1 -1
  104. package/resources/user.js +11 -0
  105. package/resources/user.js.map +1 -1
  106. package/resources/user.mjs +11 -0
  107. package/resources/user.mjs.map +1 -1
  108. package/src/client.ts +81 -9
  109. package/src/internal/parse.ts +6 -0
  110. package/src/resources/document.ts +17 -4
  111. package/src/resources/index.ts +21 -0
  112. package/src/resources/memory.ts +586 -134
  113. package/src/resources/messages/index.ts +11 -0
  114. package/src/resources/messages/messages.ts +193 -0
  115. package/src/resources/messages/sessions.ts +315 -0
  116. package/src/resources/messages.ts +3 -0
  117. package/src/resources/omo.ts +132 -0
  118. package/src/resources/schemas.ts +740 -111
  119. package/src/resources/shared.ts +752 -0
  120. package/src/resources/sync.ts +179 -0
  121. package/src/resources/user.ts +23 -0
  122. package/src/version.ts +1 -1
  123. package/version.d.mts +1 -1
  124. package/version.d.mts.map +1 -1
  125. package/version.d.ts +1 -1
  126. package/version.d.ts.map +1 -1
  127. package/version.js +1 -1
  128. package/version.js.map +1 -1
  129. package/version.mjs +1 -1
  130. package/version.mjs.map +1 -1
@@ -97,8 +97,12 @@ export class Memory extends APIResource {
97
97
  * ```
98
98
  */
99
99
  add(params: MemoryAddParams, options?: RequestOptions): APIPromise<AddMemoryResponse> {
100
- const { skip_background_processing, ...body } = params;
101
- return this._client.post('/v1/memory', { query: { skip_background_processing }, body, ...options });
100
+ const { enable_holographic, format, skip_background_processing, ...body } = params;
101
+ return this._client.post('/v1/memory', {
102
+ query: { enable_holographic, format, skip_background_processing },
103
+ body,
104
+ ...options,
105
+ });
102
106
  }
103
107
 
104
108
  /**
@@ -189,8 +193,12 @@ export class Memory extends APIResource {
189
193
  * const searchResponse = await client.memory.get('memory_id');
190
194
  * ```
191
195
  */
192
- get(memoryID: string, options?: RequestOptions): APIPromise<SearchResponse> {
193
- return this._client.get(path`/v1/memory/${memoryID}`, options);
196
+ get(
197
+ memoryID: string,
198
+ query: MemoryGetParams | null | undefined = {},
199
+ options?: RequestOptions,
200
+ ): APIPromise<SearchResponse> {
201
+ return this._client.get(path`/v1/memory/${memoryID}`, { query, ...options });
194
202
  }
195
203
 
196
204
  /**
@@ -202,6 +210,16 @@ export class Memory extends APIResource {
202
210
  * - API Key in `X-API-Key` header
203
211
  * - Session token in `X-Session-Token` header
204
212
  *
213
+ * **Response Format Options**:
214
+ * Choose between standard JSON or TOON (Token-Oriented Object Notation) format:
215
+ * - **JSON (default)**: Standard JSON response format
216
+ * - **TOON**: Optimized format achieving 30-60% token reduction for LLM contexts
217
+ * - Use `response_format=toon` query parameter
218
+ * - Returns `text/plain` with TOON-formatted content
219
+ * - Ideal for LLM integrations to reduce API costs and latency
220
+ * - Maintains semantic clarity while minimizing token usage
221
+ * - Example: `/v1/memory/search?response_format=toon`
222
+ *
205
223
  * **Custom Schema Support**:
206
224
  * This endpoint supports both system-defined and custom user-defined node types:
207
225
  * - **System nodes**: Memory, Person, Company, Project, Task, Insight, Meeting, Opportunity, Code
@@ -226,6 +244,7 @@ export class Memory extends APIResource {
226
244
  * - Set `enable_agentic_graph: true` for intelligent, context-aware search that can understand ambiguous references
227
245
  * - Use `max_memories: 15-20` for comprehensive memory coverage
228
246
  * - Use `max_nodes: 10-15` for comprehensive graph entity relationships
247
+ * - Use `response_format: toon` when integrating with LLMs to reduce token costs by 30-60%
229
248
  *
230
249
  * **Agentic Graph Benefits:**
231
250
  * When enabled, the system can understand vague references by first identifying specific entities from your memory graph, then performing targeted searches. For example:
@@ -253,9 +272,9 @@ export class Memory extends APIResource {
253
272
  * ```
254
273
  */
255
274
  search(params: MemorySearchParams, options?: RequestOptions): APIPromise<SearchResponse> {
256
- const { max_memories, max_nodes, 'Accept-Encoding': acceptEncoding, ...body } = params;
275
+ const { max_memories, max_nodes, response_format, 'Accept-Encoding': acceptEncoding, ...body } = params;
257
276
  return this._client.post('/v1/memory/search', {
258
- query: { max_memories, max_nodes },
277
+ query: { max_memories, max_nodes, response_format },
259
278
  body,
260
279
  ...options,
261
280
  headers: buildHeaders([
@@ -276,15 +295,61 @@ export interface AddMemory {
276
295
  content: string;
277
296
 
278
297
  /**
279
- * Context can be conversation history or any relevant context for a memory item
298
+ * Conversation history context for this memory. Use for providing message history
299
+ * when adding a memory. Format: [{role: 'user'|'assistant', content: '...'}]
280
300
  */
281
301
  context?: Array<ContextItem> | null;
282
302
 
283
303
  /**
284
- * Graph generation configuration
304
+ * Your application's user identifier. This is the primary way to identify users.
305
+ * Use this for your app's user IDs (e.g., 'user_alice_123', UUID, email). Papr
306
+ * will automatically resolve or create internal users as needed.
307
+ */
308
+ external_user_id?: string | null;
309
+
310
+ /**
311
+ * @deprecated Graph generation configuration
285
312
  */
286
313
  graph_generation?: GraphGeneration | null;
287
314
 
315
+ /**
316
+ * Shorthand DSL for node/edge constraints. Expands to
317
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
318
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
319
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
320
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
321
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
322
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
323
+ * '$this', '$previous', '$context:N' Example:
324
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
325
+ */
326
+ link_to?: string | Array<string> | { [key: string]: unknown } | null;
327
+
328
+ /**
329
+ * Unified memory processing policy.
330
+ *
331
+ * This is the SINGLE source of truth for how a memory should be processed,
332
+ * combining graph generation control AND OMO (Open Memory Object) safety
333
+ * standards.
334
+ *
335
+ * **Graph Generation Modes:**
336
+ *
337
+ * - auto: LLM extracts entities freely (default)
338
+ * - manual: Developer provides exact nodes (no LLM extraction)
339
+ *
340
+ * **OMO Safety Standards:**
341
+ *
342
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
343
+ * - risk: Safety assessment (none, sensitive, flagged)
344
+ * - acl: Access control list for read/write permissions
345
+ *
346
+ * **Schema Integration:**
347
+ *
348
+ * - schema_id: Reference a schema that may have its own default memory_policy
349
+ * - Schema-level policies are merged with request-level (request takes precedence)
350
+ */
351
+ memory_policy?: Shared.MemoryPolicy | null;
352
+
288
353
  /**
289
354
  * Metadata for memory request
290
355
  */
@@ -303,7 +368,10 @@ export interface AddMemory {
303
368
  organization_id?: string | null;
304
369
 
305
370
  /**
306
- * Array of relationships that we can use in Graph DB (neo4J)
371
+ * @deprecated DEPRECATED: Use 'memory_policy' instead. Migration options: 1.
372
+ * Specific memory: relationships=[{source: '$this', target: 'mem_123', type:
373
+ * 'FOLLOWS'}] 2. Previous memory: link_to_previous_memory=True 3. Related
374
+ * memories: link_to_related_memories=3
307
375
  */
308
376
  relationships_json?: Array<RelationshipItem> | null;
309
377
 
@@ -311,6 +379,12 @@ export interface AddMemory {
311
379
  * Memory item type; defaults to 'text' if omitted
312
380
  */
313
381
  type?: MemoryType;
382
+
383
+ /**
384
+ * @deprecated DEPRECATED: Use 'external_user_id' instead. Internal Papr Parse user
385
+ * ID. Most developers should not use this field directly.
386
+ */
387
+ user_id?: string | null;
314
388
  }
315
389
 
316
390
  /**
@@ -356,11 +430,6 @@ export interface AutoGraphGeneration {
356
430
  * Force AI to use this specific schema instead of auto-selecting
357
431
  */
358
432
  schema_id?: string | null;
359
-
360
- /**
361
- * Limit AI to system + one user schema for consistency
362
- */
363
- simple_schema_mode?: boolean;
364
433
  }
365
434
 
366
435
  export namespace AutoGraphGeneration {
@@ -585,6 +654,12 @@ export namespace ManualGraphGeneration {
585
654
  * Metadata for memory request
586
655
  */
587
656
  export interface MemoryMetadata {
657
+ /**
658
+ * @deprecated DEPRECATED: Use 'memory_policy.acl' at request level instead.
659
+ * Format: {'read': [...], 'write': [...]}.
660
+ */
661
+ acl?: { [key: string]: Array<string> } | null;
662
+
588
663
  assistantMessage?: string | null;
589
664
 
590
665
  /**
@@ -593,6 +668,12 @@ export interface MemoryMetadata {
593
668
  */
594
669
  category?: 'preference' | 'task' | 'goal' | 'fact' | 'context' | 'skills' | 'learning' | null;
595
670
 
671
+ /**
672
+ * @deprecated DEPRECATED: Use 'memory_policy.consent' at request level instead.
673
+ * Values: 'explicit', 'implicit' (default), 'terms', 'none'.
674
+ */
675
+ consent?: string | null;
676
+
596
677
  conversationId?: string | null;
597
678
 
598
679
  /**
@@ -610,10 +691,22 @@ export interface MemoryMetadata {
610
691
 
611
692
  'emotion tags'?: Array<string> | null;
612
693
 
694
+ /**
695
+ * @deprecated DEPRECATED: Use 'external_user_id' at request level instead. This
696
+ * field will be removed in v2.
697
+ */
613
698
  external_user_id?: string | null;
614
699
 
700
+ /**
701
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
702
+ * instead.
703
+ */
615
704
  external_user_read_access?: Array<string> | null;
616
705
 
706
+ /**
707
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
708
+ * instead.
709
+ */
617
710
  external_user_write_access?: Array<string> | null;
618
711
 
619
712
  goalClassificationScores?: Array<number> | null;
@@ -621,14 +714,46 @@ export interface MemoryMetadata {
621
714
  /**
622
715
  * Hierarchical structures to enable navigation from broad topics to specific ones
623
716
  */
624
- hierarchical_structures?: string | null;
717
+ hierarchical_structures?: string | Array<unknown> | null;
625
718
 
626
719
  location?: string | null;
627
720
 
721
+ /**
722
+ * @deprecated DEPRECATED: Use 'namespace_id' at request level instead. This field
723
+ * will be removed in v2.
724
+ */
628
725
  namespace_id?: string | null;
629
726
 
727
+ /**
728
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
729
+ * instead.
730
+ */
731
+ namespace_read_access?: Array<string> | null;
732
+
733
+ /**
734
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
735
+ * instead.
736
+ */
737
+ namespace_write_access?: Array<string> | null;
738
+
739
+ /**
740
+ * @deprecated DEPRECATED: Use 'organization_id' at request level instead. This
741
+ * field will be removed in v2.
742
+ */
630
743
  organization_id?: string | null;
631
744
 
745
+ /**
746
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
747
+ * instead.
748
+ */
749
+ organization_read_access?: Array<string> | null;
750
+
751
+ /**
752
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
753
+ * instead.
754
+ */
755
+ organization_write_access?: Array<string> | null;
756
+
632
757
  pageId?: string | null;
633
758
 
634
759
  post?: string | null;
@@ -639,13 +764,27 @@ export interface MemoryMetadata {
639
764
 
640
765
  relatedUseCases?: Array<string> | null;
641
766
 
767
+ /**
768
+ * @deprecated DEPRECATED: Use 'memory_policy.risk' at request level instead.
769
+ * Values: 'none' (default), 'sensitive', 'flagged'.
770
+ */
771
+ risk?: string | null;
772
+
642
773
  /**
643
774
  * Role of the message sender
644
775
  */
645
776
  role?: 'user' | 'assistant' | null;
646
777
 
778
+ /**
779
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
780
+ * instead.
781
+ */
647
782
  role_read_access?: Array<string> | null;
648
783
 
784
+ /**
785
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
786
+ * instead.
787
+ */
649
788
  role_write_access?: Array<string> | null;
650
789
 
651
790
  sessionId?: string | null;
@@ -665,18 +804,38 @@ export interface MemoryMetadata {
665
804
 
666
805
  useCaseClassificationScores?: Array<number> | null;
667
806
 
807
+ /**
808
+ * @deprecated DEPRECATED: Use 'external_user_id' at request level instead. This
809
+ * field will be removed in v2.
810
+ */
668
811
  user_id?: string | null;
669
812
 
813
+ /**
814
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
815
+ * instead.
816
+ */
670
817
  user_read_access?: Array<string> | null;
671
818
 
819
+ /**
820
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
821
+ * instead.
822
+ */
672
823
  user_write_access?: Array<string> | null;
673
824
 
674
825
  userMessage?: string | null;
675
826
 
676
827
  workspace_id?: string | null;
677
828
 
829
+ /**
830
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
831
+ * instead.
832
+ */
678
833
  workspace_read_access?: Array<string> | null;
679
834
 
835
+ /**
836
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
837
+ * instead.
838
+ */
680
839
  workspace_write_access?: Array<string> | null;
681
840
 
682
841
  [k: string]: unknown;
@@ -746,7 +905,7 @@ export namespace SearchResponse {
746
905
  * Return type for SearchResult
747
906
  */
748
907
  export interface Data {
749
- memories: Array<Data.Memory>;
908
+ memories: Array<Shared.Memory>;
750
909
 
751
910
  nodes: Array<Data.Node>;
752
911
 
@@ -758,107 +917,6 @@ export namespace SearchResponse {
758
917
  }
759
918
 
760
919
  export namespace Data {
761
- /**
762
- * A memory item in the knowledge base
763
- */
764
- export interface Memory {
765
- id: string;
766
-
767
- acl: { [key: string]: { [key: string]: boolean } };
768
-
769
- content: string;
770
-
771
- type: string;
772
-
773
- user_id: string;
774
-
775
- /**
776
- * Memory category based on role
777
- */
778
- category?: string | null;
779
-
780
- context?: Array<MemoryAPI.ContextItem> | null;
781
-
782
- conversation_id?: string;
783
-
784
- created_at?: string | null;
785
-
786
- current_step?: string | null;
787
-
788
- customMetadata?: { [key: string]: unknown } | null;
789
-
790
- external_user_id?: string | null;
791
-
792
- external_user_read_access?: Array<string> | null;
793
-
794
- external_user_write_access?: Array<string> | null;
795
-
796
- file_url?: string | null;
797
-
798
- filename?: string | null;
799
-
800
- hierarchical_structures?: string;
801
-
802
- location?: string | null;
803
-
804
- metadata?: string | { [key: string]: unknown } | null;
805
-
806
- /**
807
- * Namespace ID this memory belongs to
808
- */
809
- namespace_id?: string | null;
810
-
811
- /**
812
- * Organization ID that owns this memory
813
- */
814
- organization_id?: string | null;
815
-
816
- page?: string | null;
817
-
818
- page_number?: number | null;
819
-
820
- /**
821
- * Role that generated this memory (user or assistant)
822
- */
823
- role?: string | null;
824
-
825
- role_read_access?: Array<string> | null;
826
-
827
- role_write_access?: Array<string> | null;
828
-
829
- source_document_id?: string | null;
830
-
831
- source_message_id?: string | null;
832
-
833
- source_type?: string;
834
-
835
- source_url?: string;
836
-
837
- steps?: Array<string>;
838
-
839
- tags?: Array<string>;
840
-
841
- title?: string | null;
842
-
843
- topics?: Array<string>;
844
-
845
- total_pages?: number | null;
846
-
847
- updated_at?: string | null;
848
-
849
- user_read_access?: Array<string> | null;
850
-
851
- user_write_access?: Array<string> | null;
852
-
853
- workspace_id?: string | null;
854
-
855
- workspace_read_access?: Array<string> | null;
856
-
857
- workspace_write_access?: Array<string> | null;
858
-
859
- [k: string]: unknown;
860
- }
861
-
862
920
  /**
863
921
  * Public-facing node structure - supports both system and custom schema nodes
864
922
  */
@@ -1003,6 +1061,49 @@ export interface MemoryUpdateParams {
1003
1061
  */
1004
1062
  context?: Array<ContextItem> | null;
1005
1063
 
1064
+ /**
1065
+ * Graph generation configuration
1066
+ */
1067
+ graph_generation?: GraphGeneration | null;
1068
+
1069
+ /**
1070
+ * Shorthand DSL for node/edge constraints. Expands to
1071
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
1072
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
1073
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
1074
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
1075
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
1076
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
1077
+ * '$this', '$previous', '$context:N' Example:
1078
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
1079
+ */
1080
+ link_to?: string | Array<string> | { [key: string]: unknown } | null;
1081
+
1082
+ /**
1083
+ * Unified memory processing policy.
1084
+ *
1085
+ * This is the SINGLE source of truth for how a memory should be processed,
1086
+ * combining graph generation control AND OMO (Open Memory Object) safety
1087
+ * standards.
1088
+ *
1089
+ * **Graph Generation Modes:**
1090
+ *
1091
+ * - auto: LLM extracts entities freely (default)
1092
+ * - manual: Developer provides exact nodes (no LLM extraction)
1093
+ *
1094
+ * **OMO Safety Standards:**
1095
+ *
1096
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
1097
+ * - risk: Safety assessment (none, sensitive, flagged)
1098
+ * - acl: Access control list for read/write permissions
1099
+ *
1100
+ * **Schema Integration:**
1101
+ *
1102
+ * - schema_id: Reference a schema that may have its own default memory_policy
1103
+ * - Schema-level policies are merged with request-level (request takes precedence)
1104
+ */
1105
+ memory_policy?: Shared.MemoryPolicy | null;
1106
+
1006
1107
  /**
1007
1108
  * Metadata for memory request
1008
1109
  */
@@ -1044,22 +1145,80 @@ export interface MemoryAddParams {
1044
1145
  */
1045
1146
  content: string;
1046
1147
 
1148
+ /**
1149
+ * Query param: If True, applies holographic neural transforms and stores in
1150
+ * holographic collection
1151
+ */
1152
+ enable_holographic?: boolean;
1153
+
1154
+ /**
1155
+ * Query param: Response format. Use 'omo' for Open Memory Object standard format
1156
+ * (portable across platforms).
1157
+ */
1158
+ format?: string | null;
1159
+
1047
1160
  /**
1048
1161
  * Query param: If True, skips adding background tasks for processing
1049
1162
  */
1050
1163
  skip_background_processing?: boolean;
1051
1164
 
1052
1165
  /**
1053
- * Body param: Context can be conversation history or any relevant context for a
1054
- * memory item
1166
+ * Body param: Conversation history context for this memory. Use for providing
1167
+ * message history when adding a memory. Format: [{role: 'user'|'assistant',
1168
+ * content: '...'}]
1055
1169
  */
1056
1170
  context?: Array<ContextItem> | null;
1057
1171
 
1172
+ /**
1173
+ * Body param: Your application's user identifier. This is the primary way to
1174
+ * identify users. Use this for your app's user IDs (e.g., 'user_alice_123', UUID,
1175
+ * email). Papr will automatically resolve or create internal users as needed.
1176
+ */
1177
+ external_user_id?: string | null;
1178
+
1058
1179
  /**
1059
1180
  * Body param: Graph generation configuration
1060
1181
  */
1061
1182
  graph_generation?: GraphGeneration | null;
1062
1183
 
1184
+ /**
1185
+ * Body param: Shorthand DSL for node/edge constraints. Expands to
1186
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
1187
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
1188
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
1189
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
1190
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
1191
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
1192
+ * '$this', '$previous', '$context:N' Example:
1193
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
1194
+ */
1195
+ link_to?: string | Array<string> | { [key: string]: unknown } | null;
1196
+
1197
+ /**
1198
+ * Body param: Unified memory processing policy.
1199
+ *
1200
+ * This is the SINGLE source of truth for how a memory should be processed,
1201
+ * combining graph generation control AND OMO (Open Memory Object) safety
1202
+ * standards.
1203
+ *
1204
+ * **Graph Generation Modes:**
1205
+ *
1206
+ * - auto: LLM extracts entities freely (default)
1207
+ * - manual: Developer provides exact nodes (no LLM extraction)
1208
+ *
1209
+ * **OMO Safety Standards:**
1210
+ *
1211
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
1212
+ * - risk: Safety assessment (none, sensitive, flagged)
1213
+ * - acl: Access control list for read/write permissions
1214
+ *
1215
+ * **Schema Integration:**
1216
+ *
1217
+ * - schema_id: Reference a schema that may have its own default memory_policy
1218
+ * - Schema-level policies are merged with request-level (request takes precedence)
1219
+ */
1220
+ memory_policy?: Shared.MemoryPolicy | null;
1221
+
1063
1222
  /**
1064
1223
  * Body param: Metadata for memory request
1065
1224
  */
@@ -1078,7 +1237,10 @@ export interface MemoryAddParams {
1078
1237
  organization_id?: string | null;
1079
1238
 
1080
1239
  /**
1081
- * Body param: Array of relationships that we can use in Graph DB (neo4J)
1240
+ * @deprecated Body param: DEPRECATED: Use 'memory_policy' instead. Migration
1241
+ * options: 1. Specific memory: relationships=[{source: '$this', target: 'mem_123',
1242
+ * type: 'FOLLOWS'}] 2. Previous memory: link_to_previous_memory=True 3. Related
1243
+ * memories: link_to_related_memories=3
1082
1244
  */
1083
1245
  relationships_json?: Array<RelationshipItem> | null;
1084
1246
 
@@ -1086,6 +1248,12 @@ export interface MemoryAddParams {
1086
1248
  * Body param: Memory item type; defaults to 'text' if omitted
1087
1249
  */
1088
1250
  type?: MemoryType;
1251
+
1252
+ /**
1253
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1254
+ * Papr Parse user ID. Most developers should not use this field directly.
1255
+ */
1256
+ user_id?: string | null;
1089
1257
  }
1090
1258
 
1091
1259
  export interface MemoryAddBatchParams {
@@ -1105,8 +1273,9 @@ export interface MemoryAddBatchParams {
1105
1273
  batch_size?: number | null;
1106
1274
 
1107
1275
  /**
1108
- * Body param: External user ID for all memories in the batch. If provided and
1109
- * user_id is not, will be resolved to internal user ID.
1276
+ * Body param: Your application's user identifier for all memories in the batch.
1277
+ * This is the primary way to identify users. Papr will automatically resolve or
1278
+ * create internal users as needed.
1110
1279
  */
1111
1280
  external_user_id?: string | null;
1112
1281
 
@@ -1115,6 +1284,44 @@ export interface MemoryAddBatchParams {
1115
1284
  */
1116
1285
  graph_generation?: GraphGeneration | null;
1117
1286
 
1287
+ /**
1288
+ * Body param: Shorthand DSL for node/edge constraints. Expands to
1289
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
1290
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
1291
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
1292
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
1293
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
1294
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
1295
+ * '$this', '$previous', '$context:N' Example:
1296
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
1297
+ */
1298
+ link_to?: string | Array<string> | { [key: string]: unknown } | null;
1299
+
1300
+ /**
1301
+ * Body param: Unified memory processing policy.
1302
+ *
1303
+ * This is the SINGLE source of truth for how a memory should be processed,
1304
+ * combining graph generation control AND OMO (Open Memory Object) safety
1305
+ * standards.
1306
+ *
1307
+ * **Graph Generation Modes:**
1308
+ *
1309
+ * - auto: LLM extracts entities freely (default)
1310
+ * - manual: Developer provides exact nodes (no LLM extraction)
1311
+ *
1312
+ * **OMO Safety Standards:**
1313
+ *
1314
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
1315
+ * - risk: Safety assessment (none, sensitive, flagged)
1316
+ * - acl: Access control list for read/write permissions
1317
+ *
1318
+ * **Schema Integration:**
1319
+ *
1320
+ * - schema_id: Reference a schema that may have its own default memory_policy
1321
+ * - Schema-level policies are merged with request-level (request takes precedence)
1322
+ */
1323
+ memory_policy?: Shared.MemoryPolicy | null;
1324
+
1118
1325
  /**
1119
1326
  * Body param: Optional namespace ID for multi-tenant batch memory scoping. When
1120
1327
  * provided, all memories in the batch are associated with this namespace.
@@ -1128,8 +1335,8 @@ export interface MemoryAddBatchParams {
1128
1335
  organization_id?: string | null;
1129
1336
 
1130
1337
  /**
1131
- * Body param: Internal user ID for all memories in the batch. If not provided,
1132
- * developer's user ID will be used.
1338
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1339
+ * Papr Parse user ID.
1133
1340
  */
1134
1341
  user_id?: string | null;
1135
1342
 
@@ -1166,6 +1373,26 @@ export interface MemoryDeleteAllParams {
1166
1373
  user_id?: string | null;
1167
1374
  }
1168
1375
 
1376
+ export interface MemoryGetParams {
1377
+ /**
1378
+ * If true, return 404 if the memory has risk='flagged'. Filters out flagged
1379
+ * content.
1380
+ */
1381
+ exclude_flagged?: boolean;
1382
+
1383
+ /**
1384
+ * Maximum risk level allowed. Values: 'none', 'sensitive', 'flagged'. If memory
1385
+ * exceeds this, return 404.
1386
+ */
1387
+ max_risk?: string | null;
1388
+
1389
+ /**
1390
+ * If true, return 404 if the memory has consent='none'. Ensures only consented
1391
+ * memories are returned.
1392
+ */
1393
+ require_consent?: boolean;
1394
+ }
1395
+
1169
1396
  export interface MemorySearchParams {
1170
1397
  /**
1171
1398
  * Body param: Detailed search query describing what you're looking for. For best
@@ -1193,6 +1420,12 @@ export interface MemorySearchParams {
1193
1420
  */
1194
1421
  max_nodes?: number;
1195
1422
 
1423
+ /**
1424
+ * Query param: Response format: 'json' (default) or 'toon' (Token-Oriented Object
1425
+ * Notation for 30-60% token reduction in LLM contexts)
1426
+ */
1427
+ response_format?: 'json' | 'toon';
1428
+
1196
1429
  /**
1197
1430
  * Body param: HIGHLY RECOMMENDED: Enable agentic graph search for intelligent,
1198
1431
  * context-aware results. When enabled, the system can understand ambiguous
@@ -1207,12 +1440,22 @@ export interface MemorySearchParams {
1207
1440
  enable_agentic_graph?: boolean;
1208
1441
 
1209
1442
  /**
1210
- * Body param: Optional external user ID to filter search results by a specific
1211
- * external user. If both user_id and external_user_id are provided, user_id takes
1212
- * precedence.
1443
+ * Body param: Your application's user identifier to filter search results. This is
1444
+ * the primary way to identify users. Use this for your app's user IDs (e.g.,
1445
+ * 'user_alice_123', UUID, email).
1213
1446
  */
1214
1447
  external_user_id?: string | null;
1215
1448
 
1449
+ /**
1450
+ * Body param: Configuration for holographic neural embedding transforms and H-COND
1451
+ * scoring.
1452
+ *
1453
+ * Neural holographic embeddings use 13 brain-inspired frequency bands to encode
1454
+ * hierarchical semantic metadata alongside the base embedding. H-COND (Holographic
1455
+ * CONDitional) scoring uses phase alignment for improved relevance ranking.
1456
+ */
1457
+ holographic_config?: MemorySearchParams.HolographicConfig | null;
1458
+
1216
1459
  /**
1217
1460
  * Body param: Metadata for memory request
1218
1461
  */
@@ -1224,6 +1467,14 @@ export interface MemorySearchParams {
1224
1467
  */
1225
1468
  namespace_id?: string | null;
1226
1469
 
1470
+ /**
1471
+ * Body param: Filter for Open Memory Object (OMO) safety standards in
1472
+ * search/retrieval.
1473
+ *
1474
+ * Use this to filter search results by consent level and/or risk level.
1475
+ */
1476
+ omo_filter?: MemorySearchParams.OmoFilter | null;
1477
+
1227
1478
  /**
1228
1479
  * Body param: Optional organization ID for multi-tenant search scoping. When
1229
1480
  * provided, search is scoped to memories within this organization.
@@ -1231,17 +1482,37 @@ export interface MemorySearchParams {
1231
1482
  organization_id?: string | null;
1232
1483
 
1233
1484
  /**
1234
- * Body param: Whether to enable additional ranking of search results. Default is
1235
- * false because results are already ranked when using an LLM for search
1236
- * (recommended approach). Only enable this if you're not using an LLM in your
1237
- * search pipeline and need additional result ranking.
1485
+ * @deprecated Body param: DEPRECATED: Use 'reranking_config' instead. Whether to
1486
+ * enable additional ranking of search results. Default is false because results
1487
+ * are already ranked when using an LLM for search (recommended approach). Only
1488
+ * enable this if you're not using an LLM in your search pipeline and need
1489
+ * additional result ranking. Migration: Replace 'rank_results: true' with
1490
+ * 'reranking_config: {reranking_enabled: true, reranking_provider: "cohere",
1491
+ * reranking_model: "rerank-v3.5"}'
1238
1492
  */
1239
1493
  rank_results?: boolean;
1240
1494
 
1241
1495
  /**
1242
- * Body param: Optional internal user ID to filter search results by a specific
1243
- * user. If not provided, results are not filtered by user. If both user_id and
1244
- * external_user_id are provided, user_id takes precedence.
1496
+ * Body param: Configuration for reranking memory search results
1497
+ */
1498
+ reranking_config?: MemorySearchParams.RerankingConfig | null;
1499
+
1500
+ /**
1501
+ * Body param: Optional user-defined schema ID to use for this search. If provided,
1502
+ * this schema (plus system schema) will be used for query generation. If not
1503
+ * provided, system will automatically select relevant schema based on query
1504
+ * content.
1505
+ */
1506
+ schema_id?: string | null;
1507
+
1508
+ /**
1509
+ * Body param: Complete search override specification provided by developer
1510
+ */
1511
+ search_override?: MemorySearchParams.SearchOverride | null;
1512
+
1513
+ /**
1514
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1515
+ * Papr Parse user ID. Most developers should not use this field directly.
1245
1516
  */
1246
1517
  user_id?: string | null;
1247
1518
 
@@ -1251,6 +1522,186 @@ export interface MemorySearchParams {
1251
1522
  'Accept-Encoding'?: string;
1252
1523
  }
1253
1524
 
1525
+ export namespace MemorySearchParams {
1526
+ /**
1527
+ * Configuration for holographic neural embedding transforms and H-COND scoring.
1528
+ *
1529
+ * Neural holographic embeddings use 13 brain-inspired frequency bands to encode
1530
+ * hierarchical semantic metadata alongside the base embedding. H-COND (Holographic
1531
+ * CONDitional) scoring uses phase alignment for improved relevance ranking.
1532
+ */
1533
+ export interface HolographicConfig {
1534
+ /**
1535
+ * Whether to enable holographic embedding transforms
1536
+ */
1537
+ enabled?: boolean;
1538
+
1539
+ /**
1540
+ * Maximum boost to add for high alignment (0.0-0.5)
1541
+ */
1542
+ hcond_boost_factor?: number;
1543
+
1544
+ /**
1545
+ * Phase alignment threshold above which to apply boost (0.0-1.0)
1546
+ */
1547
+ hcond_boost_threshold?: number;
1548
+
1549
+ /**
1550
+ * Maximum penalty for low alignment (0.0-0.5)
1551
+ */
1552
+ hcond_penalty_factor?: number;
1553
+
1554
+ /**
1555
+ * Search mode: 'disabled' (off), 'integrated' (search transformed embeddings),
1556
+ * 'post_search' (fetch then rerank with H-COND)
1557
+ */
1558
+ search_mode?: 'disabled' | 'integrated' | 'post_search';
1559
+ }
1560
+
1561
+ /**
1562
+ * Filter for Open Memory Object (OMO) safety standards in search/retrieval.
1563
+ *
1564
+ * Use this to filter search results by consent level and/or risk level.
1565
+ */
1566
+ export interface OmoFilter {
1567
+ /**
1568
+ * Explicitly exclude memories with these consent levels. Example:
1569
+ * exclude_consent=['none'] filters out all memories without consent.
1570
+ */
1571
+ exclude_consent?: Array<'explicit' | 'implicit' | 'terms' | 'none'> | null;
1572
+
1573
+ /**
1574
+ * If true, exclude all flagged content (risk == 'flagged'). Shorthand for
1575
+ * exclude_risk=['flagged'].
1576
+ */
1577
+ exclude_flagged?: boolean;
1578
+
1579
+ /**
1580
+ * Explicitly exclude memories with these risk levels. Example:
1581
+ * exclude_risk=['flagged'] filters out all flagged content.
1582
+ */
1583
+ exclude_risk?: Array<'none' | 'sensitive' | 'flagged'> | null;
1584
+
1585
+ /**
1586
+ * Post-ingest safety assessment of memory content.
1587
+ *
1588
+ * Aligned with Open Memory Object (OMO) standard.
1589
+ */
1590
+ max_risk?: 'none' | 'sensitive' | 'flagged' | null;
1591
+
1592
+ /**
1593
+ * How the data owner allowed this memory to be stored/used.
1594
+ *
1595
+ * Aligned with Open Memory Object (OMO) standard.
1596
+ */
1597
+ min_consent?: 'explicit' | 'implicit' | 'terms' | 'none' | null;
1598
+
1599
+ /**
1600
+ * If true, only return memories with explicit consent (consent != 'none').
1601
+ * Shorthand for exclude_consent=['none'].
1602
+ */
1603
+ require_consent?: boolean;
1604
+ }
1605
+
1606
+ /**
1607
+ * Configuration for reranking memory search results
1608
+ */
1609
+ export interface RerankingConfig {
1610
+ /**
1611
+ * Whether to enable reranking of search results
1612
+ */
1613
+ reranking_enabled?: boolean;
1614
+
1615
+ /**
1616
+ * Model to use for reranking. OpenAI (LLM): 'gpt-5-nano' (fast reasoning,
1617
+ * default), 'gpt-5-mini' (better quality reasoning). Cohere (cross-encoder):
1618
+ * 'rerank-v3.5' (latest), 'rerank-english-v3.0', 'rerank-multilingual-v3.0'
1619
+ */
1620
+ reranking_model?: string;
1621
+
1622
+ /**
1623
+ * Reranking provider: 'openai' (better quality, slower) or 'cohere' (faster,
1624
+ * optimized for reranking)
1625
+ */
1626
+ reranking_provider?: 'openai' | 'cohere';
1627
+ }
1628
+
1629
+ /**
1630
+ * Complete search override specification provided by developer
1631
+ */
1632
+ export interface SearchOverride {
1633
+ /**
1634
+ * Graph pattern to search for (source)-[relationship]->(target)
1635
+ */
1636
+ pattern: SearchOverride.Pattern;
1637
+
1638
+ /**
1639
+ * Property filters to apply to the search pattern
1640
+ */
1641
+ filters?: Array<SearchOverride.Filter>;
1642
+
1643
+ /**
1644
+ * Specific properties to return. If not specified, returns all properties.
1645
+ */
1646
+ return_properties?: Array<string> | null;
1647
+ }
1648
+
1649
+ export namespace SearchOverride {
1650
+ /**
1651
+ * Graph pattern to search for (source)-[relationship]->(target)
1652
+ */
1653
+ export interface Pattern {
1654
+ /**
1655
+ * Relationship type (e.g., 'ASSOCIATED_WITH', 'WORKS_FOR'). Must match schema
1656
+ * relationship types.
1657
+ */
1658
+ relationship_type: string;
1659
+
1660
+ /**
1661
+ * Source node label (e.g., 'Memory', 'Person', 'Company'). Must match schema node
1662
+ * types.
1663
+ */
1664
+ source_label: string;
1665
+
1666
+ /**
1667
+ * Target node label (e.g., 'Person', 'Company', 'Project'). Must match schema node
1668
+ * types.
1669
+ */
1670
+ target_label: string;
1671
+
1672
+ /**
1673
+ * Relationship direction: '->' (outgoing), '<-' (incoming), or '-' (bidirectional)
1674
+ */
1675
+ direction?: string;
1676
+ }
1677
+
1678
+ /**
1679
+ * Property filters for search override
1680
+ */
1681
+ export interface Filter {
1682
+ /**
1683
+ * Node type to filter (e.g., 'Person', 'Memory', 'Company')
1684
+ */
1685
+ node_type: string;
1686
+
1687
+ /**
1688
+ * Filter operator: 'CONTAINS', 'EQUALS', 'STARTS_WITH', 'IN'
1689
+ */
1690
+ operator: string;
1691
+
1692
+ /**
1693
+ * Property name to filter on (e.g., 'name', 'content', 'role')
1694
+ */
1695
+ property_name: string;
1696
+
1697
+ /**
1698
+ * Filter value(s). Use list for 'IN' operator.
1699
+ */
1700
+ value: string | Array<string> | number | boolean;
1701
+ }
1702
+ }
1703
+ }
1704
+
1254
1705
  export declare namespace Memory {
1255
1706
  export {
1256
1707
  type AddMemory as AddMemory,
@@ -1272,6 +1723,7 @@ export declare namespace Memory {
1272
1723
  type MemoryAddParams as MemoryAddParams,
1273
1724
  type MemoryAddBatchParams as MemoryAddBatchParams,
1274
1725
  type MemoryDeleteAllParams as MemoryDeleteAllParams,
1726
+ type MemoryGetParams as MemoryGetParams,
1275
1727
  type MemorySearchParams as MemorySearchParams,
1276
1728
  };
1277
1729
  }