@solidxai/core 0.1.22-beta.3 → 0.1.22-beta.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.
Files changed (203) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/constants/error-messages.d.ts +1 -1
  3. package/dist/constants/error-messages.d.ts.map +1 -1
  4. package/dist/constants/error-messages.js +1 -1
  5. package/dist/constants/error-messages.js.map +1 -1
  6. package/dist/controllers/agent-registry.controller.d.ts +8 -0
  7. package/dist/controllers/agent-registry.controller.d.ts.map +1 -1
  8. package/dist/controllers/agent-registry.controller.js +14 -0
  9. package/dist/controllers/agent-registry.controller.js.map +1 -1
  10. package/dist/controllers/agent-session.controller.d.ts +8 -1
  11. package/dist/controllers/agent-session.controller.d.ts.map +1 -1
  12. package/dist/controllers/agent-session.controller.js +66 -2
  13. package/dist/controllers/agent-session.controller.js.map +1 -1
  14. package/dist/controllers/test-data.controller.d.ts +12 -0
  15. package/dist/controllers/test-data.controller.d.ts.map +1 -0
  16. package/dist/controllers/test-data.controller.js +66 -0
  17. package/dist/controllers/test-data.controller.js.map +1 -0
  18. package/dist/controllers/test-data.controller.spec.d.ts +2 -0
  19. package/dist/controllers/test-data.controller.spec.d.ts.map +1 -0
  20. package/dist/controllers/test-data.controller.spec.js +78 -0
  21. package/dist/controllers/test-data.controller.spec.js.map +1 -0
  22. package/dist/dtos/create-agent-job.dto.d.ts +1 -0
  23. package/dist/dtos/create-agent-job.dto.d.ts.map +1 -1
  24. package/dist/dtos/create-agent-job.dto.js +8 -1
  25. package/dist/dtos/create-agent-job.dto.js.map +1 -1
  26. package/dist/dtos/create-agent-process.dto.d.ts +5 -0
  27. package/dist/dtos/create-agent-process.dto.d.ts.map +1 -1
  28. package/dist/dtos/create-agent-process.dto.js +37 -1
  29. package/dist/dtos/create-agent-process.dto.js.map +1 -1
  30. package/dist/dtos/create-agent-registry.dto.d.ts +5 -0
  31. package/dist/dtos/create-agent-registry.dto.d.ts.map +1 -1
  32. package/dist/dtos/create-agent-registry.dto.js +39 -1
  33. package/dist/dtos/create-agent-registry.dto.js.map +1 -1
  34. package/dist/dtos/create-agent-session.dto.js +1 -1
  35. package/dist/dtos/create-agent-session.dto.js.map +1 -1
  36. package/dist/dtos/test-run-request.dto.d.ts +1 -0
  37. package/dist/dtos/test-run-request.dto.d.ts.map +1 -1
  38. package/dist/dtos/test-run-request.dto.js +7 -1
  39. package/dist/dtos/test-run-request.dto.js.map +1 -1
  40. package/dist/dtos/update-agent-deployment.dto.d.ts +8 -0
  41. package/dist/dtos/update-agent-deployment.dto.d.ts.map +1 -0
  42. package/dist/dtos/update-agent-deployment.dto.js +60 -0
  43. package/dist/dtos/update-agent-deployment.dto.js.map +1 -0
  44. package/dist/dtos/update-agent-job.dto.d.ts +1 -0
  45. package/dist/dtos/update-agent-job.dto.d.ts.map +1 -1
  46. package/dist/dtos/update-agent-job.dto.js +8 -1
  47. package/dist/dtos/update-agent-job.dto.js.map +1 -1
  48. package/dist/dtos/update-agent-process.dto.d.ts +5 -0
  49. package/dist/dtos/update-agent-process.dto.d.ts.map +1 -1
  50. package/dist/dtos/update-agent-process.dto.js +37 -1
  51. package/dist/dtos/update-agent-process.dto.js.map +1 -1
  52. package/dist/dtos/update-agent-registry.dto.d.ts +5 -0
  53. package/dist/dtos/update-agent-registry.dto.d.ts.map +1 -1
  54. package/dist/dtos/update-agent-registry.dto.js +39 -1
  55. package/dist/dtos/update-agent-registry.dto.js.map +1 -1
  56. package/dist/dtos/update-agent-session.dto.js +1 -1
  57. package/dist/dtos/update-agent-session.dto.js.map +1 -1
  58. package/dist/entities/agent-job.entity.d.ts +1 -0
  59. package/dist/entities/agent-job.entity.d.ts.map +1 -1
  60. package/dist/entities/agent-job.entity.js +7 -2
  61. package/dist/entities/agent-job.entity.js.map +1 -1
  62. package/dist/entities/agent-process.entity.d.ts +8 -0
  63. package/dist/entities/agent-process.entity.d.ts.map +1 -1
  64. package/dist/entities/agent-process.entity.js +38 -1
  65. package/dist/entities/agent-process.entity.js.map +1 -1
  66. package/dist/entities/agent-registry.entity.d.ts +5 -0
  67. package/dist/entities/agent-registry.entity.d.ts.map +1 -1
  68. package/dist/entities/agent-registry.entity.js +22 -1
  69. package/dist/entities/agent-registry.entity.js.map +1 -1
  70. package/dist/entities/agent-session.entity.d.ts.map +1 -1
  71. package/dist/entities/agent-session.entity.js +3 -1
  72. package/dist/entities/agent-session.entity.js.map +1 -1
  73. package/dist/helpers/agent-config-version-name.d.ts +2 -0
  74. package/dist/helpers/agent-config-version-name.d.ts.map +1 -0
  75. package/dist/helpers/agent-config-version-name.js +17 -0
  76. package/dist/helpers/agent-config-version-name.js.map +1 -0
  77. package/dist/helpers/agent-config-version-name.spec.d.ts +2 -0
  78. package/dist/helpers/agent-config-version-name.spec.d.ts.map +1 -0
  79. package/dist/helpers/agent-config-version-name.spec.js +31 -0
  80. package/dist/helpers/agent-config-version-name.spec.js.map +1 -0
  81. package/dist/index.d.ts +3 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +2 -0
  84. package/dist/index.js.map +1 -1
  85. package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts.map +1 -1
  86. package/dist/jobs/database/test-run-queue-subscriber-database.service.js +8 -4
  87. package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
  88. package/dist/resources/agent-embed/solid-agent-embed.js +243 -4
  89. package/dist/seeders/module-test-data.service.d.ts +19 -0
  90. package/dist/seeders/module-test-data.service.d.ts.map +1 -1
  91. package/dist/seeders/module-test-data.service.js +95 -15
  92. package/dist/seeders/module-test-data.service.js.map +1 -1
  93. package/dist/seeders/module-test-data.service.spec.d.ts +2 -0
  94. package/dist/seeders/module-test-data.service.spec.d.ts.map +1 -0
  95. package/dist/seeders/module-test-data.service.spec.js +158 -0
  96. package/dist/seeders/module-test-data.service.spec.js.map +1 -0
  97. package/dist/seeders/seed-data/solid-core-metadata.json +278 -11
  98. package/dist/services/agent-hub-process-manager.service.d.ts +4 -0
  99. package/dist/services/agent-hub-process-manager.service.d.ts.map +1 -1
  100. package/dist/services/agent-hub-process-manager.service.js +19 -3
  101. package/dist/services/agent-hub-process-manager.service.js.map +1 -1
  102. package/dist/services/agent-registry.service.d.ts +8 -0
  103. package/dist/services/agent-registry.service.d.ts.map +1 -1
  104. package/dist/services/agent-registry.service.js +32 -1
  105. package/dist/services/agent-registry.service.js.map +1 -1
  106. package/dist/services/crud.service.d.ts +1 -0
  107. package/dist/services/crud.service.d.ts.map +1 -1
  108. package/dist/services/crud.service.js +26 -2
  109. package/dist/services/crud.service.js.map +1 -1
  110. package/dist/services/settings/default-settings-provider.service.d.ts +12 -2
  111. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  112. package/dist/services/settings/default-settings-provider.service.js +7 -1
  113. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  114. package/dist/solid-core.module.d.ts.map +1 -1
  115. package/dist/solid-core.module.js +3 -0
  116. package/dist/solid-core.module.js.map +1 -1
  117. package/dist/testing/adapters/ui/browser-provisioner.d.ts +11 -0
  118. package/dist/testing/adapters/ui/browser-provisioner.d.ts.map +1 -1
  119. package/dist/testing/adapters/ui/browser-provisioner.js +51 -1
  120. package/dist/testing/adapters/ui/browser-provisioner.js.map +1 -1
  121. package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts +2 -0
  122. package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts.map +1 -0
  123. package/dist/testing/adapters/ui/browser-provisioner.spec.js +137 -0
  124. package/dist/testing/adapters/ui/browser-provisioner.spec.js.map +1 -0
  125. package/dist/testing/adapters/ui/playwright-adapter.d.ts +7 -0
  126. package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
  127. package/dist/testing/adapters/ui/playwright-adapter.js +37 -8
  128. package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
  129. package/dist/testing/adapters/ui/run-video.d.ts +40 -0
  130. package/dist/testing/adapters/ui/run-video.d.ts.map +1 -0
  131. package/dist/testing/adapters/ui/run-video.js +113 -0
  132. package/dist/testing/adapters/ui/run-video.js.map +1 -0
  133. package/dist/testing/adapters/ui/run-video.spec.d.ts +2 -0
  134. package/dist/testing/adapters/ui/run-video.spec.d.ts.map +1 -0
  135. package/dist/testing/adapters/ui/run-video.spec.js +62 -0
  136. package/dist/testing/adapters/ui/run-video.spec.js.map +1 -0
  137. package/dist/testing/contracts/testing-metadata.types.d.ts +1 -0
  138. package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -1
  139. package/dist/testing/contracts/testing-metadata.types.js.map +1 -1
  140. package/dist/testing/core/testing-engine.d.ts +1 -1
  141. package/dist/testing/core/testing-engine.d.ts.map +1 -1
  142. package/dist/testing/core/testing-engine.js +22 -4
  143. package/dist/testing/core/testing-engine.js.map +1 -1
  144. package/dist/testing/reporter/lifecycle-events.types.d.ts +1 -1
  145. package/dist/testing/reporter/lifecycle-events.types.d.ts.map +1 -1
  146. package/dist/testing/reporter/lifecycle-events.types.js.map +1 -1
  147. package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts.map +1 -1
  148. package/dist/testing/reporter/lifecycle-webhook-reporter.js +2 -0
  149. package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
  150. package/dist/testing/runner/read-scenarios-file.d.ts +1 -0
  151. package/dist/testing/runner/read-scenarios-file.d.ts.map +1 -1
  152. package/dist/testing/runner/read-scenarios-file.js +20 -0
  153. package/dist/testing/runner/read-scenarios-file.js.map +1 -1
  154. package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
  155. package/dist/testing/runner/run-from-metadata.js +9 -1
  156. package/dist/testing/runner/run-from-metadata.js.map +1 -1
  157. package/dist/testing/runner/run-from-metadata.spec.js +12 -1
  158. package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
  159. package/package.json +1 -1
  160. package/resources/agent-embed/solid-agent-embed.js +243 -4
  161. package/src/constants/error-messages.ts +2 -1
  162. package/src/controllers/agent-registry.controller.ts +8 -1
  163. package/src/controllers/agent-session.controller.ts +37 -2
  164. package/src/controllers/test-data.controller.spec.ts +94 -0
  165. package/src/controllers/test-data.controller.ts +58 -0
  166. package/src/dtos/create-agent-job.dto.ts +6 -0
  167. package/src/dtos/create-agent-process.dto.ts +32 -1
  168. package/src/dtos/create-agent-registry.dto.ts +34 -1
  169. package/src/dtos/create-agent-session.dto.ts +1 -1
  170. package/src/dtos/test-run-request.dto.ts +6 -0
  171. package/src/dtos/update-agent-deployment.dto.ts +37 -0
  172. package/src/dtos/update-agent-job.dto.ts +6 -0
  173. package/src/dtos/update-agent-process.dto.ts +32 -1
  174. package/src/dtos/update-agent-registry.dto.ts +34 -1
  175. package/src/dtos/update-agent-session.dto.ts +1 -1
  176. package/src/entities/agent-job.entity.ts +5 -1
  177. package/src/entities/agent-process.entity.ts +28 -0
  178. package/src/entities/agent-registry.entity.ts +15 -0
  179. package/src/entities/agent-session.entity.ts +3 -0
  180. package/src/helpers/agent-config-version-name.spec.ts +35 -0
  181. package/src/helpers/agent-config-version-name.ts +16 -0
  182. package/src/index.ts +5 -0
  183. package/src/jobs/database/test-run-queue-subscriber-database.service.ts +10 -6
  184. package/src/seeders/module-test-data.service.spec.ts +184 -0
  185. package/src/seeders/module-test-data.service.ts +136 -20
  186. package/src/seeders/seed-data/solid-core-metadata.json +278 -11
  187. package/src/services/agent-hub-process-manager.service.ts +25 -4
  188. package/src/services/agent-registry.service.ts +35 -2
  189. package/src/services/crud.service.ts +30 -2
  190. package/src/services/settings/default-settings-provider.service.ts +11 -1
  191. package/src/solid-core.module.ts +3 -0
  192. package/src/testing/adapters/ui/browser-provisioner.spec.ts +131 -0
  193. package/src/testing/adapters/ui/browser-provisioner.ts +85 -2
  194. package/src/testing/adapters/ui/playwright-adapter.ts +48 -10
  195. package/src/testing/adapters/ui/run-video.spec.ts +72 -0
  196. package/src/testing/adapters/ui/run-video.ts +122 -0
  197. package/src/testing/contracts/testing-metadata.types.ts +5 -0
  198. package/src/testing/core/testing-engine.ts +28 -5
  199. package/src/testing/reporter/lifecycle-events.types.ts +2 -1
  200. package/src/testing/reporter/lifecycle-webhook-reporter.ts +1 -0
  201. package/src/testing/runner/read-scenarios-file.ts +24 -0
  202. package/src/testing/runner/run-from-metadata.spec.ts +15 -1
  203. package/src/testing/runner/run-from-metadata.ts +13 -5
