@xpert-ai/contracts 3.29.0 → 3.30.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 (40) hide show
  1. package/index.cjs.js +2691 -1499
  2. package/index.esm.js +3771 -2629
  3. package/package.json +2 -2
  4. package/src/ai/ai-model.model.d.ts +9 -0
  5. package/src/ai/chat-activity.model.d.ts +6 -0
  6. package/src/ai/chat.model.d.ts +7 -2
  7. package/src/ai/conversation-trail.model.d.ts +417 -0
  8. package/src/ai/copilot-model.model.d.ts +3 -0
  9. package/src/ai/copilot-provider.model.d.ts +2 -0
  10. package/src/ai/copilot.model.d.ts +7 -4
  11. package/src/ai/default-model-role.d.ts +41 -0
  12. package/src/ai/execution-activity.model.d.ts +12 -0
  13. package/src/ai/execution-observability.model.d.ts +12 -12
  14. package/src/ai/index.d.ts +3 -0
  15. package/src/ai/membership.model.d.ts +2 -0
  16. package/src/ai/model-discovery.model.d.ts +1 -0
  17. package/src/ai/model-execution-parameters.model.d.ts +14 -14
  18. package/src/ai/model-gateway.model.d.ts +9 -1
  19. package/src/ai/model-management.model.d.ts +358 -0
  20. package/src/ai/model-replacement.model.d.ts +291 -0
  21. package/src/ai/role-permissions.d.ts +59 -2
  22. package/src/ai/thread-activity.model.d.ts +1 -0
  23. package/src/ai/xpert-tool.model.d.ts +4 -3
  24. package/src/ai/xpert-toolset.model.d.ts +4 -3
  25. package/src/ai/xpert.model.d.ts +21 -5
  26. package/src/analytics-definition.model.d.ts +2 -0
  27. package/src/app-platform.d.ts +666 -0
  28. package/src/artifact.model.d.ts +1 -1
  29. package/src/index.d.ts +4 -0
  30. package/src/integration-sharing.model.d.ts +12 -0
  31. package/src/integration.model.d.ts +2 -0
  32. package/src/plugin-application.d.ts +13 -0
  33. package/src/plugin.d.ts +7 -0
  34. package/src/role-permission-modules.d.ts +13 -1
  35. package/src/role-permission.model.d.ts +1 -0
  36. package/src/role.model.d.ts +19 -0
  37. package/src/types.d.ts +1 -0
  38. package/src/user-notification.schema.d.ts +721 -0
  39. package/src/user.model.d.ts +2 -0
  40. package/src/view-extension/model.d.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/contracts",
3
- "version": "3.29.0",
3
+ "version": "3.30.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@octokit/types": "13.10.0",
23
23
  "@types/json-schema": "^7.0.15",
24
- "@xpert-ai/chatkit-types": "~0.19.0",
24
+ "@xpert-ai/chatkit-types": "~0.20.0",
25
25
  "zod-to-json-schema": "^3.25.2"
26
26
  },
