@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
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Agent Schedule Types
3
+ *
4
+ * Defines types for scheduling agents to run on a recurring basis using cron expressions.
5
+ * Schedules are stored in MongoDB with execution handled by Temporal.
6
+ */
7
+
8
+ /**
9
+ * Represents a scheduled agent execution configuration.
10
+ */
11
+ export interface AgentSchedule {
12
+ /** Unique identifier for the schedule */
13
+ id: string;
14
+
15
+ /** Human-readable name for the schedule */
16
+ name: string;
17
+
18
+ /** Optional description of what the schedule does */
19
+ description?: string;
20
+
21
+ /** Project ID this schedule belongs to */
22
+ project: string;
23
+
24
+ /** Account ID this schedule belongs to */
25
+ account: string;
26
+
27
+ /** Interaction ID or endpoint name to execute (e.g., "MyAgent" or ObjectId) */
28
+ interaction: string;
29
+
30
+ /** Cached interaction name for display purposes */
31
+ interaction_name?: string;
32
+
33
+ /**
34
+ * Cron expression defining when to run.
35
+ * Standard 5-field format: minute hour day-of-month month day-of-week
36
+ * Examples:
37
+ * - "0 0 * * MON" - Every Monday at midnight
38
+ * - "0 9 * * *" - Daily at 9am
39
+ * - "0 * * * *" - Every hour
40
+ */
41
+ cron_expression: string;
42
+
43
+ /** Timezone for the cron expression (defaults to "UTC") */
44
+ timezone?: string;
45
+
46
+ /** Variables to pass to the agent workflow */
47
+ vars?: Record<string, any>;
48
+
49
+ /** Optional task queue override for the workflow */
50
+ task_queue?: string;
51
+
52
+ /** Whether the schedule is enabled (can be paused/resumed) */
53
+ enabled: boolean;
54
+
55
+ /** Temporal schedule ID once created (format: schedule:{accountId}:{projectId}:{scheduleId}) */
56
+ temporal_schedule_id?: string;
57
+
58
+ /** User or service that created this schedule */
59
+ created_by: string;
60
+
61
+ /** User or service that last updated this schedule */
62
+ updated_by?: string;
63
+
64
+ /** Timestamp when the schedule was created */
65
+ created_at: Date;
66
+
67
+ /** Timestamp when the schedule was last updated */
68
+ updated_at: Date;
69
+
70
+ /** Timestamp of the last successful execution */
71
+ last_run_at?: Date;
72
+
73
+ /** Timestamp of the next scheduled execution */
74
+ next_run_at?: Date;
75
+
76
+ /** Total number of times this schedule has executed */
77
+ run_count?: number;
78
+ }
79
+
80
+ /**
81
+ * Payload for creating a new schedule.
82
+ */
83
+ export interface CreateSchedulePayload {
84
+ /** Human-readable name for the schedule */
85
+ name: string;
86
+
87
+ /** Optional description of what the schedule does */
88
+ description?: string;
89
+
90
+ /** Interaction ID or endpoint name to execute */
91
+ interaction: string;
92
+
93
+ /**
94
+ * Cron expression defining when to run.
95
+ * Standard 5-field format: minute hour day-of-month month day-of-week
96
+ */
97
+ cron_expression: string;
98
+
99
+ /** Timezone for the cron expression (defaults to "UTC") */
100
+ timezone?: string;
101
+
102
+ /** Variables to pass to the agent workflow */
103
+ vars?: Record<string, any>;
104
+
105
+ /** Optional task queue override */
106
+ task_queue?: string;
107
+
108
+ /** Whether the schedule should be enabled immediately (defaults to true) */
109
+ enabled?: boolean;
110
+ }
111
+
112
+ /**
113
+ * Payload for updating an existing schedule.
114
+ */
115
+ export interface UpdateSchedulePayload {
116
+ /** Updated name */
117
+ name?: string;
118
+
119
+ /** Updated description */
120
+ description?: string;
121
+
122
+ /** Updated cron expression */
123
+ cron_expression?: string;
124
+
125
+ /** Updated timezone */
126
+ timezone?: string;
127
+
128
+ /** Updated variables */
129
+ vars?: Record<string, any>;
130
+
131
+ /** Updated task queue */
132
+ task_queue?: string;
133
+
134
+ /** Enable or disable the schedule */
135
+ enabled?: boolean;
136
+ }
137
+
138
+ /**
139
+ * Summary information for listing schedules.
140
+ */
141
+ export interface ScheduleListItem {
142
+ id: string;
143
+ name: string;
144
+ description?: string;
145
+ interaction: string;
146
+ interaction_name?: string;
147
+ cron_expression: string;
148
+ timezone?: string;
149
+ enabled: boolean;
150
+ last_run_at?: Date;
151
+ next_run_at?: Date;
152
+ run_count?: number;
153
+ created_by: string;
154
+ updated_at: Date;
155
+ }
156
+
157
+ /**
158
+ * Information about a schedule's recent and upcoming runs.
159
+ */
160
+ export interface ScheduleRunInfo {
161
+ /** The schedule ID */
162
+ schedule_id: string;
163
+
164
+ /** Recent workflow executions from this schedule */
165
+ recent_runs: Array<{
166
+ workflow_id: string;
167
+ run_id: string;
168
+ started_at: Date;
169
+ status: string;
170
+ }>;
171
+
172
+ /** Upcoming scheduled execution times */
173
+ upcoming_runs: Date[];
174
+ }
175
+
176
+ /**
177
+ * Extended schedule information including Temporal execution details.
178
+ */
179
+ export interface AgentScheduleWithTemporalInfo extends AgentSchedule {
180
+ /** Information from Temporal about the schedule execution */
181
+ temporal_info?: {
182
+ /** Number of actions (workflow starts) executed */
183
+ num_actions_taken: number;
184
+
185
+ /** Number of actions missed due to catchup window */
186
+ num_actions_missed: number;
187
+
188
+ /** Number of actions skipped due to overlap policy */
189
+ num_actions_skipped: number;
190
+
191
+ /** Currently running workflows started by this schedule */
192
+ running_actions: Array<{
193
+ workflow_id: string;
194
+ run_id: string;
195
+ }>;
196
+
197
+ /** Recent actions taken by the schedule */
198
+ recent_actions: Array<{
199
+ scheduled_at: Date;
200
+ taken_at: Date;
201
+ workflow_id: string;
202
+ run_id: string;
203
+ }>;
204
+
205
+ /** Next scheduled action times */
206
+ next_action_times: Date[];
207
+
208
+ /** Whether the schedule is currently paused in Temporal */
209
+ paused: boolean;
210
+
211
+ /** Optional note about why the schedule is paused */
212
+ pause_note?: string;
213
+ };
214
+ }
215
+
216
+ /**
217
+ * Common cron expression presets for UI convenience.
218
+ */
219
+ export const CRON_PRESETS = {
220
+ EVERY_HOUR: '0 * * * *',
221
+ EVERY_DAY_MIDNIGHT: '0 0 * * *',
222
+ EVERY_DAY_9AM: '0 9 * * *',
223
+ EVERY_MONDAY_MIDNIGHT: '0 0 * * MON',
224
+ EVERY_WEEKDAY_9AM: '0 9 * * MON-FRI',
225
+ FIRST_OF_MONTH: '0 0 1 * *',
226
+ } as const;
227
+
228
+ /**
229
+ * Human-readable descriptions for cron presets.
230
+ */
231
+ export const CRON_PRESET_LABELS: Record<keyof typeof CRON_PRESETS, string> = {
232
+ EVERY_HOUR: 'Every hour',
233
+ EVERY_DAY_MIDNIGHT: 'Daily at midnight',
234
+ EVERY_DAY_9AM: 'Daily at 9:00 AM',
235
+ EVERY_MONDAY_MIDNIGHT: 'Every Monday at midnight',
236
+ EVERY_WEEKDAY_9AM: 'Weekdays at 9:00 AM',
237
+ FIRST_OF_MONTH: 'First day of month at midnight',
238
+ };
@@ -2,4 +2,24 @@ export interface UserInputSignal {
2
2
  message: string;
3
3
  metadata?: Record<string, any>;
4
4
  auth_token?: string;
5
+ /**
6
+ * Email attachments to be processed as store objects.
7
+ * These will be downloaded, uploaded to store, and processed for text extraction
8
+ * before the conversation continues.
9
+ */
10
+ attachments?: EmailAttachment[];
11
+ }
12
+
13
+ /**
14
+ * Email attachment metadata for processing in conversation workflows.
15
+ */
16
+ export interface EmailAttachment {
17
+ /** Original filename */
18
+ filename: string;
19
+ /** MIME content type */
20
+ content_type: string;
21
+ /** Size in bytes */
22
+ size: number;
23
+ /** Resend download URL (temporary, expires) */
24
+ download_url: string;
5
25
  }
