@metad/contracts 3.8.0 → 3.8.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/index.cjs.js +518 -66
- package/index.esm.js +511 -67
- package/package.json +1 -1
- package/src/ai/chat-message.model.d.ts +1 -1
- package/src/ai/index.d.ts +1 -0
- package/src/ai/message-content.utils.d.ts +52 -0
- package/src/ai/xpert-tool-mcp.model.d.ts +20 -1
- package/src/plugin.d.ts +16 -1
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@ export type ChatMessageStatusEnum = XpertAgentExecutionStatusEnum | 'thinking' |
|
|
|
52
52
|
* BaseMessage or AIMessage in Langchain.js
|
|
53
53
|
*/
|
|
54
54
|
export interface CopilotBaseMessage {
|
|
55
|
-
id
|
|
55
|
+
id?: string;
|
|
56
56
|
createdAt?: Date;
|
|
57
57
|
role: CopilotMessageType;
|
|
58
58
|
/**
|
package/src/ai/index.d.ts
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TMessageContent, TMessageContentComplex } from '@xpert-ai/chatkit-types';
|
|
2
|
+
import { CopilotChatMessage } from './chat-message.model';
|
|
3
|
+
export type TMessageJoinHint = 'none' | 'space' | 'line' | 'paragraph';
|
|
4
|
+
export type TMessageAppendContext = {
|
|
5
|
+
source?: string;
|
|
6
|
+
streamId?: string;
|
|
7
|
+
joinHint?: TMessageJoinHint;
|
|
8
|
+
};
|
|
9
|
+
export type TAppendMessageContentOptions = TMessageAppendContext & {
|
|
10
|
+
previous?: TMessageAppendContext | null;
|
|
11
|
+
};
|
|
12
|
+
export type TResolveMessageAppendContextOptions = {
|
|
13
|
+
previous?: TMessageAppendContext | null;
|
|
14
|
+
incoming: string | TMessageContentComplex;
|
|
15
|
+
fallbackSource?: string;
|
|
16
|
+
fallbackStreamId?: string;
|
|
17
|
+
};
|
|
18
|
+
export type TResolvedMessageAppendContext = {
|
|
19
|
+
appendContext: TMessageAppendContext;
|
|
20
|
+
messageContext: TMessageAppendContext;
|
|
21
|
+
};
|
|
22
|
+
export type TMessageAppendContextTracker = {
|
|
23
|
+
resolve: (options: Omit<TResolveMessageAppendContextOptions, 'previous'>) => TResolvedMessageAppendContext;
|
|
24
|
+
reset: () => void;
|
|
25
|
+
current: () => TMessageAppendContext | null;
|
|
26
|
+
};
|
|
27
|
+
export declare function inferMessageAppendContext(content: string | TMessageContentComplex, fallbackSource?: string): TMessageAppendContext;
|
|
28
|
+
export declare function resolveMessageAppendContext(options: TResolveMessageAppendContextOptions): TResolvedMessageAppendContext;
|
|
29
|
+
/**
|
|
30
|
+
* Stateful helper for streaming append.
|
|
31
|
+
*
|
|
32
|
+
* It keeps the previous append context and resolves the current one, so callers
|
|
33
|
+
* can avoid passing `previous` manually for every chunk and still get stable
|
|
34
|
+
* join behavior (for example, same source + same stream -> `joinHint: 'none'`).
|
|
35
|
+
*
|
|
36
|
+
* Call `reset()` at turn/session boundaries to prevent cross-turn contamination.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createMessageAppendContextTracker(initial?: TMessageAppendContext | null): TMessageAppendContextTracker;
|
|
39
|
+
/**
|
|
40
|
+
* Append one incoming chunk into a chat message in place.
|
|
41
|
+
*
|
|
42
|
+
* Behavior:
|
|
43
|
+
* - Keeps `aiMessage` object reference stable (caller may hold this object).
|
|
44
|
+
* - Updates message properties with new references (`content`/`reasoning` arrays)
|
|
45
|
+
* so UI change detection that relies on reference changes can react reliably.
|
|
46
|
+
* - Applies context-aware merge rules for text/reasoning/component chunks.
|
|
47
|
+
* - `previous` must be supplied by caller when same-stream join inference is needed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function appendMessageContent(aiMessage: CopilotChatMessage, incoming: string | TMessageContentComplex, context?: TAppendMessageContentOptions): void;
|
|
50
|
+
export declare function appendMessagePlainText(accumulator: string, incoming: string | TMessageContentComplex, context?: TMessageAppendContext): string;
|
|
51
|
+
export declare function stringifyMessageContent(content: TMessageContent | TMessageContentComplex): string;
|
|
52
|
+
export declare function filterMessageText(content: TMessageContent | TMessageContentComplex): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare enum MCPServerType {
|
|
2
2
|
SSE = "sse",
|
|
3
3
|
STDIO = "stdio",
|
|
4
|
-
CODE = "code"
|
|
4
|
+
CODE = "code",
|
|
5
|
+
HTTP = "http"
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Configuration for stdio transport connection
|
|
@@ -23,6 +24,19 @@ export interface SSEConnection {
|
|
|
23
24
|
headers?: Record<string, string>;
|
|
24
25
|
useNodeEventSource?: boolean;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Configuration for Streamable HTTP transport connection
|
|
29
|
+
*/
|
|
30
|
+
export interface HttpConnection {
|
|
31
|
+
transport: "http";
|
|
32
|
+
url: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to automatically fallback to SSE if Streamable HTTP is not available.
|
|
36
|
+
* Defaults to true.
|
|
37
|
+
*/
|
|
38
|
+
automaticSSEFallback?: boolean;
|
|
39
|
+
}
|
|
26
40
|
export type TMCPServerReconnect = {
|
|
27
41
|
/**
|
|
28
42
|
* Whether to automatically restart the process if it exits
|
|
@@ -51,6 +65,11 @@ export type TMCPServer = {
|
|
|
51
65
|
url?: string;
|
|
52
66
|
headers?: Record<string, string>;
|
|
53
67
|
useNodeEventSource?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to automatically fallback to SSE if Streamable HTTP is not available.
|
|
70
|
+
* Defaults to true. Only applicable for HTTP transport.
|
|
71
|
+
*/
|
|
72
|
+
automaticSSEFallback?: boolean;
|
|
54
73
|
/**
|
|
55
74
|
* Default timeout in milliseconds for tool execution. Must be greater than 0.
|
|
56
75
|
* If not specified, tools will use their own configured timeout values.
|
package/src/plugin.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
|
|
2
2
|
import { IconDefinition } from './types';
|
|
3
3
|
export type PluginName = string;
|
|
4
|
+
export declare const PLUGIN_LEVEL: {
|
|
5
|
+
readonly SYSTEM: "system";
|
|
6
|
+
readonly ORGANIZATION: "organization";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Classifies plugin scope and governance.
|
|
10
|
+
* - `system`: built-in/platform-managed plugin that users cannot install/uninstall from org APIs.
|
|
11
|
+
* - `organization`: tenant/org-managed plugin that can be installed and removed per organization.
|
|
12
|
+
*/
|
|
13
|
+
export type PluginLevel = (typeof PLUGIN_LEVEL)[keyof typeof PLUGIN_LEVEL];
|
|
4
14
|
export interface PluginMeta {
|
|
5
15
|
name: PluginName;
|
|
6
16
|
version: string;
|
|
17
|
+
/**
|
|
18
|
+
* Declares the plugin's operational level used for visibility and install/uninstall guardrails.
|
|
19
|
+
*/
|
|
20
|
+
level?: PluginLevel;
|
|
7
21
|
icon?: IconDefinition;
|
|
8
22
|
category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration' | 'datasource' | 'database' | 'middleware';
|
|
9
23
|
displayName: string;
|
|
@@ -16,6 +30,7 @@ export interface IPlugin extends IBasePerTenantAndOrganizationEntityModel {
|
|
|
16
30
|
pluginName: string;
|
|
17
31
|
packageName: string;
|
|
18
32
|
version?: string;
|
|
19
|
-
source?:
|
|
33
|
+
source?: 'marketplace' | 'local' | 'git' | 'url' | 'npm' | 'code' | 'env';
|
|
34
|
+
level?: PluginLevel;
|
|
20
35
|
config: Record<string, any>;
|
|
21
36
|
}
|