@synapcores/sdk 0.1.0 → 0.2.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/dist/index.d.mts CHANGED
@@ -95,7 +95,11 @@ interface SubscriptionOptions {
95
95
  }
96
96
 
97
97
  /**
98
- * Real-time subscription support for SynapCores SDK
98
+ * Real-time subscription support for SynapCores SDK.
99
+ *
100
+ * v0.2.0: WebSocket auth uses the ticket exchange flow.
101
+ * 1. POST /v1/ws/ticket -> {token, expiresAt}
102
+ * 2. Open `ws://host:port/ws?token={ticket}` (note: root /ws, not /v1/ws)
99
103
  */
100
104
 
101
105
  declare class Subscription extends EventEmitter {
@@ -247,6 +251,9 @@ interface ListTrainingJobsOptions {
247
251
 
248
252
  /**
249
253
  * AutoML client for SynapCores SDK
254
+ *
255
+ * v0.2.0: paths migrated from /ai/* to /automl/* to match gateway
256
+ * v1.5.0-ce. Async training is just /automl/train + polling /automl/jobs/:id.
250
257
  */
251
258
 
252
259
  declare class AutoMLModel {
@@ -269,7 +276,10 @@ declare class AutoMLClient {
269
276
  status?: string;
270
277
  }): Promise<ModelInfo[]>;
271
278
  /**
272
- * Start async training job
279
+ * Start async training job.
280
+ *
281
+ * In v1.5.0-ce there is no separate /train/async endpoint — /automl/train
282
+ * itself returns a job descriptor when the training is long-running.
273
283
  */
274
284
  trainAsync(options: AsyncTrainOptions): Promise<TrainingJob>;
275
285
  /**
@@ -281,11 +291,15 @@ declare class AutoMLClient {
281
291
  */
282
292
  listTrainingJobs(options?: ListTrainingJobsOptions): Promise<TrainingJob[]>;
283
293
  /**
284
- * Cancel a training job
294
+ * Cancel/stop a training job
285
295
  */
286
296
  cancelTrainingJob(jobId: string): Promise<void>;
287
297
  /**
288
- * Get training metrics for a job
298
+ * Get training metrics for a job.
299
+ *
300
+ * v1.5.0-ce: gateway no longer has a dedicated /metrics route — metrics
301
+ * (when available) ship inside the /automl/jobs/:id payload as
302
+ * `metrics` or `trial_metrics`. We just unwrap that field here.
289
303
  */
290
304
  getTrainingMetrics(jobId: string): Promise<TrainingMetrics[]>;
291
305
  /**
@@ -296,6 +310,7 @@ declare class AutoMLClient {
296
310
  timeout?: number;
297
311
  onProgress?: (job: TrainingJob) => void;
298
312
  }): Promise<AutoMLModel>;
313
+ private mapTrainingJob;
299
314
  }
300
315
 
301
316
  /**
@@ -322,7 +337,7 @@ interface NLPAnalysis {
322
337
  }
323
338
  interface AnalyzeOptions {
324
339
  text: string | string[];
325
- tasks?: Array<'sentiment' | 'entities' | 'summary' | 'keywords'>;
340
+ tasks?: Array<'sentiment' | 'entities' | 'summary' | 'summarize' | 'keywords'>;
326
341
  language?: string;
327
342
  }
328
343
  interface SummarizeOptions {
@@ -337,17 +352,36 @@ interface ClassifyOptions {
337
352
  }
338
353
 
339
354
  /**
340
- * NLP client for SynapCores SDK
355
+ * NLP client for SynapCores SDK.
356
+ *
357
+ * v0.2.0: replaced /ai/analyze (which never existed in v1.5.0-ce) with a
358
+ * client-side fan-out to /ai/sentiment + /ai/entities + /ai/summarize.
359
+ * Added qa() for question-answering against the new /ai/qa route.
341
360
  */
342
361
 
343
362
  declare class NLPClient {
344
363
  private readonly synapCores;
345
364
  constructor(synapCores: SynapCores);
365
+ /**
366
+ * Run multiple NLP tasks in parallel and stitch them into a single
367
+ * NLPAnalysis (or array of them, matching the input shape).
368
+ */
346
369
  analyze(options: AnalyzeOptions): Promise<NLPAnalysis | NLPAnalysis[]>;
347
370
  summarize(options: SummarizeOptions): Promise<string>;
348
371
  extractEntities(text: string, entityTypes?: string[]): Promise<Entity[]>;
349
372
  sentiment(text: string | string[]): Promise<Sentiment | Sentiment[]>;
350
373
  classify(options: ClassifyOptions): Promise<Record<string, number> | Record<string, number>[]>;
374
+ /**
375
+ * Question-answering against an optional context window.
376
+ */
377
+ qa(question: string, context?: string, opts?: {
378
+ maxAnswerTokens?: number;
379
+ }): Promise<{
380
+ answer: string;
381
+ score?: number;
382
+ start?: number;
383
+ end?: number;
384
+ }>;
351
385
  }
352
386
 
353
387
  /**
@@ -496,9 +530,56 @@ declare class RecipeClient {
496
530
  */
497
531
  generate(options: GenerateRecipeOptions): Promise<GeneratedRecipe>;
498
532
  /**
499
- * List available recipe categories
533
+ * List available recipe categories with counts.
534
+ *
535
+ * v0.2.0: gateway path is /recipes/categories/counts.
536
+ * Returns the array of category names; for the {category, count}
537
+ * payload use `listCategoriesWithCounts`.
500
538
  */
501
539
  listCategories(): Promise<string[]>;
540
+ listCategoriesWithCounts(): Promise<Array<{
541
+ category: string;
542
+ count: number;
543
+ }>>;
544
+ /**
545
+ * Validate a recipe payload before saving/executing.
546
+ */
547
+ validate(body: {
548
+ content?: string;
549
+ recipe?: any;
550
+ parameters?: Record<string, any>;
551
+ }): Promise<{
552
+ is_valid: boolean;
553
+ errors: string[];
554
+ warnings: string[];
555
+ }>;
556
+ /**
557
+ * Get execution history for a specific recipe.
558
+ */
559
+ getHistory(id: string): Promise<RecipeExecutionResult[]>;
560
+ /**
561
+ * List built-in / shared recipe templates.
562
+ */
563
+ listTemplates(): Promise<RecipeInfo[]>;
564
+ /**
565
+ * Get a specific recipe template.
566
+ */
567
+ getTemplate(id: string): Promise<Recipe>;
568
+ /**
569
+ * Execute a recipe template with a parameter set.
570
+ */
571
+ executeTemplate(id: string, params?: Record<string, any>): Promise<RecipeExecutionResult>;
572
+ /**
573
+ * List all recipe executions across recipes.
574
+ */
575
+ listExecutions(options?: {
576
+ limit?: number;
577
+ status?: string;
578
+ }): Promise<RecipeExecutionResult[]>;
579
+ /**
580
+ * Get a single execution by ID.
581
+ */
582
+ getExecution(id: string): Promise<RecipeExecutionResult>;
502
583
  }
503
584
 
504
585
  /**
@@ -658,59 +739,66 @@ interface ValidationWarning$1 {
658
739
  }
659
740
 
660
741
  /**
661
- * Schema Introspection Client for SynapCores SDK
742
+ * Schema Introspection Client for SynapCores SDK.
743
+ *
744
+ * v0.2.0: trimmed to match gateway v1.5.0-ce. Removed
745
+ * getRelationships(), getStatistics(), validateSchema(), compareSchemas(),
746
+ * analyzeTable() and generateDDL() — none of those endpoints exist in the
747
+ * v1.5.0-ce gateway. Added listDatabases() and previewTable().
662
748
  */
663
749
 
750
+ interface DatabaseInfo {
751
+ name: string;
752
+ table_count?: number;
753
+ size_bytes?: number;
754
+ is_default?: boolean;
755
+ }
756
+ interface TableDataPreview {
757
+ columns: Array<{
758
+ name: string;
759
+ data_type?: string;
760
+ }>;
761
+ rows: any[][];
762
+ total_rows?: number;
763
+ }
664
764
  declare class SchemaClient {
665
765
  private readonly synapCores;
666
766
  constructor(synapCores: SynapCores);
667
767
  /**
668
- * List all tables in the database
768
+ * List all databases visible to the current authentication context.
769
+ */
770
+ listDatabases(): Promise<DatabaseInfo[]>;
771
+ /**
772
+ * List all tables in the current database.
669
773
  */
670
774
  listTables(options?: {
671
775
  includeSystem?: boolean;
672
776
  }): Promise<TableInfo$1[]>;
673
777
  /**
674
- * Get complete schema for a specific table
778
+ * Get complete schema for a specific table.
779
+ *
780
+ * Combines /schema/tables/:t with /schema/tables/:t/columns and
781
+ * /schema/tables/:t/indexes side-channels because the table-only payload
782
+ * does not always include columns and indexes inline.
675
783
  */
676
784
  getTable(tableName: string): Promise<TableSchema>;
677
785
  /**
678
- * Get columns for a specific table
786
+ * Get columns for a specific table.
679
787
  */
680
788
  getColumns(tableName: string): Promise<ColumnInfo[]>;
681
789
  /**
682
- * Get indexes for a specific table
790
+ * Get indexes for a specific table.
683
791
  */
684
792
  getIndexes(tableName: string): Promise<IndexInfo[]>;
685
793
  /**
686
- * Get all relationships in the database
687
- */
688
- getRelationships(): Promise<RelationshipInfo[]>;
689
- /**
690
- * Get schema statistics
691
- */
692
- getStatistics(): Promise<SchemaStatistics>;
693
- /**
694
- * Validate a schema definition
794
+ * Preview rows from a table without writing SQL.
795
+ *
796
+ * GET /schema/tables/:t/data?limit=&offset=
695
797
  */
696
- validateSchema(schema: object): Promise<ValidationResult>;
697
- /**
698
- * Compare two schemas
699
- */
700
- compareSchemas(schema1: string | object, schema2: string | object): Promise<{
701
- differences: any[];
702
- added: string[];
703
- removed: string[];
704
- modified: string[];
705
- }>;
706
- /**
707
- * Generate SQL DDL for a table
708
- */
709
- generateDDL(tableName: string): Promise<string>;
710
- /**
711
- * Analyze table and update statistics
712
- */
713
- analyzeTable(tableName: string): Promise<void>;
798
+ previewTable(tableName: string, opts?: {
799
+ limit?: number;
800
+ offset?: number;
801
+ }): Promise<TableDataPreview>;
714
802
  }
715
803
 
716
804
  /**
@@ -912,68 +1000,42 @@ interface ValidationWarning {
912
1000
  }
913
1001
 
914
1002
  /**
915
- * Data Import/Export Client for SynapCores SDK
1003
+ * Data Import Client for SynapCores SDK.
1004
+ *
1005
+ * v0.2.0: gateway v1.5.0-ce only exposes one-shot multipart uploads at
1006
+ * POST /v1/data/import/csv
1007
+ * POST /v1/data/import/json
1008
+ * The legacy /import, /export and job-tracking endpoints no longer exist
1009
+ * — for exports, recommend going through `client.executeQuery` with
1010
+ * `COPY ... TO STDOUT` style SQL.
916
1011
  */
917
1012
 
918
1013
  declare class ImportExportClient {
919
1014
  private readonly synapCores;
920
1015
  constructor(synapCores: SynapCores);
921
1016
  /**
922
- * Import data into a table
1017
+ * Import data into a table.
1018
+ *
1019
+ * Routes to /v1/data/import/csv or /v1/data/import/json based on
1020
+ * `options.format`. NDJSON falls under the JSON endpoint.
923
1021
  */
924
1022
  import(options: ImportOptions): Promise<ImportResult>;
925
- /**
926
- * Export data from a table or query
927
- */
928
- export(options: ExportOptions): Promise<ExportResult>;
929
- /**
930
- * Get import job status
931
- */
932
- getImportStatus(jobId: string): Promise<ImportJobStatus>;
933
- /**
934
- * Get export job status
935
- */
936
- getExportStatus(jobId: string): Promise<ExportJobStatus>;
937
- /**
938
- * Cancel an import job
939
- */
940
- cancelImport(jobId: string): Promise<void>;
941
- /**
942
- * Cancel an export job
943
- */
944
- cancelExport(jobId: string): Promise<void>;
945
- /**
946
- * Import data from multiple sources in bulk
947
- */
948
- bulkImport(options: BulkImportOptions): Promise<BulkImportResult>;
949
- /**
950
- * Validate data before import
951
- */
952
- validateData(options: DataValidationOptions): Promise<DataValidationResult>;
953
- /**
954
- * Get import template for a table
955
- */
956
- getImportTemplate(tableName: string, format?: 'csv' | 'json'): Promise<string>;
957
- /**
958
- * List import/export jobs
959
- */
960
- listJobs(options?: {
1023
+ export(_options: ExportOptions): Promise<ExportResult>;
1024
+ getImportStatus(_jobId: string): Promise<ImportJobStatus>;
1025
+ getExportStatus(_jobId: string): Promise<ExportJobStatus>;
1026
+ cancelImport(_jobId: string): Promise<void>;
1027
+ cancelExport(_jobId: string): Promise<void>;
1028
+ bulkImport(_options: BulkImportOptions): Promise<BulkImportResult>;
1029
+ validateData(_options: DataValidationOptions): Promise<DataValidationResult>;
1030
+ getImportTemplate(_tableName: string, _format?: 'csv' | 'json'): Promise<string>;
1031
+ listJobs(_options?: {
961
1032
  type?: 'import' | 'export';
962
1033
  status?: string;
963
1034
  limit?: number;
964
1035
  }): Promise<Array<ImportJobStatus | ExportJobStatus>>;
965
- /**
966
- * Download exported data
967
- */
968
- downloadExport(jobId: string): Promise<Buffer>;
969
- /**
970
- * Stream import data (for large files)
971
- */
972
- streamImport(options: ImportOptions, onProgress?: (progress: ImportJobStatus) => void): Promise<ImportResult>;
973
- /**
974
- * Stream export data (for large datasets)
975
- */
976
- streamExport(options: ExportOptions, onProgress?: (progress: ExportJobStatus) => void): Promise<ExportResult>;
1036
+ downloadExport(_jobId: string): Promise<Buffer>;
1037
+ streamImport(options: ImportOptions, _onProgress?: (progress: ImportJobStatus) => void): Promise<ImportResult>;
1038
+ streamExport(_options: ExportOptions, _onProgress?: (progress: ExportJobStatus) => void): Promise<ExportResult>;
977
1039
  }
978
1040
 
979
1041
  /**
@@ -1221,91 +1283,90 @@ interface TestIntegrationResult {
1221
1283
  }
1222
1284
 
1223
1285
  /**
1224
- * Integration Management Client for SynapCores SDK
1286
+ * Integration Management Client for SynapCores SDK.
1287
+ *
1288
+ * v0.2.0: gateway v1.5.0-ce uses {integration_type} (a slug) as the path
1289
+ * parameter, not arbitrary IDs. Webhooks, stats, logs, events and
1290
+ * execution history routes do not exist on the gateway, so those methods
1291
+ * now throw a ValidationError. New methods: listTypes() and audit().
1225
1292
  */
1226
1293
 
1294
+ interface IntegrationTypeInfo {
1295
+ type: string;
1296
+ display_name?: string;
1297
+ description?: string;
1298
+ config_schema?: any;
1299
+ }
1300
+ interface IntegrationAuditEntry {
1301
+ id?: string;
1302
+ type: string;
1303
+ action: string;
1304
+ user?: string;
1305
+ timestamp: Date;
1306
+ details?: any;
1307
+ }
1227
1308
  declare class IntegrationClient {
1228
1309
  private readonly synapCores;
1229
1310
  constructor(synapCores: SynapCores);
1230
1311
  /**
1231
- * Create a new integration
1312
+ * Create a new integration. Gateway v1.5.0-ce keys integrations by
1313
+ * `type` (slug). The body still carries the type so old call sites
1314
+ * remain backwards compatible.
1232
1315
  */
1233
1316
  create(options: CreateIntegrationOptions): Promise<Integration>;
1234
1317
  /**
1235
- * List integrations with optional filters
1318
+ * List integrations (optional filters).
1236
1319
  */
1237
1320
  list(options?: ListIntegrationsOptions): Promise<Integration[]>;
1238
1321
  /**
1239
- * Get a specific integration by ID
1322
+ * Get a specific integration by type-slug.
1240
1323
  */
1241
- get(id: string): Promise<Integration>;
1324
+ get(type: string): Promise<Integration>;
1242
1325
  /**
1243
- * Update an existing integration
1326
+ * Update an existing integration by type-slug.
1244
1327
  */
1245
- update(id: string, updates: Partial<CreateIntegrationOptions>): Promise<Integration>;
1328
+ update(type: string, updates: Partial<CreateIntegrationOptions>): Promise<Integration>;
1246
1329
  /**
1247
- * Delete an integration
1330
+ * Delete an integration by type-slug.
1248
1331
  */
1249
- delete(id: string): Promise<void>;
1250
- /**
1251
- * Activate an integration
1252
- */
1253
- activate(id: string): Promise<Integration>;
1332
+ delete(type: string): Promise<void>;
1254
1333
  /**
1255
- * Deactivate an integration
1334
+ * Test an integration connection.
1256
1335
  */
1257
- deactivate(id: string): Promise<Integration>;
1258
- /**
1259
- * Execute an integration
1260
- */
1261
- execute(options: ExecuteIntegrationOptions): Promise<IntegrationExecutionResult>;
1336
+ test(options: TestIntegrationOptions): Promise<TestIntegrationResult>;
1262
1337
  /**
1263
- * Test an integration without executing
1338
+ * List supported integration types and their config schemas.
1264
1339
  */
1265
- test(options: TestIntegrationOptions): Promise<TestIntegrationResult>;
1340
+ listTypes(): Promise<IntegrationTypeInfo[]>;
1266
1341
  /**
1267
- * Get integration execution history
1342
+ * Get the integrations audit trail.
1268
1343
  */
1269
- getExecutionHistory(integrationId: string, options?: {
1344
+ audit(options?: {
1345
+ limit?: number;
1346
+ type?: string;
1347
+ }): Promise<IntegrationAuditEntry[]>;
1348
+ activate(_type: string): Promise<Integration>;
1349
+ deactivate(_type: string): Promise<Integration>;
1350
+ execute(_options: ExecuteIntegrationOptions): Promise<IntegrationExecutionResult>;
1351
+ getExecutionHistory(_type: string, _options?: {
1270
1352
  limit?: number;
1271
1353
  offset?: number;
1272
1354
  }): Promise<IntegrationExecutionResult[]>;
1273
- /**
1274
- * Get integration statistics
1275
- */
1276
- getStats(integrationId: string): Promise<IntegrationStats>;
1277
- /**
1278
- * Create a webhook for an integration
1279
- */
1280
- createWebhook(options: CreateWebhookOptions): Promise<IntegrationWebhook>;
1281
- /**
1282
- * List webhooks for an integration
1283
- */
1284
- listWebhooks(integrationId: string): Promise<IntegrationWebhook[]>;
1285
- /**
1286
- * Delete a webhook
1287
- */
1288
- deleteWebhook(webhookId: string): Promise<void>;
1289
- /**
1290
- * Get integration events
1291
- */
1292
- getEvents(integrationId: string, options?: {
1355
+ getStats(_type: string): Promise<IntegrationStats>;
1356
+ createWebhook(_options: CreateWebhookOptions): Promise<IntegrationWebhook>;
1357
+ listWebhooks(_type: string): Promise<IntegrationWebhook[]>;
1358
+ deleteWebhook(_webhookId: string): Promise<void>;
1359
+ getEvents(_type: string, _options?: {
1293
1360
  limit?: number;
1294
1361
  status?: string;
1295
1362
  }): Promise<IntegrationEvent[]>;
1296
- /**
1297
- * Get integration logs
1298
- */
1299
- getLogs(integrationId: string, options?: {
1363
+ getLogs(_type: string, _options?: {
1300
1364
  limit?: number;
1301
1365
  level?: string;
1302
1366
  }): Promise<IntegrationLog[]>;
1367
+ retryExecution(_executionId: string): Promise<IntegrationExecutionResult>;
1303
1368
  /**
1304
- * Retry a failed execution
1305
- */
1306
- retryExecution(executionId: string): Promise<IntegrationExecutionResult>;
1307
- /**
1308
- * Map raw integration data to Integration type
1369
+ * Map raw integration data to Integration type.
1309
1370
  */
1310
1371
  private mapIntegration;
1311
1372
  }
@@ -1595,14 +1656,6 @@ declare class BackupClient {
1595
1656
  * Get restore status
1596
1657
  */
1597
1658
  getRestoreStatus(restoreId: string): Promise<RestoreStatus>;
1598
- /**
1599
- * Cancel a backup in progress
1600
- */
1601
- cancelBackup(backupId: string): Promise<void>;
1602
- /**
1603
- * Cancel a restore in progress
1604
- */
1605
- cancelRestore(restoreId: string): Promise<void>;
1606
1659
  /**
1607
1660
  * Download a backup file
1608
1661
  */
@@ -1639,16 +1692,784 @@ declare class BackupClient {
1639
1692
  * Deactivate a schedule
1640
1693
  */
1641
1694
  deactivateSchedule(scheduleId: string): Promise<BackupSchedule>;
1642
- /**
1643
- * Get backup metrics
1644
- */
1645
- getMetrics(): Promise<BackupMetrics>;
1646
1695
  /**
1647
1696
  * Map raw backup data to Backup type
1648
1697
  */
1649
1698
  private mapBackup;
1650
1699
  }
1651
1700
 
1701
+ /**
1702
+ * Graph database type definitions (v1.5.0-ce).
1703
+ */
1704
+ interface GraphNode {
1705
+ id: string;
1706
+ label?: string;
1707
+ labels?: string[];
1708
+ properties?: Record<string, any>;
1709
+ }
1710
+ interface GraphEdge {
1711
+ id?: string;
1712
+ from: string;
1713
+ to: string;
1714
+ type: string;
1715
+ properties?: Record<string, any>;
1716
+ }
1717
+ interface CypherResult {
1718
+ columns?: string[];
1719
+ rows: any[][];
1720
+ records?: Array<Record<string, any>>;
1721
+ stats?: Record<string, any>;
1722
+ /** Server-side execution time, when reported. */
1723
+ execution_time_ms?: number;
1724
+ }
1725
+ interface CypherProfileResult extends CypherResult {
1726
+ plan?: any;
1727
+ profile?: any;
1728
+ }
1729
+ type GraphAlgorithmName = 'page_rank' | 'louvain' | 'label_propagation' | 'triangle_count';
1730
+ interface GraphAlgorithmRequest {
1731
+ graph?: string;
1732
+ /** Free-form algorithm parameters (max iterations, damping etc). */
1733
+ params?: Record<string, any>;
1734
+ /** Optional projection of subgraph to operate over. */
1735
+ node_filter?: string;
1736
+ edge_filter?: string;
1737
+ }
1738
+ interface GraphAlgorithmResult {
1739
+ algorithm: GraphAlgorithmName;
1740
+ results: any;
1741
+ stats?: Record<string, any>;
1742
+ execution_time_ms?: number;
1743
+ }
1744
+ interface GraphSummary {
1745
+ name: string;
1746
+ node_count?: number;
1747
+ edge_count?: number;
1748
+ created_at?: Date;
1749
+ description?: string;
1750
+ }
1751
+ interface GraphExtractRequest {
1752
+ text: string;
1753
+ graph?: string;
1754
+ schema?: any;
1755
+ model?: string;
1756
+ }
1757
+ interface GraphExtractResult {
1758
+ nodes: GraphNode[];
1759
+ edges: GraphEdge[];
1760
+ /** Optional source-text spans used for provenance. */
1761
+ spans?: Array<{
1762
+ start: number;
1763
+ end: number;
1764
+ text: string;
1765
+ }>;
1766
+ }
1767
+
1768
+ /**
1769
+ * Graph database client for SynapCores SDK (v1.5.0-ce).
1770
+ */
1771
+
1772
+ declare class GraphNodeApi {
1773
+ private readonly synapCores;
1774
+ constructor(synapCores: SynapCores);
1775
+ create(label: string, props?: Record<string, any>): Promise<GraphNode>;
1776
+ get(id: string): Promise<GraphNode>;
1777
+ update(id: string, patch: Record<string, any>): Promise<GraphNode>;
1778
+ delete(id: string): Promise<void>;
1779
+ neighbors(id: string, opts?: {
1780
+ direction?: 'in' | 'out' | 'both';
1781
+ limit?: number;
1782
+ type?: string;
1783
+ }): Promise<{
1784
+ nodes: GraphNode[];
1785
+ edges: GraphEdge[];
1786
+ }>;
1787
+ private normalize;
1788
+ private normalizeEdge;
1789
+ }
1790
+ declare class GraphEdgeApi {
1791
+ private readonly synapCores;
1792
+ constructor(synapCores: SynapCores);
1793
+ create(from: string, to: string, type: string, props?: Record<string, any>): Promise<GraphEdge>;
1794
+ }
1795
+ declare class GraphIndexesApi {
1796
+ private readonly synapCores;
1797
+ constructor(synapCores: SynapCores);
1798
+ /**
1799
+ * Create a graph index (label/property index, fulltext, or vector
1800
+ * depending on the gateway's accepted DDL strings).
1801
+ */
1802
+ create(stmt: string): Promise<{
1803
+ name?: string;
1804
+ raw: any;
1805
+ }>;
1806
+ }
1807
+ declare class GraphAlgorithmsApi {
1808
+ private readonly synapCores;
1809
+ constructor(synapCores: SynapCores);
1810
+ run(name: GraphAlgorithmName, opts?: GraphAlgorithmRequest): Promise<GraphAlgorithmResult>;
1811
+ }
1812
+ declare class GraphsApi {
1813
+ private readonly synapCores;
1814
+ constructor(synapCores: SynapCores);
1815
+ list(): Promise<GraphSummary[]>;
1816
+ create(name: string, opts?: {
1817
+ description?: string;
1818
+ }): Promise<GraphSummary>;
1819
+ get(name: string): Promise<GraphSummary>;
1820
+ delete(name: string): Promise<void>;
1821
+ private normalize;
1822
+ }
1823
+ declare class GraphClient {
1824
+ private readonly synapCores;
1825
+ readonly nodes: GraphNodeApi;
1826
+ readonly edges: GraphEdgeApi;
1827
+ readonly indexes: GraphIndexesApi;
1828
+ readonly algorithms: GraphAlgorithmsApi;
1829
+ readonly graphs: GraphsApi;
1830
+ constructor(synapCores: SynapCores);
1831
+ /**
1832
+ * Run a Cypher / MATCH query.
1833
+ */
1834
+ cypher(query: string, params?: Record<string, any>, graph?: string): Promise<CypherResult>;
1835
+ /**
1836
+ * Profile a Cypher / MATCH query (returns plan/profile metadata).
1837
+ */
1838
+ cypherProfile(query: string, params?: Record<string, any>, graph?: string): Promise<CypherProfileResult>;
1839
+ /**
1840
+ * Run LLM-based extraction over text into the given graph.
1841
+ */
1842
+ extract(req: GraphExtractRequest | string, graphName?: string): Promise<GraphExtractResult>;
1843
+ private normalizeCypher;
1844
+ }
1845
+
1846
+ /**
1847
+ * Natural-language-to-SQL type definitions (v1.5.0-ce).
1848
+ */
1849
+ interface Nl2SqlAskOptions {
1850
+ /** Optional database/tenant scope. */
1851
+ database?: string;
1852
+ /** Force a specific dialect when the gateway supports multiple. */
1853
+ dialect?: 'postgres' | 'mysql' | 'aidb';
1854
+ /** Whether to also execute the generated SQL. */
1855
+ execute?: boolean;
1856
+ /** Restrict tables the model is allowed to consider. */
1857
+ tables?: string[];
1858
+ /** Free-form context the model should consider. */
1859
+ context?: string;
1860
+ /** Stable session id for conversational refinement. */
1861
+ session_id?: string;
1862
+ }
1863
+ interface Nl2SqlAskResult {
1864
+ sql: string;
1865
+ /** Confidence/score reported by the model when present. */
1866
+ confidence?: number;
1867
+ /** Server-side row results when execute=true. */
1868
+ rows?: any[][];
1869
+ columns?: Array<{
1870
+ name: string;
1871
+ data_type?: string;
1872
+ }>;
1873
+ /** Execution time when the SQL was run. */
1874
+ execution_time_ms?: number;
1875
+ /** Raw structured trace from the model (planner output etc). */
1876
+ trace?: any;
1877
+ /** Echo of the question for downstream logging. */
1878
+ question?: string;
1879
+ }
1880
+ interface Nl2SqlSchemaContext {
1881
+ /** A flat description of the schema or a structured payload. */
1882
+ description?: string;
1883
+ tables?: Array<{
1884
+ name: string;
1885
+ columns: Array<{
1886
+ name: string;
1887
+ data_type: string;
1888
+ description?: string;
1889
+ }>;
1890
+ description?: string;
1891
+ }>;
1892
+ /** Free-form examples the model can reason over. */
1893
+ examples?: Array<{
1894
+ question: string;
1895
+ sql: string;
1896
+ }>;
1897
+ }
1898
+ interface Nl2SqlHistoryEntry {
1899
+ id: string;
1900
+ question: string;
1901
+ sql: string;
1902
+ created_at: Date;
1903
+ executed?: boolean;
1904
+ success?: boolean;
1905
+ }
1906
+ interface Nl2SqlValidateResult {
1907
+ is_valid: boolean;
1908
+ errors: string[];
1909
+ warnings: string[];
1910
+ /** Server-rewritten SQL when the validator made adjustments. */
1911
+ rewritten_sql?: string;
1912
+ }
1913
+
1914
+ /**
1915
+ * Natural-language-to-SQL client for SynapCores SDK (v1.5.0-ce).
1916
+ */
1917
+
1918
+ declare class NL2SqlClient {
1919
+ private readonly synapCores;
1920
+ constructor(synapCores: SynapCores);
1921
+ /**
1922
+ * Ask a question in natural language. The gateway returns the
1923
+ * generated SQL and optionally the executed result set when
1924
+ * `execute=true`.
1925
+ */
1926
+ ask(question: string, opts?: Nl2SqlAskOptions): Promise<Nl2SqlAskResult>;
1927
+ /**
1928
+ * Push schema context the model should use for subsequent ask() calls.
1929
+ */
1930
+ updateSchemaContext(payload: Nl2SqlSchemaContext): Promise<{
1931
+ accepted: boolean;
1932
+ raw: any;
1933
+ }>;
1934
+ /**
1935
+ * Retrieve recent NL2SQL history for the current authenticated user.
1936
+ */
1937
+ history(opts?: {
1938
+ limit?: number;
1939
+ session_id?: string;
1940
+ }): Promise<Nl2SqlHistoryEntry[]>;
1941
+ /**
1942
+ * Validate a SQL string against the current schema and policies.
1943
+ */
1944
+ validate(sql: string): Promise<Nl2SqlValidateResult>;
1945
+ }
1946
+
1947
+ /**
1948
+ * Filesystem-backed collection type definitions (v1.5.0-ce).
1949
+ */
1950
+ interface FsCollection {
1951
+ id: string;
1952
+ name: string;
1953
+ description?: string;
1954
+ path?: string;
1955
+ status?: string;
1956
+ document_count?: number;
1957
+ created_at?: Date;
1958
+ updated_at?: Date;
1959
+ config?: Record<string, any>;
1960
+ }
1961
+ interface CreateFsCollectionOptions {
1962
+ name: string;
1963
+ path?: string;
1964
+ description?: string;
1965
+ config?: Record<string, any>;
1966
+ watch?: boolean;
1967
+ /** File extensions to ingest. */
1968
+ include_extensions?: string[];
1969
+ }
1970
+ interface FsDocument {
1971
+ id: string;
1972
+ collection_id?: string;
1973
+ filename?: string;
1974
+ path?: string;
1975
+ status?: string;
1976
+ size_bytes?: number;
1977
+ created_at?: Date;
1978
+ updated_at?: Date;
1979
+ }
1980
+ interface FsProgressEvent {
1981
+ type: string;
1982
+ collection_id?: string;
1983
+ document_id?: string;
1984
+ filename?: string;
1985
+ status?: string;
1986
+ progress?: number;
1987
+ message?: string;
1988
+ error?: string;
1989
+ timestamp?: Date;
1990
+ /** Raw payload for forward-compat. */
1991
+ raw?: any;
1992
+ }
1993
+
1994
+ /**
1995
+ * Filesystem-collections client for SynapCores SDK (v1.5.0-ce).
1996
+ *
1997
+ * Routes:
1998
+ * GET/POST /v1/filesystem-collections
1999
+ * GET/PATCH/DELETE /v1/filesystem-collections/:id
2000
+ * GET /v1/filesystem-collections/:id/documents
2001
+ * POST /v1/filesystem-collections/:id/reprocess
2002
+ * WS /ws/filesystem-collections/:id/progress?token=
2003
+ */
2004
+
2005
+ declare class FsCollectionsApi {
2006
+ private readonly synapCores;
2007
+ constructor(synapCores: SynapCores);
2008
+ create(opts: CreateFsCollectionOptions): Promise<FsCollection>;
2009
+ list(): Promise<FsCollection[]>;
2010
+ get(id: string): Promise<FsCollection>;
2011
+ patch(id: string, p: Partial<CreateFsCollectionOptions> & {
2012
+ config?: Record<string, any>;
2013
+ }): Promise<FsCollection>;
2014
+ delete(id: string): Promise<void>;
2015
+ documents(id: string, opts?: {
2016
+ page?: number;
2017
+ page_size?: number;
2018
+ }): Promise<FsDocument[]>;
2019
+ reprocess(id: string, fileId?: string): Promise<{
2020
+ accepted: boolean;
2021
+ raw: any;
2022
+ }>;
2023
+ /**
2024
+ * Stream progress events for an in-flight ingestion. Each tick maps to
2025
+ * a JSON payload broadcast by the gateway over the WS channel. The
2026
+ * iterator ends when the server closes the socket or the consumer
2027
+ * breaks out of the for-await loop.
2028
+ */
2029
+ subscribeProgress(id: string, opts?: {
2030
+ signal?: AbortSignal;
2031
+ }): AsyncIterable<FsProgressEvent>;
2032
+ private normalize;
2033
+ }
2034
+ declare class FilesystemCollectionsClient {
2035
+ readonly collections: FsCollectionsApi;
2036
+ constructor(synapCores: SynapCores);
2037
+ }
2038
+
2039
+ /**
2040
+ * AI chat session type definitions (v1.5.0-ce).
2041
+ */
2042
+ interface ChatSession {
2043
+ id: string;
2044
+ title?: string;
2045
+ model?: string;
2046
+ system_prompt?: string;
2047
+ created_at: Date;
2048
+ updated_at?: Date;
2049
+ message_count?: number;
2050
+ metadata?: Record<string, any>;
2051
+ }
2052
+ interface CreateChatSessionOptions {
2053
+ title?: string;
2054
+ model?: string;
2055
+ system_prompt?: string;
2056
+ /** Tool names the assistant may call. */
2057
+ tools?: string[];
2058
+ metadata?: Record<string, any>;
2059
+ }
2060
+ interface ChatMessage {
2061
+ id: string;
2062
+ session_id: string;
2063
+ role: 'user' | 'assistant' | 'system' | 'tool';
2064
+ content: string;
2065
+ created_at: Date;
2066
+ metadata?: Record<string, any>;
2067
+ }
2068
+ interface SendChatOptions {
2069
+ /** Override the session's model on this turn. */
2070
+ model?: string;
2071
+ temperature?: number;
2072
+ max_tokens?: number;
2073
+ /** Enable tool-use on this turn. */
2074
+ tools?: string[];
2075
+ /** Free-form attachments (image refs, file ids etc). */
2076
+ attachments?: any[];
2077
+ metadata?: Record<string, any>;
2078
+ }
2079
+ interface SendChatResult {
2080
+ message: ChatMessage;
2081
+ /** Optional tool call trace returned by the gateway. */
2082
+ tool_calls?: any[];
2083
+ usage?: {
2084
+ input_tokens?: number;
2085
+ output_tokens?: number;
2086
+ total_tokens?: number;
2087
+ };
2088
+ }
2089
+ interface ChatStreamChunk {
2090
+ /** Text delta for the assistant message. */
2091
+ delta?: string;
2092
+ /** Whole message when the gateway sends consolidated chunks. */
2093
+ content?: string;
2094
+ type?: string;
2095
+ done?: boolean;
2096
+ raw?: any;
2097
+ }
2098
+ interface ChatSuggestion {
2099
+ prompt: string;
2100
+ category?: string;
2101
+ /** Optional bag of metadata the gateway may attach. */
2102
+ meta?: Record<string, any>;
2103
+ }
2104
+ interface ChatSuggestionsOptions {
2105
+ count?: number;
2106
+ context?: string;
2107
+ category?: string;
2108
+ }
2109
+ interface ChatModelInfo {
2110
+ id: string;
2111
+ name?: string;
2112
+ provider?: string;
2113
+ context_window?: number;
2114
+ /** Capabilities flags from the gateway. */
2115
+ capabilities?: string[];
2116
+ }
2117
+ interface ChatSystemPrompt {
2118
+ id: string;
2119
+ name: string;
2120
+ content: string;
2121
+ description?: string;
2122
+ category?: string;
2123
+ }
2124
+ interface ChatTool {
2125
+ name: string;
2126
+ description?: string;
2127
+ parameters?: any;
2128
+ }
2129
+ interface ChatCacheStats {
2130
+ size_bytes?: number;
2131
+ hit_count?: number;
2132
+ miss_count?: number;
2133
+ entries?: number;
2134
+ raw?: any;
2135
+ }
2136
+
2137
+ /**
2138
+ * AI chat client for SynapCores SDK (v1.5.0-ce).
2139
+ *
2140
+ * Wraps:
2141
+ * /v1/ai/sessions, /v1/ai/sessions/:id, /v1/ai/sessions/:id/messages
2142
+ * /v1/ai/chat, /v1/ai/chat/stream (POST)
2143
+ * /v1/ai/suggestions, /v1/ai/models, /v1/ai/system-prompts
2144
+ * /v1/ai/tools, /v1/ai/tools/execute, /v1/ai/tools/sql
2145
+ * /v1/ai/cache/stats, /v1/ai/cache/clear
2146
+ */
2147
+
2148
+ declare class ChatSessionsApi {
2149
+ private readonly synapCores;
2150
+ constructor(synapCores: SynapCores);
2151
+ create(opts?: CreateChatSessionOptions): Promise<ChatSession>;
2152
+ list(opts?: {
2153
+ limit?: number;
2154
+ offset?: number;
2155
+ }): Promise<ChatSession[]>;
2156
+ get(id: string): Promise<ChatSession>;
2157
+ delete(id: string): Promise<void>;
2158
+ messages(id: string, opts?: {
2159
+ limit?: number;
2160
+ offset?: number;
2161
+ }): Promise<ChatMessage[]>;
2162
+ private normalize;
2163
+ private normalizeMessage;
2164
+ }
2165
+ declare class ChatToolsApi {
2166
+ private readonly synapCores;
2167
+ constructor(synapCores: SynapCores);
2168
+ list(): Promise<ChatTool[]>;
2169
+ execute(name: string, args?: Record<string, any>): Promise<any>;
2170
+ sql(sql: string, params?: any[]): Promise<any>;
2171
+ }
2172
+ declare class ChatCacheApi {
2173
+ private readonly synapCores;
2174
+ constructor(synapCores: SynapCores);
2175
+ stats(): Promise<ChatCacheStats>;
2176
+ clear(): Promise<void>;
2177
+ }
2178
+ declare class ChatClient {
2179
+ private readonly synapCores;
2180
+ readonly sessions: ChatSessionsApi;
2181
+ readonly tools: ChatToolsApi;
2182
+ readonly cache: ChatCacheApi;
2183
+ constructor(synapCores: SynapCores);
2184
+ /**
2185
+ * Send a one-shot chat message. The gateway accepts both /ai/chat and
2186
+ * the alias /ai/ — we use /ai/chat for clarity.
2187
+ */
2188
+ send(sessionId: string, content: string, opts?: SendChatOptions): Promise<SendChatResult>;
2189
+ /**
2190
+ * Stream a chat completion. Returns an async iterator over SSE chunks.
2191
+ */
2192
+ stream(sessionId: string, content: string, opts?: SendChatOptions): AsyncIterable<ChatStreamChunk>;
2193
+ /**
2194
+ * Get prompt suggestions, e.g. for an empty session UI.
2195
+ */
2196
+ suggestions(opts?: ChatSuggestionsOptions): Promise<ChatSuggestion[]>;
2197
+ /**
2198
+ * List configured chat models.
2199
+ */
2200
+ models(): Promise<ChatModelInfo[]>;
2201
+ /**
2202
+ * List the available system prompts library.
2203
+ */
2204
+ systemPrompts(): Promise<ChatSystemPrompt[]>;
2205
+ }
2206
+
2207
+ /**
2208
+ * Multimodal search/retrieval type definitions (v1.5.0-ce).
2209
+ */
2210
+ type MultimodalInput = {
2211
+ type: 'text';
2212
+ text: string;
2213
+ } | {
2214
+ type: 'image_url';
2215
+ url: string;
2216
+ } | {
2217
+ type: 'image_base64';
2218
+ data: string;
2219
+ mime_type?: string;
2220
+ } | {
2221
+ type: 'audio_url';
2222
+ url: string;
2223
+ } | {
2224
+ type: 'video_url';
2225
+ url: string;
2226
+ };
2227
+ interface MultimodalSimilarityOptions {
2228
+ metric?: 'cosine' | 'l2' | 'inner_product';
2229
+ model?: string;
2230
+ }
2231
+ interface MultimodalSimilarityResult {
2232
+ similarity: number;
2233
+ metric?: string;
2234
+ /** Optional pair-wise debug payload. */
2235
+ raw?: any;
2236
+ }
2237
+ interface MultimodalSearchOptions {
2238
+ collection?: string;
2239
+ limit?: number;
2240
+ modality?: 'text' | 'image' | 'audio' | 'video' | 'any';
2241
+ filter?: Record<string, any>;
2242
+ model?: string;
2243
+ }
2244
+ interface MultimodalSearchHit {
2245
+ id: string;
2246
+ score: number;
2247
+ modality?: string;
2248
+ metadata?: Record<string, any>;
2249
+ }
2250
+ interface MultimodalJoinOptions {
2251
+ left_modality?: string;
2252
+ right_modality?: string;
2253
+ threshold?: number;
2254
+ limit?: number;
2255
+ model?: string;
2256
+ }
2257
+ interface MultimodalJoinResult {
2258
+ pairs: Array<{
2259
+ left: any;
2260
+ right: any;
2261
+ score: number;
2262
+ }>;
2263
+ }
2264
+ interface MultimodalEmbedResult {
2265
+ embedding: number[];
2266
+ modality?: string;
2267
+ model?: string;
2268
+ dimensions?: number;
2269
+ }
2270
+
2271
+ /**
2272
+ * Multimodal client for SynapCores SDK (v1.5.0-ce).
2273
+ *
2274
+ * Wraps:
2275
+ * POST /v1/multimodal/similarity
2276
+ * POST /v1/multimodal/search
2277
+ * POST /v1/multimodal/join
2278
+ * POST /v1/multimodal/embed
2279
+ */
2280
+
2281
+ declare class MultimodalClient {
2282
+ private readonly synapCores;
2283
+ constructor(synapCores: SynapCores);
2284
+ similarity(a: MultimodalInput | string, b: MultimodalInput | string, opts?: MultimodalSimilarityOptions): Promise<MultimodalSimilarityResult>;
2285
+ search(query: MultimodalInput | string, opts?: MultimodalSearchOptions): Promise<MultimodalSearchHit[]>;
2286
+ join(left: Array<MultimodalInput | string> | {
2287
+ collection: string;
2288
+ }, right: Array<MultimodalInput | string> | {
2289
+ collection: string;
2290
+ }, opts?: MultimodalJoinOptions): Promise<MultimodalJoinResult>;
2291
+ embed(input: MultimodalInput | string, model?: string): Promise<MultimodalEmbedResult>;
2292
+ }
2293
+
2294
+ /**
2295
+ * System / admin type definitions (v1.5.0-ce).
2296
+ */
2297
+ interface VisionConfig {
2298
+ provider?: string;
2299
+ model?: string;
2300
+ api_key?: string;
2301
+ endpoint?: string;
2302
+ /** Free-form provider-specific options. */
2303
+ options?: Record<string, any>;
2304
+ }
2305
+ interface VisionTestResult {
2306
+ success: boolean;
2307
+ latency_ms?: number;
2308
+ /** Sample echoed back from provider when applicable. */
2309
+ response?: any;
2310
+ error?: string;
2311
+ }
2312
+
2313
+ /**
2314
+ * System / admin client for SynapCores SDK (v1.5.0-ce).
2315
+ *
2316
+ * Currently only the vision provider config surface is exposed:
2317
+ * GET/PUT/DELETE /v1/system/vision
2318
+ * POST /v1/system/vision/test
2319
+ */
2320
+
2321
+ declare class VisionApi {
2322
+ private readonly synapCores;
2323
+ constructor(synapCores: SynapCores);
2324
+ get(): Promise<VisionConfig | null>;
2325
+ set(cfg: VisionConfig): Promise<VisionConfig>;
2326
+ delete(): Promise<void>;
2327
+ test(payload?: any): Promise<VisionTestResult>;
2328
+ }
2329
+ declare class SystemClient {
2330
+ readonly vision: VisionApi;
2331
+ constructor(synapCores: SynapCores);
2332
+ }
2333
+
2334
+ /**
2335
+ * Server-side transactions type definitions (v1.5.0-ce).
2336
+ */
2337
+ interface BeginTransactionOptions {
2338
+ isolation_level?: 'READ_UNCOMMITTED' | 'READ_COMMITTED' | 'REPEATABLE_READ' | 'SERIALIZABLE';
2339
+ read_only?: boolean;
2340
+ timeout_secs?: number;
2341
+ database?: string;
2342
+ }
2343
+ interface TxQueryResult {
2344
+ columns: Array<{
2345
+ name: string;
2346
+ data_type?: string;
2347
+ }>;
2348
+ rows: any[][];
2349
+ rows_affected?: number;
2350
+ execution_time_ms?: number;
2351
+ }
2352
+ interface TxHistoryEntry {
2353
+ id: string;
2354
+ status: 'committed' | 'rolled_back' | 'aborted' | string;
2355
+ started_at: Date;
2356
+ completed_at?: Date;
2357
+ isolation_level?: string;
2358
+ read_only?: boolean;
2359
+ statement_count?: number;
2360
+ /** Optional bag of server-reported metrics. */
2361
+ metrics?: Record<string, any>;
2362
+ }
2363
+
2364
+ /**
2365
+ * Server-side transactions client for SynapCores SDK (v1.5.0-ce).
2366
+ *
2367
+ * Wraps:
2368
+ * POST /v1/transactions
2369
+ * GET /v1/transactions/:id
2370
+ * POST /v1/transactions/:id/{execute,commit,rollback,savepoint}
2371
+ * POST /v1/transactions/:id/savepoint/:name/rollback
2372
+ * GET /v1/transactions/history
2373
+ * GET /v1/transactions/history/:id
2374
+ */
2375
+
2376
+ declare class Tx {
2377
+ private readonly http;
2378
+ readonly id: string;
2379
+ readonly options: BeginTransactionOptions;
2380
+ private active;
2381
+ constructor(http: AxiosInstance, id: string, options: BeginTransactionOptions);
2382
+ isActive(): boolean;
2383
+ execute(sql: string, params?: any[]): Promise<TxQueryResult>;
2384
+ commit(): Promise<void>;
2385
+ rollback(): Promise<void>;
2386
+ savepoint(name: string): Promise<void>;
2387
+ rollbackTo(name: string): Promise<void>;
2388
+ private assertActive;
2389
+ }
2390
+ declare class TxHistoryApi {
2391
+ private readonly synapCores;
2392
+ constructor(synapCores: SynapCores);
2393
+ list(opts?: {
2394
+ limit?: number;
2395
+ status?: string;
2396
+ }): Promise<TxHistoryEntry[]>;
2397
+ get(id: string): Promise<TxHistoryEntry>;
2398
+ }
2399
+ declare class TransactionsClient {
2400
+ private readonly synapCores;
2401
+ readonly history: TxHistoryApi;
2402
+ constructor(synapCores: SynapCores);
2403
+ /**
2404
+ * Begin a new server-side transaction.
2405
+ */
2406
+ begin(opts?: BeginTransactionOptions): Promise<Tx>;
2407
+ }
2408
+
2409
+ /**
2410
+ * Model Context Protocol type definitions (v1.5.0-ce).
2411
+ *
2412
+ * The gateway exposes a JSON-RPC-style MCP surface — payloads are
2413
+ * intentionally loose so the SDK does not have to track every server-side
2414
+ * tool schema.
2415
+ */
2416
+ interface McpRequest {
2417
+ /** Request id (jsonrpc-style). Generated client-side if omitted. */
2418
+ id?: string | number;
2419
+ method: string;
2420
+ params?: Record<string, any>;
2421
+ /** Optional MCP version pin. */
2422
+ version?: string;
2423
+ }
2424
+ interface McpResponse<T = any> {
2425
+ id?: string | number;
2426
+ result?: T;
2427
+ error?: {
2428
+ code: number;
2429
+ message: string;
2430
+ data?: any;
2431
+ };
2432
+ /** Raw payload for forward-compat. */
2433
+ raw?: any;
2434
+ }
2435
+ interface McpInfo {
2436
+ version: string;
2437
+ capabilities?: string[];
2438
+ tools?: Array<{
2439
+ name: string;
2440
+ description?: string;
2441
+ }>;
2442
+ /** Forwarded server metadata. */
2443
+ meta?: Record<string, any>;
2444
+ }
2445
+
2446
+ /**
2447
+ * Model Context Protocol (MCP) client for SynapCores SDK (v1.5.0-ce).
2448
+ *
2449
+ * Wraps:
2450
+ * POST /v1/mcp - single JSON-RPC style invocation
2451
+ * POST /v1/mcp/batch - array of invocations in one round-trip
2452
+ * GET /v1/mcp/info - server-side discovery
2453
+ */
2454
+
2455
+ declare class McpClient {
2456
+ private readonly synapCores;
2457
+ constructor(synapCores: SynapCores);
2458
+ /**
2459
+ * Invoke a single MCP method.
2460
+ */
2461
+ invoke<T = any>(req: McpRequest): Promise<McpResponse<T>>;
2462
+ /**
2463
+ * Send an array of MCP invocations and resolve to the matching array
2464
+ * of responses (in the order returned by the gateway).
2465
+ */
2466
+ batch<T = any>(reqs: McpRequest[]): Promise<Array<McpResponse<T>>>;
2467
+ /**
2468
+ * Discover the server's MCP capabilities and tools.
2469
+ */
2470
+ info(): Promise<McpInfo>;
2471
+ }
2472
+
1652
2473
  /**
1653
2474
  * Type definitions for SynapCores client
1654
2475
  */
@@ -2055,7 +2876,36 @@ declare class SynapCores {
2055
2876
  readonly import: ImportExportClient;
2056
2877
  readonly integrations: IntegrationClient;
2057
2878
  readonly backup: BackupClient;
2879
+ readonly graph: GraphClient;
2880
+ readonly nl2sql: NL2SqlClient;
2881
+ readonly filesystem: FilesystemCollectionsClient;
2882
+ readonly chat: ChatClient;
2883
+ readonly multimodal: MultimodalClient;
2884
+ readonly system: SystemClient;
2885
+ readonly transactions: TransactionsClient;
2886
+ readonly mcp: McpClient;
2058
2887
  constructor(config?: SynapCoresConfig);
2888
+ /**
2889
+ * Build the WebSocket base URL (ws:// or wss://).
2890
+ */
2891
+ _getWsBaseUrl(): string;
2892
+ /**
2893
+ * Read-only access to the configured host/port for WS-clients.
2894
+ */
2895
+ _getConfig(): Required<SynapCoresConfig>;
2896
+ /**
2897
+ * Exchange the current credentials (JWT or API key) for a short-lived
2898
+ * WebSocket ticket. Use the returned token as the `?token=` query
2899
+ * param when opening any /ws endpoint.
2900
+ */
2901
+ createWsTicket(): Promise<{
2902
+ token: string;
2903
+ expiresAt: number;
2904
+ }>;
2905
+ /**
2906
+ * Revoke a previously-issued ticket (best-effort).
2907
+ */
2908
+ revokeWsTicket(token: string): Promise<void>;
2059
2909
  private handleError;
2060
2910
  /**
2061
2911
  * Create collection (legacy method for backward compatibility)
@@ -2263,23 +3113,14 @@ declare class SynapCores {
2263
3113
  vectorAdd(vector1: number[], vector2: number[]): Promise<VectorArithmeticResult>;
2264
3114
  /**
2265
3115
  * Performs vector subtraction
2266
- * @param vector1 - First vector (minuend)
2267
- * @param vector2 - Second vector (subtrahend)
2268
- * @returns Promise resolving to vector subtraction result
2269
3116
  */
2270
3117
  vectorSubtract(vector1: number[], vector2: number[]): Promise<VectorArithmeticResult>;
2271
3118
  /**
2272
3119
  * Performs scalar multiplication on a vector
2273
- * @param vector - Input vector
2274
- * @param scalar - Scalar value to multiply by
2275
- * @returns Promise resolving to scalar multiplication result
2276
3120
  */
2277
3121
  vectorScalarMultiply(vector: number[], scalar: number): Promise<VectorArithmeticResult>;
2278
3122
  /**
2279
3123
  * Calculates the dot product of two vectors
2280
- * @param vector1 - First vector
2281
- * @param vector2 - Second vector
2282
- * @returns Promise resolving to dot product result
2283
3124
  */
2284
3125
  vectorDotProduct(vector1: number[], vector2: number[]): Promise<{
2285
3126
  dotProduct: number;
@@ -2287,53 +3128,35 @@ declare class SynapCores {
2287
3128
  }>;
2288
3129
  /**
2289
3130
  * Calculates cosine similarity between two vectors
2290
- * @param vector1 - First vector
2291
- * @param vector2 - Second vector
2292
- * @returns Promise resolving to cosine similarity result
2293
3131
  */
2294
3132
  cosineSimilarity(vector1: number[], vector2: number[]): Promise<VectorSimilarityResult>;
2295
3133
  /**
2296
3134
  * Calculates L2 (Euclidean) distance between two vectors
2297
- * @param vector1 - First vector
2298
- * @param vector2 - Second vector
2299
- * @returns Promise resolving to L2 distance result
2300
3135
  */
2301
3136
  l2Distance(vector1: number[], vector2: number[]): Promise<VectorSimilarityResult>;
2302
3137
  /**
2303
3138
  * Calculates inner product between two vectors
2304
- * @param vector1 - First vector
2305
- * @param vector2 - Second vector
2306
- * @returns Promise resolving to inner product result
2307
3139
  */
2308
3140
  innerProduct(vector1: number[], vector2: number[]): Promise<VectorSimilarityResult>;
2309
3141
  /**
2310
- * Performs K-nearest neighbors vector search
2311
- * @param options - KNN search options
2312
- * @returns Promise resolving to KNN search results
3142
+ * Performs K-nearest neighbors vector search.
3143
+ * v0.2.0: routes through /vectors/collections/:c/search with mode discriminator.
2313
3144
  */
2314
3145
  knnSearch(options: KNNSearchOptions): Promise<VectorSearchResult[]>;
2315
3146
  /**
2316
- * Performs range-based vector similarity search
2317
- * @param options - Range search options
2318
- * @returns Promise resolving to range search results
3147
+ * Performs range-based vector similarity search.
2319
3148
  */
2320
3149
  rangeSearch(options: RangeSearchOptions): Promise<VectorSearchResult[]>;
2321
3150
  /**
2322
- * Performs hybrid search combining vector similarity and SQL filtering
2323
- * @param options - Hybrid search options
2324
- * @returns Promise resolving to hybrid search results
3151
+ * Performs hybrid search combining vector similarity and SQL filtering.
2325
3152
  */
2326
3153
  hybridSearch(options: HybridSearchOptions): Promise<VectorSearchResult[]>;
2327
3154
  /**
2328
3155
  * Normalizes a vector to unit length
2329
- * @param vector - Input vector to normalize
2330
- * @returns Promise resolving to normalized vector
2331
3156
  */
2332
3157
  normalizeVector(vector: number[]): Promise<VectorArithmeticResult>;
2333
3158
  /**
2334
3159
  * Calculates the magnitude (length) of a vector
2335
- * @param vector - Input vector
2336
- * @returns Promise resolving to vector magnitude
2337
3160
  */
2338
3161
  vectorMagnitude(vector: number[]): Promise<{
2339
3162
  magnitude: number;
@@ -2348,9 +3171,17 @@ declare class SynapCores {
2348
3171
  */
2349
3172
  login(request: LoginRequest): Promise<LoginResponse>;
2350
3173
  /**
2351
- * Refresh JWT token
3174
+ * Refresh JWT token.
3175
+ *
3176
+ * v0.2.0: the gateway does not currently expose a refresh endpoint —
3177
+ * this method now re-runs login() with the same credentials. Pass
3178
+ * the credentials in the call site (or supply them at SDK construction
3179
+ * time and we'll re-use the cached pair).
2352
3180
  */
2353
- refreshToken(): Promise<RefreshResponse>;
3181
+ refreshToken(credentials?: {
3182
+ username?: string;
3183
+ password?: string;
3184
+ }): Promise<RefreshResponse>;
2354
3185
  /**
2355
3186
  * Set JWT token manually (useful after login)
2356
3187
  */
@@ -2468,6 +3299,6 @@ declare class BatchOperationError extends SynapCoresError {
2468
3299
  * Official SDK for SynapCores AI-Native Database Management System.
2469
3300
  */
2470
3301
 
2471
- declare const VERSION = "0.1.0";
3302
+ declare const VERSION = "0.2.0";
2472
3303
 
2473
- export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateCollectionRequest, type CreateCollectionResponse, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateWebhookOptions, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, type ForeignKeyReference, type GenerateRecipeOptions, type GeneratedRecipe, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, type ModelInfo, type MultimediaInfo, type NLPAnalysis, NLPClient, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorError, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type WindowFunctionOptions };
3304
+ export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BeginTransactionOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, type ChatCacheStats, ChatClient, type ChatMessage, type ChatModelInfo, type ChatSession, type ChatStreamChunk, type ChatSuggestion, type ChatSuggestionsOptions, type ChatSystemPrompt, type ChatTool, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateChatSessionOptions, type CreateCollectionRequest, type CreateCollectionResponse, type CreateFsCollectionOptions, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateWebhookOptions, type CypherProfileResult, type CypherResult, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, FilesystemCollectionsClient, type ForeignKeyReference, type FsCollection, type FsDocument, type FsProgressEvent, type GenerateRecipeOptions, type GeneratedRecipe, type GraphAlgorithmName, type GraphAlgorithmRequest, type GraphAlgorithmResult, GraphClient, type GraphEdge, type GraphExtractRequest, type GraphExtractResult, type GraphNode, type GraphSummary, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, McpClient, type McpInfo, type McpRequest, type McpResponse, type ModelInfo, type MultimediaInfo, MultimodalClient, type MultimodalEmbedResult, type MultimodalInput, type MultimodalJoinOptions, type MultimodalJoinResult, type MultimodalSearchHit, type MultimodalSearchOptions, type MultimodalSimilarityOptions, type MultimodalSimilarityResult, NL2SqlClient, type NLPAnalysis, NLPClient, type Nl2SqlAskOptions, type Nl2SqlAskResult, type Nl2SqlHistoryEntry, type Nl2SqlSchemaContext, type Nl2SqlValidateResult, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type SendChatOptions, type SendChatResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, SystemClient, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, TransactionsClient, Tx, type TxHistoryEntry, type TxQueryResult, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorError, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type VisionConfig, type VisionTestResult, type WindowFunctionOptions };