@vertesia/common 0.81.1 → 1.0.0-dev.20260203.130115Z

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 (301) hide show
  1. package/package.json +5 -5
  2. package/src/analytics.ts +5 -2
  3. package/src/apikey.ts +20 -1
  4. package/src/apps.ts +269 -4
  5. package/src/ask-user.ts +35 -0
  6. package/src/channels.ts +70 -0
  7. package/src/data-platform.ts +976 -0
  8. package/src/email.ts +80 -0
  9. package/src/index.ts +7 -1
  10. package/src/integrations.ts +34 -0
  11. package/src/interaction.ts +280 -1
  12. package/src/pending-asks.ts +106 -0
  13. package/src/project.ts +90 -1
  14. package/src/prompt.ts +2 -1
  15. package/src/skill.ts +1 -0
  16. package/src/store/conversation-state.ts +152 -0
  17. package/src/store/dsl-workflow.ts +12 -0
  18. package/src/store/hive-memory.ts +167 -0
  19. package/src/store/index.ts +3 -0
  20. package/src/store/schedule.ts +238 -0
  21. package/src/store/signals.ts +20 -0
  22. package/src/store/store.ts +124 -0
  23. package/src/store/workflow.test.ts +578 -0
  24. package/src/store/workflow.ts +612 -53
  25. package/src/tool-execution.ts +47 -0
  26. package/src/user.ts +14 -1
  27. package/src/workflow-analytics.ts +925 -0
  28. package/lib/cjs/Progress.js +0 -61
  29. package/lib/cjs/Progress.js.map +0 -1
  30. package/lib/cjs/access-control.js +0 -56
  31. package/lib/cjs/access-control.js.map +0 -1
  32. package/lib/cjs/analytics.js +0 -3
  33. package/lib/cjs/analytics.js.map +0 -1
  34. package/lib/cjs/apikey.js +0 -16
  35. package/lib/cjs/apikey.js.map +0 -1
  36. package/lib/cjs/apps.js +0 -3
  37. package/lib/cjs/apps.js.map +0 -1
  38. package/lib/cjs/common.js +0 -3
  39. package/lib/cjs/common.js.map +0 -1
  40. package/lib/cjs/environment.js +0 -44
  41. package/lib/cjs/environment.js.map +0 -1
  42. package/lib/cjs/facets.js +0 -3
  43. package/lib/cjs/facets.js.map +0 -1
  44. package/lib/cjs/group.js +0 -5
  45. package/lib/cjs/group.js.map +0 -1
  46. package/lib/cjs/index.js +0 -49
  47. package/lib/cjs/index.js.map +0 -1
  48. package/lib/cjs/integrations.js +0 -12
  49. package/lib/cjs/integrations.js.map +0 -1
  50. package/lib/cjs/interaction.js +0 -74
  51. package/lib/cjs/interaction.js.map +0 -1
  52. package/lib/cjs/json-schema.js +0 -3
  53. package/lib/cjs/json-schema.js.map +0 -1
  54. package/lib/cjs/json.js +0 -3
  55. package/lib/cjs/json.js.map +0 -1
  56. package/lib/cjs/meters.js +0 -13
  57. package/lib/cjs/meters.js.map +0 -1
  58. package/lib/cjs/model_utility.js +0 -6
  59. package/lib/cjs/model_utility.js.map +0 -1
  60. package/lib/cjs/package.json +0 -3
  61. package/lib/cjs/payload.js +0 -3
  62. package/lib/cjs/payload.js.map +0 -1
  63. package/lib/cjs/project.js +0 -107
  64. package/lib/cjs/project.js.map +0 -1
  65. package/lib/cjs/prompt.js +0 -20
  66. package/lib/cjs/prompt.js.map +0 -1
  67. package/lib/cjs/query.js +0 -3
  68. package/lib/cjs/query.js.map +0 -1
  69. package/lib/cjs/rate-limiter.js +0 -6
  70. package/lib/cjs/rate-limiter.js.map +0 -1
  71. package/lib/cjs/refs.js +0 -14
  72. package/lib/cjs/refs.js.map +0 -1
  73. package/lib/cjs/runs.js +0 -3
  74. package/lib/cjs/runs.js.map +0 -1
  75. package/lib/cjs/skill.js +0 -14
  76. package/lib/cjs/skill.js.map +0 -1
  77. package/lib/cjs/store/activity-catalog.js +0 -3
  78. package/lib/cjs/store/activity-catalog.js.map +0 -1
  79. package/lib/cjs/store/collections.js +0 -9
  80. package/lib/cjs/store/collections.js.map +0 -1
  81. package/lib/cjs/store/common.js +0 -3
  82. package/lib/cjs/store/common.js.map +0 -1
  83. package/lib/cjs/store/doc-analyzer.js +0 -3
  84. package/lib/cjs/store/doc-analyzer.js.map +0 -1
  85. package/lib/cjs/store/dsl-workflow.js +0 -5
  86. package/lib/cjs/store/dsl-workflow.js.map +0 -1
  87. package/lib/cjs/store/index.js +0 -28
  88. package/lib/cjs/store/index.js.map +0 -1
  89. package/lib/cjs/store/object-types.js +0 -98
  90. package/lib/cjs/store/object-types.js.map +0 -1
  91. package/lib/cjs/store/signals.js +0 -3
  92. package/lib/cjs/store/signals.js.map +0 -1
  93. package/lib/cjs/store/store.js +0 -55
  94. package/lib/cjs/store/store.js.map +0 -1
  95. package/lib/cjs/store/temporalio.js +0 -44
  96. package/lib/cjs/store/temporalio.js.map +0 -1
  97. package/lib/cjs/store/worker.js +0 -3
  98. package/lib/cjs/store/worker.js.map +0 -1
  99. package/lib/cjs/store/workflow.js +0 -49
  100. package/lib/cjs/store/workflow.js.map +0 -1
  101. package/lib/cjs/sts-token-types.js +0 -32
  102. package/lib/cjs/sts-token-types.js.map +0 -1
  103. package/lib/cjs/tenant.js +0 -3
  104. package/lib/cjs/tenant.js.map +0 -1
  105. package/lib/cjs/training.js +0 -14
  106. package/lib/cjs/training.js.map +0 -1
  107. package/lib/cjs/transient-tokens.js +0 -9
  108. package/lib/cjs/transient-tokens.js.map +0 -1
  109. package/lib/cjs/user.js +0 -25
  110. package/lib/cjs/user.js.map +0 -1
  111. package/lib/cjs/utils/auth.js +0 -15
  112. package/lib/cjs/utils/auth.js.map +0 -1
  113. package/lib/cjs/utils/schemas.js +0 -114
  114. package/lib/cjs/utils/schemas.js.map +0 -1
  115. package/lib/cjs/utils/type-helpers.js +0 -3
  116. package/lib/cjs/utils/type-helpers.js.map +0 -1
  117. package/lib/cjs/versions.js +0 -8
  118. package/lib/cjs/versions.js.map +0 -1
  119. package/lib/esm/Progress.js +0 -57
  120. package/lib/esm/Progress.js.map +0 -1
  121. package/lib/esm/access-control.js +0 -53
  122. package/lib/esm/access-control.js.map +0 -1
  123. package/lib/esm/analytics.js +0 -2
  124. package/lib/esm/analytics.js.map +0 -1
  125. package/lib/esm/apikey.js +0 -13
  126. package/lib/esm/apikey.js.map +0 -1
  127. package/lib/esm/apps.js +0 -2
  128. package/lib/esm/apps.js.map +0 -1
  129. package/lib/esm/common.js +0 -2
  130. package/lib/esm/common.js.map +0 -1
  131. package/lib/esm/environment.js +0 -41
  132. package/lib/esm/environment.js.map +0 -1
  133. package/lib/esm/facets.js +0 -2
  134. package/lib/esm/facets.js.map +0 -1
  135. package/lib/esm/group.js +0 -2
  136. package/lib/esm/group.js.map +0 -1
  137. package/lib/esm/index.js +0 -33
  138. package/lib/esm/index.js.map +0 -1
  139. package/lib/esm/integrations.js +0 -9
  140. package/lib/esm/integrations.js.map +0 -1
  141. package/lib/esm/interaction.js +0 -71
  142. package/lib/esm/interaction.js.map +0 -1
  143. package/lib/esm/json-schema.js +0 -2
  144. package/lib/esm/json-schema.js.map +0 -1
  145. package/lib/esm/json.js +0 -2
  146. package/lib/esm/json.js.map +0 -1
  147. package/lib/esm/meters.js +0 -10
  148. package/lib/esm/meters.js.map +0 -1
  149. package/lib/esm/model_utility.js +0 -2
  150. package/lib/esm/model_utility.js.map +0 -1
  151. package/lib/esm/payload.js +0 -2
  152. package/lib/esm/payload.js.map +0 -1
  153. package/lib/esm/project.js +0 -102
  154. package/lib/esm/project.js.map +0 -1
  155. package/lib/esm/prompt.js +0 -17
  156. package/lib/esm/prompt.js.map +0 -1
  157. package/lib/esm/query.js +0 -2
  158. package/lib/esm/query.js.map +0 -1
  159. package/lib/esm/rate-limiter.js +0 -5
  160. package/lib/esm/rate-limiter.js.map +0 -1
  161. package/lib/esm/refs.js +0 -11
  162. package/lib/esm/refs.js.map +0 -1
  163. package/lib/esm/runs.js +0 -2
  164. package/lib/esm/runs.js.map +0 -1
  165. package/lib/esm/skill.js +0 -13
  166. package/lib/esm/skill.js.map +0 -1
  167. package/lib/esm/store/activity-catalog.js +0 -2
  168. package/lib/esm/store/activity-catalog.js.map +0 -1
  169. package/lib/esm/store/collections.js +0 -6
  170. package/lib/esm/store/collections.js.map +0 -1
  171. package/lib/esm/store/common.js +0 -2
  172. package/lib/esm/store/common.js.map +0 -1
  173. package/lib/esm/store/doc-analyzer.js +0 -2
  174. package/lib/esm/store/doc-analyzer.js.map +0 -1
  175. package/lib/esm/store/dsl-workflow.js +0 -2
  176. package/lib/esm/store/dsl-workflow.js.map +0 -1
  177. package/lib/esm/store/index.js +0 -12
  178. package/lib/esm/store/index.js.map +0 -1
  179. package/lib/esm/store/object-types.js +0 -95
  180. package/lib/esm/store/object-types.js.map +0 -1
  181. package/lib/esm/store/signals.js +0 -2
  182. package/lib/esm/store/signals.js.map +0 -1
  183. package/lib/esm/store/store.js +0 -52
  184. package/lib/esm/store/store.js.map +0 -1
  185. package/lib/esm/store/temporalio.js +0 -41
  186. package/lib/esm/store/temporalio.js.map +0 -1
  187. package/lib/esm/store/worker.js +0 -2
  188. package/lib/esm/store/worker.js.map +0 -1
  189. package/lib/esm/store/workflow.js +0 -45
  190. package/lib/esm/store/workflow.js.map +0 -1
  191. package/lib/esm/sts-token-types.js +0 -24
  192. package/lib/esm/sts-token-types.js.map +0 -1
  193. package/lib/esm/tenant.js +0 -2
  194. package/lib/esm/tenant.js.map +0 -1
  195. package/lib/esm/training.js +0 -11
  196. package/lib/esm/training.js.map +0 -1
  197. package/lib/esm/transient-tokens.js +0 -6
  198. package/lib/esm/transient-tokens.js.map +0 -1
  199. package/lib/esm/user.js +0 -22
  200. package/lib/esm/user.js.map +0 -1
  201. package/lib/esm/utils/auth.js +0 -11
  202. package/lib/esm/utils/auth.js.map +0 -1
  203. package/lib/esm/utils/schemas.js +0 -107
  204. package/lib/esm/utils/schemas.js.map +0 -1
  205. package/lib/esm/utils/type-helpers.js +0 -2
  206. package/lib/esm/utils/type-helpers.js.map +0 -1
  207. package/lib/esm/versions.js +0 -5
  208. package/lib/esm/versions.js.map +0 -1
  209. package/lib/tsconfig.tsbuildinfo +0 -1
  210. package/lib/types/Progress.d.ts +0 -21
  211. package/lib/types/Progress.d.ts.map +0 -1
  212. package/lib/types/access-control.d.ts +0 -73
  213. package/lib/types/access-control.d.ts.map +0 -1
  214. package/lib/types/analytics.d.ts +0 -85
  215. package/lib/types/analytics.d.ts.map +0 -1
  216. package/lib/types/apikey.d.ts +0 -80
  217. package/lib/types/apikey.d.ts.map +0 -1
  218. package/lib/types/apps.d.ts +0 -102
  219. package/lib/types/apps.d.ts.map +0 -1
  220. package/lib/types/common.d.ts +0 -31
  221. package/lib/types/common.d.ts.map +0 -1
  222. package/lib/types/environment.d.ts +0 -106
  223. package/lib/types/environment.d.ts.map +0 -1
  224. package/lib/types/facets.d.ts +0 -34
  225. package/lib/types/facets.d.ts.map +0 -1
  226. package/lib/types/group.d.ts +0 -21
  227. package/lib/types/group.d.ts.map +0 -1
  228. package/lib/types/index.d.ts +0 -33
  229. package/lib/types/index.d.ts.map +0 -1
  230. package/lib/types/integrations.d.ts +0 -28
  231. package/lib/types/integrations.d.ts.map +0 -1
  232. package/lib/types/interaction.d.ts +0 -727
  233. package/lib/types/interaction.d.ts.map +0 -1
  234. package/lib/types/json-schema.d.ts +0 -1
  235. package/lib/types/json-schema.d.ts.map +0 -1
  236. package/lib/types/json.d.ts +0 -1
  237. package/lib/types/json.d.ts.map +0 -1
  238. package/lib/types/meters.d.ts +0 -23
  239. package/lib/types/meters.d.ts.map +0 -1
  240. package/lib/types/model_utility.d.ts +0 -1
  241. package/lib/types/model_utility.d.ts.map +0 -1
  242. package/lib/types/payload.d.ts +0 -60
  243. package/lib/types/payload.d.ts.map +0 -1
  244. package/lib/types/project.d.ts +0 -173
  245. package/lib/types/project.d.ts.map +0 -1
  246. package/lib/types/prompt.d.ts +0 -77
  247. package/lib/types/prompt.d.ts.map +0 -1
  248. package/lib/types/query.d.ts +0 -118
  249. package/lib/types/query.d.ts.map +0 -1
  250. package/lib/types/rate-limiter.d.ts +0 -28
  251. package/lib/types/rate-limiter.d.ts.map +0 -1
  252. package/lib/types/refs.d.ts +0 -22
  253. package/lib/types/refs.d.ts.map +0 -1
  254. package/lib/types/runs.d.ts +0 -32
  255. package/lib/types/runs.d.ts.map +0 -1
  256. package/lib/types/skill.d.ts +0 -78
  257. package/lib/types/skill.d.ts.map +0 -1
  258. package/lib/types/store/activity-catalog.d.ts +0 -26
  259. package/lib/types/store/activity-catalog.d.ts.map +0 -1
  260. package/lib/types/store/collections.d.ts +0 -78
  261. package/lib/types/store/collections.d.ts.map +0 -1
  262. package/lib/types/store/common.d.ts +0 -22
  263. package/lib/types/store/common.d.ts.map +0 -1
  264. package/lib/types/store/doc-analyzer.d.ts +0 -140
  265. package/lib/types/store/doc-analyzer.d.ts.map +0 -1
  266. package/lib/types/store/dsl-workflow.d.ts +0 -238
  267. package/lib/types/store/dsl-workflow.d.ts.map +0 -1
  268. package/lib/types/store/index.d.ts +0 -11
  269. package/lib/types/store/index.d.ts.map +0 -1
  270. package/lib/types/store/object-types.d.ts +0 -23
  271. package/lib/types/store/object-types.d.ts.map +0 -1
  272. package/lib/types/store/signals.d.ts +0 -5
  273. package/lib/types/store/signals.d.ts.map +0 -1
  274. package/lib/types/store/store.d.ts +0 -358
  275. package/lib/types/store/store.d.ts.map +0 -1
  276. package/lib/types/store/temporalio.d.ts +0 -16
  277. package/lib/types/store/temporalio.d.ts.map +0 -1
  278. package/lib/types/store/worker.d.ts +0 -18
  279. package/lib/types/store/worker.d.ts.map +0 -1
  280. package/lib/types/store/workflow.d.ts +0 -439
  281. package/lib/types/store/workflow.d.ts.map +0 -1
  282. package/lib/types/sts-token-types.d.ts +0 -72
  283. package/lib/types/sts-token-types.d.ts.map +0 -1
  284. package/lib/types/tenant.d.ts +0 -10
  285. package/lib/types/tenant.d.ts.map +0 -1
  286. package/lib/types/training.d.ts +0 -38
  287. package/lib/types/training.d.ts.map +0 -1
  288. package/lib/types/transient-tokens.d.ts +0 -24
  289. package/lib/types/transient-tokens.d.ts.map +0 -1
  290. package/lib/types/user.d.ts +0 -116
  291. package/lib/types/user.d.ts.map +0 -1
  292. package/lib/types/utils/auth.d.ts +0 -3
  293. package/lib/types/utils/auth.d.ts.map +0 -1
  294. package/lib/types/utils/schemas.d.ts +0 -9
  295. package/lib/types/utils/schemas.d.ts.map +0 -1
  296. package/lib/types/utils/type-helpers.d.ts +0 -3
  297. package/lib/types/utils/type-helpers.d.ts.map +0 -1
  298. package/lib/types/versions.d.ts +0 -3
  299. package/lib/types/versions.d.ts.map +0 -1
  300. package/lib/vertesia-common.js +0 -2
  301. package/lib/vertesia-common.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/common",
