@vertesia/common 0.51.0 → 0.54.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 (231) hide show
  1. package/package.json +3 -3
  2. package/src/apikey.ts +1 -1
  3. package/src/common.ts +3 -0
  4. package/src/index.ts +1 -1
  5. package/src/integrations.ts +1 -1
  6. package/src/interaction.ts +263 -40
  7. package/src/meters.ts +9 -3
  8. package/src/payload.ts +15 -3
  9. package/src/plugin.ts +12 -0
  10. package/src/project.ts +8 -0
  11. package/src/prompt.ts +1 -1
  12. package/src/query.ts +5 -3
  13. package/src/runs.ts +11 -2
  14. package/src/store/activity-catalog.ts +2 -2
  15. package/src/store/agent.ts +1 -1
  16. package/src/store/collections.ts +9 -3
  17. package/src/store/common.ts +21 -1
  18. package/src/store/doc-analyzer.ts +80 -20
  19. package/src/store/dsl-workflow.ts +9 -9
  20. package/src/store/index.ts +1 -0
  21. package/src/store/signals.ts +5 -0
  22. package/src/store/store.ts +118 -52
  23. package/src/store/workflow.ts +173 -67
  24. package/src/user.ts +0 -2
  25. package/src/utils/schemas.ts +18 -1
  26. package/lib/cjs/Progress.js +0 -61
  27. package/lib/cjs/Progress.js.map +0 -1
  28. package/lib/cjs/access-control.js +0 -39
  29. package/lib/cjs/access-control.js.map +0 -1
  30. package/lib/cjs/analytics.js +0 -3
  31. package/lib/cjs/analytics.js.map +0 -1
  32. package/lib/cjs/apikey.js +0 -15
  33. package/lib/cjs/apikey.js.map +0 -1
  34. package/lib/cjs/common.js +0 -3
  35. package/lib/cjs/common.js.map +0 -1
  36. package/lib/cjs/environment.js +0 -116
  37. package/lib/cjs/environment.js.map +0 -1
  38. package/lib/cjs/facets.js +0 -3
  39. package/lib/cjs/facets.js.map +0 -1
  40. package/lib/cjs/index.js +0 -40
  41. package/lib/cjs/index.js.map +0 -1
  42. package/lib/cjs/integrations.js +0 -11
  43. package/lib/cjs/integrations.js.map +0 -1
  44. package/lib/cjs/interaction.js +0 -63
  45. package/lib/cjs/interaction.js.map +0 -1
  46. package/lib/cjs/meters.js +0 -13
  47. package/lib/cjs/meters.js.map +0 -1
  48. package/lib/cjs/package.json +0 -3
  49. package/lib/cjs/payload.js +0 -3
  50. package/lib/cjs/payload.js.map +0 -1
  51. package/lib/cjs/project.js +0 -50
  52. package/lib/cjs/project.js.map +0 -1
  53. package/lib/cjs/prompt.js +0 -21
  54. package/lib/cjs/prompt.js.map +0 -1
  55. package/lib/cjs/query.js +0 -3
  56. package/lib/cjs/query.js.map +0 -1
  57. package/lib/cjs/refs.js +0 -12
  58. package/lib/cjs/refs.js.map +0 -1
  59. package/lib/cjs/runs.js +0 -3
  60. package/lib/cjs/runs.js.map +0 -1
  61. package/lib/cjs/store/activity-catalog.js +0 -3
  62. package/lib/cjs/store/activity-catalog.js.map +0 -1
  63. package/lib/cjs/store/agent.js +0 -3
  64. package/lib/cjs/store/agent.js.map +0 -1
  65. package/lib/cjs/store/collections.js +0 -9
  66. package/lib/cjs/store/collections.js.map +0 -1
  67. package/lib/cjs/store/common.js +0 -3
  68. package/lib/cjs/store/common.js.map +0 -1
  69. package/lib/cjs/store/doc-analyzer.js +0 -3
  70. package/lib/cjs/store/doc-analyzer.js.map +0 -1
  71. package/lib/cjs/store/dsl-workflow.js +0 -5
  72. package/lib/cjs/store/dsl-workflow.js.map +0 -1
  73. package/lib/cjs/store/index.js +0 -27
  74. package/lib/cjs/store/index.js.map +0 -1
  75. package/lib/cjs/store/object-types.js +0 -98
  76. package/lib/cjs/store/object-types.js.map +0 -1
  77. package/lib/cjs/store/store.js +0 -18
  78. package/lib/cjs/store/store.js.map +0 -1
  79. package/lib/cjs/store/temporalio.js +0 -44
  80. package/lib/cjs/store/temporalio.js.map +0 -1
  81. package/lib/cjs/store/workflow.js +0 -24
  82. package/lib/cjs/store/workflow.js.map +0 -1
  83. package/lib/cjs/training.js +0 -14
  84. package/lib/cjs/training.js.map +0 -1
  85. package/lib/cjs/transient-tokens.js +0 -9
  86. package/lib/cjs/transient-tokens.js.map +0 -1
  87. package/lib/cjs/user.js +0 -17
  88. package/lib/cjs/user.js.map +0 -1
  89. package/lib/cjs/utils/advanced-content-processing.js +0 -25
  90. package/lib/cjs/utils/advanced-content-processing.js.map +0 -1
  91. package/lib/cjs/utils/auth.js +0 -15
  92. package/lib/cjs/utils/auth.js.map +0 -1
  93. package/lib/cjs/utils/schemas.js +0 -48
  94. package/lib/cjs/utils/schemas.js.map +0 -1
  95. package/lib/esm/Progress.js +0 -57
  96. package/lib/esm/Progress.js.map +0 -1
  97. package/lib/esm/access-control.js +0 -36
  98. package/lib/esm/access-control.js.map +0 -1
  99. package/lib/esm/analytics.js +0 -2
  100. package/lib/esm/analytics.js.map +0 -1
  101. package/lib/esm/apikey.js +0 -12
  102. package/lib/esm/apikey.js.map +0 -1
  103. package/lib/esm/common.js +0 -2
  104. package/lib/esm/common.js.map +0 -1
  105. package/lib/esm/environment.js +0 -113
  106. package/lib/esm/environment.js.map +0 -1
  107. package/lib/esm/facets.js +0 -2
  108. package/lib/esm/facets.js.map +0 -1
  109. package/lib/esm/index.js +0 -24
  110. package/lib/esm/index.js.map +0 -1
  111. package/lib/esm/integrations.js +0 -8
  112. package/lib/esm/integrations.js.map +0 -1
  113. package/lib/esm/interaction.js +0 -60
  114. package/lib/esm/interaction.js.map +0 -1
  115. package/lib/esm/meters.js +0 -10
  116. package/lib/esm/meters.js.map +0 -1
  117. package/lib/esm/payload.js +0 -2
  118. package/lib/esm/payload.js.map +0 -1
  119. package/lib/esm/project.js +0 -46
  120. package/lib/esm/project.js.map +0 -1
  121. package/lib/esm/prompt.js +0 -18
  122. package/lib/esm/prompt.js.map +0 -1
  123. package/lib/esm/query.js +0 -2
  124. package/lib/esm/query.js.map +0 -1
  125. package/lib/esm/refs.js +0 -9
  126. package/lib/esm/refs.js.map +0 -1
  127. package/lib/esm/runs.js +0 -2
  128. package/lib/esm/runs.js.map +0 -1
  129. package/lib/esm/store/activity-catalog.js +0 -2
  130. package/lib/esm/store/activity-catalog.js.map +0 -1
  131. package/lib/esm/store/agent.js +0 -2
  132. package/lib/esm/store/agent.js.map +0 -1
  133. package/lib/esm/store/collections.js +0 -6
  134. package/lib/esm/store/collections.js.map +0 -1
  135. package/lib/esm/store/common.js +0 -2
  136. package/lib/esm/store/common.js.map +0 -1
  137. package/lib/esm/store/doc-analyzer.js +0 -2
  138. package/lib/esm/store/doc-analyzer.js.map +0 -1
  139. package/lib/esm/store/dsl-workflow.js +0 -2
  140. package/lib/esm/store/dsl-workflow.js.map +0 -1
  141. package/lib/esm/store/index.js +0 -11
  142. package/lib/esm/store/index.js.map +0 -1
  143. package/lib/esm/store/object-types.js +0 -95
  144. package/lib/esm/store/object-types.js.map +0 -1
  145. package/lib/esm/store/store.js +0 -15
  146. package/lib/esm/store/store.js.map +0 -1
  147. package/lib/esm/store/temporalio.js +0 -41
  148. package/lib/esm/store/temporalio.js.map +0 -1
  149. package/lib/esm/store/workflow.js +0 -21
  150. package/lib/esm/store/workflow.js.map +0 -1
  151. package/lib/esm/training.js +0 -11
  152. package/lib/esm/training.js.map +0 -1
  153. package/lib/esm/transient-tokens.js +0 -6
  154. package/lib/esm/transient-tokens.js.map +0 -1
  155. package/lib/esm/user.js +0 -14
  156. package/lib/esm/user.js.map +0 -1
  157. package/lib/esm/utils/advanced-content-processing.js +0 -19
  158. package/lib/esm/utils/advanced-content-processing.js.map +0 -1
  159. package/lib/esm/utils/auth.js +0 -11
  160. package/lib/esm/utils/auth.js.map +0 -1
  161. package/lib/esm/utils/schemas.js +0 -44
  162. package/lib/esm/utils/schemas.js.map +0 -1
  163. package/lib/tsconfig.tsbuildinfo +0 -1
  164. package/lib/types/Progress.d.ts +0 -22
  165. package/lib/types/Progress.d.ts.map +0 -1
  166. package/lib/types/access-control.d.ts +0 -57
  167. package/lib/types/access-control.d.ts.map +0 -1
  168. package/lib/types/analytics.d.ts +0 -37
  169. package/lib/types/analytics.d.ts.map +0 -1
  170. package/lib/types/apikey.d.ts +0 -55
  171. package/lib/types/apikey.d.ts.map +0 -1
  172. package/lib/types/common.d.ts +0 -29
  173. package/lib/types/common.d.ts.map +0 -1
  174. package/lib/types/environment.d.ts +0 -81
  175. package/lib/types/environment.d.ts.map +0 -1
  176. package/lib/types/facets.d.ts +0 -35
  177. package/lib/types/facets.d.ts.map +0 -1
  178. package/lib/types/index.d.ts +0 -24
  179. package/lib/types/index.d.ts.map +0 -1
  180. package/lib/types/integrations.d.ts +0 -24
  181. package/lib/types/integrations.d.ts.map +0 -1
  182. package/lib/types/interaction.d.ts +0 -230
  183. package/lib/types/interaction.d.ts.map +0 -1
  184. package/lib/types/meters.d.ts +0 -17
  185. package/lib/types/meters.d.ts.map +0 -1
  186. package/lib/types/payload.d.ts +0 -50
  187. package/lib/types/payload.d.ts.map +0 -1
  188. package/lib/types/project.d.ts +0 -96
  189. package/lib/types/project.d.ts.map +0 -1
  190. package/lib/types/prompt.d.ts +0 -71
  191. package/lib/types/prompt.d.ts.map +0 -1
  192. package/lib/types/query.d.ts +0 -77
  193. package/lib/types/query.d.ts.map +0 -1
  194. package/lib/types/refs.d.ts +0 -20
  195. package/lib/types/refs.d.ts.map +0 -1
  196. package/lib/types/runs.d.ts +0 -25
  197. package/lib/types/runs.d.ts.map +0 -1
  198. package/lib/types/store/activity-catalog.d.ts +0 -27
  199. package/lib/types/store/activity-catalog.d.ts.map +0 -1
  200. package/lib/types/store/agent.d.ts +0 -19
  201. package/lib/types/store/agent.d.ts.map +0 -1
  202. package/lib/types/store/collections.d.ts +0 -55
  203. package/lib/types/store/collections.d.ts.map +0 -1
  204. package/lib/types/store/common.d.ts +0 -11
  205. package/lib/types/store/common.d.ts.map +0 -1
  206. package/lib/types/store/doc-analyzer.d.ts +0 -84
  207. package/lib/types/store/doc-analyzer.d.ts.map +0 -1
  208. package/lib/types/store/dsl-workflow.d.ts +0 -239
  209. package/lib/types/store/dsl-workflow.d.ts.map +0 -1
  210. package/lib/types/store/index.d.ts +0 -11
  211. package/lib/types/store/index.d.ts.map +0 -1
  212. package/lib/types/store/object-types.d.ts +0 -24
  213. package/lib/types/store/object-types.d.ts.map +0 -1
  214. package/lib/types/store/store.d.ts +0 -211
  215. package/lib/types/store/store.d.ts.map +0 -1
  216. package/lib/types/store/temporalio.d.ts +0 -17
  217. package/lib/types/store/temporalio.d.ts.map +0 -1
  218. package/lib/types/store/workflow.d.ts +0 -147
  219. package/lib/types/store/workflow.d.ts.map +0 -1
  220. package/lib/types/training.d.ts +0 -39
  221. package/lib/types/training.d.ts.map +0 -1
  222. package/lib/types/transient-tokens.d.ts +0 -28
  223. package/lib/types/transient-tokens.d.ts.map +0 -1
  224. package/lib/types/user.d.ts +0 -116
  225. package/lib/types/user.d.ts.map +0 -1
  226. package/lib/types/utils/advanced-content-processing.d.ts +0 -16
  227. package/lib/types/utils/advanced-content-processing.d.ts.map +0 -1
  228. package/lib/types/utils/auth.d.ts +0 -4
  229. package/lib/types/utils/auth.d.ts.map +0 -1
  230. package/lib/types/utils/schemas.d.ts +0 -6
  231. package/lib/types/utils/schemas.d.ts.map +0 -1
