indusagi 0.12.13 → 0.12.15

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 (142) hide show
  1. package/dist/agent/tools/registry.d.ts +1 -1
  2. package/dist/agent/tools/registry.d.ts.map +1 -1
  3. package/dist/agent/types.d.ts +1 -0
  4. package/dist/agent/types.d.ts.map +1 -1
  5. package/dist/agent/types.js.map +1 -1
  6. package/dist/ai/models.generated.d.ts +621 -53
  7. package/dist/ai/models.generated.d.ts.map +1 -1
  8. package/dist/ai/models.generated.js +548 -0
  9. package/dist/ai/models.generated.js.map +1 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/mcp/client-pool.d.ts +106 -0
  15. package/dist/mcp/client-pool.d.ts.map +1 -0
  16. package/dist/mcp/client-pool.js +233 -0
  17. package/dist/mcp/client-pool.js.map +1 -0
  18. package/dist/mcp/client.d.ts +158 -0
  19. package/dist/mcp/client.d.ts.map +1 -0
  20. package/dist/mcp/client.js +586 -0
  21. package/dist/mcp/client.js.map +1 -0
  22. package/dist/mcp/config.d.ts +61 -0
  23. package/dist/mcp/config.d.ts.map +1 -0
  24. package/dist/mcp/config.js +250 -0
  25. package/dist/mcp/config.js.map +1 -0
  26. package/dist/mcp/errors.d.ts +104 -0
  27. package/dist/mcp/errors.d.ts.map +1 -0
  28. package/dist/mcp/errors.js +138 -0
  29. package/dist/mcp/errors.js.map +1 -0
  30. package/dist/mcp/index.d.ts +56 -0
  31. package/dist/mcp/index.d.ts.map +1 -0
  32. package/dist/mcp/index.js +83 -0
  33. package/dist/mcp/index.js.map +1 -0
  34. package/dist/mcp/schema-converter.d.ts +68 -0
  35. package/dist/mcp/schema-converter.d.ts.map +1 -0
  36. package/dist/mcp/schema-converter.js +230 -0
  37. package/dist/mcp/schema-converter.js.map +1 -0
  38. package/dist/mcp/server.d.ts +111 -0
  39. package/dist/mcp/server.d.ts.map +1 -0
  40. package/dist/mcp/server.js +300 -0
  41. package/dist/mcp/server.js.map +1 -0
  42. package/dist/mcp/tool-factory.d.ts +63 -0
  43. package/dist/mcp/tool-factory.d.ts.map +1 -0
  44. package/dist/mcp/tool-factory.js +228 -0
  45. package/dist/mcp/tool-factory.js.map +1 -0
  46. package/dist/mcp/types.d.ts +289 -0
  47. package/dist/mcp/types.d.ts.map +1 -0
  48. package/dist/mcp/types.js +8 -0
  49. package/dist/mcp/types.js.map +1 -0
  50. package/dist/mcp.d.ts +6 -0
  51. package/dist/mcp.d.ts.map +1 -0
  52. package/dist/mcp.js +6 -0
  53. package/dist/mcp.js.map +1 -0
  54. package/dist/memory/embedder/base.d.ts +41 -0
  55. package/dist/memory/embedder/base.d.ts.map +1 -0
  56. package/dist/memory/embedder/base.js +10 -0
  57. package/dist/memory/embedder/base.js.map +1 -0
  58. package/dist/memory/embedder/index.d.ts +8 -0
  59. package/dist/memory/embedder/index.d.ts.map +1 -0
  60. package/dist/memory/embedder/index.js +6 -0
  61. package/dist/memory/embedder/index.js.map +1 -0
  62. package/dist/memory/embedder/openai.d.ts +35 -0
  63. package/dist/memory/embedder/openai.d.ts.map +1 -0
  64. package/dist/memory/embedder/openai.js +103 -0
  65. package/dist/memory/embedder/openai.js.map +1 -0
  66. package/dist/memory/index.d.ts +33 -0
  67. package/dist/memory/index.d.ts.map +1 -0
  68. package/dist/memory/index.js +31 -0
  69. package/dist/memory/index.js.map +1 -0
  70. package/dist/memory/memory.d.ts +126 -0
  71. package/dist/memory/memory.d.ts.map +1 -0
  72. package/dist/memory/memory.js +280 -0
  73. package/dist/memory/memory.js.map +1 -0
  74. package/dist/memory/processors/base.d.ts +42 -0
  75. package/dist/memory/processors/base.d.ts.map +1 -0
  76. package/dist/memory/processors/base.js +6 -0
  77. package/dist/memory/processors/base.js.map +1 -0
  78. package/dist/memory/processors/index.d.ts +16 -0
  79. package/dist/memory/processors/index.d.ts.map +1 -0
  80. package/dist/memory/processors/index.js +18 -0
  81. package/dist/memory/processors/index.js.map +1 -0
  82. package/dist/memory/processors/message-history.d.ts +35 -0
  83. package/dist/memory/processors/message-history.d.ts.map +1 -0
  84. package/dist/memory/processors/message-history.js +51 -0
  85. package/dist/memory/processors/message-history.js.map +1 -0
  86. package/dist/memory/processors/observational-memory/index.d.ts +82 -0
  87. package/dist/memory/processors/observational-memory/index.d.ts.map +1 -0
  88. package/dist/memory/processors/observational-memory/index.js +234 -0
  89. package/dist/memory/processors/observational-memory/index.js.map +1 -0
  90. package/dist/memory/processors/observational-memory/observer-agent.d.ts +64 -0
  91. package/dist/memory/processors/observational-memory/observer-agent.d.ts.map +1 -0
  92. package/dist/memory/processors/observational-memory/observer-agent.js +362 -0
  93. package/dist/memory/processors/observational-memory/observer-agent.js.map +1 -0
  94. package/dist/memory/processors/observational-memory/reflector-agent.d.ts +38 -0
  95. package/dist/memory/processors/observational-memory/reflector-agent.d.ts.map +1 -0
  96. package/dist/memory/processors/observational-memory/reflector-agent.js +213 -0
  97. package/dist/memory/processors/observational-memory/reflector-agent.js.map +1 -0
  98. package/dist/memory/processors/observational-memory/token-counter.d.ts +35 -0
  99. package/dist/memory/processors/observational-memory/token-counter.d.ts.map +1 -0
  100. package/dist/memory/processors/observational-memory/token-counter.js +90 -0
  101. package/dist/memory/processors/observational-memory/token-counter.js.map +1 -0
  102. package/dist/memory/processors/semantic-recall.d.ts +55 -0
  103. package/dist/memory/processors/semantic-recall.d.ts.map +1 -0
  104. package/dist/memory/processors/semantic-recall.js +143 -0
  105. package/dist/memory/processors/semantic-recall.js.map +1 -0
  106. package/dist/memory/processors/working-memory.d.ts +41 -0
  107. package/dist/memory/processors/working-memory.d.ts.map +1 -0
  108. package/dist/memory/processors/working-memory.js +82 -0
  109. package/dist/memory/processors/working-memory.js.map +1 -0
  110. package/dist/memory/storage/base.d.ts +288 -0
  111. package/dist/memory/storage/base.d.ts.map +1 -0
  112. package/dist/memory/storage/base.js +211 -0
  113. package/dist/memory/storage/base.js.map +1 -0
  114. package/dist/memory/storage/index.d.ts +9 -0
  115. package/dist/memory/storage/index.d.ts.map +1 -0
  116. package/dist/memory/storage/index.js +7 -0
  117. package/dist/memory/storage/index.js.map +1 -0
  118. package/dist/memory/storage/inmemory.d.ts +93 -0
  119. package/dist/memory/storage/inmemory.d.ts.map +1 -0
  120. package/dist/memory/storage/inmemory.js +646 -0
  121. package/dist/memory/storage/inmemory.js.map +1 -0
  122. package/dist/memory/tools/working-memory.d.ts +100 -0
  123. package/dist/memory/tools/working-memory.d.ts.map +1 -0
  124. package/dist/memory/tools/working-memory.js +237 -0
  125. package/dist/memory/tools/working-memory.js.map +1 -0
  126. package/dist/memory/types.d.ts +386 -0
  127. package/dist/memory/types.d.ts.map +1 -0
  128. package/dist/memory/types.js +58 -0
  129. package/dist/memory/types.js.map +1 -0
  130. package/dist/memory/vector/base.d.ts +145 -0
  131. package/dist/memory/vector/base.d.ts.map +1 -0
  132. package/dist/memory/vector/base.js +83 -0
  133. package/dist/memory/vector/base.js.map +1 -0
  134. package/dist/memory/vector/index.d.ts +8 -0
  135. package/dist/memory/vector/index.d.ts.map +1 -0
  136. package/dist/memory/vector/index.js +7 -0
  137. package/dist/memory/vector/index.js.map +1 -0
  138. package/dist/memory/vector/inmemory.d.ts +47 -0
  139. package/dist/memory/vector/inmemory.d.ts.map +1 -0
  140. package/dist/memory/vector/inmemory.js +234 -0
  141. package/dist/memory/vector/inmemory.js.map +1 -0
  142. package/package.json +32 -2
