@xpert-ai/contracts 3.18.6 → 3.20.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 (69) hide show
  1. package/index.cjs.js +1390 -222
  2. package/index.esm.js +1317 -223
  3. package/package.json +6 -3
  4. package/src/agent/ai-model.d.ts +1 -0
  5. package/src/agent/token.d.ts +4 -0
  6. package/src/agent-plugin.d.ts +192 -0
  7. package/src/ai/agent-output-delivery.model.d.ts +31 -0
  8. package/src/ai/agent-runtime.model.d.ts +53 -0
  9. package/src/ai/ai-model.model.d.ts +3 -0
  10. package/src/ai/assistant-binding.model.d.ts +3 -0
  11. package/src/ai/assistant-configuration.model.d.ts +76 -0
  12. package/src/ai/assistant-order.d.ts +5 -0
  13. package/src/ai/assistant-trigger.model.d.ts +56 -0
  14. package/src/ai/bosi.model.d.ts +73 -0
  15. package/src/ai/chat-activity.model.d.ts +14 -0
  16. package/src/ai/chat-message-envelope.model.d.ts +55 -0
  17. package/src/ai/chat-message.model.d.ts +14 -1
  18. package/src/ai/chat-task-summary.model.d.ts +4 -3
  19. package/src/ai/chat.model.d.ts +110 -13
  20. package/src/ai/clawxpert-conversation-scope.model.d.ts +2 -0
  21. package/src/ai/evolution/baseline.d.ts +40 -0
  22. package/src/ai/evolution/change.d.ts +53 -0
  23. package/src/ai/evolution/index.d.ts +1 -0
  24. package/src/ai/evolution/persistence.d.ts +2 -0
  25. package/src/ai/evolution/provider.d.ts +1 -1
  26. package/src/ai/execution-activity.model.d.ts +547 -0
  27. package/src/ai/index.d.ts +17 -0
  28. package/src/ai/knowledge-keyword-analyzer.model.d.ts +18 -0
  29. package/src/ai/knowledgebase.model.d.ts +5 -0
  30. package/src/ai/mcp-capability.model.d.ts +5 -1
  31. package/src/ai/mcp-publication.model.d.ts +1 -1
  32. package/src/ai/membership.model.d.ts +5 -0
  33. package/src/ai/middleware.model.d.ts +1 -0
  34. package/src/ai/mobile.model.d.ts +5 -0
  35. package/src/ai/model-execution.model.d.ts +265 -0
  36. package/src/ai/model-gateway.model.d.ts +15 -3
  37. package/src/ai/model-usage.model.d.ts +19 -0
  38. package/src/ai/project-selection.model.d.ts +9 -0
  39. package/src/ai/project-task-graph.model.d.ts +70 -0
  40. package/src/ai/project-task-runtime.model.d.ts +1106 -0
  41. package/src/ai/project-task-schedule.d.ts +24 -0
  42. package/src/ai/project-task-type.model.d.ts +13 -0
  43. package/src/ai/prompt-workflow-capabilities.model.d.ts +15 -0
  44. package/src/ai/prompt-workflow.model.d.ts +17 -0
  45. package/src/ai/realtime-voice.model.d.ts +90 -0
  46. package/src/ai/realtime-voice.transport.d.ts +54 -0
  47. package/src/ai/resource-card.d.ts +2 -0
  48. package/src/ai/sandbox-file-output.model.d.ts +9 -0
  49. package/src/ai/thread-activity.model.d.ts +14 -0
  50. package/src/ai/xpert-agent-execution.model.d.ts +37 -0
  51. package/src/ai/xpert-chat.model.d.ts +2 -0
  52. package/src/ai/xpert-marketplace.model.d.ts +5 -0
  53. package/src/ai/xpert-project-type.model.d.ts +56 -0
  54. package/src/ai/xpert-project.model.d.ts +46 -1
  55. package/src/ai/xpert-template.model.d.ts +48 -0
  56. package/src/ai/xpert-tool-mcp.model.d.ts +21 -1
  57. package/src/ai/xpert-workflow.model.d.ts +15 -1
  58. package/src/ai/xpert.model.d.ts +20 -1
  59. package/src/desktop-shell.model.d.ts +159 -0
  60. package/src/i18n.model.d.ts +1 -0
  61. package/src/index.d.ts +7 -0
  62. package/src/integration.model.d.ts +19 -0
  63. package/src/plugin.d.ts +26 -7
  64. package/src/tag-entity.model.d.ts +1 -1
  65. package/src/types.d.ts +4 -0
  66. package/src/view-extension/index.d.ts +2 -0
  67. package/src/view-extension/model.d.ts +41 -1
  68. package/src/view-extension/workbench-open.d.ts +10 -0
  69. package/src/view-extension/workbench.d.ts +6 -0
