@papr/memory 1.20.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.
- package/CHANGELOG.md +61 -0
- package/LICENSE +1 -1
- package/README.md +13 -1
- package/client.d.mts +37 -9
- package/client.d.mts.map +1 -1
- package/client.d.ts +37 -9
- package/client.d.ts.map +1 -1
- package/client.js +17 -2
- package/client.js.map +1 -1
- package/client.mjs +17 -2
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/tslib.js +22 -22
- package/package.json +1 -1
- package/resources/document.d.mts +16 -3
- package/resources/document.d.mts.map +1 -1
- package/resources/document.d.ts +16 -3
- package/resources/document.d.ts.map +1 -1
- package/resources/index.d.mts +6 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +6 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/memory.d.mts +498 -119
- package/resources/memory.d.mts.map +1 -1
- package/resources/memory.d.ts +498 -119
- package/resources/memory.d.ts.map +1 -1
- package/resources/memory.js +8 -4
- package/resources/memory.js.map +1 -1
- package/resources/memory.mjs +8 -4
- package/resources/memory.mjs.map +1 -1
- package/resources/messages/index.d.mts +3 -0
- package/resources/messages/index.d.mts.map +1 -0
- package/resources/messages/index.d.ts +3 -0
- package/resources/messages/index.d.ts.map +1 -0
- package/resources/messages/index.js +9 -0
- package/resources/messages/index.js.map +1 -0
- package/resources/messages/index.mjs +4 -0
- package/resources/messages/index.mjs.map +1 -0
- package/resources/messages/messages.d.mts +160 -0
- package/resources/messages/messages.d.mts.map +1 -0
- package/resources/messages/messages.d.ts +160 -0
- package/resources/messages/messages.d.ts.map +1 -0
- package/resources/messages/messages.js +54 -0
- package/resources/messages/messages.js.map +1 -0
- package/resources/messages/messages.mjs +49 -0
- package/resources/messages/messages.mjs.map +1 -0
- package/resources/messages/sessions.d.mts +262 -0
- package/resources/messages/sessions.d.mts.map +1 -0
- package/resources/messages/sessions.d.ts +262 -0
- package/resources/messages/sessions.d.ts.map +1 -0
- package/resources/messages/sessions.js +122 -0
- package/resources/messages/sessions.js.map +1 -0
- package/resources/messages/sessions.mjs +118 -0
- package/resources/messages/sessions.mjs.map +1 -0
- package/resources/messages.d.mts +2 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +2 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +6 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +3 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/omo.d.mts +98 -0
- package/resources/omo.d.mts.map +1 -0
- package/resources/omo.d.ts +98 -0
- package/resources/omo.d.ts.map +1 -0
- package/resources/omo.js +36 -0
- package/resources/omo.js.map +1 -0
- package/resources/omo.mjs +32 -0
- package/resources/omo.mjs.map +1 -0
- package/resources/schemas.d.mts +667 -76
- package/resources/schemas.d.mts.map +1 -1
- package/resources/schemas.d.ts +667 -76
- package/resources/schemas.d.ts.map +1 -1
- package/resources/schemas.js.map +1 -1
- package/resources/schemas.mjs.map +1 -1
- package/resources/shared.d.mts +671 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +671 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/sync.d.mts +142 -0
- package/resources/sync.d.mts.map +1 -0
- package/resources/sync.d.ts +142 -0
- package/resources/sync.d.ts.map +1 -0
- package/resources/sync.js +36 -0
- package/resources/sync.js.map +1 -0
- package/resources/sync.mjs +32 -0
- package/resources/sync.mjs.map +1 -0
- package/resources/user.d.mts +18 -1
- package/resources/user.d.mts.map +1 -1
- package/resources/user.d.ts +18 -1
- package/resources/user.d.ts.map +1 -1
- package/resources/user.js +11 -0
- package/resources/user.js.map +1 -1
- package/resources/user.mjs +11 -0
- package/resources/user.mjs.map +1 -1
- package/src/client.ts +80 -8
- package/src/internal/parse.ts +6 -0
- package/src/resources/document.ts +17 -4
- package/src/resources/index.ts +21 -0
- package/src/resources/memory.ts +548 -163
- package/src/resources/messages/index.ts +11 -0
- package/src/resources/messages/messages.ts +193 -0
- package/src/resources/messages/sessions.ts +315 -0
- package/src/resources/messages.ts +3 -0
- package/src/resources/omo.ts +132 -0
- package/src/resources/schemas.ts +701 -95
- package/src/resources/shared.ts +752 -0
- package/src/resources/sync.ts +179 -0
- package/src/resources/user.ts +23 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export { Messages, type MessageStoreResponse, type MessageStoreParams } from './messages';
|
|
4
|
+
export {
|
|
5
|
+
Sessions,
|
|
6
|
+
type SessionCompressResponse,
|
|
7
|
+
type SessionProcessResponse,
|
|
8
|
+
type SessionRetrieveHistoryResponse,
|
|
9
|
+
type SessionRetrieveStatusResponse,
|
|
10
|
+
type SessionRetrieveHistoryParams,
|
|
11
|
+
} from './sessions';
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as MemoryAPI from '../memory';
|
|
5
|
+
import * as Shared from '../shared';
|
|
6
|
+
import * as SessionsAPI from './sessions';
|
|
7
|
+
import {
|
|
8
|
+
SessionCompressResponse,
|
|
9
|
+
SessionProcessResponse,
|
|
10
|
+
SessionRetrieveHistoryParams,
|
|
11
|
+
SessionRetrieveHistoryResponse,
|
|
12
|
+
SessionRetrieveStatusResponse,
|
|
13
|
+
Sessions,
|
|
14
|
+
} from './sessions';
|
|
15
|
+
import { APIPromise } from '../../core/api-promise';
|
|
16
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
17
|
+
|
|
18
|
+
export class Messages extends APIResource {
|
|
19
|
+
sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Store a chat message and queue it for AI analysis and memory creation.
|
|
23
|
+
*
|
|
24
|
+
* **Authentication Required**: Bearer token, API key, or session token
|
|
25
|
+
*
|
|
26
|
+
* **Processing Control**:
|
|
27
|
+
* - Set `process_messages: true` (default) to enable full AI analysis and memory creation
|
|
28
|
+
* - Set `process_messages: false` to store messages only without processing into memories
|
|
29
|
+
*
|
|
30
|
+
* **Processing Flow** (when process_messages=true):
|
|
31
|
+
* 1. Message is immediately stored in PostMessage class
|
|
32
|
+
* 2. Background processing analyzes the message for memory-worthiness
|
|
33
|
+
* 3. If worthy, creates a memory with appropriate role-based categorization
|
|
34
|
+
* 4. Links the message to the created memory
|
|
35
|
+
*
|
|
36
|
+
* **Role-Based Categories**:
|
|
37
|
+
* - **User messages**: preference, task, goal, facts, context
|
|
38
|
+
* - **Assistant messages**: skills, learning
|
|
39
|
+
*
|
|
40
|
+
* **Session Management**:
|
|
41
|
+
* - `sessionId` is required to group related messages
|
|
42
|
+
* - Use the same `sessionId` for an entire conversation
|
|
43
|
+
* - **Optional `title`**: Set a human-readable title for the conversation (e.g., "Q4 Planning Session")
|
|
44
|
+
* - Retrieve conversation history using GET /messages/sessions/{sessionId}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const response = await client.messages.store({
|
|
49
|
+
* content: 'string',
|
|
50
|
+
* role: 'user',
|
|
51
|
+
* sessionId: 'sessionId',
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
store(body: MessageStoreParams, options?: RequestOptions): APIPromise<MessageStoreResponse> {
|
|
56
|
+
return this._client.post('/v1/messages', { body, ...options });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Response model for message storage
|
|
62
|
+
*/
|
|
63
|
+
export interface MessageStoreResponse {
|
|
64
|
+
/**
|
|
65
|
+
* Content of the message - can be a simple string or structured content objects
|
|
66
|
+
*/
|
|
67
|
+
content: string | Array<{ [key: string]: unknown }>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* When the message was created
|
|
71
|
+
*/
|
|
72
|
+
createdAt: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Parse Server objectId of the stored message
|
|
76
|
+
*/
|
|
77
|
+
objectId: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Role of the message sender
|
|
81
|
+
*/
|
|
82
|
+
role: 'user' | 'assistant';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Session ID of the conversation
|
|
86
|
+
*/
|
|
87
|
+
sessionId: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Status of background processing (queued, analyzing, completed, failed)
|
|
91
|
+
*/
|
|
92
|
+
processing_status?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface MessageStoreParams {
|
|
96
|
+
/**
|
|
97
|
+
* The content of the chat message - can be a simple string or structured content
|
|
98
|
+
* objects
|
|
99
|
+
*/
|
|
100
|
+
content: string | Array<{ [key: string]: unknown }>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Role of the message sender (user or assistant)
|
|
104
|
+
*/
|
|
105
|
+
role: 'user' | 'assistant';
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Session ID to group related messages in a conversation
|
|
109
|
+
*/
|
|
110
|
+
sessionId: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Optional context for the message (conversation history or relevant context)
|
|
114
|
+
*/
|
|
115
|
+
context?: Array<{ [key: string]: unknown }> | null;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Graph generation configuration
|
|
119
|
+
*/
|
|
120
|
+
graph_generation?: MemoryAPI.GraphGeneration | null;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Unified memory processing policy.
|
|
124
|
+
*
|
|
125
|
+
* This is the SINGLE source of truth for how a memory should be processed,
|
|
126
|
+
* combining graph generation control AND OMO (Open Memory Object) safety
|
|
127
|
+
* standards.
|
|
128
|
+
*
|
|
129
|
+
* **Graph Generation Modes:**
|
|
130
|
+
*
|
|
131
|
+
* - auto: LLM extracts entities freely (default)
|
|
132
|
+
* - manual: Developer provides exact nodes (no LLM extraction)
|
|
133
|
+
*
|
|
134
|
+
* **OMO Safety Standards:**
|
|
135
|
+
*
|
|
136
|
+
* - consent: How data owner allowed storage (explicit, implicit, terms, none)
|
|
137
|
+
* - risk: Safety assessment (none, sensitive, flagged)
|
|
138
|
+
* - acl: Access control list for read/write permissions
|
|
139
|
+
*
|
|
140
|
+
* **Schema Integration:**
|
|
141
|
+
*
|
|
142
|
+
* - schema_id: Reference a schema that may have its own default memory_policy
|
|
143
|
+
* - Schema-level policies are merged with request-level (request takes precedence)
|
|
144
|
+
*/
|
|
145
|
+
memory_policy?: Shared.MemoryPolicy | null;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Metadata for memory request
|
|
149
|
+
*/
|
|
150
|
+
metadata?: MemoryAPI.MemoryMetadata | null;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Optional namespace ID for multi-tenant message scoping
|
|
154
|
+
*/
|
|
155
|
+
namespace_id?: string | null;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Optional organization ID for multi-tenant message scoping
|
|
159
|
+
*/
|
|
160
|
+
organization_id?: string | null;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Whether to process messages into memories (true) or just store them (false).
|
|
164
|
+
* Default is true.
|
|
165
|
+
*/
|
|
166
|
+
process_messages?: boolean;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Optional array of relationships for Graph DB (Neo4j)
|
|
170
|
+
*/
|
|
171
|
+
relationships_json?: Array<{ [key: string]: unknown }> | null;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Optional title for the conversation session. Sets the Chat.title in Parse Server
|
|
175
|
+
* for easy identification.
|
|
176
|
+
*/
|
|
177
|
+
title?: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
Messages.Sessions = Sessions;
|
|
181
|
+
|
|
182
|
+
export declare namespace Messages {
|
|
183
|
+
export { type MessageStoreResponse as MessageStoreResponse, type MessageStoreParams as MessageStoreParams };
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
Sessions as Sessions,
|
|
187
|
+
type SessionCompressResponse as SessionCompressResponse,
|
|
188
|
+
type SessionProcessResponse as SessionProcessResponse,
|
|
189
|
+
type SessionRetrieveHistoryResponse as SessionRetrieveHistoryResponse,
|
|
190
|
+
type SessionRetrieveStatusResponse as SessionRetrieveStatusResponse,
|
|
191
|
+
type SessionRetrieveHistoryParams as SessionRetrieveHistoryParams,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
6
|
+
import { path } from '../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Sessions extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Get compressed conversation context for a session.
|
|
11
|
+
*
|
|
12
|
+
* Compress your conversation into hierarchical summaries with rich metadata,
|
|
13
|
+
* perfect for reducing token usage in LLM context windows.
|
|
14
|
+
*
|
|
15
|
+
* **Authentication Required**: Bearer token, API key, or session token
|
|
16
|
+
*
|
|
17
|
+
* **What it returns**:
|
|
18
|
+
* - **short_term**: Last 15 messages compressed
|
|
19
|
+
* - **medium_term**: Last ~100 messages compressed
|
|
20
|
+
* - **long_term**: Full session compressed
|
|
21
|
+
* - **topics**: Key topics discussed
|
|
22
|
+
* - **enhanced_fields**: Project context, tech stack, key decisions, next steps, files accessed
|
|
23
|
+
*
|
|
24
|
+
* **Perfect for**:
|
|
25
|
+
* - Reducing token usage in LLM prompts (96% savings)
|
|
26
|
+
* - Providing conversation context without full history
|
|
27
|
+
* - Quick conversation overview for AI agents
|
|
28
|
+
* - Project documentation and status snapshots
|
|
29
|
+
*
|
|
30
|
+
* **Input**: Just the session ID - all context is extracted automatically
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const response = await client.messages.sessions.compress(
|
|
35
|
+
* 'session_id',
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
compress(sessionID: string, options?: RequestOptions): APIPromise<SessionCompressResponse> {
|
|
40
|
+
return this._client.get(path`/v1/messages/sessions/${sessionID}/compress`, options);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Process all stored messages in a session that were previously stored with
|
|
45
|
+
* process_messages=false.
|
|
46
|
+
*
|
|
47
|
+
* **Authentication Required**: Bearer token, API key, or session token
|
|
48
|
+
*
|
|
49
|
+
* This endpoint allows you to retroactively process messages that were initially stored
|
|
50
|
+
* without processing. Useful for:
|
|
51
|
+
* - Processing messages after deciding you want them as memories
|
|
52
|
+
* - Batch processing large conversation sessions
|
|
53
|
+
* - Re-processing sessions with updated AI models
|
|
54
|
+
*
|
|
55
|
+
* **Processing Behavior**:
|
|
56
|
+
* - Only processes messages with status 'stored_only' or 'pending'
|
|
57
|
+
* - Uses the same smart batch analysis (every 15 messages)
|
|
58
|
+
* - Respects existing memory creation pipeline
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const response = await client.messages.sessions.process(
|
|
63
|
+
* 'session_id',
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
process(sessionID: string, options?: RequestOptions): APIPromise<unknown> {
|
|
68
|
+
return this._client.post(path`/v1/messages/sessions/${sessionID}/process`, options);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Retrieve message history for a specific conversation session.
|
|
73
|
+
*
|
|
74
|
+
* **Authentication Required**: Bearer token, API key, or session token
|
|
75
|
+
*
|
|
76
|
+
* **Pagination**:
|
|
77
|
+
* - Use `limit` and `skip` parameters for pagination
|
|
78
|
+
* - Messages are returned in chronological order (oldest first)
|
|
79
|
+
* - `total_count` indicates total messages in the session
|
|
80
|
+
*
|
|
81
|
+
* **Summaries** (if available):
|
|
82
|
+
* - Returns hierarchical conversation summaries (short/medium/long-term)
|
|
83
|
+
* - Includes `context_for_llm` field with pre-compressed context
|
|
84
|
+
* - Summaries are automatically generated every 15 messages
|
|
85
|
+
* - Use `/sessions/{session_id}/compress` endpoint to retrieve on-demand
|
|
86
|
+
*
|
|
87
|
+
* **Access Control**:
|
|
88
|
+
* - Only returns messages for the authenticated user
|
|
89
|
+
* - Workspace scoping is applied if available
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const response =
|
|
94
|
+
* await client.messages.sessions.retrieveHistory(
|
|
95
|
+
* 'session_id',
|
|
96
|
+
* );
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
retrieveHistory(
|
|
100
|
+
sessionID: string,
|
|
101
|
+
query: SessionRetrieveHistoryParams | null | undefined = {},
|
|
102
|
+
options?: RequestOptions,
|
|
103
|
+
): APIPromise<SessionRetrieveHistoryResponse> {
|
|
104
|
+
return this._client.get(path`/v1/messages/sessions/${sessionID}`, { query, ...options });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get processing status for messages in a session.
|
|
109
|
+
*
|
|
110
|
+
* **Authentication Required**: Bearer token, API key, or session token
|
|
111
|
+
*
|
|
112
|
+
* **Status Information**:
|
|
113
|
+
* - Total messages in session
|
|
114
|
+
* - Processing status breakdown (queued, analyzing, completed, failed)
|
|
115
|
+
* - Any messages with processing errors
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const response =
|
|
120
|
+
* await client.messages.sessions.retrieveStatus(
|
|
121
|
+
* 'session_id',
|
|
122
|
+
* );
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
retrieveStatus(sessionID: string, options?: RequestOptions): APIPromise<unknown> {
|
|
126
|
+
return this._client.get(path`/v1/messages/sessions/${sessionID}/status`, options);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Response model for session summarization endpoint
|
|
132
|
+
*/
|
|
133
|
+
export interface SessionCompressResponse {
|
|
134
|
+
/**
|
|
135
|
+
* Instructions for AI agents on how to search for more details about this
|
|
136
|
+
* conversation
|
|
137
|
+
*/
|
|
138
|
+
ai_agent_note: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Whether summaries were retrieved from cache (true) or just generated (false)
|
|
142
|
+
*/
|
|
143
|
+
from_cache: boolean;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Session ID of the conversation
|
|
147
|
+
*/
|
|
148
|
+
session_id: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Hierarchical conversation summaries
|
|
152
|
+
*/
|
|
153
|
+
summaries: SessionCompressResponse.Summaries;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Number of messages summarized (only present if just generated)
|
|
157
|
+
*/
|
|
158
|
+
message_count?: number | null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export namespace SessionCompressResponse {
|
|
162
|
+
/**
|
|
163
|
+
* Hierarchical conversation summaries
|
|
164
|
+
*/
|
|
165
|
+
export interface Summaries {
|
|
166
|
+
/**
|
|
167
|
+
* When summaries were last updated
|
|
168
|
+
*/
|
|
169
|
+
last_updated?: string | null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Full session summary
|
|
173
|
+
*/
|
|
174
|
+
long_term?: string | null;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Summary of last ~100 messages
|
|
178
|
+
*/
|
|
179
|
+
medium_term?: string | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Summary of last 15 messages
|
|
183
|
+
*/
|
|
184
|
+
short_term?: string | null;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Key topics discussed
|
|
188
|
+
*/
|
|
189
|
+
topics?: Array<string>;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type SessionProcessResponse = unknown;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Response model for retrieving message history
|
|
197
|
+
*/
|
|
198
|
+
export interface SessionRetrieveHistoryResponse {
|
|
199
|
+
/**
|
|
200
|
+
* List of messages in chronological order
|
|
201
|
+
*/
|
|
202
|
+
messages: Array<SessionRetrieveHistoryResponse.Message>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Session ID of the conversation
|
|
206
|
+
*/
|
|
207
|
+
sessionId: string;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Total number of messages in the session
|
|
211
|
+
*/
|
|
212
|
+
total_count: number;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Pre-formatted compressed context ready for LLM consumption (summaries + recent
|
|
216
|
+
* messages)
|
|
217
|
+
*/
|
|
218
|
+
context_for_llm?: string | null;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Hierarchical conversation summaries for context window compression
|
|
222
|
+
*/
|
|
223
|
+
summaries?: SessionRetrieveHistoryResponse.Summaries | null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export namespace SessionRetrieveHistoryResponse {
|
|
227
|
+
/**
|
|
228
|
+
* Response model for message storage
|
|
229
|
+
*/
|
|
230
|
+
export interface Message {
|
|
231
|
+
/**
|
|
232
|
+
* Content of the message - can be a simple string or structured content objects
|
|
233
|
+
*/
|
|
234
|
+
content: string | Array<{ [key: string]: unknown }>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* When the message was created
|
|
238
|
+
*/
|
|
239
|
+
createdAt: string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Parse Server objectId of the stored message
|
|
243
|
+
*/
|
|
244
|
+
objectId: string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Role of the message sender
|
|
248
|
+
*/
|
|
249
|
+
role: 'user' | 'assistant';
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Session ID of the conversation
|
|
253
|
+
*/
|
|
254
|
+
sessionId: string;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Status of background processing (queued, analyzing, completed, failed)
|
|
258
|
+
*/
|
|
259
|
+
processing_status?: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Hierarchical conversation summaries for context window compression
|
|
264
|
+
*/
|
|
265
|
+
export interface Summaries {
|
|
266
|
+
/**
|
|
267
|
+
* When summaries were last updated
|
|
268
|
+
*/
|
|
269
|
+
last_updated?: string | null;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Full session summary
|
|
273
|
+
*/
|
|
274
|
+
long_term?: string | null;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Summary of last ~100 messages
|
|
278
|
+
*/
|
|
279
|
+
medium_term?: string | null;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Summary of last 15 messages
|
|
283
|
+
*/
|
|
284
|
+
short_term?: string | null;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Key topics discussed
|
|
288
|
+
*/
|
|
289
|
+
topics?: Array<string>;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type SessionRetrieveStatusResponse = unknown;
|
|
294
|
+
|
|
295
|
+
export interface SessionRetrieveHistoryParams {
|
|
296
|
+
/**
|
|
297
|
+
* Maximum number of messages to return
|
|
298
|
+
*/
|
|
299
|
+
limit?: number;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Number of messages to skip for pagination
|
|
303
|
+
*/
|
|
304
|
+
skip?: number;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export declare namespace Sessions {
|
|
308
|
+
export {
|
|
309
|
+
type SessionCompressResponse as SessionCompressResponse,
|
|
310
|
+
type SessionProcessResponse as SessionProcessResponse,
|
|
311
|
+
type SessionRetrieveHistoryResponse as SessionRetrieveHistoryResponse,
|
|
312
|
+
type SessionRetrieveStatusResponse as SessionRetrieveStatusResponse,
|
|
313
|
+
type SessionRetrieveHistoryParams as SessionRetrieveHistoryParams,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class Omo extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Export memories in Open Memory Object (OMO) standard format.
|
|
10
|
+
*
|
|
11
|
+
* This enables memory portability to other OMO-compliant platforms.
|
|
12
|
+
* The exported format follows the OMO v1 schema.
|
|
13
|
+
*
|
|
14
|
+
* **OMO Standard:** https://github.com/papr-ai/open-memory-object
|
|
15
|
+
*/
|
|
16
|
+
exportMemories(
|
|
17
|
+
body: OmoExportMemoriesParams,
|
|
18
|
+
options?: RequestOptions,
|
|
19
|
+
): APIPromise<OmoExportMemoriesResponse> {
|
|
20
|
+
return this._client.post('/v1/omo/export', { body, ...options });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Export memories in OMO JSON file format for download.
|
|
25
|
+
*/
|
|
26
|
+
exportMemoriesAsJson(query: OmoExportMemoriesAsJsonParams, options?: RequestOptions): APIPromise<unknown> {
|
|
27
|
+
return this._client.get('/v1/omo/export.json', { query, ...options });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Import memories from Open Memory Object (OMO) standard format.
|
|
32
|
+
*
|
|
33
|
+
* This enables importing memories from other OMO-compliant platforms.
|
|
34
|
+
*
|
|
35
|
+
* **OMO Standard:** https://github.com/papr-ai/open-memory-object
|
|
36
|
+
*/
|
|
37
|
+
importMemories(
|
|
38
|
+
body: OmoImportMemoriesParams,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<OmoImportMemoriesResponse> {
|
|
41
|
+
return this._client.post('/v1/omo/import', { body, ...options });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Response model for OMO export.
|
|
47
|
+
*/
|
|
48
|
+
export interface OmoExportMemoriesResponse {
|
|
49
|
+
/**
|
|
50
|
+
* Number of memories exported
|
|
51
|
+
*/
|
|
52
|
+
count: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Memories in OMO v1 format
|
|
56
|
+
*/
|
|
57
|
+
memories: Array<{ [key: string]: unknown }>;
|
|
58
|
+
|
|
59
|
+
code?: number;
|
|
60
|
+
|
|
61
|
+
error?: string | null;
|
|
62
|
+
|
|
63
|
+
status?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type OmoExportMemoriesAsJsonResponse = unknown;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Response model for OMO import.
|
|
70
|
+
*/
|
|
71
|
+
export interface OmoImportMemoriesResponse {
|
|
72
|
+
/**
|
|
73
|
+
* Number of memories successfully imported
|
|
74
|
+
*/
|
|
75
|
+
imported: number;
|
|
76
|
+
|
|
77
|
+
code?: number;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Import errors
|
|
81
|
+
*/
|
|
82
|
+
errors?: Array<{ [key: string]: unknown }>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* IDs of imported memories
|
|
86
|
+
*/
|
|
87
|
+
memory_ids?: Array<string>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Number of memories skipped (duplicates)
|
|
91
|
+
*/
|
|
92
|
+
skipped?: number;
|
|
93
|
+
|
|
94
|
+
status?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface OmoExportMemoriesParams {
|
|
98
|
+
/**
|
|
99
|
+
* List of memory IDs to export
|
|
100
|
+
*/
|
|
101
|
+
memory_ids: Array<string>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface OmoExportMemoriesAsJsonParams {
|
|
105
|
+
/**
|
|
106
|
+
* Comma-separated list of memory IDs
|
|
107
|
+
*/
|
|
108
|
+
memory_ids: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface OmoImportMemoriesParams {
|
|
112
|
+
/**
|
|
113
|
+
* List of memories in OMO v1 format
|
|
114
|
+
*/
|
|
115
|
+
memories: Array<{ [key: string]: unknown }>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Skip memories with IDs that already exist
|
|
119
|
+
*/
|
|
120
|
+
skip_duplicates?: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export declare namespace Omo {
|
|
124
|
+
export {
|
|
125
|
+
type OmoExportMemoriesResponse as OmoExportMemoriesResponse,
|
|
126
|
+
type OmoExportMemoriesAsJsonResponse as OmoExportMemoriesAsJsonResponse,
|
|
127
|
+
type OmoImportMemoriesResponse as OmoImportMemoriesResponse,
|
|
128
|
+
type OmoExportMemoriesParams as OmoExportMemoriesParams,
|
|
129
|
+
type OmoExportMemoriesAsJsonParams as OmoExportMemoriesAsJsonParams,
|
|
130
|
+
type OmoImportMemoriesParams as OmoImportMemoriesParams,
|
|
131
|
+
};
|
|
132
|
+
}
|