@@ -1,61 +1,66 @@
1
-
2
1
  export enum ContentEventName {
3
2
  create = "create",
4
3
  change_type = "change_type",
5
4
  update = "update",
5
+ revision_created = "revision_created",
6
6
  delete = "delete",
7
7
  workflow_finished = "workflow_finished",
8
8
  workflow_execution_request = "workflow_execution_request",
9
+ api_request = "api_request",
9
10
  }
10
11
 
12
+ export interface WorkflowExecutionBaseParams<T = Record<string, any>> {
13
+ /**
14
+ * The ref of the user who initiated the workflow.
15
+ */
16
+ initiated_by?: string;
11
17
 
12
- export interface WorkflowExecutionBaseParams<T=Record<string, any>> {
18
+ /**
19
+ * The account ID of the user who created the activity.
20
+ * This is useful to select the right database to work on.
21
+ */
22
+ account_id: string;
13
23
 
14
- /**
15
- * The ref of the user who initiated the workflow.
16
- */
17
- initiated_by?: string;
24
+ /**
25
+ * The project ID of the account who created the activity.
26
+ */
27
+ project_id: string;
18
28
 
19
- /**
20
- * The account ID of the user who created the activity.
21
- * This is usefull to select the right database to work on.
22
- */
23
- account_id: string;
29
+ /**
30
+ * The vars field is mainly used to pass the user input to the workflow.
31
+ * The user input ar custom user options that can be used to configure the workflow.
32
+ * You can see the user input as the arguments for a command line app.
33
+ *
34
+ * In the case of workflows started by events (e.g. using a a workflow rule) the user input vars will be initialized with the workflow rule configuration field.
35
+ *
36
+ * In case of dsl workflows the workflow execution payload vars will be applied over the default vars values stored in the DSL vars field.
37
+ */
38
+ vars: T;
24
39
 
25
- /**
26
- * The project ID of the account who created the activity.
27
- */
28
- project_id: string;
40
+ /**
41
+ * Auth Token to access Zeno and Composable from the workers
42
+ */
43
+ auth_token?: string;
29
44
 
30
- /**
31
- * The vars field is mainly used to pass the user input to the workflow.
32
- * The user input ar custom user options that can be used to configure the workflow.
33
- * You can see the user input as the arguments for a command line app.
34
- *
35
- * In the case of workflows started by events (e.g. using a a workflow rule) the user input vars will be initialized with the workflow rule configuration field.
36
- *
37
- * In case of dsl workflows the worflow execution payload vars will be applied over the default vars values stored in the DSL vars field.
38
- */
39
- vars: T;
45
+ /**
46
+ * The configuration for the workflow execution.
47
+ */
48
+ config?: {
49
+ studio_url: string;
50
+ store_url: string;
51
+ slack_app_url?: string;
52
+ enabled_integrations?: string[]; //list of enabled integrations
53
+ };
40
54
 
41
- /**
42
- * Auth Token to access Zeno and Composable from the workers
43
- */
44
- auth_token?: string;
55
+ /**
56
+ * The list of endpoints to notify when the workflow finishes.
57
+ * It is handled by a sub-workflow execution, so the main workflow will not wait for the notification to be sent.
58
+ */
59
+ notify_endpoints?: string[];
45
60
 
46
- /**
47
- * The configuration for the workflow execution.
48
- */
49
- config?: {
50
- studio_url: string;
51
- store_url: string;
52
- enabled_integrations?: string[]; //list of enabled integrations
53
- }
54
-
55
61
  }
56
62
 
57
-
58
- export interface WorkflowExecutionPayload<T=Record<string, any>> extends WorkflowExecutionBaseParams<T> {
63
+ export interface WorkflowExecutionPayload<T = Record<string, any>> extends WorkflowExecutionBaseParams<T> {
59
64
  /**
60
65
  * The event which started the workflow who created the activity.
61
66
  */
@@ -72,38 +77,102 @@ export interface WorkflowExecutionPayload<T=Record<string, any>> extends Workflo
72
77
  */
73
78
  objectIds: string[];
74
79
 
75
- /**
76
- * Auth Token to access Zeno and Composable from the workers
77
- */
78
- auth_token: string;
79
-
80
-
81
80
  /**
82
- * The configuration for the workflow execution.
81
+ * Auth Token to access Zeno and Composable from the workers
83
82
  */
84
- config?: {
85
- studio_url: string;
86
- store_url: string;
87
- enabled_integrations?: string[]; //list of enabled integrations
88
- }
83
+ auth_token: string;
89
84
  }
90
85
 
86
+ export function getDocumentIds(payload: WorkflowExecutionPayload): string[] {
87
+ if ("objectIds" in payload) {
88
+ return payload.objectIds;
89
+ }
90
+ return [];
91
+ }
91
92
 
92
93
  export interface ExecuteWorkflowPayload {
94
+
95
+ /**
96
+ * The task queue to assign the workflow to. Deprecated, queues are choosend server side
97
+ */
98
+ //@deprecated
93
99
  task_queue?: string;
100
+
101
+ /**
102
+ * Docuument IDs pon which the workflow will be executed, deprecated, replaced params in vars
103
+ */
104
+ //@deprecated
94
105
  objectIds?: string[];
106
+
107
+ /**
108
+ * Parameters to pass to the workflow
109
+ */
95
110
  vars?: Record<string, any>;
111
+
112
+ /**
113
+ * Make the workflow ID unique by always adding a random token to the ID.
114
+ */
115
+ unique?: boolean;
116
+
117
+ /**
118
+ * A custom ID to use for the workflow execution id instead of the generated one.
119
+ */
120
+ custom_id?: string;
121
+
122
+ /**
123
+ * Timeout for the workflow execution to complete, in seconds.
124
+ */
125
+ timeout?: number; //timeout in seconds
96
126
  }
97
127
 
98
128
  export interface ListWorkflowRunsPayload {
129
+
130
+ /**
131
+ * The document ID passed to a workflow run.
132
+ */
133
+
99
134
  document_id?: string;
135
+
136
+ /**
137
+ * The event name that triggered the workflow.
138
+ */
100
139
  event_name?: string;
140
+
141
+ /**
142
+ * The workflow rule ID that triggered the workflow.
143
+ */
101
144
  rule_id?: string;
145
+
146
+ /**
147
+ * The start time for filtering workflow runs.
148
+ */
102
149
  start?: string;
150
+
151
+ /**
152
+ * The end time for filtering workflow runs.
153
+ */
103
154
  end?: string;
155
+
156
+ /**
157
+ * The status of the workflow run.
158
+ */
104
159
  status?: string;
160
+
161
+ /**
162
+ * search term to filter on workflow id and run id
163
+ */
105
164
  search_term?: string;
165
+
166
+ /**
167
+ * The user or service account that initiated the workflow run.
168
+ */
106
169
  initiated_by?: string;
170
+
171
+ /**
172
+ * Lucene query string to search for the workflow runs.
173
+ * This is a full text search on the workflow run history.
174
+ */
175
+ query?: string;
107
176
  }
108
177
 
109
178
  interface WorkflowRunEvent {
@@ -117,7 +186,7 @@ interface WorkflowRunEvent {
117
186
  name: string;
118
187
  id: string;
119
188
  input?: any;
120
- }
189
+ };
121
190
 
122
191
  error?: {
123
192
  message: string;
@@ -126,35 +195,38 @@ interface WorkflowRunEvent {
126
195
  type?: string;
127
196
  };
128
197
 
129
- result?: any
130
-
198
+ result?: any;
131
199
  }
132
200
 
133
201
  export interface WorkflowRun {
134
- status?: WorkflowExecutionStatus | string,
135
- type?: string,
136
- started_at?: number,
137
- closed_at?: number,
138
- execution_duration?: number,
139
- run_id?: string,
140
- workflow_id?: string,
141
- initiated_by?: string,
142
- raw?: any
202
+ status?: WorkflowExecutionStatus | string;
203
+ type?: string;
204
+ started_at?: number;
205
+ closed_at?: number;
206
+ execution_duration?: number;
207
+ run_id?: string;
208
+ workflow_id?: string;
209
+ initiated_by?: string;
210
+ result?: any;
211
+ raw?: any;
143
212
  }
144
213
 
145
214
  export interface WorkflowRunWithDetails extends WorkflowRun {
146
215
  history?: WorkflowRunEvent[];
216
+ memo?: {
217
+ [key: string]: any;
218
+ } | null;
147
219
  }
148
220
  export interface ListWorkflowRunsResponse {
149
221
  runs: WorkflowRun[];
150
222
  }
151
223
 
152
- export interface MultiDocumentsInteractionParams extends Omit<WorkflowExecutionPayload, 'config'> {
224
+ export interface MultiDocumentsInteractionParams extends Omit<WorkflowExecutionPayload, "config"> {
153
225
  config: {
154
226
  interactionName: string;
155
227
  action: DocumentActionConfig;
156
228
  data: Record<string, any>;
157
- }
229
+ };
158
230
  }
159
231
 
160
232
  export interface DocumentActionConfig {
@@ -176,4 +248,38 @@ export enum WorkflowExecutionStatus {
176
248
  TERMINATED = 5,
177
249
  CONTINUED_AS_NEW = 6,
178
250
  TIMED_OUT = 7,
179
- }
251
+ }
252
+
253
+ /**
254
+ * Basic response for anything run with an async workflow
255
+ */
256
+ export interface WorkflowRunStatus {
257
+ workflow_id: string | null;
258
+ workflow_run_id: string | null;
259
+ status: WorkflowExecutionStatus;
260
+ }
261
+
262
+ /**
263
+ * Workflow Update Message
264
+ */
265
+ export interface AgentMessage {
266
+ timestamp: number;
267
+ workflow_run_id: string;
268
+ type: AgentMessageType;
269
+ message?: string;
270
+ details?: any;
271
+ }
272
+
273
+ export enum AgentMessageType {
274
+ SYSTEM = "system",
275
+ THOUGHT = "thought",
276
+ PLAN = "plan",
277
+ UPDATE = "update",
278
+ COMPLETE = "complete",
279
+ WARNING = "warning",
280
+ ERROR = "error",
281
+ ANSWER = "answer",
282
+ QUESTION = "question",
283
+ REQUEST_INPUT = "request_input",
284
+ IDLE = "idle",
285
+ }
package/src/user.ts CHANGED
@@ -107,11 +107,9 @@ export interface UserSessionInfo extends SessionInfo<User> { }
107
107
  export interface ApiKeySessionInfo extends SessionInfo<ApiKey> { }
108
108
 
109
109
  export interface OnboardingProgress {
110
- projects: boolean,
111
110
  interactions: boolean,
112
111
  prompts: boolean,
113
112
  environments: boolean,
114
- runs: boolean;
115
113
  default_environment_defined: boolean
116
114
  }
117
115
 
@@ -1,8 +1,25 @@
1
- import { PromptRole } from "@llumiverse/core";
1
+ import { JSONSchema, PromptRole } from "@llumiverse/core";
2
2
  import { JSONSchema4 } from "json-schema";
3
3
  import { InteractionRefWithSchema, PopulatedInteraction } from "../interaction.js";
4
4
  import { PopulatedPromptSegmentDef, PromptSegmentDef, PromptSegmentDefType, PromptTemplateRefWithSchema } from "../prompt.js";
5
5
 
6
+
7
+ export function mergeJSONSchemas(schemas: JSONSchema[]) {
8
+ const props: Record<string, JSONSchema4> = {};
9
+ let required: string[] = [];
10
+ for (const schema of schemas) {
11
+ if (schema.properties) {
12
+ if (schema.required) {
13
+ for (const prop of schema.required as string[]) {
14
+ if (!required.includes(prop)) required.push(prop);
15
+ }
16
+ }
17
+ Object.assign(props, schema.properties);
18
+ }
19
+ }
20
+ return Object.keys(props).length > 0 ? { properties: props, required } as JSONSchema : null;
21
+ }
22
+
6
23
  export function _mergePromptsSchema(prompts: PromptSegmentDef<PromptTemplateRefWithSchema>[] | PopulatedPromptSegmentDef[]) {
7
24
  const props: Record<string, JSONSchema4> = {};
8
25
  let required: string[] = [];
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Progress = void 0;
4
- class ProgressSpan {
5
- parent;
6
- parentUnits;
7
- spanUnits;
8
- unitsDone;
9
- constructor(parent, parentUnits, spanUnits) {
10
- this.parent = parent;
11
- this.parentUnits = parentUnits;
12
- this.spanUnits = spanUnits;
13
- this.unitsDone = 0;
14
- }
15
- done(units) {
16
- const remaining = this.spanUnits - this.unitsDone;
17
- if (!remaining)
18
- return; // ignore if already done
19
- if (!units || units > remaining) {
20
- units = remaining;
21
- }
22
- this.unitsDone += units;
23
- this.parent.done(units * this.parentUnits / this.spanUnits);
24
- }
25
- get parentUnitsDone() {
26
- return Math.round(this.unitsDone * this.parentUnits / this.spanUnits);
27
- }
28
- get isDone() {
29
- return this.unitsDone >= this.spanUnits;
30
- }
31
- }
32
- class Progress {
33
- total;
34
- unitsDone = 0;
35
- constructor(total) {
36
- this.total = total;
37
- }
38
- get fraction() {
39
- return this.unitsDone / this.total;
40
- }
41
- get percent() {
42
- return Math.round(this.fraction * 100);
43
- }
44
- get isDone() {
45
- return this.unitsDone >= this.total;
46
- }
47
- done(units) {
48
- const remaining = this.total - this.unitsDone;
49
- if (!remaining)
50
- return; // ignore if already done
51
- if (!units || units > remaining) {
52
- units = remaining;
53
- }
54
- this.unitsDone += units;
55
- }
56
- span(units, spanUnits) {
57
- return new ProgressSpan(this, units, spanUnits || units);
58
- }
59
- }
60
- exports.Progress = Progress;
61
- //# sourceMappingURL=Progress.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Progress.js","sourceRoot":"","sources":["../../src/Progress.ts"],"names":[],"mappings":";;;AACA,MAAM,YAAY;IAEK;IAAyB;IAA4B;IADxE,SAAS,CAAS;IAClB,YAAmB,MAAgB,EAAS,WAAmB,EAAS,SAAiB;QAAtE,WAAM,GAAN,MAAM,CAAU;QAAS,gBAAW,GAAX,WAAW,CAAQ;QAAS,cAAS,GAAT,SAAS,CAAQ;QACrF,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,KAAc;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAClD,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,yBAAyB;QACjD,IAAI,CAAC,KAAK,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;YAC9B,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;IAC5C,CAAC;CACJ;AAED,MAAa,QAAQ;IAGE;IAFnB,SAAS,GAAW,CAAC,CAAC;IAEtB,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAChC,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;IACvC,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAc;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;QAC9C,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,yBAAyB;QACjD,IAAI,CAAC,KAAK,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;YAC9B,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,SAAkB;QAClC,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,IAAI,KAAK,CAAC,CAAC;IAC7D,CAAC;CACJ;AA9BD,4BA8BC"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module access-control
4
- * @description
5
- * Access control interfaces
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AccessControlledResource = exports.Permission = void 0;
9
- var Permission;
10
- (function (Permission) {
11
- Permission["int_read"] = "interaction:read";
12
- Permission["int_write"] = "interaction:write";
13
- Permission["int_delete"] = "interaction:delete";
14
- Permission["int_execute"] = "interaction:execute";
15
- Permission["run_read"] = "run:read";
16
- Permission["run_write"] = "run:write";
17
- Permission["env_manage"] = "environment:manage";
18
- Permission["project_manage"] = "project:manage";
19
- Permission["api_key_create"] = "api_key:create";
20
- Permission["api_key_read"] = "api_key:read";
21
- Permission["account_read"] = "account:read";
22
- Permission["account_manage"] = "account:manage";
23
- Permission["manage_billing"] = "account:billing";
24
- Permission["account_member"] = "account:member";
25
- Permission["content_read"] = "content:read";
26
- Permission["content_create"] = "content:create";
27
- Permission["content_update"] = "content:update";
28
- Permission["content_delete"] = "content:delete";
29
- Permission["content_admin"] = "content:admin";
30
- Permission["workflow_run"] = "workflow:run";
31
- })(Permission || (exports.Permission = Permission = {}));
32
- var AccessControlledResource;
33
- (function (AccessControlledResource) {
34
- AccessControlledResource["project"] = "project";
35
- AccessControlledResource["environment"] = "environment";
36
- AccessControlledResource["account"] = "account";
37
- AccessControlledResource["interaction"] = "interaction";
38
- })(AccessControlledResource || (exports.AccessControlledResource = AccessControlledResource = {}));
39
- //# sourceMappingURL=access-control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"access-control.js","sourceRoot":"","sources":["../../src/access-control.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,IAAY,UA8BX;AA9BD,WAAY,UAAU;IAClB,2CAA6B,CAAA;IAC7B,6CAA+B,CAAA;IAC/B,+CAAiC,CAAA;IAEjC,iDAAmC,CAAA;IACnC,mCAAqB,CAAA;IACrB,qCAAuB,CAAA;IAEvB,+CAAiC,CAAA;IAEjC,+CAAiC,CAAA;IAEjC,+CAAiC,CAAA;IACjC,2CAA6B,CAAA;IAE7B,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,gDAAkC,CAAA;IAClC,+CAAiC,CAAA;IAGjC,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,+CAAiC,CAAA;IACjC,+CAAiC,CAAA;IAEjC,6CAA+B,CAAA;IAE/B,2CAA6B,CAAA;AACjC,CAAC,EA9BW,UAAU,0BAAV,UAAU,QA8BrB;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAChC,+CAAmB,CAAA;IACnB,uDAA2B,CAAA;IAC3B,+CAAmB,CAAA;IACnB,uDAA2B,CAAA;AAC/B,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=analytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/analytics.ts"],"names":[],"mappings":""}
package/lib/cjs/apikey.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrincipalType = exports.ApiKeyTypes = void 0;
4
- var ApiKeyTypes;
5
- (function (ApiKeyTypes) {
6
- ApiKeyTypes["public"] = "pk";
7
- ApiKeyTypes["secret"] = "sk";
8
- })(ApiKeyTypes || (exports.ApiKeyTypes = ApiKeyTypes = {}));
9
- var PrincipalType;
10
- (function (PrincipalType) {
11
- PrincipalType["User"] = "user";
12
- PrincipalType["ApiKey"] = "apikey";
13
- PrincipalType["ServiceAcount"] = "service_account";
14
- })(PrincipalType || (exports.PrincipalType = PrincipalType = {}));
15
- //# sourceMappingURL=apikey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apikey.js","sourceRoot":"","sources":["../../src/apikey.ts"],"names":[],"mappings":";;;AAIA,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,4BAAa,CAAA;IACb,4BAAa,CAAA;AACjB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAwDD,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,8BAAa,CAAA;IACb,kCAAiB,CAAA;IACjB,kDAAiC,CAAA;AACrC,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
package/lib/cjs/common.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":""}
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExecutionEnvironmentRefPopulate = exports.SupportedProvidersList = exports.SupportedProviders = void 0;
4
- var SupportedProviders;
5
- (function (SupportedProviders) {
6
- // from llumiverse
7
- SupportedProviders["openai"] = "openai";
8
- SupportedProviders["azure_openai"] = "azure_openai";
9
- SupportedProviders["huggingface_ie"] = "huggingface_ie";
10
- SupportedProviders["replicate"] = "replicate";
11
- SupportedProviders["bedrock"] = "bedrock";
12
- SupportedProviders["vertexai"] = "vertexai";
13
- SupportedProviders["togetherai"] = "togetherai";
14
- SupportedProviders["mistralai"] = "mistralai";
15
- SupportedProviders["groq"] = "groq";
16
- SupportedProviders["watsonx"] = "watsonx";
17
- // from studio
18
- SupportedProviders["virtual_lb"] = "virtual_lb";
19
- SupportedProviders["virtual_mediator"] = "virtual_mediator";
20
- SupportedProviders["test"] = "test";
21
- })(SupportedProviders || (exports.SupportedProviders = SupportedProviders = {}));
22
- exports.SupportedProvidersList = {
23
- 'openai': {
24
- id: SupportedProviders.openai,
25
- name: "OpenAI",
26
- requiresApiKey: true,
27
- requiresEndpointUrl: false,
28
- supportSearch: false,
29
- },
30
- 'azure_openai': {
31
- id: SupportedProviders.azure_openai,
32
- name: "Azure OpenAI",
33
- requiresApiKey: false,
34
- requiresEndpointUrl: true,
35
- supportSearch: false,
36
- },
37
- 'huggingface_ie': {
38
- id: SupportedProviders.huggingface_ie,
39
- name: "HuggingFace Inference Endpoint",
40
- requiresApiKey: true,
41
- requiresEndpointUrl: true,
42
- },
43
- 'replicate': {
44
- id: SupportedProviders.replicate,
45
- name: "Repicate",
46
- requiresApiKey: true,
47
- requiresEndpointUrl: false,
48
- supportSearch: true,
49
- },
50
- 'bedrock': {
51
- id: SupportedProviders.bedrock,
52
- name: "AWS Bedrock",
53
- requiresApiKey: false,
54
- requiresEndpointUrl: false,
55
- endpointPlaceholder: "region name (eg. us-east-1)",
56
- supportSearch: false,
57
- },
58
- vertexai: {
59
- id: SupportedProviders.vertexai,
60
- name: "Google Vertex AI",
61
- requiresApiKey: false,
62
- requiresEndpointUrl: false,
63
- supportSearch: false,
64
- },
65
- togetherai: {
66
- id: SupportedProviders.togetherai,
67
- name: "Together AI",
68
- requiresApiKey: false,
69
- requiresEndpointUrl: false,
70
- supportSearch: false,
71
- },
72
- mistralai: {
73
- id: SupportedProviders.mistralai,
74
- name: "Mistral AI",
75
- requiresApiKey: false,
76
- requiresEndpointUrl: false,
77
- supportSearch: false,
78
- },
79
- groq: {
80
- id: SupportedProviders.groq,
81
- name: "Groq Cloud",
82
- requiresApiKey: false,
83
- requiresEndpointUrl: false,
84
- supportSearch: false,
85
- },
86
- watsonx: {
87
- id: SupportedProviders.watsonx,
88
- name: "IBM WatsonX",
89
- requiresApiKey: true,
90
- requiresEndpointUrl: true,
91
- supportSearch: false
92
- },
93
- 'virtual_lb': {
94
- id: SupportedProviders.virtual_lb,
95
- name: "Virtual - Load Balancer",
96
- requiresApiKey: false,
97
- requiresEndpointUrl: false,
98
- supportSearch: false,
99
- },
100
- 'virtual_mediator': {
101
- id: SupportedProviders.virtual_mediator,
102
- name: "Virtual - Mediator",
103
- requiresApiKey: false,
104
- requiresEndpointUrl: false,
105
- supportSearch: false,
106
- },
107
- 'test': {
108
- id: SupportedProviders.test,
109
- name: "Test LLM",
110
- requiresApiKey: false,
111
- requiresEndpointUrl: false,
112
- supportSearch: false,
113
- },
114
- };
115
- exports.ExecutionEnvironmentRefPopulate = "id name provider enabled_models default_model endpoint_url allowed_projects account created_at updated_at";
116
- //# sourceMappingURL=environment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":";;;AAGA,IAAY,kBAgBX;AAhBD,WAAY,kBAAkB;IAC1B,kBAAkB;IAClB,uCAAiB,CAAA;IACjB,mDAA6B,CAAA;IAC7B,uDAAiC,CAAA;IACjC,6CAAuB,CAAA;IACvB,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;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- //# sourceMappingURL=facets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"facets.js","sourceRoot":"","sources":["../../src/facets.ts"],"names":[],"mappings":""}