@vertesia/common 0.78.0-dev-28b447d → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/LICENSE +13 -0
  2. package/lib/cjs/Progress.js +61 -0
  3. package/lib/cjs/Progress.js.map +1 -0
  4. package/lib/cjs/access-control.js +56 -0
  5. package/lib/cjs/access-control.js.map +1 -0
  6. package/lib/cjs/analytics.js +3 -0
  7. package/lib/cjs/analytics.js.map +1 -0
  8. package/lib/cjs/apikey.js +15 -0
  9. package/lib/cjs/apikey.js.map +1 -0
  10. package/lib/cjs/apps.js +3 -0
  11. package/lib/cjs/apps.js.map +1 -0
  12. package/lib/cjs/common.js +3 -0
  13. package/lib/cjs/common.js.map +1 -0
  14. package/lib/cjs/environment.js +44 -0
  15. package/lib/cjs/environment.js.map +1 -0
  16. package/lib/cjs/facets.js +3 -0
  17. package/lib/cjs/facets.js.map +1 -0
  18. package/lib/cjs/group.js +5 -0
  19. package/lib/cjs/group.js.map +1 -0
  20. package/lib/cjs/index.js +47 -0
  21. package/lib/cjs/index.js.map +1 -0
  22. package/lib/cjs/integrations.js +12 -0
  23. package/lib/cjs/integrations.js.map +1 -0
  24. package/lib/cjs/interaction.js +64 -0
  25. package/lib/cjs/interaction.js.map +1 -0
  26. package/lib/cjs/json-schema.js +3 -0
  27. package/lib/cjs/json-schema.js.map +1 -0
  28. package/lib/cjs/json.js +3 -0
  29. package/lib/cjs/json.js.map +1 -0
  30. package/lib/cjs/meters.js +13 -0
  31. package/lib/cjs/meters.js.map +1 -0
  32. package/lib/cjs/model_utility.js +6 -0
  33. package/lib/cjs/model_utility.js.map +1 -0
  34. package/lib/cjs/package.json +3 -0
  35. package/lib/cjs/payload.js +3 -0
  36. package/lib/cjs/payload.js.map +1 -0
  37. package/lib/cjs/project.js +61 -0
  38. package/lib/cjs/project.js.map +1 -0
  39. package/lib/cjs/prompt.js +21 -0
  40. package/lib/cjs/prompt.js.map +1 -0
  41. package/lib/cjs/query.js +3 -0
  42. package/lib/cjs/query.js.map +1 -0
  43. package/lib/cjs/rate-limiter.js +6 -0
  44. package/lib/cjs/rate-limiter.js.map +1 -0
  45. package/lib/cjs/refs.js +14 -0
  46. package/lib/cjs/refs.js.map +1 -0
  47. package/lib/cjs/runs.js +3 -0
  48. package/lib/cjs/runs.js.map +1 -0
  49. package/lib/cjs/store/activity-catalog.js +3 -0
  50. package/lib/cjs/store/activity-catalog.js.map +1 -0
  51. package/lib/cjs/store/agent.js +3 -0
  52. package/lib/cjs/store/agent.js.map +1 -0
  53. package/lib/cjs/store/collections.js +9 -0
  54. package/lib/cjs/store/collections.js.map +1 -0
  55. package/lib/cjs/store/common.js +3 -0
  56. package/lib/cjs/store/common.js.map +1 -0
  57. package/lib/cjs/store/doc-analyzer.js +3 -0
  58. package/lib/cjs/store/doc-analyzer.js.map +1 -0
  59. package/lib/cjs/store/dsl-workflow.js +5 -0
  60. package/lib/cjs/store/dsl-workflow.js.map +1 -0
  61. package/lib/cjs/store/index.js +28 -0
  62. package/lib/cjs/store/index.js.map +1 -0
  63. package/lib/cjs/store/object-types.js +98 -0
  64. package/lib/cjs/store/object-types.js.map +1 -0
  65. package/lib/cjs/store/signals.js +3 -0
  66. package/lib/cjs/store/signals.js.map +1 -0
  67. package/lib/cjs/store/store.js +41 -0
  68. package/lib/cjs/store/store.js.map +1 -0
  69. package/lib/cjs/store/temporalio.js +44 -0
  70. package/lib/cjs/store/temporalio.js.map +1 -0
  71. package/lib/cjs/store/workflow.js +49 -0
  72. package/lib/cjs/store/workflow.js.map +1 -0
  73. package/lib/cjs/sts-token-types.js +32 -0
  74. package/lib/cjs/sts-token-types.js.map +1 -0
  75. package/lib/cjs/tenant.js +3 -0
  76. package/lib/cjs/tenant.js.map +1 -0
  77. package/lib/cjs/training.js +14 -0
  78. package/lib/cjs/training.js.map +1 -0
  79. package/lib/cjs/transient-tokens.js +9 -0
  80. package/lib/cjs/transient-tokens.js.map +1 -0
  81. package/lib/cjs/user.js +17 -0
  82. package/lib/cjs/user.js.map +1 -0
  83. package/lib/cjs/utils/auth.js +15 -0
  84. package/lib/cjs/utils/auth.js.map +1 -0
  85. package/lib/cjs/utils/schemas.js +66 -0
  86. package/lib/cjs/utils/schemas.js.map +1 -0
  87. package/lib/cjs/utils/type-helpers.js +3 -0
  88. package/lib/cjs/utils/type-helpers.js.map +1 -0
  89. package/lib/cjs/versions.js +8 -0
  90. package/lib/cjs/versions.js.map +1 -0
  91. package/lib/esm/Progress.js +57 -0
  92. package/lib/esm/Progress.js.map +1 -0
  93. package/lib/esm/access-control.js +53 -0
  94. package/lib/esm/access-control.js.map +1 -0
  95. package/lib/esm/analytics.js +2 -0
  96. package/lib/esm/analytics.js.map +1 -0
  97. package/lib/esm/apikey.js +12 -0
  98. package/lib/esm/apikey.js.map +1 -0
  99. package/lib/esm/apps.js +2 -0
  100. package/lib/esm/apps.js.map +1 -0
  101. package/lib/esm/common.js +2 -0
  102. package/lib/esm/common.js.map +1 -0
  103. package/lib/esm/environment.js +41 -0
  104. package/lib/esm/environment.js.map +1 -0
  105. package/lib/esm/facets.js +2 -0
  106. package/lib/esm/facets.js.map +1 -0
  107. package/lib/esm/group.js +2 -0
  108. package/lib/esm/group.js.map +1 -0
  109. package/lib/esm/index.js +31 -0
  110. package/lib/esm/index.js.map +1 -0
  111. package/lib/esm/integrations.js +9 -0
  112. package/lib/esm/integrations.js.map +1 -0
  113. package/lib/esm/interaction.js +61 -0
  114. package/lib/esm/interaction.js.map +1 -0
  115. package/lib/esm/json-schema.js +2 -0
  116. package/lib/esm/json-schema.js.map +1 -0
  117. package/lib/esm/json.js +2 -0
  118. package/lib/esm/json.js.map +1 -0
  119. package/lib/esm/meters.js +10 -0
  120. package/lib/esm/meters.js.map +1 -0
  121. package/lib/esm/model_utility.js +2 -0
  122. package/lib/esm/model_utility.js.map +1 -0
  123. package/lib/esm/payload.js +2 -0
  124. package/lib/esm/payload.js.map +1 -0
  125. package/lib/esm/project.js +57 -0
  126. package/lib/esm/project.js.map +1 -0
  127. package/lib/esm/prompt.js +18 -0
  128. package/lib/esm/prompt.js.map +1 -0
  129. package/lib/esm/query.js +2 -0
  130. package/lib/esm/query.js.map +1 -0
  131. package/lib/esm/rate-limiter.js +5 -0
  132. package/lib/esm/rate-limiter.js.map +1 -0
  133. package/lib/esm/refs.js +11 -0
  134. package/lib/esm/refs.js.map +1 -0
  135. package/lib/esm/runs.js +2 -0
  136. package/lib/esm/runs.js.map +1 -0
  137. package/lib/esm/store/activity-catalog.js +2 -0
  138. package/lib/esm/store/activity-catalog.js.map +1 -0
  139. package/lib/esm/store/agent.js +2 -0
  140. package/lib/esm/store/agent.js.map +1 -0
  141. package/lib/esm/store/collections.js +6 -0
  142. package/lib/esm/store/collections.js.map +1 -0
  143. package/lib/esm/store/common.js +2 -0
  144. package/lib/esm/store/common.js.map +1 -0
  145. package/lib/esm/store/doc-analyzer.js +2 -0
  146. package/lib/esm/store/doc-analyzer.js.map +1 -0
  147. package/lib/esm/store/dsl-workflow.js +2 -0
  148. package/lib/esm/store/dsl-workflow.js.map +1 -0
  149. package/lib/esm/store/index.js +12 -0
  150. package/lib/esm/store/index.js.map +1 -0
  151. package/lib/esm/store/object-types.js +95 -0
  152. package/lib/esm/store/object-types.js.map +1 -0
  153. package/lib/esm/store/signals.js +2 -0
  154. package/lib/esm/store/signals.js.map +1 -0
  155. package/lib/esm/store/store.js +38 -0
  156. package/lib/esm/store/store.js.map +1 -0
  157. package/lib/esm/store/temporalio.js +41 -0
  158. package/lib/esm/store/temporalio.js.map +1 -0
  159. package/lib/esm/store/workflow.js +45 -0
  160. package/lib/esm/store/workflow.js.map +1 -0
  161. package/lib/esm/sts-token-types.js +24 -0
  162. package/lib/esm/sts-token-types.js.map +1 -0
  163. package/lib/esm/tenant.js +2 -0
  164. package/lib/esm/tenant.js.map +1 -0
  165. package/lib/esm/training.js +11 -0
  166. package/lib/esm/training.js.map +1 -0
  167. package/lib/esm/transient-tokens.js +6 -0
  168. package/lib/esm/transient-tokens.js.map +1 -0
  169. package/lib/esm/user.js +14 -0
  170. package/lib/esm/user.js.map +1 -0
  171. package/lib/esm/utils/auth.js +11 -0
  172. package/lib/esm/utils/auth.js.map +1 -0
  173. package/lib/esm/utils/schemas.js +61 -0
  174. package/lib/esm/utils/schemas.js.map +1 -0
  175. package/lib/esm/utils/type-helpers.js +2 -0
  176. package/lib/esm/utils/type-helpers.js.map +1 -0
  177. package/lib/esm/versions.js +5 -0
  178. package/lib/esm/versions.js.map +1 -0
  179. package/lib/tsconfig.tsbuildinfo +1 -0
  180. package/lib/types/Progress.d.ts +21 -0
  181. package/lib/types/Progress.d.ts.map +1 -0
  182. package/lib/types/access-control.d.ts +73 -0
  183. package/lib/types/access-control.d.ts.map +1 -0
  184. package/lib/types/analytics.d.ts +36 -0
  185. package/lib/types/analytics.d.ts.map +1 -0
  186. package/lib/types/apikey.d.ts +76 -0
  187. package/lib/types/apikey.d.ts.map +1 -0
  188. package/lib/types/apps.d.ts +93 -0
  189. package/lib/types/apps.d.ts.map +1 -0
  190. package/lib/types/common.d.ts +31 -0
  191. package/lib/types/common.d.ts.map +1 -0
  192. package/lib/types/environment.d.ts +84 -0
  193. package/lib/types/environment.d.ts.map +1 -0
  194. package/lib/types/facets.d.ts +34 -0
  195. package/lib/types/facets.d.ts.map +1 -0
  196. package/lib/types/group.d.ts +21 -0
  197. package/lib/types/group.d.ts.map +1 -0
  198. package/lib/types/index.d.ts +31 -0
  199. package/lib/types/index.d.ts.map +1 -0
  200. package/lib/types/integrations.d.ts +28 -0
  201. package/lib/types/integrations.d.ts.map +1 -0
  202. package/lib/types/interaction.d.ts +440 -0
  203. package/lib/types/interaction.d.ts.map +1 -0
  204. package/lib/types/json-schema.d.ts +1 -0
  205. package/lib/types/json-schema.d.ts.map +1 -0
  206. package/lib/types/json.d.ts +1 -0
  207. package/lib/types/json.d.ts.map +1 -0
  208. package/lib/types/meters.d.ts +23 -0
  209. package/lib/types/meters.d.ts.map +1 -0
  210. package/lib/types/model_utility.d.ts +1 -0
  211. package/lib/types/model_utility.d.ts.map +1 -0
  212. package/lib/types/payload.d.ts +60 -0
  213. package/lib/types/payload.d.ts.map +1 -0
  214. package/lib/types/project.d.ts +116 -0
  215. package/lib/types/project.d.ts.map +1 -0
  216. package/lib/types/prompt.d.ts +70 -0
  217. package/lib/types/prompt.d.ts.map +1 -0
  218. package/lib/types/query.d.ts +116 -0
  219. package/lib/types/query.d.ts.map +1 -0
  220. package/lib/types/rate-limiter.d.ts +28 -0
  221. package/lib/types/rate-limiter.d.ts.map +1 -0
  222. package/lib/types/refs.d.ts +22 -0
  223. package/lib/types/refs.d.ts.map +1 -0
  224. package/lib/types/runs.d.ts +32 -0
  225. package/lib/types/runs.d.ts.map +1 -0
  226. package/lib/types/store/activity-catalog.d.ts +26 -0
  227. package/lib/types/store/activity-catalog.d.ts.map +1 -0
  228. package/lib/types/store/agent.d.ts +18 -0
  229. package/lib/types/store/agent.d.ts.map +1 -0
  230. package/lib/types/store/collections.d.ts +64 -0
  231. package/lib/types/store/collections.d.ts.map +1 -0
  232. package/lib/types/store/common.d.ts +22 -0
  233. package/lib/types/store/common.d.ts.map +1 -0
  234. package/lib/types/store/doc-analyzer.d.ts +132 -0
  235. package/lib/types/store/doc-analyzer.d.ts.map +1 -0
  236. package/lib/types/store/dsl-workflow.d.ts +238 -0
  237. package/lib/types/store/dsl-workflow.d.ts.map +1 -0
  238. package/lib/types/store/index.d.ts +11 -0
  239. package/lib/types/store/index.d.ts.map +1 -0
  240. package/lib/types/store/object-types.d.ts +23 -0
  241. package/lib/types/store/object-types.d.ts.map +1 -0
  242. package/lib/types/store/signals.d.ts +5 -0
  243. package/lib/types/store/signals.d.ts.map +1 -0
  244. package/lib/types/store/store.d.ts +304 -0
  245. package/lib/types/store/store.d.ts.map +1 -0
  246. package/lib/types/store/temporalio.d.ts +16 -0
  247. package/lib/types/store/temporalio.d.ts.map +1 -0
  248. package/lib/types/store/workflow.d.ts +356 -0
  249. package/lib/types/store/workflow.d.ts.map +1 -0
  250. package/lib/types/sts-token-types.d.ts +69 -0
  251. package/lib/types/sts-token-types.d.ts.map +1 -0
  252. package/lib/types/tenant.d.ts +10 -0
  253. package/lib/types/tenant.d.ts.map +1 -0
  254. package/lib/types/training.d.ts +38 -0
  255. package/lib/types/training.d.ts.map +1 -0
  256. package/lib/types/transient-tokens.d.ts +24 -0
  257. package/lib/types/transient-tokens.d.ts.map +1 -0
  258. package/lib/types/user.d.ts +113 -0
  259. package/lib/types/user.d.ts.map +1 -0
  260. package/lib/types/utils/auth.d.ts +3 -0
  261. package/lib/types/utils/auth.d.ts.map +1 -0
  262. package/lib/types/utils/schemas.d.ts +7 -0
  263. package/lib/types/utils/schemas.d.ts.map +1 -0
  264. package/lib/types/utils/type-helpers.d.ts +3 -0
  265. package/lib/types/utils/type-helpers.d.ts.map +1 -0
  266. package/lib/types/versions.d.ts +3 -0
  267. package/lib/types/versions.d.ts.map +1 -0
  268. package/lib/vertesia-common.js +2 -0
  269. package/lib/vertesia-common.js.map +1 -0
  270. package/package.json +38 -43
  271. package/src/access-control.ts +4 -4
  272. package/src/apikey.ts +21 -22
  273. package/src/apps.ts +0 -34
  274. package/src/index.ts +2 -1
  275. package/src/interaction.ts +13 -119
  276. package/src/project.ts +2 -0
  277. package/src/prompt.ts +9 -16
  278. package/src/store/workflow.ts +12 -40
  279. package/src/utils/schemas.ts +4 -4
  280. package/src/versions.ts +3 -0
  281. package/src/sts-token-types.ts +0 -114
