@mnexium/sdk 0.1.0 → 0.2.1

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/README.md CHANGED
@@ -224,6 +224,43 @@ const task = await alice.state.get('current_task');
224
224
  await alice.state.delete('current_task');
225
225
  ```
226
226
 
227
+ ### Records (Structured Data)
228
+
229
+ Define typed schemas and work with structured records:
230
+
231
+ ```typescript
232
+ // Define a schema
233
+ await mnx.records.defineSchema(
234
+ 'deal',
235
+ {
236
+ title: { type: 'string', required: true },
237
+ value: { type: 'number' },
238
+ stage: { type: 'string' },
239
+ },
240
+ { displayName: 'Deal', description: 'Sales opportunities' }
241
+ );
242
+
243
+ // Insert a record
244
+ const deal = await mnx.records.insert('deal', {
245
+ title: 'Acme Renewal',
246
+ value: 500000,
247
+ stage: 'negotiation',
248
+ });
249
+
250
+ // Get/update/delete
251
+ const found = await mnx.records.get('deal', deal.record_id);
252
+ await mnx.records.update('deal', deal.record_id, { stage: 'closed_won' });
253
+ await mnx.records.delete('deal', deal.record_id);
254
+
255
+ // Query/search
256
+ const wonDeals = await mnx.records.query('deal', {
257
+ where: { stage: 'closed_won' },
258
+ orderBy: '-value',
259
+ limit: 10,
260
+ });
261
+ const similar = await mnx.records.search('deal', 'large enterprise renewals');
262
+ ```
263
+
227
264
  ### Chat History
228
265
 
229
266
  ```typescript
@@ -280,6 +317,7 @@ const mnx = new Mnexium({
280
317
  recall: false,
281
318
  profile: false,
282
319
  history: true,
320
+ memoryPolicy: 'mp_sales_v1', // Or false to disable policy for a request
283
321
  },
284
322
  });
