@vertesia/common 1.1.0-dev.20260327.125707Z → 1.1.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 (146) hide show
  1. package/lib/cjs/access-control.js +2 -0
  2. package/lib/cjs/access-control.js.map +1 -1
  3. package/lib/cjs/apikey.js.map +1 -1
  4. package/lib/cjs/apps.js +35 -0
  5. package/lib/cjs/apps.js.map +1 -1
  6. package/lib/cjs/audit-trail.js +7 -0
  7. package/lib/cjs/audit-trail.js.map +1 -1
  8. package/lib/cjs/cost-analytics.js +13 -0
  9. package/lib/cjs/cost-analytics.js.map +1 -0
  10. package/lib/cjs/group.js +2 -1
  11. package/lib/cjs/group.js.map +1 -1
  12. package/lib/cjs/index.js +3 -1
  13. package/lib/cjs/index.js.map +1 -1
  14. package/lib/cjs/integrations.js.map +1 -1
  15. package/lib/cjs/interaction.js +2 -0
  16. package/lib/cjs/interaction.js.map +1 -1
  17. package/lib/cjs/oauth-server.js +3 -0
  18. package/lib/cjs/oauth-server.js.map +1 -0
  19. package/lib/cjs/oauth.js +1 -1
  20. package/lib/cjs/project.js.map +1 -1
  21. package/lib/cjs/store/conversation-state.js.map +1 -1
  22. package/lib/cjs/store/rendering.js +4 -0
  23. package/lib/cjs/store/rendering.js.map +1 -1
  24. package/lib/cjs/store/schedule.js.map +1 -1
  25. package/lib/cjs/store/store.js +4 -1
  26. package/lib/cjs/store/store.js.map +1 -1
  27. package/lib/cjs/store/workflow.js.map +1 -1
  28. package/lib/cjs/user.js +1 -0
  29. package/lib/cjs/user.js.map +1 -1
  30. package/lib/esm/access-control.js +2 -0
  31. package/lib/esm/access-control.js.map +1 -1
  32. package/lib/esm/apikey.js.map +1 -1
  33. package/lib/esm/apps.js +30 -0
  34. package/lib/esm/apps.js.map +1 -1
  35. package/lib/esm/audit-trail.js +6 -1
  36. package/lib/esm/audit-trail.js.map +1 -1
  37. package/lib/esm/cost-analytics.js +10 -0
  38. package/lib/esm/cost-analytics.js.map +1 -0
  39. package/lib/esm/group.js +1 -0
  40. package/lib/esm/group.js.map +1 -1
  41. package/lib/esm/index.js +3 -1
  42. package/lib/esm/index.js.map +1 -1
  43. package/lib/esm/integrations.js.map +1 -1
  44. package/lib/esm/interaction.js +2 -0
  45. package/lib/esm/interaction.js.map +1 -1
  46. package/lib/esm/oauth-server.js +2 -0
  47. package/lib/esm/oauth-server.js.map +1 -0
  48. package/lib/esm/oauth.js +1 -1
  49. package/lib/esm/project.js.map +1 -1
  50. package/lib/esm/store/conversation-state.js.map +1 -1
  51. package/lib/esm/store/rendering.js +3 -0
  52. package/lib/esm/store/rendering.js.map +1 -1
  53. package/lib/esm/store/schedule.js.map +1 -1
  54. package/lib/esm/store/store.js +3 -0
  55. package/lib/esm/store/store.js.map +1 -1
  56. package/lib/esm/store/workflow.js.map +1 -1
  57. package/lib/esm/user.js +1 -0
  58. package/lib/esm/user.js.map +1 -1
  59. package/lib/tsconfig.tsbuildinfo +1 -1
  60. package/lib/types/access-control.d.ts +2 -0
  61. package/lib/types/access-control.d.ts.map +1 -1
  62. package/lib/types/analytics.d.ts +12 -6
  63. package/lib/types/analytics.d.ts.map +1 -1
  64. package/lib/types/apikey.d.ts +1 -0
  65. package/lib/types/apikey.d.ts.map +1 -1
  66. package/lib/types/apps.d.ts +351 -40
  67. package/lib/types/apps.d.ts.map +1 -1
  68. package/lib/types/ask-user.d.ts +0 -4
  69. package/lib/types/ask-user.d.ts.map +1 -1
  70. package/lib/types/audit-trail.d.ts +32 -5
  71. package/lib/types/audit-trail.d.ts.map +1 -1
  72. package/lib/types/cost-analytics.d.ts +160 -0
  73. package/lib/types/cost-analytics.d.ts.map +1 -0
  74. package/lib/types/group.d.ts +1 -0
  75. package/lib/types/group.d.ts.map +1 -1
  76. package/lib/types/index.d.ts +3 -1
  77. package/lib/types/index.d.ts.map +1 -1
  78. package/lib/types/integrations.d.ts +20 -6
  79. package/lib/types/integrations.d.ts.map +1 -1
  80. package/lib/types/interaction.d.ts +33 -4
  81. package/lib/types/interaction.d.ts.map +1 -1
  82. package/lib/types/oauth-server.d.ts +233 -0
  83. package/lib/types/oauth-server.d.ts.map +1 -0
  84. package/lib/types/oauth.d.ts +29 -18
  85. package/lib/types/oauth.d.ts.map +1 -1
  86. package/lib/types/project.d.ts +98 -19
  87. package/lib/types/project.d.ts.map +1 -1
  88. package/lib/types/query.d.ts +7 -0
  89. package/lib/types/query.d.ts.map +1 -1
  90. package/lib/types/refs.d.ts +4 -0
  91. package/lib/types/refs.d.ts.map +1 -1
  92. package/lib/types/runs.d.ts +14 -0
  93. package/lib/types/runs.d.ts.map +1 -1
  94. package/lib/types/store/agent-run.d.ts +160 -2
  95. package/lib/types/store/agent-run.d.ts.map +1 -1
  96. package/lib/types/store/conversation-state.d.ts +21 -2
  97. package/lib/types/store/conversation-state.d.ts.map +1 -1
  98. package/lib/types/store/doc-analyzer.d.ts +10 -0
  99. package/lib/types/store/doc-analyzer.d.ts.map +1 -1
  100. package/lib/types/store/rendering.d.ts +6 -0
  101. package/lib/types/store/rendering.d.ts.map +1 -1
  102. package/lib/types/store/schedule.d.ts +2 -5
  103. package/lib/types/store/schedule.d.ts.map +1 -1
  104. package/lib/types/store/store.d.ts +9 -0
  105. package/lib/types/store/store.d.ts.map +1 -1
  106. package/lib/types/store/workflow.d.ts +2 -2
  107. package/lib/types/store/workflow.d.ts.map +1 -1
  108. package/lib/types/tool-execution.d.ts +4 -0
  109. package/lib/types/tool-execution.d.ts.map +1 -1
  110. package/lib/types/transient-tokens.d.ts +1 -1
  111. package/lib/types/transient-tokens.d.ts.map +1 -1
  112. package/lib/types/user.d.ts +1 -0
  113. package/lib/types/user.d.ts.map +1 -1
  114. package/lib/types/workflow-analytics.d.ts +12 -0
  115. package/lib/types/workflow-analytics.d.ts.map +1 -1
  116. package/lib/vertesia-common.js +1 -1
  117. package/lib/vertesia-common.js.map +1 -1
  118. package/package.json +4 -4
  119. package/src/access-control.ts +2 -0
  120. package/src/analytics.ts +13 -6
  121. package/src/apikey.ts +1 -0
  122. package/src/apps.ts +401 -40
  123. package/src/ask-user.ts +0 -4
  124. package/src/audit-trail.ts +44 -5
  125. package/src/cost-analytics.ts +171 -0
  126. package/src/group.ts +3 -1
  127. package/src/index.ts +3 -2
  128. package/src/integrations.ts +21 -7
  129. package/src/interaction.ts +37 -3
  130. package/src/oauth-server.ts +258 -0
  131. package/src/oauth.ts +30 -18
  132. package/src/project.ts +105 -21
  133. package/src/query.ts +7 -0
  134. package/src/refs.ts +4 -0
  135. package/src/runs.ts +15 -0
  136. package/src/store/agent-run.ts +186 -2
  137. package/src/store/conversation-state.ts +24 -2
  138. package/src/store/doc-analyzer.ts +12 -0
  139. package/src/store/rendering.ts +10 -0
  140. package/src/store/schedule.ts +2 -6
  141. package/src/store/store.ts +11 -0
  142. package/src/store/workflow.ts +3 -2
  143. package/src/tool-execution.ts +4 -0
  144. package/src/transient-tokens.ts +1 -1
  145. package/src/user.ts +1 -0
  146. package/src/workflow-analytics.ts +12 -0
