@ema.co/mcp-toolkit 2026.2.13 → 2026.2.23-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.

Potentially problematic release.


This version of @ema.co/mcp-toolkit might be problematic. Click here for more details.

Files changed (67) hide show
  1. package/.context/public/guides/ema-user-guide.md +12 -16
  2. package/.context/public/guides/mcp-tools-guide.md +203 -334
  3. package/dist/cli/index.js +2 -2
  4. package/dist/mcp/domain/loop-detection.js +89 -0
  5. package/dist/mcp/domain/sanitizer.js +1 -1
  6. package/dist/mcp/domain/structural-rules.js +4 -5
  7. package/dist/mcp/domain/validation-rules.js +5 -5
  8. package/dist/mcp/domain/workflow-graph.js +3 -5
  9. package/dist/mcp/domain/workflow-path-enumerator.js +7 -4
  10. package/dist/mcp/guidance.js +62 -29
  11. package/dist/mcp/handlers/debug/adapter.js +15 -0
  12. package/dist/mcp/handlers/debug/formatters.js +282 -0
  13. package/dist/mcp/handlers/debug/index.js +133 -0
  14. package/dist/mcp/handlers/demo/adapter.js +180 -0
  15. package/dist/mcp/handlers/env/config.js +2 -2
  16. package/dist/mcp/handlers/feedback/index.js +1 -1
  17. package/dist/mcp/handlers/index.js +0 -1
  18. package/dist/mcp/handlers/persona/adapter.js +135 -0
  19. package/dist/mcp/handlers/persona/index.js +237 -8
  20. package/dist/mcp/handlers/persona/schema.js +27 -0
  21. package/dist/mcp/handlers/reference/index.js +6 -4
  22. package/dist/mcp/handlers/sync/adapter.js +200 -0
  23. package/dist/mcp/handlers/workflow/adapter.js +174 -0
  24. package/dist/mcp/handlers/workflow/fix.js +11 -12
  25. package/dist/mcp/handlers/workflow/index.js +12 -40
  26. package/dist/mcp/handlers/workflow/validation.js +1 -1
  27. package/dist/mcp/knowledge-guidance-topics.js +615 -0
  28. package/dist/mcp/knowledge-types.js +7 -0
  29. package/dist/mcp/knowledge.js +75 -1403
  30. package/dist/mcp/resources-dynamic.js +2395 -0
  31. package/dist/mcp/resources-validation.js +408 -0
  32. package/dist/mcp/resources.js +72 -2508
  33. package/dist/mcp/server.js +69 -2825
  34. package/dist/mcp/tools.js +106 -5
  35. package/dist/sdk/client-adapter.js +265 -24
  36. package/dist/sdk/ema-client.js +100 -9
  37. package/dist/sdk/generated/agent-catalog.js +615 -0
  38. package/dist/sdk/generated/api-client/client/client.gen.js +3 -3
  39. package/dist/sdk/generated/api-client/client/index.js +5 -5
  40. package/dist/sdk/generated/api-client/client/utils.gen.js +4 -4
  41. package/dist/sdk/generated/api-client/client.gen.js +1 -1
  42. package/dist/sdk/generated/api-client/core/utils.gen.js +1 -1
  43. package/dist/sdk/generated/api-client/index.js +1 -1
  44. package/dist/sdk/generated/api-client/sdk.gen.js +2 -2
  45. package/dist/sdk/generated/well-known-types.js +99 -0
  46. package/dist/sdk/generated/widget-catalog.js +60 -0
  47. package/dist/sdk/grpc-client.js +115 -1
  48. package/dist/sync/sdk.js +2 -2
  49. package/dist/sync.js +4 -3
  50. package/docs/README.md +17 -9
  51. package/package.json +4 -3
  52. package/.context/public/guides/dashboard-operations.md +0 -349
  53. package/.context/public/guides/email-patterns.md +0 -125
  54. package/.context/public/guides/workflow-builder-patterns.md +0 -708
  55. package/dist/mcp/domain/intent-architect.js +0 -914
  56. package/dist/mcp/domain/quality-gates.js +0 -110
  57. package/dist/mcp/domain/workflow-execution-analyzer.js +0 -412
  58. package/dist/mcp/domain/workflow-intent.js +0 -1806
  59. package/dist/mcp/domain/workflow-merge.js +0 -449
  60. package/dist/mcp/domain/workflow-tracer.js +0 -648
  61. package/dist/mcp/domain/workflow-transformer.js +0 -742
  62. package/dist/mcp/handlers/knowledge/index.js +0 -54
  63. package/dist/mcp/handlers/persona/intent.js +0 -141
  64. package/dist/mcp/handlers/workflow/analyze.js +0 -119
  65. package/dist/mcp/handlers/workflow/compare.js +0 -70
  66. package/dist/mcp/handlers/workflow/generate.js +0 -384
  67. package/dist/mcp/handlers-consolidated.js +0 -333
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- import { createClient, createConfig } from './client';
2
+ import { createClient, createConfig } from './client/index.js';
3
3
  export const client = createClient(createConfig({ baseUrl: 'https://api.ema.co' }));
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen';
2
+ import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen.js';
3
3
  export const PATH_PARAM_RE = /\{[^{}]+\}/g;