@@ -5832,7 +5832,16 @@
5832
5832
  {
5833
5833
  "name": "status",
5834
5834
  "displayName": "Status",
5835
- "type": "shortText",
5835
+ "type": "selectionStatic",
5836
+ "ormType": "varchar",
5837
+ "selectionStaticValues": [
5838
+ "success:Success",
5839
+ "pending:Pending",
5840
+ "denied:Denied",
5841
+ "error:Error"
5842
+ ],
5843
+ "selectionValueType": "string",
5844
+ "isMultiSelect": false,
5836
5845
  "columnName": "status",
5837
5846
  "length": 16,
5838
5847
  "required": true,
@@ -8952,6 +8961,81 @@
8952
8961
  "enableAuditTracking": true,
8953
8962
  "isPrimaryKey": false
8954
8963
  },
8964
+ {
8965
+ "name": "runner",
8966
+ "displayName": "Runner",
8967
+ "description": "Runner for new processes. Inherit the installation default when unset.",
8968
+ "type": "shortText",
8969
+ "ormType": "varchar",
8970
+ "isSystem": true,
8971
+ "required": false,
8972
+ "unique": false,
8973
+ "index": false,
8974
+ "private": false,
8975
+ "encrypt": false,
8976
+ "enableAuditTracking": true
8977
+ },
8978
+ {
8979
+ "name": "minProcesses",
8980
+ "displayName": "Minimum Processes",
8981
+ "description": "Number of processes kept warm.",
8982
+ "type": "int",
8983
+ "ormType": "integer",
8984
+ "isSystem": true,
8985
+ "required": false,
8986
+ "unique": false,
8987
+ "index": false,
8988
+ "private": false,
8989
+ "encrypt": false,
8990
+ "enableAuditTracking": true,
8991
+ "defaultValue": "0",
8992
+ "min": 0
8993
+ },
8994
+ {
8995
+ "name": "maxProcesses",
8996
+ "displayName": "Maximum Processes",
8997
+ "description": "Process cap. Inherit the installation limit when unset.",
8998
+ "type": "int",
8999
+ "ormType": "integer",
9000
+ "isSystem": true,
9001
+ "required": false,
9002
+ "unique": false,
9003
+ "index": false,
9004
+ "private": false,
9005
+ "encrypt": false,
9006
+ "enableAuditTracking": true,
9007
+ "min": 1
9008
+ },
9009
+ {
9010
+ "name": "processCpu",
9011
+ "displayName": "Process CPU",
9012
+ "description": "ECS CPU units for new processes. Inherit the task definition when unset.",
9013
+ "type": "int",
9014
+ "ormType": "integer",
9015
+ "isSystem": true,
9016
+ "required": false,
9017
+ "unique": false,
9018
+ "index": false,
9019
+ "private": false,
9020
+ "encrypt": false,
9021
+ "enableAuditTracking": true,
9022
+ "min": 1
9023
+ },
9024
+ {
9025
+ "name": "processMemory",
9026
+ "displayName": "Process Memory",
9027
+ "description": "Memory in MiB for new ECS processes. Inherit the task definition when unset.",
9028
+ "type": "int",
9029
+ "ormType": "integer",
9030
+ "isSystem": true,
9031
+ "required": false,
9032
+ "unique": false,
9033
+ "index": false,
9034
+ "private": false,
9035
+ "encrypt": false,
9036
+ "enableAuditTracking": true,
9037
+ "min": 1
9038
+ },
8955
9039
  {
8956
9040
  "name": "configVersions",
8957
9041
  "displayName": "Config Versions",
@@ -10214,6 +10298,123 @@
10214
10298
  "enableAuditTracking": true,
10215
10299
  "isPrimaryKey": false
10216
10300
  },
