@xpert-ai/contracts 3.27.0 → 3.28.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.
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod';
2
+ /** Internal boot capabilities. Online/readiness and execution settlement remain separate facts. */
3
+ export declare const executionControlProtocols: {
4
+ readonly taskControl: 2;
5
+ readonly managedQueue: 3;
6
+ readonly threadControlView: 1;
7
+ readonly mcpControl: 1;
8
+ readonly sandboxControl: 1;
9
+ readonly invocationEvidence: 2;
10
+ };
11
+ export type ExecutionControlCapability = keyof typeof executionControlProtocols;
12
+ export declare const controlledHandlerSchema: z.ZodObject<{
13
+ pluginName: z.ZodString;
14
+ queueName: z.ZodString;
15
+ jobName: z.ZodString;
16
+ scopeKey: z.ZodNullable<z.ZodString>;
17
+ controlContract: z.ZodString;
18
+ }, "strict", z.ZodTypeAny, {
19
+ pluginName?: string;
20
+ scopeKey?: string;
21
+ queueName?: string;
22
+ jobName?: string;
23
+ controlContract?: string;
24
+ }, {
25
+ pluginName?: string;
26
+ scopeKey?: string;
27
+ queueName?: string;
28
+ jobName?: string;
29
+ controlContract?: string;
30
+ }>;
31
+ export type ControlledHandlerCapability = z.infer<typeof controlledHandlerSchema>;
32
+ export declare const executionControlCapabilitiesSchema: z.ZodObject<{
33
+ version: z.ZodLiteral<1>;
34
+ validUntil: z.ZodNumber;
35
+ protocols: z.ZodObject<{
36
+ taskControl: z.ZodOptional<z.ZodLiteral<2>>;
37
+ managedQueue: z.ZodOptional<z.ZodLiteral<3>>;
38
+ threadControlView: z.ZodOptional<z.ZodLiteral<1>>;
39
+ mcpControl: z.ZodOptional<z.ZodLiteral<1>>;
40
+ sandboxControl: z.ZodOptional<z.ZodLiteral<1>>;
41
+ invocationEvidence: z.ZodOptional<z.ZodLiteral<2>>;
42
+ }, "strict", z.ZodTypeAny, {
43
+ taskControl?: 2;
44
+ managedQueue?: 3;
45
+ threadControlView?: 1;
46
+ mcpControl?: 1;
47
+ sandboxControl?: 1;
48
+ invocationEvidence?: 2;
49
+ }, {
50
+ taskControl?: 2;
51
+ managedQueue?: 3;
52
+ threadControlView?: 1;
53
+ mcpControl?: 1;
54
+ sandboxControl?: 1;
55
+ invocationEvidence?: 2;
56
+ }>;
57
+ queuePrefix: z.ZodString;
58
+ queuePools: z.ZodArray<z.ZodEnum<["default", "sandbox-browser"]>, "many">;
59
+ handlers: z.ZodArray<z.ZodObject<{
60
+ pluginName: z.ZodString;
61
+ queueName: z.ZodString;
62
+ jobName: z.ZodString;
63
+ scopeKey: z.ZodNullable<z.ZodString>;
64
+ controlContract: z.ZodString;
65
+ }, "strict", z.ZodTypeAny, {
66
+ pluginName?: string;
67
+ scopeKey?: string;
68
+ queueName?: string;
69
+ jobName?: string;
70
+ controlContract?: string;
71
+ }, {
72
+ pluginName?: string;
73
+ scopeKey?: string;
74
+ queueName?: string;
75
+ jobName?: string;
76
+ controlContract?: string;
77
+ }>, "many">;
78
+ }, "strict", z.ZodTypeAny, {
79
+ version?: 1;
80
+ validUntil?: number;
81
+ protocols?: {
82
+ taskControl?: 2;
83
+ managedQueue?: 3;
84
+ threadControlView?: 1;
85
+ mcpControl?: 1;
86
+ sandboxControl?: 1;
87
+ invocationEvidence?: 2;
88
+ };
89
+ queuePrefix?: string;
90
+ queuePools?: ("default" | "sandbox-browser")[];
91
+ handlers?: {
92
+ pluginName?: string;
93
+ scopeKey?: string;
94
+ queueName?: string;
95
+ jobName?: string;
96
+ controlContract?: string;
97
+ }[];
98
+ }, {
99
+ version?: 1;
100
+ validUntil?: number;
101
+ protocols?: {
102
+ taskControl?: 2;
103
+ managedQueue?: 3;
104
+ threadControlView?: 1;
105
+ mcpControl?: 1;
106
+ sandboxControl?: 1;
107
+ invocationEvidence?: 2;
108
+ };
109
+ queuePrefix?: string;
110
+ queuePools?: ("default" | "sandbox-browser")[];
111
+ handlers?: {
112
+ pluginName?: string;
113
+ scopeKey?: string;
114
+ queueName?: string;
115
+ jobName?: string;
116
+ controlContract?: string;
117
+ }[];
118
+ }>;
119
+ export type ExecutionControlCapabilities = z.infer<typeof executionControlCapabilitiesSchema>;
package/src/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
+ export * from './task-control.model';
2
+ export * from './execution-control-admission.schema';
1
3
  export * from './types';