@@ -12,16 +12,29 @@
12
12
  * (workflowId, runId) are internal server concerns.
13
13
  */
14
14
 
15
- import { AgentSearchScope, ConversationVisibility, InteractionExecutionConfiguration, RunSource } from "../interaction.js";
15
+ import { AgentSearchScope, ConversationVisibility, InteractionExecutionConfiguration, InteractionRef, RunSource } from "../interaction.js";
16
16
  import { UserChannel } from "../email.js";
17
+ import { AgentEvent } from "../workflow-analytics.js";
18
+ import { UserInputSignal } from "./signals.js";
17
19
  import { ContentObjectTypeRef } from "./store.js";
18
- import { ConversationActivityState } from "./workflow.js";
20
+ import { AgentMessage, CompactMessage, ConversationActivityState, ConversationFileRef, WorkflowRunEvent } from "./workflow.js";
19
21
 
20
22
  /**
21
23
  * Status of an agent run through its lifecycle.
22
24
  */
23
25
  export type AgentRunStatus = 'created' | 'running' | 'completed' | 'failed' | 'cancelled';
24
26
 
27
+ /**
28
+ * Archive lifecycle state for an agent run.
29
+ *
30
+ * - `none`: No archive exists (default)
31
+ * - `pending`: Terminal status recorded; archive workflow triggered
32
+ * - `archiving`: Archive workflow is running
33
+ * - `complete`: Archive stored in GCS successfully
34
+ * - `failed`: Archive attempt failed (see `last_archive_error`)
35
+ */
36
+ export type AgentRunArchiveState = 'none' | 'pending' | 'archiving' | 'complete' | 'failed';
37
+
25
38
  /**
26
39
  * How the agent run was created.
27
40
  */
