@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
@@ -0,0 +1,258 @@
1
+ import type { AuthTokenPayload } from './apikey.js';
2
+ import type { ProjectRef } from './project.js';
3
+
4
+ export type OAuthClientType = 'public' | 'confidential';
5
+ export type OAuthClientStatus = 'active' | 'disabled';
6
+ export type OAuthRegistrationSource = 'admin' | 'dynamic';
7
+ export type OAuthProjectBindingMode = 'user_select' | 'fixed';
8
+ export type OAuthTokenEndpointAuthMethod = 'none' | 'client_secret_post' | 'client_secret_basic';
9
+ export type OAuthGrantType = 'authorization_code' | 'refresh_token';
10
+ export type OAuthResponseType = 'code';
11
+ export type OAuthAuthorizationRequestStatus = 'pending' | 'denied' | 'consumed';
12
+ export type OAuthClientRegistrationMode = 'registered' | 'client_id_metadata_document';
13
+ export type OAuthGrantStatus = 'active' | 'revoked' | 'expired';
14
+ export type OAuthGrantSortField = 'granted_at' | 'client_name' | 'user_name' | 'resource' | 'last_used_at' | 'expires_at' | 'status';
15
+ export type OAuthGrantSortOrder = 'asc' | 'desc';
16
+
17
+ export interface OAuthClientData {
18
+ client_name: string;
19
+ client_type: OAuthClientType;
20
+ redirect_uris: string[];
21
+ grant_types: OAuthGrantType[];
22
+ response_types: OAuthResponseType[];
23
+ token_endpoint_auth_method: OAuthTokenEndpointAuthMethod;
24
+ allowed_scopes: string[];
25
+ registration_source: OAuthRegistrationSource;
26
+ status: OAuthClientStatus;
27
+ project_binding_mode: OAuthProjectBindingMode;
28
+ fixed_project_id?: string;
29
+ metadata?: Record<string, unknown>;
30
+ created_by?: string;
31
+ client_secret_configured?: boolean;
32
+ created_at: string;
33
+ updated_at: string;
34
+ }
35
+
36
+ export interface OAuthClient extends OAuthClientData {
37
+ client_id: string;
38
+ }
39
+
40
+ export interface OAuthClientCreateResponse extends OAuthClient {
41
+ client_secret?: string;
42
+ }
43
+
44
+ export interface OAuthGrant {
45
+ grant_id: string;
46
+ client_id: string;
47
+ client_name: string;
48
+ user_id: string;
49
+ user_name?: string;
50
+ user_email?: string;
51
+ account_id: string;
52
+ project_id: string;
53
+ resource: string;
54
+ scope: string[];
55
+ status: OAuthGrantStatus;
56
+ token_count: number;
57
+ granted_at: string;
58
+ created_at: string;
59
+ last_used_at?: string;
60
+ expires_at?: string;
61
+ }
62
+
63
+ export interface ListOAuthGrantsQuery {
64
+ account_id?: string;
65
+ project_id?: string;
66
+ user_id?: string;
67
+ client_id?: string;
68
+ resource?: string;
69
+ status?: OAuthGrantStatus | 'all';
70
+ limit?: number;
71
+ offset?: number;
72
+ sort_by?: OAuthGrantSortField;
73
+ sort_order?: OAuthGrantSortOrder;
74
+ }
75
+
76
+ export interface OAuthGrantListResponse {
77
+ grants: OAuthGrant[];
78
+ total_count: number;
79
+ limit: number;
80
+ offset: number;
81
+ }
82
+
83
+ export interface BulkRevokeOAuthGrantsPayload extends ListOAuthGrantsQuery {
84
+ grant_ids?: string[];
85
+ include_consent?: boolean;
86
+ }
87
+
88
+ export interface OAuthGrantRevokeResponse {
89
+ revoked_tokens: number;
90
+ revoked_consents: number;
91
+ }
92
+
93
+ export interface CreateOAuthClientPayload {
94
+ client_name: string;
95
+ client_type?: OAuthClientType;
96
+ redirect_uris: string[];
97
+ grant_types?: OAuthGrantType[];
98
+ response_types?: OAuthResponseType[];
99
+ token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
100
+ allowed_scopes?: string[];
101
+ project_binding_mode?: OAuthProjectBindingMode;
102
+ fixed_project_id?: string;
103
+ client_secret?: string;
104
+ metadata?: Record<string, unknown>;
105
+ }
106
+
107
+ export interface UpdateOAuthClientPayload {
108
+ client_name?: string;
109
+ redirect_uris?: string[];
110
+ grant_types?: OAuthGrantType[];
111
+ response_types?: OAuthResponseType[];
112
+ token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
113
+ allowed_scopes?: string[];
114
+ status?: OAuthClientStatus;
115
+ project_binding_mode?: OAuthProjectBindingMode;
116
+ fixed_project_id?: string;
117
+ client_secret?: string;
118
+ metadata?: Record<string, unknown>;
119
+ }
120
+
121
+ export interface OAuthAuthorizationServerMetadata {
122
+ issuer: string;
123
+ authorization_endpoint: string;
124
+ token_endpoint: string;
125
+ jwks_uri: string;
126
+ registration_endpoint?: string;
127
+ revocation_endpoint?: string;
128
+ response_types_supported: string[];
129
+ grant_types_supported: string[];
130
+ code_challenge_methods_supported: string[];
131
+ token_endpoint_auth_methods_supported: string[];
132
+ scopes_supported: string[];
133
+ client_id_metadata_document_supported?: boolean;
134
+ }
135
+
136
+ export interface OAuthClientMetadataDocument {
137
+ client_id: string;
138
+ client_name: string;
139
+ redirect_uris: string[];
140
+ grant_types?: OAuthGrantType[];
141
+ response_types?: OAuthResponseType[];
142
+ token_endpoint_auth_method?: OAuthTokenEndpointAuthMethod;
143
+ scope?: string;
144
+ client_uri?: string;
145
+ logo_uri?: string;
146
+ tos_uri?: string;
147
+ policy_uri?: string;
148
+ }
149
+
150
+ export interface OAuthClientDisplayMetadata {
151
+ client_uri?: string;
152
+ logo_uri?: string;
153
+ tos_uri?: string;
154
+ policy_uri?: string;
155
+ }
156
+
157
+ export interface OAuthAuthorizeQuery {
158
+ response_type: 'code';
159
+ client_id: string;
160
+ redirect_uri: string;
161
+ resource?: string;
162
+ scope?: string;
163
+ state?: string;
164
+ code_challenge: string;
165
+ code_challenge_method: 'S256';
166
+ project_id?: string;
167
+ }
168
+
169
+ export interface CreateOAuthAuthorizationRequestPayload extends OAuthAuthorizeQuery {}
170
+
171
+ export interface OAuthAuthorizationRequest {
172
+ request_id: string;
173
+ client_id: string;
174
+ client_name: string;
175
+ client_metadata?: OAuthClientDisplayMetadata;
176
+ client_registration_mode?: OAuthClientRegistrationMode;
177
+ redirect_uri: string;
178
+ redirect_origin: string;
179
+ resource?: string;
180
+ requested_scopes: string[];
181
+ requested_project_id?: string;
182
+ project_binding_mode: OAuthProjectBindingMode;
183
+ fixed_project_id?: string;
184
+ status: OAuthAuthorizationRequestStatus;
185
+ created_at: string;
186
+ expires_at: string;
187
+ }
188
+
189
+ export interface ApproveOAuthAuthorizationRequestPayload {
190
+ project_id?: string;
191
+ }
192
+
193
+ export interface OAuthAuthorizationDecisionResponse {
194
+ redirect_url: string;
195
+ }
196
+
197
+ export interface OAuthTokenRequestAuthorizationCode {
198
+ grant_type: 'authorization_code';
199
+ code: string;
200
+ redirect_uri: string;
201
+ client_id: string;
202
+ resource?: string;
203
+ code_verifier: string;
204
+ client_secret?: string;
205
+ }
206
+
207
+ export interface OAuthTokenRequestRefreshToken {
208
+ grant_type: 'refresh_token';
209
+ refresh_token: string;
210
+ client_id: string;
211
+ resource?: string;
212
+ client_secret?: string;
213
+ }
214
+
215
+ export type OAuthTokenRequest = OAuthTokenRequestAuthorizationCode | OAuthTokenRequestRefreshToken;
216
+
217
+ export interface OAuthTokenResponse {
218
+ access_token: string;
219
+ token_type: 'Bearer';
220
+ expires_in: number;
221
+ scope: string;
222
+ refresh_token?: string;
223
+ id_token?: string;
224
+ }
225
+
226
+ export interface OAuthAuthorizationCodeRecord {
227
+ code: string;
228
+ client_id: string;
229
+ user_id: string;
230
+ account_id: string;
231
+ project_id: string;
232
+ resource: string;
233
+ scope: string[];
234
+ redirect_uri: string;
235
+ code_challenge: string;
236
+ code_challenge_method: 'S256';
237
+ expires_at: string;
238
+ }
239
+
240
+ export interface OAuthConsentRecord {
241
+ user_id: string;
242
+ client_id: string;
243
+ account_id: string;
244
+ project_id: string;
245
+ scope: string[];
246
+ granted_at: string;
247
+ revoked_at?: string;
248
+ }
249
+
250
+ export interface OAuthAccessTokenPayload extends Omit<AuthTokenPayload, 'type' | 'project'> {
251
+ type: 'oauth_access';
252
+ client_id: string;
253
+ scope: string;
254
+ user_id: string;
255
+ project: ProjectRef;
256
+ allowed_collections?: string[];
257
+ resource?: string;
258
+ }
package/src/oauth.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * OAuth Application types for generic, project-level OAuth 2.0 integration.
2
+ * OAuth Provider types for generic, project-level OAuth 2.0 integration.
3
3
  * Decoupled from MCP — can be used by MCP collections, tool activities, or any OAuth-protected API.