285
323
  ```
@@ -298,9 +336,31 @@ Every `process()` and `chat.process()` call supports these options:
298
336
  | `log` | boolean | `true` | Save messages to chat history |
299
337
  | `summarize` | boolean/string | `false` | `'light'`, `'balanced'`, or `'aggressive'` |
300
338
  | `systemPrompt` | boolean/string | `true` | `true` (auto), `false` (skip), or prompt ID |
339
+ | `memoryPolicy` | string/boolean | — | Policy ID string to force a policy, or `false` to disable policy for this request |
340
+ | `records` | object | — | Records controls: `learn: 'force' | 'auto' | false`, `tables: string[]`, `sync: boolean`, `recall: boolean` |
301
341
  | `stream` | boolean | `false` | Enable streaming response |
302
342
  | `metadata` | object | — | Custom metadata attached to saved logs |
303
343
 
344
+ Memory policy fallback header: the SDK also sends `x-mnx-memory-policy` when `memoryPolicy` is set.
345
+ - `memoryPolicy: false` -> `x-mnx-memory-policy: false`
346
+ - `memoryPolicy: 'mp_abc123'` -> `x-mnx-memory-policy: mp_abc123`
347
+
348
+ Records extraction controls:
349
+
350
+ ```typescript
351
+ const response = await mnx.process({
352
+ content: 'Extract and save order details',
353
+ records: {
354
+ learn: 'force', // 'force' | 'auto' | false
355
+ tables: ['orders'], // Optional allowlist
356
+ sync: true, // Wait for write completion
357
+ recall: true, // Include prior records in context
358
+ },
359
+ });
360
+
361
+ console.log(response.records); // Sync extraction metadata (when returned by backend)
362
+ ```
363
+
304
364
  ## Trial Keys
305
365
 
306
366
  If you don't provide an API key, Mnexium auto-provisions a trial key:
@@ -362,6 +422,7 @@ See the [examples/](./examples/) directory for runnable demos:
362
422
  | `npm run claims` | Claims extraction and manual setting |
363
423
  | `npm run state` | Agent state with TTL |
364
424
  | `npm run profile` | User profiles |
425
+ | `npm run records` | Structured records (schemas, CRUD, query, search) |
365
426
  | `npm run prompts` | System prompt management |
366
427
  | `npm run multi` | Multi-provider (OpenAI, Claude, Gemini) |
367
428
  | `npm run full` | Full API demo |
package/dist/index.d.mts CHANGED
@@ -5,6 +5,17 @@
5
5
  interface ProviderConfig {
6
6
  apiKey: string;
7
7
  }
8
+ type MnxRecordsLearnMode = 'force' | 'auto' | false;
9
+ interface MnxRecordsConfig {
10
+ /** Enable record recall (inject existing records as context) */
11
+ recall?: boolean;
12
+ /** Records extraction mode: "auto" (best effort), "force" (must attempt), false (off) */
13
+ learn?: MnxRecordsLearnMode;
14
+ /** Whether extraction should be synchronous (blocking) */
15
+ sync?: boolean;
16
+ /** Restrict extraction to specific tables */
17
+ tables?: string[];
18
+ }
8
19
  /** Default settings for all process() calls */
9
20
  interface MnexiumDefaults {
10
21
  /** Default model to use */
@@ -35,6 +46,10 @@ interface MnexiumDefaults {
35
46
  temperature?: number;
36
47
  /** Force regenerate trial key on every request (for testing) */
37
48
  regenerateKey?: boolean;
49
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
50
+ memoryPolicy?: string | false;
51
+ /** Default records behavior for process/chat requests */
52
+ records?: MnxRecordsConfig;
38
53
  }
39
54
  interface MnexiumConfig {
40
55
  /** Mnexium API key. If omitted, a trial key will be auto-provisioned. */
@@ -82,6 +97,10 @@ interface ChatSessionOptions {
82
97
  temperature?: number;
83
98
  /** Custom metadata attached to saved logs */
84
99
  metadata?: Record<string, unknown>;
100
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
101
+ memoryPolicy?: string | false;
102
+ /** Records extraction/recall behavior */
103
+ records?: MnxRecordsConfig;
85
104
  }
86
105
  /** Options for creating a Chat */
87
106
  interface ChatOptions {
@@ -109,6 +128,10 @@ interface ChatOptions {
109
128
  temperature?: number;
110
129
  /** Custom metadata attached to saved logs */
111
130
  metadata?: Record<string, unknown>;
131
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
132
+ memoryPolicy?: string | false;
133
+ /** Records extraction/recall behavior */
134
+ records?: MnxRecordsConfig;
112
135
  }
113
136
  /** Options for listing chat history */
114
137
  interface ChatHistoryListOptions {
@@ -160,6 +183,10 @@ interface ChatProcessOptions {
160
183
  metadata?: Record<string, unknown>;
161
184
  /** Force regenerate trial key */
162
185
  regenerateKey?: boolean;
186
+ /** Override memory policy: policy ID string, or false to disable policy for this request */
187
+ memoryPolicy?: string | false;
188
+ /** Override records extraction/recall behavior */
189
+ records?: MnxRecordsConfig;
163
190
  }
164
191
  /** Options for the simplified process() API */
165
192
  interface ProcessOptions {
@@ -195,6 +222,10 @@ interface ProcessOptions {
195
222
  metadata?: Record<string, unknown>;
196
223
  /** Force regenerate trial key (for key recovery) */
197
224
  regenerateKey?: boolean;
225
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
226
+ memoryPolicy?: string | false;
227
+ /** Records extraction/recall behavior */
228
+ records?: MnxRecordsConfig;
198
229
  }
199
230
  /** Response from process() */
200
231
  interface ProcessResponse {
@@ -216,6 +247,8 @@ interface ProcessResponse {
216
247
  provisionedKey?: string;
217
248
  /** Claim URL for trial key */
218
249
  claimUrl?: string;
250
+ /** Records extraction result metadata when sync records mode is enabled */
251
+ records?: unknown;
219
252
  /** Full raw response (for advanced use) */
220
253
  raw: ChatCompletionResponse;
221
254
  }
@@ -258,6 +291,10 @@ interface MnxOptions {
258
291
  metadata?: Record<string, unknown>;
259
292
  /** Force regenerate trial key (for key recovery) */
260
293
  regenerateKey?: boolean;
294
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
295
+ memoryPolicy?: string | false;
296
+ /** Records configuration */
297
+ records?: MnxRecordsConfig;
261
298
  }
262
299
  interface ChatCompletionOptions extends MnxOptions {
263
300
  /** Model to use (e.g., 'gpt-4o-mini', 'claude-3-sonnet', 'gemini-1.5-pro') */
@@ -296,6 +333,7 @@ interface MnxResponseData {
296
333
  subject_id: string;
297
334
  provisioned_key?: string;
298
335
  claim_url?: string;
336
+ records?: unknown;
299
337
  }
300
338
  interface ChatCompletionResponse {
301
339
  id: string;
@@ -419,6 +457,74 @@ interface SystemPromptCreateOptions {
419
457
  /** Set as default prompt for the project */
420
458
  isDefault?: boolean;
421
459
  }
460
+ /** A record schema definition */
461
+ interface RecordSchema {
462
+ project_id: string;
463
+ type_name: string;
464
+ fields: Record<string, RecordFieldDef>;
465
+ display_name?: string;
466
+ description?: string;
467
+ created_at: string;
468
+ updated_at: string;
469
+ }
470
+ /** A field definition within a record schema */
471
+ interface RecordFieldDef {
472
+ type: string;
473
+ required?: boolean;
474
+ description?: string;
475
+ display_name?: string;
476
+ }
477
+ /** Options for defining a record schema */
478
+ interface RecordSchemaDefineOptions {
479
+ /** Record type name (e.g. 'deal', 'contact') */
480
+ typeName: string;
481
+ /** Field definitions */
482
+ fields: Record<string, RecordFieldDef>;
483
+ /** Human-readable display name */
484
+ displayName?: string;
485
+ /** Description of this record type */
486
+ description?: string;
487
+ }
488
+ /** A record instance */
489
+ interface MnxRecord {
490
+ record_id: string;
491
+ project_id: string;
492
+ type_name: string;
493
+ owner_id?: string;
494
+ visibility: 'public' | 'private';
495
+ collaborators?: string[];
496
+ data: globalThis.Record<string, unknown>;
497
+ summary_text?: string;
498
+ is_deleted?: boolean;
499
+ created_at: string;
500
+ updated_at: string;
501
+ }
502
+ /** Options for inserting a record */
503
+ interface RecordInsertOptions {
504
+ /** Record data */
505
+ data: globalThis.Record<string, unknown>;
506
+ /** Owner subject ID */
507
+ ownerId?: string;
508
+ /** Visibility: 'public' (default) or 'private' */
509
+ visibility?: 'public' | 'private';
510
+ /** Subject IDs with write access (in addition to the owner) */
511
+ collaborators?: string[];
512
+ }
513
+ /** Options for querying records */
514
+ interface RecordQueryOptions {
515
+ /** JSONB field filters */
516
+ where?: globalThis.Record<string, unknown>;
517
+ /** Order by field (prefix with - for DESC) */
518
+ orderBy?: string;
519
+ /** Maximum results */
520
+ limit?: number;
521
+ /** Offset for pagination */
522
+ offset?: number;
523
+ }
524
+ /** A record search result with similarity score */
525
+ interface RecordSearchResult extends MnxRecord {
526
+ similarity: number;
527
+ }
422
528
 
423
529
  /**
424
530
  * Streaming support for Mnexium SDK
@@ -597,6 +703,7 @@ declare class SubjectMemoriesResource {
597
703
  source?: string;
598
704
  visibility?: 'private' | 'shared';
599
705
  metadata?: Record<string, unknown>;
706
+ no_supersede?: boolean;
600
707
  }): Promise<any>;
601
708
  list(options?: {
602
709
  limit?: number;
@@ -731,7 +838,13 @@ declare class ChatResource {
731
838
  declare class ChatCompletionsResource {
732
839
  private readonly client;
733
840
  constructor(client: Mnexium);
734
- create(options: ChatCompletionOptions): Promise<ChatCompletionResponse>;
841
+ create(options: ChatCompletionOptions & {
842
+ stream: true;
843
+ }): Promise<StreamResponse>;
844
+ create(options: ChatCompletionOptions & {
845
+ stream?: false;
846
+ }): Promise<ChatCompletionResponse>;
847
+ create(options: ChatCompletionOptions): Promise<ChatCompletionResponse | StreamResponse>;
735
848
  }
736
849
 
737
850
  /**
@@ -806,6 +919,84 @@ declare class PromptsResource {
806
919
  }): Promise<any>;
807
920
  }
808
921
 
922
+ /**
923
+ * Records Resource - Structured data management API
924
+ */
925
+
926
+ declare class RecordsResource {
927
+ private readonly client;
928
+ constructor(client: Mnexium);
929
+ /**
930
+ * Define or update a record schema
931
+ *
932
+ * @example
933
+ * await mnx.records.defineSchema('deal', {
934
+ * title: { type: 'string', required: true },
935
+ * value: { type: 'number' },
936
+ * stage: { type: 'string' },
937
+ * account_id: { type: 'ref:account' },
938
+ * }, { displayName: 'Deal', description: 'Sales deals' });
939
+ */
940
+ defineSchema(typeName: string, fields: RecordSchemaDefineOptions['fields'], opts?: {
941
+ displayName?: string;
942
+ description?: string;
943
+ }): Promise<RecordSchema>;
944
+ /**
945
+ * Get a schema by type name
946
+ */
947
+ getSchema(typeName: string): Promise<RecordSchema | null>;
948
+ /**
949
+ * List all schemas for the project
950
+ */
951
+ listSchemas(): Promise<RecordSchema[]>;
952
+ /**
953
+ * Insert a new record
954
+ *
955
+ * @example
956
+ * const deal = await mnx.records.insert('deal', {
957
+ * title: 'Acme Renewal',
958
+ * value: 500000,
959
+ * stage: 'negotiation',
960
+ * });
961
+ */
962
+ insert(typeName: string, data: Record<string, unknown>, opts?: Omit<RecordInsertOptions, 'data'>): Promise<MnxRecord>;
963
+ /**
964
+ * Get a record by ID
965
+ */
966
+ get(typeName: string, recordId: string): Promise<MnxRecord | null>;
967
+ /**
968
+ * Update a record (partial merge)
969
+ *
970
+ * @example
971
+ * await mnx.records.update('deal', 'rec_abc', { stage: 'closed_won', value: 550000 });
972
+ */
973
+ update(typeName: string, recordId: string, data: Record<string, unknown>): Promise<MnxRecord>;
974
+ /**
975
+ * Soft-delete a record
976
+ */
977
+ delete(typeName: string, recordId: string): Promise<void>;
978
+ /**
979
+ * Query records with JSONB filters
980
+ *
981
+ * @example
982
+ * const deals = await mnx.records.query('deal', {
983
+ * where: { stage: 'closed_won' },
984
+ * orderBy: '-value',
985
+ * limit: 10,
986
+ * });
987
+ */
988
+ query(typeName: string, opts?: RecordQueryOptions): Promise<MnxRecord[]>;
989
+ /**
990
+ * Semantic search across records
991
+ *
992
+ * @example
993
+ * const results = await mnx.records.search('deal', 'large enterprise renewal');
994
+ */
995
+ search(typeName: string, query: string, opts?: {
996
+ limit?: number;
997
+ }): Promise<RecordSearchResult[]>;
998
+ }
999
+
809
1000
  /**
810
1001
  * Mnexium SDK Client
811
1002
  */
@@ -826,6 +1017,7 @@ declare class Mnexium {
826
1017
  readonly profiles: ProfilesResource;
827
1018
  readonly state: StateResource;
828
1019
  readonly prompts: PromptsResource;
1020
+ readonly records: RecordsResource;
829
1021
  constructor(config?: MnexiumConfig);
830
1022
  /**
831
1023
  * Process a message with Mnexium's memory-enhanced AI
@@ -903,6 +1095,7 @@ declare class Mnexium {
903
1095
  body?: unknown;
904
1096
  headers?: Record<string, string>;
905
1097
  query?: Record<string, string | number | boolean | undefined>;
1098
+ signal?: AbortSignal;
906
1099
  }): Promise<Response>;
907
1100
  /**
908
1101
  * Internal: Make an API request
package/dist/index.d.ts CHANGED
@@ -5,6 +5,17 @@
5
5
  interface ProviderConfig {
6
6
  apiKey: string;
7
7
  }
8
+ type MnxRecordsLearnMode = 'force' | 'auto' | false;
9
+ interface MnxRecordsConfig {
10
+ /** Enable record recall (inject existing records as context) */
11
+ recall?: boolean;
12
+ /** Records extraction mode: "auto" (best effort), "force" (must attempt), false (off) */
13
+ learn?: MnxRecordsLearnMode;
14
+ /** Whether extraction should be synchronous (blocking) */
15
+ sync?: boolean;
16
+ /** Restrict extraction to specific tables */
17
+ tables?: string[];
18
+ }
8
19
  /** Default settings for all process() calls */
9
20
  interface MnexiumDefaults {
10
21
  /** Default model to use */
@@ -35,6 +46,10 @@ interface MnexiumDefaults {
35
46
  temperature?: number;
36
47
  /** Force regenerate trial key on every request (for testing) */
37
48
  regenerateKey?: boolean;
49
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
50
+ memoryPolicy?: string | false;
51
+ /** Default records behavior for process/chat requests */
52
+ records?: MnxRecordsConfig;
38
53
  }
39
54
  interface MnexiumConfig {
40
55
  /** Mnexium API key. If omitted, a trial key will be auto-provisioned. */
@@ -82,6 +97,10 @@ interface ChatSessionOptions {
82
97
  temperature?: number;
83
98
  /** Custom metadata attached to saved logs */
84
99
  metadata?: Record<string, unknown>;
100
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
101
+ memoryPolicy?: string | false;
102
+ /** Records extraction/recall behavior */
103
+ records?: MnxRecordsConfig;
85
104
  }
86
105
  /** Options for creating a Chat */
87
106
  interface ChatOptions {
@@ -109,6 +128,10 @@ interface ChatOptions {
109
128
  temperature?: number;
110
129
  /** Custom metadata attached to saved logs */
111
130
  metadata?: Record<string, unknown>;
131
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
132
+ memoryPolicy?: string | false;
133
+ /** Records extraction/recall behavior */
134
+ records?: MnxRecordsConfig;
112
135
  }
113
136
  /** Options for listing chat history */
114
137
  interface ChatHistoryListOptions {
@@ -160,6 +183,10 @@ interface ChatProcessOptions {
160
183
  metadata?: Record<string, unknown>;
161
184
  /** Force regenerate trial key */
162
185
  regenerateKey?: boolean;
186
+ /** Override memory policy: policy ID string, or false to disable policy for this request */
187
+ memoryPolicy?: string | false;
188
+ /** Override records extraction/recall behavior */
189
+ records?: MnxRecordsConfig;
163
190
  }
164
191
  /** Options for the simplified process() API */
165
192
  interface ProcessOptions {
@@ -195,6 +222,10 @@ interface ProcessOptions {
195
222
  metadata?: Record<string, unknown>;
196
223
  /** Force regenerate trial key (for key recovery) */
197
224
  regenerateKey?: boolean;
225
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
226
+ memoryPolicy?: string | false;
227
+ /** Records extraction/recall behavior */
228
+ records?: MnxRecordsConfig;
198
229
  }
199
230
  /** Response from process() */
200
231
  interface ProcessResponse {
@@ -216,6 +247,8 @@ interface ProcessResponse {
216
247
  provisionedKey?: string;
217
248
  /** Claim URL for trial key */
218
249
  claimUrl?: string;
250
+ /** Records extraction result metadata when sync records mode is enabled */
251
+ records?: unknown;
219
252
  /** Full raw response (for advanced use) */
220
253
  raw: ChatCompletionResponse;
221
254
  }
@@ -258,6 +291,10 @@ interface MnxOptions {
258
291
  metadata?: Record<string, unknown>;
259
292
  /** Force regenerate trial key (for key recovery) */
260
293
  regenerateKey?: boolean;
294
+ /** Memory policy override: policy ID string, or false to disable policy for this request */
295
+ memoryPolicy?: string | false;
296
+ /** Records configuration */
297
+ records?: MnxRecordsConfig;
261
298
  }
262
299
  interface ChatCompletionOptions extends MnxOptions {
263
300
  /** Model to use (e.g., 'gpt-4o-mini', 'claude-3-sonnet', 'gemini-1.5-pro') */
@@ -296,6 +333,7 @@ interface MnxResponseData {
296
333
  subject_id: string;
297
334
  provisioned_key?: string;
298
335
  claim_url?: string;
336
+ records?: unknown;
299
337
  }
300
338
  interface ChatCompletionResponse {
301
339
  id: string;
@@ -419,6 +457,74 @@ interface SystemPromptCreateOptions {
419
457
  /** Set as default prompt for the project */
420
458
  isDefault?: boolean;
421
459
  }
460
+ /** A record schema definition */
461
+ interface RecordSchema {
462
+ project_id: string;
463
+ type_name: string;
464
+ fields: Record<string, RecordFieldDef>;
465
+ display_name?: string;
466
+ description?: string;
467
+ created_at: string;
468
+ updated_at: string;
469
+ }
470
+ /** A field definition within a record schema */
471
+ interface RecordFieldDef {
472
+ type: string;
473
+ required?: boolean;
474
+ description?: string;
475
+ display_name?: string;
476
+ }
477
+ /** Options for defining a record schema */
478
+ interface RecordSchemaDefineOptions {
479
+ /** Record type name (e.g. 'deal', 'contact') */
480
+ typeName: string;
481
+ /** Field definitions */
482
+ fields: Record<string, RecordFieldDef>;
483
+ /** Human-readable display name */
484
+ displayName?: string;
485
+ /** Description of this record type */
486
+ description?: string;
487
+ }
488
+ /** A record instance */
489
+ interface MnxRecord {
490
+ record_id: string;
491
+ project_id: string;
492
+ type_name: string;
493
+ owner_id?: string;
494
+ visibility: 'public' | 'private';
495
+ collaborators?: string[];
496
+ data: globalThis.Record<string, unknown>;
497
+ summary_text?: string;
498
+ is_deleted?: boolean;
499
+ created_at: string;
500
+ updated_at: string;
501
+ }
502
+ /** Options for inserting a record */
503
+ interface RecordInsertOptions {
504
+ /** Record data */
505
+ data: globalThis.Record<string, unknown>;
506
+ /** Owner subject ID */
507
+ ownerId?: string;
508
+ /** Visibility: 'public' (default) or 'private' */
509
+ visibility?: 'public' | 'private';
510
+ /** Subject IDs with write access (in addition to the owner) */
511
+ collaborators?: string[];
512
+ }
513
+ /** Options for querying records */
514
+ interface RecordQueryOptions {
515
+ /** JSONB field filters */
516
+ where?: globalThis.Record<string, unknown>;
517
+ /** Order by field (prefix with - for DESC) */
518
+ orderBy?: string;
519
+ /** Maximum results */
520
+ limit?: number;
521
+ /** Offset for pagination */
522
+ offset?: number;
523
+ }
524
+ /** A record search result with similarity score */
525
+ interface RecordSearchResult extends MnxRecord {
526
+ similarity: number;
527
+ }
422
528
 
423
529
  /**
424
530
  * Streaming support for Mnexium SDK
@@ -597,6 +703,7 @@ declare class SubjectMemoriesResource {
597
703
  source?: string;
598
704
  visibility?: 'private' | 'shared';
599
705
  metadata?: Record<string, unknown>;
706
+ no_supersede?: boolean;
600
707
  }): Promise<any>;
601
708
  list(options?: {
602
709
  limit?: number;
@@ -731,7 +838,13 @@ declare class ChatResource {
731
838
  declare class ChatCompletionsResource {
732
839
  private readonly client;
733
840
  constructor(client: Mnexium);
734
- create(options: ChatCompletionOptions): Promise<ChatCompletionResponse>;
841
+ create(options: ChatCompletionOptions & {
842
+ stream: true;
843
+ }): Promise<StreamResponse>;
844
+ create(options: ChatCompletionOptions & {
845
+ stream?: false;
846
+ }): Promise<ChatCompletionResponse>;
847
+ create(options: ChatCompletionOptions): Promise<ChatCompletionResponse | StreamResponse>;
735
848
  }
736
849
 
737
850
  /**
@@ -806,6 +919,84 @@ declare class PromptsResource {
806
919
  }): Promise<any>;
807
920
  }
808
921
 
922
+ /**
923
+ * Records Resource - Structured data management API
924
+ */
925
+
926
+ declare class RecordsResource {
927
+ private readonly client;
928
+ constructor(client: Mnexium);
929
+ /**
930
+ * Define or update a record schema
931
+ *
932
+ * @example
933
+ * await mnx.records.defineSchema('deal', {
934
+ * title: { type: 'string', required: true },
935
+ * value: { type: 'number' },
936
+ * stage: { type: 'string' },
937
+ * account_id: { type: 'ref:account' },
938
+ * }, { displayName: 'Deal', description: 'Sales deals' });
939
+ */
940
+ defineSchema(typeName: string, fields: RecordSchemaDefineOptions['fields'], opts?: {
941
+ displayName?: string;
942
+ description?: string;
943
+ }): Promise<RecordSchema>;
944
+ /**
945
+ * Get a schema by type name
946
+ */
947
+ getSchema(typeName: string): Promise<RecordSchema | null>;
948
+ /**
949
+ * List all schemas for the project
950
+ */
951
+ listSchemas(): Promise<RecordSchema[]>;
952
+ /**
953
+ * Insert a new record
954
+ *
955
+ * @example
956
+ * const deal = await mnx.records.insert('deal', {
957
+ * title: 'Acme Renewal',
958
+ * value: 500000,
959
+ * stage: 'negotiation',
960
+ * });
961
+ */
962
+ insert(typeName: string, data: Record<string, unknown>, opts?: Omit<RecordInsertOptions, 'data'>): Promise<MnxRecord>;
963
+ /**
964
+ * Get a record by ID
965
+ */
966
+ get(typeName: string, recordId: string): Promise<MnxRecord | null>;
967
+ /**
968
+ * Update a record (partial merge)
969
+ *
970
+ * @example
971
+ * await mnx.records.update('deal', 'rec_abc', { stage: 'closed_won', value: 550000 });
972
+ */
973
+ update(typeName: string, recordId: string, data: Record<string, unknown>): Promise<MnxRecord>;
974
+ /**
975
+ * Soft-delete a record
976
+ */
977
+ delete(typeName: string, recordId: string): Promise<void>;
978
+ /**
979
+ * Query records with JSONB filters
980
+ *
981
+ * @example
982
+ * const deals = await mnx.records.query('deal', {
983
+ * where: { stage: 'closed_won' },
984
+ * orderBy: '-value',
985
+ * limit: 10,
986
+ * });
987
+ */
988
+ query(typeName: string, opts?: RecordQueryOptions): Promise<MnxRecord[]>;
989
+ /**
990
+ * Semantic search across records
991
+ *
992
+ * @example
993
+ * const results = await mnx.records.search('deal', 'large enterprise renewal');
994
+ */
995
+ search(typeName: string, query: string, opts?: {
996
+ limit?: number;
997
+ }): Promise<RecordSearchResult[]>;
998
+ }
999
+
809
1000
  /**
810
1001
  * Mnexium SDK Client
811
1002
  */
@@ -826,6 +1017,7 @@ declare class Mnexium {
826
1017
  readonly profiles: ProfilesResource;
827
1018
  readonly state: StateResource;
828
1019
  readonly prompts: PromptsResource;
1020
+ readonly records: RecordsResource;
829
1021
  constructor(config?: MnexiumConfig);
830
1022
  /**
831
1023
  * Process a message with Mnexium's memory-enhanced AI
@@ -903,6 +1095,7 @@ declare class Mnexium {
903
1095
  body?: unknown;
904
1096
  headers?: Record<string, string>;
905
1097
  query?: Record<string, string | number | boolean | undefined>;
1098
+ signal?: AbortSignal;
906
1099
  }): Promise<Response>;
907
1100
  /**
908
1101
  * Internal: Make an API request