@@ -109,6 +122,8 @@ export interface AgentRun<TData = Record<string, any>, TProperties = Record<stri
109
122
  /** Human-readable interaction name */
110
123
  interaction_name?: string;
111
124
 
125
+ interactionRef: InteractionRef;
126
+
112
127
  // --- Lifecycle ---
113
128
 
114
129
  /** Current status of the agent run */
@@ -137,6 +152,25 @@ export interface AgentRun<TData = Record<string, any>, TProperties = Record<stri
137
152
  /** Lessons learned from the conversation (extracted at completion) */
138
153
  lessons_learned?: string[];
139
154
 
155
+ // --- Archival ---
156
+
157
+ /** Archive lifecycle state */
158
+ archive_state?: AgentRunArchiveState;
159
+
160
+ /** When the last successful archive completed */
161
+ archived_at?: Date;
162
+
163
+ /** Archive format version (for forward compatibility) */
164
+ archive_version?: number;
165
+
166
+ /** Last archive error message (when archive_state === 'failed') */
167
+ last_archive_error?: string;
168
+
169
+ /** Source agent run ID when this run was forked (enables message history chaining) */
170
+ forked_from?: string;
171
+
172
+ // --- Timestamps ---
173
+
140
174
  /** Timestamp when the document was created */
141
175
  created_at: Date;
142
176
 
@@ -168,8 +202,143 @@ export interface CreateAgentRunPayload<TData = Record<string, any>, TProperties
168
202
 
169
203
  /** Enable debug mode for verbose logging */
170
204
  debug_mode?: boolean;
205
+
206
+ /** Principal ref of the user who initiated the run (for server-to-server forwarding) */
207
+ started_by?: string;
208
+ }
209
+
210
+ /**
211
+ * Payload to record an AgentRun for an already-running workflow.
212
+ *
213
+ * Used by server-side callers that have already started a Temporal workflow
214
+ * and need to create the stable AgentRun MongoDB document against it.
215
+ *
216
+ * @typeParam TData - The interaction's expected input data type.
217
+ */
218
+ export interface RecordAgentRunPayload<TData = CreateAgentRunPayload["data"]> extends Pick<AgentRunBase<TData>, "interaction" | "data" | "schedule_id" | "visibility" | "type"> {
219
+ /** Temporal workflow ID (stable across continueAsNew) */
220
+ workflow_id: string;
221
+
222
+ /** First Temporal workflow run ID (stable stream/artifact identity) */
223
+ first_workflow_run_id: string;
224
+ }
225
+
226
+ /**
227
+ * Response from terminating an agent run.
228
+ */
229
+ export interface TerminateAgentRunResponse {
230
+ message: string;
231
+ reason?: string;
232
+ }
233
+
234
+ /**
235
+ * Payload for updating an AgentRun's lifecycle and derived metadata.
236
+ */
237
+ export interface UpdateAgentRunStatusPayload {
238
+ status?: AgentRunStatus;
239
+ activity_state?: ConversationActivityState;
240
+ title?: string;
241
+ topic?: string;
242
+ lessons_learned?: string[];
243
+ /** ES-only: conversation content text (not stored in MongoDB) */
244
+ content?: string;
245
+ /** Archive state fields (set by the archive workflow) */
246
+ archive_state?: AgentRunArchiveState;
247
+ archived_at?: string;
248
+ archive_version?: number;
249
+ last_archive_error?: string;
250
+ }
251
+
252
+ /**
253
+ * Generic signal payload sent to a running agent workflow.
254
+ */
255
+ export type SignalAgentPayload =
256
+ | UserInputSignal
257
+ | ConversationFileRef
258
+ | Record<string, unknown>;
259
+
260
+ /**
261
+ * Response from signaling an agent workflow.
262
+ */
263
+ export interface SignalAgentResponse {
264
+ status: string;
265
+ message: string;
171
266
  }