10301
+ {
10302
+ "name": "runner",
10303
+ "displayName": "Runner",
10304
+ "description": "Runner that launched this process. An unset value identifies a legacy local process.",
10305
+ "type": "shortText",
10306
+ "ormType": "varchar",
10307
+ "isSystem": true,
10308
+ "required": false,
10309
+ "unique": false,
10310
+ "index": false,
10311
+ "private": false,
10312
+ "encrypt": false,
10313
+ "enableAuditTracking": true
10314
+ },
10315
+ {
10316
+ "name": "runnerRef",
10317
+ "displayName": "Runner Reference",
10318
+ "description": "Runner handle, such as a local PID or an ECS task ARN.",
10319
+ "type": "shortText",
10320
+ "ormType": "varchar",
10321
+ "isSystem": true,
10322
+ "required": false,
10323
+ "unique": false,
10324
+ "index": false,
10325
+ "private": false,
10326
+ "encrypt": false,
10327
+ "enableAuditTracking": true,
10328
+ "max": 512
10329
+ },
10330
+ {
10331
+ "name": "internalUrl",
10332
+ "displayName": "Internal URL",
10333
+ "description": "Private URL used by the manager and gateway.",
10334
+ "type": "shortText",
10335
+ "ormType": "varchar",
10336
+ "isSystem": true,
10337
+ "required": false,
10338
+ "unique": false,
10339
+ "index": false,
10340
+ "private": true,
10341
+ "encrypt": false,
10342
+ "enableAuditTracking": false,
10343
+ "defaultValue": ""
10344
+ },
10345
+ {
10346
+ "name": "bootstrapTokenHash",
10347
+ "displayName": "Bootstrap Token Hash",
10348
+ "description": "SHA-256 hash of the process bootstrap token.",
10349
+ "type": "shortText",
10350
+ "ormType": "varchar",
10351
+ "isSystem": true,
10352
+ "required": false,
10353
+ "unique": false,
10354
+ "index": false,
10355
+ "private": true,
10356
+ "encrypt": false,
10357
+ "enableAuditTracking": false,
10358
+ "max": 64
10359
+ },
10360
+ {
10361
+ "name": "bootstrapExpiresAt",
10362
+ "displayName": "Bootstrap Expires At",
10363
+ "description": "Deadline for process bootstrap.",
10364
+ "type": "datetime",
10365
+ "ormType": "timestamptz",
10366
+ "isSystem": true,
10367
+ "required": false,
10368
+ "unique": false,
10369
+ "index": false,
10370
+ "private": true,
10371
+ "encrypt": false,
10372
+ "enableAuditTracking": false
10373
+ },
10374
+ {
10375
+ "name": "runtimeVersion",
10376
+ "displayName": "Runtime Version",
10377
+ "description": "Runtime package version reported by the process.",
10378
+ "type": "shortText",
10379
+ "ormType": "varchar",
10380
+ "isSystem": true,
10381
+ "required": false,
10382
+ "unique": false,
10383
+ "index": false,
10384
+ "private": false,
10385
+ "encrypt": false,
10386
+ "enableAuditTracking": true
10387
+ },
10388
+ {
10389
+ "name": "cpu",
10390
+ "displayName": "CPU",
10391
+ "description": "CPU units used to launch this process.",
10392
+ "type": "int",
10393
+ "ormType": "integer",
10394
+ "isSystem": true,
10395
+ "required": false,
10396
+ "unique": false,
10397
+ "index": false,
10398
+ "private": false,
10399
+ "encrypt": false,
10400
+ "enableAuditTracking": true,
10401
+ "min": 1
10402
+ },
10403
+ {
10404
+ "name": "memory",
10405
+ "displayName": "Memory",
10406
+ "description": "Memory in MiB used to launch this process.",
10407
+ "type": "int",
10408
+ "ormType": "integer",
10409
+ "isSystem": true,
10410
+ "required": false,
10411
+ "unique": false,
10412
+ "index": false,
10413
+ "private": false,
10414
+ "encrypt": false,
10415
+ "enableAuditTracking": true,
10416
+ "min": 1
10417
+ },
10217
10418
  {
10218
10419
  "name": "wsUrl",
10219
10420
  "displayName": "WebSocket URL",
@@ -10586,7 +10787,7 @@
10586
10787
  "relationCascade": "set null",
10587
10788
  "required": false,
10588
10789
  "unique": false,
10589
- "index": false,
10790
+ "index": true,
10590
10791
  "private": false,
10591
10792
  "encrypt": false,
10592
10793
  "encryptionType": null,
@@ -10621,7 +10822,7 @@
10621
10822
  {
10622
10823
  "name": "trigger",
10623
10824
  "displayName": "Trigger",
10624
- "description": null,
10825
+ "description": "Original session entry point. Use api or webhook for the background jobs inbox.",
10625
10826
  "type": "selectionStatic",
10626
10827
  "ormType": "varchar",
10627
10828
  "isSystem": true,
@@ -10669,15 +10870,24 @@
10669
10870
  {
10670
10871
  "name": "status",
10671
10872
  "displayName": "Status",
10672
- "description": "queued: Background session waiting for its first job to be claimed; active: Interactive session open, waiting for the user's next message; running: A turn is executing; awaiting_input: Parked on a request_human_input question; awaiting_approval: Parked on a tool approval; completed, failed, cancelled, expired: Terminal.",
10673
- "type": "shortText",
10873
+ "description": "Current phase of the session. An active session is open between turns. A queued session is waiting for a worker to start or resume its job.",
10874
+ "type": "selectionStatic",
10674
10875
  "ormType": "varchar",
10675
10876
  "isSystem": true,
10676
10877
  "defaultValue": "queued",
10677
- "min": null,
10678
- "max": null,
10679
- "regexPattern": null,
10680
- "regexPatternNotMatchingErrorMsg": null,
10878
+ "selectionStaticValues": [
10879
+ "queued:Queued",
10880
+ "active:Active",
10881
+ "running:Running",
10882
+ "awaiting_input:Awaiting Input",
10883
+ "awaiting_approval:Awaiting Approval",
10884
+ "completed:Completed",
10885
+ "failed:Failed",
10886
+ "cancelled:Cancelled",
10887
+ "expired:Expired"
10888
+ ],
10889
+ "selectionValueType": "string",
10890
+ "isMultiSelect": false,
10681
10891
  "required": true,
10682
10892
  "unique": false,
10683
10893
  "index": false,
@@ -11142,7 +11352,11 @@
11142
11352
  "ormType": "varchar",
11143
11353
  "isSystem": true,
11144
11354
  "defaultValue": "start",
11145
- "selectionStaticValues": "start:Start (first prompt),resume:Resume (after a human reply),recover:Recover (after process death)",
11355
+ "selectionStaticValues": [
11356
+ "start:Start (first prompt)",
11357
+ "resume:Resume (after a human reply)",
11358
+ "recover:Recover (after process death)"
11359
+ ],
11146
11360
  "selectionValueType": "string",
11147
11361
  "required": true,
11148
11362
  "unique": false,
@@ -11200,7 +11414,14 @@
11200
11414
  "ormType": "varchar",
11201
11415
  "isSystem": true,
11202
11416
  "defaultValue": "queued",
11203
- "selectionStaticValues": "queued:Queued,running:Running,awaiting_input:Awaiting Input,succeeded:Succeeded,failed:Failed,cancelled:Cancelled",
11417
+ "selectionStaticValues": [
11418
+ "queued:Queued",
11419
+ "running:Running",
11420
+ "awaiting_input:Awaiting Input",
11421
+ "succeeded:Succeeded",
11422
+ "failed:Failed",
11423
+ "cancelled:Cancelled"
11424
+ ],
11204
11425
  "selectionValueType": "string",
11205
11426
  "required": true,
11206
11427
  "unique": false,
@@ -11255,6 +11476,20 @@
11255
11476
  "columnName": null,
11256
11477
  "enableAuditTracking": true
11257
11478
  },
11479
+ {
11480
+ "name": "dispatchedAt",
11481
+ "displayName": "Dispatched At",
11482
+ "description": "Most recent successful broker publish for this job.",
11483
+ "type": "datetime",
11484
+ "ormType": "timestamptz",
11485
+ "isSystem": true,
11486
+ "required": false,
11487
+ "unique": false,
11488
+ "index": false,
11489
+ "private": false,
11490
+ "encrypt": false,
11491
+ "enableAuditTracking": false
11492
+ },
11258
11493
  {
11259
11494
  "name": "attempts",
11260
11495
  "displayName": "Attempts",
@@ -11895,6 +12130,9 @@
11895
12130
  "selectionStaticValues": [
11896
12131
  "pending:Pending",
11897
12132
  "answered:Answered",
12133
+ "executing:Executing",
12134
+ "executed:Executed",
12135
+ "rejected:Rejected",
11898
12136
  "cancelled:Cancelled",
11899
12137
  "expired:Expired"
11900
12138
  ],
@@ -12182,6 +12420,11 @@
12182
12420
  "SettingController.getAllSettings",
12183
12421
  "AgentSessionController.findMany",
12184
12422
  "AgentSessionController.findOne",
12423
+ "AgentSessionController.messages",
12424
+ "AgentSessionController.listInbox",
12425
+ "AgentSessionController.getInboxRun",
12426
+ "AgentSessionController.connectInboxRun",
12427
+ "AgentSessionController.answerInboxRun",
12185
12428
  "AgentEventController.findMany",
12186
12429
  "AgentEventController.findOne",
12187
12430
  "AgentEventController.uploadAttachments",
@@ -13664,6 +13907,19 @@
13664
13907
  "moduleUserKey": "solid-core",
13665
13908
  "modelUserKey": "agentRegistry"
13666
13909
  },
13910
+ {
13911
+ "displayName": "Jobs inbox",
13912
+ "name": "agentSession-inbox-action",
13913
+ "type": "custom",
13914
+ "domain": "",
13915
+ "context": "{}",
13916
+ "customComponent": "/admin/core/solid-core/agent-session/inbox",
13917
+ "customIsModal": false,
13918
+ "serverEndpoint": "",
13919
+ "viewUserKey": "agentSession-list-view",
13920
+ "moduleUserKey": "solid-core",
13921
+ "modelUserKey": "agentSession"
13922
+ },
13667
13923
  {
13668
13924
  "displayName": "Agent Edit",
13669
13925
  "name": "agentRegistry-custom-edit-action",
@@ -14069,6 +14325,7 @@
14069
14325
  "displayName": "Agent",
14070
14326
  "name": "agent-menu-item",
14071
14327
  "sequenceNumber": 8,
14328
+ "roles": ["Internal User"],
14072
14329
  "actionUserKey": "",
14073
14330
  "moduleUserKey": "solid-core",
14074
14331
  "parentMenuItemUserKey": "",
@@ -14181,6 +14438,16 @@
14181
14438
  "parentMenuItemUserKey": "agent-menu-item",
14182
14439
  "iconName": "chat"
14183
14440
  },
14441
+ {
14442
+ "displayName": "Jobs inbox",
14443
+ "name": "agentSession-inbox-menu-item",
14444
+ "sequenceNumber": 7,
14445
+ "roles": ["Internal User"],
14446
+ "actionUserKey": "agentSession-inbox-action",
14447
+ "moduleUserKey": "solid-core",
14448
+ "parentMenuItemUserKey": "agent-menu-item",
14449
+ "iconName": "inbox"
14450
+ },
14184
14451
  {
14185
14452
  "displayName": "Config Versions",
14186
14453
  "name": "agentConfigVersion-menu-item",
@@ -7,6 +7,10 @@ export declare class AgentHubProcessManagerService {
7
7
  private getBaseUrl;
8
8
  private request;
9
9
  listProcesses(authorization: string): Promise<any[]>;
10
+ listJobSessions(authorization: string, review: boolean, offset: number): Promise<unknown>;
11
+ getJobSession(authorization: string, sessionId: string): Promise<unknown>;
12
+ connectJobSession(authorization: string, sessionId: string): Promise<unknown>;
13
+ answerJobSession(authorization: string, sessionId: string, requestId: number, answer: unknown): Promise<unknown>;
10
14
  stopProcess(processId: string, authorization: string): Promise<{
11
15
  status: string;
12
16
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-hub-process-manager.service.d.ts","sourceRoot":"","sources":["../../src/services/agent-hub-process-manager.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,qBACa,6BAA6B;IAEtC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc;IAGjD,OAAO,CAAC,UAAU;YAYJ,OAAO;IAiBrB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAI9C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAUxF,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,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EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvF,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAYzH"}
@@ -29,27 +29,43 @@ let AgentHubProcessManagerService = class AgentHubProcessManagerService {
29
29
  }
30
30
  return base;
31
31
  }
32
- async request(method, path, authorization) {
32
+ async request(method, path, authorization, data) {
33
33
  try {
34
34
  const response = await this.httpService.axiosRef.request({
35
35
  url: `${this.getBaseUrl()}${path}`,
36
36
  method,
37
37
  headers: { Authorization: authorization },
38
+ data,
38
39
  timeout: 15000,
39
40
  });
40
41
  return response.data;
41
42
  }
42
43
  catch (error) {
43
- if (error?.status)
44
+ if (error instanceof common_1.HttpException)
44
45
  throw error;
45
46
  const status = error?.response?.status;
46
47
  const detail = error?.response?.data?.detail ?? error?.response?.data?.message;
48
+ if ([400, 401, 403, 404, 409, 422, 429, 503].includes(status)) {
49
+ throw new common_1.HttpException(typeof detail === 'string' ? detail : 'AgentHub request failed.', status);
50
+ }
47
51
  throw new common_1.BadGatewayException(detail || `AgentHub manager request failed${status ? ` (${status})` : ''}.`);
48
52
  }
49
53
  }
50
54
  listProcesses(authorization) {
51
55
  return this.request('GET', '/api/processes', authorization);
52
56
  }
57
+ listJobSessions(authorization, review, offset) {
58
+ return this.request('GET', `/api/job-sessions?review=${review}&offset=${offset}`, authorization);
59
+ }
60
+ getJobSession(authorization, sessionId) {
61
+ return this.request('GET', `/api/job-sessions/${encodeURIComponent(sessionId)}`, authorization);
62
+ }
63
+ connectJobSession(authorization, sessionId) {
64
+ return this.request('POST', `/api/job-sessions/${encodeURIComponent(sessionId)}/connect`, authorization);
65
+ }
66
+ answerJobSession(authorization, sessionId, requestId, answer) {
67
+ return this.request('POST', `/api/job-sessions/${encodeURIComponent(sessionId)}/requests/${requestId}/answer`, authorization, answer);
68
+ }
53
69
  async stopProcess(processId, authorization) {
54
70
  const processes = await this.listProcesses(authorization);
55
71
  const process = processes.find((item) => String(item.id) === processId);
@@ -74,7 +90,7 @@ let AgentHubProcessManagerService = class AgentHubProcessManagerService {
74
90
  if (Number(process.agentId) !== agentId) {
75
91
  throw new common_1.ConflictException('The process is no longer linked to this agent.');
76
92
  }
77
- return this.restartAgent(agentId, authorization);
93
+ return this.request('POST', `/api/processes/${encodeURIComponent(processId)}/restart`, authorization);
78
94
  }
79
95
  };
80
96
  exports.AgentHubProcessManagerService = AgentHubProcessManagerService;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-hub-process-manager.service.js","sourceRoot":"","sources":["../../src/services/agent-hub-process-manager.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoI;AACpI,yCAA4C;AAC5C,uDAAmD;AAI5C,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACxC,YACmB,WAAwB,EACxB,cAA8B;QAD9B,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAEI,UAAU;QAChB,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAM,0BAA0B,CAAC,CAAC;QACvF,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;YACzD,MAAM,IAAI,oCAA2B,CAAC,yCAAyC,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,oCAA2B,CAAC,8CAA8C,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,C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,gCAAc;GAHtC,6BAA6B,CAiEzC","sourcesContent":["import { BadGatewayException, ConflictException, Injectable, NotFoundException, ServiceUnavailableException } from '@nestjs/common';\nimport { HttpService } from '@nestjs/axios';\nimport { SettingService } from './setting.service';\n\n/** Host-to-host API client for the AgentHub runtime manager control plane. */\n@Injectable()\nexport class AgentHubProcessManagerService {\n constructor(\n private readonly httpService: HttpService,\n private readonly settingService: SettingService,\n ) {}\n\n private getBaseUrl(): string {\n const configured = this.settingService.getConfigValue<any>('solidxAgentHubBackendUrl');\n if (typeof configured !== 'string' || !configured.trim()) {\n throw new ServiceUnavailableException('AgentHub manager URL is not configured.');\n }\n const base = configured.trim().replace(/\\/+$/, '');\n if (!/^https?:\\/\\//i.test(base)) {\n throw new ServiceUnavailableException('AgentHub manager URL must use HTTP or HTTPS.');\n }\n return base;\n }\n\n private async request<T>(method: 'GET' | 'POST', path: string, authorization: string): Promise<T> {\n try {\n const response = await this.httpService.axiosRef.request<T>({\n url: `${this.getBaseUrl()}${path}`,\n method,\n headers: { Authorization: authorization },\n timeout: 15000,\n });\n return response.data;\n } catch (error: any) {\n if (error?.status) throw error;\n const status = error?.response?.status;\n const detail = error?.response?.data?.detail ?? error?.response?.data?.message;\n throw new BadGatewayException(detail || `AgentHub manager request failed${status ? ` (${status})` : ''}.`);\n }\n }\n\n listProcesses(authorization: string): Promise<any[]> {\n return this.request('GET', '/api/processes', authorization);\n }\n\n async stopProcess(processId: string, authorization: string): Promise<{ status: string }> {\n const processes = await this.listProcesses(authorization);\n const process = processes.find((item) => String(item.id) === processId);\n if (!process) throw new NotFoundException('Runtime process was not found.');\n if (process.status !== 'ready') {\n throw new ConflictException(`Only a ready process can be stopped (current status: ${process.status}).`);\n }\n return this.request('POST', `/api/processes/${encodeURIComponent(processId)}/stop`, authorization);\n }\n\n restartAgent(agentId: number, authorization: string): Promise<{ id: string; status: string }> {\n return this.request('POST', `/api/agents/${agentId}/restart`, authorization);\n }\n\n async restartProcess(processId: string, agentId: number, authorization: string): Promise<{ id: string; status: string }> {\n const processes = await this.listProcesses(authorization);\n const process = processes.find((item) => String(item.id) === processId);\n if (!process) throw new NotFoundException('Runtime process was not found.');\n if (process.status !== 'ready') {\n throw new ConflictException(`Only a ready process can restart its agent (current status: ${process.status}).`);\n }\n if (Number(process.agentId) !== agentId) {\n throw new ConflictException('The process is no longer linked to this agent.');\n }\n return this.restartAgent(agentId, authorization);\n }\n}\n"]}
1
+ {"version":3,"file":"agent-hub-process-manager.service.js","sourceRoot":"","sources":["../../src/services/agent-hub-process-manager.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmJ;AACnJ,yCAA4C;AAC5C,uDAAmD;AAI5C,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACxC,YACmB,WAAwB,EACxB,cAA8B;QAD9B,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAEI,UAAU;QAChB,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAM,0BAA0B,CAAC,CAAC;QACvF,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;YACzD,MAAM,IAAI,oCAA2B,CAAC,yCAAyC,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,oCAA2B,CAAC,8CAA8C,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,MAAsB,EAAE,IAAY,EAAE,aAAqB,EAAE,IAAc;QAClG,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,C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,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,OAAO,UAAU,EAAE,aAAa,CAAC,CAAC;IAC/E,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB,EAAE,OAAe,EAAE,aAAqB;QAC5E,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC;QACxE,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,0BAAiB,CAAC,gCAAgC,CAAC,CAAC;QAC5E,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,0BAAiB,CAAC,+DAA+D,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;QACjH,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,CAAC;YACxC,MAAM,IAAI,0BAAiB,CAAC,gDAAgD,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,kBAAkB,CAAC,SAAS,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACxG,CAAC;CACF,CAAA;AAtFY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,mBAAU,GAAE;qCAGqB,mBAAW;QACR,gCAAc;GAHtC,6BAA6B,CAsFzC","sourcesContent":["import { BadGatewayException, ConflictException, HttpException, Injectable, NotFoundException, ServiceUnavailableException } from '@nestjs/common';\nimport { HttpService } from '@nestjs/axios';\nimport { SettingService } from './setting.service';\n\n/** Host-to-host API client for the AgentHub runtime manager control plane. */\n@Injectable()\nexport class AgentHubProcessManagerService {\n constructor(\n private readonly httpService: HttpService,\n private readonly settingService: SettingService,\n ) {}\n\n private getBaseUrl(): string {\n const configured = this.settingService.getConfigValue<any>('solidxAgentHubBackendUrl');\n if (typeof configured !== 'string' || !configured.trim()) {\n throw new ServiceUnavailableException('AgentHub manager URL is not configured.');\n }\n const base = configured.trim().replace(/\\/+$/, '');\n if (!/^https?:\\/\\//i.test(base)) {\n throw new ServiceUnavailableException('AgentHub manager URL must use HTTP or HTTPS.');\n }\n return base;\n }\n\n private async request<T>(method: 'GET' | 'POST', path: string, authorization: string, data?: unknown): Promise<T> {\n try {\n const response = await this.httpService.axiosRef.request<T>({\n url: `${this.getBaseUrl()}${path}`,\n method,\n headers: { Authorization: authorization },\n data,\n timeout: 15000,\n });\n return response.data;\n } catch (error: any) {\n if (error instanceof HttpException) throw error;\n const status = error?.response?.status;\n const detail = error?.response?.data?.detail ?? error?.response?.data?.message;\n if ([400, 401, 403, 404, 409, 422, 429, 503].includes(status)) {\n throw new HttpException(typeof detail === 'string' ? detail : 'AgentHub request failed.', status);\n }\n throw new BadGatewayException(detail || `AgentHub manager request failed${status ? ` (${status})` : ''}.`);\n }\n }\n\n listProcesses(authorization: string): Promise<any[]> {\n return this.request('GET', '/api/processes', authorization);\n }\n\n listJobSessions(authorization: string, review: boolean, offset: number) {\n return this.request('GET', `/api/job-sessions?review=${review}&offset=${offset}`, authorization);\n }\n\n getJobSession(authorization: string, sessionId: string) {\n return this.request('GET', `/api/job-sessions/${encodeURIComponent(sessionId)}`, authorization);\n }\n\n connectJobSession(authorization: string, sessionId: string) {\n return this.request('POST', `/api/job-sessions/${encodeURIComponent(sessionId)}/connect`, authorization);\n }\n\n answerJobSession(authorization: string, sessionId: string, requestId: number, answer: unknown) {\n return this.request('POST', `/api/job-sessions/${encodeURIComponent(sessionId)}/requests/${requestId}/answer`,\n authorization, answer);\n }\n\n async stopProcess(processId: string, authorization: string): Promise<{ status: string }> {\n const processes = await this.listProcesses(authorization);\n const process = processes.find((item) => String(item.id) === processId);\n if (!process) throw new NotFoundException('Runtime process was not found.');\n if (process.status !== 'ready') {\n throw new ConflictException(`Only a ready process can be stopped (current status: ${process.status}).`);\n }\n return this.request('POST', `/api/processes/${encodeURIComponent(processId)}/stop`, authorization);\n }\n\n restartAgent(agentId: number, authorization: string): Promise<{ id: string; status: string }> {\n return this.request('POST', `/api/agents/${agentId}/restart`, authorization);\n }\n\n async restartProcess(processId: string, agentId: number, authorization: string): Promise<{ id: string; status: string }> {\n const processes = await this.listProcesses(authorization);\n const process = processes.find((item) => String(item.id) === processId);\n if (!process) throw new NotFoundException('Runtime process was not found.');\n if (process.status !== 'ready') {\n throw new ConflictException(`Only a ready process can restart its agent (current status: ${process.status}).`);\n }\n if (Number(process.agentId) !== agentId) {\n throw new ConflictException('The process is no longer linked to this agent.');\n }\n return this.request('POST', `/api/processes/${encodeURIComponent(processId)}/restart`, authorization);\n }\n}\n"]}
@@ -4,6 +4,7 @@ import { CRUDService } from './crud.service';
4
4
  import { AgentRegistry } from '../entities/agent-registry.entity';
5
5
  import { AgentRegistryRepository } from '../repository/agent-registry.repository';
6
6
  import { ActivateAgentRegistryDto } from '../dtos/activate-agent-registry.dto';
7
+ import { UpdateAgentDeploymentDto } from '../dtos/update-agent-deployment.dto';
7
8
  export declare class AgentRegistryService extends CRUDService<AgentRegistry> {
8
9
  readonly entityManager: EntityManager;
9
10
  readonly repo: AgentRegistryRepository;
@@ -13,6 +14,13 @@ export declare class AgentRegistryService extends CRUDService<AgentRegistry> {
13
14
  create(createDto: any, files?: Express.Multer.File[], solidRequestContext?: any): Promise<AgentRegistry>;
14
15
  createMany(createDtos: any[], solidRequestContext?: any): Promise<AgentRegistry[]>;
15
16
  update(id: number, updateDto: any, files?: Express.Multer.File[], isPartialUpdate?: boolean, solidRequestContext?: any, isUpdate?: boolean): Promise<AgentRegistry>;
17
+ updateDeployment(id: number, dto: UpdateAgentDeploymentDto): Promise<{
18
+ runner: string;
19
+ minProcesses: number;
20
+ maxProcesses: number;
21
+ processCpu: number;
22
+ processMemory: number;
23
+ }>;
16
24
  activate(id: number, dto?: ActivateAgentRegistryDto): Promise<AgentRegistry>;
17
25
  }
18
26
  //# sourceMappingURL=agent-registry.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-registry.service.d.ts","sourceRoot":"","sources":["../../src/services/agent-registry.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAG,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAM/E,qBACa,oBAAqB,SAAQ,WAAW,CAAC,aAAa,CAAC;IAIhE,QAAQ,CAAC,aAAa,EAAE,aAAa;IACrC,QAAQ,CAAC,IAAI,EAAE,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,SAAS;IAL/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;gBAGrD,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,uBAAuB,EAC7B,SAAS,EAAE,SAAS;IAMhB,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,GAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAO,EAAE,mBAAmB,GAAE,GAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhH,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,EAAE,mBAAmB,GAAE,GAAQ,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAItF,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,GAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAO,EAAE,eAAe,UAAQ,EAAE,mBAAmB,GAAE,GAAQ,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAAC,aAAa,CA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AQ,EAAE,mBAAmB,GAAE,GAAQ,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;IAqBhL,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,wBAAwB;;;;;;;IA+B1D,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,wBAA6B,GAAG,OAAO,CAAC,aAAa,CAAC;CA0BvF"}
@@ -23,6 +23,7 @@ const agent_registry_entity_1 = require("../entities/agent-registry.entity");
23
23
  const agent_registry_repository_1 = require("../repository/agent-registry.repository");
24
24
  const agent_config_version_entity_1 = require("../entities/agent-config-version.entity");
25
25
  const agent_config_version_service_1 = require("./agent-config-version.service");
26
+ const agent_config_version_name_1 = require("../helpers/agent-config-version-name");
26
27
  const agent_required_inputs_1 = require("../helpers/agent-required-inputs");
27
28
  const module_metadata_helper_service_1 = require("../helpers/module-metadata-helper.service");
28
29
  const agenthub_metadata_sync_util_1 = require("../subscribers/agenthub-metadata-sync.util");
@@ -54,6 +55,36 @@ let AgentRegistryService = AgentRegistryService_1 = class AgentRegistryService e
54
55
  await (0, agent_config_version_service_1.markActiveAgentsDraft)(this.entityManager, [saved.id]);
55
56
  return this.repo.findOne({ where: { id: saved.id } });
56
57
  }
58
+ async updateDeployment(id, dto) {
59
+ return this.entityManager.transaction(async (manager) => {
60
+ const repository = manager.getRepository(agent_registry_entity_1.AgentRegistry);
61
+ const agent = await repository.findOne({ where: { id }, lock: { mode: 'pessimistic_write' } });
62
+ if (!agent)
63
+ throw new common_1.NotFoundException(`Agent ${id} was not found.`);
64
+ const runner = dto.runner === undefined ? agent.runner : dto.runner;
65
+ const minProcesses = dto.minProcesses ?? agent.minProcesses;
66
+ const maxProcesses = dto.maxProcesses === undefined ? agent.maxProcesses : dto.maxProcesses;
67
+ const processCpu = dto.processCpu === undefined ? agent.processCpu : dto.processCpu;
68
+ const processMemory = dto.processMemory === undefined ? agent.processMemory : dto.processMemory;
69
+ if (maxProcesses !== null && minProcesses > maxProcesses) {
70
+ throw new common_1.BadRequestException('Minimum processes cannot exceed maximum processes.');
71
+ }
72
+ if (runner === 'docker' || runner === 'ecs') {
73
+ const links = await repository.createQueryBuilder('agent')
74
+ .innerJoin('agent.agentTools', 'link')
75
+ .innerJoin('link.agentToolRegistry', 'tool')
76
+ .select('tool.name', 'name')
77
+ .where('agent.id = :id', { id })
78
+ .getRawMany();
79
+ if (links.some(({ name }) => name.startsWith('browser_'))) {
80
+ throw new common_1.BadRequestException('Agents with browser tools require the local runner.');
81
+ }
82
+ }
83
+ const deployment = { runner, minProcesses, maxProcesses, processCpu, processMemory };
84
+ await repository.update(id, deployment);
85
+ return deployment;
86
+ });
87
+ }
57
88
  async activate(id, dto = {}) {
58
89
  return this.entityManager.transaction(async (manager) => {
59
90
  const agentRepository = manager.getRepository(agent_registry_entity_1.AgentRegistry);
@@ -70,7 +101,7 @@ let AgentRegistryService = AgentRegistryService_1 = class AgentRegistryService e
70
101
  await versionRepository.save(versionRepository.create({
71
102
  agentRegistry: agent,
72
103
  versionNumber,
73
- name: dto.name?.trim() || null,
104
+ name: (0, agent_config_version_name_1.buildAgentConfigVersionName)(dto.name, versionNumber),
74
105
  description: dto.description?.trim() || null,
75
106
  }));
76
107
  agent.configVersion = versionNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-registry.service.js","sourceRoot":"","sources":["../../src/services/agent-registry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,6CAAsD;AACtD,uCAA0C;AAC1C,qCAAwC;AACxC,iDAA6C;AAC7C,6EAAkE;AAClE,uFAAkF;AAClF,yFAA6E;AAE7E,iFAAuE;AACvE,4EAAgF;AAChF,8FAAwF;AACxF,4FAAgG;AAGzF,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,0BAA0B;IAElE,YAEE,aAAqC,EAC5B,IAA6B,EAC7B,SAAoB;QAG9B,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE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ager } from '@nestjs/typeorm';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { EntityManager } from 'typeorm';\nimport { CRUDService } from './crud.service';\nimport { AgentRegistry } from '../entities/agent-registry.entity';\nimport { AgentRegistryRepository } from '../repository/agent-registry.repository';\nimport { AgentConfigVersion } from '../entities/agent-config-version.entity';\nimport { ActivateAgentRegistryDto } from '../dtos/activate-agent-registry.dto';\nimport { markActiveAgentsDraft } from './agent-config-version.service';\nimport { normalizeAgentRequiredInputs } from '../helpers/agent-required-inputs';\nimport { ModuleMetadataHelperService } from '../helpers/module-metadata-helper.service';\nimport { syncEntityTagsToModuleMetadataJson } from '../subscribers/agenthub-metadata-sync.util';\n\n@Injectable()\nexport class AgentRegistryService extends CRUDService<AgentRegistry>{\n private readonly logger = new Logger(AgentRegistryService.name);\n constructor(\n @InjectEntityManager(\"default\")\n readonly entityManager: EntityManager,\n readonly repo: AgentRegistryRepository,\n readonly moduleRef: ModuleRef,\n \n ) {\n super(entityManager, repo, 'agentRegistry', 'agent-hub', moduleRef);\n }\n\n override async create(createDto: any, files: Express.Multer.File[] = [], solidRequestContext: any = {}): Promise<AgentRegistry> {\n return super.create({ ...createDto, requiredInputs: normalizeAgentRequiredInputs(createDto.requiredInputs), configVersion: 1 }, files, solidRequestContext);\n }\n\n override async createMany(createDtos: any[], solidRequestContext: any = {}): Promise<AgentRegistry[]> {\n return super.createMany(createDtos.map((dto) => ({ ...dto, requiredInputs: normalizeAgentRequiredInputs(dto.requiredInputs), configVersion: 1 })), solidRequestContext);\n }\n\n override async update(id: number, updateDto: any, files: Express.Multer.File[] = [], isPartialUpdate = false, solidRequestContext: any = {}, isUpdate = false): Promise<AgentRegistry> {\n const { configVersion: _ignored, ...changes } = updateDto;\n if ('requiredInputs' in changes) changes.requiredInputs = normalizeAgentRequiredInputs(changes.requiredInputs);\n const saved = await super.update(id, changes, files, isPartialUpdate, solidRequestContext, isUpdate);\n if ('tagsCommand' in changes) {\n const agent = await this.repo.findOne({ where: { id: saved.id }, relations: { module: true, tags: true } });\n if (agent) {\n await syncEntityTagsToModuleMetadataJson(\n agent.module?.name,\n 'agenthubAgents',\n agent.name,\n agent.tags ?? [],\n this.moduleRef.get(ModuleMetadataHelperService, { strict: false }),\n this.logger,\n );\n }\n }\n await markActiveAgentsDraft(this.entityManager, [saved.id]);\n return this.repo.findOne({ where: { id: saved.id } });\n }\n\n async activate(id: number, dto: ActivateAgentRegistryDto = {}): Promise<AgentRegistry> {\n return this.entityManager.transaction(async (manager) => {\n const agentRepository = manager.getRepository(AgentRegistry);\n const versionRepository = manager.getRepository(AgentConfigVersion);\n const agent = await agentRepository.findOne({ where: { id } });\n if (!agent) throw new NotFoundException(`Agent ${id} was not found.`);\n\n const latestVersion = await versionRepository.findOne({\n where: { agentRegistry: { id } },\n order: { versionNumber: 'DESC' },\n });\n const currentVersion = Math.max(Number(agent.configVersion ?? 1), Number(latestVersion?.versionNumber ?? 0));\n const versionNumber = latestVersion ? currentVersion + 1 : currentVersion;\n\n await versionRepository.save(versionRepository.create({\n agentRegistry: agent,\n versionNumber,\n name: dto.name?.trim() || null,\n description: dto.description?.trim() || null,\n }));\n\n agent.configVersion = versionNumber;\n agent.status = 'active';\n return agentRepository.save(agent);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"agent-registry.service.js","sourceRoot":"","sources":["../../src/services/agent-registry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4F;AAC5F,6CAAsD;AACtD,uCAA0C;AAC1C,qCAAwC;AACxC,iDAA6C;AAC7C,6EAAkE;AAClE,uFAAkF;AAClF,yFAA6E;AAG7E,iFAAuE;AACvE,oFAAmF;AACnF,4EAAgF;AAChF,8FAAwF;AACxF,4FAAgG;AAGzF,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,0BAA0B;IAElE,YAEE,aAAqC,EAC5B,IAA6B,EAC7B,SAAoB;QAG9B,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,WA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C,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;YAE1E,MAAM,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;gBACpD,aAAa,EAAE,KAAK;gBACpB,aAAa;gBACb,IAAI,EAAE,IAAA,uDAA2B,EAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC;gBAC1D,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,IAAI;aAC7C,CAAC,CAAC,CAAC;YAEJ,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;YACpC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;YACxB,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAlGY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,6BAAmB,EAAC,SAAS,CAAC,CAAA;qCACP,uBAAa;QACtB,mDAAuB;QAClB,gBAAS;GANpB,oBAAoB,CAkGhC","sourcesContent":["import { BadRequestException, Injectable, Logger, NotFoundException } from '@nestjs/common';\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { EntityManager } from 'typeorm';\nimport { CRUDService } from './crud.service';\nimport { AgentRegistry } from '../entities/agent-registry.entity';\nimport { AgentRegistryRepository } from '../repository/agent-registry.repository';\nimport { AgentConfigVersion } from '../entities/agent-config-version.entity';\nimport { ActivateAgentRegistryDto } from '../dtos/activate-agent-registry.dto';\nimport { UpdateAgentDeploymentDto } from '../dtos/update-agent-deployment.dto';\nimport { markActiveAgentsDraft } from './agent-config-version.service';\nimport { buildAgentConfigVersionName } from '../helpers/agent-config-version-name';\nimport { normalizeAgentRequiredInputs } from '../helpers/agent-required-inputs';\nimport { ModuleMetadataHelperService } from '../helpers/module-metadata-helper.service';\nimport { syncEntityTagsToModuleMetadataJson } from '../subscribers/agenthub-metadata-sync.util';\n\n@Injectable()\nexport class AgentRegistryService extends CRUDService<AgentRegistry>{\n private readonly logger = new Logger(AgentRegistryService.name);\n constructor(\n @InjectEntityManager(\"default\")\n readonly entityManager: EntityManager,\n readonly repo: AgentRegistryRepository,\n readonly moduleRef: ModuleRef,\n \n ) {\n super(entityManager, repo, 'agentRegistry', 'agent-hub', moduleRef);\n }\n\n override async create(createDto: any, files: Express.Multer.File[] = [], solidRequestContext: any = {}): Promise<AgentRegistry> {\n return super.create({ ...createDto, requiredInputs: normalizeAgentRequiredInputs(createDto.requiredInputs), configVersion: 1 }, files, solidRequestContext);\n }\n\n override async createMany(createDtos: any[], solidRequestContext: any = {}): Promise<AgentRegistry[]> {\n return super.createMany(createDtos.map((dto) => ({ ...dto, requiredInputs: normalizeAgentRequiredInputs(dto.requiredInputs), configVersion: 1 })), solidRequestContext);\n }\n\n override async update(id: number, updateDto: any, files: Express.Multer.File[] = [], isPartialUpdate = false, solidRequestContext: any = {}, isUpdate = false): Promise<AgentRegistry> {\n const { configVersion: _ignored, ...changes } = updateDto;\n if ('requiredInputs' in changes) changes.requiredInputs = normalizeAgentRequiredInputs(changes.requiredInputs);\n const saved = await super.update(id, changes, files, isPartialUpdate, solidRequestContext, isUpdate);\n if ('tagsCommand' in changes) {\n const agent = await this.repo.findOne({ where: { id: saved.id }, relations: { module: true, tags: true } });\n if (agent) {\n await syncEntityTagsToModuleMetadataJson(\n agent.module?.name,\n 'agenthubAgents',\n agent.name,\n agent.tags ?? [],\n this.moduleRef.get(ModuleMetadataHelperService, { strict: false }),\n this.logger,\n );\n }\n }\n await markActiveAgentsDraft(this.entityManager, [saved.id]);\n return this.repo.findOne({ where: { id: saved.id } });\n }\n\n async updateDeployment(id: number, dto: UpdateAgentDeploymentDto) {\n return this.entityManager.transaction(async (manager) => {\n const repository = manager.getRepository(AgentRegistry);\n const agent = await repository.findOne({ where: { id }, lock: { mode: 'pessimistic_write' } });\n if (!agent) throw new NotFoundException(`Agent ${id} was not found.`);\n\n const runner = dto.runner === undefined ? agent.runner : dto.runner;\n const minProcesses = dto.minProcesses ?? agent.minProcesses;\n const maxProcesses = dto.maxProcesses === undefined ? agent.maxProcesses : dto.maxProcesses;\n const processCpu = dto.processCpu === undefined ? agent.processCpu : dto.processCpu;\n const processMemory = dto.processMemory === undefined ? agent.processMemory : dto.processMemory;\n if (maxProcesses !== null && minProcesses > maxProcesses) {\n throw new BadRequestException('Minimum processes cannot exceed maximum processes.');\n }\n if (runner === 'docker' || runner === 'ecs') {\n const links = await repository.createQueryBuilder('agent')\n .innerJoin('agent.agentTools', 'link')\n .innerJoin('link.agentToolRegistry', 'tool')\n .select('tool.name', 'name')\n .where('agent.id = :id', { id })\n .getRawMany<{ name: string }>();\n if (links.some(({ name }) => name.startsWith('browser_'))) {\n throw new BadRequestException('Agents with browser tools require the local runner.');\n }\n }\n const deployment = { runner, minProcesses, maxProcesses, processCpu, processMemory };\n await repository.update(id, deployment);\n return deployment;\n });\n }\n\n async activate(id: number, dto: ActivateAgentRegistryDto = {}): Promise<AgentRegistry> {\n return this.entityManager.transaction(async (manager) => {\n const agentRepository = manager.getRepository(AgentRegistry);\n const versionRepository = manager.getRepository(AgentConfigVersion);\n const agent = await agentRepository.findOne({ where: { id } });\n if (!agent) throw new NotFoundException(`Agent ${id} was not found.`);\n\n const latestVersion = await versionRepository.findOne({\n where: { agentRegistry: { id } },\n order: { versionNumber: 'DESC' },\n });\n const currentVersion = Math.max(Number(agent.configVersion ?? 1), Number(latestVersion?.versionNumber ?? 0));\n const versionNumber = latestVersion ? currentVersion + 1 : currentVersion;\n\n await versionRepository.save(versionRepository.create({\n agentRegistry: agent,\n versionNumber,\n name: buildAgentConfigVersionName(dto.name, versionNumber),\n description: dto.description?.trim() || null,\n }));\n\n agent.configVersion = versionNumber;\n agent.status = 'active';\n return agentRepository.save(agent);\n });\n }\n}\n"]}