@opencxh/domain 1.52.0 → 1.53.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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ToolTraceEntry } from '../../platform/ai-tools';
|
|
1
2
|
export interface AIMessageInput {
|
|
2
3
|
text: string;
|
|
3
4
|
type: "text";
|
|
@@ -17,16 +18,19 @@ export interface AIMessage {
|
|
|
17
18
|
accountId?: string;
|
|
18
19
|
model?: string;
|
|
19
20
|
externalId?: string;
|
|
21
|
+
/** Tools the assistant invoked while producing this message (final, persisted trace). */
|
|
22
|
+
toolTrace?: ToolTraceEntry[];
|
|
20
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Profile-driven ask payload. The selected profile is the source of truth, so
|
|
26
|
+
* the client sends only `profileId`; the server resolves account/model/
|
|
27
|
+
* systemPrompt/enabledTools from it.
|
|
28
|
+
*/
|
|
21
29
|
export interface AIMessageAskPayload {
|
|
22
30
|
interactionId: string;
|
|
23
31
|
input: AIMessageInput;
|
|
24
|
-
|
|
25
|
-
accountId: string;
|
|
32
|
+
profileId: string;
|
|
26
33
|
previousExternalId?: string;
|
|
27
|
-
providerConfig?: Record<string, any>;
|
|
28
|
-
instructions?: string;
|
|
29
|
-
systemPrompt?: string;
|
|
30
34
|
context?: Record<string, any>;
|
|
31
35
|
}
|
|
32
36
|
export interface AIMessageAskResponse {
|
|
@@ -13,4 +13,6 @@ export interface AIProfile<T extends Record<string, any> = Record<string, any>>
|
|
|
13
13
|
systemPrompt: string;
|
|
14
14
|
contextIds?: string[];
|
|
15
15
|
predefinedPrompts?: PredefinedPrompt[];
|
|
16
|
+
/** Namespaced tool names this profile may use (default: none enabled). */
|
|
17
|
+
enabledTools?: string[];
|
|
16
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Configuration for an external MCP (Model Context Protocol) server, per organization. */
|
|
2
|
+
export interface McpServerConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Only Streamable HTTP transport is supported for server-side connections. */
|
|
7
|
+
transport: "http";
|
|
8
|
+
url: string;
|
|
9
|
+
/** Optional auth/extra headers sent on connect (e.g. `Authorization`). */
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './entities/ai-account';
|
|
|
5
5
|
export * from './entities/ai-context';
|
|
6
6
|
export * from './entities/ai-message';
|
|
7
7
|
export * from './entities/ai-profile';
|
|
8
|
+
export * from './entities/mcp';
|
|
8
9
|
export * from './entities/channel';
|
|
9
10
|
export * from './entities/communication';
|
|
10
11
|
export * from './entities/contact';
|
|
@@ -18,6 +19,7 @@ export * from './entities/organization';
|
|
|
18
19
|
export * from './entities/shopify';
|
|
19
20
|
export * from './entities/transcript';
|
|
20
21
|
export * from './entities/user';
|
|
22
|
+
export * from './platform/ai-tools';
|
|
21
23
|
export * from './platform/api';
|
|
22
24
|
export * from './platform/common';
|
|
23
25
|
export * from './platform/capabilities';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-agnostic tool-use contracts for the AI assistant.
|
|
3
|
+
*
|
|
4
|
+
* A tool is described once in this neutral shape; each AI provider adapter
|
|
5
|
+
* translates it to/from its own native function-calling format. Tools can come
|
|
6
|
+
* from internal apps (via the "ai-tool" provider role) or external MCP servers —
|
|
7
|
+
* both surface through the same {@link AiTool} shape.
|
|
8
|
+
*/
|
|
9
|
+
/** JSON-Schema object describing a tool's arguments. */
|
|
10
|
+
export interface AiToolParameterSchema {
|
|
11
|
+
type: "object";
|
|
12
|
+
properties: Record<string, unknown>;
|
|
13
|
+
required?: string[];
|
|
14
|
+
}
|
|
15
|
+
/** A callable tool advertised to the model. */
|
|
16
|
+
export interface AiTool {
|
|
17
|
+
/** Namespaced, model-facing name, e.g. `kb__kb_search` or `mcp__<server>__<tool>`. */
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: AiToolParameterSchema;
|
|
21
|
+
}
|
|
22
|
+
/** A model's request to call a tool. */
|
|
23
|
+
export interface AiToolCall {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
arguments: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/** The result of executing a tool call, fed back to the model. */
|
|
29
|
+
export interface AiToolResult {
|
|
30
|
+
id: string;
|
|
31
|
+
content: string;
|
|
32
|
+
isError?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Returned by an app's `GET /provider/ai-tools/describe`. */
|
|
35
|
+
export type AiToolDescriptor = AiTool;
|
|
36
|
+
/** One step in the assistant's tool-use trace, persisted on the message. */
|
|
37
|
+
export interface ToolTraceEntry {
|
|
38
|
+
call: AiToolCall;
|
|
39
|
+
state: "running" | "done" | "error";
|
|
40
|
+
result?: AiToolResult;
|
|
41
|
+
}
|