@vertesia/common 0.24.0-dev.202601221707

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 (388) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +53 -0
  3. package/lib/cjs/Progress.js +61 -0
  4. package/lib/cjs/Progress.js.map +1 -0
  5. package/lib/cjs/access-control.js +56 -0
  6. package/lib/cjs/access-control.js.map +1 -0
  7. package/lib/cjs/analytics.js +3 -0
  8. package/lib/cjs/analytics.js.map +1 -0
  9. package/lib/cjs/apikey.js +16 -0
  10. package/lib/cjs/apikey.js.map +1 -0
  11. package/lib/cjs/apps.js +35 -0
  12. package/lib/cjs/apps.js.map +1 -0
  13. package/lib/cjs/ask-user.js +8 -0
  14. package/lib/cjs/ask-user.js.map +1 -0
  15. package/lib/cjs/channels.js +63 -0
  16. package/lib/cjs/channels.js.map +1 -0
  17. package/lib/cjs/common.js +3 -0
  18. package/lib/cjs/common.js.map +1 -0
  19. package/lib/cjs/data-platform.js +127 -0
  20. package/lib/cjs/data-platform.js.map +1 -0
  21. package/lib/cjs/email.js +20 -0
  22. package/lib/cjs/email.js.map +1 -0
  23. package/lib/cjs/environment.js +44 -0
  24. package/lib/cjs/environment.js.map +1 -0
  25. package/lib/cjs/facets.js +3 -0
  26. package/lib/cjs/facets.js.map +1 -0
  27. package/lib/cjs/group.js +5 -0
  28. package/lib/cjs/group.js.map +1 -0
  29. package/lib/cjs/index.js +55 -0
  30. package/lib/cjs/index.js.map +1 -0
  31. package/lib/cjs/integrations.js +14 -0
  32. package/lib/cjs/integrations.js.map +1 -0
  33. package/lib/cjs/interaction.js +97 -0
  34. package/lib/cjs/interaction.js.map +1 -0
  35. package/lib/cjs/json-schema.js +3 -0
  36. package/lib/cjs/json-schema.js.map +1 -0
  37. package/lib/cjs/json.js +3 -0
  38. package/lib/cjs/json.js.map +1 -0
  39. package/lib/cjs/meters.js +13 -0
  40. package/lib/cjs/meters.js.map +1 -0
  41. package/lib/cjs/model_utility.js +6 -0
  42. package/lib/cjs/model_utility.js.map +1 -0
  43. package/lib/cjs/package.json +3 -0
  44. package/lib/cjs/payload.js +3 -0
  45. package/lib/cjs/payload.js.map +1 -0
  46. package/lib/cjs/pending-asks.js +7 -0
  47. package/lib/cjs/pending-asks.js.map +1 -0
  48. package/lib/cjs/project.js +107 -0
  49. package/lib/cjs/project.js.map +1 -0
  50. package/lib/cjs/prompt.js +21 -0
  51. package/lib/cjs/prompt.js.map +1 -0
  52. package/lib/cjs/query.js +3 -0
  53. package/lib/cjs/query.js.map +1 -0
  54. package/lib/cjs/rate-limiter.js +6 -0
  55. package/lib/cjs/rate-limiter.js.map +1 -0
  56. package/lib/cjs/refs.js +14 -0
  57. package/lib/cjs/refs.js.map +1 -0
  58. package/lib/cjs/runs.js +3 -0
  59. package/lib/cjs/runs.js.map +1 -0
  60. package/lib/cjs/skill.js +14 -0
  61. package/lib/cjs/skill.js.map +1 -0
  62. package/lib/cjs/store/activity-catalog.js +3 -0
  63. package/lib/cjs/store/activity-catalog.js.map +1 -0
  64. package/lib/cjs/store/collections.js +9 -0
  65. package/lib/cjs/store/collections.js.map +1 -0
  66. package/lib/cjs/store/common.js +3 -0
  67. package/lib/cjs/store/common.js.map +1 -0
  68. package/lib/cjs/store/conversation-state.js +3 -0
  69. package/lib/cjs/store/conversation-state.js.map +1 -0
  70. package/lib/cjs/store/doc-analyzer.js +3 -0
  71. package/lib/cjs/store/doc-analyzer.js.map +1 -0
  72. package/lib/cjs/store/dsl-workflow.js +5 -0
  73. package/lib/cjs/store/dsl-workflow.js.map +1 -0
  74. package/lib/cjs/store/index.js +30 -0
  75. package/lib/cjs/store/index.js.map +1 -0
  76. package/lib/cjs/store/object-types.js +98 -0
  77. package/lib/cjs/store/object-types.js.map +1 -0
  78. package/lib/cjs/store/schedule.js +32 -0
  79. package/lib/cjs/store/schedule.js.map +1 -0
  80. package/lib/cjs/store/signals.js +3 -0
  81. package/lib/cjs/store/signals.js.map +1 -0
  82. package/lib/cjs/store/store.js +166 -0
  83. package/lib/cjs/store/store.js.map +1 -0
  84. package/lib/cjs/store/temporalio.js +44 -0
  85. package/lib/cjs/store/temporalio.js.map +1 -0
  86. package/lib/cjs/store/worker.js +3 -0
  87. package/lib/cjs/store/worker.js.map +1 -0
  88. package/lib/cjs/store/workflow.js +241 -0
  89. package/lib/cjs/store/workflow.js.map +1 -0
  90. package/lib/cjs/sts-token-types.js +32 -0
  91. package/lib/cjs/sts-token-types.js.map +1 -0
  92. package/lib/cjs/tenant.js +3 -0
  93. package/lib/cjs/tenant.js.map +1 -0
  94. package/lib/cjs/tool-execution.js +6 -0
  95. package/lib/cjs/tool-execution.js.map +1 -0
  96. package/lib/cjs/training.js +14 -0
  97. package/lib/cjs/training.js.map +1 -0
  98. package/lib/cjs/transient-tokens.js +9 -0
  99. package/lib/cjs/transient-tokens.js.map +1 -0
  100. package/lib/cjs/user.js +25 -0
  101. package/lib/cjs/user.js.map +1 -0
  102. package/lib/cjs/utils/auth.js +15 -0
  103. package/lib/cjs/utils/auth.js.map +1 -0
  104. package/lib/cjs/utils/schemas.js +114 -0
  105. package/lib/cjs/utils/schemas.js.map +1 -0
  106. package/lib/cjs/utils/type-helpers.js +3 -0
  107. package/lib/cjs/utils/type-helpers.js.map +1 -0
  108. package/lib/cjs/versions.js +8 -0
  109. package/lib/cjs/versions.js.map +1 -0
  110. package/lib/cjs/workflow-analytics.js +52 -0
  111. package/lib/cjs/workflow-analytics.js.map +1 -0
  112. package/lib/esm/Progress.js +57 -0
  113. package/lib/esm/Progress.js.map +1 -0
  114. package/lib/esm/access-control.js +53 -0
  115. package/lib/esm/access-control.js.map +1 -0
  116. package/lib/esm/analytics.js +2 -0
  117. package/lib/esm/analytics.js.map +1 -0
  118. package/lib/esm/apikey.js +13 -0
  119. package/lib/esm/apikey.js.map +1 -0
  120. package/lib/esm/apps.js +32 -0
  121. package/lib/esm/apps.js.map +1 -0
  122. package/lib/esm/ask-user.js +7 -0
  123. package/lib/esm/ask-user.js.map +1 -0
  124. package/lib/esm/channels.js +57 -0
  125. package/lib/esm/channels.js.map +1 -0
  126. package/lib/esm/common.js +2 -0
  127. package/lib/esm/common.js.map +1 -0
  128. package/lib/esm/data-platform.js +124 -0
  129. package/lib/esm/data-platform.js.map +1 -0
  130. package/lib/esm/email.js +16 -0
  131. package/lib/esm/email.js.map +1 -0
  132. package/lib/esm/environment.js +41 -0
  133. package/lib/esm/environment.js.map +1 -0
  134. package/lib/esm/facets.js +2 -0
  135. package/lib/esm/facets.js.map +1 -0
  136. package/lib/esm/group.js +2 -0
  137. package/lib/esm/group.js.map +1 -0
  138. package/lib/esm/index.js +39 -0
  139. package/lib/esm/index.js.map +1 -0
  140. package/lib/esm/integrations.js +11 -0
  141. package/lib/esm/integrations.js.map +1 -0
  142. package/lib/esm/interaction.js +92 -0
  143. package/lib/esm/interaction.js.map +1 -0
  144. package/lib/esm/json-schema.js +2 -0
  145. package/lib/esm/json-schema.js.map +1 -0
  146. package/lib/esm/json.js +2 -0
  147. package/lib/esm/json.js.map +1 -0
  148. package/lib/esm/meters.js +10 -0
  149. package/lib/esm/meters.js.map +1 -0
  150. package/lib/esm/model_utility.js +2 -0
  151. package/lib/esm/model_utility.js.map +1 -0
  152. package/lib/esm/payload.js +2 -0
  153. package/lib/esm/payload.js.map +1 -0
  154. package/lib/esm/pending-asks.js +6 -0
  155. package/lib/esm/pending-asks.js.map +1 -0
  156. package/lib/esm/project.js +102 -0
  157. package/lib/esm/project.js.map +1 -0
  158. package/lib/esm/prompt.js +18 -0
  159. package/lib/esm/prompt.js.map +1 -0
  160. package/lib/esm/query.js +2 -0
  161. package/lib/esm/query.js.map +1 -0
  162. package/lib/esm/rate-limiter.js +5 -0
  163. package/lib/esm/rate-limiter.js.map +1 -0
  164. package/lib/esm/refs.js +11 -0
  165. package/lib/esm/refs.js.map +1 -0
  166. package/lib/esm/runs.js +2 -0
  167. package/lib/esm/runs.js.map +1 -0
  168. package/lib/esm/skill.js +13 -0
  169. package/lib/esm/skill.js.map +1 -0
  170. package/lib/esm/store/activity-catalog.js +2 -0
  171. package/lib/esm/store/activity-catalog.js.map +1 -0
  172. package/lib/esm/store/collections.js +6 -0
  173. package/lib/esm/store/collections.js.map +1 -0
  174. package/lib/esm/store/common.js +2 -0
  175. package/lib/esm/store/common.js.map +1 -0
  176. package/lib/esm/store/conversation-state.js +2 -0
  177. package/lib/esm/store/conversation-state.js.map +1 -0
  178. package/lib/esm/store/doc-analyzer.js +2 -0
  179. package/lib/esm/store/doc-analyzer.js.map +1 -0
  180. package/lib/esm/store/dsl-workflow.js +2 -0
  181. package/lib/esm/store/dsl-workflow.js.map +1 -0
  182. package/lib/esm/store/index.js +14 -0
  183. package/lib/esm/store/index.js.map +1 -0
  184. package/lib/esm/store/object-types.js +95 -0
  185. package/lib/esm/store/object-types.js.map +1 -0
  186. package/lib/esm/store/schedule.js +29 -0
  187. package/lib/esm/store/schedule.js.map +1 -0
  188. package/lib/esm/store/signals.js +2 -0
  189. package/lib/esm/store/signals.js.map +1 -0
  190. package/lib/esm/store/store.js +160 -0
  191. package/lib/esm/store/store.js.map +1 -0
  192. package/lib/esm/store/temporalio.js +41 -0
  193. package/lib/esm/store/temporalio.js.map +1 -0
  194. package/lib/esm/store/worker.js +2 -0
  195. package/lib/esm/store/worker.js.map +1 -0
  196. package/lib/esm/store/workflow.js +228 -0
  197. package/lib/esm/store/workflow.js.map +1 -0
  198. package/lib/esm/sts-token-types.js +24 -0
  199. package/lib/esm/sts-token-types.js.map +1 -0
  200. package/lib/esm/tenant.js +2 -0
  201. package/lib/esm/tenant.js.map +1 -0
  202. package/lib/esm/tool-execution.js +5 -0
  203. package/lib/esm/tool-execution.js.map +1 -0
  204. package/lib/esm/training.js +11 -0
  205. package/lib/esm/training.js.map +1 -0
  206. package/lib/esm/transient-tokens.js +6 -0
  207. package/lib/esm/transient-tokens.js.map +1 -0
  208. package/lib/esm/user.js +22 -0
  209. package/lib/esm/user.js.map +1 -0
  210. package/lib/esm/utils/auth.js +11 -0
  211. package/lib/esm/utils/auth.js.map +1 -0
  212. package/lib/esm/utils/schemas.js +107 -0
  213. package/lib/esm/utils/schemas.js.map +1 -0
  214. package/lib/esm/utils/type-helpers.js +2 -0
  215. package/lib/esm/utils/type-helpers.js.map +1 -0
  216. package/lib/esm/versions.js +5 -0
  217. package/lib/esm/versions.js.map +1 -0
  218. package/lib/esm/workflow-analytics.js +49 -0
  219. package/lib/esm/workflow-analytics.js.map +1 -0
  220. package/lib/tsconfig.tsbuildinfo +1 -0
  221. package/lib/types/Progress.d.ts +21 -0
  222. package/lib/types/Progress.d.ts.map +1 -0
  223. package/lib/types/access-control.d.ts +73 -0
  224. package/lib/types/access-control.d.ts.map +1 -0
  225. package/lib/types/analytics.d.ts +87 -0
  226. package/lib/types/analytics.d.ts.map +1 -0
  227. package/lib/types/apikey.d.ts +98 -0
  228. package/lib/types/apikey.d.ts.map +1 -0
  229. package/lib/types/apps.d.ts +236 -0
  230. package/lib/types/apps.d.ts.map +1 -0
  231. package/lib/types/ask-user.d.ts +32 -0
  232. package/lib/types/ask-user.d.ts.map +1 -0
  233. package/lib/types/channels.d.ts +21 -0
  234. package/lib/types/channels.d.ts.map +1 -0
  235. package/lib/types/common.d.ts +31 -0
  236. package/lib/types/common.d.ts.map +1 -0
  237. package/lib/types/data-platform.d.ts +860 -0
  238. package/lib/types/data-platform.d.ts.map +1 -0
  239. package/lib/types/email.d.ts +66 -0
  240. package/lib/types/email.d.ts.map +1 -0
  241. package/lib/types/environment.d.ts +106 -0
  242. package/lib/types/environment.d.ts.map +1 -0
  243. package/lib/types/facets.d.ts +34 -0
  244. package/lib/types/facets.d.ts.map +1 -0
  245. package/lib/types/group.d.ts +21 -0
  246. package/lib/types/group.d.ts.map +1 -0
  247. package/lib/types/index.d.ts +39 -0
  248. package/lib/types/index.d.ts.map +1 -0
  249. package/lib/types/integrations.d.ts +60 -0
  250. package/lib/types/integrations.d.ts.map +1 -0
  251. package/lib/types/interaction.d.ts +958 -0
  252. package/lib/types/interaction.d.ts.map +1 -0
  253. package/lib/types/json-schema.d.ts +1 -0
  254. package/lib/types/json-schema.d.ts.map +1 -0
  255. package/lib/types/json.d.ts +1 -0
  256. package/lib/types/json.d.ts.map +1 -0
  257. package/lib/types/meters.d.ts +23 -0
  258. package/lib/types/meters.d.ts.map +1 -0
  259. package/lib/types/model_utility.d.ts +1 -0
  260. package/lib/types/model_utility.d.ts.map +1 -0
  261. package/lib/types/payload.d.ts +60 -0
  262. package/lib/types/payload.d.ts.map +1 -0
  263. package/lib/types/pending-asks.d.ts +93 -0
  264. package/lib/types/pending-asks.d.ts.map +1 -0
  265. package/lib/types/project.d.ts +179 -0
  266. package/lib/types/project.d.ts.map +1 -0
  267. package/lib/types/prompt.d.ts +78 -0
  268. package/lib/types/prompt.d.ts.map +1 -0
  269. package/lib/types/query.d.ts +118 -0
  270. package/lib/types/query.d.ts.map +1 -0
  271. package/lib/types/rate-limiter.d.ts +28 -0
  272. package/lib/types/rate-limiter.d.ts.map +1 -0
  273. package/lib/types/refs.d.ts +22 -0
  274. package/lib/types/refs.d.ts.map +1 -0
  275. package/lib/types/runs.d.ts +32 -0
  276. package/lib/types/runs.d.ts.map +1 -0
  277. package/lib/types/skill.d.ts +78 -0
  278. package/lib/types/skill.d.ts.map +1 -0
  279. package/lib/types/store/activity-catalog.d.ts +26 -0
  280. package/lib/types/store/activity-catalog.d.ts.map +1 -0
  281. package/lib/types/store/collections.d.ts +78 -0
  282. package/lib/types/store/collections.d.ts.map +1 -0
  283. package/lib/types/store/common.d.ts +22 -0
  284. package/lib/types/store/common.d.ts.map +1 -0
  285. package/lib/types/store/conversation-state.d.ts +120 -0
  286. package/lib/types/store/conversation-state.d.ts.map +1 -0
  287. package/lib/types/store/doc-analyzer.d.ts +140 -0
  288. package/lib/types/store/doc-analyzer.d.ts.map +1 -0
  289. package/lib/types/store/dsl-workflow.d.ts +244 -0
  290. package/lib/types/store/dsl-workflow.d.ts.map +1 -0
  291. package/lib/types/store/index.d.ts +13 -0
  292. package/lib/types/store/index.d.ts.map +1 -0
  293. package/lib/types/store/object-types.d.ts +23 -0
  294. package/lib/types/store/object-types.d.ts.map +1 -0
  295. package/lib/types/store/schedule.d.ts +182 -0
  296. package/lib/types/store/schedule.d.ts.map +1 -0
  297. package/lib/types/store/signals.d.ts +24 -0
  298. package/lib/types/store/signals.d.ts.map +1 -0
  299. package/lib/types/store/store.d.ts +407 -0
  300. package/lib/types/store/store.d.ts.map +1 -0
  301. package/lib/types/store/temporalio.d.ts +16 -0
  302. package/lib/types/store/temporalio.d.ts.map +1 -0
  303. package/lib/types/store/worker.d.ts +18 -0
  304. package/lib/types/store/worker.d.ts.map +1 -0
  305. package/lib/types/store/workflow.d.ts +730 -0
  306. package/lib/types/store/workflow.d.ts.map +1 -0
  307. package/lib/types/sts-token-types.d.ts +72 -0
  308. package/lib/types/sts-token-types.d.ts.map +1 -0
  309. package/lib/types/tenant.d.ts +10 -0
  310. package/lib/types/tenant.d.ts.map +1 -0
  311. package/lib/types/tool-execution.d.ts +45 -0
  312. package/lib/types/tool-execution.d.ts.map +1 -0
  313. package/lib/types/training.d.ts +38 -0
  314. package/lib/types/training.d.ts.map +1 -0
  315. package/lib/types/transient-tokens.d.ts +24 -0
  316. package/lib/types/transient-tokens.d.ts.map +1 -0
  317. package/lib/types/user.d.ts +116 -0
  318. package/lib/types/user.d.ts.map +1 -0
  319. package/lib/types/utils/auth.d.ts +3 -0
  320. package/lib/types/utils/auth.d.ts.map +1 -0
  321. package/lib/types/utils/schemas.d.ts +9 -0
  322. package/lib/types/utils/schemas.d.ts.map +1 -0
  323. package/lib/types/utils/type-helpers.d.ts +3 -0
  324. package/lib/types/utils/type-helpers.d.ts.map +1 -0
  325. package/lib/types/versions.d.ts +3 -0
  326. package/lib/types/versions.d.ts.map +1 -0
  327. package/lib/types/workflow-analytics.d.ts +777 -0
  328. package/lib/types/workflow-analytics.d.ts.map +1 -0
  329. package/lib/vertesia-common.js +2 -0
  330. package/lib/vertesia-common.js.map +1 -0
  331. package/package.json +54 -0
  332. package/src/Progress.ts +57 -0
  333. package/src/access-control.ts +98 -0
  334. package/src/analytics.ts +106 -0
  335. package/src/apikey.ts +116 -0
  336. package/src/apps.ts +296 -0
  337. package/src/ask-user.ts +35 -0
  338. package/src/channels.ts +70 -0
  339. package/src/common.ts +37 -0
  340. package/src/data-platform.ts +976 -0
  341. package/src/email.ts +80 -0
  342. package/src/environment.ts +137 -0
  343. package/src/facets.ts +44 -0
  344. package/src/group.ts +26 -0
  345. package/src/index.ts +40 -0
  346. package/src/integrations.ts +72 -0
  347. package/src/interaction.ts +1182 -0
  348. package/src/json-schema.ts +7 -0
  349. package/src/json.ts +4 -0
  350. package/src/meters.ts +30 -0
  351. package/src/model_utility.ts +1 -0
  352. package/src/payload.ts +83 -0
  353. package/src/pending-asks.ts +106 -0
  354. package/src/project.ts +263 -0
  355. package/src/prompt.ts +103 -0
  356. package/src/query.ts +137 -0
  357. package/src/rate-limiter.ts +34 -0
  358. package/src/refs.ts +30 -0
  359. package/src/runs.ts +36 -0
  360. package/src/skill.ts +90 -0
  361. package/src/store/activity-catalog.ts +44 -0
  362. package/src/store/collections.ts +87 -0
  363. package/src/store/common.ts +30 -0
  364. package/src/store/conversation-state.ts +146 -0
  365. package/src/store/doc-analyzer.ts +161 -0
  366. package/src/store/dsl-workflow.ts +288 -0
  367. package/src/store/index.ts +14 -0
  368. package/src/store/ms.d.ts +11 -0
  369. package/src/store/object-types.ts +127 -0
  370. package/src/store/schedule.ts +238 -0
  371. package/src/store/signals.ts +25 -0
  372. package/src/store/store.ts +579 -0
  373. package/src/store/temporalio.ts +54 -0
  374. package/src/store/worker.ts +19 -0
  375. package/src/store/workflow.test.ts +578 -0
  376. package/src/store/workflow.ts +973 -0
  377. package/src/sts-token-types.ts +117 -0
  378. package/src/tenant.ts +10 -0
  379. package/src/tool-execution.ts +47 -0
  380. package/src/training.ts +44 -0
  381. package/src/transient-tokens.ts +30 -0
  382. package/src/user.ts +153 -0
  383. package/src/utils/auth.ts +12 -0
  384. package/src/utils/schemas.ts +108 -0
  385. package/src/utils/type-helpers.ts +6 -0
  386. package/src/versions.ts +3 -0
  387. package/src/workflow-analytics.ts +925 -0
  388. package/tsconfig.dist.json +20 -0
