@metad/contracts 3.8.3 → 3.9.0-beta.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 +709 -310
- package/index.esm.js +695 -305
- package/package.json +6 -6
- package/src/agent/graph.d.ts +44 -29
- package/src/agent/token.d.ts +0 -17
- package/src/ai/assistant-binding.model.d.ts +74 -0
- package/src/ai/chat-event.model.d.ts +8 -0
- package/src/ai/chat-message.model.d.ts +1 -1
- package/src/ai/chat.model.d.ts +7 -1
- package/src/ai/feature.model.d.ts +5 -1
- package/src/ai/index.d.ts +40 -1
- package/src/ai/message-content.utils.d.ts +7 -1
- package/src/ai/sandbox.d.ts +3 -1
- package/src/ai/skill.model.d.ts +37 -18
- package/src/ai/xpert-agent-execution.model.d.ts +9 -0
- package/src/ai/xpert-agent.model.d.ts +3 -31
- package/src/ai/xpert-chat.model.d.ts +66 -0
- package/src/ai/xpert-project.model.d.ts +3 -0
- package/src/ai/xpert-workspace.model.d.ts +6 -1
- package/src/ai/xpert.model.d.ts +14 -4
- package/src/ai/xpert.utils.d.ts +8 -5
- package/src/api-key.model.d.ts +59 -1
- package/src/index.d.ts +3 -0
- package/src/integration.model.d.ts +7 -0
- package/src/invite.model.d.ts +2 -0
- package/src/plugin.d.ts +66 -1
- package/src/role.model.d.ts +3 -4
- package/src/scope.model.d.ts +9 -0
- package/src/types.d.ts +5 -2
- package/src/user-group.model.d.ts +7 -0
- package/src/view-extension/index.d.ts +1 -0
- package/src/view-extension/model.d.ts +183 -0
- package/index.esm.d.ts +0 -1
- package/src/help-center-article.model.d.ts +0 -0
- package/src/help-center.model.d.ts +0 -0
- package/src/integration/dify.d.ts +0 -0
- package/src/integration/fastgpt.d.ts +0 -0
- /package/{index.cjs.d.ts → index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metad/contracts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-beta.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"url": "https://github.com/xpert-ai/xpert/issues"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"docs": "
|
|
13
|
+
"docs": "pnpm typedoc --out ./.docs"
|
|
14
14
|
},
|
|
15
15
|
"module": "./index.esm.js",
|
|
16
16
|
"main": "./index.cjs.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
"@xpert-ai/chatkit-types": "^0.0.17"
|
|
19
|
+
},
|
|
20
|
+
"types": "./index.d.ts"
|
|
21
|
+
}
|
package/src/agent/graph.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseMessage } from '@langchain/core/messages';
|
|
2
2
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
-
import { TMessageContentComplex } from '@xpert-ai/chatkit-types';
|
|
3
|
+
import type { TMessageContentComplex } from '@xpert-ai/chatkit-types';
|
|
4
4
|
import { Subscriber } from 'rxjs';
|
|
5
|
+
import { ICopilotModel } from '../ai/copilot-model.model';
|
|
5
6
|
import { TWorkflowVarGroup } from '../ai/xpert-workflow.model';
|
|
6
|
-
import { TXpertGraph } from '../ai/xpert.model';
|
|
7
|
+
import { TXpertGraph, TXpertTeamNode } from '../ai/xpert.model';
|
|
7
8
|
import { IXpertAgent } from '../ai/xpert-agent.model';
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated can use getCurrentTaskInput instead?
|
|
@@ -30,9 +31,34 @@ export type TMessageChannel = {
|
|
|
30
31
|
summary?: string;
|
|
31
32
|
error?: string | null;
|
|
32
33
|
};
|
|
34
|
+
export interface IBackendProtocol {
|
|
35
|
+
workingDirectory: string;
|
|
36
|
+
}
|
|
33
37
|
export type TSandboxConfigurable = {
|
|
38
|
+
/**
|
|
39
|
+
* Resolved sandbox provider type used for this backend acquisition.
|
|
40
|
+
*/
|
|
34
41
|
provider?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Effective working directory inside the sandbox backend.
|
|
44
|
+
*/
|
|
35
45
|
workingDirectory?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Canonical sandbox environment id that owns this backend/container.
|
|
48
|
+
*/
|
|
49
|
+
environmentId?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Underlying runtime container id when the backend is container-backed.
|
|
52
|
+
*/
|
|
53
|
+
containerId?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Container lifecycle run id created for this acquisition, if a new
|
|
56
|
+
* container run was recorded.
|
|
57
|
+
*/
|
|
58
|
+
runId?: string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Concrete backend instance used by the agent/runtime.
|
|
61
|
+
*/
|
|
36
62
|
backend?: unknown;
|
|
37
63
|
};
|
|
38
64
|
export type TAgentRunnableConfigurable = {
|
|
@@ -55,6 +81,13 @@ export type TAgentRunnableConfigurable = {
|
|
|
55
81
|
agentKey: string;
|
|
56
82
|
xpertName?: string;
|
|
57
83
|
toolName?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Additional runtime context for middleware/tool execution.
|
|
86
|
+
*/
|
|
87
|
+
context?: Record<string, unknown> & {
|
|
88
|
+
env?: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
copilotModel?: ICopilotModel;
|
|
58
91
|
subscriber: Subscriber<any>;
|
|
59
92
|
/**
|
|
60
93
|
* Execution id of agent workflow node
|
|
@@ -124,14 +157,6 @@ export declare function getAgentVarGroup(key: string, graph: TXpertGraph): TWork
|
|
|
124
157
|
*/
|
|
125
158
|
export declare function getSwarmPartners(graph: TXpertGraph, agentKey: string, partners: string[], leaderKey?: string): string[];
|
|
126
159
|
export declare function getWorkflowTriggers(graph: TXpertGraph, from: string): ((import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
127
|
-
type: "agent";
|
|
128
|
-
} & {
|
|
129
|
-
entity: IXpertAgent;
|
|
130
|
-
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
131
|
-
type: "knowledge";
|
|
132
|
-
} & {
|
|
133
|
-
entity: import("..").IKnowledgebase;
|
|
134
|
-
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
135
160
|
type: "toolset";
|
|
136
161
|
} & {
|
|
137
162
|
entity: import("..").IXpertToolset;
|
|
@@ -139,29 +164,19 @@ export declare function getWorkflowTriggers(graph: TXpertGraph, from: string): (
|
|
|
139
164
|
type: "xpert";
|
|
140
165
|
} & {
|
|
141
166
|
entity: import("../ai/xpert.model").IXpert;
|
|
142
|
-
nodes?:
|
|
143
|
-
type: "agent";
|
|
144
|
-
} & {
|
|
145
|
-
entity: IXpertAgent;
|
|
146
|
-
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
147
|
-
type: "knowledge";
|
|
148
|
-
} & {
|
|
149
|
-
entity: import("..").IKnowledgebase;
|
|
150
|
-
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
151
|
-
type: "toolset";
|
|
152
|
-
} & {
|
|
153
|
-
entity: import("..").IXpertToolset;
|
|
154
|
-
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
155
|
-
type: "xpert";
|
|
156
|
-
} & any) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
157
|
-
type: "workflow";
|
|
158
|
-
} & {
|
|
159
|
-
entity: import("../ai/xpert-workflow.model").IWorkflowNode;
|
|
160
|
-
}))[];
|
|
167
|
+
nodes?: TXpertTeamNode[];
|
|
161
168
|
connections?: import("../ai/xpert.model").TXpertTeamConnection[];
|
|
162
169
|
expanded?: boolean;
|
|
163
170
|
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
164
171
|
type: "workflow";
|
|
165
172
|
} & {
|
|
166
173
|
entity: import("../ai/xpert-workflow.model").IWorkflowNode;
|
|
174
|
+
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
175
|
+
type: "agent";
|
|
176
|
+
} & {
|
|
177
|
+
entity: IXpertAgent;
|
|
178
|
+
}) | (import("../ai/xpert.model").TXpertTeamNodeBase & {
|
|
179
|
+
type: "knowledge";
|
|
180
|
+
} & {
|
|
181
|
+
entity: import("..").IKnowledgebase;
|
|
167
182
|
}))[];
|
package/src/agent/token.d.ts
CHANGED
|
@@ -3,23 +3,6 @@ export type TTokenUsage = {
|
|
|
3
3
|
completionTokens: number;
|
|
4
4
|
totalTokens: number;
|
|
5
5
|
};
|
|
6
|
-
export type TThreadContextUsageMetrics = {
|
|
7
|
-
contextTokens: number;
|
|
8
|
-
inputTokens: number;
|
|
9
|
-
outputTokens: number;
|
|
10
|
-
totalTokens: number;
|
|
11
|
-
embedTokens: number;
|
|
12
|
-
totalPrice: number;
|
|
13
|
-
currency: string | null;
|
|
14
|
-
};
|
|
15
|
-
export type TThreadContextUsageEvent = {
|
|
16
|
-
type: 'thread_context_usage';
|
|
17
|
-
threadId: string;
|
|
18
|
-
runId: string | null;
|
|
19
|
-
agentKey: string;
|
|
20
|
-
updatedAt: string;
|
|
21
|
-
usage: TThreadContextUsageMetrics;
|
|
22
|
-
};
|
|
23
6
|
export interface IModelUsage {
|
|
24
7
|
totalTokens: number;
|
|
25
8
|
totalPrice: number;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
2
|
+
import { IUser } from '../user.model';
|
|
3
|
+
export declare enum AssistantCode {
|
|
4
|
+
CHAT_COMMON = "chat_common",
|
|
5
|
+
XPERT_SHARED = "xpert_shared",
|
|
6
|
+
CHATBI = "chatbi",
|
|
7
|
+
CLAWXPERT = "clawxpert"
|
|
8
|
+
}
|
|
9
|
+
export declare enum AssistantBindingScope {
|
|
10
|
+
TENANT = "tenant",
|
|
11
|
+
ORGANIZATION = "organization",
|
|
12
|
+
USER = "user"
|
|
13
|
+
}
|
|
14
|
+
export declare enum AssistantBindingSourceScope {
|
|
15
|
+
NONE = "none",
|
|
16
|
+
TENANT = "tenant",
|
|
17
|
+
ORGANIZATION = "organization"
|
|
18
|
+
}
|
|
19
|
+
export type AssistantManagement = 'system' | 'user';
|
|
20
|
+
export interface IAssistantBindingToolsetPreference {
|
|
21
|
+
toolsetId?: string | null;
|
|
22
|
+
toolsetName: string;
|
|
23
|
+
disabledTools: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface IAssistantBindingMiddlewarePreference {
|
|
26
|
+
provider: string;
|
|
27
|
+
disabledTools: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface IAssistantBindingSkillPreference {
|
|
30
|
+
workspaceId: string;
|
|
31
|
+
disabledSkillIds: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface IAssistantBindingToolPreferences {
|
|
34
|
+
version: 1;
|
|
35
|
+
toolsets?: Record<string, IAssistantBindingToolsetPreference>;
|
|
36
|
+
middlewares?: Record<string, IAssistantBindingMiddlewarePreference>;
|
|
37
|
+
skills?: Record<string, IAssistantBindingSkillPreference>;
|
|
38
|
+
}
|
|
39
|
+
export interface IAssistantBinding extends IBasePerTenantAndOrganizationEntityModel {
|
|
40
|
+
code: AssistantCode;
|
|
41
|
+
scope: AssistantBindingScope;
|
|
42
|
+
assistantId?: string | null;
|
|
43
|
+
enabled?: boolean | null;
|
|
44
|
+
userId?: string | null;
|
|
45
|
+
user?: IUser;
|
|
46
|
+
preferences?: IAssistantBindingUserPreference[];
|
|
47
|
+
}
|
|
48
|
+
export interface IAssistantBindingUserPreference extends IBasePerTenantAndOrganizationEntityModel {
|
|
49
|
+
assistantBindingId: string;
|
|
50
|
+
assistantBinding?: IAssistantBinding;
|
|
51
|
+
userId?: string | null;
|
|
52
|
+
user?: IUser;
|
|
53
|
+
soul?: string | null;
|
|
54
|
+
profile?: string | null;
|
|
55
|
+
toolPreferences?: IAssistantBindingToolPreferences | null;
|
|
56
|
+
}
|
|
57
|
+
export interface IResolvedAssistantBinding extends IAssistantBinding {
|
|
58
|
+
sourceScope: AssistantBindingSourceScope;
|
|
59
|
+
}
|
|
60
|
+
export interface IAssistantBindingUpsertInput {
|
|
61
|
+
code: AssistantCode;
|
|
62
|
+
scope: AssistantBindingScope;
|
|
63
|
+
assistantId?: string | null;
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface IAssistantBindingUserPreferenceUpsertInput {
|
|
67
|
+
scope: AssistantBindingScope;
|
|
68
|
+
soul?: string | null;
|
|
69
|
+
profile?: string | null;
|
|
70
|
+
toolPreferences?: IAssistantBindingToolPreferences | null;
|
|
71
|
+
}
|
|
72
|
+
export declare function getAssistantManagement(code: AssistantCode): AssistantManagement;
|
|
73
|
+
export declare function isUserManagedAssistant(code: AssistantCode): boolean;
|
|
74
|
+
export declare function isSystemManagedAssistant(code: AssistantCode): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TChatEventMessage } from '@xpert-ai/chatkit-types';
|
|
2
|
+
export declare const CHAT_EVENT_TYPE_THREAD_CONTEXT_USAGE: "thread_context_usage";
|
|
3
|
+
export declare const CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY: "conversation_title_summary";
|
|
4
|
+
export type TConversationTitleSummaryEvent = TChatEventMessage & {
|
|
5
|
+
id?: string;
|
|
6
|
+
type: typeof CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY;
|
|
7
|
+
};
|
|
8
|
+
export declare function createConversationTitleSummaryEvent(event: Omit<TConversationTitleSummaryEvent, 'type'>): TConversationTitleSummaryEvent;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MessageType } from '@langchain/core/messages';
|
|
2
|
+
import type { TChatMessageStep, TMessageContent, TMessageContentReasoning } from '@xpert-ai/chatkit-types';
|
|
2
3
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
3
4
|
import { IChatConversation } from './chat.model';
|
|
4
5
|
import { LongTermMemoryTypeEnum } from './xpert.model';
|
|
5
6
|
import { IXpertAgentExecution, XpertAgentExecutionStatusEnum } from './xpert-agent-execution.model';
|
|
6
7
|
import { JSONValue } from '../core.model';
|
|
7
8
|
import { IStorageFile } from '../storage-file.model';
|
|
8
|
-
import { TChatMessageStep, TMessageContent, TMessageContentReasoning } from '@xpert-ai/chatkit-types';
|
|
9
9
|
export type TSummaryJob = Record<LongTermMemoryTypeEnum, {
|
|
10
10
|
jobId: number | string;
|
|
11
11
|
status: string;
|
package/src/ai/chat.model.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { IStorageFile } from '../storage-file.model';
|
|
|
9
9
|
import { IXpertTask } from './xpert-task.model';
|
|
10
10
|
import { TToolCall } from '../agent';
|
|
11
11
|
import { TInterrupt } from '../agent/interrupt';
|
|
12
|
+
import { IUser } from '../user.model';
|
|
12
13
|
export type TChatConversationOptions = {
|
|
13
14
|
parameters?: {
|
|
14
15
|
input?: string;
|
|
@@ -19,8 +20,9 @@ export type TChatConversationOptions = {
|
|
|
19
20
|
features?: Array<'timeline' | 'sandbox' | 'files'>;
|
|
20
21
|
workspacePath?: string;
|
|
21
22
|
workspaceUrl?: string;
|
|
23
|
+
sandboxEnvironmentId?: string;
|
|
22
24
|
};
|
|
23
|
-
export type TChatConversationStatus =
|
|
25
|
+
export type TChatConversationStatus = 'idle' | 'busy' | 'interrupted' | 'error';
|
|
24
26
|
export type TToolCallType = 'agent' | 'tool';
|
|
25
27
|
export type TChatFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom';
|
|
26
28
|
/**
|
|
@@ -90,6 +92,10 @@ export interface IChatConversation extends IBasePerTenantAndOrganizationEntityMo
|
|
|
90
92
|
* End anonymous user
|
|
91
93
|
*/
|
|
92
94
|
fromEndUserId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Internal user matched by fromEndUserId when available
|
|
97
|
+
*/
|
|
98
|
+
fromEndUser?: IUser;
|
|
93
99
|
/**
|
|
94
100
|
* Chat with Xpert
|
|
95
101
|
*/
|
|
@@ -2,5 +2,9 @@ export declare enum AiFeatureEnum {
|
|
|
2
2
|
FEATURE_COPILOT = "FEATURE_COPILOT",
|
|
3
3
|
FEATURE_COPILOT_KNOWLEDGEBASE = "FEATURE_COPILOT_KNOWLEDGEBASE",
|
|
4
4
|
FEATURE_COPILOT_CHAT = "FEATURE_COPILOT_CHAT",
|
|
5
|
-
FEATURE_XPERT = "FEATURE_XPERT"
|
|
5
|
+
FEATURE_XPERT = "FEATURE_XPERT",
|
|
6
|
+
FEATURE_XPERT_CHATBI = "FEATURE_XPERT_CHATBI",
|
|
7
|
+
FEATURE_XPERT_CLAWXPERT = "FEATURE_XPERT_CLAWXPERT",
|
|
8
|
+
FEATURE_XPERT_CODEXPERT = "FEATURE_XPERT_CODEXPERT",
|
|
9
|
+
FEATURE_XPERT_DEEP_RESEARCH = "FEATURE_XPERT_DEEP_RESEARCH"
|
|
6
10
|
}
|
package/src/ai/index.d.ts
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const STATE_VARIABLE_HUMAN = "human";
|
|
2
|
+
export declare enum ChatMessageTypeEnum {
|
|
3
|
+
MESSAGE = "message",
|
|
4
|
+
EVENT = "event"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ChatMessageEventTypeEnum {
|
|
7
|
+
ON_CONVERSATION_START = "on_conversation_start",
|
|
8
|
+
ON_CONVERSATION_END = "on_conversation_end",
|
|
9
|
+
ON_MESSAGE_START = "on_message_start",
|
|
10
|
+
ON_MESSAGE_END = "on_message_end",
|
|
11
|
+
ON_TOOL_START = "on_tool_start",
|
|
12
|
+
ON_TOOL_END = "on_tool_end",
|
|
13
|
+
ON_TOOL_ERROR = "on_tool_error",
|
|
14
|
+
ON_TOOL_MESSAGE = "on_tool_message",
|
|
15
|
+
ON_AGENT_START = "on_agent_start",
|
|
16
|
+
ON_AGENT_END = "on_agent_end",
|
|
17
|
+
ON_RETRIEVER_START = "on_retriever_start",
|
|
18
|
+
ON_RETRIEVER_END = "on_retriever_end",
|
|
19
|
+
ON_RETRIEVER_ERROR = "on_retriever_error",
|
|
20
|
+
ON_INTERRUPT = "on_interrupt",
|
|
21
|
+
ON_ERROR = "on_error",
|
|
22
|
+
ON_CHAT_EVENT = "on_chat_event",
|
|
23
|
+
ON_CLIENT_EFFECT = "on_client_effect"
|
|
24
|
+
}
|
|
25
|
+
export declare enum ChatMessageStepCategory {
|
|
26
|
+
List = "list",
|
|
27
|
+
WebSearch = "web_search",
|
|
28
|
+
Files = "files",
|
|
29
|
+
File = "file",
|
|
30
|
+
Program = "program",
|
|
31
|
+
Iframe = "iframe",
|
|
32
|
+
Memory = "memory",
|
|
33
|
+
Tasks = "tasks",
|
|
34
|
+
Knowledges = "knowledges"
|
|
35
|
+
}
|
|
36
|
+
export type * from '@xpert-ai/chatkit-types';
|
|
37
|
+
export type { TChatRequest } from './xpert-chat.model';
|
|
38
|
+
export * from './assistant-binding.model';
|
|
2
39
|
export * from './ai-model.model';
|
|
3
40
|
export * from './ai.model';
|
|
41
|
+
export * from './chat-event.model';
|
|
4
42
|
export * from './chat.model';
|
|
5
43
|
export * from './chat-message.model';
|
|
6
44
|
export * from './chat-message-feedback.model';
|
|
@@ -21,6 +59,7 @@ export * from './knowledge-doc-page.model';
|
|
|
21
59
|
export * from './role-permissions';
|
|
22
60
|
export * from './xpert-agent-execution.model';
|
|
23
61
|
export * from './xpert-agent.model';
|
|
62
|
+
export * from './xpert-chat.model';
|
|
24
63
|
export * from './xpert-tool.model';
|
|
25
64
|
export * from './xpert-toolset.model';
|
|
26
65
|
export * from './xpert-workspace.model';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TMessageContent, TMessageContentComplex } from '@xpert-ai/chatkit-types';
|
|
1
|
+
import type { TMessageContent, TMessageContentComplex } from '@xpert-ai/chatkit-types';
|
|
2
2
|
import { CopilotChatMessage } from './chat-message.model';
|
|
3
3
|
export type TMessageJoinHint = 'none' | 'space' | 'line' | 'paragraph';
|
|
4
4
|
export type TMessageAppendContext = {
|
|
@@ -48,5 +48,11 @@ export declare function createMessageAppendContextTracker(initial?: TMessageAppe
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function appendMessageContent(aiMessage: CopilotChatMessage, incoming: string | TMessageContentComplex, context?: TAppendMessageContentOptions): void;
|
|
50
50
|
export declare function appendMessagePlainText(accumulator: string, incoming: string | TMessageContentComplex, context?: TMessageAppendContext): string;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a display-only content view that reassembles text chunks belonging to
|
|
53
|
+
* the same stream id. This preserves markdown continuity without changing the
|
|
54
|
+
* underlying stored/streamed message structure.
|
|
55
|
+
*/
|
|
56
|
+
export declare function mergeMessageContentForDisplay(content: TMessageContent | TMessageContentComplex | null | undefined): TMessageContentComplex[] | null;
|
|
51
57
|
export declare function stringifyMessageContent(content: TMessageContent | TMessageContentComplex): string;
|
|
52
58
|
export declare function filterMessageText(content: TMessageContent | TMessageContentComplex): string;
|
package/src/ai/sandbox.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { I18nObject, IconDefinition } from
|
|
1
|
+
import { I18nObject, IconDefinition } from '../types';
|
|
2
2
|
export type TSandboxProviderMeta = {
|
|
3
3
|
name: I18nObject;
|
|
4
4
|
description?: I18nObject;
|
|
5
5
|
icon: IconDefinition;
|
|
6
6
|
};
|
|
7
|
+
export declare const SANDBOX_WORK_FOR_TYPES: readonly ["user", "project", "environment"];
|
|
8
|
+
export type TSandboxWorkForType = (typeof SANDBOX_WORK_FOR_TYPES)[number];
|
package/src/ai/skill.model.d.ts
CHANGED
|
@@ -4,12 +4,28 @@ import { JsonSchemaObjectType } from "./types";
|
|
|
4
4
|
import { IWorkflowNode, WorkflowNodeTypeEnum } from "./xpert-workflow.model";
|
|
5
5
|
import { IBasePerWorkspaceEntityModel } from "./xpert-workspace.model";
|
|
6
6
|
export type SkillId = string;
|
|
7
|
+
export interface ISkillRepositoryIndexStats {
|
|
8
|
+
comments?: number;
|
|
9
|
+
downloads?: number;
|
|
10
|
+
installsAllTime?: number;
|
|
11
|
+
installsCurrent?: number;
|
|
12
|
+
stars?: number;
|
|
13
|
+
versions?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ISkillRepositoryIndexPublisher {
|
|
16
|
+
handle?: string;
|
|
17
|
+
displayName?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
image?: string;
|
|
20
|
+
kind?: string;
|
|
21
|
+
}
|
|
7
22
|
export interface SkillMetadata {
|
|
8
23
|
name: string;
|
|
9
24
|
displayName?: I18nObject;
|
|
10
25
|
version: string;
|
|
11
26
|
summary?: I18nObject;
|
|
12
27
|
description?: I18nObject;
|
|
28
|
+
icon?: IconDefinition;
|
|
13
29
|
tags?: string[];
|
|
14
30
|
author?: {
|
|
15
31
|
name: string;
|
|
@@ -59,15 +75,15 @@ export interface TSkillPackage {
|
|
|
59
75
|
owners: string[];
|
|
60
76
|
readers: string[];
|
|
61
77
|
writers: string[];
|
|
62
|
-
policies?:
|
|
78
|
+
policies?: Record<string, unknown>;
|
|
63
79
|
};
|
|
64
80
|
signatures?: string[];
|
|
65
|
-
provenance?:
|
|
81
|
+
provenance?: Record<string, unknown>;
|
|
66
82
|
}
|
|
67
83
|
/**
|
|
68
|
-
*
|
|
84
|
+
* Represents a repository (e.g. anthropics/skills)
|
|
69
85
|
*/
|
|
70
|
-
export interface ISkillRepository<O = Record<string,
|
|
86
|
+
export interface ISkillRepository<O = Record<string, unknown>, C = Record<string, unknown>> extends IBasePerTenantAndOrganizationEntityModel {
|
|
71
87
|
name: string;
|
|
72
88
|
provider: string;
|
|
73
89
|
/**
|
|
@@ -78,11 +94,11 @@ export interface ISkillRepository<O = Record<string, any>, C = Record<string, an
|
|
|
78
94
|
* Options configured using the strategy's configSchema
|
|
79
95
|
*/
|
|
80
96
|
options?: O;
|
|
81
|
-
lastSyncAt?:
|
|
97
|
+
lastSyncAt?: Date;
|
|
82
98
|
deletedAt?: Date;
|
|
83
99
|
}
|
|
84
100
|
/**
|
|
85
|
-
*
|
|
101
|
+
* Skill index produced by repository sync scan (one per skill directory)
|
|
86
102
|
*/
|
|
87
103
|
export interface ISkillRepositoryIndex extends IBasePerTenantAndOrganizationEntityModel {
|
|
88
104
|
repositoryId: string;
|
|
@@ -90,35 +106,38 @@ export interface ISkillRepositoryIndex extends IBasePerTenantAndOrganizationEnti
|
|
|
90
106
|
skillPath: string;
|
|
91
107
|
skillId: string;
|
|
92
108
|
name?: string;
|
|
109
|
+
link?: string;
|
|
110
|
+
publisher?: ISkillRepositoryIndexPublisher;
|
|
93
111
|
description?: string;
|
|
94
112
|
license?: string;
|
|
95
113
|
tags?: string[];
|
|
96
114
|
version?: string;
|
|
97
|
-
|
|
115
|
+
stats?: ISkillRepositoryIndexStats;
|
|
116
|
+
resources?: Array<Record<string, unknown>>;
|
|
98
117
|
deletedAt?: Date;
|
|
99
118
|
}
|
|
100
119
|
/**
|
|
101
|
-
*
|
|
120
|
+
* Installed skill package record (skill.yaml)
|
|
102
121
|
*/
|
|
103
122
|
export interface ISkillPackage extends IBasePerWorkspaceEntityModel, TSkillPackage {
|
|
104
123
|
skillIndexId?: SkillId;
|
|
105
124
|
skillIndex?: ISkillRepositoryIndex;
|
|
106
|
-
name?:
|
|
125
|
+
name?: string;
|
|
107
126
|
visibility: 'private' | 'team' | 'tenant';
|
|
108
127
|
packagePath?: string;
|
|
109
128
|
}
|
|
110
129
|
/**
|
|
111
|
-
*
|
|
130
|
+
* Skill version (multiple versions can coexist per skill)
|
|
112
131
|
*/
|
|
113
132
|
export interface ISkillVersion extends IBasePerWorkspaceEntityModel {
|
|
114
133
|
packageId: string;
|
|
115
134
|
version: string;
|
|
116
|
-
metadata:
|
|
117
|
-
instructions:
|
|
135
|
+
metadata: SkillMetadata;
|
|
136
|
+
instructions: TSkillPackage['instructions'];
|
|
118
137
|
installedAt?: string;
|
|
119
138
|
}
|
|
120
139
|
/**
|
|
121
|
-
*
|
|
140
|
+
* Skill resource file record (scripts/templates/assets)
|
|
122
141
|
*/
|
|
123
142
|
export interface ISkillResource extends IBasePerWorkspaceEntityModel {
|
|
124
143
|
versionId: string;
|
|
@@ -126,10 +145,10 @@ export interface ISkillResource extends IBasePerWorkspaceEntityModel {
|
|
|
126
145
|
type: 'script' | 'template' | 'asset' | 'doc';
|
|
127
146
|
hash?: string;
|
|
128
147
|
size?: number;
|
|
129
|
-
meta?:
|
|
148
|
+
meta?: Record<string, unknown>;
|
|
130
149
|
}
|
|
131
150
|
/**
|
|
132
|
-
*
|
|
151
|
+
* Tenant/organization/team/user installation record
|
|
133
152
|
*/
|
|
134
153
|
export interface ISkillInstallation extends IBasePerTenantAndOrganizationEntityModel {
|
|
135
154
|
versionId: string;
|
|
@@ -139,7 +158,7 @@ export interface ISkillInstallation extends IBasePerTenantAndOrganizationEntityM
|
|
|
139
158
|
status: 'pending' | 'installed' | 'failed';
|
|
140
159
|
}
|
|
141
160
|
/**
|
|
142
|
-
*
|
|
161
|
+
* Detailed logs during skill installation
|
|
143
162
|
*/
|
|
144
163
|
export interface ISkillInstallLog extends IBasePerTenantAndOrganizationEntityModel {
|
|
145
164
|
installationId: string;
|
|
@@ -148,14 +167,14 @@ export interface ISkillInstallLog extends IBasePerTenantAndOrganizationEntityMod
|
|
|
148
167
|
timestamp: string;
|
|
149
168
|
}
|
|
150
169
|
/**
|
|
151
|
-
*
|
|
170
|
+
* Runtime audit log for skills
|
|
152
171
|
*/
|
|
153
172
|
export interface ISkillAuditLog extends IBasePerTenantAndOrganizationEntityModel {
|
|
154
173
|
skillId: string;
|
|
155
174
|
versionId: string;
|
|
156
175
|
sessionId: string;
|
|
157
176
|
eventType: string;
|
|
158
|
-
metadata:
|
|
177
|
+
metadata: Record<string, unknown>;
|
|
159
178
|
}
|
|
160
179
|
export type TSkillSourceMeta = {
|
|
161
180
|
/**
|
|
@@ -27,6 +27,15 @@ export type TXpertExecution = {
|
|
|
27
27
|
xpertId?: string;
|
|
28
28
|
parentId?: string;
|
|
29
29
|
};
|
|
30
|
+
export type TXpertAgentExecutionCheckpoint = {
|
|
31
|
+
threadId: string;
|
|
32
|
+
checkpointNs: string;
|
|
33
|
+
checkpointId: string;
|
|
34
|
+
parentCheckpointId?: string | null;
|
|
35
|
+
createdAt?: string | null;
|
|
36
|
+
metadata?: Record<string, unknown> | null;
|
|
37
|
+
isCurrent?: boolean;
|
|
38
|
+
};
|
|
30
39
|
/**
|
|
31
40
|
* Corresponds to the run in the [Agent Protocol](https://github.com/langchain-ai/agent-protocol).
|
|
32
41
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { STATE_VARIABLE_HUMAN, TChatRequestHuman, TInterruptCommand } from '@xpert-ai/chatkit-types';
|
|
2
1
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
3
2
|
import { ICopilotModel, TCopilotModel } from './copilot-model.model';
|
|
4
3
|
import { IKnowledgebase, TKBRecallParams } from './knowledgebase.model';
|
|
@@ -138,7 +137,7 @@ export type TXpertAgentOptions = {
|
|
|
138
137
|
* - *jsonSchema*
|
|
139
138
|
*
|
|
140
139
|
*/
|
|
141
|
-
structuredOutputMethod?:
|
|
140
|
+
structuredOutputMethod?: 'functionCalling' | 'jsonMode' | 'jsonSchema' | string;
|
|
142
141
|
/**
|
|
143
142
|
* @deprecated use attachment
|
|
144
143
|
*/
|
|
@@ -178,41 +177,14 @@ export type TAgentPromptTemplate = {
|
|
|
178
177
|
};
|
|
179
178
|
export type TAgentOutputVariable = TXpertParameter & {
|
|
180
179
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
* value write to state's variable
|
|
181
|
+
*/
|
|
183
182
|
variableSelector: string;
|
|
184
183
|
/**
|
|
185
184
|
* How to write value to variable
|
|
186
185
|
*/
|
|
187
186
|
operation: 'append' | 'extends' | 'overwrite' | 'clear';
|
|
188
187
|
};
|
|
189
|
-
/**
|
|
190
|
-
* @deprecated use TChatRequest
|
|
191
|
-
*/
|
|
192
|
-
export type TChatAgentParams = {
|
|
193
|
-
/**
|
|
194
|
-
* @deprecated use state instead
|
|
195
|
-
*/
|
|
196
|
-
input?: {
|
|
197
|
-
input?: string;
|
|
198
|
-
[key: string]: unknown;
|
|
199
|
-
};
|
|
200
|
-
state: {
|
|
201
|
-
[STATE_VARIABLE_HUMAN]: TChatRequestHuman;
|
|
202
|
-
[key: string]: any;
|
|
203
|
-
};
|
|
204
|
-
agentKey: string;
|
|
205
|
-
xpertId: string;
|
|
206
|
-
executionId?: string;
|
|
207
|
-
environmentId?: string;
|
|
208
|
-
/**
|
|
209
|
-
*/
|
|
210
|
-
command?: TInterruptCommand;
|
|
211
|
-
/**
|
|
212
|
-
* Reject the sensitive tool calls
|
|
213
|
-
*/
|
|
214
|
-
reject?: boolean;
|
|
215
|
-
};
|
|
216
188
|
export declare function agentLabel(agent: Partial<IXpertAgent>): string;
|
|
217
189
|
export declare function agentUniqueName(agent: IXpertAgent): string;
|
|
218
190
|
export declare function convertToUrlPath(title: string): string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { TChatRequestHuman, TInterruptCommand } from '@xpert-ai/chatkit-types';
|
|
2
|
+
import { STATE_VARIABLE_HUMAN } from '@xpert-ai/chatkit-types';
|
|
3
|
+
export type TXpertChatState = {
|
|
4
|
+
[STATE_VARIABLE_HUMAN]?: TChatRequestHuman;
|
|
5
|
+
} & Record<string, any>;
|
|
6
|
+
export type TXpertChatResumeDecision = {
|
|
7
|
+
type: 'confirm' | 'reject';
|
|
8
|
+
payload?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type TXpertChatInterruptPatch = Pick<TInterruptCommand, 'agentKey' | 'toolCalls' | 'update'>;
|
|
11
|
+
export type TXpertChatTarget = {
|
|
12
|
+
aiMessageId?: string;
|
|
13
|
+
executionId?: string;
|
|
14
|
+
};
|
|
15
|
+
export type TXpertChatSource = {
|
|
16
|
+
aiMessageId?: string;
|
|
17
|
+
executionId?: string;
|
|
18
|
+
};
|
|
19
|
+
export type TXpertChatSendRequest = {
|
|
20
|
+
action: 'send';
|
|
21
|
+
conversationId?: string;
|
|
22
|
+
projectId?: string;
|
|
23
|
+
environmentId?: string;
|
|
24
|
+
sandboxEnvironmentId?: string;
|
|
25
|
+
message: {
|
|
26
|
+
clientMessageId?: string;
|
|
27
|
+
input: TChatRequestHuman;
|
|
28
|
+
};
|
|
29
|
+
state?: TXpertChatState;
|
|
30
|
+
};
|
|
31
|
+
export type TXpertChatResumeRequest = {
|
|
32
|
+
action: 'resume';
|
|
33
|
+
conversationId: string;
|
|
34
|
+
target: TXpertChatTarget;
|
|
35
|
+
decision: TXpertChatResumeDecision;
|
|
36
|
+
patch?: TXpertChatInterruptPatch;
|
|
37
|
+
state?: TXpertChatState;
|
|
38
|
+
};
|
|
39
|
+
export type TXpertChatRetryRequest = {
|
|
40
|
+
action: 'retry';
|
|
41
|
+
conversationId: string;
|
|
42
|
+
source: TXpertChatSource;
|
|
43
|
+
environmentId?: string;
|
|
44
|
+
checkpointId?: string;
|
|
45
|
+
};
|
|
46
|
+
export type TChatRequest = TXpertChatSendRequest | TXpertChatResumeRequest | TXpertChatRetryRequest;
|
|
47
|
+
export type TXpertAgentChatRunRequest = {
|
|
48
|
+
action: 'run';
|
|
49
|
+
state: TXpertChatState;
|
|
50
|
+
agentKey: string;
|
|
51
|
+
xpertId: string;
|
|
52
|
+
environmentId?: string;
|
|
53
|
+
};
|
|
54
|
+
export type TXpertAgentChatResumeRequest = {
|
|
55
|
+
action: 'resume';
|
|
56
|
+
agentKey: string;
|
|
57
|
+
xpertId: string;
|
|
58
|
+
target: {
|
|
59
|
+
executionId: string;
|
|
60
|
+
};
|
|
61
|
+
decision: TXpertChatResumeDecision;
|
|
62
|
+
patch?: TXpertChatInterruptPatch;
|
|
63
|
+
environmentId?: string;
|
|
64
|
+
state?: TXpertChatState;
|
|
65
|
+
};
|
|
66
|
+
export type TXpertAgentChatRequest = TXpertAgentChatRunRequest | TXpertAgentChatResumeRequest;
|