@xpert-ai/contracts 3.18.5 → 3.19.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/index.cjs.js +1045 -216
- package/index.esm.js +1023 -217
- package/package.json +3 -3
- package/src/agent-plugin.d.ts +192 -0
- package/src/ai/assistant-configuration.model.d.ts +45 -0
- package/src/ai/assistant-order.d.ts +5 -0
- package/src/ai/assistant-trigger.model.d.ts +56 -0
- package/src/ai/chat-activity.model.d.ts +14 -0
- package/src/ai/chat-message.model.d.ts +10 -1
- package/src/ai/chat-task-summary.model.d.ts +4 -3
- package/src/ai/chat.model.d.ts +100 -13
- package/src/ai/clawxpert-conversation-scope.model.d.ts +2 -0
- package/src/ai/evolution/baseline.d.ts +40 -0
- package/src/ai/evolution/change.d.ts +53 -0
- package/src/ai/evolution/index.d.ts +1 -0
- package/src/ai/evolution/persistence.d.ts +2 -0
- package/src/ai/evolution/provider.d.ts +1 -1
- package/src/ai/index.d.ts +9 -0
- package/src/ai/knowledge-doc.model.d.ts +18 -1
- package/src/ai/knowledge-filter.model.d.ts +26 -1
- package/src/ai/knowledge-graph.model.d.ts +18 -1
- package/src/ai/knowledge-keyword-analyzer.model.d.ts +18 -0
- package/src/ai/knowledge-parser-selection.d.ts +6 -0
- package/src/ai/knowledgebase.model.d.ts +18 -0
- package/src/ai/mcp-publication.model.d.ts +1 -1
- package/src/ai/middleware.model.d.ts +1 -0
- package/src/ai/mobile.model.d.ts +5 -0
- package/src/ai/project-selection.model.d.ts +9 -0
- package/src/ai/project-task-graph.model.d.ts +58 -0
- package/src/ai/project-task-schedule.d.ts +24 -0
- package/src/ai/prompt-workflow-capabilities.model.d.ts +15 -0
- package/src/ai/prompt-workflow.model.d.ts +13 -0
- package/src/ai/sandbox-file-output.model.d.ts +9 -0
- package/src/ai/xpert-agent-execution.model.d.ts +33 -0
- package/src/ai/xpert-chat.model.d.ts +2 -0
- package/src/ai/xpert-marketplace.model.d.ts +5 -0
- package/src/ai/xpert-project-type.model.d.ts +56 -0
- package/src/ai/xpert-project.model.d.ts +25 -1
- package/src/ai/xpert-template.model.d.ts +30 -0
- package/src/ai/xpert-tool-mcp.model.d.ts +15 -1
- package/src/ai/xpert-workflow.model.d.ts +15 -1
- package/src/ai/xpert.model.d.ts +15 -1
- package/src/desktop-shell.model.d.ts +159 -0
- package/src/index.d.ts +4 -0
- package/src/integration.model.d.ts +19 -0
- package/src/plugin.d.ts +26 -7
- package/src/tag-entity.model.d.ts +1 -1
- package/src/view-extension/index.d.ts +2 -0
- package/src/view-extension/model.d.ts +20 -1
- package/src/view-extension/workbench-open.d.ts +10 -0
- package/src/view-extension/workbench.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/contracts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@octokit/types": "13.10.0",
|
|
23
23
|
"@types/json-schema": "^7.0.15",
|
|
24
|
-
"@xpert-ai/chatkit-types": "
|
|
24
|
+
"@xpert-ai/chatkit-types": "0.8.0",
|
|
25
25
|
"zod-to-json-schema": "^3.25.2"
|
|
26
26
|
},
|
|
27
27
|
"types": "./index.d.ts"
|
|
28
|
-
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { JSONValue } from './core.model';
|
|
2
|
+
import type { IconDefinition, TAvatar } from './types';
|
|
3
|
+
import type { I18nText } from './i18n.model';
|
|
4
|
+
/**
|
|
5
|
+
* Selectable standard package, configured middleware, or published platform Assistant.
|
|
6
|
+
* agent_plugin is distinct from a native server-code plugin.
|
|
7
|
+
*/
|
|
8
|
+
export type RuntimeResourceKind = 'agent_plugin' | 'middleware' | 'external_xpert';
|
|
9
|
+
/**
|
|
10
|
+
* Availability in the current user/project context; execution still revalidates access.
|
|
11
|
+
* partial means some components are usable; requires_auth needs personal authorization;
|
|
12
|
+
* configuration_required needs administrator configuration.
|
|
13
|
+
*/
|
|
14
|
+
export type RuntimeResourceStatus = 'ready' | 'requires_auth' | 'configuration_required' | 'partial' | 'unavailable';
|
|
15
|
+
/** Version-pinned catalog reference; copy both fields unchanged when selecting. */
|
|
16
|
+
export interface RuntimeResourceReference {
|
|
17
|
+
/** Opaque resource ID, not necessarily a UUID; distinct from Connector or invocation IDs. */
|
|
18
|
+
bindingId: string;
|
|
19
|
+
/** Opaque resource version; existing selections must not silently upgrade. */
|
|
20
|
+
version: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Complete conversation selection, independent of graph runtimeCapabilities.
|
|
24
|
+
* Updates apply to the next execution without changing the Assistant graph.
|
|
25
|
+
*/
|
|
26
|
+
export interface RuntimeResourcesSelection {
|
|
27
|
+
/** Optimistic concurrency revision: use the latest server value; new selections start at zero. */
|
|
28
|
+
revision: number;
|
|
29
|
+
/** Full replacement set; an empty array clears the selection. */
|
|
30
|
+
resources: RuntimeResourceReference[];
|
|
31
|
+
}
|
|
32
|
+
/** Package or component diagnostic. Use code for programmatic handling, message for display. */
|
|
33
|
+
export interface AgentPluginDiagnostic {
|
|
34
|
+
/** Component key/path or package-level location. */
|
|
35
|
+
component: string;
|
|
36
|
+
code: string;
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
/** Contextual resource descriptor. Selection identity is bindingId plus version. */
|
|
40
|
+
export interface RuntimeResourceCatalogItem extends RuntimeResourceReference {
|
|
41
|
+
kind: RuntimeResourceKind;
|
|
42
|
+
title: string;
|
|
43
|
+
description?: I18nText;
|
|
44
|
+
icon?: string;
|
|
45
|
+
/** Actual resource avatar, including published Assistant avatars. */
|
|
46
|
+
avatar?: TAvatar;
|
|
47
|
+
/** Middleware/provider icon; use a category fallback when absent. */
|
|
48
|
+
iconDefinition?: IconDefinition;
|
|
49
|
+
/** Related middleware Views for display, not active View instances. */
|
|
50
|
+
views?: RuntimeResourceView[];
|
|
51
|
+
status: RuntimeResourceStatus;
|
|
52
|
+
diagnostics: AgentPluginDiagnostic[];
|
|
53
|
+
/** Package components and their individual availability. Plugins are selected as a whole. */
|
|
54
|
+
components: Array<{
|
|
55
|
+
key: string;
|
|
56
|
+
kind: 'skill' | 'mcp' | 'middleware' | 'external_xpert';
|
|
57
|
+
status: RuntimeResourceStatus;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
/** Related View metadata; displaying it neither activates the View nor grants access. */
|
|
61
|
+
export interface RuntimeResourceView {
|
|
62
|
+
key: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description?: I18nText;
|
|
65
|
+
icon?: IconDefinition;
|
|
66
|
+
/** Feature keys used to associate the View with middleware. */
|
|
67
|
+
requiredFeatures: string[];
|
|
68
|
+
}
|
|
69
|
+
/** Paginated resource search result in the authorized context. */
|
|
70
|
+
export interface RuntimeResourceCatalog {
|
|
71
|
+
items: RuntimeResourceCatalogItem[];
|
|
72
|
+
/** Total matches before pagination. */
|
|
73
|
+
total: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Portable extensions["xpertai"] manifest data. References installed capabilities;
|
|
77
|
+
* contains no server code, deployment IDs or credentials.
|
|
78
|
+
*/
|
|
79
|
+
export interface AgentPluginXpertExtension {
|
|
80
|
+
/** Extension schema version, independent of the Agent Plugins spec version. */
|
|
81
|
+
version: 1;
|
|
82
|
+
interface?: {
|
|
83
|
+
displayName?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
icon?: string;
|
|
86
|
+
};
|
|
87
|
+
/** Presets for already installed middleware providers. */
|
|
88
|
+
middlewares?: Array<{
|
|
89
|
+
key: string;
|
|
90
|
+
provider: string;
|
|
91
|
+
options?: {
|
|
92
|
+
[key: string]: JSONValue;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
/** Logical expert references mapped to published Assistants by the administrator. */
|
|
96
|
+
experts?: Array<{
|
|
97
|
+
key: string;
|
|
98
|
+
reference: string;
|
|
99
|
+
}>;
|
|
100
|
+
/** Authentication dependencies keyed by the exact server name in mcp.json. */
|
|
101
|
+
connectors?: {
|
|
102
|
+
[serverName: string]: AgentPluginConnectorAuth;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Portable MCP authorization requirement: generic MCP OAuth or an existing Connector provider. */
|
|
106
|
+
export type AgentPluginConnectorAuth = {
|
|
107
|
+
type: 'mcp_oauth';
|
|
108
|
+
scopes?: string[];
|
|
109
|
+
/** OAuth client registration mode; omission uses host defaults. */
|
|
110
|
+
clientRegistration?: 'dynamic' | 'preregistered';
|
|
111
|
+
} | {
|
|
112
|
+
type: 'existing';
|
|
113
|
+
provider: string;
|
|
114
|
+
/** Resource/audience understood by the Connector provider. */
|
|
115
|
+
resource: string;
|
|
116
|
+
scopes?: string[];
|
|
117
|
+
};
|
|
118
|
+
/** Host-local authorization binding; never include it in a portable package. */
|
|
119
|
+
export interface AgentPluginConnectorBinding {
|
|
120
|
+
bindingId: string;
|
|
121
|
+
provider: string;
|
|
122
|
+
}
|
|
123
|
+
/** Administrator-owned resource configuration; deployment-local IDs are allowed here. */
|
|
124
|
+
export type RuntimeResourceDefinition = {
|
|
125
|
+
kind: 'agent_plugin';
|
|
126
|
+
packageId: string;
|
|
127
|
+
/** Portable expert reference to approved, published Assistant ID. */
|
|
128
|
+
experts: {
|
|
129
|
+
[reference: string]: string;
|
|
130
|
+
};
|
|
131
|
+
/** Direct MCP OAuth server names; must not overlap connectorServers. */
|
|
132
|
+
oauthServers?: string[];
|
|
133
|
+
/** Connector requirements, optionally populated from the package extension. */
|
|
134
|
+
connectorServers?: {
|
|
135
|
+
[serverName: string]: AgentPluginConnectorAuth;
|
|
136
|
+
};
|
|
137
|
+
} | {
|
|
138
|
+
kind: 'middleware';
|
|
139
|
+
provider: string;
|
|
140
|
+
options: {
|
|
141
|
+
[key: string]: JSONValue;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
kind: 'external_xpert';
|
|
145
|
+
/** Published platform Assistant ID, not a remote Agent URL. */
|
|
146
|
+
xpertId: string;
|
|
147
|
+
};
|
|
148
|
+
/** Administrator request to publish a resource binding. */
|
|
149
|
+
export interface RuntimeResourceBindingInput {
|
|
150
|
+
/** Supersede an existing binding; its conversation selections are not silently rewritten. */
|
|
151
|
+
replacesBindingId?: string;
|
|
152
|
+
title: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
/** Workspaces granted access within the organization. */
|
|
155
|
+
workspaceIds: string[];
|
|
156
|
+
definition: RuntimeResourceDefinition;
|
|
157
|
+
}
|
|
158
|
+
/** Editor-facing workspace installation catalog. Never includes sources, MCP configuration or credentials. */
|
|
159
|
+
export interface WorkspaceAgentPlugin {
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
description?: I18nText;
|
|
163
|
+
icon?: string;
|
|
164
|
+
version: string;
|
|
165
|
+
status: 'available' | 'not_published' | 'disabled';
|
|
166
|
+
components: Array<{
|
|
167
|
+
kind: 'skill' | 'mcp' | 'middleware' | 'external_xpert';
|
|
168
|
+
name: string;
|
|
169
|
+
}>;
|
|
170
|
+
expertReferences: string[];
|
|
171
|
+
}
|
|
172
|
+
export interface WorkspaceAgentPluginOptions {
|
|
173
|
+
workspaces: Array<{
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
}>;
|
|
177
|
+
experts: Array<{
|
|
178
|
+
id: string;
|
|
179
|
+
name: string;
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
/** Add one imported package to one editable workspace without changing other workspaces or conversations. */
|
|
183
|
+
export interface WorkspaceAgentPluginAddInput {
|
|
184
|
+
packageId: string;
|
|
185
|
+
experts: {
|
|
186
|
+
[reference: string]: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export interface WorkspaceAgentPluginAddResult {
|
|
190
|
+
status: 'added' | 'already_added';
|
|
191
|
+
bindingId: string;
|
|
192
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IXpertAgent } from './xpert-agent.model';
|
|
2
|
+
import type { TXpertFeatures, TXpertTeamConnection, TXpertTeamNode } from './xpert.model';
|
|
3
|
+
import type { XpertTemplateSetup } from './xpert-template.model';
|
|
4
|
+
/** Tracks only capability-owned changes so editing does not replace a user's workflow. */
|
|
5
|
+
export interface AssistantCapabilityState {
|
|
6
|
+
version: 1;
|
|
7
|
+
selected: string[];
|
|
8
|
+
nodes: {
|
|
9
|
+
key: string;
|
|
10
|
+
before?: TXpertTeamNode;
|
|
11
|
+
after: TXpertTeamNode;
|
|
12
|
+
}[];
|
|
13
|
+
connections: {
|
|
14
|
+
key: string;
|
|
15
|
+
before?: TXpertTeamConnection;
|
|
16
|
+
after: TXpertTeamConnection;
|
|
17
|
+
}[];
|
|
18
|
+
agentKey: string;
|
|
19
|
+
agentOptions?: {
|
|
20
|
+
before?: Pick<IXpertAgent['options'], 'middlewares' | 'parallelToolCalls'>;
|
|
21
|
+
after?: Pick<IXpertAgent['options'], 'middlewares' | 'parallelToolCalls'>;
|
|
22
|
+
};
|
|
23
|
+
sandbox?: {
|
|
24
|
+
before?: TXpertFeatures['sandbox'];
|
|
25
|
+
after?: TXpertFeatures['sandbox'];
|
|
26
|
+
};
|
|
27
|
+
instructions: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AssistantConfiguration {
|
|
30
|
+
revision: string;
|
|
31
|
+
workspace: {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
prompt: string;
|
|
36
|
+
modelId: string;
|
|
37
|
+
capabilities: string[];
|
|
38
|
+
setup: XpertTemplateSetup;
|
|
39
|
+
}
|
|
40
|
+
export interface AssistantConfigurationInput {
|
|
41
|
+
revision: string;
|
|
42
|
+
prompt: string;
|
|
43
|
+
modelId: string;
|
|
44
|
+
capabilities: string[];
|
|
45
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { I18nObject } from '../types';
|
|
2
|
+
import type { TWorkflowTriggerMeta } from './xpert-workflow.model';
|
|
3
|
+
import type { JsonSchemaObjectType } from './types';
|
|
4
|
+
export type AssistantTriggerCategory = 'channel' | 'automation';
|
|
5
|
+
export type AssistantAutomationKind = 'schedule' | 'app-event' | 'webhook' | 'email';
|
|
6
|
+
/** Provider-owned UI mapping; field names refer to the existing Trigger config schema. */
|
|
7
|
+
export interface AssistantTriggerPresentation {
|
|
8
|
+
category: AssistantTriggerCategory;
|
|
9
|
+
channel?: string;
|
|
10
|
+
kind?: AssistantAutomationKind;
|
|
11
|
+
accountFields?: string[];
|
|
12
|
+
instructionField?: string;
|
|
13
|
+
}
|
|
14
|
+
export type AssistantTriggerValue = string | number | boolean | null | AssistantTriggerValue[] | {
|
|
15
|
+
[key: string]: AssistantTriggerValue;
|
|
16
|
+
};
|
|
17
|
+
export type AssistantTriggerConfig = {
|
|
18
|
+
[key: string]: AssistantTriggerValue;
|
|
19
|
+
};
|
|
20
|
+
export interface AssistantTriggerProvider {
|
|
21
|
+
name: string;
|
|
22
|
+
label: I18nObject;
|
|
23
|
+
presentation?: AssistantTriggerPresentation;
|
|
24
|
+
schema: JsonSchemaObjectType;
|
|
25
|
+
quickConnect?: TWorkflowTriggerMeta['quickConnect'];
|
|
26
|
+
available: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface AssistantTriggerItem {
|
|
29
|
+
key: string;
|
|
30
|
+
provider: string;
|
|
31
|
+
title: string;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
config: AssistantTriggerConfig;
|
|
34
|
+
lastActivityAt: string | null;
|
|
35
|
+
lastRunAt: string | null;
|
|
36
|
+
connection: 'connected' | 'disconnected' | 'connecting' | 'failed' | 'unknown';
|
|
37
|
+
}
|
|
38
|
+
export interface AssistantTriggerSettings {
|
|
39
|
+
revision: string;
|
|
40
|
+
canEdit: boolean;
|
|
41
|
+
providers: AssistantTriggerProvider[];
|
|
42
|
+
items: AssistantTriggerItem[];
|
|
43
|
+
}
|
|
44
|
+
export type AssistantTriggerMutation = {
|
|
45
|
+
revision: string;
|
|
46
|
+
provider: string;
|
|
47
|
+
} & ({
|
|
48
|
+
operation: 'save';
|
|
49
|
+
title: string;
|
|
50
|
+
config: AssistantTriggerConfig;
|
|
51
|
+
} | {
|
|
52
|
+
operation: 'toggle';
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
} | {
|
|
55
|
+
operation: 'delete';
|
|
56
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TChatConversationStatus = 'idle' | 'busy' | 'pausing' | 'paused' | 'interrupted' | 'error';
|
|
2
|
+
export interface IChatConversationUnreadXpertSummary {
|
|
3
|
+
xpertId: string;
|
|
4
|
+
unreadMessages: number;
|
|
5
|
+
unreadConversations: number;
|
|
6
|
+
latestUnreadAt?: Date | string | null;
|
|
7
|
+
latestUnreadConversationId?: string | null;
|
|
8
|
+
latestUnreadThreadId?: string | null;
|
|
9
|
+
latestConversationAt?: Date | string | null;
|
|
10
|
+
latestConversationId?: string | null;
|
|
11
|
+
latestConversationThreadId?: string | null;
|
|
12
|
+
latestConversationTitle?: string | null;
|
|
13
|
+
latestConversationStatus?: TChatConversationStatus | null;
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
@@ -59,6 +59,15 @@ export interface IChatMessage extends IBasePerTenantAndOrganizationEntityModel,
|
|
|
59
59
|
parent?: IChatMessage | null;
|
|
60
60
|
children?: IChatMessage[];
|
|
61
61
|
parentId?: string | null;
|
|
62
|
+
inputCheckpoint?: TChatInputCheckpoint | null;
|
|
63
|
+
/** Internal persisted state; excluded from public DTOs and raw stream events. */
|
|
64
|
+
outputCheckpoint?: TChatOutputCheckpoint | null;
|
|
65
|
+
/** Public capability derived from the finalized message, not inferred from executionId. */
|
|
66
|
+
branching?: TChatMessageBranching;
|
|
67
|
+
/** Copied execution history is display-only and must not restore live tool sessions. */
|
|
68
|
+
historical?: boolean;
|
|
69
|
+
/** Owned snapshot for a branch whose original execution may later be deleted. */
|
|
70
|
+
historicalAgentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
|
|
62
71
|
/**
|
|
63
72
|
* @deprecated Chat attachments now use `fileAssets`. This field is kept only
|
|
64
73
|
* 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>;
|
package/src/ai/chat.model.d.ts
CHANGED
|
@@ -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,10 @@ 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
|
+
/** Preserve an explicit no-Project choice across reloads and subsequent sends. */
|
|
18
|
+
projectSelection?: import('./project-selection.model').ProjectSelection;
|
|
19
|
+
/** Persisted resources augment the entry Agent without changing the Assistant graph. */
|
|
20
|
+
runtimeResources?: import('../agent-plugin').RuntimeResourcesSelection;
|
|
15
21
|
parameters?: {
|
|
16
22
|
input?: string;
|
|
17
23
|
[key: string]: unknown;
|
|
@@ -34,7 +40,99 @@ export type TChatConversationSourceAudit = {
|
|
|
34
40
|
channelType?: string | null;
|
|
35
41
|
sourceMessageLogIds?: string[];
|
|
36
42
|
};
|
|
37
|
-
export type
|
|
43
|
+
export type TChatCheckpointReference = {
|
|
44
|
+
threadId: string;
|
|
45
|
+
checkpointNs: string;
|
|
46
|
+
checkpointId: string;
|
|
47
|
+
};
|
|
48
|
+
export type TChatInputCheckpoint = {
|
|
49
|
+
version: 1;
|
|
50
|
+
checkpoint: TChatCheckpointReference | null;
|
|
51
|
+
graphRevision: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Server-only graph boundary for an assistant reply. Capture first pins persisted
|
|
55
|
+
* state; both hashes are added only after the final message and its path are saved.
|
|
56
|
+
* An unsealed boundary must never enable branching in public message payloads.
|
|
57
|
+
*/
|
|
58
|
+
export type TChatOutputCheckpoint = {
|
|
59
|
+
version: 1;
|
|
60
|
+
/** Exact root-graph resume point; never substitute the thread's latest checkpoint. */
|
|
61
|
+
checkpoint: TChatCheckpointReference;
|
|
62
|
+
/** Root and child namespaces pinned while this execution still owns the thread. */
|
|
63
|
+
checkpoints: TChatCheckpointReference[];
|
|
64
|
+
/** Reject continuation if the published graph no longer matches this boundary. */
|
|
65
|
+
graphRevision: string;
|
|
66
|
+
options?: TChatConversationOptions;
|
|
67
|
+
/** Hash of the finalized presentation; detects later edits to stored messages. */
|
|
68
|
+
messageHash?: string;
|
|
69
|
+
/** Hash of the ordered ancestor path, including the selected assistant reply. */
|
|
70
|
+
messagePathHash?: string;
|
|
71
|
+
/** Access must be checked again before linking these assets to a new conversation. */
|
|
72
|
+
fileAssetIds?: string[];
|
|
73
|
+
agentRuns?: import('./xpert-agent-execution.model').TChatAgentRunSummary[];
|
|
74
|
+
};
|
|
75
|
+
/** Copy the source thread's ancestor path through afterMessageId, inclusive. */
|
|
76
|
+
export type TConversationBranchRequest = {
|
|
77
|
+
sourceThreadId: string;
|
|
78
|
+
afterMessageId: string;
|
|
79
|
+
/** Reuse this UUID for retries of one user attempt; changing parameters is a conflict. */
|
|
80
|
+
requestId: string;
|
|
81
|
+
};
|
|
82
|
+
/** Audit data and retry identity, not foreign keys into the source conversation. */
|
|
83
|
+
export type TConversationBranchSource = {
|
|
84
|
+
conversationId: string;
|
|
85
|
+
threadId: string;
|
|
86
|
+
messageId: string;
|
|
87
|
+
requestId: string;
|
|
88
|
+
naming?: TConversationBranchNaming;
|
|
89
|
+
};
|
|
90
|
+
/** Persisted numbering group; display titles are never parsed to infer ancestry. */
|
|
91
|
+
export type TConversationBranchNaming = {
|
|
92
|
+
/** Stable numbering group retained even if its original conversation is deleted. */
|
|
93
|
+
familyId: string;
|
|
94
|
+
baseTitle: string;
|
|
95
|
+
/** The original is implicitly 1; generated branches start at 2. */
|
|
96
|
+
number: number;
|
|
97
|
+
/** A different current title means the user renamed the branch and starts a new group. */
|
|
98
|
+
generatedTitle: string;
|
|
99
|
+
};
|
|
100
|
+
/** Public capability reasons shared by history reads and message completion events. */
|
|
101
|
+
export type TChatMessageBranchUnavailableReason = 'message_not_complete' | 'checkpoint_unavailable' | 'graph_changed' | 'state_not_supported';
|
|
102
|
+
/** UI hint only; the branch endpoint revalidates access, state and graph compatibility. */
|
|
103
|
+
export type TChatMessageBranching = {
|
|
104
|
+
available: boolean;
|
|
105
|
+
reason?: TChatMessageBranchUnavailableReason;
|
|
106
|
+
};
|
|
107
|
+
export type TChatThreadDisplayPause = {
|
|
108
|
+
executionId: string;
|
|
109
|
+
pauseId: string;
|
|
110
|
+
createdAt: string;
|
|
111
|
+
snapshot?: string;
|
|
112
|
+
};
|
|
113
|
+
export type TChatThreadRunControl = {
|
|
114
|
+
executionId: string;
|
|
115
|
+
state: 'running' | 'pausing' | 'paused';
|
|
116
|
+
pauseId?: string;
|
|
117
|
+
graphRevision?: string;
|
|
118
|
+
checkpoint?: TChatCheckpointReference;
|
|
119
|
+
};
|
|
120
|
+
/** Why a derived conversation thread was created. */
|
|
121
|
+
export declare const ChatThreadPurpose: {
|
|
122
|
+
readonly SideChat: "side-chat";
|
|
123
|
+
readonly MessageEdit: "message-edit";
|
|
124
|
+
};
|
|
125
|
+
export type TChatThreadPurpose = (typeof ChatThreadPurpose)[keyof typeof ChatThreadPurpose];
|
|
126
|
+
/** Machine-readable keys stored in `ChatConversationThread.metadata`. */
|
|
127
|
+
export type TChatThreadMetadata = {
|
|
128
|
+
primary?: boolean;
|
|
129
|
+
purpose?: TChatThreadPurpose;
|
|
130
|
+
/** Graph revision the edited input was captured on; cleared after the first successful run. */
|
|
131
|
+
forkGraphRevision?: string;
|
|
132
|
+
/** Client-provided idempotency key for branch creation. */
|
|
133
|
+
forkRequestId?: string;
|
|
134
|
+
[key: string]: unknown;
|
|
135
|
+
};
|
|
38
136
|
export type TToolCallType = 'agent' | 'tool';
|
|
39
137
|
export type TChatFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'schedule' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom' | 'wechat';
|
|
40
138
|
/**
|
|
@@ -68,6 +166,7 @@ export type TSensitiveOperation = {
|
|
|
68
166
|
* Corresponds to the thread in the [Agent Protocol](https://github.com/langchain-ai/agent-protocol).
|
|
69
167
|
*/
|
|
70
168
|
export interface IChatConversation extends IBasePerTenantAndOrganizationEntityModel {
|
|
169
|
+
branchSource?: TConversationBranchSource | null;
|
|
71
170
|
/**
|
|
72
171
|
* Non-persistent, response-only field populated by the sidebar endpoint.
|
|
73
172
|
* Not stored on the ChatConversation entity or in the chat_conversation table.
|
|
@@ -159,18 +258,6 @@ export interface IChatConversationMarkReadRequest {
|
|
|
159
258
|
export interface IChatConversationUnreadXpertsRequest {
|
|
160
259
|
xpertIds: string[];
|
|
161
260
|
}
|
|
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
261
|
export type ChatMessage = {
|
|
175
262
|
conversationId: string;
|
|
176
263
|
id: string;
|
|
@@ -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[];
|
|
@@ -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[];
|