@xpert-ai/contracts 3.26.2 → 3.27.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/contracts",
3
- "version": "3.26.2",
3
+ "version": "3.27.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.17.0",
24
+ "@xpert-ai/chatkit-types": "~0.19.0",
25
25
  "zod-to-json-schema": "^3.25.2"
26
26
  },
27
27
  "peerDependencies": {
@@ -247,3 +247,5 @@ export interface InstalledAgentPlugin extends Omit<WorkspaceAgentPlugin, 'status
247
247
  scope: 'tenant' | 'organization';
248
248
  status: 'available' | 'configuration_required' | 'disabled';
249
249
  }
250
+ /** Storage faults are distinct from dependency compatibility and installation snapshot changes. */
251
+ export type AgentPluginStorageErrorCode = 'AGENT_PLUGIN_STORAGE_MISSING' | 'AGENT_PLUGIN_STORAGE_UNREADABLE' | 'AGENT_PLUGIN_STORAGE_CORRUPT';
@@ -0,0 +1,32 @@
1
+ import type { TChatCheckpointReference } from './chat.model';
2
+ /** Server-owned boundaries. An input retry may repeat completed actions; latest is not an automatic resume grant. */
3
+ export type TChatExecutionRecovery = {
4
+ version: 1;
5
+ graphRevision: string;
6
+ input?: TChatCheckpointReference;
7
+ latest: TChatCheckpointReference;
8
+ };
9
+ export type TChatRecoveryErrorCode = 'conversation_graph_changed' | 'conversation_recovery_unavailable' | 'conversation_branch_selection_changed';
10
+ export type TChatRecoveryError = {
11
+ code: TChatRecoveryErrorCode;
12
+ message: string;
13
+ };
14
+ export type TMessageEditAdmission = {
15
+ version: 1;
16
+ state: 'pending' | 'admitted';
17
+ workingThreadId: string;
18
+ workingThreadRevision: number;
19
+ };
20
+ /** Internal diagnostic result. ChatKit receives only TChatThreadCapabilities. */
21
+ export type TChatThreadRecovery = {
22
+ threadId: string;
23
+ executionId?: string;
24
+ canRetry: boolean;
25
+ reason?: TChatRecoveryErrorCode;
26
+ originalError?: string;
27
+ sourceThreadId?: string;
28
+ };
29
+ /** Chat clients consume availability only; diagnostic details stay server-side. */
30
+ export type TChatThreadCapabilities = {
31
+ canRetry: boolean;
32
+ };
@@ -133,6 +133,8 @@ export declare const ChatThreadPurpose: {
133
133
  export type TChatThreadPurpose = (typeof ChatThreadPurpose)[keyof typeof ChatThreadPurpose];
134
134
  /** Machine-readable keys stored in `ChatConversationThread.metadata`. */
135
135
  export type TChatThreadMetadata = {
136
+ /** Server-owned admission for historical-message edits. */
137
+ editAdmission?: import('./chat-recovery.model').TMessageEditAdmission;
136
138
  /** User-editable branch label, independent of the conversation title. */
137
139
  title?: string;
138
140
  primary?: boolean;
@@ -178,6 +180,8 @@ export type TSensitiveOperation = {
178
180
  * Corresponds to the thread in the [Agent Protocol](https://github.com/langchain-ai/agent-protocol).
179
181
  */
180
182
  export interface IChatConversation extends IBasePerTenantAndOrganizationEntityModel {
183
+ /** Optimistic concurrency token for the persisted working-thread selection. */
184
+ workingThreadRevision?: number;
181
185
  /**
182
186
  * `private`: ordinary chat; `group`: shared public transcript; `group_assistant_runtime`:
183
187
  * one member Assistant's isolated execution history. Optional for legacy DTOs (treated as private).
package/src/ai/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { createResourceCardContent, isResourceCardContent, parseResourceCard, pa
21
21
  export type { ConversationResourceCard, ResourceCardImage, ResourceCardOpenTarget, ResourceCardScalar, TMessageContentResourceCard } from './resource-card';
22
22
  export * from './thread-goal.model';
23
23
  export * from './chat.model';
24
+ export * from './chat-recovery.model';
24
25
  export * from './chat-message.model';
25
26
  export * from './chat-task-summary.model';
26
27
  export * from './chat-message-feedback.model';
@@ -120,3 +121,4 @@ export * from './assistant-template-setup.model';
120
121
  export * from './template-activity.model';
121
122
  export * from './template-lifecycle.model';
122
123
  export * from './assistant-template-overview.model';
124
+ export * from './run-display-snapshot.model';
@@ -0,0 +1,24 @@
1
+ import type { IChatMessage } from './chat-message.model';
2
+ import type { TChatAgentRunSummary } from './xpert-agent-execution.model';
3
+ /** Display only: no graph state, commands, interrupts or client tool invocations. */
4
+ export type TRunDisplayMessage = Pick<IChatMessage, 'id' | 'executionId' | 'conversationId' | 'content' | 'reasoning' | 'events' | 'status' | 'error'> & {
5
+ role: 'ai';
6
+ agentRuns?: TChatAgentRunSummary[];
7
+ };
8
+ export interface TRunDisplaySnapshot {
9
+ version: 1;
10
+ threadId: string;
11
+ runId: string;
12
+ segmentId: string;
13
+ revision: number;
14
+ cursor: string;
15
+ savedAt: string;
16
+ activeMessageId: string;
17
+ messages: TRunDisplayMessage[];
18
+ }
19
+ export interface TRunDisplaySnapshotPayload {
20
+ type: 'stream_snapshot';
21
+ snapshot: TRunDisplaySnapshot;
22
+ /** False means the retained tail cannot bridge this snapshot. Do not apply partial deltas. */
23
+ continuous: boolean;
24
+ }
@@ -99,6 +99,8 @@ export declare enum XpertAgentExecutionStatusEnum {
99
99
  INTERRUPTED = "interrupted"
100
100
  }
101
101
  export type TAgentExecutionMetadata = {
102
+ /** Written atomically with root checkpoints, not by message/execution finalizers. */
103
+ recovery?: import('./chat-recovery.model').TChatExecutionRecovery;
102
104
  templateSource?: import('../agent-plugin').TemplateAgentSource;
103
105
  businessOutcome?: import('@xpert-ai/chatkit-types').TAgentExecutionOutcome;
104
106
  /** Recorded by the invocation boundary; never inferred from agent names. */
@@ -11,6 +11,8 @@ export interface XpertProjectTypeRef {
11
11
  projectTypeKey: string;
12
12
  }
13
13
  export declare const GENERAL_PROJECT_TYPE: XpertProjectTypeRef;
14
+ /** File-backed collaborative writing workspace using the ordinary Project lifecycle. */
15
+ export declare const SPACE_PROJECT_TYPE: XpertProjectTypeRef;
14
16
  /** Business-task capacity owned by the Project type's dispatcher, never the Agent runtime. */
15
17
  export interface XpertProjectTaskConcurrency {
16
18
  maxConcurrentTasks: number;
@@ -144,6 +144,8 @@ export interface XpertTemplateSetup {
144
144
  key: XpertTemplateCapability;
145
145
  label: string;
146
146
  description: string;
147
+ /** Safe to add through a creation switch without an additional configuration form. */
148
+ supportsQuickCreation?: boolean;
147
149
  }[];
148
150
  requiredModelFeatures: ModelFeature[];
149
151
  models: XpertTemplateModelOption[];
@@ -27,6 +27,7 @@ export type TXpertWorkspaceSettings = {
27
27
  userId?: string;
28
28
  pluginName?: string;
29
29
  appName?: string;
30
+ applicationInstallationId?: string;
30
31
  };
31
32
  };
32
33
  export type TXpertWorkspaceStatus = 'active' | 'deprecated' | 'archived';
@@ -356,6 +356,10 @@ export type TXpertOptions = {
356
356
  position?: IPoint;
357
357
  size?: ISize;
358
358
  }>;
359
+ workflow?: Record<string, {
360
+ position?: IPoint;
361
+ size?: ISize;
362
+ }>;
359
363
  xpert?: Record<string, {
360
364
  position?: IPoint;
361
365
  size?: ISize;
@@ -55,6 +55,8 @@ export interface IArtifactWorkspaceFileReference {
55
55
  * this record owns source identity, scope, title, and current-version pointer.
56
56
  */
57
57
  export interface IArtifact extends IBasePerTenantAndOrganizationEntityModel {
58
+ /** Optional resource authorization provider; authorizes the existing resourceId in addition to link access. */
59
+ authorizationProviderKey?: string | null;
58
60
  pluginName: string;
59
61
  resourceType: string;
60
62
  resourceId: string;
@@ -68,6 +70,7 @@ export interface IArtifact extends IBasePerTenantAndOrganizationEntityModel {
68
70
  workspaceId?: string | null;
69
71
  projectId?: string | null;
70
72
  xpertId?: string | null;
73
+ /** Personal owner; null with projectId denotes Project ownership, independent of resource authorization. */
71
74
  userId?: string | null;
72
75
  metadata?: Record<string, unknown> | null;
73
76
  }
@@ -0,0 +1,140 @@
1
+ /** A file-backed editor resource has one identity across paths, Assistants and Views. */
2
+ export interface ContentDocumentDescriptor {
3
+ id: string;
4
+ resourceRef: {
5
+ providerKey: 'platform.project.file';
6
+ resourceId: string;
7
+ };
8
+ projectId: string;
9
+ path: string;
10
+ title: string;
11
+ modelKey: string;
12
+ schemaVersion: number;
13
+ epoch: number;
14
+ headRevisionId: string;
15
+ fileHash: string;
16
+ sequence: number;
17
+ status: 'ready' | 'pending' | 'conflict' | 'failed' | 'deleted' | 'moving';
18
+ }
19
+ export interface ContentDocumentBlock {
20
+ id: string;
21
+ type: string;
22
+ text: string;
23
+ }
24
+ /** Logical page hierarchy is independent of Project file folders and never grants access. */
25
+ export interface ContentPageEntry {
26
+ resourceId: string;
27
+ title: string;
28
+ path: string;
29
+ }
30
+ export interface ContentPageHierarchy {
31
+ supported: boolean;
32
+ canCreate: boolean;
33
+ parent: ContentPageEntry | null;
34
+ children: ContentPageEntry[];
35
+ hasMore: boolean;
36
+ }
37
+ export interface ContentDocumentSelection {
38
+ type: 'text';
39
+ resourceId: string;
40
+ epoch: number;
41
+ sequence: number;
42
+ blockId: string;
43
+ text: string;
44
+ }
45
+ export interface ContentDocumentRevision {
46
+ id: string;
47
+ resourceId: string;
48
+ parentId: string | null;
49
+ hash: string;
50
+ sequence: number;
51
+ epoch: number;
52
+ label: string;
53
+ createdAt: string;
54
+ createdById: string;
55
+ }
56
+ export interface ContentDocumentProposal {
57
+ id: string;
58
+ resourceId: string;
59
+ mutationId: string;
60
+ epoch: number;
61
+ sequence: number;
62
+ blockId: string;
63
+ before: string;
64
+ after: string;
65
+ status: 'pending' | 'accepted' | 'rejected' | 'stale';
66
+ createdById: string;
67
+ assistantId: string | null;
68
+ }
69
+ export interface ContentDocumentComment {
70
+ id: string;
71
+ resourceId: string;
72
+ blockId: string | null;
73
+ epoch: number;
74
+ body: string;
75
+ resolved: boolean;
76
+ createdById: string;
77
+ createdAt: string;
78
+ }
79
+ /** Discovery/navigation metadata is independent of an editor's document model. */
80
+ export interface ContentEditorMetadata {
81
+ key: string;
82
+ protocolVersion: 2;
83
+ title: string;
84
+ formatId: string;
85
+ mimeType: string;
86
+ extension: string;
87
+ view: {
88
+ providerKey: string;
89
+ viewKey: string;
90
+ entry: string;
91
+ };
92
+ }
93
+ export interface TextContentEditorRegistration extends ContentEditorMetadata {
94
+ kind: 'text-document';
95
+ schemaVersion: number;
96
+ concurrency: 'crdt';
97
+ engine: 'yjs';
98
+ }
99
+ export interface FileContentEditorRegistration extends ContentEditorMetadata {
100
+ kind: 'file';
101
+ concurrency: 'versioned';
102
+ }
103
+ export type ContentEditorRegistration = TextContentEditorRegistration | FileContentEditorRegistration;
104
+ /**
105
+ * Resolve an authorized resource to its registered editor, without opening UI.
106
+ * Send the returned navigation through workbench.navigation.open in the same
107
+ * Remote View bridge so the Workbench that contains the caller owns the tab.
108
+ */
109
+ export declare const CONTENT_EDITOR_RESOLVE_COMMAND = "workbench.content.resolve";
110
+ /** Authorize a document and return its stable URL without changing navigation or clipboard. */
111
+ export declare const CONTENT_EDITOR_LINK_COMMAND = "workbench.content.link";
112
+ export interface ContentEditorLinkResult {
113
+ success: true;
114
+ url: string;
115
+ }
116
+ /** Explicit document-reference discriminator in share URLs; consumers must reauthorize the ID. */
117
+ export declare const CONTENT_DOCUMENT_LINK_RESOURCE_PARAM = "contentResource";
118
+ export declare const ASSISTANT_CONTENT_REVIEW_COMMAND = "assistant.content.review";
119
+ export declare const CONTENT_EDITOR_STATUS_COMMAND = "workbench.content.status";
120
+ export interface ContentEditorOpenRequest {
121
+ /** Omit for a platform text document; resource providers are reauthorized server-side. */
122
+ providerKey?: string;
123
+ resourceId: string;
124
+ }
125
+ export interface ContentEditorResolveResult {
126
+ success: true;
127
+ navigation: {
128
+ target: 'workbench.view';
129
+ viewKey: string;
130
+ selectionId: string;
131
+ parameters?: {
132
+ contentProvider: string;
133
+ };
134
+ };
135
+ }
136
+ export interface ContentEditorStatus {
137
+ resourceId: string;
138
+ dirty: boolean;
139
+ label: string;
140
+ }
@@ -0,0 +1,19 @@
1
+ /** Persistent identity only. Never serialize signed URLs or connector credentials into a document.
2
+ * Markdown representation: xpert-resource://v1/{kind}/{providerKey}/{resourceId}.
3
+ * Resolving a reference does not grant access; the source and containing project are checked again.
4
+ */
5
+ export interface ContentReferenceTarget {
6
+ kind: 'image' | 'file' | 'page';
7
+ providerKey: string;
8
+ resourceId: string;
9
+ }
10
+ export interface ContentReferenceEntry extends ContentReferenceTarget {
11
+ title: string;
12
+ path: string;
13
+ mimeType: string;
14
+ size: number | null;
15
+ }
16
+ export interface ContentReferencePage {
17
+ items: ContentReferenceEntry[];
18
+ nextCursor: string | null;
19
+ }
package/src/index.d.ts CHANGED
@@ -68,12 +68,14 @@ export * from './plain-object.model';
68
68
  export * from './plugin';
69
69
  export * from './view-extension';
70
70
  export * from './runtime-control';
71
- export type { RuntimeResourceKind, AgentPluginRole, RuntimeResourceCatalogPurpose, RuntimeResourceStatus, RuntimeResourceReference, TemplateAgentSource, RuntimeResourcesSelection, AgentPluginDiagnostic, RuntimeResourceCatalogItem, RuntimeResourceView, RuntimeResourceCatalog, AgentPluginXpertExtension, AgentPluginCommand, AgentPluginCommandPresentation, RuntimeResourceCommand, RuntimeResourceSkillReference, AgentPluginConnectorAuth, AgentPluginConnectorBinding, RuntimeResourceDefinition, RuntimeResourceBindingInput, WorkspaceAgentPlugin, WorkspaceAgentPluginOptions, WorkspaceAgentPluginAddInput, WorkspaceAgentPluginAddResult, InstalledAgentPlugin } from './agent-plugin';
71
+ export type { RuntimeResourceKind, AgentPluginRole, RuntimeResourceCatalogPurpose, RuntimeResourceStatus, RuntimeResourceReference, TemplateAgentSource, RuntimeResourcesSelection, AgentPluginDiagnostic, AgentPluginStorageErrorCode, RuntimeResourceCatalogItem, RuntimeResourceView, RuntimeResourceCatalog, AgentPluginXpertExtension, AgentPluginCommand, AgentPluginCommandPresentation, RuntimeResourceCommand, RuntimeResourceSkillReference, AgentPluginConnectorAuth, AgentPluginConnectorBinding, RuntimeResourceDefinition, RuntimeResourceBindingInput, WorkspaceAgentPlugin, WorkspaceAgentPluginOptions, WorkspaceAgentPluginAddInput, WorkspaceAgentPluginAddResult, InstalledAgentPlugin } from './agent-plugin';
72
72
  export * from './desktop-shell.model';
73
73
  export * from './ai/agent-output-delivery.model';
74
74
  export * from './ai/execution-activity.model';
75
75
  export * from './setup-plugins';
76
76
  export * from './default-agent-plugins';
77
+ export * from './content-document.model';
78
+ export * from './content-reference.model';
77
79
  export * from './agent-plugin-maintenance';
78
80
  export * from './assistant-sharing.model';
79
81
  export * from './artifact-presentation.model';
@@ -24,9 +24,8 @@ export declare const PLUGIN_APPLICATION_INSTALLATION_STATUS: {
24
24
  /**
25
25
  * Scope declared by a trusted plugin application contribution.
26
26
  *
27
- * The current host initializer supports `organization`; the other values are
28
- * stable contract values for discovery and UI gating until their installers
29
- * are implemented.
27
+ * Organization and personal installations remain inside the current organization.
28
+ * Tenant is reserved for discovery until a tenant initializer is implemented.
30
29
  */
31
30
  export type PluginApplicationScope = (typeof PLUGIN_APPLICATION_SCOPE)[keyof typeof PLUGIN_APPLICATION_SCOPE];
32
31
  export type PluginApplicationInstallationStatus = (typeof PLUGIN_APPLICATION_INSTALLATION_STATUS)[keyof typeof PLUGIN_APPLICATION_INSTALLATION_STATUS];
@@ -46,7 +45,8 @@ export interface PluginMarketplaceAppKnowledgebaseConfig {
46
45
  key: string;
47
46
  name: string | I18nObject;
48
47
  description?: string | I18nObject;
49
- permission: 'organization';
48
+ /** Personal installations always create private knowledge bases. */
49
+ permission: 'organization' | 'private';
50
50
  applicationTags?: string[];
51
51
  graphRag?: {
52
52
  enabled: boolean;
@@ -85,7 +85,8 @@ export interface PluginMarketplaceAppAssistantSuite {
85
85
  * The host only executes this contract from a loaded plugin contribution.
86
86
  */
87
87
  export interface PluginMarketplaceAppConfig {
88
- scope: PluginApplicationScope;
88
+ /** A single scope or ordered choices. The first choice is the backward-compatible default. */
89
+ scope: PluginApplicationScope | PluginApplicationScope[];
89
90
  assistantTemplateKey: string;
90
91
  assistantSuite?: PluginMarketplaceAppAssistantSuite;
91
92
  workspace: {
@@ -136,7 +137,9 @@ export interface PluginTemplateApplicationSummary {
136
137
  export interface IPluginApplicationInstallation extends IBasePerTenantAndOrganizationEntityModel {
137
138
  pluginName: string;
138
139
  appName: string;
140
+ /** Actual scope selected for this installation, independent of the App declaration. */
139
141
  declaredScope: PluginApplicationScope;
142
+ ownerUserId?: string | null;
140
143
  scopeKey: string;
141
144
  status: PluginApplicationInstallationStatus;
142
145
  pluginVersion?: string | null;
@@ -184,6 +187,7 @@ export interface PluginApplicationToolsetSelection {
184
187
  /** Read model used by marketplace cards to render installation health and actions. */
185
188
  export interface PluginApplicationStatusSummary {
186
189
  appId: string;
190
+ installationScope?: PluginApplicationScope;
187
191
  status: PluginApplicationInstallationStatus | 'not_installed';
188
192
  initializationAccess?: 'allowed' | 'organization_required' | 'role_required' | 'unsupported';
189
193
  installationId?: string;
@@ -244,10 +248,11 @@ export interface PluginApplicationDetail {
244
248
  preflight: PluginApplicationPreflight;
245
249
  }
246
250
  /**
247
- * User-selectable portion of an initialization request. Scope and target
248
- * resources are intentionally absent and are derived from RequestContext.
251
+ * Clients select a declared installation scope; identity and target resource IDs
252
+ * are derived exclusively from the authenticated request context.
249
253
  */
250
254
  export interface PluginApplicationInitializeInput {
255
+ installationScope?: PluginApplicationScope;
251
256
  pluginName: string;
252
257
  appName: string;
253
258
  embeddingModelId?: string;
@@ -258,6 +263,7 @@ export interface PluginApplicationInitializeInput {
258
263
  }
259
264
  /** Prepares or discards configuration in the current request scope; never accepts a Workspace ID. */
260
265
  export interface PluginApplicationSetupInput {
266
+ installationScope?: PluginApplicationScope;
261
267
  pluginName: string;
262
268
  appName: string;
263
269
  }
@@ -266,3 +272,6 @@ export interface PluginApplicationBindToolsetInput extends PluginApplicationSetu
266
272
  key: string;
267
273
  toolsetId: string;
268
274
  }
275
+ /** Validate portable metadata without inferring a scope from names or presentation text. */
276
+ export declare function getPluginApplicationScopes(value: unknown): PluginApplicationScope[];
277
+ export declare function isPluginApplicationScope(value: unknown): value is PluginApplicationScope;
@@ -1,3 +1,4 @@
1
+ import type { PluginApplicationScope } from '../plugin-application';
1
2
  import type { I18nObject, IconDefinition } from '../types';
2
3
  import type { JsonSchemaObjectType } from '../ai/types';
3
4
  import type { XpertViewAssistantIdentity } from './assistant-profile';
@@ -104,6 +105,13 @@ export interface XpertViewRuntimeScope {
104
105
  }
105
106
  export type XpertViewHostState = Record<string, unknown>;
106
107
  export interface XpertResolvedViewHostContext extends XpertViewHostContext {
108
+ application?: {
109
+ installationId: string;
110
+ pluginName: string;
111
+ appName: string;
112
+ scope: PluginApplicationScope;
113
+ ownerUserId: string | null;
114
+ } | null;
107
115
  assistant?: XpertViewAssistantIdentity;
108
116
  slots: XpertViewSlot[];
109
117
  hostSnapshot?: unknown;
@@ -312,6 +320,8 @@ export interface XpertViewActionDefinition {
312
320
  requiredHostAccess?: XpertViewHostAccessLevel;
313
321
  }
314
322
  export interface XpertViewClientCommandDefinition {
323
+ /** A host must implement this command before mounting the view. Optional actions may omit this. */
324
+ required?: boolean;
315
325
  key: string;
316
326
  label?: I18nObject;
317
327
  description?: I18nObject;