4
4
  export const defaultPathSerializer = ({ path, url: _url }) => {
5
5
  let url = _url;
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- export { archiveProjectById, createChatbotConversation, createConversation, createDocument, createPersona, createPersonaTemplate, createProject, createProjectTemplate, deleteConversation, deletePersona, deletePersonaTemplate, deleteProjectTemplate, editChartSnippet, emailActionImage, emailActionLink, emailActionUnsubscribe, fetchTicketUpdates, getChatbotConfig, getChatHistory, getConversationMessages, getConversationMessagesPaginated, getDefaultPersonaTemplateAccessSettingsForTenant, getLinkedInAuthUrl, getLogoUploadUrl, getMailLoginUrlForPersona, getPersonaAccessLevelById, getPersonaById, getPersonaTemplateById, getProjectById, getProjectsForPersona, getProjectTemplateByPersonaId, getWelcomeMessage, grantPersonaTemplateAccess, healthBasicCheck, healthCheck, importPersona, linkedinAccountNotification, linkedinActionLink, listAllPersonaTemplates, listAvailablePhoneNumbers, listConversations, listConversationsForPersona, listConversationsPaginated, listPersonas, listPersonaTemplates, listPersonaTemplatesPost, listSavedSnippets, metrics, processWebPrompt, provisionPhoneNumber, regenerateDocument, retrieveDocument, revokePersonaTemplateAccess, saveSnippet, sendChatMessage, sendChatMessageAsync, setDefaultPersonaTemplateAccessSetting, setPersonaTemplateAccessSettingsForNewSubTenant, streamChatbotConversationsCsv, triggerProjectWorkflow, unsaveSnippet, updateConversationDisplayName, updateDataUploadStatus, updateDocument, updateMessageFeedback, updatePersona, updatePersonaTemplate, updateProject, updateProjectTemplate, uploadLogo, verifyLogoUpload } from './sdk.gen';
2
+ export { archiveProjectById, createChatbotConversation, createConversation, createDocument, createPersona, createPersonaTemplate, createProject, createProjectTemplate, deleteConversation, deletePersona, deletePersonaTemplate, deleteProjectTemplate, editChartSnippet, emailActionImage, emailActionLink, emailActionUnsubscribe, fetchTicketUpdates, getChatbotConfig, getChatHistory, getConversationMessages, getConversationMessagesPaginated, getDefaultPersonaTemplateAccessSettingsForTenant, getLinkedInAuthUrl, getLogoUploadUrl, getMailLoginUrlForPersona, getPersonaAccessLevelById, getPersonaById, getPersonaTemplateById, getProjectById, getProjectsForPersona, getProjectTemplateByPersonaId, getWelcomeMessage, grantPersonaTemplateAccess, healthBasicCheck, healthCheck, importPersona, linkedinAccountNotification, linkedinActionLink, listAllPersonaTemplates, listAvailablePhoneNumbers, listConversations, listConversationsForPersona, listConversationsPaginated, listPersonas, listPersonaTemplates, listPersonaTemplatesPost, listSavedSnippets, metrics, processWebPrompt, provisionPhoneNumber, regenerateDocument, retrieveDocument, revokePersonaTemplateAccess, saveSnippet, sendChatMessage, sendChatMessageAsync, setDefaultPersonaTemplateAccessSetting, setPersonaTemplateAccessSettingsForNewSubTenant, streamChatbotConversationsCsv, triggerProjectWorkflow, unsaveSnippet, updateConversationDisplayName, updateDataUploadStatus, updateDocument, updateMessageFeedback, updatePersona, updatePersonaTemplate, updateProject, updateProjectTemplate, uploadLogo, verifyLogoUpload } from './sdk.gen.js';
@@ -1,6 +1,6 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- import { formDataBodySerializer } from './client';
3
- import { client } from './client.gen';
2
+ import { formDataBodySerializer } from './client/index.js';
3
+ import { client } from './client.gen.js';
4
4
  /**
5
5
  * Metrics
6
6
  *
@@ -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));
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Widget Catalog — Intentionally Static (NO API Alternative)
3
+ *
4
+ * WHY STATIC: There is no API endpoint to list widget definitions. Widget metadata
5
+ * lives in persona template YAML files and is not exposed via the API.
6
+ *
7
+ * RUNTIME ALTERNATIVE: For a specific persona, fetch widgets dynamically via:
8
+ * persona(id="...", include_workflow=true) → proto_config.widgets[].name
9
+ *
10
+ * SOURCE: ema-repos/ema/ema_backend/db/system_values/persona_templates/prod/*.yaml
11
+ * SYNC: Manual - run knowledge scan workflow to detect template changes
12
+ *
13
+ * TECHNICAL NOTES:
14
+ * - Widget 'id' is the WidgetType enum value from protos
15
+ * - Widget 'name' is assigned per-template (e.g., "upload", "upload1", "upload2")
16
+ * - Proto 'case' values represent TYPE discriminators, not widget names
17
+ *
18
+ * See .context/core/guides/source-repos.md for full sync instructions
19
+ */
20
+ export const WIDGET_CATALOG = [
21
+ // ═══════════════════════════════════════════════════════════════════════════
22
+ // Voice AI Widgets
23
+ // ═══════════════════════════════════════════════════════════════════════════
24
+ // SOURCE: voicebot_ai_employee.yaml
25
+ // LAST VERIFIED: 2026-01-27
26
+ { id: 38, name: "voiceSettings", description: "Language hints, voice model selection (title: 'Voice and language')", requiredFor: ["voice"], fields: ["languageHints", "voiceModel"] },
27
+ { id: 39, name: "conversationSettings", description: "Identity, purpose, action instructions, hangup rules (title: 'Conversational behavior')", requiredFor: ["voice"], fields: ["welcomeMessage", "identityAndPurpose", "takeActionInstructions", "hangupInstructions", "transferCallInstructions", "speechCharacteristics", "systemPrompt", "formFillingInstructions", "waitMessage"] },
28
+ { id: 43, name: "vadSettings", description: "Voice activity detection settings", requiredFor: ["voice"], fields: ["turnTimeout", "silenceEndCallTimeout", "maxConversationDuration"] },
29
+ { id: 42, name: "dataStorageSettings", description: "Audio/transcript recording settings", requiredFor: ["voice"], fields: ["storeAudioRecording", "storeTranscripts", "storeAgentTranscript"] },
30
+ { id: 41, name: "callSettings", description: "Call forwarding, spam prevention settings", requiredFor: ["voice"], fields: ["enableCallForwarding", "callForwardingNumber", "enableSpamCallPrevention"] },
31
+ { id: 44, name: "voicebotPhoneNumber", description: "Phone number configuration (title: 'Phone numbers')", requiredFor: ["voice"], fields: ["phoneNumber"] },
32
+ { id: 40, name: "voicebotFeedbackCollection", description: "Post-call feedback collection (title: 'Feedback collection')", requiredFor: ["voice"], fields: [] },
33
+ // ═══════════════════════════════════════════════════════════════════════════
34
+ // Chat AI Widgets
35
+ // ═══════════════════════════════════════════════════════════════════════════
36
+ // SOURCE: TBD - need to verify from chat template
37
+ { id: 28, name: "chatbotSdkConfig", description: "Chat widget configuration and theming", requiredFor: ["chat"], fields: ["theme", "position", "initialMessage"] },
38
+ { id: 33, name: "feedbackMessage", description: "Feedback collection settings", requiredFor: ["chat"], fields: ["enabled", "prompt"] },
39
+ // ═══════════════════════════════════════════════════════════════════════════
40
+ // Document Generation Widgets
41
+ // ═══════════════════════════════════════════════════════════════════════════
42
+ // SOURCE: ema-repos/ema/ema_backend/db/system_values/persona_templates/prod/document_proposal_manager.yaml
43
+ // NOTE: Widget names are defined per-template. These are from Document Proposal Manager.
44
+ // To sync: see .context/core/guides/source-repos.md
45
+ // LAST VERIFIED: 2026-01-27 from document_proposal_manager.yaml
46
+ { id: 3, name: "upload", description: "Content Repository - gold standard company docs (title: 'Content Repository')", requiredFor: ["document"], fields: ["tags"], uploadTarget: true },
47
+ { id: 3, name: "upload1", description: "Service Line Documents - business unit specific content (title: 'Service Line Documents')", requiredFor: ["document"], fields: ["tags"], uploadTarget: true },
48
+ { id: 3, name: "upload2", description: "Style Guide - formatting and tone guide (title: 'Style Guide')", requiredFor: ["document"], fields: ["tags"], uploadTarget: true },
49
+ { id: 29, name: "fileTagging0", description: "File tagging configuration (title: 'Set Tags')", requiredFor: ["document"], fields: ["tagTypes", "fileTagMappings"] },
50
+ { id: 5, name: "answerFormat0", description: "Proposal instructions - format, tone, language (title: 'Proposal Instructions')", requiredFor: ["document"], fields: ["textValue"] },
51
+ { id: 16, name: "sectionConfigWidget", description: "Section categories with instructions (title: 'Section Categories')", requiredFor: ["document"], fields: ["sections"] },
52
+ // ═══════════════════════════════════════════════════════════════════════════
53
+ // Common Widgets (all types)
54
+ // ═══════════════════════════════════════════════════════════════════════════
55
+ // These appear across multiple template types
56
+ { id: 3, name: "fileUpload", description: "Default document upload (KB files, title: 'Data sources')", requiredFor: ["voice", "chat", "dashboard"], fields: ["allowedTypes", "maxSize"], uploadTarget: true },
57
+ { id: 6, name: "fusionModel", description: "EmaFusion model selection (GPT-4, Claude, etc., title: 'EmaFusion™ model')", requiredFor: ["voice", "chat", "dashboard", "document"], fields: ["allModels", "selectedModels"] },
58
+ { id: 8, name: "dataProtection", description: "PII redaction settings", requiredFor: ["voice", "chat", "dashboard", "document"], fields: ["protectedClasses"] },
59
+ { id: 9, name: "copyrightCheck", description: "Copyright infringement checker (title: 'Copyright Checker')", requiredFor: ["document"], fields: [] },
60
+ ];
@@ -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 { EmaClient } from "../sdk/client.js";
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 EmaClient(env));
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 { EmaApiError, EmaClient } from "./sdk/client.js";
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 EmaClient(buildEnv(masterEnvCfg));
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 EmaClient(buildEnv(targetCfg));
269
+ const targetClient = new EmaClientAdapter(buildEnv(targetCfg));
269
270
  try {
270
271
  await upsertReplicaPersona({
271
272
  cfg,
package/docs/README.md CHANGED
@@ -1,14 +1,22 @@
1
- # Deprecated
1
+ # Documentation
2
2
 
3
- > **This directory is deprecated.** Public documentation has moved to `.context/public/guides/`.
3
+ > Public documentation lives in `.context/public/guides/` (static files) and MCP dynamic resources (generated from code).
4
4
 
5
- ## Moved files
5
+ ## Static guides (shipped with npm package)
6
6
 
7
- - `ema-user-guide.md` → `.context/public/guides/ema-user-guide.md`
8
- - `mcp-tools-guide.md` → `.context/public/guides/mcp-tools-guide.md`
9
- - `dashboard-operations.md` → `.context/public/guides/dashboard-operations.md`
10
- - `email-patterns.md` → `.context/public/guides/email-patterns.md`
7
+ - `.context/public/guides/mcp-tools-guide.md` → `ema://docs/getting-started`
8
+ - `.context/public/guides/ema-user-guide.md` → `ema://docs/ema-user-guide`
11
9
 
12
- ## Future
10
+ ## Dynamic resources (generated, always current)
13
11
 
14
- This directory may be re-added as a symlink to internal docs once cutover is verified.
12
+ - `ema://docs/workflow-node-reference` Per-node I/O types, categorizer patterns, LLM config
13
+ - `ema://rules/email-input-wiring` — Email field wiring patterns
14
+ - `ema://rules/extraction-column-format` — Entity extraction column schema
15
+ - `ema://rules/chat-response-wiring` — Chat response wiring rules
16
+ - `ema://docs/usage-guide` — Complete MCP usage guide
17
+
18
+ ## Removed (content consolidated into dynamic resources)
19
+
20
+ - `dashboard-operations.md` → `ema://docs/workflow-node-reference`, `ema://rules/extraction-column-format`
21
+ - `email-patterns.md` → `ema://rules/email-input-wiring`
22
+ - `workflow-builder-patterns.md` → `ema://docs/workflow-node-reference`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ema.co/mcp-toolkit",
3
- "version": "2026.2.13",
3
+ "version": "2026.2.23-1",
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",
@@ -56,7 +56,7 @@
56
56
  "check:publish": "tsx scripts/check-publish-content.ts",
57
57
  "prepublishOnly": "npm run build && npm run test && npm run check:publish",
58
58
  "generate:types": "tsx scripts/generate-types.ts",
59
- "generate:api-client": "npx @hey-api/openapi-ts -i src/sdk/generated/openapi.json -o src/sdk/generated/api-client -c @hey-api/client-fetch",
59
+ "generate:api-client": "npx @hey-api/openapi-ts -i src/sdk/generated/openapi.json -o src/sdk/generated/api-client -c @hey-api/client-fetch && tsx scripts/fix-generated-esm-imports.ts",
60
60
  "generate:protos": "buf generate ../ema-repos/protos --template buf.gen.yaml",
61
61
  "generate:proto-fields": "tsx scripts/generate-proto-fields.ts",
62
62
  "generate:deprecated-actions": "tsx scripts/generate-deprecated-actions.ts",
@@ -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:all": "npm run generate:protos && npm run generate:api-client && npm run generate:templates && npm run generate:skill",
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",