feat: add system tools and state updates

This commit is contained in:
Xin Wang
2026-08-04 15:27:39 +08:00
parent 5bf5987fe4
commit 731a372df9
33 changed files with 1787 additions and 124 deletions

View File

@@ -216,6 +216,12 @@ export type StartupConfig = {
} | null;
};
export type SystemToolKind =
| "end_conversation"
| "update_state"
| "skip_turn"
| "request_human_handoff";
/** 后端 AssistantOut(宽表 STI:瘦字段平铺,workflow 用 graph)。apiKey 读时打码 */
export type Assistant = {
id: string;
@@ -226,6 +232,7 @@ export type Assistant = {
enableInterrupt: boolean;
turnConfig: TurnConfig;
startup: StartupConfig;
systemTools: SystemToolKind[];
visionEnabled: boolean;
visionModelResourceId: string | null;
modelResourceIds: Partial<Record<ModelType, string>>;
@@ -354,10 +361,11 @@ export type ToolParameter = {
required: boolean;
};
export type EndCallToolDefinition = {
export type SystemToolDefinition = {
schemaVersion: number;
type: "end_call";
type: "system";
config: {
kind: "end_conversation";
messageType: "none" | "custom";
customMessage: string;
captureReason: boolean;
@@ -411,10 +419,10 @@ export type Tool = {
id: string;
name: string;
functionName: string;
type: "end_call" | "http" | "mcp" | "client";
type: "system" | "http" | "mcp" | "client";
description: string;
definition:
| EndCallToolDefinition
| SystemToolDefinition
| HttpToolDefinition
| ClientToolDefinition
| McpToolDefinition;