@besales/mcp 0.45.0 → 0.47.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/README.md +96 -55
- package/dist/auth/connection-store.d.ts +21 -1
- package/dist/auth/connection-store.js +46 -2
- package/dist/auth/connection-store.js.map +1 -1
- package/dist/auth/oauth-client.d.ts +5 -1
- package/dist/auth/oauth-client.js +22 -12
- package/dist/auth/oauth-client.js.map +1 -1
- package/dist/cli.js +14 -5
- package/dist/cli.js.map +1 -1
- package/dist/http/api-client.d.ts +16 -1
- package/dist/http/api-client.js +50 -2
- package/dist/http/api-client.js.map +1 -1
- package/dist/instructions/server-instructions.d.ts +4 -13
- package/dist/instructions/server-instructions.js +68 -274
- package/dist/instructions/server-instructions.js.map +1 -1
- package/dist/prompts/registry.d.ts +15 -0
- package/dist/prompts/registry.js +83 -0
- package/dist/prompts/registry.js.map +1 -0
- package/dist/resources/concepts/feedback-sheets.md +7 -4
- package/dist/resources/concepts/handoff.md +4 -1
- package/dist/resources/concepts/sandbox.md +14 -5
- package/dist/resources/concepts/triggers.md +6 -2
- package/dist/resources/concepts/workbook-classification.md +26 -21
- package/dist/resources/docs/campaigns.md +20 -0
- package/dist/resources/docs/crm-integration.md +3 -1
- package/dist/resources/docs/follow-up.md +19 -0
- package/dist/resources/docs/platforms.md +2 -2
- package/dist/resources/docs/routing.md +18 -0
- package/dist/resources/docs/task-state.md +30 -0
- package/dist/resources/docs/trigger-actions.md +28 -0
- package/dist/resources/docs/variables.md +18 -0
- package/dist/resources/registry.js +51 -2
- package/dist/resources/registry.js.map +1 -1
- package/dist/resources/workflows/compare-models.md +4 -3
- package/dist/resources/workflows/connect-crm-from-scratch.md +8 -0
- package/dist/resources/workflows/extract-from-document.md +8 -1
- package/dist/resources/workflows/iterate-with-sandbox.md +5 -2
- package/dist/resources/workflows/platform-setup-from-scratch.md +90 -2
- package/dist/resources/workflows/production-readiness-check.md +22 -18
- package/dist/schemas/mcp-tools.json +1537 -177
- package/dist/server.d.ts +2 -0
- package/dist/server.js +8 -2
- package/dist/server.js.map +1 -1
- package/dist/tasks/task-state-store.d.ts +68 -0
- package/dist/tasks/task-state-store.js +278 -0
- package/dist/tasks/task-state-store.js.map +1 -0
- package/dist/tools/annotations.d.ts +7 -0
- package/dist/tools/annotations.js +16 -0
- package/dist/tools/annotations.js.map +1 -0
- package/dist/tools/contracts.js +7 -1
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/definitions/agent-design.d.ts +49 -20
- package/dist/tools/definitions/agent-design.js +192 -19
- package/dist/tools/definitions/agent-design.js.map +1 -1
- package/dist/tools/definitions/analytics.d.ts +40 -0
- package/dist/tools/definitions/analytics.js +233 -0
- package/dist/tools/definitions/analytics.js.map +1 -0
- package/dist/tools/definitions/broadcast-analytics.d.ts +5 -4
- package/dist/tools/definitions/broadcast-analytics.js +26 -4
- package/dist/tools/definitions/broadcast-analytics.js.map +1 -1
- package/dist/tools/definitions/broadcast-mailing-variants.d.ts +2 -0
- package/dist/tools/definitions/broadcast-mailing-variants.js +10 -0
- package/dist/tools/definitions/broadcast-mailing-variants.js.map +1 -1
- package/dist/tools/definitions/broadcast-scheduler.d.ts +20 -1
- package/dist/tools/definitions/broadcast-scheduler.js +134 -8
- package/dist/tools/definitions/broadcast-scheduler.js.map +1 -1
- package/dist/tools/definitions/contacts.d.ts +15 -0
- package/dist/tools/definitions/contacts.js +84 -0
- package/dist/tools/definitions/contacts.js.map +1 -0
- package/dist/tools/definitions/crm-platform.d.ts +2 -0
- package/dist/tools/definitions/crm-platform.js +95 -5
- package/dist/tools/definitions/crm-platform.js.map +1 -1
- package/dist/tools/definitions/datasource.d.ts +1 -0
- package/dist/tools/definitions/datasource.js +16 -1
- package/dist/tools/definitions/datasource.js.map +1 -1
- package/dist/tools/definitions/dialogue-audit.d.ts +2 -2
- package/dist/tools/definitions/dialogue-audit.js +54 -16
- package/dist/tools/definitions/dialogue-audit.js.map +1 -1
- package/dist/tools/definitions/dialogue-export.d.ts +1 -1
- package/dist/tools/definitions/dialogue-export.js +12 -0
- package/dist/tools/definitions/dialogue-export.js.map +1 -1
- package/dist/tools/definitions/external-api-channels.js +39 -12
- package/dist/tools/definitions/external-api-channels.js.map +1 -1
- package/dist/tools/definitions/follow-up-funnel-test.js +4 -0
- package/dist/tools/definitions/follow-up-funnel-test.js.map +1 -1
- package/dist/tools/definitions/follow-up-setup.js +3 -0
- package/dist/tools/definitions/follow-up-setup.js.map +1 -1
- package/dist/tools/definitions/follow-up.d.ts +1 -1
- package/dist/tools/definitions/follow-up.js +6 -0
- package/dist/tools/definitions/follow-up.js.map +1 -1
- package/dist/tools/definitions/getcourse-anchor-refresh.d.ts +3 -0
- package/dist/tools/definitions/getcourse-anchor-refresh.js +29 -2
- package/dist/tools/definitions/getcourse-anchor-refresh.js.map +1 -1
- package/dist/tools/definitions/getcourse-cold-welcome.d.ts +20 -2
- package/dist/tools/definitions/getcourse-cold-welcome.js +128 -7
- package/dist/tools/definitions/getcourse-cold-welcome.js.map +1 -1
- package/dist/tools/definitions/getcourse-wave.js +14 -0
- package/dist/tools/definitions/getcourse-wave.js.map +1 -1
- package/dist/tools/definitions/help.d.ts +8 -0
- package/dist/tools/definitions/help.js +219 -0
- package/dist/tools/definitions/help.js.map +1 -0
- package/dist/tools/definitions/knowledge.d.ts +27 -5
- package/dist/tools/definitions/knowledge.js +200 -33
- package/dist/tools/definitions/knowledge.js.map +1 -1
- package/dist/tools/definitions/link-tracking.js +31 -0
- package/dist/tools/definitions/link-tracking.js.map +1 -1
- package/dist/tools/definitions/model-comparison.js +12 -3
- package/dist/tools/definitions/model-comparison.js.map +1 -1
- package/dist/tools/definitions/operational-overview.d.ts +3 -0
- package/dist/tools/definitions/operational-overview.js +23 -0
- package/dist/tools/definitions/operational-overview.js.map +1 -0
- package/dist/tools/definitions/operator-workflow.d.ts +20 -0
- package/dist/tools/definitions/operator-workflow.js +114 -0
- package/dist/tools/definitions/operator-workflow.js.map +1 -0
- package/dist/tools/definitions/platform-setup.d.ts +54 -3
- package/dist/tools/definitions/platform-setup.js +211 -5
- package/dist/tools/definitions/platform-setup.js.map +1 -1
- package/dist/tools/definitions/scheduled-tasks.js +2 -0
- package/dist/tools/definitions/scheduled-tasks.js.map +1 -1
- package/dist/tools/definitions/session.js +103 -5
- package/dist/tools/definitions/session.js.map +1 -1
- package/dist/tools/definitions/shared.d.ts +272 -10
- package/dist/tools/definitions/shared.js +154 -8
- package/dist/tools/definitions/shared.js.map +1 -1
- package/dist/tools/definitions/task-state.d.ts +76 -0
- package/dist/tools/definitions/task-state.js +301 -0
- package/dist/tools/definitions/task-state.js.map +1 -0
- package/dist/tools/definitions/trigger-contact-claims.d.ts +7 -0
- package/dist/tools/definitions/trigger-contact-claims.js +60 -0
- package/dist/tools/definitions/trigger-contact-claims.js.map +1 -0
- package/dist/tools/definitions.d.ts +334 -35
- package/dist/tools/definitions.js +14 -0
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/description-localization.d.ts +2 -0
- package/dist/tools/description-localization.js +46 -0
- package/dist/tools/description-localization.js.map +1 -0
- package/dist/tools/incomplete-list.d.ts +23 -0
- package/dist/tools/incomplete-list.js +39 -0
- package/dist/tools/incomplete-list.js.map +1 -0
- package/dist/tools/inventory.d.ts +10 -0
- package/dist/tools/inventory.js +49 -0
- package/dist/tools/inventory.js.map +1 -0
- package/dist/tools/registry-mapping-cases-core.js +122 -4
- package/dist/tools/registry-mapping-cases-core.js.map +1 -1
- package/dist/tools/registry-mapping-cases-platform.js +69 -0
- package/dist/tools/registry-mapping-cases-platform.js.map +1 -1
- package/dist/tools/registry.d.ts +2 -0
- package/dist/tools/registry.js +60 -8
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +46 -0
- package/dist/tools/result-envelope.js +184 -0
- package/dist/tools/result-envelope.js.map +1 -0
- package/dist/tools/result.d.ts +41 -3
- package/dist/tools/result.js +229 -27
- package/dist/tools/result.js.map +1 -1
- package/dist/tools/tool-title.d.ts +2 -0
- package/dist/tools/tool-title.js +12 -0
- package/dist/tools/tool-title.js.map +1 -0
- package/dist/tools/toolsets.d.ts +37 -0
- package/dist/tools/toolsets.js +64 -0
- package/dist/tools/toolsets.js.map +1 -0
- package/dist/tools/trigger-action-config.js +4 -0
- package/dist/tools/trigger-action-config.js.map +1 -1
- package/dist/tools/verify-with.d.ts +5 -0
- package/dist/tools/verify-with.js +36 -0
- package/dist/tools/verify-with.js.map +1 -0
- package/dist/types/api-contract.gen.d.ts +2612 -332
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.js +64 -8
- package/dist/utils/logger.js.map +1 -1
- package/docs/agent-usage-guide.full.ru.md +21 -15
- package/docs/agent-usage-guide.ru.md +24 -16
- package/docs/async-operation-lifecycle.md +46 -0
- package/docs/connect.ru.md +120 -0
- package/docs/evals/model-behavior-scorecard.md +80 -0
- package/docs/failure-semantics.md +56 -0
- package/docs/help-navigation.md +48 -0
- package/docs/host-compatibility-matrix.md +153 -0
- package/docs/host-setup.md +22 -6
- package/docs/operation-coverage.md +114 -0
- package/docs/pii-policy.md +46 -0
- package/docs/response-size-budget.md +150 -0
- package/docs/task-state.md +58 -0
- package/docs/tool-effects.md +46 -0
- package/docs/tool-surface.md +91 -0
- package/package.json +6 -2
- package/scripts/model-eval-server.js +213 -0
- package/scripts/probe-mcp-protocol.js +134 -0
- package/scripts/run-model-eval.js +447 -0
|
@@ -28,6 +28,9 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
28
28
|
operation_id: string;
|
|
29
29
|
icp_profile_id: string;
|
|
30
30
|
segments: {
|
|
31
|
+
language_style: {
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
} | undefined;
|
|
31
34
|
name: string;
|
|
32
35
|
id?: string | undefined;
|
|
33
36
|
description?: string | undefined;
|
|
@@ -36,22 +39,19 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
36
39
|
} | undefined;
|
|
37
40
|
pains?: unknown[] | undefined;
|
|
38
41
|
motivations?: unknown[] | undefined;
|
|
39
|
-
language_style?: {
|
|
40
|
-
[x: string]: unknown;
|
|
41
|
-
} | undefined;
|
|
42
42
|
}[];
|
|
43
43
|
personas: {
|
|
44
|
+
segment_id: string | undefined;
|
|
45
|
+
pain_points: unknown[] | undefined;
|
|
46
|
+
messaging_hints: {
|
|
47
|
+
[x: string]: unknown;
|
|
48
|
+
} | undefined;
|
|
44
49
|
name: string;
|
|
45
|
-
segment_id: string;
|
|
46
50
|
description?: string | undefined;
|
|
47
|
-
pain_points?: unknown[] | undefined;
|
|
48
51
|
goals?: unknown[] | undefined;
|
|
49
52
|
objections?: {
|
|
50
53
|
[x: string]: unknown;
|
|
51
54
|
} | undefined;
|
|
52
|
-
messaging_hints?: {
|
|
53
|
-
[x: string]: unknown;
|
|
54
|
-
} | undefined;
|
|
55
55
|
}[];
|
|
56
56
|
workspace_id?: string | undefined;
|
|
57
57
|
}> | import("./shared.js").ToolDefinition<{
|
|
@@ -75,6 +75,7 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
75
75
|
message_direction?: "INBOUND" | "OUTBOUND" | undefined;
|
|
76
76
|
} | undefined;
|
|
77
77
|
}> | import("./shared.js").ToolDefinition<{
|
|
78
|
+
final_content: string | undefined;
|
|
78
79
|
agent_id: string;
|
|
79
80
|
operation_id: string;
|
|
80
81
|
stages: {
|
|
@@ -83,7 +84,6 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
83
84
|
[x: string]: unknown;
|
|
84
85
|
};
|
|
85
86
|
}[];
|
|
86
|
-
final_content: string;
|
|
87
87
|
metadata?: {
|
|
88
88
|
total_tokens?: number | undefined;
|
|
89
89
|
models?: Record<string, string> | undefined;
|
|
@@ -93,6 +93,9 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
93
93
|
version_id: string;
|
|
94
94
|
modes: ("grammar" | "industry" | "structure" | "completeness" | "contradictions")[];
|
|
95
95
|
}> | import("./shared.js").ToolDefinition<{
|
|
96
|
+
aggregated_issues: {
|
|
97
|
+
[x: string]: unknown;
|
|
98
|
+
}[] | undefined;
|
|
96
99
|
agent_id: string;
|
|
97
100
|
operation_id: string;
|
|
98
101
|
stages: {
|
|
@@ -101,15 +104,13 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
101
104
|
[x: string]: unknown;
|
|
102
105
|
};
|
|
103
106
|
}[];
|
|
104
|
-
aggregated_issues: {
|
|
105
|
-
[x: string]: unknown;
|
|
106
|
-
}[];
|
|
107
107
|
}> | import("./shared.js").ToolDefinition<{
|
|
108
108
|
agent_id: string;
|
|
109
109
|
draft_version_id: string;
|
|
110
110
|
changelog_note?: string | undefined;
|
|
111
111
|
}> | import("./shared.js").ToolDefinition<{
|
|
112
112
|
agent_id: string;
|
|
113
|
+
candidate_prompt?: string | undefined;
|
|
113
114
|
scenario_ids?: string[] | undefined;
|
|
114
115
|
options?: {
|
|
115
116
|
mode: "single_agent" | "workflow";
|
|
@@ -123,6 +124,19 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
123
124
|
max_turns?: number | undefined;
|
|
124
125
|
} | undefined;
|
|
125
126
|
} | undefined;
|
|
127
|
+
}> | import("./shared.js").ToolDefinition<{
|
|
128
|
+
agent_id: string;
|
|
129
|
+
limit?: number | undefined;
|
|
130
|
+
cursor?: string | undefined;
|
|
131
|
+
}> | import("./shared.js").ToolDefinition<{
|
|
132
|
+
run_id: string;
|
|
133
|
+
reviewed_issues: {
|
|
134
|
+
scenario_id?: string | undefined;
|
|
135
|
+
turn_index?: number | undefined;
|
|
136
|
+
category?: "other" | "hallucination" | "wrong_action" | "bad_tone" | "missed_context" | undefined;
|
|
137
|
+
description?: string | undefined;
|
|
138
|
+
}[];
|
|
139
|
+
general_comments?: string | undefined;
|
|
126
140
|
}> | import("./shared.js").ToolDefinition<{
|
|
127
141
|
agent_id: string;
|
|
128
142
|
run_id: string;
|
|
@@ -131,12 +145,17 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
131
145
|
run_id: string;
|
|
132
146
|
operation_id: string;
|
|
133
147
|
findings: {
|
|
134
|
-
category: "other" | "hallucination" | "wrong_action" | "bad_tone" | "
|
|
135
|
-
severity: "
|
|
136
|
-
message: string;
|
|
148
|
+
category: "other" | "hallucination" | "wrong_action" | "bad_tone" | "missed_context" | "wrong_routing" | "rag_miss";
|
|
149
|
+
severity: "critical" | "low" | "medium";
|
|
137
150
|
scenario_id?: string | undefined;
|
|
151
|
+
scenarioId?: string | undefined;
|
|
152
|
+
description?: string | undefined;
|
|
153
|
+
message?: string | undefined;
|
|
154
|
+
evidence?: string | undefined;
|
|
155
|
+
recommendation?: string | undefined;
|
|
138
156
|
suggestion?: string | undefined;
|
|
139
157
|
turn_index?: number | undefined;
|
|
158
|
+
turnIndex?: number | undefined;
|
|
140
159
|
}[];
|
|
141
160
|
}> | import("./shared.js").ToolDefinition<{
|
|
142
161
|
agent_id: string;
|
|
@@ -146,11 +165,13 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
146
165
|
operation_id: string;
|
|
147
166
|
findings: {
|
|
148
167
|
category: "other" | "hallucination" | "wrong_action" | "bad_tone" | "missed_context" | "contradiction" | "off_topic";
|
|
149
|
-
severity: "
|
|
168
|
+
severity: "critical" | "low" | "medium";
|
|
150
169
|
message: string;
|
|
151
170
|
dialogue_id?: string | undefined;
|
|
171
|
+
dialogueId?: string | undefined;
|
|
152
172
|
suggestion?: string | undefined;
|
|
153
173
|
reference_message_index?: number | undefined;
|
|
174
|
+
referenceMessageIndex?: number | undefined;
|
|
154
175
|
}[];
|
|
155
176
|
simulation_id?: string | undefined;
|
|
156
177
|
}> | import("./shared.js").ToolDefinition<{
|
|
@@ -160,14 +181,14 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
160
181
|
company_context?: string | undefined;
|
|
161
182
|
icp_profile_id?: string | undefined;
|
|
162
183
|
}> | import("./shared.js").ToolDefinition<{
|
|
163
|
-
|
|
164
|
-
operation_id: string;
|
|
184
|
+
knowledge_space_id: string | undefined;
|
|
165
185
|
qa_pairs: {
|
|
166
186
|
question: string;
|
|
167
187
|
answer: string;
|
|
168
188
|
tags?: string[] | undefined;
|
|
169
|
-
}[];
|
|
170
|
-
|
|
189
|
+
}[] | undefined;
|
|
190
|
+
agent_id: string;
|
|
191
|
+
operation_id: string;
|
|
171
192
|
}> | import("./shared.js").ToolDefinition<{
|
|
172
193
|
icp_profile_id: string;
|
|
173
194
|
count: number;
|
|
@@ -184,6 +205,14 @@ export declare const agentDesignTools: (import("./shared.js").ToolDefinition<{
|
|
|
184
205
|
situations: {
|
|
185
206
|
role: "client" | "agent";
|
|
186
207
|
text: string;
|
|
208
|
+
expect?: {
|
|
209
|
+
triggers?: string[] | undefined;
|
|
210
|
+
noTriggers?: string[] | undefined;
|
|
211
|
+
tools?: string[] | undefined;
|
|
212
|
+
noTools?: string[] | undefined;
|
|
213
|
+
answerContains?: string[] | undefined;
|
|
214
|
+
answerNotContains?: string[] | undefined;
|
|
215
|
+
} | undefined;
|
|
187
216
|
}[];
|
|
188
217
|
description?: string | undefined;
|
|
189
218
|
}[];
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { analysisModeSchema, anyObjectSchema, buildListQuery, compactMetadata, compactObject, defineTool, generatedScenarioSchema, icpAnalysisPersonaSchema, icpAnalysisSegmentSchema, optionalAnyObjectSchema, outcomeSchema, promptAnalysisStageOutputSchema, promptGenerationStageOutputSchema, sandboxFindingSchema, simulationFindingSchema, uuidSchema, withInstructions, } from './shared.js';
|
|
3
|
+
const SANDBOX_TERMINAL_STATUSES = new Set(['COMPLETED', 'FAILED', 'CANCELLED']);
|
|
4
|
+
function enhanceSandboxStatus(response) {
|
|
5
|
+
if (!response || typeof response !== 'object' || Array.isArray(response)) {
|
|
6
|
+
return response;
|
|
7
|
+
}
|
|
8
|
+
const status = response.status;
|
|
9
|
+
if (typeof status !== 'string') {
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
if (!SANDBOX_TERMINAL_STATUSES.has(status)) {
|
|
13
|
+
return withInstructions(response, [
|
|
14
|
+
`Прогон ещё не завершён (${status}). Подожди 10–30 секунд и снова вызови besales_sandbox_run_get с тем же run_id.`,
|
|
15
|
+
'Не запускай второй прогон вместо проверки статуса.',
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
if (status === 'COMPLETED') {
|
|
19
|
+
return withInstructions(response, [
|
|
20
|
+
'Прогон завершён. passRate показывает живучесть ответов, а не качество.',
|
|
21
|
+
'Проверь checksRate и qualityRate отдельно. Если qualityRate ещё null, вызови besales_sandbox_findings_get_instructions, затем besales_sandbox_findings_submit.',
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
return withInstructions(response, [
|
|
25
|
+
`Прогон завершён со статусом ${status}. Не запускай findings и не выдавай готовность агента за доказанную.`,
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
3
28
|
export const agentDesignTools = [
|
|
4
29
|
defineTool({
|
|
5
30
|
name: 'besales_icp_create',
|
|
31
|
+
sideEffect: 'write',
|
|
6
32
|
requiredFields: ['name'],
|
|
7
33
|
defaultWorkspaceId: true,
|
|
8
34
|
schema: z.object({
|
|
@@ -24,6 +50,9 @@ export const agentDesignTools = [
|
|
|
24
50
|
}),
|
|
25
51
|
defineTool({
|
|
26
52
|
name: 'besales_icp_import_dialogues',
|
|
53
|
+
// Имя проверки из имени операции не выводится: суффиксы не парные.
|
|
54
|
+
verifyWithToolName: 'besales_icp_import_status',
|
|
55
|
+
sideEffect: 'spend',
|
|
27
56
|
requiredFields: ['icp_id'],
|
|
28
57
|
schema: z
|
|
29
58
|
.object({
|
|
@@ -121,6 +150,7 @@ export const agentDesignTools = [
|
|
|
121
150
|
}),
|
|
122
151
|
defineTool({
|
|
123
152
|
name: 'besales_icp_import_status',
|
|
153
|
+
sideEffect: 'none',
|
|
124
154
|
requiredFields: ['run_id'],
|
|
125
155
|
schema: z.object({
|
|
126
156
|
run_id: uuidSchema,
|
|
@@ -132,6 +162,7 @@ export const agentDesignTools = [
|
|
|
132
162
|
}),
|
|
133
163
|
defineTool({
|
|
134
164
|
name: 'besales_icp_analysis_get_instructions',
|
|
165
|
+
sideEffect: 'write',
|
|
135
166
|
requiredFields: ['icp_profile_id'],
|
|
136
167
|
defaultWorkspaceId: true,
|
|
137
168
|
schema: z.object({
|
|
@@ -155,6 +186,7 @@ export const agentDesignTools = [
|
|
|
155
186
|
}),
|
|
156
187
|
defineTool({
|
|
157
188
|
name: 'besales_icp_analysis_submit',
|
|
189
|
+
sideEffect: 'write',
|
|
158
190
|
requiredFields: ['operation_id', 'icp_profile_id', 'segments', 'personas'],
|
|
159
191
|
defaultWorkspaceId: true,
|
|
160
192
|
schema: z.object({
|
|
@@ -193,6 +225,9 @@ export const agentDesignTools = [
|
|
|
193
225
|
}),
|
|
194
226
|
defineTool({
|
|
195
227
|
name: 'besales_icp_list',
|
|
228
|
+
// Постраничная выдача уже работает: конверт подменил бы исправный механизм тихой потерей.
|
|
229
|
+
resultPolicy: { neverTruncate: true },
|
|
230
|
+
sideEffect: 'none',
|
|
196
231
|
requiredFields: [],
|
|
197
232
|
defaultWorkspaceId: true,
|
|
198
233
|
schema: z.object({
|
|
@@ -207,6 +242,7 @@ export const agentDesignTools = [
|
|
|
207
242
|
}),
|
|
208
243
|
defineTool({
|
|
209
244
|
name: 'besales_icp_get',
|
|
245
|
+
sideEffect: 'none',
|
|
210
246
|
requiredFields: ['icp_id'],
|
|
211
247
|
schema: z.object({
|
|
212
248
|
icp_id: uuidSchema,
|
|
@@ -218,6 +254,10 @@ export const agentDesignTools = [
|
|
|
218
254
|
}),
|
|
219
255
|
defineTool({
|
|
220
256
|
name: 'besales_icp_scenarios_list',
|
|
257
|
+
// Замерено 119 КБ голым массивом, ручек сужения нет. Обрезка молча срезала бы часть
|
|
258
|
+
// сценариев, а добрать отрезанное нечем — поэтому отказ, а не половина набора.
|
|
259
|
+
resultPolicy: { neverTruncate: true },
|
|
260
|
+
sideEffect: 'none',
|
|
221
261
|
requiredFields: ['icp_id'],
|
|
222
262
|
schema: z.object({
|
|
223
263
|
icp_id: uuidSchema,
|
|
@@ -229,6 +269,7 @@ export const agentDesignTools = [
|
|
|
229
269
|
}),
|
|
230
270
|
defineTool({
|
|
231
271
|
name: 'besales_icp_sample_messages',
|
|
272
|
+
sideEffect: 'none',
|
|
232
273
|
requiredFields: ['sample_id'],
|
|
233
274
|
schema: z.object({
|
|
234
275
|
sample_id: uuidSchema,
|
|
@@ -240,6 +281,7 @@ export const agentDesignTools = [
|
|
|
240
281
|
}),
|
|
241
282
|
defineTool({
|
|
242
283
|
name: 'besales_prompt_generate_get_instructions',
|
|
284
|
+
sideEffect: 'write',
|
|
243
285
|
requiredFields: ['agent_id'],
|
|
244
286
|
schema: z.object({
|
|
245
287
|
agent_id: uuidSchema,
|
|
@@ -282,19 +324,30 @@ export const agentDesignTools = [
|
|
|
282
324
|
}),
|
|
283
325
|
defineTool({
|
|
284
326
|
name: 'besales_prompt_generate_submit',
|
|
285
|
-
|
|
286
|
-
|
|
327
|
+
sideEffect: 'write',
|
|
328
|
+
requiredFields: ['agent_id', 'operation_id', 'stages'],
|
|
329
|
+
schema: z
|
|
330
|
+
.object({
|
|
287
331
|
agent_id: uuidSchema,
|
|
288
332
|
operation_id: uuidSchema,
|
|
289
333
|
stages: z.array(promptGenerationStageOutputSchema).min(4),
|
|
290
|
-
final_content: z.string(),
|
|
334
|
+
final_content: z.string().optional(),
|
|
335
|
+
finalContent: z.string().optional(),
|
|
291
336
|
metadata: z
|
|
292
337
|
.object({
|
|
293
338
|
total_tokens: z.number().int().optional(),
|
|
294
339
|
models: z.record(z.string(), z.string()).optional(),
|
|
295
340
|
})
|
|
296
341
|
.optional(),
|
|
297
|
-
})
|
|
342
|
+
})
|
|
343
|
+
.refine((input) => input.final_content !== undefined || input.finalContent !== undefined, {
|
|
344
|
+
message: 'finalContent is required',
|
|
345
|
+
path: ['finalContent'],
|
|
346
|
+
})
|
|
347
|
+
.transform(({ final_content, finalContent, ...input }) => ({
|
|
348
|
+
...input,
|
|
349
|
+
final_content: final_content ?? finalContent,
|
|
350
|
+
})),
|
|
298
351
|
createRequest: (input) => ({
|
|
299
352
|
path: `/agents/${input.agent_id}/prompt/generate/${input.operation_id}/submit`,
|
|
300
353
|
body: compactObject({
|
|
@@ -307,6 +360,7 @@ export const agentDesignTools = [
|
|
|
307
360
|
}),
|
|
308
361
|
defineTool({
|
|
309
362
|
name: 'besales_prompt_analyze_get_instructions',
|
|
363
|
+
sideEffect: 'write',
|
|
310
364
|
requiredFields: ['agent_id', 'version_id'],
|
|
311
365
|
schema: z.object({
|
|
312
366
|
agent_id: uuidSchema,
|
|
@@ -328,13 +382,21 @@ export const agentDesignTools = [
|
|
|
328
382
|
}),
|
|
329
383
|
defineTool({
|
|
330
384
|
name: 'besales_prompt_analyze_submit',
|
|
331
|
-
|
|
332
|
-
|
|
385
|
+
sideEffect: 'write',
|
|
386
|
+
requiredFields: ['agent_id', 'operation_id', 'stages'],
|
|
387
|
+
schema: z
|
|
388
|
+
.object({
|
|
333
389
|
agent_id: uuidSchema,
|
|
334
390
|
operation_id: uuidSchema,
|
|
335
391
|
stages: z.array(promptAnalysisStageOutputSchema).min(4),
|
|
336
|
-
aggregated_issues: z.array(anyObjectSchema),
|
|
337
|
-
|
|
392
|
+
aggregated_issues: z.array(anyObjectSchema).optional(),
|
|
393
|
+
aggregatedIssues: z.array(anyObjectSchema).optional(),
|
|
394
|
+
})
|
|
395
|
+
.refine((input) => input.aggregated_issues !== undefined || input.aggregatedIssues !== undefined, { message: 'aggregatedIssues is required', path: ['aggregatedIssues'] })
|
|
396
|
+
.transform(({ aggregated_issues, aggregatedIssues, ...input }) => ({
|
|
397
|
+
...input,
|
|
398
|
+
aggregated_issues: aggregated_issues ?? aggregatedIssues,
|
|
399
|
+
})),
|
|
338
400
|
createRequest: (input) => ({
|
|
339
401
|
path: `/agents/${input.agent_id}/prompt/analyze/${input.operation_id}/submit`,
|
|
340
402
|
body: {
|
|
@@ -346,6 +408,7 @@ export const agentDesignTools = [
|
|
|
346
408
|
}),
|
|
347
409
|
defineTool({
|
|
348
410
|
name: 'besales_prompt_finalize',
|
|
411
|
+
sideEffect: 'write',
|
|
349
412
|
requiredFields: ['agent_id', 'draft_version_id'],
|
|
350
413
|
schema: z.object({
|
|
351
414
|
agent_id: uuidSchema,
|
|
@@ -365,9 +428,11 @@ export const agentDesignTools = [
|
|
|
365
428
|
}),
|
|
366
429
|
defineTool({
|
|
367
430
|
name: 'besales_sandbox_run_start',
|
|
431
|
+
sideEffect: 'spend',
|
|
368
432
|
requiredFields: ['agent_id'],
|
|
369
433
|
schema: z.object({
|
|
370
434
|
agent_id: uuidSchema,
|
|
435
|
+
candidate_prompt: z.string().min(10).max(100_000).optional(),
|
|
371
436
|
scenario_ids: z.array(uuidSchema).optional(),
|
|
372
437
|
options: z
|
|
373
438
|
.object({
|
|
@@ -389,6 +454,7 @@ export const agentDesignTools = [
|
|
|
389
454
|
createRequest: (input) => ({
|
|
390
455
|
path: `/agents/${input.agent_id}/sandbox-runs`,
|
|
391
456
|
body: compactObject({
|
|
457
|
+
candidatePrompt: input.candidate_prompt,
|
|
392
458
|
scenarioIds: input.scenario_ids,
|
|
393
459
|
options: input.options
|
|
394
460
|
? {
|
|
@@ -406,9 +472,83 @@ export const agentDesignTools = [
|
|
|
406
472
|
: undefined,
|
|
407
473
|
}),
|
|
408
474
|
}),
|
|
475
|
+
verifyWithToolName: 'besales_sandbox_run_get',
|
|
476
|
+
enhanceResponse: (response, input) => withInstructions(response, [
|
|
477
|
+
'Сохрани id прогона как run_id. Проверяй только этот прогон через besales_sandbox_run_get.',
|
|
478
|
+
input.candidate_prompt
|
|
479
|
+
? 'Проверяется неактивированный candidate_prompt. Он не меняет работающего агента; активировать результат можно только отдельным prompt commit/finalize после проверки актуальности hash.'
|
|
480
|
+
: 'Проверяется активный промпт агента. testedConfiguration в detail фиксирует его hash/version на момент постановки.',
|
|
481
|
+
'Первую проверку делай через 10–30 секунд; повторяй, пока status не станет COMPLETED, FAILED или CANCELLED.',
|
|
482
|
+
]),
|
|
483
|
+
}),
|
|
484
|
+
defineTool({
|
|
485
|
+
name: 'besales_sandbox_run_list',
|
|
486
|
+
resultPolicy: { neverTruncate: true },
|
|
487
|
+
sideEffect: 'none',
|
|
488
|
+
requiredFields: ['agent_id'],
|
|
489
|
+
schema: z.object({
|
|
490
|
+
agent_id: uuidSchema,
|
|
491
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
492
|
+
cursor: z.string().optional(),
|
|
493
|
+
}),
|
|
494
|
+
createRequest: (input) => ({
|
|
495
|
+
method: 'GET',
|
|
496
|
+
path: `/agents/${input.agent_id}/sandbox-runs${buildListQuery({ limit: input.limit, cursor: input.cursor })}`,
|
|
497
|
+
}),
|
|
498
|
+
}),
|
|
499
|
+
defineTool({
|
|
500
|
+
name: 'besales_sandbox_run_get',
|
|
501
|
+
sideEffect: 'none',
|
|
502
|
+
requiredFields: ['run_id'],
|
|
503
|
+
schema: z.object({ run_id: uuidSchema }),
|
|
504
|
+
createRequest: (input) => ({
|
|
505
|
+
method: 'GET',
|
|
506
|
+
path: `/sandbox-runs/${input.run_id}`,
|
|
507
|
+
}),
|
|
508
|
+
enhanceResponse: enhanceSandboxStatus,
|
|
509
|
+
}),
|
|
510
|
+
defineTool({
|
|
511
|
+
name: 'besales_sandbox_run_cancel',
|
|
512
|
+
sideEffect: 'write',
|
|
513
|
+
requiredFields: ['run_id'],
|
|
514
|
+
schema: z.object({ run_id: uuidSchema }),
|
|
515
|
+
createRequest: (input) => ({
|
|
516
|
+
path: `/sandbox-runs/${input.run_id}/cancel`,
|
|
517
|
+
}),
|
|
518
|
+
enhanceResponse: enhanceSandboxStatus,
|
|
519
|
+
}),
|
|
520
|
+
defineTool({
|
|
521
|
+
name: 'besales_sandbox_run_feedback',
|
|
522
|
+
sideEffect: 'write',
|
|
523
|
+
requiredFields: ['run_id', 'reviewed_issues'],
|
|
524
|
+
schema: z.object({
|
|
525
|
+
run_id: uuidSchema,
|
|
526
|
+
reviewed_issues: z.array(z.object({
|
|
527
|
+
scenario_id: uuidSchema.optional(),
|
|
528
|
+
turn_index: z.number().int().min(0).optional(),
|
|
529
|
+
category: z
|
|
530
|
+
.enum(['hallucination', 'wrong_action', 'bad_tone', 'missed_context', 'other'])
|
|
531
|
+
.optional(),
|
|
532
|
+
description: z.string().optional(),
|
|
533
|
+
})),
|
|
534
|
+
general_comments: z.string().optional(),
|
|
535
|
+
}),
|
|
536
|
+
createRequest: (input) => ({
|
|
537
|
+
path: `/sandbox-runs/${input.run_id}/feedback`,
|
|
538
|
+
body: compactObject({
|
|
539
|
+
reviewedIssues: input.reviewed_issues.map((issue) => compactObject({
|
|
540
|
+
scenarioId: issue.scenario_id,
|
|
541
|
+
turnIndex: issue.turn_index,
|
|
542
|
+
category: issue.category,
|
|
543
|
+
description: issue.description,
|
|
544
|
+
})),
|
|
545
|
+
generalComments: input.general_comments,
|
|
546
|
+
}),
|
|
547
|
+
}),
|
|
409
548
|
}),
|
|
410
549
|
defineTool({
|
|
411
550
|
name: 'besales_sandbox_findings_get_instructions',
|
|
551
|
+
sideEffect: 'write',
|
|
412
552
|
requiredFields: ['agent_id', 'run_id'],
|
|
413
553
|
schema: z.object({
|
|
414
554
|
agent_id: uuidSchema,
|
|
@@ -427,6 +567,7 @@ export const agentDesignTools = [
|
|
|
427
567
|
}),
|
|
428
568
|
defineTool({
|
|
429
569
|
name: 'besales_sandbox_findings_submit',
|
|
570
|
+
sideEffect: 'write',
|
|
430
571
|
requiredFields: ['agent_id', 'run_id', 'operation_id', 'findings'],
|
|
431
572
|
schema: z.object({
|
|
432
573
|
agent_id: uuidSchema,
|
|
@@ -438,12 +579,13 @@ export const agentDesignTools = [
|
|
|
438
579
|
path: `/agents/${input.agent_id}/sandbox/runs/${input.run_id}/findings/${input.operation_id}/submit`,
|
|
439
580
|
body: {
|
|
440
581
|
findings: input.findings.map((finding) => compactObject({
|
|
441
|
-
scenarioId: finding.scenario_id,
|
|
582
|
+
scenarioId: finding.scenarioId ?? finding.scenario_id,
|
|
442
583
|
category: finding.category,
|
|
443
584
|
severity: finding.severity,
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
585
|
+
description: finding.description ?? finding.message,
|
|
586
|
+
evidence: finding.evidence,
|
|
587
|
+
recommendation: finding.recommendation ?? finding.suggestion,
|
|
588
|
+
turnIndex: finding.turnIndex ?? finding.turn_index,
|
|
447
589
|
})),
|
|
448
590
|
},
|
|
449
591
|
}),
|
|
@@ -451,6 +593,7 @@ export const agentDesignTools = [
|
|
|
451
593
|
}),
|
|
452
594
|
defineTool({
|
|
453
595
|
name: 'besales_simulation_findings_get_instructions',
|
|
596
|
+
sideEffect: 'write',
|
|
454
597
|
requiredFields: ['agent_id', 'simulation_id'],
|
|
455
598
|
schema: z.object({
|
|
456
599
|
agent_id: uuidSchema,
|
|
@@ -470,6 +613,7 @@ export const agentDesignTools = [
|
|
|
470
613
|
}),
|
|
471
614
|
defineTool({
|
|
472
615
|
name: 'besales_simulation_findings_submit',
|
|
616
|
+
sideEffect: 'write',
|
|
473
617
|
requiredFields: ['agent_id', 'operation_id', 'findings'],
|
|
474
618
|
schema: z.object({
|
|
475
619
|
agent_id: uuidSchema,
|
|
@@ -483,12 +627,12 @@ export const agentDesignTools = [
|
|
|
483
627
|
path: `/agents/${input.agent_id}/prompt/simulate-findings/${input.operation_id}/submit`,
|
|
484
628
|
body: {
|
|
485
629
|
findings: input.findings.map((finding) => compactObject({
|
|
486
|
-
dialogueId: finding.dialogue_id,
|
|
630
|
+
dialogueId: finding.dialogueId ?? finding.dialogue_id,
|
|
487
631
|
category: finding.category,
|
|
488
632
|
severity: finding.severity,
|
|
489
633
|
message: finding.message,
|
|
490
634
|
suggestion: finding.suggestion,
|
|
491
|
-
referenceMessageIndex: finding.reference_message_index,
|
|
635
|
+
referenceMessageIndex: finding.referenceMessageIndex ?? finding.reference_message_index,
|
|
492
636
|
})),
|
|
493
637
|
},
|
|
494
638
|
}),
|
|
@@ -496,6 +640,7 @@ export const agentDesignTools = [
|
|
|
496
640
|
}),
|
|
497
641
|
defineTool({
|
|
498
642
|
name: 'besales_qa_generation_get_instructions',
|
|
643
|
+
sideEffect: 'write',
|
|
499
644
|
requiredFields: ['agent_id'],
|
|
500
645
|
schema: z.object({
|
|
501
646
|
agent_id: uuidSchema,
|
|
@@ -521,17 +666,38 @@ export const agentDesignTools = [
|
|
|
521
666
|
}),
|
|
522
667
|
defineTool({
|
|
523
668
|
name: 'besales_qa_generation_submit',
|
|
524
|
-
|
|
525
|
-
|
|
669
|
+
sideEffect: 'write',
|
|
670
|
+
requiredFields: ['agent_id', 'operation_id'],
|
|
671
|
+
schema: z
|
|
672
|
+
.object({
|
|
526
673
|
agent_id: uuidSchema,
|
|
527
674
|
operation_id: uuidSchema,
|
|
528
675
|
knowledge_space_id: uuidSchema.optional(),
|
|
529
|
-
|
|
676
|
+
knowledgeSpaceId: uuidSchema.optional(),
|
|
677
|
+
qa_pairs: z
|
|
678
|
+
.array(z.object({
|
|
530
679
|
question: z.string(),
|
|
531
680
|
answer: z.string(),
|
|
532
681
|
tags: z.array(z.string()).optional(),
|
|
533
|
-
}))
|
|
534
|
-
|
|
682
|
+
}))
|
|
683
|
+
.optional(),
|
|
684
|
+
qaPairs: z
|
|
685
|
+
.array(z.object({
|
|
686
|
+
question: z.string(),
|
|
687
|
+
answer: z.string(),
|
|
688
|
+
tags: z.array(z.string()).optional(),
|
|
689
|
+
}))
|
|
690
|
+
.optional(),
|
|
691
|
+
})
|
|
692
|
+
.refine((input) => input.qa_pairs !== undefined || input.qaPairs !== undefined, {
|
|
693
|
+
message: 'qaPairs is required',
|
|
694
|
+
path: ['qaPairs'],
|
|
695
|
+
})
|
|
696
|
+
.transform(({ knowledge_space_id, knowledgeSpaceId, qa_pairs, qaPairs, ...input }) => ({
|
|
697
|
+
...input,
|
|
698
|
+
knowledge_space_id: knowledge_space_id ?? knowledgeSpaceId,
|
|
699
|
+
qa_pairs: qa_pairs ?? qaPairs,
|
|
700
|
+
})),
|
|
535
701
|
createRequest: (input) => ({
|
|
536
702
|
path: `/agents/${input.agent_id}/knowledge/qa-generation/${input.operation_id}/submit`,
|
|
537
703
|
body: compactObject({
|
|
@@ -543,6 +709,7 @@ export const agentDesignTools = [
|
|
|
543
709
|
}),
|
|
544
710
|
defineTool({
|
|
545
711
|
name: 'besales_test_scenario_generate_get_instructions',
|
|
712
|
+
sideEffect: 'write',
|
|
546
713
|
requiredFields: ['icp_profile_id'],
|
|
547
714
|
defaultWorkspaceId: true,
|
|
548
715
|
schema: z.object({
|
|
@@ -571,6 +738,7 @@ export const agentDesignTools = [
|
|
|
571
738
|
}),
|
|
572
739
|
defineTool({
|
|
573
740
|
name: 'besales_test_scenario_generate_submit',
|
|
741
|
+
sideEffect: 'write',
|
|
574
742
|
requiredFields: ['operation_id', 'icp_profile_id', 'scenarios'],
|
|
575
743
|
defaultWorkspaceId: true,
|
|
576
744
|
schema: z.object({
|
|
@@ -588,9 +756,12 @@ export const agentDesignTools = [
|
|
|
588
756
|
name: scenario.name,
|
|
589
757
|
description: scenario.description,
|
|
590
758
|
segmentIds: scenario.segment_ids,
|
|
759
|
+
// ⚠️ `expect` перечислен ЯВНО: реплики пересобираются по списку полей, и забытый
|
|
760
|
+
// ключ не ломает ни сборку, ни схему — ожидания просто не доехали бы до backend.
|
|
591
761
|
situations: scenario.situations.map((situation) => ({
|
|
592
762
|
role: situation.role,
|
|
593
763
|
text: situation.text,
|
|
764
|
+
expect: situation.expect,
|
|
594
765
|
})),
|
|
595
766
|
})),
|
|
596
767
|
},
|
|
@@ -599,6 +770,7 @@ export const agentDesignTools = [
|
|
|
599
770
|
}),
|
|
600
771
|
defineTool({
|
|
601
772
|
name: 'besales_dialog_script_get',
|
|
773
|
+
sideEffect: 'none',
|
|
602
774
|
requiredFields: ['agent_id'],
|
|
603
775
|
schema: z.object({
|
|
604
776
|
agent_id: uuidSchema,
|
|
@@ -610,6 +782,7 @@ export const agentDesignTools = [
|
|
|
610
782
|
}),
|
|
611
783
|
defineTool({
|
|
612
784
|
name: 'besales_dialog_script_update',
|
|
785
|
+
sideEffect: 'write',
|
|
613
786
|
requiredFields: ['agent_id', 'graph'],
|
|
614
787
|
schema: z.object({
|
|
615
788
|
agent_id: uuidSchema,
|