@@ -0,0 +1,289 @@
1
+ /**
2
+ * MCP Type Definitions
3
+ *
4
+ * Aligned with Model Context Protocol specification
5
+ * Reference: @mastra/mcp packages/mcp/src/client/types.ts
6
+ */
7
+ /**
8
+ * Configuration for MCP servers using stdio (subprocess) transport.
9
+ * Used when the MCP server is spawned as a subprocess that communicates via stdin/stdout.
10
+ */
11
+ export interface StdioServerConfig {
12
+ /** Command to execute (e.g., 'node', 'python', 'npx') */
13
+ command: string;
14
+ /** Optional arguments to pass to the command */
15
+ args?: string[];
16
+ /** Optional environment variables for the subprocess */
17
+ env?: Record<string, string>;
18
+ /** Optional working directory for the subprocess */
19
+ cwd?: string;
20
+ }
21
+ /**
22
+ * Configuration for MCP servers using HTTP-based transport (Streamable HTTP or SSE fallback).
23
+ * Used when connecting to remote MCP servers over HTTP.
24
+ */
25
+ export interface HttpServerConfig {
26
+ /** URL of the MCP server endpoint */
27
+ url: URL;
28
+ /** Optional headers for HTTP requests */
29
+ headers?: Record<string, string>;
30
+ /** Custom fetch implementation */
31
+ fetch?: typeof fetch;
32
+ }
33
+ /**
34
+ * Configuration for connecting to an MCP server.
35
+ * Either stdio-based (subprocess) or HTTP-based (remote server).
36
+ */
37
+ export type MCPServerConfig = StdioServerConfig | HttpServerConfig;
38
+ /**
39
+ * Options for establishing an MCP connection.
40
+ */
41
+ export interface MCPConnectionOptions {
42
+ /** Unique name for this server connection */
43
+ name: string;
44
+ /** Server configuration (stdio or HTTP) */
45
+ config: MCPServerConfig;
46
+ /** Optional timeout in milliseconds */
47
+ timeout?: number;
48
+ }
49
+ /**
50
+ * Definition of a tool exposed by an MCP server.
51
+ */
52
+ export interface MCPToolDefinition {
53
+ /** Tool name */
54
+ name: string;
55
+ /** Human-readable description */
56
+ description?: string;
57
+ /** JSON Schema for input parameters */
58
+ inputSchema: Record<string, unknown>;
59
+ /** Optional JSON Schema for output */
60
+ outputSchema?: Record<string, unknown>;
61
+ }
62
+ /**
63
+ * Resource exposed by an MCP server.
64
+ */
65
+ export interface MCPResource {
66
+ /** Unique URI for this resource */
67
+ uri: string;
68
+ /** Human-readable name */
69
+ name?: string;
70
+ /** MIME type of the resource content */
71
+ mimeType?: string;
72
+ /** Description of the resource */
73
+ description?: string;
74
+ }
75
+ /**
76
+ * Prompt template exposed by an MCP server.
77
+ */
78
+ export interface MCPPrompt {
79
+ /** Prompt name */
80
+ name: string;
81
+ /** Human-readable description */
82
+ description?: string;
83
+ /** Arguments the prompt accepts */
84
+ arguments?: Array<{
85
+ name: string;
86
+ description?: string;
87
+ required?: boolean;
88
+ }>;
89
+ }
90
+ /**
91
+ * Result of MCP server initialization.
92
+ */
93
+ export interface MCPInitializeResult {
94
+ /** Protocol version supported by the server */
95
+ protocolVersion: string;
96
+ /** Server information */
97
+ serverInfo: {
98
+ name: string;
99
+ version?: string;
100
+ };
101
+ /** Server capabilities */
102
+ capabilities: Record<string, unknown>;
103
+ }
104
+ /**
105
+ * Current state of an MCP client connection.
106
+ */
107
+ export interface MCPClientState {
108
+ /** Whether the client is connected */
109
+ connected: boolean;
110
+ /** Name of the connected server */
111
+ serverName: string;
112
+ /** Tools available from the server */
113
+ tools: MCPToolDefinition[];
114
+ /** Resources available from the server */
115
+ resources: MCPResource[];
116
+ /** Prompts available from the server */
117
+ prompts: MCPPrompt[];
118
+ }
119
+ /**
120
+ * Request to call an MCP tool.
121
+ */
122
+ export interface MCPToolCallRequest {
123
+ /** Tool name */
124
+ name: string;
125
+ /** Tool arguments */
126
+ arguments: Record<string, unknown>;
127
+ }
128
+ /**
129
+ * Content block in an MCP tool call result.
130
+ */
131
+ export type MCPContentBlock = {
132
+ type: "text";
133
+ text: string;
134
+ } | {
135
+ type: "image";
136
+ data: string;
137
+ mimeType: string;
138
+ } | {
139
+ type: "resource";
140
+ resource: MCPResource;
141
+ };
142
+ /**
143
+ * Result of an MCP tool call.
144
+ */
145
+ export interface MCPToolCallResult {
146
+ /** Content blocks returned by the tool */
147
+ content: MCPContentBlock[];
148
+ /** Whether the tool execution resulted in an error */
149
+ isError?: boolean;
150
+ /** Structured content if the tool has an output schema */
151
+ structuredContent?: unknown;
152
+ }
153
+ /**
154
+ * Server configuration in the MCP config file.
155
+ */
156
+ export interface MCPServerConfigEntry {
157
+ /** Unique name for this server */
158
+ name: string;
159
+ /** Command for stdio transport */
160
+ command?: string;
161
+ /** Arguments for stdio transport */
162
+ args?: string[];
163
+ /** Environment variables for stdio transport */
164
+ env?: Record<string, string>;
165
+ /** URL for HTTP transport */
166
+ url?: string;
167
+ /** Headers for HTTP transport */
168
+ headers?: Record<string, string>;
169
+ /** Timeout in milliseconds */
170
+ timeout?: number;
171
+ /** Whether this server is enabled (default: true) */
172
+ enabled?: boolean;
173
+ }
174
+ /**
175
+ * Server configuration without name (for object format).
176
+ */
177
+ export interface MCPServerConfigValue {
178
+ /** Command for stdio transport */
179
+ command?: string;
180
+ /** Arguments for stdio transport */
181
+ args?: string[];
182
+ /** Environment variables for stdio transport */
183
+ env?: Record<string, string>;
184
+ /** URL for HTTP transport */
185
+ url?: string;
186
+ /** Headers for HTTP transport */
187
+ headers?: Record<string, string>;
188
+ /** Timeout in milliseconds */
189
+ timeout?: number;
190
+ /** Whether this server is enabled (default: true) */
191
+ enabled?: boolean;
192
+ }
193
+ /**
194
+ * MCP configuration file structure.
195
+ * Supports two formats:
196
+ * - Array: { "servers": [{ "name": "github", "command": "npx", ... }] }
197
+ * - Object: { "servers": { "github": { "command": "npx", ... } } }
198
+ */
199
+ export interface MCPConfigFile {
200
+ /** Server configurations (array or object with server names as keys) */
201
+ servers: MCPServerConfigEntry[] | Record<string, MCPServerConfigValue>;
202
+ }
203
+ /**
204
+ * MCP logging levels.
205
+ */
206
+ export type MCPLoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
207
+ /**
208
+ * Log message from an MCP server.
209
+ */
210
+ export interface MCPLogMessage {
211
+ /** Logging level */
212
+ level: MCPLoggingLevel;
213
+ /** Log message content */
214
+ message: string;
215
+ /** Timestamp */
216
+ timestamp: Date;
217
+ /** Server name */
218
+ serverName: string;
219
+ /** Additional details */
220
+ details?: Record<string, unknown>;
221
+ }
222
+ /**
223
+ * Handler function for processing log messages from MCP servers.
224
+ */
225
+ export type MCPLogHandler = (logMessage: MCPLogMessage) => void;
226
+ /**
227
+ * Progress notification from an MCP server.
228
+ */
229
+ export interface MCPProgressNotification {
230
+ /** Progress token */
231
+ progressToken: string | number;
232
+ /** Current progress value */
233
+ progress: number;
234
+ /** Total value (optional) */
235
+ total?: number;
236
+ /** Human-readable message */
237
+ message?: string;
238
+ }
239
+ /**
240
+ * Handler function for processing progress notifications.
241
+ */
242
+ export type MCPProgressHandler = (params: MCPProgressNotification) => void;
243
+ /**
244
+ * Elicitation request from an MCP server (requesting user input).
245
+ */
246
+ export interface MCPElicitRequest {
247
+ /** Message to display to the user */
248
+ message: string;
249
+ /** JSON Schema for the expected response */
250
+ requestedSchema: Record<string, unknown>;
251
+ }
252
+ /**
253
+ * Response to an elicitation request.
254
+ */
255
+ export interface MCPElicitResult {
256
+ /** Action taken: accept, decline, or cancel */
257
+ action: "accept" | "decline" | "cancel";
258
+ /** Content if action is accept */
259
+ content?: Record<string, unknown>;
260
+ }
261
+ /**
262
+ * Handler function for processing elicitation requests.
263
+ */
264
+ export type MCPElicitationHandler = (request: MCPElicitRequest) => Promise<MCPElicitResult>;
265
+ /**
266
+ * Filesystem root exposed to MCP servers.
267
+ */
268
+ export interface MCPRoot {
269
+ /** Unique URI (must be file://) */
270
+ uri: string;
271
+ /** Human-readable name */
272
+ name?: string;
273
+ }
274
+ /**
275
+ * Base options common to all MCP server definitions.
276
+ */
277
+ export interface BaseServerOptions {
278
+ /** Optional handler for server log messages */
279
+ logger?: MCPLogHandler;
280
+ /** Optional timeout in milliseconds */
281
+ timeout?: number;
282
+ /** Whether to enable server log forwarding (default: true) */
283
+ enableServerLogs?: boolean;
284
+ /** Whether to enable progress tracking (default: false) */
285
+ enableProgressTracking?: boolean;
286
+ /** List of filesystem roots to expose to the MCP server */
287
+ roots?: MCPRoot[];
288
+ }
289
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAA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,SAAS,GAAG,QAAQ,CAAC;IACxC,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAM5F;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;CACnB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * MCP Type Definitions
3
+ *
4
+ * Aligned with Model Context Protocol specification
5
+ * Reference: @mastra/mcp packages/mcp/src/client/types.ts
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MCP (Model Context Protocol) entry point
3
+ * Re-exports all MCP components for external use
4
+ */
5
+ export * from "./mcp/index.js";
6
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC"}
package/dist/mcp.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MCP (Model Context Protocol) entry point
3
+ * Re-exports all MCP components for external use
4
+ */
5
+ export * from "./mcp/index.js";
6
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Embedder Abstract Base Class
3
+ * Based on Mastra Embedder patterns
4
+ */
5
+ import type { EmbeddingResult, EmbedderOptions } from "../types.js";
6
+ /**
7
+ * Embedder configuration
8
+ */
9
+ export interface EmbedderConfig {
10
+ model: string;
11
+ dimensions?: number;
12
+ batchSize?: number;
13
+ apiKey?: string;
14
+ baseUrl?: string;
15
+ }
16
+ /**
17
+ * Abstract base class for embedding model implementations
18
+ */
19
+ export declare abstract class Embedder {
20
+ /**
21
+ * Embedder name/identifier
22
+ */
23
+ abstract readonly name: string;
24
+ /**
25
+ * Model identifier
26
+ */
27
+ abstract readonly model: string;
28
+ /**
29
+ * Output dimensions
30
+ */
31
+ abstract readonly dimensions: number;
32
+ /**
33
+ * Generate embedding for a single text
34
+ */
35
+ abstract embed(text: string, options?: EmbedderOptions): Promise<EmbeddingResult>;
36
+ /**
37
+ * Generate embeddings for multiple texts
38
+ */
39
+ abstract embedBatch(texts: string[], options?: EmbedderOptions): Promise<EmbeddingResult[]>;
40
+ }
41
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/memory/embedder/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,8BAAsB,QAAQ;IAC5B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAEjF;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAC5F"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Embedder Abstract Base Class
3
+ * Based on Mastra Embedder patterns
4
+ */
5
+ /**
6
+ * Abstract base class for embedding model implementations
7
+ */
8
+ export class Embedder {
9
+ }
10
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/memory/embedder/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH;;GAEG;AACH,MAAM,OAAgB,QAAQ;CAyB7B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Embedder Module Exports
3
+ */
4
+ export { Embedder } from "./base.js";
5
+ export type { EmbedderConfig } from "./base.js";
6
+ export { OpenAIEmbedder, createOpenAIEmbedder } from "./openai.js";
7
+ export type { OpenAIEmbedderConfig } from "./openai.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/embedder/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Embedder Module Exports
3
+ */
4
+ export { Embedder } from "./base.js";
5
+ export { OpenAIEmbedder, createOpenAIEmbedder } from "./openai.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/memory/embedder/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * OpenAI Embedder Implementation
3
+ * Based on Mastra embedder patterns
4
+ */
5
+ import { Embedder, type EmbedderConfig } from "./base.js";
6
+ import type { EmbeddingResult, EmbedderOptions } from "../types.js";
7
+ /**
8
+ * OpenAI Embedder Configuration
9
+ */
10
+ export interface OpenAIEmbedderConfig extends EmbedderConfig {
11
+ apiKey?: string;
12
+ baseUrl?: string;
13
+ organization?: string;
14
+ }
15
+ /**
16
+ * OpenAI Embedder Implementation
17
+ */
18
+ export declare class OpenAIEmbedder extends Embedder {
19
+ readonly name = "openai";
20
+ readonly model: string;
21
+ readonly dimensions: number;
22
+ private apiKey;
23
+ private baseUrl;
24
+ private organization?;
25
+ private batchSize;
26
+ constructor(config: OpenAIEmbedderConfig);
27
+ embed(text: string, options?: EmbedderOptions): Promise<EmbeddingResult>;
28
+ embedBatch(texts: string[], options?: EmbedderOptions): Promise<EmbeddingResult[]>;
29
+ private embedBatchInternal;
30
+ }
31
+ /**
32
+ * Create an OpenAI embedder with default configuration
33
+ */
34
+ export declare function createOpenAIEmbedder(config?: Partial<OpenAIEmbedderConfig>): OpenAIEmbedder;
35
+ //# sourceMappingURL=openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/memory/embedder/openai.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAmBpE;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAWD;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,oBAAoB;IAiBlC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKxE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAa1E,kBAAkB;CA4DjC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,cAAc,CAK3F"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * OpenAI Embedder Implementation
3
+ * Based on Mastra embedder patterns
4
+ */
5
+ import { Embedder } from "./base.js";
6
+ /**
7
+ * Default dimensions for OpenAI embedding models
8
+ */
9
+ const MODEL_DIMENSIONS = {
10
+ "text-embedding-3-small": 1536,
11
+ "text-embedding-3-large": 3072,
12
+ "text-embedding-ada-002": 1536,
13
+ };
14
+ /**
15
+ * OpenAI Embedder Implementation
16
+ */
17
+ export class OpenAIEmbedder extends Embedder {
18
+ constructor(config) {
19
+ super();
20
+ this.name = "openai";
21
+ this.model = config.model ?? "text-embedding-3-small";
22
+ this.dimensions = config.dimensions ?? MODEL_DIMENSIONS[this.model] ?? 1536;
23
+ this.apiKey = config.apiKey ?? process.env.OPENAI_API_KEY ?? "";
24
+ this.baseUrl = config.baseUrl ?? "https://api.openai.com/v1";
25
+ this.organization = config.organization;
26
+ this.batchSize = config.batchSize ?? 100;
27
+ if (!this.apiKey) {
28
+ throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass apiKey in config.");
29
+ }
30
+ }
31
+ async embed(text, options) {
32
+ const results = await this.embedBatch([text], options);
33
+ return results[0];
34
+ }
35
+ async embedBatch(texts, options) {
36
+ // Process in batches to avoid API limits
37
+ const results = [];
38
+ for (let i = 0; i < texts.length; i += this.batchSize) {
39
+ const batch = texts.slice(i, i + this.batchSize);
40
+ const batchResults = await this.embedBatchInternal(batch, options);
41
+ results.push(...batchResults);
42
+ }
43
+ return results;
44
+ }
45
+ async embedBatchInternal(texts, options) {
46
+ const headers = {
47
+ "Content-Type": "application/json",
48
+ Authorization: `Bearer ${this.apiKey}`,
49
+ };
50
+ if (this.organization) {
51
+ headers["OpenAI-Organization"] = this.organization;
52
+ }
53
+ const body = {
54
+ input: texts,
55
+ model: this.model,
56
+ dimensions: options?.dimensions ?? this.dimensions,
57
+ };
58
+ // Add provider options if provided
59
+ if (options?.providerOptions) {
60
+ Object.assign(body, options.providerOptions);
61
+ }
62
+ const response = await fetch(`${this.baseUrl}/embeddings`, {
63
+ method: "POST",
64
+ headers,
65
+ body: JSON.stringify(body),
66
+ });
67
+ if (!response.ok) {
68
+ const errorText = await response.text();
69
+ let errorMessage = `OpenAI embedding failed: ${response.statusText}`;
70
+ try {
71
+ const errorJson = JSON.parse(errorText);
72
+ if (errorJson.error?.message) {
73
+ errorMessage = errorJson.error.message;
74
+ }
75
+ }
76
+ catch {
77
+ // Use default error message
78
+ }
79
+ throw new Error(errorMessage);
80
+ }
81
+ const data = (await response.json());
82
+ // Sort by index to ensure correct order
83
+ const sortedData = [...data.data].sort((a, b) => a.index - b.index);
84
+ return sortedData.map((item, i) => ({
85
+ vector: item.embedding,
86
+ model: this.model,
87
+ dimensions: item.embedding.length,
88
+ usage: {
89
+ inputTokens: Math.round(data.usage.prompt_tokens / texts.length),
90
+ },
91
+ }));
92
+ }
93
+ }
94
+ /**
95
+ * Create an OpenAI embedder with default configuration
96
+ */
97
+ export function createOpenAIEmbedder(config) {
98
+ return new OpenAIEmbedder({
99
+ model: "text-embedding-3-small",
100
+ ...config,
101
+ });
102
+ }
103
+ //# sourceMappingURL=openai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.js","sourceRoot":"","sources":["../../../src/memory/embedder/openai.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAuB,MAAM,WAAW,CAAC;AA6B1D;;GAEG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,wBAAwB,EAAE,IAAI;IAC9B,wBAAwB,EAAE,IAAI;IAC9B,wBAAwB,EAAE,IAAI;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAU1C,YAAY,MAA4B;QACtC,KAAK,EAAE,CAAC;QAVD,SAAI,GAAG,QAAQ,CAAC;QAYvB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,wBAAwB,CAAC;QACtD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,gBAAgB,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AC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA4B,CAAC;QAEhE,wCAAwC;QACxC,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAEpE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAClC,MAAM,EAAE,IAAI,CAAC,SAAS;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;YACjC,KAAK,EAAE;gBACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;aACjE;SACF,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsC;IACzE,OAAO,IAAI,cAAc,CAAC;QACxB,KAAK,EAAE,wBAAwB;QAC/B,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Memory Module - Public Exports
3
+ * Based on Mastra memory patterns
4
+ */
5
+ export { Memory } from "./memory.js";
6
+ export type { CoreMessage, MessageContentV2, MessagePart, StorageMessageType, StorageThreadType, StorageResourceType, MemoryConfig, SharedMemoryConfig, SemanticRecallConfig, WorkingMemoryConfig, ObservationalMemoryOptions, ObservationConfig, ReflectionConfig, ObservationalMemoryModelSettings, VectorIndexConfig, EmbeddingResult, EmbedderOptions, VectorQueryResult, IndexStats, PaginationInput, PaginationOutput, OrderByInput, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, ObservationalMemoryRecord, BufferedObservationChunk, WorkingMemoryTemplate, } from "./types.js";
7
+ export { memoryDefaultOptions, DEFAULT_SEMANTIC_RECALL, DEFAULT_OBSERVATIONAL_MEMORY, } from "./types.js";
8
+ export { MemoryStorage } from "./storage/base.js";
9
+ export type { CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput, } from "./storage/base.js";
10
+ export { InMemoryStorage, createInMemoryDB } from "./storage/inmemory.js";
11
+ export type { InMemoryDB } from "./storage/inmemory.js";
12
+ export { VectorStore } from "./vector/base.js";
13
+ export type { CreateIndexParams, UpsertVectorParams, QueryVectorParams, UpdateVectorParams, DeleteVectorParams, DeleteVectorsParams, } from "./vector/base.js";
14
+ export { InMemoryVectorStore } from "./vector/inmemory.js";
15
+ export { Embedder } from "./embedder/base.js";
16
+ export type { EmbedderConfig } from "./embedder/base.js";
17
+ export { OpenAIEmbedder, createOpenAIEmbedder } from "./embedder/openai.js";
18
+ export type { OpenAIEmbedderConfig } from "./embedder/openai.js";
19
+ export type { MemoryProcessor, ProcessorContext } from "./processors/base.js";
20
+ export { WorkingMemory } from "./processors/working-memory.js";
21
+ export type { WorkingMemoryProcessorConfig } from "./processors/working-memory.js";
22
+ export { SemanticRecall } from "./processors/semantic-recall.js";
23
+ export type { SemanticRecallProcessorConfig } from "./processors/semantic-recall.js";
24
+ export { MessageHistory } from "./processors/message-history.js";
25
+ export type { MessageHistoryProcessorConfig } from "./processors/message-history.js";
26
+ export { ObservationalMemory, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTINUATION_HINT, } from "./processors/observational-memory/index.js";
27
+ export type { ObservationalMemoryProcessorConfig } from "./processors/observational-memory/index.js";
28
+ export { TokenCounter, createTokenCounter } from "./processors/observational-memory/token-counter.js";
29
+ export { buildObserverSystemPrompt, buildObserverPrompt, parseObserverOutput, formatMessagesForObserver, sanitizeObservationLines, detectDegenerateRepetition, optimizeObservationsForContext, OBSERVER_SYSTEM_PROMPT, OBSERVER_EXTRACTION_INSTRUCTIONS, OBSERVER_OUTPUT_FORMAT_BASE, OBSERVER_GUIDELINES, type ObserverResult, } from "./processors/observational-memory/observer-agent.js";
30
+ export { buildReflectorSystemPrompt, buildReflectorPrompt, parseReflectorOutput, validateCompression, REFLECTOR_SYSTEM_PROMPT, COMPRESSION_GUIDANCE, type ReflectorResult, } from "./processors/observational-memory/reflector-agent.js";
31
+ export { createUpdateWorkingMemoryTool, createUpdateWorkingMemoryToolVNext, deepMergeWorkingMemory, extractWorkingMemoryTags, removeWorkingMemoryTags, } from "./tools/working-memory.js";
32
+ export type { UpdateWorkingMemoryInput, UpdateWorkingMemoryResult, } from "./tools/working-memory.js";
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,YAAY,EAEV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAGlB,iBAAiB,EAGjB,mBAAmB,EAGnB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,iBAAiB,EAGjB,eAAe,EACf,eAAe,EAGf,iBAAiB,EACjB,UAAU,EAGV,eAAe,EACf,gBAAgB,EAChB,YAAY,EAGZ,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EAGxB,yBAAyB,EACzB,wBAAwB,EAGxB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,8BAA8B,EA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,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAGtG,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,sBAAsB,EACtB,gCAAgC,EAChC,2BAA2B,EAC3B,mBAAmB,EACnB,KAAK,cAAc,GACpB,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,sDAAsD,CAAC;AAG9D,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Memory Module - Public Exports
3
+ * Based on Mastra memory patterns
4
+ */
5
+ // Main Memory class
6
+ export { Memory } from "./memory.js";
7
+ // Export defaults
8
+ export { memoryDefaultOptions, DEFAULT_SEMANTIC_RECALL, DEFAULT_OBSERVATIONAL_MEMORY, } from "./types.js";
9
+ // Storage
10
+ export { MemoryStorage } from "./storage/base.js";
11
+ export { InMemoryStorage, createInMemoryDB } from "./storage/inmemory.js";
12
+ // Vector Store
13
+ export { VectorStore } from "./vector/base.js";
14
+ export { InMemoryVectorStore } from "./vector/inmemory.js";
15
+ // Embedder
16
+ export { Embedder } from "./embedder/base.js";
17
+ export { OpenAIEmbedder, createOpenAIEmbedder } from "./embedder/openai.js";
18
+ export { WorkingMemory } from "./processors/working-memory.js";
19
+ export { SemanticRecall } from "./processors/semantic-recall.js";
20
+ export { MessageHistory } from "./processors/message-history.js";
21
+ // Observational Memory Processor
22
+ export { ObservationalMemory, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTINUATION_HINT, } from "./processors/observational-memory/index.js";
23
+ // Token Counter
24
+ export { TokenCounter, createTokenCounter } from "./processors/observational-memory/token-counter.js";
25
+ // Observer Agent
26
+ export { buildObserverSystemPrompt, buildObserverPrompt, parseObserverOutput, formatMessagesForObserver, sanitizeObservationLines, detectDegenerateRepetition, optimizeObservationsForContext, OBSERVER_SYSTEM_PROMPT, OBSERVER_EXTRACTION_INSTRUCTIONS, OBSERVER_OUTPUT_FORMAT_BASE, OBSERVER_GUIDELINES, } from "./processors/observational-memory/observer-agent.js";
27
+ // Reflector Agent
28
+ export { buildReflectorSystemPrompt, buildReflectorPrompt, parseReflectorOutput, validateCompression, REFLECTOR_SYSTEM_PROMPT, COMPRESSION_GUIDANCE, } from "./processors/observational-memory/reflector-agent.js";
29
+ // Tools
30
+ export { createUpdateWorkingMemoryTool, createUpdateWorkingMemoryToolVNext, deepMergeWorkingMemory, extractWorkingMemoryTags, removeWorkingMemoryTags, } from "./tools/working-memory.js";
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsDrC,kBAAkB;AAClB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AAEpB,UAAU;AACV,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWlD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG1E,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAS/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,WAAW;AACX,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE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