package/src/apps.ts CHANGED
@@ -15,33 +15,6 @@ export interface AppUIConfig {
15
15
  isolation?: "shadow" | "css";
16
16
  }
17
17
 
18
- export interface AppInteractionRef {
19
- /**
20
- * The interaction code name
21
- */
22
- name: string;
23
-
24
- /**
25
- * The url to get the interaction specification
26
- */
27
- url: string;
28
-
29
- /**
30
- * The interaction title. Optional. To be used in studio UI when the interaction is displayed
31
- */
32
- title?: string;
33
-
34
- /**
35
- * The interaction description. Optional. To be used in studio UI when the interaction is displayed
36
- */
37
- description?: string;
38
- }
39
- export interface ResolvedAppInteractionRef extends AppInteractionRef {
40
- /**
41
- * The interaction unique name (can also be used as an ID) that can be used to execute the interaction.
42
- */
43
- id: string;
44
- }
45
18
  export interface AppManifestData {
46
19
  /**
47
20
  * The name of the app, used as the id in the system.
@@ -81,13 +54,6 @@ export interface AppManifestData {
81
54
  */
82
55
  tool_collections?: string[]
83
56
 
84
- /**
85
- * An URL providing interactions definitions in JSON format.
86
- * GET interactions_url should return a JSON object with the interactions definitions.
87
- * GET `${interactions_url}/${endpoint}` should return a JSON object with the interaction definition for the specified endpoint.
88
- */
89
- interactions?: AppInteractionRef[];
90
-
91
57
  /**
92
58
  * A JSON chema for the app installation settings.
93
59
  */
package/src/index.ts CHANGED
@@ -28,4 +28,5 @@ export * from './user.js';
28
28
  export * from './utils/auth.js';
29
29
  export * from './utils/schemas.js';
30
30
  export type * from './utils/type-helpers.js';
31
- export * from './sts-token-types.js';
31
+ export * from './versions.js';
32
+
@@ -4,7 +4,6 @@ import type {
4
4
  JSONSchema,
5
5
  Modalities,
6
6
  ModelOptions,
7
- PromptRole,
8
7
  StatelessExecutionOptions,
9
8
  ToolDefinition,
10
9
  ToolUse,
@@ -16,12 +15,10 @@ import { ExecutionTokenUsage } from "@llumiverse/common";
16
15
  import { ExecutionEnvironmentRef } from "./environment.js";
17
16
  import { ProjectRef } from "./project.js";
18
17
  import {
19
- ExecutablePromptSegmentDef,
20
18
  PopulatedPromptSegmentDef,
21
19
  PromptSegmentDef,
22
20
  PromptTemplateRef,
23
21
  PromptTemplateRefWithSchema,
24
- TemplateType,
25
22
  } from "./prompt.js";
26
23
  import { ExecutionRunDocRef } from "./runs.js";
27
24
  import { AccountRef } from "./user.js";
@@ -32,79 +29,6 @@ export interface InteractionExecutionError {
32
29
  data?: any;
33
30
  }
34
31
 
35
-
36
- // ------------------ in code interactions -----------------
37
- export interface InCodePrompt {
38
- role: PromptRole,
39
- content: string,
40
- content_type: TemplateType;
41
- schema?: JSONSchema;
42
- }
43
- export interface InCodeInteraction {
44
- /**
45
- * The id of the interaction. Required.
46
- * The id is a unique identifier for the interaction.
47
- * It is recommended to use a URL safe string and not include spaces.
48
- * The id composaed by some namespace or prefix and the interaction name.
49
- * Example: sys:generic_question, app:review_contract, tmp:my_temp_interaction
50
- */
51
- id: string;
52
-
53
- /**
54
- * The interaction code name. Required.
55
- * Should be a URL safe string and not include spaces. It is recommended to use kebab-case or camel-case.
56
- * The endpoints must satisfy the following regexp: /^[a-zA-Z0-9-_]+$/. No whitespaces or special characters are allowed.
57
- */
58
- name: string;
59
-
60
- /**
61
- * A title for the interaction. If not provided, the endpoint will be used.
62
- */
63
- title?: string;
64
-
65
- /**
66
- * An optional description of the interaction.
67
- */
68
- description?: string;
69
-
70
- /**
71
- * The JSON schema to be used for the result if any.
72
- */
73
- result_schema?: JSONSchema;
74
-
75
- /**
76
- * The modality of the interaction output.
77
- * If not specified Modalities.Text is assumed.
78
- */
79
- output_modality?: Modalities,
80
-
81
- /**
82
- * How to store the run data for executions of this interaction.
83
- * Defaults to STANDARD.
84
- */
85
- storage?: RunDataStorageLevel;
86
-
87
- /**
88
- * Optional tags for the interaction.
89
- */
90
- tags?: string[];
91
-
92
- /**
93
- * Default options for the model to be used when executing this interaction.
94
- * (like temperature etc)
95
- */
96
- model_options?: ModelOptions;
97
-
98
- /**
99
- * The prompts composing the interaction. Required.
100
- */
101
- prompts: InCodePrompt[]
102
-
103
- }
104
- export interface InteractionSpec extends Omit<InCodeInteraction, 'id'> {
105
- }
106
- // ---------------------------------------------------------
107
-
108
32
  /**
109
33
  * The payload to query the interaction endpoints
110
34
  */
@@ -243,31 +167,28 @@ export interface CachePolicy {
243
167
  ttl: number;
244
168
  }
245
169
  export type InteractionVisibility = "public" | "private";
246
-
247
- export interface InteractionData {
170
+ export interface Interaction {
248
171
  readonly id: string;
249
172
  name: string;
250
173
  endpoint: string;
251
174
  description?: string;
252
- project: string | ProjectRef;
253
- tags: string[];
254
- result_schema?: JSONSchema4 | SchemaRef;
255
- environment?: string | ExecutionEnvironmentRef;
256
- model?: string;
257
- model_options?: ModelOptions;
258
- restriction?: RunDataStorageLevel;
259
- output_modality?: Modalities;
260
- }
261
- export interface Interaction extends InteractionData {
262
175
  status: InteractionStatus;
263
176
  parent?: string;
264
177
  // only used for versions (status === "published")
265
178
  visibility: InteractionVisibility;
266
179
  version: number;
180
+ tags: string[];
267
181
  test_data?: JSONObject;
268
182
  interaction_schema?: JSONSchema4 | SchemaRef;
183
+ result_schema?: JSONSchema4 | SchemaRef;
269
184
  cache_policy?: CachePolicy;
185
+ model: string;
186
+ model_options?: ModelOptions;
270
187
  prompts: PromptSegmentDef[];
188
+ output_modality?: Modalities;
189
+ environment: string | ExecutionEnvironmentRef;
190
+ restriction?: RunDataStorageLevel;
191
+ project: string | ProjectRef;
271
192
  // only for drafts - when it was last published
272
193
  last_published_at?: Date;
273
194
  created_by: string;
@@ -280,14 +201,6 @@ export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
280
201
  prompts: PopulatedPromptSegmentDef[];
281
202
  }
282
203
 
283
- /**
284
- * Used to describe an interaction that can be executed. Contains only the interaction data useful
285
- * to execute the interaction plus the prompt templates
286
- */
287
- export interface ExecutableInteraction extends InteractionData {
288
- prompts: ExecutablePromptSegmentDef[];
289
- }
290
-
291
204
  export interface InteractionCreatePayload
292
205
  extends Omit<
293
206
  Interaction,
@@ -358,12 +271,6 @@ export interface InteractionExecutionPayload {
358
271
  * The workflow related to this Interaction Run.
359
272
  */
360
273
  workflow?: ExecutionRunWorkflow;
361
-
362
- /**
363
- * Only used by ad-hoc interactions which defines the prompt in the execution payload itself
364
- * These are temporary interactions using "tmp:" suffix.
365
- */
366
- prompts?: InCodePrompt[];
367
274
  }
368
275
 
369
276
  export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
@@ -517,7 +424,7 @@ export interface RunSource {
517
424
  client_ip: string;
518
425
  }
519
426
 
520
- export interface BaseExecutionRun<P = any> {
427
+ export interface ExecutionRun<P = any> {
521
428
  readonly id: string;
522
429
  /**
523
430
  * Only used by runs that were created by a virtual run to point toward the virtual run parent
@@ -536,12 +443,8 @@ export interface BaseExecutionRun<P = any> {
536
443
  */
537
444
  parameters: P; //params used to create the interaction, only in varies on?
538
445
  tags?: string[];
539
- // only set when the target interaction is a stored interaction
540
- //TODO check the code where Interaction type is used (should be in run details)
541
- // TODO when execution string is passed as the type of interaction
542
- interaction?: string | Interaction;
543
- // only set when the target interaction is an in-code interaction
544
- interaction_code?: string; // Interaction code name in case of in-code interaction (not stored in the DB as an Interaction document)
446
+ //TODO a string is returned when executing not the interaction object
447
+ interaction: Interaction;
545
448
  //TODO a string is returned when execution not the env object
546
449
  environment: ExecutionEnvironmentRef;
547
450
  modelId: string;
@@ -574,14 +477,6 @@ export interface BaseExecutionRun<P = any> {
574
477
  workflow?: ExecutionRunWorkflow;
575
478
  }
576
479
 
577
- export interface ExecutionRun<P = any> extends BaseExecutionRun<P> {
578
- interaction?: string;
579
- }
580
-
581
- export interface PopulatedExecutionRun<P = any> extends BaseExecutionRun<P> {
582
- interaction?: Interaction;
583
- }
584
-
585
480
  export interface ExecutionRunWorkflow {
586
481
  /**
587
482
  * The Temporal Workflow Run ID related to this Interaction Run.
@@ -615,8 +510,7 @@ export interface InteractionExecutionResult<P = any> extends ExecutionRun<P> {
615
510
  }
616
511
 
617
512
  export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
618
- interaction?: InteractionRef;
619
- interaction_code?: string;
513
+ interaction: InteractionRef;
620
514
  }
621
515
 
622
516
  export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt";
package/src/project.ts CHANGED
@@ -142,7 +142,9 @@ export interface EmbeddingsStatusResponse {
142
142
  status: string;
143
143
  embeddingRunsInProgress: number;
144
144
  totalRunsInProgress: number;
145
+ totalIndexableObjects: number;
145
146
  embeddingsModels: string[];
147
+ objectsWithEmbeddings: number;
146
148
  vectorIndex: {
147
149
  status: "READY" | "PENDING" | "DELETING" | "ABSENT",
148
150
  name?: string,
package/src/prompt.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { JSONObject } from "@llumiverse/common";
2
- import { PromptRole } from "@llumiverse/common";
3
1
  import type { JSONSchema4 } from "json-schema";
2
+ import type { JSONObject } from "@llumiverse/common";
4
3
  import { ProjectRef } from "./project.js";
4
+ import { PromptRole } from "@llumiverse/common";
5
5
 
6
6
  export interface ChatPromptSchema {
7
7
  role: PromptRole.user | PromptRole.assistant;
@@ -31,13 +31,6 @@ export interface PopulatedPromptSegmentDef
31
31
  extends Omit<PromptSegmentDef, "template"> {
32
32
  template?: PromptTemplate;
33
33
  }
34
- /**
35
- * Used for prompt rendering at interaction execution
36
- */
37
- export interface ExecutablePromptSegmentDef
38
- extends Omit<PromptSegmentDef, "template"> {
39
- template?: ExecutablePromptTemplate;
40
- }
41
34
 
42
35
  export interface PromptTemplateRef {
43
36
  id: string;
@@ -54,25 +47,25 @@ export interface PromptTemplateRefWithSchema extends PromptTemplateRef {
54
47
 
55
48
  export enum TemplateType {
56
49
  text = "text",
50
+ js = "js",
57
51
  jst = "jst",
58
52
  }
59
- export interface ExecutablePromptTemplate {
60
- role: PromptRole;
61
- content: string;
62
- content_type: TemplateType;
63
- inputSchema?: JSONSchema4;
64
- }
65
- export interface PromptTemplate extends ExecutablePromptTemplate {
53
+
54
+ export interface PromptTemplate {
66
55
  id: string;
67
56
  name: string;
57
+ role: PromptRole;
68
58
  status: PromptStatus;
69
59
  version: number;
70
60
  // only to be used by published versions
71
61
  // the id draft version which is the source of this published version (only when published)
72
62
  parent?: string;
73
63
  description?: string;
64
+ content_type: TemplateType;
65
+ content: string;
74
66
  test_data?: JSONObject; // optional test data satisfying the schema
75
67
  script?: string; // cache the template output
68
+ inputSchema?: JSONSchema4;
76
69
  project: string | ProjectRef; // or projectRef? ObjectIdType;
77
70
  // The name of a field in the input data that is of the specified schema and on each the template will iterate.
78
71
  // If not specified then the schema will define the whole input data
@@ -66,7 +66,7 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
66
66
  * The list of endpoints to notify when the workflow finishes.
67
67
  * It is handled by a sub-workflow execution, so the main workflow will not wait for the notification to be sent.
68
68
  */
69
- notify_endpoints?: string[];
69
+ notify_endpoints?: (string | WebHookSpec)[];
70
70
 
71
71
  /** If this is a child workflow, parent contains parent's ids */
72
72
  parent?: {
@@ -85,6 +85,17 @@ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
85
85
 
86
86
  }
87
87
 
88
+ export interface WebHookSpec {
89
+ /**
90
+ * The webhook URL to call using POST method
91
+ */
92
+ url: string;
93
+ /**
94
+ * the API version to use if any
95
+ */
96
+ version?: number;
97
+ }
98
+
88
99
  export interface WorkflowExecutionPayload<T = Record<string, any>> extends WorkflowExecutionBaseParams<T> {
89
100
  /**
90
101
  * The event which started the workflow who created the activity.
@@ -410,42 +421,3 @@ export interface Plan {
410
421
  }
411
422
 
412
423
  export const LOW_PRIORITY_TASK_QUEUE = "low_priority";
413
-
414
- /**
415
- * WebSocket message types for bidirectional communication
416
- */
417
- export interface WebSocketSignalMessage {
418
- type: 'signal';
419
- signalName: string;
420
- data: any;
421
- requestId?: string | number;
422
- }
423
-
424
- export interface WebSocketPingMessage {
425
- type: 'ping';
426
- }
427
-
428
- export interface WebSocketPongMessage {
429
- type: 'pong';
430
- }
431
-
432
- export interface WebSocketAckMessage {
433
- type: 'ack';
434
- requestId: string | number;
435
- }
436
-
437
- export interface WebSocketErrorMessage {
438
- type: 'error';
439
- requestId?: string | number;
440
- error: string;
441
- }
442
-
443
- export type WebSocketClientMessage =
444
- | WebSocketSignalMessage
445
- | WebSocketPingMessage;
446
-
447
- export type WebSocketServerMessage =
448
- | WebSocketPongMessage
449
- | WebSocketAckMessage
450
- | WebSocketErrorMessage
451
- | AgentMessage;
@@ -1,8 +1,8 @@
1
- import type { JSONSchema } from "@llumiverse/common";
2
1
  import { PromptRole } from "@llumiverse/common";
2
+ import type { JSONSchema } from "@llumiverse/common";
3
3
  import type { JSONSchema4 } from "json-schema";
4
4
  import { InteractionRefWithSchema, PopulatedInteraction } from "../interaction.js";
5
- import { ExecutablePromptSegmentDef, PromptSegmentDefType } from "../prompt.js";
5
+ import { PopulatedPromptSegmentDef, PromptSegmentDef, PromptSegmentDefType, PromptTemplateRefWithSchema } from "../prompt.js";
6
6
 
7
7
 
8
8
  export function mergeJSONSchemas(schemas: JSONSchema[]) {
@@ -22,7 +22,7 @@ export function mergeJSONSchemas(schemas: JSONSchema[]) {
22
22
  return schema;
23
23
  }
24
24
 
25
- export function _mergePromptsSchema(prompts: ExecutablePromptSegmentDef[]) {
25
+ export function _mergePromptsSchema(prompts: PromptSegmentDef<PromptTemplateRefWithSchema>[] | PopulatedPromptSegmentDef[]) {
26
26
  const props: Record<string, JSONSchema4> = {};
27
27
  let required: string[] = [];
28
28
  for (const prompt of prompts) {
@@ -59,5 +59,5 @@ export function _mergePromptsSchema(prompts: ExecutablePromptSegmentDef[]) {
59
59
 
60
60
  export function mergePromptsSchema(interaction: InteractionRefWithSchema | PopulatedInteraction) {
61
61
  if (!interaction.prompts) return null;
62
- return _mergePromptsSchema(interaction.prompts as ExecutablePromptSegmentDef[]);
62
+ return _mergePromptsSchema(interaction.prompts);
63
63
  }
@@ -0,0 +1,3 @@
1
+ export enum ApiVersions {
2
+ COMPLETION_RESULT_V1 = 20250925,
3
+ }
@@ -1,114 +0,0 @@
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
-
8
- interface BaseTokenRequest {
9
- type: TokenType;
10
- audience?: string;
11
- }
12
-
13
- // API key doesn't need account/project as it's determined from the key
14
- export interface ApiKeyTokenRequest extends BaseTokenRequest {
15
- type: 'apikey';
16
- key: string;
17
- }
18
-
19
- // User token needs optional account/project for scoping
20
- export interface UserTokenRequest extends BaseTokenRequest {
21
- type: 'user';
22
- user_id?: string; // Optional - can be determined from auth token
23
- account_id?: string; // Optional - for scoping to specific account
24
- project_id?: string; // Optional - for scoping to specific project
25
- expires_at?: number;
26
-
27
- on_behalf_of?: string; // Optional - user ID when acting on behalf of another user
28
- }
29
-
30
- // Project token requires project_id and account_id
31
- export interface ProjectTokenRequest extends BaseTokenRequest {
32
- type: 'project';
33
- project_id: string;
34
- account_id: string;
35
- }
36
-
37
- // Environment token requires IDs - names fetched from DB
38
- export interface EnvironmentTokenRequest extends BaseTokenRequest {
39
- type: 'environment';
40
- environment_id: string;
41
- environment_name: string; // Still required as environments may not be in DB
42
- project_id: string; // Will fetch name and verify account
43
- account_id: string; // Will fetch name and verify project belongs to it
44
- }
45
-
46
- // Agent token for service accounts acting as agents
47
- export interface AgentTokenRequest extends BaseTokenRequest {
48
- type: 'agent';
49
- account_id: string;
50
- project_id: string; // Will verify it belongs to account
51
- name?: string;
52
- on_behalf_of: string; // Required: signed Vertesia token to verify user context
53
- }
54
-
55
- // Service account token
56
- export interface ServiceAccountTokenRequest extends BaseTokenRequest {
57
- type: 'service_account';
58
- account_id: string;
59
- project_id: string; // Will verify it belongs to account
60
- roles?: string[]; // Optional - roles for the service account token
61
- name?: string;
62
- }
63
-
64
- export type IssueTokenRequest =
65
- | ApiKeyTokenRequest
66
- | UserTokenRequest
67
- | ProjectTokenRequest
68
- | EnvironmentTokenRequest
69
- | AgentTokenRequest
70
- | ServiceAccountTokenRequest;
71
-
72
- export interface RefreshTokenRequest {
73
- token: string;
74
- }
75
-
76
- export interface RevokeTokenRequest {
77
- token: string;
78
- }
79
-
80
- // Helper type guards for type narrowing
81
- export function isApiKeyRequest(req: IssueTokenRequest): req is ApiKeyTokenRequest {
82
- return req.type === 'apikey';
83
- }
84
-
85
- export function isUserRequest(req: IssueTokenRequest): req is UserTokenRequest {
86
- return req.type === 'user';
87
- }
88
-
89
- export function isProjectRequest(req: IssueTokenRequest): req is ProjectTokenRequest {
90
- return req.type === 'project';
91
- }
92
-
93
- export function isEnvironmentRequest(req: IssueTokenRequest): req is EnvironmentTokenRequest {
94
- return req.type === 'environment';
95
- }
96
-
97
- export function isAgentRequest(req: IssueTokenRequest): req is AgentTokenRequest {
98
- return req.type === 'agent';
99
- }
100
-
101
- export function isServiceAccountRequest(req: IssueTokenRequest): req is ServiceAccountTokenRequest {
102
- return req.type === 'service_account';
103
- }
104
-
105
- // Response types
106
- export interface TokenResponse {
107
- token: string;
108
- }
109
-
110
- export interface ValidateTokenResponse {
111
- valid: boolean;
112
- payload?: any;
113
- error?: string;
114
- }