@mesh-sync/worker-backend-client 4.0.2 → 4.0.4

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
@@ -324,7 +324,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
324
324
 
325
325
  - `modelId` (string) [✗]: The unique identifier for the model to be downloaded.
326
326
 
327
- - `ownerId` (string) [✗]: The identifier of the user who owns the model.
327
+ - `ownerId` (string) [✗]: The identifier of the user who owns the model. Optional - if not provided, will be retrieved from StorageConnection.
328
328
 
329
329
  - `storageLocation` (object) [✗]: The storage location of the model.
330
330
 
@@ -908,7 +908,7 @@ and stores aggregated statistics in Elasticsearch for trend analysis.
908
908
 
909
909
  ### model-metadata-generation-completed
910
910
 
911
- **Description:** Handles model metadata generation completed.
911
+ **Description:** Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.
912
912
 
913
913
  **Method:** `client.modelMetadataGenerationCompleted(data)`
914
914
 
@@ -916,15 +916,15 @@ and stores aggregated statistics in Elasticsearch for trend analysis.
916
916
 
917
917
  **Fields:**
918
918
 
919
- - `modelId` (string) [✓]: The unique identifier for the model.
919
+ - `modelId` (string) [✓]: UUID of the model that was processed.
920
920
 
921
- - `metadata` (object) [✓]: The enriched metadata for the model.
921
+ - `metadata` (object) [✓]: Enriched marketplace metadata generated by LLM.
922
922
 
923
923
 
924
924
 
925
925
  ### model-metadata-generation-request
926
926
 
927
- **Description:** Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
927
+ **Description:** Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM analysis with optional vision capabilities. Worker queries database by modelId to retrieve: Model (fileName, fileSize, ownerId, storageItem), TechnicalMetadata (geometry, quality, printability), and ThumbnailMedia (for vision analysis). Prerequisites: file download completed, technical metadata analysis completed (strongly recommended), thumbnail generation completed (optional for vision enhancement).
928
928
 
929
929
  **Method:** `client.modelMetadataGenerationRequest(data)`
930
930
 
@@ -932,29 +932,9 @@ and stores aggregated statistics in Elasticsearch for trend analysis.
932
932
 
933
933
  **Fields:**
934
934
 
935
- - `modelId` (string) [✗]: The unique identifier for the model.
936
-
937
- - `ownerId` (string) [✗]: The identifier of the user who owns the model.
938
-
939
- - `storageConnectionId` (string) [✗]: The ID of the storage connection (legacy - used if minioPath not provided).
940
-
941
- - `filePath` (string) [✗]: The path to the model file (legacy - used if minioPath not provided).
935
+ - `modelId` (string) [✗]: UUID of the model to generate metadata for. Worker queries database to retrieve: 1) Model entity (name, fileName, fileSize, ownerId, storageItem relationship), 2) Model.technicalMetadata relationship (vertices, faces, quality scores, printability metrics), 3) AssociatedMedia.thumbnails (via associatedMediaId) for vision-enhanced analysis. All data fetched from PostgreSQL - no additional parameters required.
942
936
 
943
- - `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.
944
-
945
- - `fileName` (string) [✗]: The name of the model file.
946
-
947
- - `fileSize` (number) [✗]: The size of the model file in bytes.
948
-
949
- - `fileLastModified` (string) [✗]: The last modified date of the model file.
950
-
951
- - `storageProviderType` (string) [✗]: The type of the storage provider.
952
-
953
- - `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).
954
-
955
- - `modelThumbnailUrl` (string) [✗]: The URL of the model thumbnail.
956
-
957
- - `metamodel` (object) [✗]: The metamodel of the model.
937
+ - `parentJobId` (string) [✗]: Optional ID of parent job for BullMQ dependency tracking. Set to thumbnail-generation job ID if you want metadata generation to wait until thumbnails are ready (enables vision analysis). Set to technical-metadata job ID for basic generation without vision. Not required for manual/retry scenarios.
958
938
 
959
939
 
960
940
 
@@ -1383,6 +1363,70 @@ Each worker includes its specific metrics in the `metrics` object.
1383
1363
 
1384
1364
 
1385
1365
 
