@xpert-ai/contracts 3.21.1 → 3.21.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/contracts",
3
- "version": "3.21.1",
3
+ "version": "3.21.2",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,6 +2,7 @@ import { AiModelTypeEnum } from '../agent';
2
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
3
  import { IAiProviderEntity } from './ai-model.model';
4
4
  import { ICopilot } from './copilot.model';
5
+ import type { ModelConfiguration, ModelDiscoveryState } from './model-discovery.model';
5
6
  export interface ICopilotProvider extends IBasePerTenantAndOrganizationEntityModel {
6
7
  providerName?: string;
7
8
  providerType?: string;
@@ -13,7 +14,9 @@ export interface ICopilotProvider extends IBasePerTenantAndOrganizationEntityMod
13
14
  quotaUsed?: number;
14
15
  /**
15
16
  */
16
- options?: any;
17
+ options?: Record<string, unknown> & {
18
+ modelDiscovery?: ModelDiscoveryState;
19
+ };
17
20
  copilot?: ICopilot;
18
21
  copilotId?: string;
19
22
  models?: ICopilotProviderModel[];
@@ -23,7 +26,11 @@ export interface ICopilotProviderModel extends IBasePerTenantAndOrganizationEnti
23
26
  providerName?: string;
24
27
  modelName?: string;
25
28
  modelType?: AiModelTypeEnum;
26
- modelProperties?: Record<string, any>;
29
+ modelProperties?: Record<string, any> & {
30
+ model_configuration?: ModelConfiguration;
31
+ discovery_model_id?: string;
32
+ configuration_source?: 'discovered' | 'manual';
33
+ };
27
34
  isValid?: boolean;
28
35
  provider?: ICopilotProvider;
29
36
  providerId?: string;
@@ -89,7 +89,7 @@ export declare const executionActivityItemSchema: z.ZodObject<{
89
89
  }[];
90
90
  }>]>>;
91
91
  }, "strict", z.ZodTypeAny, {
92
- status?: "succeeded" | "failed" | "running" | "unknown";
92
+ status?: "unknown" | "succeeded" | "failed" | "running";
93
93
  name?: string;
94
94
  input?: string;
95
95
  output?: string;
@@ -114,7 +114,7 @@ export declare const executionActivityItemSchema: z.ZodObject<{
114
114
  key?: string;
115
115
  };
116
116
  }, {
117
- status?: "succeeded" | "failed" | "running" | "unknown";
117
+ status?: "unknown" | "succeeded" | "failed" | "running";
118
118
  name?: string;
119
119
  input?: string;
120
120
  output?: string;
@@ -157,7 +157,7 @@ export declare const executionActivityItemSchema: z.ZodObject<{
157
157
  text?: string;
158
158
  kind?: "message";
159
159
  } | {
160
- status?: "succeeded" | "failed" | "running" | "unknown";
160
+ status?: "unknown" | "succeeded" | "failed" | "running";
161
161
  name?: string;
162
162
  input?: string;
163
163
  output?: string;
@@ -193,7 +193,7 @@ export declare const executionActivityItemSchema: z.ZodObject<{
193
193
  text?: string;
194
194
  kind?: "message";
195
195
  } | {
196
- status?: "succeeded" | "failed" | "running" | "unknown";
196
+ status?: "unknown" | "succeeded" | "failed" | "running";
197
197
  name?: string;
198
198
  input?: string;
199
199
  output?: string;
@@ -304,7 +304,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
304
304
  }[];
305
305
  }>]>>;
306
306
  }, "strict", z.ZodTypeAny, {
307
- status?: "succeeded" | "failed" | "running" | "unknown";
307
+ status?: "unknown" | "succeeded" | "failed" | "running";
308
308
  name?: string;
309
309
  input?: string;
310
310
  output?: string;
@@ -329,7 +329,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
329
329
  key?: string;
330
330
  };