@@ -0,0 +1,117 @@
1
+ /**
2
+ * STS Token Request Types
3
+ * These types define the structure for token requests to the Security Token Service
4
+ */
5
+
6
+ export type TokenType = 'apikey' | 'user' | 'project' | 'environment' | 'agent' | 'service_account';
7
+ export type SigningAlgorithm = 'ES256' | 'RS256';
8
+
9
+ interface BaseTokenRequest {
10
+ type: TokenType;
11
+ audience?: string;
12
+ /** Signing algorithm - defaults to ES256. Use RS256 for Azure AD compatibility. */
13
+ algorithm?: SigningAlgorithm;
14
+ }
15
+
16
+ // API key doesn't need account/project as it's determined from the key
17
+ export interface ApiKeyTokenRequest extends BaseTokenRequest {
18
+ type: 'apikey';
19
+ key: string;
20
+ }
21
+
22
+ // User token needs optional account/project for scoping
23
+ export interface UserTokenRequest extends BaseTokenRequest {
24
+ type: 'user';
25
+ user_id?: string; // Optional - can be determined from auth token
26
+ account_id?: string; // Optional - for scoping to specific account
27
+ project_id?: string; // Optional - for scoping to specific project
28
+ expires_at?: number;
29
+
30
+ on_behalf_of?: string; // Optional - user ID when acting on behalf of another user
31
+ }
32
+
33
+ // Project token requires project_id and account_id
34
+ export interface ProjectTokenRequest extends BaseTokenRequest {
35
+ type: 'project';
36
+ project_id: string;
37
+ account_id: string;
38
+ }
39
+
40
+ // Environment token requires IDs - names fetched from DB
41
+ export interface EnvironmentTokenRequest extends BaseTokenRequest {
42
+ type: 'environment';
43
+ environment_id: string;
44
+ environment_name: string; // Still required as environments may not be in DB
45
+ project_id: string; // Will fetch name and verify account
46
+ account_id: string; // Will fetch name and verify project belongs to it
47
+ }
48
+
49
+ // Agent token for service accounts acting as agents
50
+ export interface AgentTokenRequest extends BaseTokenRequest {
51
+ type: 'agent';
52
+ account_id: string;
53
+ project_id: string; // Will verify it belongs to account
54
+ name?: string;
55
+ on_behalf_of: string; // Required: signed Vertesia token to verify user context
56
+ }
57
+
58
+ // Service account token
59
+ export interface ServiceAccountTokenRequest extends BaseTokenRequest {
60
+ type: 'service_account';
61
+ account_id: string;
62
+ project_id: string; // Will verify it belongs to account
63
+ roles?: string[]; // Optional - roles for the service account token
64
+ name?: string;
65
+ }
66
+
67
+ export type IssueTokenRequest =
68
+ | ApiKeyTokenRequest
69
+ | UserTokenRequest
70
+ | ProjectTokenRequest
71
+ | EnvironmentTokenRequest
72
+ | AgentTokenRequest
73
+ | ServiceAccountTokenRequest;
74
+
75
+ export interface RefreshTokenRequest {
76
+ token: string;
77
+ }
78
+
79
+ export interface RevokeTokenRequest {
80
+ token: string;
81
+ }
82
+
83
+ // Helper type guards for type narrowing
84
+ export function isApiKeyRequest(req: IssueTokenRequest): req is ApiKeyTokenRequest {
85
+ return req.type === 'apikey';
86
+ }
87
+
88
+ export function isUserRequest(req: IssueTokenRequest): req is UserTokenRequest {
89
+ return req.type === 'user';
90
+ }
91
+
92
+ export function isProjectRequest(req: IssueTokenRequest): req is ProjectTokenRequest {
93
+ return req.type === 'project';
94
+ }
95
+
96
+ export function isEnvironmentRequest(req: IssueTokenRequest): req is EnvironmentTokenRequest {
97
+ return req.type === 'environment';
98
+ }
99
+
100
+ export function isAgentRequest(req: IssueTokenRequest): req is AgentTokenRequest {
101
+ return req.type === 'agent';
102
+ }
103
+
104
+ export function isServiceAccountRequest(req: IssueTokenRequest): req is ServiceAccountTokenRequest {
105
+ return req.type === 'service_account';
106
+ }
107
+
108
+ // Response types
109
+ export interface TokenResponse {
110
+ token: string;
111
+ }
112
+
113
+ export interface ValidateTokenResponse {
114
+ valid: boolean;
115
+ payload?: any;
116
+ error?: string;
117
+ }
package/src/tenant.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This interface is used only on the client side and is shared between @vertesia/ui/session and the main app.
3
+ */
4
+ export interface UIResolvedTenant {
5
+ firebaseTenantId: string;
6
+ label?: string;
7
+ logo?: string;
8
+ provider?: string;
9
+ name?: string;
10
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Types for tool execution payloads shared between workflows and tool servers
3
+ */
4
+
5
+ /**
6
+ * Endpoint configuration that can override JWT-embedded endpoints
7
+ */
8
+ export interface ToolEndpointOverrides {
9
+ /**
10
+ * Studio server URL
11
+ */
12
+ studio?: string;
13
+ /**
14
+ * Store/Zeno server URL
15
+ */
16
+ store?: string;
17
+ /**
18
+ * Token server URL
19
+ */
20
+ token?: string;
21
+ }
22
+
23
+ /**
24
+ * Metadata passed with tool execution requests from workflows to tool servers
25
+ */
26
+ export interface ToolExecutionMetadata {
27
+ /**
28
+ * Workflow run ID
29
+ */
30
+ run_id?: string;
31
+ /**
32
+ * App installation ID
33
+ */
34
+ app_install_id?: string;
35
+ /**
36
+ * App-specific settings
37
+ */
38
+ app_settings?: Record<string, any>;
39
+ /**
40
+ * Endpoint overrides from workflow config (takes precedence over JWT endpoints)
41
+ */
42
+ endpoints?: ToolEndpointOverrides;
43
+ /**
44
+ * Additional metadata fields
45
+ */
46
+ [key: string]: any;
47
+ }
@@ -0,0 +1,44 @@
1
+ import type { TrainingJob } from "@llumiverse/common";
2
+ import { ExecutionEnvironmentRef } from "./environment.js";
3
+
4
+ export enum TrainingSessionStatus {
5
+ 'created' = 'created',
6
+ 'building' = 'building',
7
+ 'prepared' = 'prepared',
8
+ 'processing' = 'processing',
9
+ 'completed' = 'completed',
10
+ 'cancelled' = 'cancelled',
11
+ 'failed' = 'failed'
12
+ }
13
+
14
+ export interface TrainingSession {
15
+ id: string;
16
+ project: string;
17
+ name: string
18
+ env: ExecutionEnvironmentRef,
19
+ model: string,
20
+ status: TrainingSessionStatus,
21
+ runs: string[],
22
+ dataset: string, //the name of the file dataset which was generated in GCS
23
+ job: TrainingJob,
24
+ created_by: string,
25
+ updated_by: string,
26
+ created_at: Date,
27
+ updated_at: Date,
28
+ }
29
+
30
+ export interface TrainingSessionRef extends Omit<TrainingSession, 'runs'> {
31
+ }
32
+
33
+
34
+ export interface TrainingSessionCreatePayload {
35
+ name: string
36
+ env: string,
37
+ model: string,
38
+ }
39
+
40
+ export interface ListTrainingSessionsQuery {
41
+ limit?: number;
42
+ offset?: number;
43
+ status?: TrainingSessionStatus;
44
+ }
@@ -0,0 +1,30 @@
1
+ import { ProjectRef, ProjectRoles } from "./project.js";
2
+ import { AccountRef, UserRef } from "./user.js";
3
+
4
+
5
+ export enum TransientTokenType {
6
+ userInvite = 'user-invite',
7
+ migration = 'migration',
8
+ }
9
+
10
+ export interface TransientToken<T> {
11
+ id: string;
12
+ type: TransientTokenType;
13
+ data: T;
14
+ expires: Date;
15
+ account?: string;
16
+ created_at: Date;
17
+ updated_at: Date;
18
+ }
19
+
20
+
21
+ export interface CreateOrUpdateTransientTokenPayload<T> extends Partial<TransientToken<T>> {
22
+ }
23
+
24
+ export interface UserInviteTokenData {
25
+ email: string;
26
+ role: ProjectRoles;
27
+ account: AccountRef;
28
+ project: ProjectRef;
29
+ invited_by: UserRef;
30
+ }
package/src/user.ts ADDED
@@ -0,0 +1,153 @@
1
+ import { ApiKey } from "./apikey.js";
2
+ import { ProjectRoles } from "./project.js";
3
+
4
+ export interface UserWithAccounts extends User {
5
+ accounts: AccountRef[];
6
+ }
7
+
8
+
9
+ export interface User {
10
+ id: string;
11
+ externalId: string;
12
+ email: string;
13
+ name: string;
14
+ username?: string;
15
+ picture?: string;
16
+ language?: string;
17
+ phone?: string;
18
+ sign_in_provider?: string;
19
+ last_selected_account?: string;
20
+ source?: 'firebase' | 'scim';
21
+ }
22
+
23
+
24
+ export interface UserRef {
25
+ id: string;
26
+ name: string;
27
+ email: string;
28
+ picture?: string;
29
+ }
30
+
31
+ export const UserRefPopulate = "id name email picture";
32
+
33
+ export enum Datacenters {
34
+ aws = 'aws',
35
+ gcp = 'gcp',
36
+ azure = 'azure'
37
+ }
38
+
39
+
40
+ export enum BillingMethod {
41
+ stripe = 'stripe',
42
+ invoice = 'invoice'
43
+ }
44
+
45
+ export enum AccountType {
46
+ vertesia = 'vertesia',
47
+ partner = 'partner',
48
+ free = 'free',
49
+ customer = 'customer',
50
+ unknown = 'unknown'
51
+ }
52
+
53
+ export interface AccountBilling {
54
+ method: BillingMethod;
55
+ stripe_customer_id?: string;
56
+ }
57
+
58
+
59
+ export interface Account {
60
+ id: string;
61
+ name: string;
62
+
63
+ email_domains: string[];
64
+
65
+ onboarding: {
66
+ completed: boolean,
67
+ completed_at: Date,
68
+ };
69
+
70
+ datacenter: string;
71
+
72
+ account_type: AccountType;
73
+
74
+ billing: AccountBilling;
75
+
76
+ created_by: string;
77
+ updated_by: string;
78
+ created_at: string;
79
+ updated_at: string;
80
+ }
81
+
82
+
83
+ export interface UpdateAccountPayload {
84
+ name?: string;
85
+ email_domains?: string[];
86
+ billing?: AccountBilling;
87
+ }
88
+
89
+
90
+ export interface AccountRef {
91
+ id: string;
92
+ name: string;
93
+ }
94
+
95
+ export const AccountRefPopulate = "id name";
96
+
97
+ export interface InviteUserRequestPayload {
98
+ email: string;
99
+ role: ProjectRoles;
100
+ }
101
+
102
+
103
+ export interface InviteUserResponsePayload {
104
+ action: 'invited' | 'added';
105
+ }
106
+
107
+
108
+
109
+ type UserOrApiKey<T extends User | ApiKey> = T extends User ? User : ApiKey;
110
+ type SessionType<T extends User | ApiKey> = T extends User ? "user" : "apikey";
111
+ export interface SessionInfo<T extends User | ApiKey> {
112
+ isNew?: boolean;
113
+ type: SessionType<T>;
114
+ subject: UserOrApiKey<T>;
115
+ //User | ApiKey; // no user if using an apikey
116
+ current_account: Account;
117
+ //role: string; // TODO the role on the selected account
118
+ accounts: AccountRef[];
119
+ }
120
+
121
+
122
+ export interface UserSessionInfo extends SessionInfo<User> { }
123
+ export interface ApiKeySessionInfo extends SessionInfo<ApiKey> { }
124
+
125
+ export interface OnboardingProgress {
126
+ interactions: boolean,
127
+ prompts: boolean,
128
+ environments: boolean,
129
+ default_environment_defined: boolean
130
+ }
131
+
132
+
133
+
134
+ /**
135
+ * Data collected at signup
136
+ * used for onboarding and segments
137
+ **/
138
+ export interface SignupData {
139
+ accountType: string;
140
+ companyName?: string;
141
+ companySize?: number;
142
+ companyWebsite?: string;
143
+ maturity?: string;
144
+ }
145
+
146
+
147
+ /**
148
+ * Signup Payload: used to create a new user
149
+ */
150
+ export interface SignupPayload {
151
+ firebaseToken: string;
152
+ signupData: SignupData;
153
+ }
@@ -0,0 +1,12 @@
1
+ import { ProjectRef } from "../project.js";
2
+
3
+ export function getTenantId(accountId: string, projectId: string): string {
4
+ //use the last 6 characters of the accountId as the db name
5
+ //as in mongo the last 6 char are an incrementing counter
6
+ const accountLast6 = accountId.slice(-6);
7
+ const projectLast6 = projectId.slice(-6);
8
+ return accountLast6 + '_' + projectLast6;
9
+ }
10
+ export function getTenantIdFromProject(project: ProjectRef): string {
11
+ return getTenantId(project.account, project.id);
12
+ }
@@ -0,0 +1,108 @@
1
+ import type { JSONSchema } from "@llumiverse/common";
2
+ import { PromptRole } from "@llumiverse/common";
3
+ import type { JSONSchema4 } from "json-schema";
4
+ import { InCodePrompt, InteractionRefWithSchema, PopulatedInteraction } from "../interaction.js";
5
+ import { ExecutablePromptSegmentDef, PromptSegmentDefType } from "../prompt.js";
6
+
7
+
8
+ // Remove custom properties from the JSON before sending further down execution pipeline
9
+ export function removeExtraProperties<T>(schema: T): T {
10
+ if (!schema) return schema;
11
+ if (Array.isArray(schema)) {
12
+ for (const item of schema) {
13
+ removeExtraProperties(item);
14
+ }
15
+ } else if (typeof schema === 'object') {
16
+ const obj = schema as Record<string, any>;
17
+ for (const [key, value] of Object.entries(obj)) {
18
+ if (key === 'editor' && (value === 'textarea' || value === 'document' || value === 'media')) {
19
+ delete obj[key];
20
+ } else if (key === 'format' && (value === 'textarea' || value === 'document' || value === 'media')) {
21
+ delete obj[key];
22
+ } else if (typeof value === 'object') {
23
+ removeExtraProperties(value)
24
+ }
25
+ }
26
+ }
27
+ return schema;
28
+ }
29
+
30
+ export function mergeJSONSchemas(schemas: JSONSchema[]) {
31
+ const props: Record<string, JSONSchema4> = {};
32
+ let required: string[] = [];
33
+ for (const schema of schemas) {
34
+ if (schema.properties) {
35
+ if (schema.required) {
36
+ for (const prop of schema.required as string[]) {
37
+ if (!required.includes(prop)) required.push(prop);
38
+ }
39
+ }
40
+ Object.assign(props, schema.properties);
41
+ }
42
+ }
43
+ const schema = Object.keys(props).length > 0 ? { properties: props, required, type: 'object' } as JSONSchema : null;
44
+ return schema;
45
+ }
46
+
47
+ export function _mergePromptsSchema(prompts: ExecutablePromptSegmentDef[]) {
48
+ const props: Record<string, JSONSchema4> = {};
49
+ let required = new Set<String>();
50
+ for (const prompt of prompts) {
51
+ if (prompt.template?.inputSchema?.properties) {
52
+ const schema = prompt.template?.inputSchema;
53
+ if (schema.required) {
54
+ for (const prop of schema.required as string[]) {
55
+ required.add(prop);
56
+ }
57
+ }
58
+ Object.assign(props, schema.properties);
59
+ } else if (prompt.type === PromptSegmentDefType.chat) {
60
+ Object.assign(props, {
61
+ chat: {
62
+ type: 'array',
63
+ items: {
64
+ type: 'object',
65
+ properties: {
66
+ role: {
67
+ type: 'string',
68
+ enum: [PromptRole.assistant, PromptRole.user]
69
+ },
70
+ content: { type: 'string' },
71
+ },
72
+ required: ['role', 'content']
73
+ }
74
+ }
75
+ });
76
+ required.add('chat');
77
+ }
78
+ }
79
+ return Object.keys(props).length > 0 ? {
80
+ properties: props,
81
+ required: Array.from(required)
82
+ } as JSONSchema4 : null;
83
+ }
84
+
85
+ export function mergePromptsSchema(interaction: InteractionRefWithSchema | PopulatedInteraction) {
86
+ if (!interaction.prompts) return null;
87
+ return _mergePromptsSchema(interaction.prompts as ExecutablePromptSegmentDef[]);
88
+ }
89
+
90
+ export function mergeInCodePromptSchemas(prompts: InCodePrompt[]) {
91
+ const props: Record<string, JSONSchema> = {};
92
+ let required = new Set<String>();
93
+ for (const prompt of prompts) {
94
+ if (prompt.schema?.properties) {
95
+ const schema = prompt.schema;
96
+ if (schema.required) {
97
+ for (const prop of schema.required as string[]) {
98
+ required.add(prop);
99
+ }
100
+ }
101
+ Object.assign(props, schema.properties);
102
+ }
103
+ }
104
+ return Object.keys(props).length > 0 ? {
105
+ properties: props,
106
+ required: Array.from(required)
107
+ } as JSONSchema : null;
108
+ }
@@ -0,0 +1,6 @@
1
+ export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> =
2
+ Pick<T, Exclude<keyof T, Keys>> &
3
+ {
4
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>
5
+ }[Keys];
6
+
@@ -0,0 +1,3 @@
1
+ export enum ApiVersions {
2
+ COMPLETION_RESULT_V1 = 20250925,
3
+ }