@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
@@ -151,7 +151,7 @@ export declare class Memory extends APIResource {
151
151
  * const searchResponse = await client.memory.get('memory_id');
152
152
  * ```
153
153
  */
154
- get(memoryID: string, options?: RequestOptions): APIPromise<SearchResponse>;
154
+ get(memoryID: string, query?: MemoryGetParams | null | undefined, options?: RequestOptions): APIPromise<SearchResponse>;
155
155
  /**
156
156
  * Search through memories with authentication required.
157
157
  *
@@ -161,6 +161,16 @@ export declare class Memory extends APIResource {
161
161
  * - API Key in `X-API-Key` header
162
162
  * - Session token in `X-Session-Token` header
163
163
  *
164
+ * **Response Format Options**:
165
+ * Choose between standard JSON or TOON (Token-Oriented Object Notation) format:
166
+ * - **JSON (default)**: Standard JSON response format
167
+ * - **TOON**: Optimized format achieving 30-60% token reduction for LLM contexts
168
+ * - Use `response_format=toon` query parameter
169
+ * - Returns `text/plain` with TOON-formatted content
170
+ * - Ideal for LLM integrations to reduce API costs and latency
171
+ * - Maintains semantic clarity while minimizing token usage
172
+ * - Example: `/v1/memory/search?response_format=toon`
173
+ *
164
174
  * **Custom Schema Support**:
165
175
  * This endpoint supports both system-defined and custom user-defined node types:
166
176
  * - **System nodes**: Memory, Person, Company, Project, Task, Insight, Meeting, Opportunity, Code
@@ -185,6 +195,7 @@ export declare class Memory extends APIResource {
185
195
  * - Set `enable_agentic_graph: true` for intelligent, context-aware search that can understand ambiguous references
186
196
  * - Use `max_memories: 15-20` for comprehensive memory coverage
187
197
  * - Use `max_nodes: 10-15` for comprehensive graph entity relationships
198
+ * - Use `response_format: toon` when integrating with LLMs to reduce token costs by 30-60%
188
199
  *
189
200
  * **Agentic Graph Benefits:**
190
201
  * When enabled, the system can understand vague references by first identifying specific entities from your memory graph, then performing targeted searches. For example:
@@ -222,13 +233,58 @@ export interface AddMemory {
222
233
  */
223
234
  content: string;
224
235
  /**
225
- * Context can be conversation history or any relevant context for a memory item
236
+ * Conversation history context for this memory. Use for providing message history
237
+ * when adding a memory. Format: [{role: 'user'|'assistant', content: '...'}]
226
238
  */
227
239
  context?: Array<ContextItem> | null;
228
240
  /**
229
- * Graph generation configuration
241
+ * Your application's user identifier. This is the primary way to identify users.
242
+ * Use this for your app's user IDs (e.g., 'user_alice_123', UUID, email). Papr
243
+ * will automatically resolve or create internal users as needed.
244
+ */
245
+ external_user_id?: string | null;
246
+ /**
247
+ * @deprecated Graph generation configuration
230
248
  */
231
249
  graph_generation?: GraphGeneration | null;
250
+ /**
251
+ * Shorthand DSL for node/edge constraints. Expands to
252
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
253
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
254
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
255
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
256
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
257
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
258
+ * '$this', '$previous', '$context:N' Example:
259
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
260
+ */
261
+ link_to?: string | Array<string> | {
262
+ [key: string]: unknown;
263
+ } | null;
264
+ /**
265
+ * Unified memory processing policy.
266
+ *
267
+ * This is the SINGLE source of truth for how a memory should be processed,
268
+ * combining graph generation control AND OMO (Open Memory Object) safety
269
+ * standards.
270
+ *
271
+ * **Graph Generation Modes:**
272
+ *
273
+ * - auto: LLM extracts entities freely (default)
274
+ * - manual: Developer provides exact nodes (no LLM extraction)
275
+ *
276
+ * **OMO Safety Standards:**
277
+ *
278
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
279
+ * - risk: Safety assessment (none, sensitive, flagged)
280
+ * - acl: Access control list for read/write permissions
281
+ *
282
+ * **Schema Integration:**
283
+ *
284
+ * - schema_id: Reference a schema that may have its own default memory_policy
285
+ * - Schema-level policies are merged with request-level (request takes precedence)
286
+ */
287
+ memory_policy?: Shared.MemoryPolicy | null;
232
288
  /**
233
289
  * Metadata for memory request
234
290
  */
@@ -244,13 +300,21 @@ export interface AddMemory {
244
300
  */
245
301
  organization_id?: string | null;
246
302
  /**
247
- * Array of relationships that we can use in Graph DB (neo4J)
303
+ * @deprecated DEPRECATED: Use 'memory_policy' instead. Migration options: 1.
304
+ * Specific memory: relationships=[{source: '$this', target: 'mem_123', type:
305
+ * 'FOLLOWS'}] 2. Previous memory: link_to_previous_memory=True 3. Related
306
+ * memories: link_to_related_memories=3
248
307
  */
249
308
  relationships_json?: Array<RelationshipItem> | null;
250
309
  /**
251
310
  * Memory item type; defaults to 'text' if omitted
252
311
  */
253
312
  type?: MemoryType;
313
+ /**
314
+ * @deprecated DEPRECATED: Use 'external_user_id' instead. Internal Papr Parse user
315
+ * ID. Most developers should not use this field directly.
316
+ */
317
+ user_id?: string | null;
254
318
  }
255
319
  /**
256
320
  * Unified response model for add_memory API endpoint (success or error).
@@ -289,10 +353,6 @@ export interface AutoGraphGeneration {
289
353
  * Force AI to use this specific schema instead of auto-selecting
290
354
  */
291
355
  schema_id?: string | null;
292
- /**
293
- * Limit AI to system + one user schema for consistency
294
- */
295
- simple_schema_mode?: boolean;
296
356
  }
297
357
  export declare namespace AutoGraphGeneration {
298
358
  /**
@@ -486,12 +546,24 @@ export declare namespace ManualGraphGeneration {
486
546
  * Metadata for memory request
487
547
  */
488
548
  export interface MemoryMetadata {
549
+ /**
550
+ * @deprecated DEPRECATED: Use 'memory_policy.acl' at request level instead.
551
+ * Format: {'read': [...], 'write': [...]}.
552
+ */
553
+ acl?: {
554
+ [key: string]: Array<string>;
555
+ } | null;
489
556
  assistantMessage?: string | null;
490
557
  /**
491
558
  * Memory category based on role. For users: preference, task, goal, fact, context.
492
559
  * For assistants: skills, learning, task, goal, fact, context.
493
560
  */
494
561
  category?: 'preference' | 'task' | 'goal' | 'fact' | 'context' | 'skills' | 'learning' | null;
562
+ /**
563
+ * @deprecated DEPRECATED: Use 'memory_policy.consent' at request level instead.
564
+ * Values: 'explicit', 'implicit' (default), 'terms', 'none'.
565
+ */
566
+ consent?: string | null;
495
567
  conversationId?: string | null;
496
568
  /**
497
569
  * ISO datetime when the memory was created
@@ -506,27 +578,80 @@ export interface MemoryMetadata {
506
578
  } | null;
507
579
  'emoji tags'?: Array<string> | null;
508
580
  'emotion tags'?: Array<string> | null;
581
+ /**
582
+ * @deprecated DEPRECATED: Use 'external_user_id' at request level instead. This
583
+ * field will be removed in v2.
584
+ */
509
585
  external_user_id?: string | null;
586
+ /**
587
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
588
+ * instead.
589
+ */
510
590
  external_user_read_access?: Array<string> | null;
591
+ /**
592
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
593
+ * instead.
594
+ */
511
595
  external_user_write_access?: Array<string> | null;
512
596
  goalClassificationScores?: Array<number> | null;
513
597
  /**
514
598
  * Hierarchical structures to enable navigation from broad topics to specific ones
515
599
  */
516
- hierarchical_structures?: string | null;
600
+ hierarchical_structures?: string | Array<unknown> | null;
517
601
  location?: string | null;
602
+ /**
603
+ * @deprecated DEPRECATED: Use 'namespace_id' at request level instead. This field
604
+ * will be removed in v2.
605
+ */
518
606
  namespace_id?: string | null;
607
+ /**
608
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
609
+ * instead.
610
+ */
611
+ namespace_read_access?: Array<string> | null;
612
+ /**
613
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
614
+ * instead.
615
+ */
616
+ namespace_write_access?: Array<string> | null;
617
+ /**
618
+ * @deprecated DEPRECATED: Use 'organization_id' at request level instead. This
619
+ * field will be removed in v2.
620
+ */
519
621
  organization_id?: string | null;
622
+ /**
623
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
624
+ * instead.
625
+ */
626
+ organization_read_access?: Array<string> | null;
627
+ /**
628
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
629
+ * instead.
630
+ */
631
+ organization_write_access?: Array<string> | null;
520
632
  pageId?: string | null;
521
633
  post?: string | null;
522
634
  relatedGoals?: Array<string> | null;
523
635
  relatedSteps?: Array<string> | null;
524
636
  relatedUseCases?: Array<string> | null;
637
+ /**
638
+ * @deprecated DEPRECATED: Use 'memory_policy.risk' at request level instead.
639
+ * Values: 'none' (default), 'sensitive', 'flagged'.
640
+ */
641
+ risk?: string | null;
525
642
  /**
526
643
  * Role of the message sender
527
644
  */
528
645
  role?: 'user' | 'assistant' | null;
646
+ /**
647
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
648
+ * instead.
649
+ */
529
650
  role_read_access?: Array<string> | null;
651
+ /**
652
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
653
+ * instead.
654
+ */
530
655
  role_write_access?: Array<string> | null;
531
656
  sessionId?: string | null;
532
657
  sourceType?: string | null;
@@ -538,12 +663,32 @@ export interface MemoryMetadata {
538
663
  */
539
664
  upload_id?: string | null;
540
665
  useCaseClassificationScores?: Array<number> | null;
666
+ /**
667
+ * @deprecated DEPRECATED: Use 'external_user_id' at request level instead. This
668
+ * field will be removed in v2.
669
+ */
541
670
  user_id?: string | null;
671
+ /**
672
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
673
+ * instead.
674
+ */
542
675
  user_read_access?: Array<string> | null;
676
+ /**
677
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
678
+ * instead.
679
+ */
543
680
  user_write_access?: Array<string> | null;
544
681
  userMessage?: string | null;
545
682
  workspace_id?: string | null;
683
+ /**
684
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
685
+ * instead.
686
+ */
546
687
  workspace_read_access?: Array<string> | null;
688
+ /**
689
+ * INTERNAL: Auto-populated for vector store filtering. Use memory_policy.acl
690
+ * instead.
691
+ */
547
692
  workspace_write_access?: Array<string> | null;
548
693
  [k: string]: unknown;
549
694
  }
@@ -601,7 +746,7 @@ export declare namespace SearchResponse {
601
746
  * Return type for SearchResult
602
747
  */
603
748
  interface Data {
604
- memories: Array<Data.Memory>;
749
+ memories: Array<Shared.Memory>;
605
750
  nodes: Array<Data.Node>;
606
751
  /**
607
752
  * List of UserGraphSchema IDs used in this response. Use GET /v1/schemas/{id} to
@@ -610,73 +755,6 @@ export declare namespace SearchResponse {
610
755
  schemas_used?: Array<string> | null;
611
756
  }
612
757
  namespace Data {
613
- /**
614
- * A memory item in the knowledge base
615
- */
616
- interface Memory {
617
- id: string;
618
- acl: {
619
- [key: string]: {
620
- [key: string]: boolean;
621
- };
622
- };
623
- content: string;
624
- type: string;
625
- user_id: string;
626
- /**
627
- * Memory category based on role
628
- */
629
- category?: string | null;
630
- context?: Array<MemoryAPI.ContextItem> | null;
631
- conversation_id?: string;
632
- created_at?: string | null;
633
- current_step?: string | null;
634
- customMetadata?: {
635
- [key: string]: unknown;
636
- } | null;
637
- external_user_id?: string | null;
638
- external_user_read_access?: Array<string> | null;
639
- external_user_write_access?: Array<string> | null;
640
- file_url?: string | null;
641
- filename?: string | null;
642
- hierarchical_structures?: string;
643
- location?: string | null;
644
- metadata?: string | {
645
- [key: string]: unknown;
646
- } | null;
647
- /**
648
- * Namespace ID this memory belongs to
649
- */
650
- namespace_id?: string | null;
651
- /**
652
- * Organization ID that owns this memory
653
- */
654
- organization_id?: string | null;
655
- page?: string | null;
656
- page_number?: number | null;
657
- /**
658
- * Role that generated this memory (user or assistant)
659
- */
660
- role?: string | null;
661
- role_read_access?: Array<string> | null;
662
- role_write_access?: Array<string> | null;
663
- source_document_id?: string | null;
664
- source_message_id?: string | null;
665
- source_type?: string;
666
- source_url?: string;
667
- steps?: Array<string>;
668
- tags?: Array<string>;
669
- title?: string | null;
670
- topics?: Array<string>;
671
- total_pages?: number | null;
672
- updated_at?: string | null;
673
- user_read_access?: Array<string> | null;
674
- user_write_access?: Array<string> | null;
675
- workspace_id?: string | null;
676
- workspace_read_access?: Array<string> | null;
677
- workspace_write_access?: Array<string> | null;
678
- [k: string]: unknown;
679
- }
680
758
  /**
681
759
  * Public-facing node structure - supports both system and custom schema nodes
682
760
  */
@@ -790,6 +868,48 @@ export interface MemoryUpdateParams {
790
868
  * Updated context for the memory item
791
869
  */
792
870
  context?: Array<ContextItem> | null;
871
+ /**
872
+ * Graph generation configuration
873
+ */
874
+ graph_generation?: GraphGeneration | null;
875
+ /**
876
+ * Shorthand DSL for node/edge constraints. Expands to
877
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
878
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
879
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
880
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
881
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
882
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
883
+ * '$this', '$previous', '$context:N' Example:
884
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
885
+ */
886
+ link_to?: string | Array<string> | {
887
+ [key: string]: unknown;
888
+ } | null;
889
+ /**
890
+ * Unified memory processing policy.
891
+ *
892
+ * This is the SINGLE source of truth for how a memory should be processed,
893
+ * combining graph generation control AND OMO (Open Memory Object) safety
894
+ * standards.
895
+ *
896
+ * **Graph Generation Modes:**
897
+ *
898
+ * - auto: LLM extracts entities freely (default)
899
+ * - manual: Developer provides exact nodes (no LLM extraction)
900
+ *
901
+ * **OMO Safety Standards:**
902
+ *
903
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
904
+ * - risk: Safety assessment (none, sensitive, flagged)
905
+ * - acl: Access control list for read/write permissions
906
+ *
907
+ * **Schema Integration:**
908
+ *
909
+ * - schema_id: Reference a schema that may have its own default memory_policy
910
+ * - Schema-level policies are merged with request-level (request takes precedence)
911
+ */
912
+ memory_policy?: Shared.MemoryPolicy | null;
793
913
  /**
794
914
  * Metadata for memory request
795
915
  */
@@ -824,19 +944,74 @@ export interface MemoryAddParams {
824
944
  * Body param: The content of the memory item you want to add to memory
825
945
  */
826
946
  content: string;
947
+ /**
948
+ * Query param: If True, applies holographic neural transforms and stores in
949
+ * holographic collection
950
+ */
951
+ enable_holographic?: boolean;
952
+ /**
953
+ * Query param: Response format. Use 'omo' for Open Memory Object standard format
954
+ * (portable across platforms).
955
+ */
956
+ format?: string | null;
827
957
  /**
828
958
  * Query param: If True, skips adding background tasks for processing
829
959
  */
830
960
  skip_background_processing?: boolean;
831
961
  /**
832
- * Body param: Context can be conversation history or any relevant context for a
833
- * memory item
962
+ * Body param: Conversation history context for this memory. Use for providing
963
+ * message history when adding a memory. Format: [{role: 'user'|'assistant',
964
+ * content: '...'}]
834
965
  */
835
966
  context?: Array<ContextItem> | null;
967
+ /**
968
+ * Body param: Your application's user identifier. This is the primary way to
969
+ * identify users. Use this for your app's user IDs (e.g., 'user_alice_123', UUID,
970
+ * email). Papr will automatically resolve or create internal users as needed.
971
+ */
972
+ external_user_id?: string | null;
836
973
  /**
837
974
  * Body param: Graph generation configuration
838
975
  */
839
976
  graph_generation?: GraphGeneration | null;
977
+ /**
978
+ * Body param: Shorthand DSL for node/edge constraints. Expands to
979
+ * memory_policy.node_constraints and edge_constraints. Formats: - String:
980
+ * 'Task:title' (semantic match on Task.title) - List: ['Task:title',
981
+ * 'Person:email'] (multiple constraints) - Dict: {'Task:title': {'set': {...}}}
982
+ * (with options) Syntax: - Node: 'Type:property', 'Type:prop=value' (exact),
983
+ * 'Type:prop~value' (semantic) - Edge: 'Source->EDGE->Target:property' (arrow
984
+ * syntax) - Via: 'Type.via(EDGE->Target:prop)' (relationship traversal) - Special:
985
+ * '$this', '$previous', '$context:N' Example:
986
+ * 'SecurityBehavior->MITIGATES->TacticDef:name' with {'create': 'never'}
987
+ */
988
+ link_to?: string | Array<string> | {
989
+ [key: string]: unknown;
990
+ } | null;
991
+ /**
992
+ * Body param: Unified memory processing policy.
993
+ *
994
+ * This is the SINGLE source of truth for how a memory should be processed,
995
+ * combining graph generation control AND OMO (Open Memory Object) safety
996
+ * standards.
997
+ *
998
+ * **Graph Generation Modes:**
999
+ *
1000
+ * - auto: LLM extracts entities freely (default)
1001
+ * - manual: Developer provides exact nodes (no LLM extraction)
1002
+ *
1003
+ * **OMO Safety Standards:**
1004
+ *
1005
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
1006
+ * - risk: Safety assessment (none, sensitive, flagged)
1007
+ * - acl: Access control list for read/write permissions
1008
+ *
1009
+ * **Schema Integration:**
1010
+ *
1011
+ * - schema_id: Reference a schema that may have its own default memory_policy
1012
+ * - Schema-level policies are merged with request-level (request takes precedence)
1013
+ */
1014
+ memory_policy?: Shared.MemoryPolicy | null;
840
1015
  /**
841
1016
  * Body param: Metadata for memory request
842
1017
  */
@@ -852,13 +1027,21 @@ export interface MemoryAddParams {
852
1027
  */
853
1028
  organization_id?: string | null;
854
1029
  /**
855
- * Body param: Array of relationships that we can use in Graph DB (neo4J)
1030
+ * @deprecated Body param: DEPRECATED: Use 'memory_policy' instead. Migration
1031
+ * options: 1. Specific memory: relationships=[{source: '$this', target: 'mem_123',
1032
+ * type: 'FOLLOWS'}] 2. Previous memory: link_to_previous_memory=True 3. Related
1033
+ * memories: link_to_related_memories=3
856
1034
  */
857
1035
  relationships_json?: Array<RelationshipItem> | null;
858
1036
  /**
859
1037
  * Body param: Memory item type; defaults to 'text' if omitted
860
1038
  */
861
1039
  type?: MemoryType;
1040
+ /**
1041
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1042
+ * Papr Parse user ID. Most developers should not use this field directly.
1043
+ */
1044
+ user_id?: string | null;
862
1045
  }
863
1046
  export interface MemoryAddBatchParams {
864
1047
  /**
@@ -874,14 +1057,53 @@ export interface MemoryAddBatchParams {
874
1057
  */
875
1058
  batch_size?: number | null;
876
1059
  /**
877
- * Body param: External user ID for all memories in the batch. If provided and
878
- * user_id is not, will be resolved to internal user ID.
1060
+ * Body param: Your application's user identifier for all memories in the batch.
1061
+ * This is the primary way to identify users. Papr will automatically resolve or
1062
+ * create internal users as needed.
879
1063
  */
880
1064
  external_user_id?: string | null;
881
1065
  /**
882
1066
  * Body param: Graph generation configuration
883
1067
  */
884
1068
  graph_generation?: GraphGeneration | null;
1069
+ /**
1070
+ * Body param: 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> | {
1081
+ [key: string]: unknown;
1082
+ } | null;
1083
+ /**
1084
+ * Body param: Unified memory processing policy.
1085
+ *
1086
+ * This is the SINGLE source of truth for how a memory should be processed,
1087
+ * combining graph generation control AND OMO (Open Memory Object) safety
1088
+ * standards.
1089
+ *
1090
+ * **Graph Generation Modes:**
1091
+ *
1092
+ * - auto: LLM extracts entities freely (default)
1093
+ * - manual: Developer provides exact nodes (no LLM extraction)
1094
+ *
1095
+ * **OMO Safety Standards:**
1096
+ *
1097
+ * - consent: How data owner allowed storage (explicit, implicit, terms, none)
1098
+ * - risk: Safety assessment (none, sensitive, flagged)
1099
+ * - acl: Access control list for read/write permissions
1100
+ *
1101
+ * **Schema Integration:**
1102
+ *
1103
+ * - schema_id: Reference a schema that may have its own default memory_policy
1104
+ * - Schema-level policies are merged with request-level (request takes precedence)
1105
+ */
1106
+ memory_policy?: Shared.MemoryPolicy | null;
885
1107
  /**
886
1108
  * Body param: Optional namespace ID for multi-tenant batch memory scoping. When
887
1109
  * provided, all memories in the batch are associated with this namespace.
@@ -893,8 +1115,8 @@ export interface MemoryAddBatchParams {
893
1115
  */
894
1116
  organization_id?: string | null;
895
1117
  /**
896
- * Body param: Internal user ID for all memories in the batch. If not provided,
897
- * developer's user ID will be used.
1118
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1119
+ * Papr Parse user ID.
898
1120
  */
899
1121
  user_id?: string | null;
900
1122
  /**
@@ -924,6 +1146,23 @@ export interface MemoryDeleteAllParams {
924
1146
  */
925
1147
  user_id?: string | null;
926
1148
  }
1149
+ export interface MemoryGetParams {
1150
+ /**
1151
+ * If true, return 404 if the memory has risk='flagged'. Filters out flagged
1152
+ * content.
1153
+ */
1154
+ exclude_flagged?: boolean;
1155
+ /**
1156
+ * Maximum risk level allowed. Values: 'none', 'sensitive', 'flagged'. If memory
1157
+ * exceeds this, return 404.
1158
+ */
1159
+ max_risk?: string | null;
1160
+ /**
1161
+ * If true, return 404 if the memory has consent='none'. Ensures only consented
1162
+ * memories are returned.
1163
+ */
1164
+ require_consent?: boolean;
1165
+ }
927
1166
  export interface MemorySearchParams {
928
1167
  /**
929
1168
  * Body param: Detailed search query describing what you're looking for. For best
@@ -948,6 +1187,11 @@ export interface MemorySearchParams {
948
1187
  * entity relationships. Default is 15 for optimal coverage.
949
1188
  */
950
1189
  max_nodes?: number;
1190
+ /**
1191
+ * Query param: Response format: 'json' (default) or 'toon' (Token-Oriented Object
1192
+ * Notation for 30-60% token reduction in LLM contexts)
1193
+ */
1194
+ response_format?: 'json' | 'toon';
951
1195
  /**
952
1196
  * Body param: HIGHLY RECOMMENDED: Enable agentic graph search for intelligent,
953
1197
  * context-aware results. When enabled, the system can understand ambiguous
@@ -961,11 +1205,20 @@ export interface MemorySearchParams {
961
1205
  */
962
1206
  enable_agentic_graph?: boolean;
963
1207
  /**
964
- * Body param: Optional external user ID to filter search results by a specific
965
- * external user. If both user_id and external_user_id are provided, user_id takes
966
- * precedence.
1208
+ * Body param: Your application's user identifier to filter search results. This is
1209
+ * the primary way to identify users. Use this for your app's user IDs (e.g.,
1210
+ * 'user_alice_123', UUID, email).
967
1211
  */
968
1212
  external_user_id?: string | null;
1213
+ /**
1214
+ * Body param: Configuration for holographic neural embedding transforms and H-COND
1215
+ * scoring.
1216
+ *
1217
+ * Neural holographic embeddings use 13 brain-inspired frequency bands to encode
1218
+ * hierarchical semantic metadata alongside the base embedding. H-COND (Holographic
1219
+ * CONDitional) scoring uses phase alignment for improved relevance ranking.
1220
+ */
1221
+ holographic_config?: MemorySearchParams.HolographicConfig | null;
969
1222
  /**
970
1223
  * Body param: Metadata for memory request
971
1224
  */
@@ -975,22 +1228,46 @@ export interface MemorySearchParams {
975
1228
  * provided, search is scoped to memories within this namespace.
976
1229
  */
977
1230
  namespace_id?: string | null;
1231
+ /**
1232
+ * Body param: Filter for Open Memory Object (OMO) safety standards in
1233
+ * search/retrieval.
1234
+ *
1235
+ * Use this to filter search results by consent level and/or risk level.
1236
+ */
1237
+ omo_filter?: MemorySearchParams.OmoFilter | null;
978
1238
  /**
979
1239
  * Body param: Optional organization ID for multi-tenant search scoping. When
980
1240
  * provided, search is scoped to memories within this organization.
981
1241
  */
982
1242
  organization_id?: string | null;
983
1243
  /**
984
- * Body param: Whether to enable additional ranking of search results. Default is
985
- * false because results are already ranked when using an LLM for search
986
- * (recommended approach). Only enable this if you're not using an LLM in your
987
- * search pipeline and need additional result ranking.
1244
+ * @deprecated Body param: DEPRECATED: Use 'reranking_config' instead. Whether to
1245
+ * enable additional ranking of search results. Default is false because results
1246
+ * are already ranked when using an LLM for search (recommended approach). Only
1247
+ * enable this if you're not using an LLM in your search pipeline and need
1248
+ * additional result ranking. Migration: Replace 'rank_results: true' with
1249
+ * 'reranking_config: {reranking_enabled: true, reranking_provider: "cohere",
1250
+ * reranking_model: "rerank-v3.5"}'
988
1251
  */
989
1252
  rank_results?: boolean;
990
1253
  /**
991
- * Body param: Optional internal user ID to filter search results by a specific
992
- * user. If not provided, results are not filtered by user. If both user_id and
993
- * external_user_id are provided, user_id takes precedence.
1254
+ * Body param: Configuration for reranking memory search results
1255
+ */
1256
+ reranking_config?: MemorySearchParams.RerankingConfig | null;
1257
+ /**
1258
+ * Body param: Optional user-defined schema ID to use for this search. If provided,
1259
+ * this schema (plus system schema) will be used for query generation. If not
1260
+ * provided, system will automatically select relevant schema based on query
1261
+ * content.
1262
+ */
1263
+ schema_id?: string | null;
1264
+ /**
1265
+ * Body param: Complete search override specification provided by developer
1266
+ */
1267
+ search_override?: MemorySearchParams.SearchOverride | null;
1268
+ /**
1269
+ * @deprecated Body param: DEPRECATED: Use 'external_user_id' instead. Internal
1270
+ * Papr Parse user ID. Most developers should not use this field directly.
994
1271
  */
995
1272
  user_id?: string | null;
996
1273
  /**
@@ -998,7 +1275,162 @@ export interface MemorySearchParams {
998
1275
  */
999
1276
  'Accept-Encoding'?: string;
1000
1277
  }
1278
+ export declare namespace MemorySearchParams {
1279
+ /**
1280
+ * Configuration for holographic neural embedding transforms and H-COND scoring.
1281
+ *
1282
+ * Neural holographic embeddings use 13 brain-inspired frequency bands to encode
1283
+ * hierarchical semantic metadata alongside the base embedding. H-COND (Holographic
1284
+ * CONDitional) scoring uses phase alignment for improved relevance ranking.
1285
+ */
1286
+ interface HolographicConfig {
1287
+ /**
1288
+ * Whether to enable holographic embedding transforms
1289
+ */
1290
+ enabled?: boolean;
1291
+ /**
1292
+ * Maximum boost to add for high alignment (0.0-0.5)
1293
+ */
1294
+ hcond_boost_factor?: number;
1295
+ /**
1296
+ * Phase alignment threshold above which to apply boost (0.0-1.0)
1297
+ */
1298
+ hcond_boost_threshold?: number;
1299
+ /**
1300
+ * Maximum penalty for low alignment (0.0-0.5)
1301
+ */
1302
+ hcond_penalty_factor?: number;
1303
+ /**
1304
+ * Search mode: 'disabled' (off), 'integrated' (search transformed embeddings),
1305
+ * 'post_search' (fetch then rerank with H-COND)
1306
+ */
1307
+ search_mode?: 'disabled' | 'integrated' | 'post_search';
1308
+ }
1309
+ /**
1310
+ * Filter for Open Memory Object (OMO) safety standards in search/retrieval.
1311
+ *
1312
+ * Use this to filter search results by consent level and/or risk level.
1313
+ */
1314
+ interface OmoFilter {
1315
+ /**
1316
+ * Explicitly exclude memories with these consent levels. Example:
1317
+ * exclude_consent=['none'] filters out all memories without consent.
1318
+ */
1319
+ exclude_consent?: Array<'explicit' | 'implicit' | 'terms' | 'none'> | null;
1320
+ /**
1321
+ * If true, exclude all flagged content (risk == 'flagged'). Shorthand for
1322
+ * exclude_risk=['flagged'].
1323
+ */
1324
+ exclude_flagged?: boolean;
1325
+ /**
1326
+ * Explicitly exclude memories with these risk levels. Example:
1327
+ * exclude_risk=['flagged'] filters out all flagged content.
1328
+ */
1329
+ exclude_risk?: Array<'none' | 'sensitive' | 'flagged'> | null;
1330
+ /**
1331
+ * Post-ingest safety assessment of memory content.
1332
+ *
1333
+ * Aligned with Open Memory Object (OMO) standard.
1334
+ */
1335
+ max_risk?: 'none' | 'sensitive' | 'flagged' | null;
1336
+ /**
1337
+ * How the data owner allowed this memory to be stored/used.
1338
+ *
1339
+ * Aligned with Open Memory Object (OMO) standard.
1340
+ */
1341
+ min_consent?: 'explicit' | 'implicit' | 'terms' | 'none' | null;
1342
+ /**
1343
+ * If true, only return memories with explicit consent (consent != 'none').
1344
+ * Shorthand for exclude_consent=['none'].
1345
+ */
1346
+ require_consent?: boolean;
1347
+ }
1348
+ /**
1349
+ * Configuration for reranking memory search results
1350
+ */
1351
+ interface RerankingConfig {
1352
+ /**
1353
+ * Whether to enable reranking of search results
1354
+ */
1355
+ reranking_enabled?: boolean;
1356
+ /**
1357
+ * Model to use for reranking. OpenAI (LLM): 'gpt-5-nano' (fast reasoning,
1358
+ * default), 'gpt-5-mini' (better quality reasoning). Cohere (cross-encoder):
1359
+ * 'rerank-v3.5' (latest), 'rerank-english-v3.0', 'rerank-multilingual-v3.0'
1360
+ */
1361
+ reranking_model?: string;
1362
+ /**
1363
+ * Reranking provider: 'openai' (better quality, slower) or 'cohere' (faster,
1364
+ * optimized for reranking)
1365
+ */
1366
+ reranking_provider?: 'openai' | 'cohere';
1367
+ }
1368
+ /**
1369
+ * Complete search override specification provided by developer
1370
+ */
1371
+ interface SearchOverride {
1372
+ /**
1373
+ * Graph pattern to search for (source)-[relationship]->(target)
1374
+ */
1375
+ pattern: SearchOverride.Pattern;
1376
+ /**
1377
+ * Property filters to apply to the search pattern
1378
+ */
1379
+ filters?: Array<SearchOverride.Filter>;
1380
+ /**
1381
+ * Specific properties to return. If not specified, returns all properties.
1382
+ */
1383
+ return_properties?: Array<string> | null;
1384
+ }
1385
+ namespace SearchOverride {
1386
+ /**
1387
+ * Graph pattern to search for (source)-[relationship]->(target)
1388
+ */
1389
+ interface Pattern {
1390
+ /**
1391
+ * Relationship type (e.g., 'ASSOCIATED_WITH', 'WORKS_FOR'). Must match schema
1392
+ * relationship types.
1393
+ */
1394
+ relationship_type: string;
1395
+ /**
1396
+ * Source node label (e.g., 'Memory', 'Person', 'Company'). Must match schema node
1397
+ * types.
1398
+ */
1399
+ source_label: string;
1400
+ /**
1401
+ * Target node label (e.g., 'Person', 'Company', 'Project'). Must match schema node
1402
+ * types.
1403
+ */
1404
+ target_label: string;
1405
+ /**
1406
+ * Relationship direction: '->' (outgoing), '<-' (incoming), or '-' (bidirectional)
1407
+ */
1408
+ direction?: string;
1409
+ }
1410
+ /**
1411
+ * Property filters for search override
1412
+ */
1413
+ interface Filter {
1414
+ /**
1415
+ * Node type to filter (e.g., 'Person', 'Memory', 'Company')
1416
+ */
1417
+ node_type: string;
1418
+ /**
1419
+ * Filter operator: 'CONTAINS', 'EQUALS', 'STARTS_WITH', 'IN'
1420
+ */
1421
+ operator: string;
1422
+ /**
1423
+ * Property name to filter on (e.g., 'name', 'content', 'role')
1424
+ */
1425
+ property_name: string;
1426
+ /**
1427
+ * Filter value(s). Use list for 'IN' operator.
1428
+ */
1429
+ value: string | Array<string> | number | boolean;
1430
+ }
1431
+ }
1432
+ }
1001
1433
  export declare namespace Memory {
1002
- export { type AddMemory as AddMemory, type AddMemoryResponse as AddMemoryResponse, type AutoGraphGeneration as AutoGraphGeneration, type BatchMemoryResponse as BatchMemoryResponse, type ContextItem as ContextItem, type GraphGeneration as GraphGeneration, type HTTPValidationError as HTTPValidationError, type ManualGraphGeneration as ManualGraphGeneration, type MemoryMetadata as MemoryMetadata, type MemoryType as MemoryType, type RelationshipItem as RelationshipItem, type SearchResponse as SearchResponse, type MemoryUpdateResponse as MemoryUpdateResponse, type MemoryDeleteResponse as MemoryDeleteResponse, type MemoryUpdateParams as MemoryUpdateParams, type MemoryDeleteParams as MemoryDeleteParams, type MemoryAddParams as MemoryAddParams, type MemoryAddBatchParams as MemoryAddBatchParams, type MemoryDeleteAllParams as MemoryDeleteAllParams, type MemorySearchParams as MemorySearchParams, };
1434
+ export { type AddMemory as AddMemory, type AddMemoryResponse as AddMemoryResponse, type AutoGraphGeneration as AutoGraphGeneration, type BatchMemoryResponse as BatchMemoryResponse, type ContextItem as ContextItem, type GraphGeneration as GraphGeneration, type HTTPValidationError as HTTPValidationError, type ManualGraphGeneration as ManualGraphGeneration, type MemoryMetadata as MemoryMetadata, type MemoryType as MemoryType, type RelationshipItem as RelationshipItem, type SearchResponse as SearchResponse, type MemoryUpdateResponse as MemoryUpdateResponse, type MemoryDeleteResponse as MemoryDeleteResponse, type MemoryUpdateParams as MemoryUpdateParams, type MemoryDeleteParams as MemoryDeleteParams, type MemoryAddParams as MemoryAddParams, type MemoryAddBatchParams as MemoryAddBatchParams, type MemoryDeleteAllParams as MemoryDeleteAllParams, type MemoryGetParams as MemoryGetParams, type MemorySearchParams as MemorySearchParams, };
1003
1435
  }
1004
1436
  //# sourceMappingURL=memory.d.mts.map