172
267
 
268
+ /**
269
+ * Response payload for retrieving compact agent updates.
270
+ */
271
+ export interface AgentRunUpdatesResponse {
272
+ messages: CompactMessage[];
273
+ }
274
+
275
+ /**
276
+ * Payload for posting an update into an agent's workflow stream.
277
+ */
278
+ export type PostAgentRunUpdatePayload = Partial<AgentMessage>;
279
+
280
+ /**
281
+ * Response from posting an agent update.
282
+ */
283
+ export interface PostAgentRunUpdateResponse {
284
+ success: boolean;
285
+ }
286
+
287
+ /**
288
+ * Signed artifact URL response for agent artifacts.
289
+ */
290
+ export interface AgentArtifactUrlResponse {
291
+ url: string;
292
+ path: string;
293
+ }
294
+
295
+ /**
296
+ * Telemetry ingestion payload for an agent run.
297
+ */
298
+ export interface IngestAgentEventsPayload {
299
+ events: AgentEvent[];
300
+ }
301
+
302
+ /**
303
+ * Telemetry ingestion response for an agent run.
304
+ */
305
+ export interface IngestAgentEventsResponse {
306
+ ingested: number;
307
+ status?: string;
308
+ error?: string;
309
+ }
310
+
311
+ /**
312
+ * History event payload emitted by the agent details SSE stream.
313
+ */
314
+ export interface AgentRunDetailsHistoryStreamEvent {
315
+ runId?: string;
316
+ event: WorkflowRunEvent;
317
+ }
318
+
319
+ /**
320
+ * Control payload emitted by the agent details SSE stream.
321
+ */
322
+ export type AgentRunDetailsControlStreamEvent =
323
+ | { type: 'continueAsNew'; newRunId: string }
324
+ | { type: 'done' };
325
+
326
+ /**
327
+ * Error payload emitted by the agent details SSE stream.
328
+ */
329
+ export interface AgentRunDetailsErrorStreamEvent {
330
+ type: 'error';
331
+ message: string;
332
+ }
333
+
334
+ /**
335
+ * Typed SSE event envelope for the agent details stream.
336
+ */
337
+ export type AgentRunDetailsStreamEvent =
338
+ | { type: 'history'; data: AgentRunDetailsHistoryStreamEvent }
339
+ | { type: 'control'; data: AgentRunDetailsControlStreamEvent }
340
+ | { type: 'error'; data: AgentRunDetailsErrorStreamEvent };
341
+
173
342
  /**
174
343
  * Filters for listing agent runs.
175
344
  */
