@ema.co/mcp-toolkit 2026.2.19 → 2026.2.23
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.
Potentially problematic release.
This version of @ema.co/mcp-toolkit might be problematic. Click here for more details.
- package/dist/cli/index.js +2 -2
- package/dist/mcp/domain/loop-detection.js +46 -54
- package/dist/mcp/domain/sanitizer.js +1 -1
- package/dist/mcp/domain/workflow-graph.js +2 -2
- package/dist/mcp/domain/workflow-path-enumerator.js +7 -4
- package/dist/mcp/guidance.js +53 -0
- package/dist/mcp/handlers/debug/adapter.js +15 -0
- package/dist/mcp/handlers/debug/formatters.js +282 -0
- package/dist/mcp/handlers/debug/index.js +133 -0
- package/dist/mcp/handlers/demo/adapter.js +180 -0
- package/dist/mcp/handlers/env/config.js +2 -2
- package/dist/mcp/handlers/index.js +0 -1
- package/dist/mcp/handlers/persona/adapter.js +135 -0
- package/dist/mcp/handlers/sync/adapter.js +200 -0
- package/dist/mcp/handlers/workflow/adapter.js +174 -0
- package/dist/mcp/handlers/workflow/fix.js +11 -12
- package/dist/mcp/handlers/workflow/index.js +0 -24
- package/dist/mcp/knowledge-guidance-topics.js +615 -0
- package/dist/mcp/knowledge.js +23 -612
- package/dist/mcp/resources-dynamic.js +2395 -0
- package/dist/mcp/resources-validation.js +408 -0
- package/dist/mcp/resources.js +72 -2724
- package/dist/mcp/server.js +33 -832
- package/dist/mcp/tools.js +104 -2
- package/dist/sdk/client-adapter.js +265 -24
- package/dist/sdk/ema-client.js +100 -9
- package/dist/sdk/generated/well-known-types.js +99 -0
- package/dist/sdk/grpc-client.js +115 -1
- package/dist/sync/sdk.js +2 -2
- package/dist/sync.js +4 -3
- package/package.json +3 -2
- package/dist/mcp/handlers/knowledge/index.js +0 -54
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated well-known type constants from Ema Platform proto definitions.
|
|
3
|
+
* Generated at: 2026-02-20T06:49:59.625Z
|
|
4
|
+
*
|
|
5
|
+
* DO NOT EDIT MANUALLY — regenerate with: npm run generate:type-compatibility
|
|
6
|
+
*
|
|
7
|
+
* Source: values_pb.ts (synced weekly from protos/service/workflows/v1/values.proto)
|
|
8
|
+
*/
|
|
9
|
+
/** All active well-known types with metadata. */
|
|
10
|
+
export const WELL_KNOWN_TYPES = [
|
|
11
|
+
{ name: "WELL_KNOWN_TYPE_STRING", shortName: "STRING", value: 1, description: "Primitives" },
|
|
12
|
+
{ name: "WELL_KNOWN_TYPE_INT", shortName: "INT", value: 2, description: "" },
|
|
13
|
+
{ name: "WELL_KNOWN_TYPE_FLOAT", shortName: "FLOAT", value: 3, description: "" },
|
|
14
|
+
{ name: "WELL_KNOWN_TYPE_BOOL", shortName: "BOOL", value: 4, description: "" },
|
|
15
|
+
{ name: "WELL_KNOWN_TYPE_STRUCT", shortName: "STRUCT", value: 14, description: "Untyped key-value dictionary" },
|
|
16
|
+
{ name: "WELL_KNOWN_TYPE_DOCUMENT", shortName: "DOCUMENT", value: 5, description: "Complex types that are built-in to the system" },
|
|
17
|
+
{ name: "WELL_KNOWN_TYPE_DATASTORE_CONNECTION", shortName: "DATASTORE_CONNECTION", value: 7, description: "Complex types that are generally used as config values" },
|
|
18
|
+
{ name: "WELL_KNOWN_TYPE_FUSION_LLM_CONFIG", shortName: "FUSION_LLM_CONFIG", value: 8, description: "" },
|
|
19
|
+
{ name: "WELL_KNOWN_TYPE_SEARCH_RESULT", shortName: "SEARCH_RESULT", value: 9, description: "" },
|
|
20
|
+
{ name: "WELL_KNOWN_TYPE_EMAIL_ACCOUNT_CONFIG", shortName: "EMAIL_ACCOUNT_CONFIG", value: 28, description: "" },
|
|
21
|
+
{ name: "WELL_KNOWN_TYPE_BOOST_TERM", shortName: "BOOST_TERM", value: 10, description: "Boost term and associated boost factor for reranking search results, specifically for extractive segments." },
|
|
22
|
+
{ name: "WELL_KNOWN_TYPE_TEXT_WITH_SOURCES", shortName: "TEXT_WITH_SOURCES", value: 11, description: "Text with sources, used to represent a text with associated sources." },
|
|
23
|
+
{ name: "WELL_KNOWN_TYPE_CHAT_CONVERSATION", shortName: "CHAT_CONVERSATION", value: 13, description: "Chat conversation or conversational context." },
|
|
24
|
+
{ name: "WELL_KNOWN_TYPE_GLOSSARY_ITEM", shortName: "GLOSSARY_ITEM", value: 15, description: "A glossary item (term (string) and definition (string)). Glossary would be a list of these items." },
|
|
25
|
+
{ name: "WELL_KNOWN_TYPE_EXTRACTION_COLUMN", shortName: "EXTRACTION_COLUMN", value: 16, description: "Extraction column, used to represent an extraction column in a table." },
|
|
26
|
+
{ name: "WELL_KNOWN_TYPE_RULESET", shortName: "RULESET", value: 17, description: "RuleSet" },
|
|
27
|
+
{ name: "WELL_KNOWN_TYPE_TAG_EXTRACTION_CONFIG", shortName: "TAG_EXTRACTION_CONFIG", value: 18, description: "Tag extraction config used to extract tag values given keys to a context dictionary for a tag dimension. These tag values are passed to Search action to filter/boost search results." },
|
|
28
|
+
{ name: "WELL_KNOWN_TYPE_DATA_PROTECTION_CONFIG", shortName: "DATA_PROTECTION_CONFIG", value: 19, description: "Uses the DataProtectionConfig proto to store data protection configuration." },
|
|
29
|
+
{ name: "WELL_KNOWN_TYPE_CHART", shortName: "CHART", value: 20, description: "A chart, which contains a family (value-based, frequency-based, xy-based), a type (bar, line, pie, etc.), a title and the data that is required to render the chart." },
|
|
30
|
+
{ name: "WELL_KNOWN_TYPE_DATE", shortName: "DATE", value: 21, description: "Date type" },
|
|
31
|
+
{ name: "WELL_KNOWN_TYPE_DATETIME", shortName: "DATETIME", value: 22, description: "DateTime type" },
|
|
32
|
+
{ name: "WELL_KNOWN_TYPE_DOCUMENT_TEMPLATE", shortName: "DOCUMENT_TEMPLATE", value: 23, description: "Document template type" },
|
|
33
|
+
{ name: "WELL_KNOWN_TYPE_ANY", shortName: "ANY", value: 24, description: "Any type" },
|
|
34
|
+
{ name: "WELL_KNOWN_TYPE_THREAD", shortName: "THREAD", value: 25, description: "Ticketing Thread type" },
|
|
35
|
+
{ name: "WELL_KNOWN_TYPE_JSON_MAPPER_CONFIG", shortName: "JSON_MAPPER_CONFIG", value: 26, description: "JSON Mapper Config type" },
|
|
36
|
+
{ name: "WELL_KNOWN_TYPE_DOCUMENT_VERSION_ID", shortName: "DOCUMENT_VERSION_ID", value: 27, description: "Document version id well known type" },
|
|
37
|
+
{ name: "WELL_KNOWN_TYPE_HUMAN_COLLABORATION_CONFIG", shortName: "HUMAN_COLLABORATION_CONFIG", value: 29, description: "Human Collaboration Config type for HITL agent" },
|
|
38
|
+
];
|
|
39
|
+
/** Deprecated well-known types (kept for backwards compatibility). */
|
|
40
|
+
export const DEPRECATED_WELL_KNOWN_TYPES = [
|
|
41
|
+
{ name: "WELL_KNOWN_TYPE_CHAT_MESSAGE", shortName: "CHAT_MESSAGE", value: 12, replacement: "WELL_KNOWN_TYPE_CHAT_CONVERSATION" },
|
|
42
|
+
];
|
|
43
|
+
export const BASE_TYPE_COMPATIBILITY = [
|
|
44
|
+
{ sourceType: "WELL_KNOWN_TYPE_STRING", targetType: "WELL_KNOWN_TYPE_STRING", compatible: true },
|
|
45
|
+
{ sourceType: "WELL_KNOWN_TYPE_INT", targetType: "WELL_KNOWN_TYPE_INT", compatible: true },
|
|
46
|
+
{ sourceType: "WELL_KNOWN_TYPE_FLOAT", targetType: "WELL_KNOWN_TYPE_FLOAT", compatible: true },
|
|
47
|
+
{ sourceType: "WELL_KNOWN_TYPE_BOOL", targetType: "WELL_KNOWN_TYPE_BOOL", compatible: true },
|
|
48
|
+
{ sourceType: "WELL_KNOWN_TYPE_STRUCT", targetType: "WELL_KNOWN_TYPE_STRUCT", compatible: true },
|
|
49
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT", targetType: "WELL_KNOWN_TYPE_DOCUMENT", compatible: true },
|
|
50
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATASTORE_CONNECTION", targetType: "WELL_KNOWN_TYPE_DATASTORE_CONNECTION", compatible: true },
|
|
51
|
+
{ sourceType: "WELL_KNOWN_TYPE_FUSION_LLM_CONFIG", targetType: "WELL_KNOWN_TYPE_FUSION_LLM_CONFIG", compatible: true },
|
|
52
|
+
{ sourceType: "WELL_KNOWN_TYPE_SEARCH_RESULT", targetType: "WELL_KNOWN_TYPE_SEARCH_RESULT", compatible: true },
|
|
53
|
+
{ sourceType: "WELL_KNOWN_TYPE_EMAIL_ACCOUNT_CONFIG", targetType: "WELL_KNOWN_TYPE_EMAIL_ACCOUNT_CONFIG", compatible: true },
|
|
54
|
+
{ sourceType: "WELL_KNOWN_TYPE_BOOST_TERM", targetType: "WELL_KNOWN_TYPE_BOOST_TERM", compatible: true },
|
|
55
|
+
{ sourceType: "WELL_KNOWN_TYPE_TEXT_WITH_SOURCES", targetType: "WELL_KNOWN_TYPE_TEXT_WITH_SOURCES", compatible: true },
|
|
56
|
+
{ sourceType: "WELL_KNOWN_TYPE_CHAT_CONVERSATION", targetType: "WELL_KNOWN_TYPE_CHAT_CONVERSATION", compatible: true },
|
|
57
|
+
{ sourceType: "WELL_KNOWN_TYPE_GLOSSARY_ITEM", targetType: "WELL_KNOWN_TYPE_GLOSSARY_ITEM", compatible: true },
|
|
58
|
+
{ sourceType: "WELL_KNOWN_TYPE_EXTRACTION_COLUMN", targetType: "WELL_KNOWN_TYPE_EXTRACTION_COLUMN", compatible: true },
|
|
59
|
+
{ sourceType: "WELL_KNOWN_TYPE_RULESET", targetType: "WELL_KNOWN_TYPE_RULESET", compatible: true },
|
|
60
|
+
{ sourceType: "WELL_KNOWN_TYPE_TAG_EXTRACTION_CONFIG", targetType: "WELL_KNOWN_TYPE_TAG_EXTRACTION_CONFIG", compatible: true },
|
|
61
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATA_PROTECTION_CONFIG", targetType: "WELL_KNOWN_TYPE_DATA_PROTECTION_CONFIG", compatible: true },
|
|
62
|
+
{ sourceType: "WELL_KNOWN_TYPE_CHART", targetType: "WELL_KNOWN_TYPE_CHART", compatible: true },
|
|
63
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATE", targetType: "WELL_KNOWN_TYPE_DATE", compatible: true },
|
|
64
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATETIME", targetType: "WELL_KNOWN_TYPE_DATETIME", compatible: true },
|
|
65
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT_TEMPLATE", targetType: "WELL_KNOWN_TYPE_DOCUMENT_TEMPLATE", compatible: true },
|
|
66
|
+
{ sourceType: "WELL_KNOWN_TYPE_ANY", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
67
|
+
{ sourceType: "WELL_KNOWN_TYPE_THREAD", targetType: "WELL_KNOWN_TYPE_THREAD", compatible: true },
|
|
68
|
+
{ sourceType: "WELL_KNOWN_TYPE_JSON_MAPPER_CONFIG", targetType: "WELL_KNOWN_TYPE_JSON_MAPPER_CONFIG", compatible: true },
|
|
69
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT_VERSION_ID", targetType: "WELL_KNOWN_TYPE_DOCUMENT_VERSION_ID", compatible: true },
|
|
70
|
+
{ sourceType: "WELL_KNOWN_TYPE_HUMAN_COLLABORATION_CONFIG", targetType: "WELL_KNOWN_TYPE_HUMAN_COLLABORATION_CONFIG", compatible: true },
|
|
71
|
+
{ sourceType: "WELL_KNOWN_TYPE_STRING", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
72
|
+
{ sourceType: "WELL_KNOWN_TYPE_INT", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
73
|
+
{ sourceType: "WELL_KNOWN_TYPE_FLOAT", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
74
|
+
{ sourceType: "WELL_KNOWN_TYPE_BOOL", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
75
|
+
{ sourceType: "WELL_KNOWN_TYPE_STRUCT", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
76
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
77
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATASTORE_CONNECTION", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
78
|
+
{ sourceType: "WELL_KNOWN_TYPE_FUSION_LLM_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
79
|
+
{ sourceType: "WELL_KNOWN_TYPE_SEARCH_RESULT", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
80
|
+
{ sourceType: "WELL_KNOWN_TYPE_EMAIL_ACCOUNT_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
81
|
+
{ sourceType: "WELL_KNOWN_TYPE_BOOST_TERM", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
82
|
+
{ sourceType: "WELL_KNOWN_TYPE_TEXT_WITH_SOURCES", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
83
|
+
{ sourceType: "WELL_KNOWN_TYPE_CHAT_CONVERSATION", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
84
|
+
{ sourceType: "WELL_KNOWN_TYPE_GLOSSARY_ITEM", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
85
|
+
{ sourceType: "WELL_KNOWN_TYPE_EXTRACTION_COLUMN", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
86
|
+
{ sourceType: "WELL_KNOWN_TYPE_RULESET", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
87
|
+
{ sourceType: "WELL_KNOWN_TYPE_TAG_EXTRACTION_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
88
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATA_PROTECTION_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
89
|
+
{ sourceType: "WELL_KNOWN_TYPE_CHART", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
90
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATE", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
91
|
+
{ sourceType: "WELL_KNOWN_TYPE_DATETIME", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
92
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT_TEMPLATE", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
93
|
+
{ sourceType: "WELL_KNOWN_TYPE_THREAD", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
94
|
+
{ sourceType: "WELL_KNOWN_TYPE_JSON_MAPPER_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
95
|
+
{ sourceType: "WELL_KNOWN_TYPE_DOCUMENT_VERSION_ID", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
96
|
+
{ sourceType: "WELL_KNOWN_TYPE_HUMAN_COLLABORATION_CONFIG", targetType: "WELL_KNOWN_TYPE_ANY", compatible: true },
|
|
97
|
+
];
|
|
98
|
+
/** Set of all active well-known type names for O(1) lookup. */
|
|
99
|
+
export const WELL_KNOWN_TYPE_NAMES = new Set(WELL_KNOWN_TYPES.map(t => t.name));
|
package/dist/sdk/grpc-client.js
CHANGED
|
@@ -17,6 +17,10 @@ import { ActionManager, ListActionsRequestSchema, ListActionsFromWorkflowRequest
|
|
|
17
17
|
import { DashboardsService, GetDashboardRowsRequestSchema, GetDashboardSchemaRequestSchema, } from './generated/protos/service/workflows/v1/dashboards_pb.js';
|
|
18
18
|
import { WorkflowManager, CheckWorkflowRequestSchema, GetWorkflowRequestSchema, } from './generated/protos/service/workflows/v1/rpc/workflow_rpc_pb.js';
|
|
19
19
|
import { DataIngestService, GetRootContentNodesRequestSchema, GetContentNodeAggregatesRequestSchema, ReplicateDataRequestSchema, GetReplicationStatusRequestSchema, FilePickerGroupType, WidgetReplicationMappingSchema, } from './generated/protos/service/dataingest/v1/dataingest_pb.js';
|
|
20
|
+
import { ConversationReviewService, GetConversationReviewsRequestSchema, GetConversationReviewDetailRequestSchema, ConversationReviewFiltersSchema, } from './generated/protos/service/conversation_review/v1/conversation_review_pb.js';
|
|
21
|
+
import { DebugLogService, WorkflowLevelDebugLogRequestSchema, ActionLevelShowWorkLogRequestSchema, } from './generated/protos/service/persona/v1/debug_logs_pb.js';
|
|
22
|
+
import { DebuggerService, SearchMessagesRequestSchema as DebuggerSearchMessagesRequestSchema, } from './generated/protos/service/debugger/service_pb.js';
|
|
23
|
+
import { timestampFromDate } from '@bufbuild/protobuf/wkt';
|
|
20
24
|
import { RegisteredWorkflowNameSchema } from './generated/protos/service/workflows/v1/names_pb.js';
|
|
21
25
|
import { WorkflowDefSchema } from './generated/protos/service/workflows/v1/workflow_pb.js';
|
|
22
26
|
/**
|
|
@@ -40,6 +44,9 @@ export class GrpcClient {
|
|
|
40
44
|
dashboardsService;
|
|
41
45
|
workflowManager;
|
|
42
46
|
dataIngestService;
|
|
47
|
+
conversationReviewService;
|
|
48
|
+
debugLogService;
|
|
49
|
+
debuggerService;
|
|
43
50
|
constructor(env) {
|
|
44
51
|
this.env = env;
|
|
45
52
|
// Create gRPC-Web transport
|
|
@@ -55,6 +62,9 @@ export class GrpcClient {
|
|
|
55
62
|
this.dashboardsService = createClient(DashboardsService, transport);
|
|
56
63
|
this.workflowManager = createClient(WorkflowManager, transport);
|
|
57
64
|
this.dataIngestService = createClient(DataIngestService, transport);
|
|
65
|
+
this.conversationReviewService = createClient(ConversationReviewService, transport);
|
|
66
|
+
this.debugLogService = createClient(DebugLogService, transport);
|
|
67
|
+
this.debuggerService = createClient(DebuggerService, transport);
|
|
58
68
|
}
|
|
59
69
|
/**
|
|
60
70
|
* Update the bearer token (e.g., after refresh)
|
|
@@ -263,6 +273,110 @@ export class GrpcClient {
|
|
|
263
273
|
});
|
|
264
274
|
return this.dataIngestService.getReplicationStatus(request);
|
|
265
275
|
}
|
|
276
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
277
|
+
// ConversationReviewService RPCs (Audit)
|
|
278
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
279
|
+
/**
|
|
280
|
+
* List conversation reviews for a persona (audit tab).
|
|
281
|
+
*
|
|
282
|
+
* @param personaId - The persona ID
|
|
283
|
+
* @param opts - Filters and pagination
|
|
284
|
+
* @returns Paginated conversation review summaries
|
|
285
|
+
*/
|
|
286
|
+
async getConversationReviews(personaId, opts) {
|
|
287
|
+
const DEFAULT_CONVERSATION_LIMIT = 20;
|
|
288
|
+
const request = create(GetConversationReviewsRequestSchema, {
|
|
289
|
+
personaId,
|
|
290
|
+
limit: opts?.limit ?? DEFAULT_CONVERSATION_LIMIT,
|
|
291
|
+
paginationToken: opts?.paginationToken ?? '',
|
|
292
|
+
...(opts?.filters ? {
|
|
293
|
+
filters: create(ConversationReviewFiltersSchema, {
|
|
294
|
+
workflowFailure: opts.filters.workflowFailure ?? false,
|
|
295
|
+
hasUserFrustration: opts.filters.hasUserFrustration ?? false,
|
|
296
|
+
noResultsFound: opts.filters.noResultsFound ?? false,
|
|
297
|
+
searchQuery: opts.filters.searchQuery ?? '',
|
|
298
|
+
status: opts.filters.status ?? 0,
|
|
299
|
+
channel: opts.filters.channel ?? 0,
|
|
300
|
+
...(opts.filters.createdFrom ? { createdFrom: timestampFromDate(opts.filters.createdFrom) } : {}),
|
|
301
|
+
...(opts.filters.createdTo ? { createdTo: timestampFromDate(opts.filters.createdTo) } : {}),
|
|
302
|
+
}),
|
|
303
|
+
} : {}),
|
|
304
|
+
});
|
|
305
|
+
return this.conversationReviewService.getConversationReviews(request);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Get detailed conversation review with messages and workflow run IDs.
|
|
309
|
+
*
|
|
310
|
+
* @param conversationId - The conversation ID
|
|
311
|
+
* @returns Full message history with workflow_run_ids and work log summaries
|
|
312
|
+
*/
|
|
313
|
+
async getConversationReviewDetail(conversationId) {
|
|
314
|
+
const request = create(GetConversationReviewDetailRequestSchema, {
|
|
315
|
+
conversationId,
|
|
316
|
+
});
|
|
317
|
+
return this.conversationReviewService.getConversationReviewDetail(request);
|
|
318
|
+
}
|
|
319
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
320
|
+
// DebugLogService RPCs (Show Work)
|
|
321
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
322
|
+
/**
|
|
323
|
+
* Get workflow-level debug log with show work for all actions.
|
|
324
|
+
*
|
|
325
|
+
* DebugLogService has PERSONA_REQUIRED auth annotation — persona is passed
|
|
326
|
+
* via X-Persona-Id gRPC header, not in the request body.
|
|
327
|
+
*
|
|
328
|
+
* @param workflowRunId - The workflow run ID (from MessageDetail.workflow_run_id)
|
|
329
|
+
* @param personaId - The persona ID (required for auth context)
|
|
330
|
+
* @returns Full execution trace including persona config, workflow def snapshot, and per-action show work logs
|
|
331
|
+
*/
|
|
332
|
+
async getWorkflowLevelDebugLog(workflowRunId, personaId) {
|
|
333
|
+
const request = create(WorkflowLevelDebugLogRequestSchema, {
|
|
334
|
+
workflowRunId,
|
|
335
|
+
});
|
|
336
|
+
return this.debugLogService.getWorkflowLevelDebugLog(request, {
|
|
337
|
+
headers: new Headers({ 'x-persona-id': personaId }),
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get action-level show work log for a specific action in a workflow run.
|
|
342
|
+
*
|
|
343
|
+
* DebugLogService has PERSONA_REQUIRED auth annotation — persona is passed
|
|
344
|
+
* via X-Persona-Id gRPC header, not in the request body.
|
|
345
|
+
*
|
|
346
|
+
* @param actionName - The action instance name
|
|
347
|
+
* @param workflowRunId - The workflow run ID
|
|
348
|
+
* @param personaId - The persona ID (required for auth context)
|
|
349
|
+
* @returns Detailed show work log with inputs, outputs, LLM calls, steps, HITL rounds
|
|
350
|
+
*/
|
|
351
|
+
async getActionLevelShowWorkLog(actionName, workflowRunId, personaId) {
|
|
352
|
+
const request = create(ActionLevelShowWorkLogRequestSchema, {
|
|
353
|
+
actionName,
|
|
354
|
+
workflowRunId,
|
|
355
|
+
});
|
|
356
|
+
return this.debugLogService.getActionLevelShowWorkLog(request, {
|
|
357
|
+
headers: new Headers({ 'x-persona-id': personaId }),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
361
|
+
// DebuggerService RPCs (Search)
|
|
362
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
363
|
+
/**
|
|
364
|
+
* Search messages across conversations.
|
|
365
|
+
* Maps `query` → proto field `queryStr`.
|
|
366
|
+
*
|
|
367
|
+
* @param opts - Search parameters
|
|
368
|
+
* @returns Matching message pairs (user + bot) with run IDs
|
|
369
|
+
*/
|
|
370
|
+
async searchMessages(opts) {
|
|
371
|
+
const request = create(DebuggerSearchMessagesRequestSchema, {
|
|
372
|
+
queryStr: opts.query,
|
|
373
|
+
personaId: opts.personaId ?? '',
|
|
374
|
+
conversationId: opts.conversationId ?? '',
|
|
375
|
+
...(opts.startTime ? { startTime: timestampFromDate(opts.startTime) } : {}),
|
|
376
|
+
...(opts.endTime ? { endTime: timestampFromDate(opts.endTime) } : {}),
|
|
377
|
+
});
|
|
378
|
+
return this.debuggerService.searchMessages(request);
|
|
379
|
+
}
|
|
266
380
|
}
|
|
267
381
|
// Re-export the service definitions for advanced use cases
|
|
268
|
-
export { ActionManager, DashboardsService, WorkflowManager, DataIngestService };
|
|
382
|
+
export { ActionManager, DashboardsService, WorkflowManager, DataIngestService, ConversationReviewService, DebugLogService, DebuggerService };
|
package/dist/sync/sdk.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* not an API client concern.
|
|
7
7
|
*/
|
|
8
8
|
import { getMasterEnv, resolveBearerToken } from "../sdk/config.js";
|
|
9
|
-
import {
|
|
9
|
+
import { EmaClientAdapter } from "../sdk/client-adapter.js";
|
|
10
10
|
import { StateStore } from "../sdk/state.js";
|
|
11
11
|
import { fingerprintPersona, syncOnce } from "../sync.js";
|
|
12
12
|
/**
|
|
@@ -34,7 +34,7 @@ export class SyncSDK {
|
|
|
34
34
|
baseUrl: envCfg.baseUrl,
|
|
35
35
|
bearerToken: resolveBearerToken(envCfg.bearerTokenEnv),
|
|
36
36
|
};
|
|
37
|
-
this.clients.set(envName, new
|
|
37
|
+
this.clients.set(envName, new EmaClientAdapter(env));
|
|
38
38
|
}
|
|
39
39
|
return this.clients.get(envName);
|
|
40
40
|
}
|
package/dist/sync.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import { getMasterEnv, resolveBearerToken } from "./sdk/config.js";
|
|
9
|
-
import {
|
|
9
|
+
import { EmaClientAdapter } from "./sdk/client-adapter.js";
|
|
10
|
+
import { EmaApiError } from "./sdk/client.js";
|
|
10
11
|
import { SYNC_METADATA_KEY } from "./sdk/models.js";
|
|
11
12
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
13
|
// Constants
|
|
@@ -201,7 +202,7 @@ export async function syncOnce(cfg, state) {
|
|
|
201
202
|
started_at: nowIso(),
|
|
202
203
|
status: "running",
|
|
203
204
|
});
|
|
204
|
-
const masterClient = new
|
|
205
|
+
const masterClient = new EmaClientAdapter(buildEnv(masterEnvCfg));
|
|
205
206
|
try {
|
|
206
207
|
const personas = await masterClient.getPersonasForTenant();
|
|
207
208
|
let scanned = 0;
|
|
@@ -265,7 +266,7 @@ export async function syncOnce(cfg, state) {
|
|
|
265
266
|
// Sync to each target
|
|
266
267
|
for (const targetEnvName of targetsNeedingSync) {
|
|
267
268
|
const targetCfg = envByName(cfg, targetEnvName);
|
|
268
|
-
const targetClient = new
|
|
269
|
+
const targetClient = new EmaClientAdapter(buildEnv(targetCfg));
|
|
269
270
|
try {
|
|
270
271
|
await upsertReplicaPersona({
|
|
271
272
|
cfg,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ema.co/mcp-toolkit",
|
|
3
|
-
"version": "2026.2.
|
|
3
|
+
"version": "2026.2.23",
|
|
4
4
|
"description": "Ema AI Employee toolkit - MCP server, CLI, and SDK for managing AI Employees across environments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"generate:skill:check": "tsx scripts/generate-skill.ts --check",
|
|
65
65
|
"generate:templates": "tsx scripts/generate-templates.ts",
|
|
66
66
|
"generate:templates:check": "tsx scripts/generate-templates.ts --check",
|
|
67
|
-
"generate:
|
|
67
|
+
"generate:type-compatibility": "tsx scripts/generate-type-compatibility.ts",
|
|
68
|
+
"generate:all": "npm run generate:protos && npm run generate:api-client && npm run generate:templates && npm run generate:skill && npm run generate:type-compatibility",
|
|
68
69
|
"check:contracts": "tsx scripts/check-api-contracts.ts",
|
|
69
70
|
"check:schema-sync": "tsx scripts/check-schema-handler-sync.ts",
|
|
70
71
|
"check:prompt-refs": "tsx scripts/check-prompt-refs.ts",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Knowledge Handler - DEPRECATED
|
|
3
|
-
*
|
|
4
|
-
* This handler is deprecated. Use the 'data' tool instead.
|
|
5
|
-
* All calls are routed to handleData with a deprecation warning.
|
|
6
|
-
*/
|
|
7
|
-
import { handleData } from "../data/index.js";
|
|
8
|
-
/**
|
|
9
|
-
* Mode mapping from knowledge tool to data tool
|
|
10
|
-
*/
|
|
11
|
-
const MODE_MAPPING = {
|
|
12
|
-
list: "list",
|
|
13
|
-
aggregates: "stats",
|
|
14
|
-
upload: "upload",
|
|
15
|
-
delete: "delete",
|
|
16
|
-
status: "embedding",
|
|
17
|
-
toggle: "embedding",
|
|
18
|
-
attach: "attach",
|
|
19
|
-
dashboard_rows: "dashboard_rows",
|
|
20
|
-
dashboard_clone: "copy",
|
|
21
|
-
dashboard_generate: "generate",
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Handle knowledge tool requests
|
|
25
|
-
*
|
|
26
|
-
* @deprecated Use data() tool instead. This handler routes to handleData.
|
|
27
|
-
*/
|
|
28
|
-
export async function handleKnowledge(args, client, readFile) {
|
|
29
|
-
console.warn("[knowledge] DEPRECATED: Use data() tool instead");
|
|
30
|
-
const mode = args.mode || "list";
|
|
31
|
-
const mappedMode = MODE_MAPPING[mode] || mode;
|
|
32
|
-
// Route to data handler
|
|
33
|
-
const dataArgs = {
|
|
34
|
-
...args,
|
|
35
|
-
mode: mappedMode,
|
|
36
|
-
};
|
|
37
|
-
// Map old param names to new
|
|
38
|
-
if (args.file)
|
|
39
|
-
dataArgs.file_path = args.file;
|
|
40
|
-
if (args.source_persona_id)
|
|
41
|
-
dataArgs.from = args.source_persona_id;
|
|
42
|
-
const result = await handleData(dataArgs, client, readFile);
|
|
43
|
-
// Add deprecation warning to result
|
|
44
|
-
if (typeof result === "object" && result !== null) {
|
|
45
|
-
return {
|
|
46
|
-
_deprecation: {
|
|
47
|
-
message: "The 'knowledge' tool is deprecated. Use 'data' tool instead.",
|
|
48
|
-
migration: `data(method="${mappedMode}", ...)`,
|
|
49
|
-
},
|
|
50
|
-
...result,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
}
|