1366
+ ### worker-metrics-enriched-event
1367
+
1368
+ **Description:** Enriched metrics event for detailed worker monitoring, cost tracking,
1369
+ and performance analysis. Published to backend.logging.events for
1370
+ centralized monitoring and cost attribution.
1371
+
1372
+ This event is emitted by all workers on job completion and includes:
1373
+ - LLM token usage and cost breakdown
1374
+ - System resource consumption (CPU, RAM, disk I/O)
1375
+ - Detailed timing breakdown by stage
1376
+ - User and context attribution
1377
+ - Model-specific metadata
1378
+
1379
+
1380
+ **Method:** `client.workerMetricsEnrichedEvent(data)`
1381
+
1382
+ **Payload Type:** `WorkerMetricsEnrichedEventMessage`
1383
+
1384
+ **Fields:**
1385
+
1386
+ - `eventType` (string) [✓]: Fixed type for enriched worker metrics
1387
+
1388
+ - `workerId` (string) [✓]: Identifier of the worker
1389
+
1390
+ - `jobId` (string) [✓]: Unique BullMQ job identifier
1391
+
1392
+ - `timestamp` (string) [✓]: ISO 8601 timestamp when job completed
1393
+
1394
+ - `status` (string) [✓]: Job completion status
1395
+
1396
+ - `userId` (string) [✗]: User who owns the resource/triggered the job
1397
+
1398
+ - `tenantId` (string) [✗]: Organization/tenant ID (for multi-tenant deployments)
1399
+
1400
+ - `sessionId` (string) [✗]: Session ID for correlating user actions
1401
+
1402
+ - `requestId` (string) [✗]: Request ID from originating API call (X-Request-Id)
1403
+
1404
+ - `modelId` (string) [✗]: Model ID being processed
1405
+
1406
+ - `metamodelId` (string) [✗]: Metamodel ID being processed
1407
+
1408
+ - `storageItemId` (string) [✗]: Storage item ID (for file operations)
1409
+
1410
+ - `timing` (object) [✗]: Comprehensive timing breakdown
1411
+
1412
+ - `llmUsage` (object) [✗]: LLM token usage and cost breakdown
1413
+
1414
+ - `resources` (object) [✗]: System resource consumption during job
1415
+
1416
+ - `workerMetrics` (object) [✗]: Worker-specific metrics (varies by worker type)
1417
+
1418
+ - `error` (object) [✗]: Error details if status is failure
1419
+
1420
+ - `environment` (string) [✗]: Deployment environment
1421
+
1422
+ - `region` (string) [✗]: Cloud region/datacenter
1423
+
1424
+ - `workerVersion` (string) [✗]: Worker service version
1425
+
1426
+ - `hostname` (string) [✗]: Pod/container hostname
1427
+
1428
+
1429
+
1386
1430
  ## Configuration
1387
1431
 
1388
1432
  ### Environment Variables
@@ -1536,10 +1580,10 @@ and stores aggregated statistics in Elasticsearch for trend analysis.
1536
1580
  - Handles model discovery scan requests events.
1537
1581
 
1538
1582
  - `modelMetadataGenerationCompleted(data: ModelMetadataGenerationCompletedMessage): Promise<JobResponse>`
1539
- - Handles model metadata generation completed.
1583
+ - Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.
1540
1584
 
1541
1585
  - `modelMetadataGenerationRequest(data: ModelMetadataGenerationRequestMessage): Promise<JobResponse>`
1542
- - Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
1586
+ - Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM analysis with optional vision capabilities. Worker queries database by modelId to retrieve: Model (fileName, fileSize, ownerId, storageItem), TechnicalMetadata (geometry, quality, printability), and ThumbnailMedia (for vision analysis). Prerequisites: file download completed, technical metadata analysis completed (strongly recommended), thumbnail generation completed (optional for vision enhancement).
1543
1587
 
1544
1588
  - `modelMetamodelDetectionFound(data: ModelMetamodelDetectionFoundMessage): Promise<JobResponse>`
1545
1589
  - Handles model metamodel detection found with hierarchical relationships.
@@ -1598,6 +1642,19 @@ All workers MUST emit this event upon job completion (success or failure).
1598
1642
  Each worker includes its specific metrics in the `metrics` object.
1599
1643
 