331
331
  }, {
332
- status?: "succeeded" | "failed" | "running" | "unknown";
332
+ status?: "unknown" | "succeeded" | "failed" | "running";
333
333
  name?: string;
334
334
  input?: string;
335
335
  output?: string;
@@ -372,7 +372,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
372
372
  text?: string;
373
373
  kind?: "message";
374
374
  } | {
375
- status?: "succeeded" | "failed" | "running" | "unknown";
375
+ status?: "unknown" | "succeeded" | "failed" | "running";
376
376
  name?: string;
377
377
  input?: string;
378
378
  output?: string;
@@ -408,7 +408,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
408
408
  text?: string;
409
409
  kind?: "message";
410
410
  } | {
411
- status?: "succeeded" | "failed" | "running" | "unknown";
411
+ status?: "unknown" | "succeeded" | "failed" | "running";
412
412
  name?: string;
413
413
  input?: string;
414
414
  output?: string;
@@ -451,7 +451,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
451
451
  text?: string;
452
452
  kind?: "message";
453
453
  } | {
454
- status?: "succeeded" | "failed" | "running" | "unknown";
454
+ status?: "unknown" | "succeeded" | "failed" | "running";
455
455
  name?: string;
456
456
  input?: string;
457
457
  output?: string;
@@ -493,7 +493,7 @@ export declare const executionActivityBatchSchema: z.ZodObject<{
493
493
  text?: string;
494
494
  kind?: "message";
495
495
  } | {
496
- status?: "succeeded" | "failed" | "running" | "unknown";
496
+ status?: "unknown" | "succeeded" | "failed" | "running";
497
497
  name?: string;
498
498
  input?: string;
499
499
  output?: string;
package/src/ai/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from './assistant-order';
13
13
  export * from './assistant-model.model';
14
14
  export * from './assistant-user-preference.model';
15
15
  export * from './ai-model.model';
16
+ export * from './model-discovery.model';
16
17
  export * from './ai.model';
17
18
  export * from './chat-event.model';
18
19
  export { createResourceCardContent, isResourceCardContent, parseResourceCard, parseResourceCardContent, resourceCardId, upsertResourceCardContent } from './resource-card';
@@ -0,0 +1,363 @@
1
+ import { z } from 'zod';
2
+ import { AiModelTypeEnum } from '../agent/ai-model';
3
+ import { AIModelEntity, ModelFeature, ProviderModel } from './ai-model.model';
4
+ import type { ICopilotProvider, ICopilotProviderModel } from './copilot-provider.model';
5
+ export declare const discoverableModelTypes: readonly [AiModelTypeEnum.LLM, AiModelTypeEnum.TEXT_EMBEDDING, AiModelTypeEnum.RERANK];
6
+ export type DiscoverableModelType = (typeof discoverableModelTypes)[number];
7
+ /** Saved model configuration is explicit; name heuristics are only discovery suggestions. */
8
+ export declare const modelConfigurationSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"modelType", [z.ZodObject<{
9
+ maxOutputTokens: z.ZodNumber;
10
+ defaultMaxTokens: z.ZodNumber;
11
+ features: z.ZodArray<z.ZodNativeEnum<typeof ModelFeature>, "many">;
12
+ contextSize: z.ZodNumber;
13
+ maxConcurrency: z.ZodNumber;
14
+ modelType: z.ZodLiteral<AiModelTypeEnum.LLM>;
15
+ }, "strict", z.ZodTypeAny, {
16
+ modelType?: AiModelTypeEnum.LLM;
17
+ maxOutputTokens?: number;
18
+ defaultMaxTokens?: number;
19
+ features?: ModelFeature[];
20
+ contextSize?: number;
21
+ maxConcurrency?: number;
22
+ }, {
23
+ modelType?: AiModelTypeEnum.LLM;
24
+ maxOutputTokens?: number;
25
+ defaultMaxTokens?: number;
26
+ features?: ModelFeature[];
27
+ contextSize?: number;
28
+ maxConcurrency?: number;
29
+ }>, z.ZodObject<{
30
+ dimensions: z.ZodOptional<z.ZodNumber>;
31
+ batchSize: z.ZodNumber;
32
+ contextSize: z.ZodNumber;
33
+ maxConcurrency: z.ZodNumber;
34
+ modelType: z.ZodLiteral<AiModelTypeEnum.TEXT_EMBEDDING>;
35
+ }, "strict", z.ZodTypeAny, {
36
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
37
+ contextSize?: number;
38
+ maxConcurrency?: number;
39
+ dimensions?: number;
40
+ batchSize?: number;
41
+ }, {
42
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
43
+ contextSize?: number;
44
+ maxConcurrency?: number;
45
+ dimensions?: number;
46
+ batchSize?: number;
47
+ }>, z.ZodObject<{
48
+ contextSize: z.ZodNumber;
49
+ maxConcurrency: z.ZodNumber;
50
+ modelType: z.ZodLiteral<AiModelTypeEnum.RERANK>;
51
+ }, "strict", z.ZodTypeAny, {
52
+ modelType?: AiModelTypeEnum.RERANK;
53
+ contextSize?: number;
54
+ maxConcurrency?: number;
55
+ }, {
56
+ modelType?: AiModelTypeEnum.RERANK;
57
+ contextSize?: number;
58
+ maxConcurrency?: number;
59
+ }>]>, {
60
+ modelType?: AiModelTypeEnum.LLM;
61
+ maxOutputTokens?: number;
62
+ defaultMaxTokens?: number;
63
+ features?: ModelFeature[];
64
+ contextSize?: number;
65
+ maxConcurrency?: number;
66
+ } | {
67
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
68
+ contextSize?: number;
69
+ maxConcurrency?: number;
70
+ dimensions?: number;
71
+ batchSize?: number;
72
+ } | {
73
+ modelType?: AiModelTypeEnum.RERANK;
74
+ contextSize?: number;
75
+ maxConcurrency?: number;
76
+ }, {
77
+ modelType?: AiModelTypeEnum.LLM;
78
+ maxOutputTokens?: number;
79
+ defaultMaxTokens?: number;
80
+ features?: ModelFeature[];
81
+ contextSize?: number;
82
+ maxConcurrency?: number;
83
+ } | {
84
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
85
+ contextSize?: number;
86
+ maxConcurrency?: number;
87
+ dimensions?: number;
88
+ batchSize?: number;
89
+ } | {
90
+ modelType?: AiModelTypeEnum.RERANK;
91
+ contextSize?: number;
92
+ maxConcurrency?: number;
93
+ }>;
94
+ export type ModelConfiguration = z.output<typeof modelConfigurationSchema>;
95
+ export declare function defaultModelConfiguration(modelType: DiscoverableModelType): ModelConfiguration;
96
+ /** Start with editable defaults and overlay the matching built-in YAML values. */
97
+ export declare function configurationFromModel(modelType: ModelConfiguration['modelType'], model?: Partial<AIModelEntity>): ModelConfiguration;
98
+ export declare function isDiscoverableModelType(value: unknown): value is DiscoverableModelType;
99
+ /** Parse the persisted JSON field once when entering the model configuration boundary. */
100
+ export declare function readModelConfiguration(properties?: {
101
+ model_configuration?: unknown;
102
+ } | null): ModelConfiguration | undefined;
103
+ export interface DiscoveredModel {
104
+ /** Exact ID returned by the upstream discovery endpoint. */
105
+ model: string;
106
+ label: string;
107
+ modelType: DiscoverableModelType | null;
108
+ typeSource: 'provider' | 'catalog' | 'name' | 'unknown';
109
+ configuration?: ModelConfiguration;
110
+ /** Adapter-owned, non-secret settings such as an exact endpoint model ID or rerank path. */
111
+ modelProperties?: Record<string, string | number | boolean>;
112
+ }
113
+ /** Last successful, explicitly saved account catalog; failed previews never change it. */
114
+ export interface ModelDiscoveryState {
115
+ mode: 'configured';
116
+ syncedAt: string;
117
+ availableModelIds: string[];
118
+ }
119
+ export type ProviderModelSource = 'builtin' | 'discovered' | 'manual';
120
+ export declare function configuredModelSource(model: Pick<ICopilotProviderModel, 'modelProperties'>): Exclude<ProviderModelSource, 'builtin'>;
121
+ export declare function usesConfiguredModelCatalog(provider: Pick<ICopilotProvider, 'options'>): boolean;
122
+ /** Shared by management UI, pickers and execution authorization. Manual additions remain explicit opt-ins. */
123
+ export declare function isConfiguredModelAvailable(provider: Pick<ICopilotProvider, 'options'>, model?: Pick<ICopilotProviderModel, 'modelProperties'> | null): boolean;
124
+ export interface ModelDiscoveryItem extends DiscoveredModel {
125
+ configured: boolean;
126
+ configuredModelId?: string;
127
+ source: Exclude<ProviderModelSource, 'builtin'>;
128
+ available: boolean;
129
+ }
130
+ export interface ModelDiscoveryResult {
131
+ models: ModelDiscoveryItem[];
132
+ }
133
+ export interface ProviderModelCatalog {
134
+ custom: ICopilotProviderModel[];
135
+ /** Reference metadata, not proof of account access. */
136
+ builtin: Array<ProviderModel & Partial<Pick<AIModelEntity, 'parameter_rules'>>>;
137
+ discoverySupported: boolean;
138
+ modelDiscovery?: ModelDiscoveryState;
139
+ }
140
+ export declare const modelImportSchema: z.ZodEffects<z.ZodObject<{
141
+ models: z.ZodArray<z.ZodObject<{
142
+ model: z.ZodString;
143
+ configuration: z.ZodEffects<z.ZodDiscriminatedUnion<"modelType", [z.ZodObject<{
144
+ maxOutputTokens: z.ZodNumber;
145
+ defaultMaxTokens: z.ZodNumber;
146
+ features: z.ZodArray<z.ZodNativeEnum<typeof ModelFeature>, "many">;
147
+ contextSize: z.ZodNumber;
148
+ maxConcurrency: z.ZodNumber;
149
+ modelType: z.ZodLiteral<AiModelTypeEnum.LLM>;
150
+ }, "strict", z.ZodTypeAny, {
151
+ modelType?: AiModelTypeEnum.LLM;
152
+ maxOutputTokens?: number;
153
+ defaultMaxTokens?: number;
154
+ features?: ModelFeature[];
155
+ contextSize?: number;
156
+ maxConcurrency?: number;
157
+ }, {
158
+ modelType?: AiModelTypeEnum.LLM;
159
+ maxOutputTokens?: number;
160
+ defaultMaxTokens?: number;
161
+ features?: ModelFeature[];
162
+ contextSize?: number;
163
+ maxConcurrency?: number;
164
+ }>, z.ZodObject<{
165
+ dimensions: z.ZodOptional<z.ZodNumber>;
166
+ batchSize: z.ZodNumber;
167
+ contextSize: z.ZodNumber;
168
+ maxConcurrency: z.ZodNumber;
169
+ modelType: z.ZodLiteral<AiModelTypeEnum.TEXT_EMBEDDING>;
170
+ }, "strict", z.ZodTypeAny, {
171
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
172
+ contextSize?: number;
173
+ maxConcurrency?: number;
174
+ dimensions?: number;
175
+ batchSize?: number;
176
+ }, {
177
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
178
+ contextSize?: number;
179
+ maxConcurrency?: number;
180
+ dimensions?: number;
181
+ batchSize?: number;
182
+ }>, z.ZodObject<{
183
+ contextSize: z.ZodNumber;
184
+ maxConcurrency: z.ZodNumber;
185
+ modelType: z.ZodLiteral<AiModelTypeEnum.RERANK>;
186
+ }, "strict", z.ZodTypeAny, {
187
+ modelType?: AiModelTypeEnum.RERANK;
188
+ contextSize?: number;
189
+ maxConcurrency?: number;
190
+ }, {
191
+ modelType?: AiModelTypeEnum.RERANK;
192
+ contextSize?: number;
193
+ maxConcurrency?: number;
194
+ }>]>, {
195
+ modelType?: AiModelTypeEnum.LLM;
196
+ maxOutputTokens?: number;
197
+ defaultMaxTokens?: number;
198
+ features?: ModelFeature[];
199
+ contextSize?: number;
200
+ maxConcurrency?: number;
201
+ } | {
202
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
203
+ contextSize?: number;
204
+ maxConcurrency?: number;
205
+ dimensions?: number;
206
+ batchSize?: number;
207
+ } | {
208
+ modelType?: AiModelTypeEnum.RERANK;
209
+ contextSize?: number;
210
+ maxConcurrency?: number;
211
+ }, {
212
+ modelType?: AiModelTypeEnum.LLM;
213
+ maxOutputTokens?: number;
214
+ defaultMaxTokens?: number;
215
+ features?: ModelFeature[];
216
+ contextSize?: number;
217
+ maxConcurrency?: number;
218
+ } | {
219
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
220
+ contextSize?: number;
221
+ maxConcurrency?: number;
222
+ dimensions?: number;
223
+ batchSize?: number;
224
+ } | {
225
+ modelType?: AiModelTypeEnum.RERANK;
226
+ contextSize?: number;
227
+ maxConcurrency?: number;
228
+ }>;
229
+ }, "strict", z.ZodTypeAny, {
230
+ model?: string;
231
+ configuration?: {
232
+ modelType?: AiModelTypeEnum.LLM;
233
+ maxOutputTokens?: number;
234
+ defaultMaxTokens?: number;
235
+ features?: ModelFeature[];
236
+ contextSize?: number;
237
+ maxConcurrency?: number;
238
+ } | {
239
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
240
+ contextSize?: number;
241
+ maxConcurrency?: number;
242
+ dimensions?: number;
243
+ batchSize?: number;
244
+ } | {
245
+ modelType?: AiModelTypeEnum.RERANK;
246
+ contextSize?: number;
247
+ maxConcurrency?: number;
248
+ };
249
+ }, {
250
+ model?: string;
251
+ configuration?: {
252
+ modelType?: AiModelTypeEnum.LLM;
253
+ maxOutputTokens?: number;
254
+ defaultMaxTokens?: number;
255
+ features?: ModelFeature[];
256
+ contextSize?: number;
257
+ maxConcurrency?: number;
258
+ } | {
259
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
260
+ contextSize?: number;
261
+ maxConcurrency?: number;
262
+ dimensions?: number;
263
+ batchSize?: number;
264
+ } | {
265
+ modelType?: AiModelTypeEnum.RERANK;
266
+ contextSize?: number;
267
+ maxConcurrency?: number;
268
+ };
269
+ }>, "many">;
270
+ }, "strict", z.ZodTypeAny, {
271
+ models?: {
272
+ model?: string;
273
+ configuration?: {
274
+ modelType?: AiModelTypeEnum.LLM;
275
+ maxOutputTokens?: number;
276
+ defaultMaxTokens?: number;
277
+ features?: ModelFeature[];
278
+ contextSize?: number;
279
+ maxConcurrency?: number;
280
+ } | {
281
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
282
+ contextSize?: number;
283
+ maxConcurrency?: number;
284
+ dimensions?: number;
285
+ batchSize?: number;
286
+ } | {
287
+ modelType?: AiModelTypeEnum.RERANK;
288
+ contextSize?: number;
289
+ maxConcurrency?: number;
290
+ };
291
+ }[];
292
+ }, {
293
+ models?: {
294
+ model?: string;
295
+ configuration?: {
296
+ modelType?: AiModelTypeEnum.LLM;
297
+ maxOutputTokens?: number;
298
+ defaultMaxTokens?: number;
299
+ features?: ModelFeature[];
300
+ contextSize?: number;
301
+ maxConcurrency?: number;
302
+ } | {
303
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
304
+ contextSize?: number;
305
+ maxConcurrency?: number;
306
+ dimensions?: number;
307
+ batchSize?: number;
308
+ } | {
309
+ modelType?: AiModelTypeEnum.RERANK;
310
+ contextSize?: number;
311
+ maxConcurrency?: number;
312
+ };
313
+ }[];
314
+ }>, {
315
+ models?: {
316
+ model?: string;
317
+ configuration?: {
318
+ modelType?: AiModelTypeEnum.LLM;
319
+ maxOutputTokens?: number;
320
+ defaultMaxTokens?: number;
321
+ features?: ModelFeature[];
322
+ contextSize?: number;
323
+ maxConcurrency?: number;
324
+ } | {
325
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
326
+ contextSize?: number;
327
+ maxConcurrency?: number;
328
+ dimensions?: number;
329
+ batchSize?: number;
330
+ } | {
331
+ modelType?: AiModelTypeEnum.RERANK;
332
+ contextSize?: number;
333
+ maxConcurrency?: number;
334
+ };
335
+ }[];
336
+ }, {
337
+ models?: {
338
+ model?: string;
339
+ configuration?: {
340
+ modelType?: AiModelTypeEnum.LLM;
341
+ maxOutputTokens?: number;
342
+ defaultMaxTokens?: number;
343
+ features?: ModelFeature[];
344
+ contextSize?: number;
345
+ maxConcurrency?: number;
346
+ } | {
347
+ modelType?: AiModelTypeEnum.TEXT_EMBEDDING;
348
+ contextSize?: number;
349
+ maxConcurrency?: number;
350
+ dimensions?: number;
351
+ batchSize?: number;
352
+ } | {
353
+ modelType?: AiModelTypeEnum.RERANK;
354
+ contextSize?: number;
355
+ maxConcurrency?: number;
356
+ };
357
+ }[];
358
+ }>;
359
+ export type ModelImportInput = z.output<typeof modelImportSchema>;
360
+ export interface ModelImportResult {
361
+ added: number;
362
+ skipped: number;
363
+ }
@@ -607,13 +607,13 @@ export declare const projectTaskDispatchReceiptSchema: z.ZodObject<{
607
607
  invocationId: z.ZodString;
608
608
  status: z.ZodEnum<["queued", "running", "waiting", "cancelling", "succeeded", "failed", "cancelled", "unknown"]>;
609
609
  }, "strict", z.ZodTypeAny, {
610
- status?: "succeeded" | "failed" | "running" | "unknown" | "queued" | "waiting" | "cancelled" | "cancelling";
610
+ status?: "unknown" | "succeeded" | "failed" | "running" | "queued" | "waiting" | "cancelled" | "cancelling";
611
611
  projectId?: string;
612
612
  invocationId?: string;
613
613
  projectTaskId?: string;
614
614
  taskExecutionId?: string;
615
615
  }, {
616
- status?: "succeeded" | "failed" | "running" | "unknown" | "queued" | "waiting" | "cancelled" | "cancelling";
616
+ status?: "unknown" | "succeeded" | "failed" | "running" | "queued" | "waiting" | "cancelled" | "cancelling";
617
617
  projectId?: string;
618
618
  invocationId?: string;
619
619
  projectTaskId?: string;
@@ -168,6 +168,7 @@ export interface IXpertProject extends TXpertProject, IBasePerTenantAndOrganizat
168
168
  xperts?: IXpert[];
169
169
  toolsets?: IXpertToolset[];
170
170
  knowledges?: IKnowledgebase[];
171
+ /** @deprecated Legacy relation. Use memberships and the Project membership API for access management. */
171
172
  members?: IUser[];
172
173
  memberships?: IXpertProjectMembership[];
173
174
  /**
@@ -11,6 +11,9 @@ export interface IPlugin extends IBasePerTenantAndOrganizationEntityModel {
11
11
  source?: PluginSource;
12
12
  sourceConfig?: PluginSourceConfig | null;
13
13
  level?: PluginLevel;
14
+ meta?: PluginMeta | null;
15
+ /** Persisted installation intent; live runtime reports determine actual availability. */
16
+ pendingRestart?: boolean;
14
17
  config: Record<string, any>;
15
18
  configurationStatus?: PluginConfigurationStatus | null;
16
19
  configurationError?: string | null;
package/src/plugin.d.ts CHANGED
@@ -29,6 +29,7 @@ export declare const PLUGIN_CONFIGURATION_STATUS: {
29
29
  };
30
30
  export declare const PLUGIN_LOAD_STATUS: {
31
31
  readonly LOADED: "loaded";
32
+ readonly PENDING_RESTART: "pending_restart";
32
33
  readonly FAILED: "failed";
33
34
  };
34
35
  export declare const PLUGIN_COMPONENT_TYPE: {
@@ -72,7 +73,7 @@ export declare const PLUGIN_RESOURCE_ERROR_CODE: {
72
73
  /**
73
74
  * Classifies plugin scope and governance.
74
75
  * - `system`: built-in/platform-managed plugin that users cannot install/uninstall from org APIs.
75
- * - `tenant`: tenant-owned plugin that may register process-global runtime artifacts and is activated after an API restart.
76
+ * - `tenant`: tenant-owned plugin shared across organizations in its owning tenant.
76
77
  * - `organization`: tenant/org-managed plugin that can be installed and removed per organization.
77
78
  */
78
79
  export type PluginLevel = (typeof PLUGIN_LEVEL)[keyof typeof PLUGIN_LEVEL];
@@ -309,7 +310,14 @@ export interface PluginCodeSourceConfig {
309
310
  export interface PluginSourceConfig extends PluginCodeSourceConfig {
310
311
  [key: string]: unknown;
311
312
  }
313
+ export interface PluginRuntimePolicy {
314
+ install: 'hot' | 'restart';
315
+ update: 'hot' | 'restart';
316
+ uninstall: 'hot' | 'restart';
317
+ }
312
318
  export interface PluginMeta {
319
+ /** Explicit lifecycle support, independent of scope. Declared in package.json xpert.plugin. */
320
+ runtimePolicy?: PluginRuntimePolicy;
313
321
  name: PluginName;
314
322
  version: string;
315
323
  /**
@@ -6,7 +6,7 @@ export interface IRuntimeStreamInterruption {
6
6
  message: string;
7
7
  }
8
8
  export type RuntimeRestartMode = 'self-signal' | 'rolling-self-signal';
9
- export type RuntimeRestartStatus = 'in_progress' | 'completed' | 'failed';
9
+ export type RuntimeRestartStatus = 'in_progress' | 'completed' | 'failed' | 'awaiting_restart';
10
10
  export interface IRuntimePluginRequirement {
11
11
  scopeKey: string;
12
12
  pluginName: string;
@@ -29,6 +29,8 @@ export interface IRuntimeRestartRequest {
29
29
  confirmation: typeof RUNTIME_RESTART_CONFIRMATION;
30
30
  /** Optional non-sensitive reason written to the structured server audit log. */
31
31
  reason?: string;
32
+ /** Explicitly permit restarting the last healthy replica during an operator-approved outage. Defaults to false. */
33
+ allowDowntime?: boolean;
32
34
  /** Plugin runtime state that every replacement process must confirm after boot. */
33
35
  runtimeRequirements?: IRuntimePluginRequirement[];
34
36
  }
@@ -64,7 +66,7 @@ export interface IPluginRuntimeConvergenceStatus {
64
66
  error?: string;
65
67
  }
66
68
  export interface IRuntimeReadiness {
67
- status: 'ready' | 'draining';
69
+ status: 'ready' | 'draining' | 'unready';
68
70
  instanceId: string;
69
71
  activeRequests: number;
70
72
  restartId?: string;