3
- "version": "0.81.1",
3
+ "version": "1.0.0-dev.20260203.130115Z",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "types": "./lib/types/index.d.ts",
@@ -22,13 +22,13 @@
22
22
  "rollup": "^4.40.2",
23
23
  "rollup-plugin-terser": "^7.0.2",
24
24
  "ts-dual-module": "^0.6.3",
25
- "typescript": "^5.0.2",
26
- "vitest": "^3.0.9"
25
+ "typescript": "^5.9.3",
26
+ "vitest": "^4.0.16"
27
27
  },
28
28
  "dependencies": {
29
- "ajv": "^8.16.0",
29
+ "ajv": "^8.17.1",
30
30
  "json-schema": "^0.4.0",
31
- "@llumiverse/common": "0.24.0"
31
+ "@llumiverse/common": "1.0.0-dev.20260202.145450Z"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",
package/src/analytics.ts CHANGED
@@ -22,9 +22,12 @@ export interface RunAnalyticsQuery {
22
22
  /** The end date of the query in EPOCH format */
23
23
  to?: number;
24
24
 
25
- /** The time resolution of the analytics query */
25
+ /** The time resolution unit of the analytics query */
26
26
  resolution?: TimeResolution;
27
27
 
28
+ /** The step size for the resolution (e.g., 4 with resolution='hour' means 4-hour intervals). Defaults to 1. */
29
+ resolutionStep?: number;
30
+
28
31
  /** The field to sort by */
29
32
  virtual?: boolean;
30
33
 
@@ -33,7 +36,7 @@ export interface RunAnalyticsQuery {
33
36
 
34
37
  export type RunAnalyticsGroupBy = "interaction" | "modelId" | "project" | "status" | "tags" | "environment";
35
38
 
36
- export type TimeResolution = "hour" | "day" | "week" | "month" | "year";
39
+ export type TimeResolution = "minute" | "hour" | "day" | "week" | "month" | "year";
37
40
 
38
41
 
39
42
  export interface RunAnalyticsResult {
package/src/apikey.ts CHANGED
@@ -70,13 +70,14 @@ export interface AuthTokenPayload {
70
70
  /**
71
71
  * API endpoints information to be used with this token.
72
72
  * Either a n API domain like 'api.vertesia.io' | 'api-preview.vertesia.io' | 'api-staging.vertesia.io' | 'local'
73
- * or explicit studio and store URLs.
73
+ * or explicit studio, store, and token URLs.
74
74
  */
75
75
  endpoints?:
76
76
  | string
77
77
  | {
78
78
  studio: string;
79
79
  store: string;
80
+ token?: string;
80
81
  };
81
82
 
82
83
  iss: string; //issuer
@@ -86,6 +87,24 @@ export interface AuthTokenPayload {
86
87
 
87
88
  permissions?: string[]; //permissions
88
89
  scopes?: string[]; //scopes
90
+
91
+ /**
92
+ * Service caller information for agent and service account tokens.
93
+ * Contains audit information about who/what initiated the token request.
94
+ * For agent tokens, includes `onBehalfOf` with the original user's token payload.
95
+ */
96
+ service_caller?: {
97
+ /** The principal that requested the token (e.g., service account identity) */
98
+ id?: string;
99
+ name?: string;
100
+ email?: string;
101
+ /**
102
+ * For agent tokens: the verified token payload of the user/apikey the agent acts on behalf of.
103
+ * Contains the original user's name, email, picture, user_id, etc.
104
+ */
105
+ onBehalfOf?: AuthTokenPayload;
106
+ [key: string]: unknown;
107
+ };
89
108
  }
90
109
 
91
110
  export enum PrincipalType {
package/src/apps.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { JSONSchema } from "@llumiverse/common";
1
+ import { JSONSchema, ToolDefinition } from "@llumiverse/common";
2
+ import { CatalogInteractionRef } from "./interaction.js";
3
+ import { InCodeTypeDefinition } from "./store/index.js";
2
4
 
3
5
  export interface AppUIConfig {
4
6
  /**
@@ -8,13 +10,155 @@ export interface AppUIConfig {
8
10
  */
9
11
  src: string;
10
12
  /**
11
- * The isolation strategy. If not specified it defaults to shadow
13
+ * The isolation strategy. If not specified it defaults to shadow
12
14
  * - shadow - use Shadow DOM to fully isolate the plugin from the host.
13
15
  * - css - use CSS processing (like prefixing or other isolation techniques). Ligther but plugins may conflict with the host
14
16
  */
15
17
  isolation?: "shadow" | "css";
16
18
  }
17
19
 
20
+ /**
21
+ * Authentication type for tool collections
22
+ */
23
+ export type ToolCollectionAuthType = "oauth" | "other";
24
+
25
+ /**
26
+ * Tool collection type
27
+ */
28
+ export type ToolCollectionType = "mcp" | "vertesia_sdk";
29
+
30
+ /**
31
+ * Base tool collection configuration
32
+ */
33
+ interface BaseToolCollectionObject {
34
+ /**
35
+ * The URL endpoint for the tool collection
36
+ */
37
+ url: string;
38
+
39
+ /**
40
+ * Optional authentication type required for this tool collection
41
+ */
42
+ auth?: ToolCollectionAuthType;
43
+ }
44
+
45
+ /**
46
+ * MCP tool collection configuration (requires name, description, and namespace)
47
+ */
48
+ export interface MCPToolCollectionObject extends BaseToolCollectionObject {
49
+ type: "mcp";
50
+
51
+ /**
52
+ * Name for the tool collection.
53
+ * Used as an identifier for the collection (e.g., for OAuth authentication).
54
+ */
55
+ name: string;
56
+
57
+ /**
58
+ * Description for the tool collection.
59
+ * Helps users understand what tools this collection provides.
60
+ */
61
+ description: string;
62
+
63
+ /**
64
+ * Prefix to use for tool names from this collection.
65
+ * Provides clean, readable tool names (e.g., "jira" instead of "https://mcp.atlassian.com/v1/mcp")
66
+ */
67
+ namespace: string;
68
+ }
69
+
70
+ /**
71
+ * Vertesia SDK tool collection configuration
72
+ */
73
+ export interface VertesiaSDKToolCollectionObject extends BaseToolCollectionObject {
74
+ type: "vertesia_sdk";
75
+
76
+ /**
77
+ * Optional namespace to use for tool names from this collection.
78
+ * If not provided, the tool server default will be used.
79
+ */
80
+ namespace?: string;
81
+
82
+ /**
83
+ * Optional name for the tool collection.
84
+ * If not provided, the tool server default will be used.
85
+ */
86
+ name?: string;
87
+
88
+ /**
89
+ * Optional description for the tool collection.
90
+ * If not provided, the tool server default will be used.
91
+ */
92
+ description?: string;
93
+ }
94
+
95
+ /**
96
+ * Tool collection configuration (object format)
97
+ */
98
+ export type ToolCollectionObject = MCPToolCollectionObject | VertesiaSDKToolCollectionObject;
99
+
100
+ /**
101
+ * Tool collection can be either:
102
+ * - A string URL (legacy format, with "mcp:" prefix for MCP servers)
103
+ * - An object with url, type, and optional auth (new format)
104
+ */
105
+ export type ToolCollection = string | ToolCollectionObject;
106
+
107
+ /**
108
+ * Normalizes a tool collection to the object format.
109
+ * Handles backward compatibility with string URLs.
110
+ *
111
+ * @param collection - String URL or ToolCollectionObject
112
+ * @returns Normalized ToolCollectionObject
113
+ */
114
+ export function normalizeToolCollection(collection: ToolCollection): ToolCollectionObject {
115
+ if (typeof collection === 'string') {
116
+ // Legacy string format
117
+ if (collection.startsWith('mcp:')) {
118
+ const url = collection.substring('mcp:'.length);
119
+ // For legacy MCP strings, derive name and prefix from URL
120
+ const urlObj = new URL(url);
121
+ const name = urlObj.hostname.replace(/\./g, '-');
122
+ return {
123
+ url,
124
+ type: 'mcp',
125
+ name,
126
+ description: `MCP server at ${url}`,
127
+ namespace: name
128
+ };
129
+ }
130
+ return {
131
+ url: collection,
132
+ type: 'vertesia_sdk'
133
+ };
134
+ }
135
+ // Already in object format
136
+ return collection;
137
+ }
138
+
139
+
140
+ /**
141
+ * Tool definition with optional activation control for agent exposure.
142
+ */
143
+ export interface AgentToolDefinition extends ToolDefinition {
144
+ /**
145
+ * The tool category if any - for UI purposes.
146
+ */
147
+ category?: string;
148
+ /**
149
+ * Whether this tool is available by default.
150
+ * - true/undefined: Tool is always available to agents
151
+ * - false: Tool is only available when activated by a skill's related_tools
152
+ */
153
+ default?: boolean;
154
+ /**
155
+ * For skill tools (learn_*): list of related tool names that become available
156
+ * when this skill is called. Used for dynamic tool discovery.
157
+ */
158
+ related_tools?: string[];
159
+ }
160
+
161
+ export type AppCapabilities = 'ui' | 'tools' | 'interactions' | 'types';
18
162
  export interface AppManifestData {
19
163
  /**
20
164
  * The name of the app, used as the id in the system.
@@ -47,28 +191,89 @@ export interface AppManifestData {
47
191
 
48
192
  status: "beta" | "stable" | "deprecated"
49
193
 
194
+ /**
195
+ * The UI configuration of the app. If not specified and the app "ui" is in the app capabilities
196
+ * then the ui configuration will be fetched from the endpoint property.
197
+ */
50
198
  ui?: AppUIConfig
51
199
 
52
200
  /**
53
201
  * A list of tool collections endpoints to be used by this app.
54
202
  * A tools collection endpoint is an URL which may end with a `?import` query string.
55
203
  * If the `?import` query string is used the tool will be imported as a javascript module and not executed through a POST on the collections endpoint.
204
+ * This feature is for advanced composition of tools. Prefer using endpoint.
56
205
  */
57
- tool_collections?: string[]
206
+ tool_collections?: ToolCollection[]
58
207
 
59
208
  /**
60
209
  * An URL providing interactions definitions in JSON format.
61
210
  * The URL must provide 2 endpoints:
62
211
  * 1. GET URL - must return a JSON array with the list of interactions (as AppInteractionRef[])
63
212
  * 2. GET URL/{interaction_name} - must return the full interaction definition for the specified interaction.
213
+ * This feature is for advanced composition of interactions. Prefer using endpoint.
64
214
  */
65
215
  interactions?: string;
66
216
 
67
217
  /**
68
218
  * A JSON chema for the app installation settings.
219
+ * @deprecated Use endpoint to provide settings_schema instead
69
220
  */
70
221
  settings_schema?: JSONSchema;
222
+
223
+ /** The following API is part of the second version of the manifest and deprectaes similar properties included directly in the manifest */
224
+
225
+ /**
226
+ * Describe the capabiltities of this app - which kind of contributions it provides.
227
+ */
228
+ capabilities?: AppCapabilities[];
229
+
230
+ /**
231
+ * The app endpoint URL
232
+ * This URL should return a JSON object describing the contributions provided by the app.
233
+ * The object shape must satisfies AppPackage interface.
234
+ * The endpoint must support GET method and a `scope` parameter to filter which resources are included in the returned AppPackage:
235
+ * The supported scope values are:
236
+ * - ui
237
+ * - tools
238
+ * - interactions
239
+ * - types
240
+ * - settings
241
+ * - all (the default if no scope is provided)
242
+ * You can also use comma-separated values to combine scopes (e.g. "ui,tools").
243
+ *
244
+ * Example:
245
+ * - ?scope=ui,tools - returns only the UI configuration
246
+ */
247
+ endpoint?: string;
71
248
  }
249
+ export type AppPackageScope = 'ui' | 'tools' | 'interactions' | 'types' | 'settings' | 'all';
250
+ export interface AppPackage {
251
+ /**
252
+ * The UI configuration of the app
253
+ */
254
+ ui?: AppUIConfig
255
+
256
+ /**
257
+ * A list of tools exposed by the app.
258
+ */
259
+ tools?: AgentToolDefinition[]
260
+
261
+ /**
262
+ * A list of interactions exposed by the app
263
+ */
264
+ interactions?: CatalogInteractionRef[];
265
+
266
+ /**
267
+ * A list of types.
268
+ */
269
+ types?: InCodeTypeDefinition[];
270
+
271
+ /**
272
+ * A JSON chema for the app installation settings.
273
+ */
274
+ settings_schema?: JSONSchema;
275
+ }
276
+
72
277
  export interface AppManifest extends AppManifestData {
73
278
  id: string;
74
279
  account: string;
@@ -97,7 +302,7 @@ export interface AppInstallationPayload {
97
302
  export type AppInstallationKind = 'ui' | 'tools' | 'all';
98
303
 
99
304
  /**
100
- * A descriptiojn of the tools provided by an app
305
+ * A description of the tools provided by an app
101
306
  */
102
307
  export interface AppToolCollection {
103
308
  /**
@@ -115,3 +320,63 @@ export interface AppToolCollection {
115
320
  */
116
321
  tools: { name: string, description?: string }[]
117
322
  }
323
+
324
+ /**
325
+ * Information about a tool and its associated app installation.
326
+ * Used to look up which app provides a specific tool.
327
+ */
328
+ export interface ProjectToolInfo {
329
+ /**
330
+ * The tool name
331
+ */
332
+ tool_name: string;
333
+
334
+ /**
335
+ * Optional tool description
336
+ */
337
+ tool_description?: string;
338
+
339
+ /**
340
+ * The app name that provides this tool
341
+ */
342
+ app_name: string;
343
+
344
+ /**
345
+ * The app installation ID
346
+ */
347
+ app_install_id: string;
348
+
349
+ /**
350
+ * The app installation settings.
351
+ * Only included for agent tokens, not user tokens (security: may contain API keys).
352
+ */
353
+ settings?: Record<string, any>;
354
+ }
355
+
356
+ /**
357
+ * OAuth authentication status for an MCP tool collection
358
+ */
359
+ export interface OAuthAuthStatus {
360
+ collection_name: string;
361
+ authenticated: boolean;
362
+ mcp_server_url: string;
363
+ expires_at?: string;
364
+ scope?: string;
365
+ }
366
+
367
+ /**
368
+ * Response from OAuth authorization endpoint
369
+ */
370
+ export interface OAuthAuthorizeResponse {
371
+ authorization_url: string;
372
+ state: string;
373
+ }
374
+
375
+ /**
376
+ * Response from OAuth metadata endpoint
377
+ */
378
+ export interface OAuthMetadataResponse {
379
+ collection_name: string;
380
+ mcp_server_url: string;
381
+ metadata: any;
382
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Types for ask_user tool UX configuration.
3
+ * These types enable the model to transmit structured UX parameters
4
+ * that render as interactive widgets instead of plain text.
5
+ */
6
+
7
+ /** Option for user selection in ask_user widget */
8
+ export interface AskUserOption {
9
+ /** Unique identifier returned when this option is selected */
10
+ id: string;
11
+ /** Display text for the option */
12
+ label: string;
13
+ /** Optional tooltip/description shown on hover */
14
+ description?: string;
15
+ }
16
+
17
+ /** UX configuration for ask_user messages */
18
+ export interface AskUserUxConfig {
19
+ /** Predefined options for the user to select from */
20
+ options?: AskUserOption[];
21
+ /** Visual style variant */
22
+ variant?: 'default' | 'warning' | 'info' | 'success';
23
+ /** Allow selecting multiple options (renders checkboxes instead of buttons) */
24
+ multiSelect?: boolean;
25
+ /** Show text input for free-form response */
26
+ allowFreeResponse?: boolean;
27
+ /** Placeholder text for free-form input */
28
+ placeholder?: string;
29
+ }
30
+
31
+ /** Message details structure for REQUEST_INPUT messages with UX config */
32
+ export interface AskUserMessageDetails {
33
+ /** UX configuration for rendering the ask_user widget */
34
+ ux?: AskUserUxConfig;
35
+ }
@@ -0,0 +1,70 @@
1
+ import { EmailChannel, isEmailChannel, UserChannel } from "./interaction.js";
2
+
3
+ /**
4
+ * Find the email channel from a list of channels.
5
+ * @returns The email channel if found, undefined otherwise
6
+ */
7
+ export function findEmailChannel(channels?: UserChannel[]): EmailChannel | undefined {
8
+ return channels?.find(isEmailChannel);
9
+ }
10
+
11
+ /**
12
+ * Check if email channel is enabled in the channels list.
13
+ */
14
+ export function hasEmailChannel(channels?: UserChannel[]): boolean {
15
+ return !!findEmailChannel(channels);
16
+ }
17
+
18
+ /**
19
+ * Update the email channel in a channels array (immutable).
20
+ * Returns a new array with the updated channel.
21
+ * If no email channel exists and to_email is provided, creates one.
22
+ */
23
+ export function updateEmailChannel(
24
+ channels: UserChannel[] | undefined,
25
+ updates: Partial<Omit<EmailChannel, "type">>
26
+ ): UserChannel[] {
27
+ const existing = channels || [];
28
+ const emailIndex = existing.findIndex(isEmailChannel);
29
+
30
+ if (emailIndex === -1) {
31
+ // No email channel exists, create one if we have required fields
32
+ if (updates.to_email) {
33
+ return [...existing, { type: "email", ...updates } as EmailChannel];
34
+ }
35
+ return existing;
36
+ }
37
+
38
+ // Update existing email channel
39
+ const updated = [...existing];
40
+ updated[emailIndex] = {
41
+ ...updated[emailIndex],
42
+ ...updates,
43
+ type: "email",
44
+ } as EmailChannel;
45
+ return updated;
46
+ }
47
+
48
+ /**
49
+ * Update email threading info after sending or receiving an email.
50
+ * Adds the new messageId to references and updates in_reply_to.
51
+ */
52
+ export function updateEmailThreading(
53
+ channels: UserChannel[] | undefined,
54
+ messageId: string,
55
+ subject?: string
56
+ ): UserChannel[] {
57
+ const emailChannel = findEmailChannel(channels);
58
+ if (!emailChannel) return channels || [];
59
+
60
+ const newReferences = emailChannel.references ? [...emailChannel.references] : [];
61
+ if (!newReferences.includes(messageId)) {
62
+ newReferences.push(messageId);
63
+ }
64
+
65
+ return updateEmailChannel(channels, {
66
+ in_reply_to: messageId,
67
+ references: newReferences,
68
+ thread_subject: subject || emailChannel.thread_subject,
69
+ });
70
+ }