1600
1644
 
1645
+ - `workerMetricsEnrichedEvent(data: WorkerMetricsEnrichedEventMessage): Promise<JobResponse>`
1646
+ - Enriched metrics event for detailed worker monitoring, cost tracking,
1647
+ and performance analysis. Published to backend.logging.events for
1648
+ centralized monitoring and cost attribution.
1649
+
1650
+ This event is emitted by all workers on job completion and includes:
1651
+ - LLM token usage and cost breakdown
1652
+ - System resource consumption (CPU, RAM, disk I/O)
1653
+ - Detailed timing breakdown by stage
1654
+ - User and context attribution
1655
+ - Model-specific metadata
1656
+
1657
+
1601
1658
 
1602
1659
  ### Response Types
1603
1660
 
package/dist/client.d.ts CHANGED
@@ -230,13 +230,13 @@ export declare class WorkerClient {
230
230
  */
231
231
  modelDiscoveryScanRequest(data: types.ModelDiscoveryScanRequestMessage): Promise<JobResponse>;
232
232
  /**
233
- * Handles model metadata generation completed.
233
+ * Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.
234
234
  * @param data - The message payload
235
235
  * @returns Job response with job ID
236
236
  */
237
237
  modelMetadataGenerationCompleted(data: types.ModelMetadataGenerationCompletedMessage): Promise<JobResponse>;
238
238
  /**
239
- * Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
239
+ * Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM analysis with optional vision capabilities. Worker queries database by modelId to retrieve: Model (fileName, fileSize, ownerId, storageItem), TechnicalMetadata (geometry, quality, printability), and ThumbnailMedia (for vision analysis). Prerequisites: file download completed, technical metadata analysis completed (strongly recommended), thumbnail generation completed (optional for vision enhancement).
240
240
  * @param data - The message payload
241
241
  * @returns Job response with job ID
242
242
  */
@@ -334,4 +334,20 @@ export declare class WorkerClient {
334
334
  * @returns Job response with job ID
335
335
  */
336
336
  workerAnalyticsEvent(data: types.WorkerAnalyticsEventMessage): Promise<JobResponse>;
337
+ /**
338
+ * Enriched metrics event for detailed worker monitoring, cost tracking,
339
+ and performance analysis. Published to backend.logging.events for
340
+ centralized monitoring and cost attribution.
341
+
342
+ This event is emitted by all workers on job completion and includes:
343
+ - LLM token usage and cost breakdown
344
+ - System resource consumption (CPU, RAM, disk I/O)
345
+ - Detailed timing breakdown by stage
346
+ - User and context attribution
347
+ - Model-specific metadata
348
+
349
+ * @param data - The message payload
350
+ * @returns Job response with job ID
351
+ */
352
+ workerMetricsEnrichedEvent(data: types.WorkerMetricsEnrichedEventMessage): Promise<JobResponse>;
337
353
  }
package/dist/client.js CHANGED
@@ -305,7 +305,7 @@ export class WorkerClient {
305
305
  return this.sendToQueue(types.MessageTypes.MODEL_DISCOVERY_SCAN_REQUEST, data);
306
306
  }
307
307
  /**
308
- * Handles model metadata generation completed.
308
+ * Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.
309
309
  * @param data - The message payload
310
310
  * @returns Job response with job ID
311
311
  */
@@ -313,7 +313,7 @@ export class WorkerClient {
313
313
  return this.sendToQueue(types.MessageTypes.MODEL_METADATA_GENERATION_COMPLETED, data);
314
314
  }
315
315
  /**
316
- * Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
316
+ * Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM analysis with optional vision capabilities. Worker queries database by modelId to retrieve: Model (fileName, fileSize, ownerId, storageItem), TechnicalMetadata (geometry, quality, printability), and ThumbnailMedia (for vision analysis). Prerequisites: file download completed, technical metadata analysis completed (strongly recommended), thumbnail generation completed (optional for vision enhancement).
317
317
  * @param data - The message payload
318
318
  * @returns Job response with job ID
319
319
  */
@@ -437,4 +437,22 @@ export class WorkerClient {
437
437
  async workerAnalyticsEvent(data) {
438
438
  return this.sendToQueue(types.MessageTypes.WORKER_ANALYTICS_EVENT, data);
439
439
  }
440
+ /**
441
+ * Enriched metrics event for detailed worker monitoring, cost tracking,
442
+ and performance analysis. Published to backend.logging.events for
443
+ centralized monitoring and cost attribution.
444
+
445
+ This event is emitted by all workers on job completion and includes:
446
+ - LLM token usage and cost breakdown
447
+ - System resource consumption (CPU, RAM, disk I/O)
448
+ - Detailed timing breakdown by stage
449
+ - User and context attribution
450
+ - Model-specific metadata
451
+
452
+ * @param data - The message payload
453
+ * @returns Job response with job ID
454
+ */
455
+ async workerMetricsEnrichedEvent(data) {
456
+ return this.sendToQueue(types.MessageTypes.WORKER_METRICS_ENRICHED_EVENT, data);
457
+ }
440
458
  }
package/dist/types.d.ts CHANGED
@@ -42,6 +42,7 @@ export declare const MessageTypes: {
42
42
  readonly THUMBNAIL_GENERATION_REQUEST: "thumbnail-generation-request";
43
43
  readonly USER_ENGAGEMENT_EVENT: "user-engagement-event";
44
44
  readonly WORKER_ANALYTICS_EVENT: "worker-analytics-event";
45
+ readonly WORKER_METRICS_ENRICHED_EVENT: "worker-metrics-enriched-event";
45
46
  };
46
47
  export type MessageType = typeof MessageTypes[keyof typeof MessageTypes];
47
48
  /**
@@ -220,7 +221,7 @@ export interface FileDownloadCompletedMessage {
220
221
  export interface FileDownloadRequestMessage {
221
222
  /** The unique identifier for the model to be downloaded. */
222
223
  modelId?: string;
223
- /** The identifier of the user who owns the model. */
224
+ /** The identifier of the user who owns the model. Optional - if not provided, will be retrieved from StorageConnection. */
224
225
  ownerId?: string;
225
226
  /** The storage location of the model. */
226
227
  storageLocation?: Record<string, string | number | boolean>;
@@ -669,42 +670,22 @@ export interface ModelDiscoveryScanRequestMessage {
669
670
  path?: string;
670
671
  }
671
672
  /**
672
- * Handles model metadata generation completed.
673
+ * Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.
673
674
  */
674
675
  export interface ModelMetadataGenerationCompletedMessage {
675
- /** The unique identifier for the model. */
676
+ /** UUID of the model that was processed. */
676
677
  modelId: string;
677
- /** The enriched metadata for the model. */
678
+ /** Enriched marketplace metadata generated by LLM. */
678
679
  metadata: Record<string, string | number | boolean>;
679
680
  }
680
681
  /**
681
- * Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
682
+ * Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM analysis with optional vision capabilities. Worker queries database by modelId to retrieve: Model (fileName, fileSize, ownerId, storageItem), TechnicalMetadata (geometry, quality, printability), and ThumbnailMedia (for vision analysis). Prerequisites: file download completed, technical metadata analysis completed (strongly recommended), thumbnail generation completed (optional for vision enhancement).
682
683
  */
683
684
  export interface ModelMetadataGenerationRequestMessage {
684
- /** The unique identifier for the model. */
685
+ /** UUID of the model to generate metadata for. Worker queries database to retrieve: 1) Model entity (name, fileName, fileSize, ownerId, storageItem relationship), 2) Model.technicalMetadata relationship (vertices, faces, quality scores, printability metrics), 3) AssociatedMedia.thumbnails (via associatedMediaId) for vision-enhanced analysis. All data fetched from PostgreSQL - no additional parameters required. */
685
686
  modelId?: string;
686
- /** The identifier of the user who owns the model. */
687
- ownerId?: string;
688
- /** The ID of the storage connection (legacy - used if minioPath not provided). */
689
- storageConnectionId?: string;
690
- /** The path to the model file (legacy - used if minioPath not provided). */
691
- filePath?: string;
692
- /** Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider. */
693
- minioPath?: string;
694
- /** The name of the model file. */
695
- fileName?: string;
696
- /** The size of the model file in bytes. */
697
- fileSize?: number;
698
- /** The last modified date of the model file. */
699
- fileLastModified?: string;
700
- /** The type of the storage provider. */
701
- storageProviderType?: string;
702
- /** ID of parent file-download job (for BullMQ dependency tracking). */
687
+ /** Optional ID of parent job for BullMQ dependency tracking. Set to thumbnail-generation job ID if you want metadata generation to wait until thumbnails are ready (enables vision analysis). Set to technical-metadata job ID for basic generation without vision. Not required for manual/retry scenarios. */
703
688
  parentJobId?: string;
704
- /** The URL of the model thumbnail. */
705
- modelThumbnailUrl?: string;
706
- /** The metamodel of the model. */
707
- metamodel?: Record<string, string | number | boolean>;
708
689
  }
709
690
  /**
710
691
  * Handles model metamodel detection found with hierarchical relationships.
@@ -1047,3 +1028,60 @@ export interface WorkerAnalyticsEventMessage {
1047
1028
  /** Worker-specific metrics. Structure varies by eventType. */
1048
1029
  metrics?: Record<string, string | number | boolean>;
1049
1030
  }