@@ -189,12 +358,18 @@ export interface ListAgentRunsQuery {
189
358
  /** Only return runs started after this date */
190
359
  since?: Date;
191
360
 
361
+ /** Only return runs started at or before this date */
362
+ until?: Date;
363
+
192
364
  /** Maximum number of results (default: 50) */
193
365
  limit?: number;
194
366
 
195
367
  /** Offset for pagination */
196
368
  offset?: number;
197
369
 
370
+ /** Cursor for stable pagination */
371
+ cursor?: string;
372
+
198
373
  /** Filter by schedule ID */
199
374
  schedule_id?: string;
200
375
 
@@ -208,6 +383,12 @@ export interface ListAgentRunsQuery {
208
383
  order?: 'asc' | 'desc';
209
384
  }
210
385
 
386
+ export interface ListAgentRunsResponse {
387
+ items: AgentRun[];
388
+ total_count: number;
389
+ next_cursor: string | null;
390
+ }
391
+
211
392
  /**
212
393
  * Query for searching agent runs via Elasticsearch.
213
394
  */
@@ -236,6 +417,9 @@ export interface SearchAgentRunsQuery {
236
417
  /** Only return runs started after this date */
237
418
  since?: Date;
238
419
 
420
+ /** Only return runs started at or before this date */
421
+ until?: Date;
422
+
239
423
  /** Maximum number of results (default: 50) */
240
424
  limit?: number;
241
425
 
@@ -78,6 +78,15 @@ export interface ConversationState {
78
78
  /** Names of currently active tools (base + unlocked). Tool definitions loaded from tool_reference. */
79
79
  active_tool_names?: string[];
80
80
 
81
+ /** Active tools that should not be evicted by bounded active-tool pruning. */
82
+ pinned_tool_names?: string[];
83
+
84
+ /**
85
+ * Activation and usage metadata for tools seen during the conversation.
86
+ * Used to keep the active tool set bounded without losing recovery context.
87
+ */
88
+ tool_activation_metadata?: Record<string, ToolActivationMetadata>;
89
+
81
90
  /** Skills that have been used in this conversation (for auto-syncing scripts and package installation) */
82
91
  used_skills?: UsedSkill[];
83
92
 
@@ -156,8 +165,8 @@ export interface ConversationState {
156
165
  export interface AvailableSkill {
157
166
  /** Skill name (e.g., "analyze_data") - without the "learn_" prefix */
158
167
  name: string;
159
- /** Source URL of the skill collection (e.g., "https://tools.vertesia.io/api/skills/data-analysis") */
160
- src: string;
168
+ /** Source URL of the skill collection (e.g., "https://tools.vertesia.io/api/skills/data-analysis"). Undefined for interaction-based skills. */
169
+ src?: string;
161
170
  }
162
171
 
163
172
  /**
@@ -192,3 +201,16 @@ export interface UsedSkill {
192
201
  /** System-level packages to install via sudo apt-get (e.g., ["poppler-utils"]) */
193
202
  system_packages?: string[];
194
203
  }
204
+
205
+ export interface ToolActivationMetadata {
206
+ /** Turn when the tool became active in this conversation. */
207
+ activated_at_iteration: number;
208
+ /** Most recent turn where the tool was actually executed. */
209
+ last_used_iteration?: number;
210
+ /** Number of successful executions in this conversation. */
211
+ use_count: number;
212
+ /** Activation source, e.g. "base", "discover_tools", "skill:presentation_authoring". */
213
+ source: string;
214
+ /** Whether this tool is pinned and should be preserved during eviction. */
215
+ pinned?: boolean;
216
+ }
@@ -10,6 +10,18 @@ export interface PdfToRichTextWorkflowPayload extends Omit<WorkflowExecutionPayl
10
10
  vars: PdfToRichtextOptions;
11
11
  }
12
12
 
13
+ export interface TransformTablesWorkflowPayload extends Omit<WorkflowExecutionPayload, "vars"> {
14
+ vars: AdaptTablesParams;
15
+ environment?: string;
16
+ }
17
+
18
+ export interface TransformTablesWorkflowResult {
19
+ result_path: string;
20
+ status: string;
21
+ table_count: number;
22
+ item_count: number;
23
+ }
24
+
13
25
  /**
14
26
  * Represents a image in a document that has been analyzed
15
27
  */
@@ -25,6 +25,16 @@ export interface ImageRenditionVars extends BaseRenditionVars {
25
25
  max_pages?: number;
26
26
  }
27
27
 
28
+ export interface ImageRenditionParams {
29
+ max_hw: number;
30
+ format: ImageRenditionFormat;
31
+ outputPath?: string;
32
+ }
33
+
34
+ export function getRenditionsPath(contentEtag: string, params: ImageRenditionParams) {
35
+ return `renditions/${contentEtag}/${params.max_hw}`;
36
+ }
37
+
28
38
  /** Metadata for PDF rendering (displayed in header/footer) */
29
39
  export interface PdfRenderingMetadata {
30
40
  /** Document ID to display in footer */
@@ -67,14 +67,11 @@ export interface AgentSchedule {
67
67
  /** Timestamp when the schedule was last updated */
68
68
  updated_at: Date;
69
69
 
70
- /** Timestamp of the last successful execution */
70
+ /** Timestamp of the last action taken by the Temporal schedule. Sourced from Temporal, not persisted in Mongo. */
71
71
  last_run_at?: Date;
72
72
 
73
- /** Timestamp of the next scheduled execution */
73
+ /** Timestamp of the next scheduled execution. Sourced from Temporal, not persisted in Mongo. */
74
74
  next_run_at?: Date;
75
-
76
- /** Total number of times this schedule has executed */
77
- run_count?: number;
78
75
  }
79
76
 
80
77
  /**
@@ -152,7 +149,6 @@ export interface ScheduleListItem {
152
149
  enabled: boolean;
153
150
  last_run_at?: Date;
154
151
  next_run_at?: Date;
155
- run_count?: number;
156
152
  created_by: string;
157
153
  updated_at: Date;
158
154
  }
@@ -178,6 +178,17 @@ export interface Transcript {
178
178
  etag?: string;
179
179
  }
180
180
 
181
+ export const TextExtractionStatus = {
182
+ success: "success",
183
+ } as const;
184
+
185
+ export interface TranscriptMediaResult {
186
+ hasText: boolean;
187
+ status: typeof TextExtractionStatus.success;
188
+ message?: string;
189
+ gladiaTranscriptionId?: string;
190
+ }
191
+
181
192
  export interface TranscriptSegment {
182
193
  start: number;
183
194
  text: string;
@@ -507,6 +507,9 @@ export interface AgentTask {
507
507
 
508
508
  /** LLM stop reason for llm_call tasks (e.g., "stop", "length", "tool_use") */
509
509
  finish_reason?: string;
510
+
511
+ /** Warnings about the task outcome (e.g. unexpected model behavior). */
512
+ warnings?: string[];
510
513
  }
511
514
 
512
515
  export interface WorkflowRun {
@@ -728,8 +731,6 @@ export interface RequestInputDetails {
728
731
  options?: Array<{ id: string; label: string }>;
729
732
  variant?: string;
730
733
  multiSelect?: boolean;
731
- allowFreeResponse?: boolean;
732
- placeholder?: string;
733
734
  };
734
735
  [key: string]: unknown;
735
736
  }
@@ -28,6 +28,10 @@ export interface ToolExecutionMetadata {
28
28
  * Workflow run ID
29
29
  */
30
30
  run_id?: string;
31
+ /**
32
+ * Conversation storage ID for artifact operations
33
+ */
34
+ conversation_storage_id?: string;
31
35
  /**
32
36
  * App installation ID
33
37
  */
@@ -25,6 +25,6 @@ export interface UserInviteTokenData {
25
25
  email: string;
26
26
  role: ProjectRoles;
27
27
  account: AccountRef;
28
- project: ProjectRef;
28
+ project?: ProjectRef;
29
29
  invited_by: UserRef;
30
30
  }
package/src/user.ts CHANGED
@@ -58,6 +58,7 @@ export enum AccountType {
58
58
  partner = 'partner',
59
59
  free = 'free',
60
60
  customer = 'customer',
61
+ prospect = 'prospect',
61
62
  unknown = 'unknown'
62
63
  }
63
64
 
@@ -142,6 +142,10 @@ export interface LlmCallEvent extends BaseAgentEvent {
142
142
  eventType: AgentEventType.LlmCall;
143
143
  /** Number of input/prompt tokens */
144
144
  promptTokens: number;
145
+ /** Number of prompt tokens served from cache */
146
+ promptCachedTokens?: number;
147
+ /** Number of prompt tokens written into cache */
148
+ promptCacheWriteTokens?: number;
145
149
  /** Number of output/completion tokens */
146
150
  completionTokens: number;
147
151
  /** Total tokens used */
@@ -352,6 +356,10 @@ export interface WorkflowToolParametersQuery extends WorkflowAnalyticsQueryBase
352
356
  export interface TokenUsageMetrics {
353
357
  /** Total input/prompt tokens */
354
358
  inputTokens: number;
359
+ /** Total cached input tokens */
360
+ cachedInputTokens?: number;
361
+ /** Total cache write input tokens */
362
+ cacheWriteInputTokens?: number;
355
363
  /** Total output/completion tokens */
356
364
  outputTokens: number;
357
365
  /** Total tokens (input + output) */
@@ -682,6 +690,10 @@ export interface AgentFilterOption {
682
690
  id: string;
683
691
  /** The display name (resolved from interaction) */
684
692
  name: string;
693
+ /** Interaction status (published, archived, code, etc.) */
694
+ status?: string;
695
+ /** Interaction version number */
696
+ version?: number;
685
697
  }
686
698
 
687
699
  /**