@xpert-ai/contracts 3.37.2 → 3.38.1

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.37.2",
3
+ "version": "3.38.1",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@octokit/types": "13.10.0",
39
39
  "@types/json-schema": "^7.0.15",
40
- "@xpert-ai/chatkit-types": "~0.23.0",
40
+ "@xpert-ai/chatkit-types": "~0.24.1",
41
41
  "zod-to-json-schema": "^3.25.2"
42
42
  },
43
43
  "peerDependencies": {
@@ -9,8 +9,9 @@ export declare const CHAT_EVENT_TYPE_THREAD_GOAL_CLEARED: "thread_goal_cleared";
9
9
  export type TConversationTitleSummaryEvent = TChatEventMessage & {
10
10
  id?: string;
11
11
  type: typeof CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY;
12
+ presentation: 'runtime';
12
13
  };
13
- export declare function createConversationTitleSummaryEvent(event: Omit<TConversationTitleSummaryEvent, 'type'>): TConversationTitleSummaryEvent;
14
+ export declare function createConversationTitleSummaryEvent(event: Omit<TConversationTitleSummaryEvent, 'type' | 'presentation'>): TConversationTitleSummaryEvent;
14
15
  export declare function createFollowUpConsumedEvent(event: Omit<TFollowUpConsumedEvent, 'type'>): TFollowUpConsumedEvent;
15
16
  export declare function createThreadGoalUpdatedEvent(goal: IThreadGoal, updatedAt?: string | Date): TThreadGoalUpdatedEvent;
16
17
  export declare function createThreadGoalClearedEvent(event: Omit<TThreadGoalClearedEvent, 'type' | 'updatedAt'> & {
@@ -1,3 +1,4 @@
1
+ import type { TChatActivityPresentation } from '@xpert-ai/chatkit-types';
1
2
  /** Provenance is descriptive, never an execution principal or an authorization grant. */
2
3
  export type TChatMessageSource = {
3
4
  type: 'user';
@@ -22,7 +23,7 @@ export type TChatMessageSource = {
22
23
  taskId: string;
23
24
  };
24
25
  /** Presentation does not change model roles or remove input from execution/retry history. */
25
- export type TChatMessagePresentation = 'message' | 'event' | 'runtime';
26
+ export type TChatMessagePresentation = 'message' | TChatActivityPresentation;
26
27
  /** Host-created provenance, persisted in ChatMessage.messageEnvelope. */
27
28
  export interface TChatMessageEnvelope {
28
29
  version: 1;
@@ -70,7 +70,7 @@ export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel,
70
70
  /** Copied execution history is display-only and must not restore live tool sessions. */
71
71
  historical?: boolean;
72
72
  /** Owned snapshot for a branch whose original execution may later be deleted. */
73
- historicalAgentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
73
+ historicalAgentRuns?: import('./chat.model').TStoredChatAgentRuns | null;
74
74
  /**
75
75
  * @deprecated Chat attachments now use `fileAssets`. This field is kept only
76
76
  * for historical messages that stored raw StorageFile handles.
@@ -1,7 +1,7 @@
1
1
  import type { TChatConversationStatus } from './chat-activity.model';
2
2
  export type { TChatConversationStatus, IChatConversationUnreadXpertSummary, IChatConversationUnreadSnapshot } from './chat-activity.model';
3
3
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
4
- import { IXpertAgentExecution } from './xpert-agent-execution.model';
4
+ import { type TChatAgentRunSummary, IXpertAgentExecution } from './xpert-agent-execution.model';
5
5
  import { IXpert } from './xpert.model';
6
6
  import { I18nObject } from '../types';
7
7
  import { CopilotChatMessage, CopilotMessageGroup, IChatMessage } from './chat-message.model';
@@ -12,7 +12,7 @@ import { IXpertTask } from './xpert-task.model';
12
12
  import { TToolCall } from '../agent';
13
13
  import { TInterrupt } from '../agent/interrupt';
14
14
  import { IUser } from '../user.model';
15
- import type { RuntimeCapabilitiesSelection } from '@xpert-ai/chatkit-types';
15
+ import type { RuntimeCapabilitiesSelection, TChatActivityPresentation } from '@xpert-ai/chatkit-types';
16
16
  export type TChatConversationOptions = {
17
17
  /** First Project binding is deferred until a human submits the application's setup App. */
18
18
  projectCreation?: {
@@ -52,6 +52,15 @@ export type TChatCheckpointReference = {
52
52
  checkpointNs: string;
53
53
  checkpointId: string;
54
54
  };
55
+ /** Version 1 contains only the executions visible in the transcript. */
56
+ export type TChatAgentRunSnapshot = {
57
+ version: 1;
58
+ runs: TChatAgentRunSummary[];
59
+ };
60
+ /** Unversioned branch snapshots may contain unclassified or explicitly marked executions. */
61
+ export type TStoredChatAgentRuns = TChatAgentRunSnapshot | (TChatAgentRunSummary & {
62
+ presentation?: TChatActivityPresentation;
63
+ })[];
55
64
  export type TChatInputCheckpoint = {
56
65
  version: 1;
57
66
  checkpoint: TChatCheckpointReference | null;
@@ -77,7 +86,7 @@ export type TChatOutputCheckpoint = {
77
86
  messagePathHash?: string;
78
87
  /** Access must be checked again before linking these assets to a new conversation. */
79
88
  fileAssetIds?: string[];
80
- agentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
89
+ agentRuns?: TStoredChatAgentRuns;
81
90
  };
82
91
  /** Copy the source thread's ancestor path through afterMessageId, inclusive. */
83
92
  export type TConversationBranchRequest = {
@@ -0,0 +1,27 @@
1
+ export type ConversationProjectDestination = 'existing' | 'create';
2
+ export interface ConversationProjectMoveOffer {
3
+ requestId: string;
4
+ assistantMessageId: string;
5
+ threadId: string;
6
+ /** Initial preference until confirmation, then the mode used to bind the Project. */
7
+ destination: ConversationProjectDestination;
8
+ projectId: string | null;
9
+ projectName?: string;
10
+ executionId: string;
11
+ conversationId: string;
12
+ waitingForIdle: boolean;
13
+ executionStatus: string | null;
14
+ }
15
+ export type ConversationProjectMoveConfirmation = {
16
+ requestId: string;
17
+ moveFromConversationId: string;
18
+ threadId: string;
19
+ shareHistory: true;
20
+ target: {
21
+ mode: 'existing';
22
+ projectId: string;
23
+ } | {
24
+ mode: 'create';
25
+ name: string;
26
+ };
27
+ };
package/src/ai/index.d.ts CHANGED
@@ -3,9 +3,11 @@ export declare const STATE_VARIABLE_HUMAN = "human";
3
3
  export * from './prompt-workflow-capabilities.model';
4
4
  export { ChatMessageEventTypeEnum, ChatMessageStepCategory, ChatMessageTypeEnum } from './ai.model';
5
5
  export type * from '@xpert-ai/chatkit-types';
6
+ export { hasRuntimePresentation, isRuntimeAgentExecution } from '@xpert-ai/chatkit-types';
6
7
  export type { IconDefinition, IconType } from '../types';
7
8
  export type { TChatRequest } from './xpert-chat.model';
8
9
  export type { ProjectSelection } from './project-selection.model';
10
+ export * from './conversation-project-move.model';
9
11
  export { CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED } from './chat-event.model';
10
12
  export * from './assistant-binding.model';
11
13
  export * from './clawxpert-recovery.model';
@@ -139,3 +141,4 @@ export * from './execution-observability.model';
139
141
  export * from './model-management.model';
140
142
  export * from './model-replacement.model';
141
143
  export * from './default-model-role';
144
+ export * from './project-task-view.model';
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod';
2
+ /** Resource names determine the projection; clients cannot request arbitrary entity fields. */
3
+ export declare const projectTaskViewQuerySchema: z.ZodDiscriminatedUnion<"resource", [z.ZodObject<{
4
+ resource: z.ZodLiteral<"context">;
5
+ contractVersion: z.ZodLiteral<2>;
6
+ knownVersion: z.ZodOptional<z.ZodString>;
7
+ }, "strict", z.ZodTypeAny, {
8
+ resource?: "context";
9
+ contractVersion?: 2;
10
+ knownVersion?: string;
11
+ }, {
12
+ resource?: "context";
13
+ contractVersion?: 2;
14
+ knownVersion?: string;
15
+ }>, z.ZodObject<{
16
+ resource: z.ZodLiteral<"task-index">;
17
+ compactAvatars: z.ZodOptional<z.ZodBoolean>;
18
+ avatarVersions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
19
+ contractVersion: z.ZodLiteral<2>;
20
+ knownVersion: z.ZodOptional<z.ZodString>;
21
+ }, "strict", z.ZodTypeAny, {
22
+ resource?: "task-index";
23
+ contractVersion?: 2;
24
+ knownVersion?: string;
25
+ compactAvatars?: boolean;
26
+ avatarVersions?: string[];
27
+ }, {
28
+ resource?: "task-index";
29
+ contractVersion?: 2;
30
+ knownVersion?: string;
31
+ compactAvatars?: boolean;
32
+ avatarVersions?: string[];
33
+ }>, z.ZodObject<{
34
+ after: z.ZodOptional<z.ZodString>;
35
+ limit: z.ZodDefault<z.ZodNumber>;
36
+ resource: z.ZodLiteral<"executions">;
37
+ taskIds: z.ZodArray<z.ZodString, "many">;
38
+ contractVersion: z.ZodLiteral<2>;
39
+ knownVersion: z.ZodOptional<z.ZodString>;
40
+ }, "strict", z.ZodTypeAny, {
41
+ resource?: "executions";
42
+ taskIds?: string[];
43
+ limit?: number;
44
+ contractVersion?: 2;
45
+ knownVersion?: string;
46
+ after?: string;
47
+ }, {
48
+ resource?: "executions";
49
+ taskIds?: string[];
50
+ limit?: number;
51
+ contractVersion?: 2;
52
+ knownVersion?: string;
53
+ after?: string;
54
+ }>, z.ZodObject<{
55
+ resource: z.ZodLiteral<"task-detail">;
56
+ taskId: z.ZodString;
57
+ contractVersion: z.ZodLiteral<2>;
58
+ knownVersion: z.ZodOptional<z.ZodString>;
59
+ }, "strict", z.ZodTypeAny, {
60
+ resource?: "task-detail";
61
+ taskId?: string;
62
+ contractVersion?: 2;
63
+ knownVersion?: string;
64
+ }, {
65
+ resource?: "task-detail";
66
+ taskId?: string;
67
+ contractVersion?: 2;
68
+ knownVersion?: string;
69
+ }>, z.ZodObject<{
70
+ resource: z.ZodLiteral<"execution-detail">;
71
+ taskId: z.ZodString;
72
+ executionId: z.ZodString;
73
+ contractVersion: z.ZodLiteral<2>;
74
+ knownVersion: z.ZodOptional<z.ZodString>;
75
+ }, "strict", z.ZodTypeAny, {
76
+ executionId?: string;
77
+ resource?: "execution-detail";
78
+ taskId?: string;
79
+ contractVersion?: 2;
80
+ knownVersion?: string;
81
+ }, {
82
+ executionId?: string;
83
+ resource?: "execution-detail";
84
+ taskId?: string;
85
+ contractVersion?: 2;
86
+ knownVersion?: string;
87
+ }>, z.ZodObject<{
88
+ resource: z.ZodLiteral<"execution-artifacts">;
89
+ taskId: z.ZodString;
90
+ executionId: z.ZodString;
91
+ contractVersion: z.ZodLiteral<2>;
92
+ knownVersion: z.ZodOptional<z.ZodString>;
93
+ }, "strict", z.ZodTypeAny, {
94
+ executionId?: string;
95
+ resource?: "execution-artifacts";
96
+ taskId?: string;
97
+ contractVersion?: 2;
98
+ knownVersion?: string;
99
+ }, {
100
+ executionId?: string;
101
+ resource?: "execution-artifacts";
102
+ taskId?: string;
103
+ contractVersion?: 2;
104
+ knownVersion?: string;
105
+ }>, z.ZodObject<{
106
+ resource: z.ZodLiteral<"execution-result">;
107
+ taskId: z.ZodString;
108
+ executionId: z.ZodString;
109
+ expectedRevision: z.ZodNumber;
110
+ offset: z.ZodDefault<z.ZodNumber>;
111
+ limit: z.ZodDefault<z.ZodNumber>;
112
+ contractVersion: z.ZodLiteral<2>;
113
+ knownVersion: z.ZodOptional<z.ZodString>;
114
+ }, "strict", z.ZodTypeAny, {
115
+ executionId?: string;
116
+ resource?: "execution-result";
117
+ taskId?: string;
118
+ offset?: number;
119
+ expectedRevision?: number;
120
+ limit?: number;
121
+ contractVersion?: 2;
122
+ knownVersion?: string;
123
+ }, {
124
+ executionId?: string;
125
+ resource?: "execution-result";
126
+ taskId?: string;
127
+ offset?: number;
128
+ expectedRevision?: number;
129
+ limit?: number;
130
+ contractVersion?: 2;
131
+ knownVersion?: string;
132
+ }>]>;
133
+ export type ProjectTaskViewQuery = z.output<typeof projectTaskViewQuerySchema>;
@@ -43,12 +43,12 @@ export declare const templateUpgradeInputSchema: z.ZodObject<{
43
43
  revision?: string;
44
44
  sourceHash?: string;
45
45
  targetTemplateId?: string;
46
- choices?: Partial<Record<"runtime" | "instructions" | "presentation" | "definition", "replace" | "keep">>;
46
+ choices?: Partial<Record<"runtime" | "instructions" | "definition" | "presentation", "replace" | "keep">>;
47
47
  }, {
48
48
  revision?: string;
49
49
  sourceHash?: string;
50
50
  targetTemplateId?: string;
51
- choices?: Partial<Record<"runtime" | "instructions" | "presentation" | "definition", "replace" | "keep">>;
51
+ choices?: Partial<Record<"runtime" | "instructions" | "definition" | "presentation", "replace" | "keep">>;
52
52
  }>;
53
53
  export type TemplateUpgradeInput = z.output<typeof templateUpgradeInputSchema>;
54
54
  export interface TemplateUpgradeSource {
@@ -6,6 +6,7 @@ import { TSensitiveOperation } from './chat.model';
6
6
  import { WorkflowNodeTypeEnum } from './xpert-workflow.model';
7
7
  import type { IModelUsageDetails } from './model-usage.model';
8
8
  import type { TAvatar } from '../types';
9
+ import type { TChatActivityPresentation } from '@xpert-ai/chatkit-types';
9
10
  export type TXpertExecution = {
10
11
  category?: TXpertTeamNodeType;
11
12
  type?: WorkflowNodeTypeEnum | string;
@@ -113,6 +114,8 @@ export declare enum XpertAgentExecutionStatusEnum {
113
114
  INTERRUPTED = "interrupted"
114
115
  }
115
116
  export type TAgentExecutionMetadata = {
117
+ /** Runtime-only executions are omitted from the conversation transcript. */
118
+ presentation?: TChatActivityPresentation;
116
119
  /** Host-created result continuation; its inbox claim proves the originating execution. */
117
120
  runtimeContinuation?: {
118
121
  /** Durable runtime inbox entry whose claim identifies this continuation and its source invocation. */
@@ -664,7 +664,7 @@ export interface AppPlatformStatus {
664
664
  }>;
665
665
  }>;
666
666
  }
667
- /** Account-wide storage, using the same snapshot and limits as quota enforcement. */
667
+ /** Storage owned by the current tenant + organization, shared by all members and Apps. */
668
668
  export interface AppPlatformStorageUsage {
669
669
  limitBytes: number;
670
670
  snapshot: {
@@ -14,6 +14,12 @@ export interface IFileAssetSource {
14
14
  filePath?: string;
15
15
  metadata?: Record<string, any>;
16
16
  }
17
+ /** Serializable public failure details, independent of the upload transport. */
18
+ export interface IFileUploadFailure {
19
+ statusCode: number;
20
+ code?: string;
21
+ message: string | string[];
22
+ }
17
23
  export interface IFileAssetDestination {
18
24
  kind: FileAssetDestinationKind;
19
25
  status: 'success' | 'failed';
@@ -22,6 +28,7 @@ export interface IFileAssetDestination {
22
28
  referenceId?: string;
23
29
  metadata?: Record<string, any>;
24
30
  error?: string;
31
+ failure?: IFileUploadFailure;
25
32
  }
26
33
  export interface IFileAsset {
27
34
  name?: string;
@@ -1,3 +1,5 @@
1
+ import type { JSONValue } from './core.model';
2
+ import type { AnalyticsBinding, AnalyticsSourceSummary } from './analytics/analytics-query.model';
1
3
  import type { AiModelTypeEnum } from './agent';
2
4
  import type { ModelSelectionMetadata } from './ai/copilot-model.model';
3
5
  import type { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
@@ -86,6 +88,81 @@ export interface PluginMarketplaceAppAssistantSuite {
86
88
  /** Published in the same workspace without granting coordinator delegation. */
87
89
  standaloneAssistants?: PluginMarketplaceAppAssistantDefinition[];
88
90
  }
91
+ /**
92
+ * Declares how an application obtains its analytics bindings from a model chosen during setup.
93
+ * The host matches each recipe to an analytics field by key. The provider interprets the recipe.
94
+ */
95
+ export interface ApplicationAnalyticsSetup {
96
+ kind: 'connection-model';
97
+ providerId: string;
98
+ recipes: Record<string, JSONValue>;
99
+ /** The host passes this versioned bundle only to the registered provider, never to the renderer. */
100
+ bootstrap?: {
101
+ key: string;
102
+ version: string;
103
+ modes: Array<{
104
+ id: string;
105
+ label: I18nObject;
106
+ }>;
107
+ bundle: JSONValue;
108
+ };
109
+ }
110
+ /**
111
+ * Declares one choice an organization makes when configuring an application.
112
+ * The kind determines how the host collects and validates the value. Keep the key stable across
113
+ * versions so existing installations can still resolve their saved selections.
114
+ */
115
+ export type ApplicationSetupField = {
116
+ kind: 'members';
117
+ key: string;
118
+ label: I18nObject;
119
+ optional?: boolean;
120
+ } | {
121
+ kind: 'analytics';
122
+ key: string;
123
+ label: I18nObject;
124
+ providerId: string;
125
+ requiredNumericFields?: string[];
126
+ };
127
+ /** An organization's saved configuration for one application, keyed by its declared setup fields. */
128
+ export interface OrganizationApplicationSettings {
129
+ /** Submit the revision read from the form so concurrent edits can be detected. Zero denotes an unsaved configuration. */
130
+ revision: number;
131
+ members: Record<string, string[]>;
132
+ queries: Record<string, AnalyticsBinding>;
133
+ }
134
+ /**
135
+ * Host response for initializing or editing an application in the current organization.
136
+ * It pairs saved values with the members and sources available to the caller. When model setup
137
+ * is offered, the client can also obtain query bindings by previewing a model.
138
+ */
139
+ export interface OrganizationApplicationSetupForm {
140
+ modelSetup?: {
141
+ kind: 'connection-model';
142
+ bootstrap?: {
143
+ modes: Array<{
144
+ id: string;
145
+ label: I18nObject;
146
+ }>;
147
+ version: string;
148
+ };
149
+ };
150
+ settings: OrganizationApplicationSettings;
151
+ users: Array<{
152
+ id: string;
153
+ label: string;
154
+ }>;
155
+ sources: AnalyticsSourceSummary[];
156
+ }
157
+ /**
158
+ * Installation metadata a project plugin can use to resolve the coordinator, role Assistants
159
+ * and organization settings for its application. Callers still check access to each resource they use.
160
+ */
161
+ export interface ProjectApplicationBindings {
162
+ coordinatorId: string;
163
+ roles: Record<string, string>;
164
+ settings: OrganizationApplicationSettings;
165
+ }
89
166
  /**
90
167
  * Declarative, host-owned initialization contract for a trusted plugin App.
91
168
  * The host only executes this contract from a loaded plugin contribution.
@@ -102,6 +179,10 @@ export interface PluginMarketplaceAppConfig {
102
179
  scope: PluginApplicationScope | PluginApplicationScope[];
103
180
  assistantTemplateKey: string;
104
181
  assistantSuite?: PluginMarketplaceAppAssistantSuite;
182
+ /** Fields the host presents when an organization initializes or edits this application. */
183
+ organizationSetup?: ApplicationSetupField[];
184
+ /** Optional model-based setup for the analytics fields declared in organizationSetup. */
185
+ analyticsSetup?: ApplicationAnalyticsSetup;
105
186
  workspace: {
106
187
  mode: 'dedicated';
107
188
  name: string | I18nObject;
@@ -266,6 +347,8 @@ export interface PluginApplicationDetail {
266
347
  * are derived exclusively from the authenticated request context.
267
348
  */
268
349
  export interface PluginApplicationInitializeInput {
350
+ /** Selections from the organization's setup form, including the revision the caller edited. */
351
+ organizationSettings?: OrganizationApplicationSettings;
269
352
  installationScope?: PluginApplicationScope;
270
353
  pluginName: string;
271
354
  appName: string;
@@ -39,4 +39,6 @@ export interface XpertViewAssistantIdentity {
39
39
  currentId: string;
40
40
  versionIds: string[];
41
41
  principalUserId?: string | null;
42
+ /** Persisted Assistant ownership, independent of the viewer's selected organization. */
43
+ organizationId?: string | null;
42
44
  }