1031
+ /**
1032
+ * Enriched metrics event for detailed worker monitoring, cost tracking,
1033
+ and performance analysis. Published to backend.logging.events for
1034
+ centralized monitoring and cost attribution.
1035
+
1036
+ This event is emitted by all workers on job completion and includes:
1037
+ - LLM token usage and cost breakdown
1038
+ - System resource consumption (CPU, RAM, disk I/O)
1039
+ - Detailed timing breakdown by stage
1040
+ - User and context attribution
1041
+ - Model-specific metadata
1042
+
1043
+ */
1044
+ export interface WorkerMetricsEnrichedEventMessage {
1045
+ /** Fixed type for enriched worker metrics */
1046
+ eventType: string;
1047
+ /** Identifier of the worker */
1048
+ workerId: string;
1049
+ /** Unique BullMQ job identifier */
1050
+ jobId: string;
1051
+ /** ISO 8601 timestamp when job completed */
1052
+ timestamp: string;
1053
+ /** Job completion status */
1054
+ status: string;
1055
+ /** User who owns the resource/triggered the job */
1056
+ userId?: string;
1057
+ /** Organization/tenant ID (for multi-tenant deployments) */
1058
+ tenantId?: string;
1059
+ /** Session ID for correlating user actions */
1060
+ sessionId?: string;
1061
+ /** Request ID from originating API call (X-Request-Id) */
1062
+ requestId?: string;
1063
+ /** Model ID being processed */
1064
+ modelId?: string;
1065
+ /** Metamodel ID being processed */
1066
+ metamodelId?: string;
1067
+ /** Storage item ID (for file operations) */
1068
+ storageItemId?: string;
1069
+ /** Comprehensive timing breakdown */
1070
+ timing?: Record<string, string | number | boolean>;
1071
+ /** LLM token usage and cost breakdown */
1072
+ llmUsage?: Record<string, string | number | boolean>;
1073
+ /** System resource consumption during job */
1074
+ resources?: Record<string, string | number | boolean>;
1075
+ /** Worker-specific metrics (varies by worker type) */
1076
+ workerMetrics?: Record<string, string | number | boolean>;
1077
+ /** Error details if status is failure */
1078
+ error?: Record<string, string | number | boolean>;
1079
+ /** Deployment environment */
1080
+ environment?: string;
1081
+ /** Cloud region/datacenter */
1082
+ region?: string;
1083
+ /** Worker service version */
1084
+ workerVersion?: string;
1085
+ /** Pod/container hostname */
1086
+ hostname?: string;
1087
+ }
package/dist/types.js CHANGED
@@ -43,4 +43,5 @@ export const MessageTypes = {
43
43
  THUMBNAIL_GENERATION_REQUEST: 'thumbnail-generation-request',
44
44
  USER_ENGAGEMENT_EVENT: 'user-engagement-event',
45
45
  WORKER_ANALYTICS_EVENT: 'worker-analytics-event',
46
+ WORKER_METRICS_ENRICHED_EVENT: 'worker-metrics-enriched-event',
46
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mesh-sync/worker-backend-client",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Auto-generated TypeScript client for worker-backend - provides type-safe methods for enqueueing jobs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",