4
+ export * from './ai/sandbox-execution-control.schema';
2
5
  export * from './ai/project-task-graph.model';
3
6
  export * from './ai/project-task-type.model';
4
7
  export * from './ai/project-task-schedule';
@@ -81,3 +84,9 @@ export * from './assistant-sharing.model';
81
84
  export * from './artifact-presentation.model';
82
85
  export * from './analytics-definition.model';
83
86
  export * from './data-retention.model';
87
+ export * from './content-resource.model';
88
+ export * from './ai/mcp-execution-control.schema';
89
+ export * from './ai/thread-control-view.schema';
90
+ export * from './ai/thread-control-projection.model';
91
+ export * from './ai/mcp-operation.model';
92
+ export * from './ai/mcp-task.schema';
@@ -242,6 +242,7 @@ export interface PluginApplicationCompositionItem {
242
242
  title: string | I18nObject;
243
243
  }
244
244
  export interface PluginApplicationDetail {
245
+ canUpdate?: boolean;
245
246
  composition: PluginApplicationCompositionItem[];
246
247
  application: PluginTemplateApplicationSummary;
247
248
  status: PluginApplicationStatusSummary;
@@ -275,3 +276,20 @@ export interface PluginApplicationBindToolsetInput extends PluginApplicationSetu
275
276
  /** Validate portable metadata without inferring a scope from names or presentation text. */
276
277
  export declare function getPluginApplicationScopes(value: unknown): PluginApplicationScope[];
277
278
  export declare function isPluginApplicationScope(value: unknown): value is PluginApplicationScope;
279
+ /** A scoped, durable release; clients never select resource IDs or template versions. */
280
+ export interface PluginApplicationUpdateInput extends PluginApplicationSetupInput {
281
+ operationId: string;
282
+ resume?: boolean;
283
+ }
284
+ export interface PluginApplicationUpdateProgress {
285
+ operationId: string;
286
+ status: 'running' | 'failed' | 'completed';
287
+ updatedAt: string;
288
+ errorCode: 'UPDATE_FAILED' | null;
289
+ completed: number;
290
+ total: number;
291
+ entries: Array<{
292
+ key: string;
293
+ stage: 'pending' | 'preparing' | 'prepared' | 'binding' | 'publishing' | 'published';
294
+ }>;
295
+ }
@@ -19,6 +19,13 @@ export interface IRuntimePluginRequirement {
19
19
  export interface IPluginRuntimeConvergence {
20
20
  generation: number;
21
21
  }
22
+ /** Durable cluster target, independent of expiring operation history. */
23
+ export interface IPluginRuntimeSnapshot {
24
+ generation: number;
25
+ status: RuntimeRestartStatus | null;
26
+ requirements: IRuntimePluginRequirement[];
27
+ activeRestartId?: string;
28
+ }
22
29
  export type RuntimeRestartCapabilityReason = 'allowed' | 'interactive-auth-required' | 'super-admin-required' | 'default-tenant-required';
23
30
  export interface IRuntimeRestartCapability {
24
31
  allowed: boolean;
@@ -34,6 +41,8 @@ export interface IRuntimeRestartRequest {
34
41
  allowDowntime?: boolean;
35
42
  /** Plugin runtime state that every replacement process must confirm after boot. */
36
43
  runtimeRequirements?: IRuntimePluginRequirement[];
44
+ /** Compare-and-set fence for publishing an approved plugin restart. */
45
+ expectedGeneration?: number;
37
46
  }
38
47
  export interface IRuntimeRestartResponse {
39
48
  accepted: true;
@@ -1,3 +1,4 @@
1
+ import { z } from 'zod';
1
2
  import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
3
  import type { TEnterpriseH5Platform } from './ai/xpert.model';
3
4
  /** Enterprise channel and integration to which an H5 session token is bound. */
@@ -5,6 +6,36 @@ export type TEnterpriseH5TokenScope = {
5
6
  platform: TEnterpriseH5Platform;
6
7
  integrationId: string;
7
8
  };
9
+ /** Immutable authorization source; live access is rechecked on every delegated request. */
10
+ export declare const clientSecretGrantSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
11
+ kind: z.ZodLiteral<"assistant">;
12
+ }, "strict", z.ZodTypeAny, {
13
+ kind?: "assistant";
14
+ }, {
15
+ kind?: "assistant";
16
+ }>, z.ZodObject<{
17
+ kind: z.ZodLiteral<"project">;
18
+ projectId: z.ZodString;
19
+ }, "strict", z.ZodTypeAny, {
20
+ kind?: "project";
21
+ projectId?: string;
22
+ }, {
23
+ kind?: "project";
24
+ projectId?: string;
25
+ }>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"conversation">;
27
+ conversationId: z.ZodString;
28
+ requesterXpertId: z.ZodString;
29
+ }, "strict", z.ZodTypeAny, {
30
+ kind?: "conversation";
31
+ conversationId?: string;
32
+ requesterXpertId?: string;
33
+ }, {
34
+ kind?: "conversation";
35
+ conversationId?: string;
36
+ requesterXpertId?: string;
37
+ }>]>;
38
+ export type TClientSecretGrantSource = z.infer<typeof clientSecretGrantSourceSchema>;
8
39
  /**
9
40
  * Selects how an opaque client secret is authorized and how entityId is
10
41
  * interpreted. createdById alone does not distinguish
@@ -41,6 +72,8 @@ export interface ISecretToken extends IBasePerTenantAndOrganizationEntityModel {
41
72
  token: string;
42
73
  /** Exact enterprise channel that issued an ENTERPRISE_XPERT token. */
43
74
  enterpriseH5Scope?: TEnterpriseH5TokenScope | null;
75
+ /** Authorization source for USER_XPERT grants; entityId remains the resource binding. */
76
+ grantSource?: TClientSecretGrantSource | null;
44
77
  validUntil?: Date;
45
78
  expired?: boolean;
46
79
  }