@@ -8,6 +8,17 @@ export enum ContentObjectApiHeaders {
8
8
  PROCESSING_PRIORITY = 'x-processing-priority',
9
9
  CREATE_REVISION = 'x-create-revision',
10
10
  REVISION_LABEL = 'x-revision-label',
11
+ /** When set to 'true', prevents this update from triggering workflow rules */
12
+ SUPPRESS_WORKFLOWS = 'x-suppress-workflows',
13
+ }
14
+
15
+ /**
16
+ * Headers for Data Store API calls.
17
+ * Used for Cloud Run session affinity to route requests to the same instance.
18
+ */
19
+ export enum DataStoreApiHeaders {
20
+ /** Data store ID for session affinity - routes requests for same store to same instance */
21
+ DATA_STORE_ID = 'x-data-store-id',
11
22
  }
12
23
 
13
24
  export enum ContentObjectStatus {
@@ -342,6 +353,7 @@ export interface ContentObjectTypeItem extends BaseObject {
342
353
  */
343
354
  strict_mode?: boolean;
344
355
  }
356
+ export type InCodeTypeDefinition = Pick<ContentObjectTypeItem, 'name' | 'description' | 'tags' | 'object_schema' | 'table_layout' | 'is_chunkable' | 'strict_mode'>;
345
357
 
346
358
  export interface CreateContentObjectTypePayload
347
359
  extends Omit<
@@ -421,6 +433,118 @@ export interface GetRenditionResponse {
421
433
  workflow_run_id?: string;
422
434
  }
423
435
 
436
+ // ============================================================================
437
+ // Rendition Format Compatibility Utilities
438
+ // ============================================================================
439
+
440
+ export type RenditionFormat = ImageRenditionFormat | MarkdownRenditionFormat;
441
+
442
+ /**
443
+ * Matrix of supported content type → format conversions.
444
+ * This is the authoritative source of truth for what renditions can be generated.
445
+ *
446
+ * Key patterns:
447
+ * - Exact MIME types (e.g., 'application/pdf')
448
+ * - Wildcard patterns (e.g., 'image/*', 'video/*')
449
+ */
450
+ const RENDITION_COMPATIBILITY: Record<string, RenditionFormat[]> = {
451
+ // Image formats can generate: jpeg, png, webp
452
+ 'image/*': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png, ImageRenditionFormat.webp],
453
+ // Video formats can generate: jpeg, png (thumbnails)
454
+ 'video/*': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png],
455
+ // PDF can generate: jpeg, png, webp (page images)
456
+ 'application/pdf': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png, ImageRenditionFormat.webp],
457
+ // Markdown can generate: pdf, docx (NOT jpeg/png)
458
+ 'text/markdown': [MarkdownRenditionFormat.pdf, MarkdownRenditionFormat.docx],
459
+ // Plain text can generate: docx
460
+ 'text/plain': [MarkdownRenditionFormat.docx],
461
+ // Office documents can generate: pdf
462
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [MarkdownRenditionFormat.pdf],
463
+ 'application/msword': [MarkdownRenditionFormat.pdf],
464
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': [MarkdownRenditionFormat.pdf],
465
+ 'application/vnd.ms-powerpoint': [MarkdownRenditionFormat.pdf],
466
+ };
467
+
468
+ /**
469
+ * Check if a specific rendition format can be generated from a content type.
470
+ *
471
+ * @param contentType - The MIME type of the source content (e.g., 'image/png', 'text/markdown')
472
+ * @param format - The desired rendition format (e.g., ImageRenditionFormat.jpeg)
473
+ * @returns true if the format can be generated from the content type
474
+ *
475
+ * @example
476
+ * canGenerateRendition('image/png', ImageRenditionFormat.jpeg) // true
477
+ * canGenerateRendition('text/markdown', ImageRenditionFormat.jpeg) // false
478
+ * canGenerateRendition('text/markdown', MarkdownRenditionFormat.pdf) // true
479
+ */
480
+ export function canGenerateRendition(contentType: string | undefined, format: RenditionFormat | string): boolean {
481
+ if (!contentType) return false;
482
+
483
+ const formatStr = typeof format === 'string' ? format : format;
484
+
485
+ // Check exact match first
486
+ const exactMatch = RENDITION_COMPATIBILITY[contentType];
487
+ if (exactMatch && exactMatch.some(f => f === formatStr)) {
488
+ return true;
489
+ }
490
+
491
+ // Check wildcard patterns (e.g., 'image/*', 'video/*')
492
+ const [category] = contentType.split('/');
493
+ const wildcardKey = `${category}/*`;
494
+ const wildcardMatch = RENDITION_COMPATIBILITY[wildcardKey];
495
+ if (wildcardMatch && wildcardMatch.some(f => f === formatStr)) {
496
+ return true;
497
+ }
498
+
499
+ return false;
500
+ }
501
+
502
+ /**
503
+ * Get the list of rendition formats supported for a given content type.
504
+ *
505
+ * @param contentType - The MIME type of the source content
506
+ * @returns Array of supported rendition formats, or empty array if none
507
+ *
508
+ * @example
509
+ * getSupportedRenditionFormats('image/png') // [jpeg, png, webp]
510
+ * getSupportedRenditionFormats('text/markdown') // [pdf, docx]
511
+ * getSupportedRenditionFormats('text/html') // []
512
+ */
513
+ export function getSupportedRenditionFormats(contentType: string | undefined): RenditionFormat[] {
514
+ if (!contentType) return [];
515
+
516
+ // Check exact match first
517
+ if (RENDITION_COMPATIBILITY[contentType]) {
518
+ return [...RENDITION_COMPATIBILITY[contentType]];
519
+ }
520
+
521
+ // Check wildcard patterns
522
+ const [category] = contentType.split('/');
523
+ const wildcardKey = `${category}/*`;
524
+ const wildcardMatch = RENDITION_COMPATIBILITY[wildcardKey];
525
+ if (wildcardMatch) {
526
+ return [...wildcardMatch];
527
+ }
528
+
529
+ return [];
530
+ }
531
+
532
+ /**
533
+ * Check if a content type supports visual (image) renditions.
534
+ * This is useful for determining if a document can have thumbnails/previews.
535
+ *
536
+ * @param contentType - The MIME type of the source content
537
+ * @returns true if the content type can generate JPEG renditions
538
+ *
539
+ * @example
540
+ * supportsVisualRendition('image/png') // true
541
+ * supportsVisualRendition('application/pdf') // true
542
+ * supportsVisualRendition('text/markdown') // false
543
+ */
544
+ export function supportsVisualRendition(contentType: string | undefined): boolean {
545
+ return canGenerateRendition(contentType, ImageRenditionFormat.jpeg);
546
+ }
547
+
424
548
  export interface GetUploadUrlPayload {
425
549
  name: string;
426
550
  id?: string;