27
27
  "peerDependencies": {
@@ -51,6 +51,12 @@ export interface ICopilotWithProvider extends ICopilot {
51
51
  }
52
52
  export interface IAiProviderEntity {
53
53
  provider: string;
54
+ /** Runtime registry provenance; never infer a plugin package from the provider name. */
55
+ plugin?: {
56
+ name: string;
57
+ version?: string;
58
+ scopeKey: string;
59
+ };
54
60
  label: I18nObject;
55
61
  description: I18nObject;
56
62
  icon_small: I18nObject;
@@ -67,6 +73,8 @@ export interface IAiProviderEntity {
67
73
  */
68
74
  not_implemented?: boolean;
69
75
  }
76
+ /** Custom-model providers without a shared credential schema validate credentials per model. */
77
+ export declare function usesModelScopedCredentials(provider: Partial<IAiProviderEntity> | null | undefined): boolean;
70
78
  export interface ProviderHelpInfo {
71
79
  title: I18nObject;
72
80
  url: I18nObject;
@@ -175,6 +183,7 @@ export declare function isOutputTokenParameter(rule: Pick<ParameterRule, 'name'>
175
183
  export declare function normalizeModelParameterValue(value: unknown, rule: ParameterRule): unknown | undefined;
176
184
  export declare function resolveModelParameterOptions(modelOptions: Record<string, unknown> | undefined, rules: ParameterRule[], config?: {
177
185
  preserveUnknown?: boolean;
186
+ preserveUnset?: boolean;
178
187
  }): Record<string, unknown> | undefined;
179
188
  export interface PriceTierConfig {
180
189
  input: number;
@@ -1,6 +1,8 @@
1
1
  export type TChatConversationStatus = 'idle' | 'busy' | 'pausing' | 'paused' | 'interrupted' | 'error';
2
2
  export interface IChatConversationUnreadXpertSummary {
3
3
  xpertId: string;
4
+ /** Includes running conversations other than the most recently updated one. */
5
+ hasActiveRuns?: boolean;
4
6
  unreadMessages: number;
5
7
  unreadConversations: number;
6
8
  latestUnreadAt?: Date | string | null;
@@ -12,3 +14,7 @@ export interface IChatConversationUnreadXpertSummary {
12
14
  latestConversationTitle?: string | null;
13
15
  latestConversationStatus?: TChatConversationStatus | null;
14
16
  }
17
+ export interface IChatConversationUnreadSnapshot {
18
+ version: string;
19
+ items: IChatConversationUnreadXpertSummary[];
20
+ }
@@ -1,5 +1,5 @@
1
1
  import type { TChatConversationStatus } from './chat-activity.model';
2
- export type { TChatConversationStatus, IChatConversationUnreadXpertSummary } from './chat-activity.model';
2
+ export type { TChatConversationStatus, IChatConversationUnreadXpertSummary, IChatConversationUnreadSnapshot } from './chat-activity.model';
3
3
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
4
4
  import { IXpertAgentExecution } from './xpert-agent-execution.model';
5
5
  import { IXpert } from './xpert.model';
@@ -159,7 +159,12 @@ export type TChatThreadMetadata = {
159
159
  [key: string]: unknown;
160
160
  };
161
161
  export type TToolCallType = 'agent' | 'tool';
162
- export type TChatFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'schedule' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom' | 'wechat';
162
+ /**
163
+ * Conversation origin: built-in values and stable identifiers supplied by channel plugins.
164
+ * Keep legacy values for stored conversations and editor completion; adding a channel
165
+ * must not require a platform release. Attribution does not grant execution permissions.
166
+ */
167
+ export type TChatFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'schedule' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom' | 'wechat' | (string & {});
163
168
  /**
164
169
  * Operation for interrupt
165
170
  */
@@ -0,0 +1,417 @@
1
+ import { z } from 'zod/v3';
2
+ /** Runtime-owned activity semantics. Display names and model prose are never classifiers. */
3
+ export declare const trailActivityKindSchema: z.ZodEnum<["task", "explore", "change", "verify", "answer", "other"]>;
4
+ export type TrailActivityKind = z.infer<typeof trailActivityKindSchema>;
5
+ export declare const trailStatusSchema: z.ZodEnum<["running", "success", "error", "pending", "waiting", "cancelling", "idle", "interrupted", "unknown"]>;
6
+ export type TrailStatus = z.infer<typeof trailStatusSchema>;
7
+ export declare const trailStepSchema: z.ZodObject<{
8
+ toolCallId: z.ZodOptional<z.ZodString>;
9
+ startedAt: z.ZodOptional<z.ZodString>;
10
+ endedAt: z.ZodOptional<z.ZodString>;
11
+ preview: z.ZodOptional<z.ZodString>;
12
+ answer: z.ZodOptional<z.ZodString>;
13
+ input: z.ZodOptional<z.ZodString>;
14
+ output: z.ZodOptional<z.ZodString>;
15
+ messageId: z.ZodOptional<z.ZodString>;
16
+ threadId: z.ZodOptional<z.ZodString>;
17
+ executionId: z.ZodOptional<z.ZodString>;
18
+ id: z.ZodString;
19
+ laneId: z.ZodString;
20
+ kind: z.ZodEnum<["turn", "tool", "message"]>;
21
+ activity: z.ZodEnum<["task", "explore", "change", "verify", "answer", "other"]>;
22
+ title: z.ZodString;
23
+ status: z.ZodEnum<["running", "success", "error", "pending", "waiting", "cancelling", "idle", "interrupted", "unknown"]>;
24
+ order: z.ZodNumber;
25
+ }, "strip", z.ZodTypeAny, {
26
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
27
+ id?: string;
28
+ kind?: "message" | "tool" | "turn";
29
+ startedAt?: string;
30
+ input?: string;
31
+ output?: string;
32
+ title?: string;
33
+ executionId?: string;
34
+ answer?: string;
35
+ preview?: string;
36
+ order?: number;
37
+ threadId?: string;
38
+ messageId?: string;
39
+ endedAt?: string;
40
+ laneId?: string;
41
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
42
+ toolCallId?: string;
43
+ }, {
44
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
45
+ id?: string;
46
+ kind?: "message" | "tool" | "turn";
47
+ startedAt?: string;
48
+ input?: string;
49
+ output?: string;
50
+ title?: string;
51
+ executionId?: string;
52
+ answer?: string;
53
+ preview?: string;
54
+ order?: number;
55
+ threadId?: string;
56
+ messageId?: string;
57
+ endedAt?: string;
58
+ laneId?: string;
59
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
60
+ toolCallId?: string;
61
+ }>;
62
+ export declare const trailLaneSchema: z.ZodObject<{
63
+ invocationKind: z.ZodOptional<z.ZodEnum<["sub_agent", "external_assistant", "activity"]>>;
64
+ purpose: z.ZodOptional<z.ZodEnum<["side-chat", "message-edit"]>>;
65
+ elapsedMs: z.ZodOptional<z.ZodNumber>;
66
+ outcome: z.ZodOptional<z.ZodObject<{
67
+ status: z.ZodString;
68
+ accepted: z.ZodBoolean;
69
+ message: z.ZodOptional<z.ZodString>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ status?: string;
72
+ message?: string;
73
+ accepted?: boolean;
74
+ }, {
75
+ status?: string;
76
+ message?: string;
77
+ accepted?: boolean;
78
+ }>>;
79
+ messageId: z.ZodOptional<z.ZodString>;
80
+ threadId: z.ZodOptional<z.ZodString>;
81
+ executionId: z.ZodOptional<z.ZodString>;
82
+ id: z.ZodString;
83
+ parentId: z.ZodNullable<z.ZodString>;
84
+ spawnStepId: z.ZodOptional<z.ZodString>;
85
+ title: z.ZodString;
86
+ primary: z.ZodBoolean;
87
+ status: z.ZodEnum<["running", "success", "error", "pending", "waiting", "cancelling", "idle", "interrupted", "unknown"]>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
90
+ id?: string;
91
+ parentId?: string;
92
+ primary?: boolean;
93
+ title?: string;
94
+ executionId?: string;
95
+ outcome?: {
96
+ status?: string;
97
+ message?: string;
98
+ accepted?: boolean;
99
+ };
100
+ purpose?: "side-chat" | "message-edit";
101
+ threadId?: string;
102
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
103
+ messageId?: string;
104
+ spawnStepId?: string;
105
+ elapsedMs?: number;
106
+ }, {
107
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
108
+ id?: string;
109
+ parentId?: string;
110
+ primary?: boolean;
111
+ title?: string;
112
+ executionId?: string;
113
+ outcome?: {
114
+ status?: string;
115
+ message?: string;
116
+ accepted?: boolean;
117
+ };
118
+ purpose?: "side-chat" | "message-edit";
119
+ threadId?: string;
120
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
121
+ messageId?: string;
122
+ spawnStepId?: string;
123
+ elapsedMs?: number;
124
+ }>;
125
+ export declare const trailEpisodeSchema: z.ZodObject<{
126
+ id: z.ZodString;
127
+ laneId: z.ZodString;
128
+ activity: z.ZodEnum<["task", "explore", "change", "verify", "answer", "other"]>;
129
+ stepIds: z.ZodArray<z.ZodString, "many">;
130
+ }, "strip", z.ZodTypeAny, {
131
+ id?: string;
132
+ laneId?: string;
133
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
134
+ stepIds?: string[];
135
+ }, {
136
+ id?: string;
137
+ laneId?: string;
138
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
139
+ stepIds?: string[];
140
+ }>;
141
+ export declare const trailGraphSchema: z.ZodObject<{
142
+ version: z.ZodLiteral<1>;
143
+ layer: z.ZodEnum<["conversation", "execution"]>;
144
+ conversationId: z.ZodString;
145
+ threadId: z.ZodString;
146
+ messageId: z.ZodOptional<z.ZodString>;
147
+ title: z.ZodString;
148
+ lanes: z.ZodArray<z.ZodObject<{
149
+ invocationKind: z.ZodOptional<z.ZodEnum<["sub_agent", "external_assistant", "activity"]>>;
150
+ purpose: z.ZodOptional<z.ZodEnum<["side-chat", "message-edit"]>>;
151
+ elapsedMs: z.ZodOptional<z.ZodNumber>;
152
+ outcome: z.ZodOptional<z.ZodObject<{
153
+ status: z.ZodString;
154
+ accepted: z.ZodBoolean;
155
+ message: z.ZodOptional<z.ZodString>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ status?: string;
158
+ message?: string;
159
+ accepted?: boolean;
160
+ }, {
161
+ status?: string;
162
+ message?: string;
163
+ accepted?: boolean;
164
+ }>>;
165
+ messageId: z.ZodOptional<z.ZodString>;
166
+ threadId: z.ZodOptional<z.ZodString>;
167
+ executionId: z.ZodOptional<z.ZodString>;
168
+ id: z.ZodString;
169
+ parentId: z.ZodNullable<z.ZodString>;
170
+ spawnStepId: z.ZodOptional<z.ZodString>;
171
+ title: z.ZodString;
172
+ primary: z.ZodBoolean;
173
+ status: z.ZodEnum<["running", "success", "error", "pending", "waiting", "cancelling", "idle", "interrupted", "unknown"]>;
174
+ }, "strip", z.ZodTypeAny, {
175
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
176
+ id?: string;
177
+ parentId?: string;
178
+ primary?: boolean;
179
+ title?: string;
180
+ executionId?: string;
181
+ outcome?: {
182
+ status?: string;
183
+ message?: string;
184
+ accepted?: boolean;
185
+ };
186
+ purpose?: "side-chat" | "message-edit";
187
+ threadId?: string;
188
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
189
+ messageId?: string;
190
+ spawnStepId?: string;
191
+ elapsedMs?: number;
192
+ }, {
193
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
194
+ id?: string;
195
+ parentId?: string;
196
+ primary?: boolean;
197
+ title?: string;
198
+ executionId?: string;
199
+ outcome?: {
200
+ status?: string;
201
+ message?: string;
202
+ accepted?: boolean;
203
+ };
204
+ purpose?: "side-chat" | "message-edit";
205
+ threadId?: string;
206
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
207
+ messageId?: string;
208
+ spawnStepId?: string;
209
+ elapsedMs?: number;
210
+ }>, "many">;
211
+ steps: z.ZodArray<z.ZodObject<{
212
+ toolCallId: z.ZodOptional<z.ZodString>;
213
+ startedAt: z.ZodOptional<z.ZodString>;
214
+ endedAt: z.ZodOptional<z.ZodString>;
215
+ preview: z.ZodOptional<z.ZodString>;
216
+ answer: z.ZodOptional<z.ZodString>;
217
+ input: z.ZodOptional<z.ZodString>;
218
+ output: z.ZodOptional<z.ZodString>;
219
+ messageId: z.ZodOptional<z.ZodString>;
220
+ threadId: z.ZodOptional<z.ZodString>;
221
+ executionId: z.ZodOptional<z.ZodString>;
222
+ id: z.ZodString;
223
+ laneId: z.ZodString;
224
+ kind: z.ZodEnum<["turn", "tool", "message"]>;
225
+ activity: z.ZodEnum<["task", "explore", "change", "verify", "answer", "other"]>;
226
+ title: z.ZodString;
227
+ status: z.ZodEnum<["running", "success", "error", "pending", "waiting", "cancelling", "idle", "interrupted", "unknown"]>;
228
+ order: z.ZodNumber;
229
+ }, "strip", z.ZodTypeAny, {
230
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
231
+ id?: string;
232
+ kind?: "message" | "tool" | "turn";
233
+ startedAt?: string;
234
+ input?: string;
235
+ output?: string;
236
+ title?: string;
237
+ executionId?: string;
238
+ answer?: string;
239
+ preview?: string;
240
+ order?: number;
241
+ threadId?: string;
242
+ messageId?: string;
243
+ endedAt?: string;
244
+ laneId?: string;
245
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
246
+ toolCallId?: string;
247
+ }, {
248
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
249
+ id?: string;
250
+ kind?: "message" | "tool" | "turn";
251
+ startedAt?: string;
252
+ input?: string;
253
+ output?: string;
254
+ title?: string;
255
+ executionId?: string;
256
+ answer?: string;
257
+ preview?: string;
258
+ order?: number;
259
+ threadId?: string;
260
+ messageId?: string;
261
+ endedAt?: string;
262
+ laneId?: string;
263
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
264
+ toolCallId?: string;
265
+ }>, "many">;
266
+ episodes: z.ZodArray<z.ZodObject<{
267
+ id: z.ZodString;
268
+ laneId: z.ZodString;
269
+ activity: z.ZodEnum<["task", "explore", "change", "verify", "answer", "other"]>;
270
+ stepIds: z.ZodArray<z.ZodString, "many">;
271
+ }, "strip", z.ZodTypeAny, {
272
+ id?: string;
273
+ laneId?: string;
274
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
275
+ stepIds?: string[];
276
+ }, {
277
+ id?: string;
278
+ laneId?: string;
279
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
280
+ stepIds?: string[];
281
+ }>, "many">;
282
+ coverage: z.ZodArray<z.ZodEnum<["record_limit", "missing_identity", "no_execution", "timing_unavailable", "activity_unavailable", "historical"]>, "many">;
283
+ source: z.ZodOptional<z.ZodObject<{
284
+ conversationId: z.ZodString;
285
+ threadId: z.ZodString;
286
+ messageId: z.ZodString;
287
+ }, "strip", z.ZodTypeAny, {
288
+ conversationId?: string;
289
+ threadId?: string;
290
+ messageId?: string;
291
+ }, {
292
+ conversationId?: string;
293
+ threadId?: string;
294
+ messageId?: string;
295
+ }>>;
296
+ live: z.ZodBoolean;
297
+ }, "strip", z.ZodTypeAny, {
298
+ version?: 1;
299
+ source?: {
300
+ conversationId?: string;
301
+ threadId?: string;
302
+ messageId?: string;
303
+ };
304
+ title?: string;
305
+ conversationId?: string;
306
+ steps?: {
307
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
308
+ id?: string;
309
+ kind?: "message" | "tool" | "turn";
310
+ startedAt?: string;
311
+ input?: string;
312
+ output?: string;
313
+ title?: string;
314
+ executionId?: string;
315
+ answer?: string;
316
+ preview?: string;
317
+ order?: number;
318
+ threadId?: string;
319
+ messageId?: string;
320
+ endedAt?: string;
321
+ laneId?: string;
322
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
323
+ toolCallId?: string;
324
+ }[];
325
+ threadId?: string;
326
+ messageId?: string;
327
+ lanes?: {
328
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
329
+ id?: string;
330
+ parentId?: string;
331
+ primary?: boolean;
332
+ title?: string;
333
+ executionId?: string;
334
+ outcome?: {
335
+ status?: string;
336
+ message?: string;
337
+ accepted?: boolean;
338
+ };
339
+ purpose?: "side-chat" | "message-edit";
340
+ threadId?: string;
341
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
342
+ messageId?: string;
343
+ spawnStepId?: string;
344
+ elapsedMs?: number;
345
+ }[];
346
+ coverage?: ("historical" | "record_limit" | "missing_identity" | "no_execution" | "timing_unavailable" | "activity_unavailable")[];
347
+ layer?: "conversation" | "execution";
348
+ episodes?: {
349
+ id?: string;
350
+ laneId?: string;
351
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
352
+ stepIds?: string[];
353
+ }[];
354
+ live?: boolean;
355
+ }, {
356
+ version?: 1;
357
+ source?: {
358
+ conversationId?: string;
359
+ threadId?: string;
360
+ messageId?: string;
361
+ };
362
+ title?: string;
363
+ conversationId?: string;
364
+ steps?: {
365
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
366
+ id?: string;
367
+ kind?: "message" | "tool" | "turn";
368
+ startedAt?: string;
369
+ input?: string;
370
+ output?: string;
371
+ title?: string;
372
+ executionId?: string;
373
+ answer?: string;
374
+ preview?: string;
375
+ order?: number;
376
+ threadId?: string;
377
+ messageId?: string;
378
+ endedAt?: string;
379
+ laneId?: string;
380
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
381
+ toolCallId?: string;
382
+ }[];
383
+ threadId?: string;
384
+ messageId?: string;
385
+ lanes?: {
386
+ status?: "idle" | "error" | "unknown" | "success" | "interrupted" | "running" | "pending" | "waiting" | "cancelling";
387
+ id?: string;
388
+ parentId?: string;
389
+ primary?: boolean;
390
+ title?: string;
391
+ executionId?: string;
392
+ outcome?: {
393
+ status?: string;
394
+ message?: string;
395
+ accepted?: boolean;
396
+ };
397
+ purpose?: "side-chat" | "message-edit";
398
+ threadId?: string;
399
+ invocationKind?: "external_assistant" | "sub_agent" | "activity";
400
+ messageId?: string;
401
+ spawnStepId?: string;
402
+ elapsedMs?: number;
403
+ }[];
404
+ coverage?: ("historical" | "record_limit" | "missing_identity" | "no_execution" | "timing_unavailable" | "activity_unavailable")[];
405
+ layer?: "conversation" | "execution";
406
+ episodes?: {
407
+ id?: string;
408
+ laneId?: string;
409
+ activity?: "other" | "task" | "answer" | "explore" | "change" | "verify";
410
+ stepIds?: string[];
411
+ }[];
412
+ live?: boolean;
413
+ }>;
414
+ export type TrailStep = z.infer<typeof trailStepSchema>;
415
+ export type TrailLane = z.infer<typeof trailLaneSchema>;
416
+ export type TrailEpisode = z.infer<typeof trailEpisodeSchema>;
417
+ export type TrailGraph = z.infer<typeof trailGraphSchema>;
@@ -39,5 +39,8 @@ export type TCopilotModelOptions = {
39
39
  * Max input context size of selected model
40
40
  */
41
41
  context_size?: number;
42
+ /** Client retry policy, independent of the selected model's generation parameters. */
43
+ maxRetries?: number;
44
+ /** Optional generation parameters use null to persist an explicit unset value. */
42
45
  [key: string]: any;
43
46
  };
@@ -3,6 +3,7 @@ import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { IAiProviderEntity } from './ai-model.model';
4
4
  import { ICopilot } from './copilot.model';
5
5
  import type { ModelConfiguration, ModelDiscoveryState } from './model-discovery.model';
6
+ import type { EnabledModelSelection } from './model-management.model';
6
7
  export interface ICopilotProvider extends IBasePerTenantAndOrganizationEntityModel {
7
8
  providerName?: string;
8
9
  providerType?: string;
@@ -16,6 +17,7 @@ export interface ICopilotProvider extends IBasePerTenantAndOrganizationEntityMod
16
17
  */
17
18
  options?: Record<string, unknown> & {
18
19
  modelDiscovery?: ModelDiscoveryState;
20
+ enabledModels?: EnabledModelSelection[];
19
21
  };
20
22
  copilot?: ICopilot;
21
23
  copilotId?: string;
@@ -1,9 +1,11 @@
1
+ import { DefaultModelRole, LegacyProviderRole } from './default-model-role';
1
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
2
3
  import { ICopilotModel } from './copilot-model.model';
3
4
  import { ICopilotProvider } from './copilot-provider.model';
4
5
  export interface ICopilot extends IBasePerTenantAndOrganizationEntityModel {
5
6
  name?: string;
6
- role: AiProviderRole;
7
+ /** @deprecated Connection roles are read only for legacy defaults and setup compatibility. */
8
+ role?: LegacyProviderRole;
7
9
  enabled?: boolean;
8
10
  showTokenizer?: boolean;
9
11
  /**
@@ -17,10 +19,11 @@ export interface ICopilot extends IBasePerTenantAndOrganizationEntityModel {
17
19
  modelProvider?: ICopilotProvider;
18
20
  copilotModel?: ICopilotModel;
19
21
  usage?: TCopilotTokenUsage;
22
+ /** Explicit role defaults projected into the public catalog, independent of the legacy connection role. */
23
+ defaultModels?: Partial<Record<DefaultModelRole, ICopilotModel>>;
24
+ configuredDefaultRoles?: DefaultModelRole[];
20
25
  }
21
- /**
22
- * The order of priority is: `Embedding`, `Secondary`, `Primary`
23
- */
26
+ /** @deprecated Use DefaultModelRole for default assignments; connections have no default purpose. */
24
27
  export declare enum AiProviderRole {
25
28
  Primary = "primary",
26
29
  Secondary = "secondary",
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { AiModelTypeEnum } from '../agent/ai-model';
3
+ /** A default assignment's purpose, independent of connection identity and model type. */
4
+ export declare const DefaultModelRole: {
5
+ readonly Primary: "primary";
6
+ readonly Secondary: "secondary";
7
+ readonly Reasoning: "reasoning";
8
+ readonly Embedding: "embedding";
9
+ readonly Realtime: "realtime";
10
+ readonly TextToSpeech: "tts";
11
+ readonly SpeechToText: "speech2text";
12
+ readonly ImageGeneration: "image";
13
+ readonly VideoGeneration: "video";
14
+ readonly Rerank: "rerank";
15
+ readonly Moderation: "moderation";
16
+ };
17
+ export declare const defaultModelRoleSchema: z.ZodNativeEnum<{
18
+ readonly Primary: "primary";
19
+ readonly Secondary: "secondary";
20
+ readonly Reasoning: "reasoning";
21
+ readonly Embedding: "embedding";
22
+ readonly Realtime: "realtime";
23
+ readonly TextToSpeech: "tts";
24
+ readonly SpeechToText: "speech2text";
25
+ readonly ImageGeneration: "image";
26
+ readonly VideoGeneration: "video";
27
+ readonly Rerank: "rerank";
28
+ readonly Moderation: "moderation";
29
+ }>;
30
+ export type DefaultModelRole = z.output<typeof defaultModelRoleSchema>;
31
+ export declare const legacyProviderRoleSchema: z.ZodEnum<["primary", "secondary", "reasoning", "embedding"]>;
32
+ export type LegacyProviderRole = z.output<typeof legacyProviderRoleSchema>;
33
+ export interface DefaultModelDefinition {
34
+ role: DefaultModelRole;
35
+ modelType: AiModelTypeEnum;
36
+ group: 'roles' | 'types';
37
+ /** Only the compatibility adapter may use this legacy connection field. */
38
+ legacyRole?: LegacyProviderRole;
39
+ }
40
+ export declare const DEFAULT_MODEL_DEFINITIONS: readonly DefaultModelDefinition[];
41
+ export declare function defaultModelDefinition(role: DefaultModelRole): DefaultModelDefinition;