@@ -0,0 +1,45 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
+ /** Host-issued identity; never derive lifecycle ownership from wait/background mode. */
3
+ export type TaskControlRef = {
4
+ version: 2;
5
+ targetId: string;
6
+ };
7
+ export type TaskControlPolicy = 'attached' | 'detached' | 'shared';
8
+ export type TaskControlIntent = 'running' | 'paused' | 'terminated';
9
+ export type TaskControlKind = 'execution' | 'invocation' | 'handoff' | 'managed-queue' | 'desktop-shell' | 'sandbox-job' | 'sandbox-callback' | 'mcp-publication' | 'mcp-operation';
10
+ export type TaskControlState = 'queued' | 'running' | 'paused' | 'completed' | 'unknown';
11
+ /** Durable task identity and control facts, independent of a particular graph attempt. */
12
+ export interface IExecutionTaskControl extends IBasePerTenantAndOrganizationEntityModel {
13
+ id: string;
14
+ tenantId: string;
15
+ rootId: string;
16
+ parentId: string | null;
17
+ kind: TaskControlKind;
18
+ resourceId: string;
19
+ policy: TaskControlPolicy;
20
+ ancestors: string[];
21
+ threadId: string | null;
22
+ currentExecutionId: string | null;
23
+ attempts: string[];
24
+ desired: TaskControlIntent;
25
+ revision: number;
26
+ state: TaskControlState;
27
+ claim: string | null;
28
+ drainOnPause: boolean;
29
+ nextCheckAt: Date;
30
+ deliveryToken: string | null;
31
+ deliveryUntil: Date | null;
32
+ observation: string | null;
33
+ outcome: 'succeeded' | 'failed' | null;
34
+ }
35
+ /** Durable outbox entry; scope is copied only from its registered task. */
36
+ export interface ITaskControlPublication extends IBasePerTenantAndOrganizationEntityModel {
37
+ tenantId: string;
38
+ targetId: string;
39
+ transport: TaskControlTransport;
40
+ payload: unknown;
41
+ result: unknown | null;
42
+ nextAttemptAt: Date;
43
+ publishedAt: Date | null;
44
+ }
45
+ export type TaskControlTransport = 'handoff' | 'managed-queue' | 'managed-queue-v3';
@@ -141,6 +141,10 @@ export interface XpertViewPolling {
141
141
  intervalMs?: number;
142
142
  }
143
143
  export interface XpertViewActivation {
144
+ /** Allow direct document opening in an authorized Project without enabling Assistant tools.
145
+ * Discovery still observes requiredFeatures. Providers must authorize each selected resource
146
+ * and action; this flag grants neither Project membership nor resource write access. */
147
+ projectResource?: boolean;
144
148
  requiredFeatures?: string[];
145
149
  }
146
150
  export interface XpertWorkbenchViewOptions {