@@ -1,11 +1,12 @@
1
1
  import { MessageType } from '@langchain/core/messages';
2
2
  import type { ChatKitReference, ChatKitReferenceBase, TChatMessageStep, TChatTaskSummaryContribution, TMessageContent, TMessageContentReasoning } from '@xpert-ai/chatkit-types';
3
3
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
4
- import { IChatConversation } from './chat.model';
4
+ import { IChatConversation, TChatInputCheckpoint, TChatOutputCheckpoint, TChatMessageBranching } from './chat.model';
5
5
  import { LongTermMemoryTypeEnum } from './xpert.model';
6
6
  import { IXpertAgentExecution, XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
7
7
  import { JSONValue } from '../core.model';
8
8
  import { IStorageFile } from '../storage-file.model';
9
+ import type { TChatMessageEnvelope } from './chat-message-envelope.model';
9
10
  export type TSummaryJob = Record<LongTermMemoryTypeEnum, {
10
11
  jobId: number | string;
11
12
  status: string;
@@ -52,13 +53,25 @@ export type TChatFileElementReference = ChatKitReferenceBase & TChatFileElementR
52
53
  type: 'file_element';
53
54
  };
54
55
  export type TChatReference = ChatKitReference | TChatElementReference | TChatFileElementReference;
56
+ export * from './chat-message-envelope.model';
55
57
  /**
56
58
  * Chat message entity type
57
59
  */
58
60
  export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel, Omit<Omit<CopilotBaseMessage, 'createdAt'>, 'id'> {
61
+ /** Persisted host-owned provenance; read-only through public message APIs. */
62
+ messageEnvelope?: TChatMessageEnvelope | null;
59
63
  parent?: IChatMessage | null;
60
64
  children?: IChatMessage[];
61
65
  parentId?: string | null;
66
+ inputCheckpoint?: TChatInputCheckpoint | null;
67
+ /** Internal persisted state; excluded from public DTOs and raw stream events. */
68
+ outputCheckpoint?: TChatOutputCheckpoint | null;
69
+ /** Public capability derived from the finalized message, not inferred from executionId. */
70
+ branching?: TChatMessageBranching;
71
+ /** Copied execution history is display-only and must not restore live tool sessions. */
72
+ historical?: boolean;
73
+ /** Owned snapshot for a branch whose original execution may later be deleted. */
74
+ historicalAgentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
62
75
  /**
63
76
  * @deprecated Chat attachments now use `fileAssets`. This field is kept only
64
77
  * for historical messages that stored raw StorageFile handles.
@@ -1,4 +1,4 @@
1
- import type { ChatTaskSummaryOutput, ChatTaskSummaryPlan, ChatTaskSummarySource, ChatTaskSummaryTodos } from '@xpert-ai/chatkit-types';
1
+ import type { ChatFileChange, ChatTaskSummaryOutput, ChatTaskSummaryPlan, ChatTaskSummarySource, ChatTaskSummaryTodos } from '@xpert-ai/chatkit-types';
2
2
  import type { IThreadGoal } from './thread-goal.model';
3
3
  import type { XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
4
4
  export type TChatTaskSummaryAgent = {
@@ -21,8 +21,8 @@ export type TChatTaskSummaryPending = {
21
21
  messageId?: string;
22
22
  createdAt?: string;
23
23
  };
24
- export type TChatTaskSummarySection = 'outputs' | 'sources' | 'agents' | 'pending';
25
- export type TChatTaskSummarySectionItem = ChatTaskSummaryOutput | ChatTaskSummarySource | TChatTaskSummaryAgent | TChatTaskSummaryPending;
24
+ export type TChatTaskSummarySection = 'outputs' | 'fileChanges' | 'sources' | 'agents' | 'pending';
25
+ export type TChatTaskSummarySectionItem = ChatFileChange | ChatTaskSummaryOutput | ChatTaskSummarySource | TChatTaskSummaryAgent | TChatTaskSummaryPending;
26
26
  export type TChatTaskSummaryList<T> = {
27
27
  items: T[];
28
28
  total: number;
@@ -36,6 +36,7 @@ export type TChatTaskSummarySnapshot = {
36
36
  plan?: ChatTaskSummaryPlan;
37
37
  todos?: ChatTaskSummaryTodos;
38
38
  };
39
+ fileChanges: TChatTaskSummaryList<ChatFileChange>;
39
40
  outputs: TChatTaskSummaryList<ChatTaskSummaryOutput>;
40
41
  sources: TChatTaskSummaryList<ChatTaskSummarySource>;
41
42
  agents: TChatTaskSummaryList<TChatTaskSummaryAgent>;
@@ -1,3 +1,5 @@
1
+ import type { TChatConversationStatus } from './chat-activity.model';
2
+ export type { TChatConversationStatus, IChatConversationUnreadXpertSummary } from './chat-activity.model';
1
3
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
2
4
  import { IXpertAgentExecution } from './xpert-agent-execution.model';
3
5
  import { IXpert } from './xpert.model';
@@ -12,6 +14,17 @@ import { TInterrupt } from '../agent/interrupt';
12
14
  import { IUser } from '../user.model';
13
15
  import type { RuntimeCapabilitiesSelection } from '@xpert-ai/chatkit-types';
14
16
  export type TChatConversationOptions = {
17
+ /** First Project binding is deferred until a human submits the application's setup App. */
18
+ projectCreation?: {
19
+ status: 'awaiting_confirmation';
20
+ } | {
21
+ status: 'confirmed';
22
+ confirmationId: string;
23
+ };
24
+ /** Preserve an explicit no-Project choice across reloads and subsequent sends. */
25
+ projectSelection?: import('./project-selection.model').ProjectSelection;
26
+ /** Persisted resources augment the entry Agent without changing the Assistant graph. */
27
+ runtimeResources?: import('../agent-plugin').RuntimeResourcesSelection;
15
28
  parameters?: {
16
29
  input?: string;
17
30
  [key: string]: unknown;
@@ -34,7 +47,102 @@ export type TChatConversationSourceAudit = {
34
47
  channelType?: string | null;
35
48
  sourceMessageLogIds?: string[];
36
49
  };
37
- export type TChatConversationStatus = 'idle' | 'busy' | 'interrupted' | 'error';
50
+ export type TChatCheckpointReference = {
51
+ threadId: string;
52
+ checkpointNs: string;
53
+ checkpointId: string;
54
+ };
55
+ export type TChatInputCheckpoint = {
56
+ version: 1;
57
+ checkpoint: TChatCheckpointReference | null;
58
+ graphRevision: string;
59
+ };
60
+ /**
61
+ * Server-only graph boundary for an assistant reply. Capture first pins persisted
62
+ * state; both hashes are added only after the final message and its path are saved.
63
+ * An unsealed boundary must never enable branching in public message payloads.
64
+ */
65
+ export type TChatOutputCheckpoint = {
66
+ version: 1;
67
+ /** Exact root-graph resume point; never substitute the thread's latest checkpoint. */
68
+ checkpoint: TChatCheckpointReference;
69
+ /** Root and child namespaces pinned while this execution still owns the thread. */
70
+ checkpoints: TChatCheckpointReference[];
71
+ /** Reject continuation if the published graph no longer matches this boundary. */
72
+ graphRevision: string;
73
+ options?: TChatConversationOptions;
74
+ /** Hash of the finalized presentation; detects later edits to stored messages. */
75
+ messageHash?: string;
76
+ /** Hash of the ordered ancestor path, including the selected assistant reply. */
77
+ messagePathHash?: string;
78
+ /** Access must be checked again before linking these assets to a new conversation. */
79
+ fileAssetIds?: string[];
80
+ agentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
81
+ };
82
+ /** Copy the source thread's ancestor path through afterMessageId, inclusive. */
83
+ export type TConversationBranchRequest = {
84
+ sourceThreadId: string;
85
+ afterMessageId: string;
86
+ /** Reuse this UUID for retries of one user attempt; changing parameters is a conflict. */
87
+ requestId: string;
88
+ };
89
+ /** Audit data and retry identity, not foreign keys into the source conversation. */
90
+ export type TConversationBranchSource = {
91
+ conversationId: string;
92
+ threadId: string;
93
+ messageId: string;
94
+ requestId: string;
95
+ naming?: TConversationBranchNaming;
96
+ };
97
+ /** Persisted numbering group; display titles are never parsed to infer ancestry. */
98
+ export type TConversationBranchNaming = {
99
+ /** Stable numbering group retained even if its original conversation is deleted. */
100
+ familyId: string;
101
+ baseTitle: string;
102
+ /** The original is implicitly 1; generated branches start at 2. */
103
+ number: number;
104
+ /** A different current title means the user renamed the branch and starts a new group. */
105
+ generatedTitle: string;
106
+ };
107
+ /** Public capability reasons shared by history reads and message completion events. */
108
+ export type TChatMessageBranchUnavailableReason = 'message_not_complete' | 'checkpoint_unavailable' | 'graph_changed' | 'state_not_supported';
109
+ /** UI hint only; the branch endpoint revalidates access, state and graph compatibility. */
110
+ export type TChatMessageBranching = {
111
+ available: boolean;
112
+ reason?: TChatMessageBranchUnavailableReason;
113
+ };
114
+ /** @deprecated Legacy presentation metadata. Run control no longer stores or returns display snapshots. */
115
+ export type TChatThreadDisplayPause = {
116
+ executionId: string;
117
+ pauseId: string;
118
+ createdAt: string;
119
+ snapshot?: string;
120
+ };
121
+ export type TChatThreadRunControl = {
122
+ executionId: string;
123
+ state: 'running' | 'pausing' | 'paused';
124
+ pauseId?: string;
125
+ graphRevision?: string;
126
+ checkpoint?: TChatCheckpointReference;
127
+ };
128
+ /** Why a derived conversation thread was created. */
129
+ export declare const ChatThreadPurpose: {
130
+ readonly SideChat: "side-chat";
131
+ readonly MessageEdit: "message-edit";
132
+ };
133
+ export type TChatThreadPurpose = (typeof ChatThreadPurpose)[keyof typeof ChatThreadPurpose];
134
+ /** Machine-readable keys stored in `ChatConversationThread.metadata`. */
135
+ export type TChatThreadMetadata = {
136
+ /** User-editable branch label, independent of the conversation title. */
137
+ title?: string;
138
+ primary?: boolean;
139
+ purpose?: TChatThreadPurpose;
140
+ /** Graph revision the edited input was captured on; cleared after the first successful run. */
141
+ forkGraphRevision?: string;
142
+ /** Client-provided idempotency key for branch creation. */
143
+ forkRequestId?: string;
144
+ [key: string]: unknown;
145
+ };
38
146
  export type TToolCallType = 'agent' | 'tool';
39
147
  export type TChatFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'schedule' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom' | 'wechat';
40
148
  /**
@@ -68,6 +176,7 @@ export type TSensitiveOperation = {
68
176
  * Corresponds to the thread in the [Agent Protocol](https://github.com/langchain-ai/agent-protocol).
69
177
  */
70
178
  export interface IChatConversation extends IBasePerTenantAndOrganizationEntityModel {
179
+ branchSource?: TConversationBranchSource | null;
71
180
  /**
72
181
  * Non-persistent, response-only field populated by the sidebar endpoint.
73
182
  * Not stored on the ChatConversation entity or in the chat_conversation table.
@@ -159,18 +268,6 @@ export interface IChatConversationMarkReadRequest {
159
268
  export interface IChatConversationUnreadXpertsRequest {
160
269
  xpertIds: string[];
161
270
  }
162
- export interface IChatConversationUnreadXpertSummary {
163
- xpertId: string;
164
- unreadMessages: number;
165
- unreadConversations: number;
166
- latestUnreadAt?: Date | string | null;
167
- latestUnreadConversationId?: string | null;
168
- latestUnreadThreadId?: string | null;
169
- latestConversationAt?: Date | string | null;
170
- latestConversationId?: string | null;
171
- latestConversationThreadId?: string | null;
172
- latestConversationTitle?: string | null;
173
- }
174
271
  export type ChatMessage = {
175
272
  conversationId: string;
176
273
  id: string;
@@ -0,0 +1,2 @@
1
+ /** The workspace entry that owns a ClawXpert conversation. */
2
+ export type ClawXpertConversationScope = 'task' | 'assistant';
@@ -0,0 +1,40 @@
1
+ import type { ActiveCapabilityPointer, CapabilityVersion } from './capability-version';
2
+ import type { ExportEvolutionBaselineRequest } from './candidate';
3
+ import type { EvolutionArtifactRef } from './target';
4
+ /** A provider-owned, read-only snapshot of the currently published source rules. */
5
+ export interface EvolutionBaselinePreview {
6
+ hash: string;
7
+ contentJson: string;
8
+ ready: boolean;
9
+ issues: string[];
10
+ }
11
+ export interface EvolutionBaselineInspection {
12
+ targetId: string;
13
+ canManage: boolean;
14
+ status: 'missing' | 'current' | 'update_available' | 'blocked' | 'managed_release';
15
+ preview: EvolutionBaselinePreview;
16
+ current: {
17
+ pointer: ActiveCapabilityPointer;
18
+ version: CapabilityVersion;
19
+ contentJson: string | null;
20
+ } | null;
21
+ }
22
+ export interface EvolutionBaselineIdentity {
23
+ tenantId: string;
24
+ organizationId: string;
25
+ targetId: string;
26
+ }
27
+ export interface EvolutionBaselinePublishRequest extends EvolutionBaselineIdentity {
28
+ mode: 'initialize' | 'update';
29
+ expectedRevision: number;
30
+ expectedHash: string;
31
+ reason: string;
32
+ }
33
+ export interface EvolutionBaselineRuntimeApi {
34
+ inspect(input: EvolutionBaselineIdentity): Promise<EvolutionBaselineInspection>;
35
+ publish(input: EvolutionBaselinePublishRequest): Promise<ActiveCapabilityPointer>;
36
+ }
37
+ export interface EvolutionBaselineReader {
38
+ previewBaseline(request: ExportEvolutionBaselineRequest): Promise<EvolutionBaselinePreview>;
39
+ readBaseline(request: ExportEvolutionBaselineRequest, artifact: EvolutionArtifactRef): Promise<string>;
40
+ }
@@ -83,16 +83,53 @@ export interface EvolutionWorkbenchLink {
83
83
  parameters: Record<string, string>;
84
84
  }
85
85
  export interface EvolutionPresentationMetric {
86
+ kind?: 'adoption';
86
87
  key: string;
87
88
  label: I18nText;
88
89
  value: string | number | null;
89
90
  total?: number;
90
91
  }
92
+ /** Provider-owned business explanations; never parsed from titles or candidate JSON by the UI. */
93
+ export interface EvolutionChangeBusinessDetails {
94
+ title: I18nText;
95
+ baselineLabel?: I18nText;
96
+ validationHint?: I18nText;
97
+ proposal?: I18nText;
98
+ rationale?: I18nText;
99
+ context: Array<{
100
+ key: string;
101
+ label: I18nText;
102
+ value?: string;
103
+ }>;
104
+ evidence: Array<{
105
+ key: string;
106
+ documentName?: string;
107
+ page?: number;
108
+ location?: string;
109
+ quote?: string;
110
+ document?: {
111
+ knowledgebaseId: string;
112
+ documentId: string;
113
+ };
114
+ }>;
115
+ changes: Array<{
116
+ key: string;
117
+ label: I18nText;
118
+ before?: I18nText;
119
+ after: I18nText;
120
+ }>;
121
+ adoption?: {
122
+ subjectLabel: I18nText;
123
+ adopted: number;
124
+ total: number;
125
+ };
126
+ }
91
127
  export interface EvolutionChangePresentation {
92
128
  title: string;
93
129
  resourceLabel: string;
94
130
  contextLabel?: string;
95
131
  description?: I18nText;
132
+ business?: EvolutionChangeBusinessDetails;
96
133
  metrics?: EvolutionPresentationMetric[];
97
134
  effect?: {
98
135
  status: 'pending' | 'partial' | 'active' | 'unknown';
@@ -130,6 +167,21 @@ export interface EvolutionChange {
130
167
  failureReasons?: string[];
131
168
  presentation?: EvolutionChangePresentation;
132
169
  presentationUnavailable?: boolean;
170
+ /** Optional execution transcript in the initiating assistant's ChatKit. */
171
+ executionContext?: EvolutionExecutionContext;
172
+ executionConversation?: EvolutionExecutionConversation;
173
+ }
174
+ export interface EvolutionExecutionContext {
175
+ xpertId: string;
176
+ projectId?: string;
177
+ title: string;
178
+ input: string;
179
+ language?: string;
180
+ }
181
+ export interface EvolutionExecutionConversation {
182
+ conversationId: string;
183
+ threadId: string;
184
+ executionId: string;
133
185
  }
134
186
  export interface EvolutionChangeOperation {
135
187
  context: EvolutionProviderContext;
@@ -152,6 +204,7 @@ export interface EvolutionChangeIdentity {
152
204
  organizationId: string;
153
205
  }
154
206
  export interface SubmitEvolutionChange extends EvolutionChangeIdentity {
207
+ executionContext?: EvolutionExecutionContext;
155
208
  strategyId: string;
156
209
  sourceKind: EvolutionInputKind;
157
210
  learningEventIds?: string[];
@@ -12,3 +12,4 @@ export * from './experience';
12
12
  export * from './change';
13
13
  export * from './persistence';
14
14
  export * from './strategy';
15
+ export * from './baseline';
@@ -6,6 +6,8 @@ import type { EvolutionScope } from './target';
6
6
  import type { EvolutionChangeCandidate, EvolutionChangeEvaluation, EvolutionEvidenceRef, EvolutionPublicationReceipt, EvolutionVersionRef } from './change';
7
7
  /** Evidence requests share Proposal persistence without fabricating trusted learning events. */
8
8
  export interface EvidenceEvolutionProposal extends Pick<ImprovementProposal, 'problemStatement' | 'rootCause' | 'changeHypothesis' | 'riskLevel' | 'evidenceEventIds' | 'baseVersionId'> {
9
+ executionContext?: import('./change').EvolutionExecutionContext;
10
+ executionConversation?: import('./change').EvolutionExecutionConversation;
9
11
  sourceKind: import('./strategy').EvolutionInputKind;
10
12
  strategy: import('./strategy').EvolutionStrategySnapshot;
11
13
  stages: import('./strategy').EvolutionStageRecord[];
@@ -6,7 +6,7 @@ export interface EvolutionCandidateBuilder {
6
6
  buildCandidate(request: BuildEvolutionCandidateRequest): Promise<CandidateBuildResult>;
7
7
  validateCandidate(request: ValidateEvolutionCandidateRequest): Promise<CandidateValidationResult>;
8
8
  }
9
- export interface EvolutionBaselineExporter {
9
+ export interface EvolutionBaselineExporter extends Partial<import('./baseline').EvolutionBaselineReader> {
10
10
  exportBaseline(request: ExportEvolutionBaselineRequest): Promise<ExportEvolutionBaselineResult>;
11
11
  }
12
12
  export interface EvolutionReplayEvaluator {