4
4
  */
5
5
 
6
6
  /**
7
- * OAuth Application data stored in MongoDB.
7
+ * OAuth Provider data stored in MongoDB.
8
8
  * Represents the configuration for an OAuth 2.0 provider at the project level.
9
9
  */
10
- export interface OAuthApplicationData {
10
+ export interface OAuthProviderData {
11
11
  /**
12
12
  * Unique name within the project (kebab-case identifier).
13
13
  */
@@ -19,12 +19,20 @@ export interface OAuthApplicationData {
19
19
  display_name: string;
20
20
 
21
21
  /**
22
- * The project this OAuth application belongs to.
22
+ * The project this OAuth provider belongs to.
23
23
  */
24
24
  project: string;
25
25
 
26
+ /**
27
+ * The OAuth 2.0 grant type to use.
28
+ * - 'authorization_code': 3-legged flow requiring user authorization (default).
29
+ * - 'client_credentials': 2-legged server-to-server flow using client_id + client_secret.
30
+ */
31
+ grant_type?: 'authorization_code' | 'client_credentials';
32
+
26
33
  /**
27
34
  * The OAuth 2.0 authorization endpoint URL.
35
+ * Only used for authorization_code flow.
28
36
  * Optional when endpoints are discovered via .well-known (e.g. MCP servers).
29
37
  */
30
38
  authorization_endpoint?: string;
@@ -52,7 +60,7 @@ export interface OAuthApplicationData {
52
60
 
53
61
  /**
54
62
  * Whether to use PKCE (Proof Key for Code Exchange) in the authorization flow.
55
- * Defaults to true.
63
+ * Only applies to authorization_code flow. Defaults to true.
56
64
  */
57
65
  use_pkce: boolean;
58
66
 
@@ -66,19 +74,20 @@ export interface OAuthApplicationData {
66
74
  }
67
75
 
68
76
  /**
69
- * OAuth Application as returned by the API (with id).
77
+ * OAuth Provider as returned by the API (with id).
70
78
  */
71
- export interface OAuthApplication extends OAuthApplicationData {
79
+ export interface OAuthProvider extends OAuthProviderData {
72
80
  id: string;
73
81
  }
74
82
 
75
83
  /**
76
- * Payload for creating an OAuth Application.
84
+ * Payload for creating an OAuth Provider.
77
85
  * The client_secret is accepted as plaintext on create and stored encrypted.
78
86
  */
79
- export interface CreateOAuthApplicationPayload {
87
+ export interface CreateOAuthProviderPayload {
80
88
  name: string;
81
89
  display_name: string;
90
+ grant_type?: 'authorization_code' | 'client_credentials';
82
91
  authorization_endpoint?: string;
83
92
  token_endpoint?: string;
84
93
  client_id: string;
@@ -93,18 +102,18 @@ export interface CreateOAuthApplicationPayload {
93
102
  }
94
103
 
95
104
  /**
96
- * Payload for updating an OAuth Application.
105
+ * Payload for updating an OAuth Provider.
97
106
  * All fields are optional — only provided fields are updated.
98
107
  * To clear the client_secret, set it to an empty string.
99
108
  */
100
- export type UpdateOAuthApplicationPayload = Partial<CreateOAuthApplicationPayload>;
109
+ export type UpdateOAuthProviderPayload = Partial<CreateOAuthProviderPayload>;
101
110
 
102
111
  /**
103
- * OAuth authentication status for a user against an OAuth Application.
112
+ * OAuth authentication status for a user against an OAuth Provider.
104
113
  */
105
- export interface OAuthAppAuthStatus {
106
- oauth_app_id: string;
107
- oauth_app_name: string;
114
+ export interface OAuthProviderAuthStatus {
115
+ oauth_provider_id: string;
116
+ oauth_provider_name: string;
108
117
  authenticated: boolean;
109
118
  expires_at?: string;
110
119
  scope?: string;
@@ -112,8 +121,11 @@ export interface OAuthAppAuthStatus {
112
121
 
113
122
  /**
114
123
  * Response from the OAuth authorize endpoint.
124
+ * For authorization_code flow: contains authorization_url and state for browser redirect.
125
+ * For client_credentials flow: contains connected=true (token was fetched server-side, no redirect needed).
115
126
  */
116
- export interface OAuthAppAuthorizeResponse {
117
- authorization_url: string;
118
- state: string;
127
+ export interface OAuthProviderAuthorizeResponse {
128
+ authorization_url?: string;
129
+ state?: string;
130
+ connected?: boolean;
119
131
  }
package/src/project.ts CHANGED
@@ -333,6 +333,16 @@ export interface IndexingStatusResponse {
333
333
  elapsed_seconds: number;
334
334
  /** Estimated seconds remaining (null if unknown) */
335
335
  estimated_seconds_remaining: number | null;
336
+ /** Total bytes sent to ES */
337
+ total_bytes?: number;
338
+ /** Total ES bulk flushes */
339
+ bulk_flushes?: number;
340
+ /** Average bytes per ES bulk flush */
341
+ avg_flush_bytes?: number;
342
+ /** Configured batch size */
343
+ batch_size?: number;
344
+ /** Configured parallel batch count */
345
+ parallel_batch_count?: number;
336
346
  };
337
347
  }
338
348
 
@@ -381,6 +391,12 @@ export interface CreateReindexTargetResult {
381
391
  index_name: string;
382
392
  alias_name: string;
383
393
  version: number;
394
+ dimensions?: {
395
+ text?: number;
396
+ image?: number;
397
+ properties?: number;
398
+ };
399
+ language?: string;
384
400
  }
385
401
 
386
402
  /**
@@ -404,17 +420,6 @@ export interface FetchBatchResult {
404
420
  done: boolean;
405
421
  }
406
422
 
407
- /**
408
- * Result from indexing a batch
409
- */
410
- export interface IndexBatchResult {
411
- successful: number;
412
- failed: number;
413
- processed: number;
414
- next_cursor: string | null;
415
- done: boolean;
416
- }
417
-
418
423
  /**
419
424
  * Result from discovering the next cursor boundary for batch partitioning
420
425
  */
@@ -437,6 +442,95 @@ export interface TriggerReindexResult {
437
442
  enabled?: boolean;
438
443
  }
439
444
 
445
+ // ========================================================================
446
+ // Zeno Bulk (Go service) types
447
+ // ========================================================================
448
+
449
+ export interface ComputeShardsRequest {
450
+ tenant_id: string;
451
+ shard_size?: number;
452
+ }
453
+
454
+ export interface ComputeShardsResult {
455
+ shards: Array<{ min?: string; max?: string }>;
456
+ count: number;
457
+ }
458
+
459
+ export interface IndexShardParams {
460
+ tenant_id: string;
461
+ target_index: string;
462
+ shard_min: string;
463
+ shard_max?: string;
464
+ embedding_dimensions?: {
465
+ text?: number;
466
+ image?: number;
467
+ properties?: number;
468
+ };
469
+ dry_run?: boolean;
470
+ concurrency?: number;
471
+ batch_size?: number;
472
+ bulk_size_bytes?: number;
473
+ bulk_concurrency?: number;
474
+ updated_since?: string;
475
+ }
476
+
477
+ export interface IndexShardRequest {
478
+ force?: boolean;
479
+ params: IndexShardParams;
480
+ }
481
+
482
+ export interface IndexShardResult {
483
+ status: string;
484
+ projects_done: number;
485
+ projects_total: number;
486
+ scanned: number;
487
+ written: number;
488
+ skipped: number;
489
+ errors: number;
490
+ read_docs_s: string;
491
+ write_docs_s: string;
492
+ read_mb: string;
493
+ write_mb: string;
494
+ read_mb_s: string;
495
+ write_mb_s: string;
496
+ duration_sec: number;
497
+ failed_projects?: Array<{ tenant: string; error: string }>;
498
+ }
499
+
500
+ export interface SwapAliasRequest {
501
+ tenant_id: string;
502
+ target_index: string;
503
+ /** ES alias name. If not provided, the Go service derives it from the tenant ID. */
504
+ alias?: string;
505
+ }
506
+
507
+ export interface SwapAliasResult {
508
+ status: string;
509
+ alias: string;
510
+ old_index: string;
511
+ new_index: string;
512
+ }
513
+
514
+ export interface ReindexViaBulkRequest {
515
+ tenant_id: string;
516
+ dry_run?: boolean;
517
+ }
518
+
519
+ export interface ReindexViaBulkResult {
520
+ status: string;
521
+ error?: string;
522
+ projects_done: number;
523
+ projects_total: number;
524
+ scanned: number;
525
+ written: number;
526
+ errors: number;
527
+ read_docs_s: string;
528
+ write_docs_s: string;
529
+ read_mb: string;
530
+ write_mb: string;
531
+ duration_sec: number;
532
+ }
533
+
440
534
  /**
441
535
  * Elasticsearch index statistics
442
536
  */
@@ -600,16 +694,6 @@ export interface DriftAnalysisStatusResponse extends WorkflowRunStatus {
600
694
  error?: string;
601
695
  }
602
696
 
603
- /**
604
- * Result from swap alias operation
605
- */
606
- export interface SwapAliasResult {
607
- swapped: boolean;
608
- alias_name?: string;
609
- new_index_name?: string;
610
- reason?: string;
611
- }
612
-
613
697
  export interface ProjectIntegrationListEntry {
614
698
  id: SupportedIntegrations;
615
699
  enabled: boolean;
package/src/query.ts CHANGED
@@ -72,6 +72,11 @@ export interface InteractionSearchQuery extends SimpleSearchQuery {
72
72
  version?: string;
73
73
  model?: string;
74
74
  environment?: string;
75
+ is_agent?: boolean;
76
+ is_tool?: boolean;
77
+ is_skill?: boolean;
78
+ is_basic?: boolean;
79
+ is_sub_agent?: boolean;
75
80
  }
76
81
 
77
82
  export interface RunSearchQuery extends SimpleSearchQuery {
@@ -90,7 +95,9 @@ export interface RunSearchQuery extends SimpleSearchQuery {
90
95
  finish_reason?: string;
91
96
  created_by?: string;
92
97
  workflow_run_ids?: string[];
98
+ workflow_ids?: string[];
93
99
  run_ids?: string[];
100
+ is_agent?: boolean;
94
101
  }
95
102
 
96
103
  export interface WorkflowExecutionSearchQuery extends SimpleSearchQuery {
package/src/refs.ts CHANGED
@@ -27,4 +27,8 @@ export interface ResourceRef {
27
27
  name: string
28
28
  type: string
29
29
  description?: string
30
+ version?: number
31
+ status?: string
32
+ tags?: string[]
33
+ endpoint?: string
30
34
  }
package/src/runs.ts CHANGED
@@ -17,6 +17,21 @@ export interface ExecutionRunDocRef {
17
17
  export interface RunCreatePayload extends NamedInteractionExecutionPayload {
18
18
  }
19
19
 
20
+ /**
21
+ * Payload for cloning an existing ExecutionRun.
22
+ * Creates a new run document with the same interaction/config but fresh status.
23
+ * Used by fork flows to create a new ExecutionRun for the forked workflow.
24
+ */
25
+ export interface RunClonePayload {
26
+ /** The _id of the source ExecutionRun to clone */
27
+ source_run_id: string;
28
+ /** Temporal workflow reference for the new run */
29
+ workflow: {
30
+ run_id: string;
31
+ workflow_id: string;
32
+ };
33
+ }
34
+
20
35
  /**
21
36
  * To be used as a value for a numeric or date filters
22
37
  */