@elevasis/core 0.15.0 → 0.16.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.
Files changed (88) hide show
  1. package/dist/index.d.ts +1718 -19
  2. package/dist/index.js +369 -25
  3. package/dist/organization-model/index.d.ts +1718 -19
  4. package/dist/organization-model/index.js +369 -25
  5. package/dist/test-utils/index.d.ts +1108 -371
  6. package/dist/test-utils/index.js +357 -17
  7. package/package.json +5 -1
  8. package/src/__tests__/publish.test.ts +14 -13
  9. package/src/__tests__/template-core-compatibility.test.ts +4 -4
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1109 -882
  11. package/src/auth/multi-tenancy/index.ts +3 -0
  12. package/src/auth/multi-tenancy/theme-presets.ts +45 -0
  13. package/src/auth/multi-tenancy/types.ts +57 -83
  14. package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
  15. package/src/business/acquisition/activity-events.ts +13 -4
  16. package/src/business/acquisition/api-schemas.test.ts +315 -4
  17. package/src/business/acquisition/api-schemas.ts +122 -8
  18. package/src/business/acquisition/build-templates.ts +44 -0
  19. package/src/business/acquisition/crm-next-action.test.ts +262 -0
  20. package/src/business/acquisition/crm-next-action.ts +220 -0
  21. package/src/business/acquisition/crm-priority.test.ts +216 -0
  22. package/src/business/acquisition/crm-priority.ts +349 -0
  23. package/src/business/acquisition/crm-state-actions.test.ts +151 -160
  24. package/src/business/acquisition/deal-ownership.test.ts +351 -0
  25. package/src/business/acquisition/deal-ownership.ts +120 -0
  26. package/src/business/acquisition/derive-actions.test.ts +101 -37
  27. package/src/business/acquisition/derive-actions.ts +102 -87
  28. package/src/business/acquisition/index.ts +10 -0
  29. package/src/business/acquisition/types.ts +400 -366
  30. package/src/business/crm/api-schemas.ts +40 -0
  31. package/src/business/crm/index.ts +1 -0
  32. package/src/business/deals/api-schemas.ts +79 -0
  33. package/src/business/deals/index.ts +1 -0
  34. package/src/business/projects/types.ts +124 -88
  35. package/src/execution/core/runner-types.ts +61 -80
  36. package/src/execution/engine/index.ts +4 -3
  37. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
  38. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
  39. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
  40. package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
  41. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
  42. package/src/execution/engine/tools/integration/tool.ts +255 -253
  43. package/src/execution/engine/tools/lead-service-types.ts +939 -924
  44. package/src/execution/engine/tools/messages.ts +43 -0
  45. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
  46. package/src/execution/engine/tools/platform/acquisition/types.ts +5 -2
  47. package/src/execution/engine/tools/platform/email/types.ts +97 -96
  48. package/src/execution/engine/tools/registry.ts +4 -3
  49. package/src/execution/engine/tools/tool-maps.ts +3 -1
  50. package/src/execution/engine/tools/types.ts +234 -233
  51. package/src/execution/engine/workflow/types.ts +195 -193
  52. package/src/execution/external/api-schemas.ts +40 -0
  53. package/src/execution/external/index.ts +1 -0
  54. package/src/knowledge/README.md +32 -0
  55. package/src/knowledge/__tests__/queries.test.ts +504 -0
  56. package/src/knowledge/format.ts +99 -0
  57. package/src/knowledge/index.ts +5 -0
  58. package/src/knowledge/queries.ts +256 -0
  59. package/src/organization-model/__tests__/defaults.test.ts +172 -172
  60. package/src/organization-model/__tests__/foundation.test.ts +7 -7
  61. package/src/organization-model/__tests__/icons.test.ts +27 -0
  62. package/src/organization-model/__tests__/knowledge.test.ts +214 -0
  63. package/src/organization-model/contracts.ts +17 -15
  64. package/src/organization-model/defaults.ts +74 -19
  65. package/src/organization-model/domains/knowledge.ts +53 -0
  66. package/src/organization-model/domains/navigation.ts +416 -399
  67. package/src/organization-model/domains/prospecting.ts +204 -1
  68. package/src/organization-model/domains/sales.test.ts +29 -0
  69. package/src/organization-model/domains/sales.ts +102 -0
  70. package/src/organization-model/domains/shared.ts +6 -5
  71. package/src/organization-model/foundation.ts +10 -6
  72. package/src/organization-model/graph/build.ts +209 -182
  73. package/src/organization-model/graph/schema.ts +37 -34
  74. package/src/organization-model/graph/types.ts +47 -31
  75. package/src/organization-model/icons.ts +81 -0
  76. package/src/organization-model/index.ts +8 -3
  77. package/src/organization-model/organization-model.mdx +1 -1
  78. package/src/organization-model/published.ts +103 -86
  79. package/src/organization-model/schema.ts +90 -85
  80. package/src/organization-model/types.ts +42 -35
  81. package/src/platform/constants/versions.ts +1 -1
  82. package/src/platform/index.ts +23 -27
  83. package/src/platform/registry/index.ts +0 -4
  84. package/src/platform/registry/resource-registry.ts +0 -77
  85. package/src/platform/registry/serialized-types.ts +148 -219
  86. package/src/platform/registry/stats-types.ts +60 -60
  87. package/src/reference/_generated/contracts.md +829 -595
  88. package/src/supabase/database.types.ts +2978 -2958
@@ -1,104 +1,105 @@
1
- import { z } from 'zod'
2
- import { createIntegrationTool } from '../../../tool'
3
- import type { Tool } from '../../../../types'
4
-
5
- /**
6
- * Create Gmail send email tool
7
- *
8
- * Creates a tool that sends emails via Gmail API using organization credentials.
9
- * Supports both OAuth2 and service account authentication, as well as mock credentials for testing.
10
- *
11
- * @param credentialName - Name of credential in credentials table
12
- * @returns Tool that sends email via Gmail
13
- *
14
- * @example
15
- * // Create tool for support email account
16
- * const sendEmail = createGmailSendEmailTool('support-gmail')
17
- *
18
- * // In agent definition:
19
- * export const emailAgentDefinition: AgentDefinition = {
20
- * config: {
21
- * resourceId: 'email-agent',
22
- * name: 'Email Agent',
23
- * description: 'Sends emails on behalf of users'
24
- * },
25
- * tools: [sendEmail],
26
- * // ...
27
- * }
28
- *
29
- * @example
30
- * // Create multiple tools for different accounts
31
- * const sendSupportEmail = createGmailSendEmailTool('support-gmail')
32
- * const sendSalesEmail = createGmailSendEmailTool('sales-gmail')
33
- *
34
- * // Use in agent with multiple email accounts
35
- * tools: [sendSupportEmail, sendSalesEmail]
36
- */
37
- export function createGmailSendEmailTool(credentialName: string): Tool {
38
- return createIntegrationTool({
39
- name: 'gmail_sendEmail',
40
- description: 'Send an email via Gmail API',
41
-
42
- inputSchema: z.object({
43
- to: z.string().email().describe('Recipient email address'),
44
- subject: z.string().describe('Email subject line'),
45
- body: z.string().describe('Email body (HTML supported)'),
46
- cc: z.string().email().optional().describe('Optional CC recipient'),
47
- from: z.string().optional().describe('Optional sender display name (defaults to "me")')
48
- }),
49
-
50
- outputSchema: z.object({
51
- messageId: z.string().describe('Gmail message ID'),
52
- threadId: z.string().describe('Gmail thread ID')
53
- }),
54
-
55
- integration: 'gmail' as const,
56
- method: 'sendEmail' as const,
57
- credentialName: credentialName
58
- })
59
- }
60
-
61
- /**
62
- * Create Gmail send email tool with custom name
63
- *
64
- * Allows creating multiple Gmail tools with different names for the same organization.
65
- * Useful when you want to distinguish between different email accounts in tool naming.
66
- *
67
- * @param toolName - Custom name for the tool (e.g., 'send_support_email')
68
- * @param credentialName - Name of credential in credentials table
69
- * @returns Tool that sends email via Gmail
70
- *
71
- * @example
72
- * const sendSupportEmail = createGmailSendEmailToolNamed(
73
- * 'send_support_email',
74
- * 'support-gmail'
75
- * )
76
- *
77
- * const sendSalesEmail = createGmailSendEmailToolNamed(
78
- * 'send_sales_email',
79
- * 'sales-gmail'
80
- * )
81
- */
82
- export function createGmailSendEmailToolNamed(toolName: string, credentialName: string): Tool {
83
- return createIntegrationTool({
84
- name: toolName,
85
- description: `Send an email via Gmail API using ${credentialName} credentials`,
86
-
87
- inputSchema: z.object({
88
- to: z.string().email().describe('Recipient email address'),
89
- subject: z.string().describe('Email subject line'),
90
- body: z.string().describe('Email body (HTML supported)'),
91
- cc: z.string().email().optional().describe('Optional CC recipient'),
92
- from: z.string().optional().describe('Optional sender display name (defaults to "me")')
93
- }),
94
-
95
- outputSchema: z.object({
96
- messageId: z.string().describe('Gmail message ID'),
97
- threadId: z.string().describe('Gmail thread ID')
98
- }),
99
-
100
- integration: 'gmail' as const,
101
- method: 'sendEmail' as const,
102
- credentialName: credentialName
103
- })
104
- }
1
+ import { z } from 'zod'
2
+ import { createIntegrationTool } from '../../../tool'
3
+ import type { Tool } from '../../../../types'
4
+ import { EmailSchema } from '../../../../../../../platform/utils/validation'
5
+
6
+ /**
7
+ * Create Gmail send email tool
8
+ *
9
+ * Creates a tool that sends emails via Gmail API using organization credentials.
10
+ * Supports both OAuth2 and service account authentication, as well as mock credentials for testing.
11
+ *
12
+ * @param credentialName - Name of credential in credentials table
13
+ * @returns Tool that sends email via Gmail
14
+ *
15
+ * @example
16
+ * // Create tool for support email account
17
+ * const sendEmail = createGmailSendEmailTool('support-gmail')
18
+ *
19
+ * // In agent definition:
20
+ * export const emailAgentDefinition: AgentDefinition = {
21
+ * config: {
22
+ * resourceId: 'email-agent',
23
+ * name: 'Email Agent',
24
+ * description: 'Sends emails on behalf of users'
25
+ * },
26
+ * tools: [sendEmail],
27
+ * // ...
28
+ * }
29
+ *
30
+ * @example
31
+ * // Create multiple tools for different accounts
32
+ * const sendSupportEmail = createGmailSendEmailTool('support-gmail')
33
+ * const sendSalesEmail = createGmailSendEmailTool('sales-gmail')
34
+ *
35
+ * // Use in agent with multiple email accounts
36
+ * tools: [sendSupportEmail, sendSalesEmail]
37
+ */
38
+ export function createGmailSendEmailTool(credentialName: string): Tool {
39
+ return createIntegrationTool({
40
+ name: 'gmail_sendEmail',
41
+ description: 'Send an email via Gmail API',
42
+
43
+ inputSchema: z.object({
44
+ to: EmailSchema.describe('Recipient email address'),
45
+ subject: z.string().describe('Email subject line'),
46
+ body: z.string().describe('Email body (HTML supported)'),
47
+ cc: EmailSchema.optional().describe('Optional CC recipient'),
48
+ from: z.string().optional().describe('Optional sender display name (defaults to "me")')
49
+ }),
50
+
51
+ outputSchema: z.object({
52
+ messageId: z.string().describe('Gmail message ID'),
53
+ threadId: z.string().describe('Gmail thread ID')
54
+ }),
55
+
56
+ integration: 'gmail' as const,
57
+ method: 'sendEmail' as const,
58
+ credentialName: credentialName
59
+ })
60
+ }
61
+
62
+ /**
63
+ * Create Gmail send email tool with custom name
64
+ *
65
+ * Allows creating multiple Gmail tools with different names for the same organization.
66
+ * Useful when you want to distinguish between different email accounts in tool naming.
67
+ *
68
+ * @param toolName - Custom name for the tool (e.g., 'send_support_email')
69
+ * @param credentialName - Name of credential in credentials table
70
+ * @returns Tool that sends email via Gmail
71
+ *
72
+ * @example
73
+ * const sendSupportEmail = createGmailSendEmailToolNamed(
74
+ * 'send_support_email',
75
+ * 'support-gmail'
76
+ * )
77
+ *
78
+ * const sendSalesEmail = createGmailSendEmailToolNamed(
79
+ * 'send_sales_email',
80
+ * 'sales-gmail'
81
+ * )
82
+ */
83
+ export function createGmailSendEmailToolNamed(toolName: string, credentialName: string): Tool {
84
+ return createIntegrationTool({
85
+ name: toolName,
86
+ description: `Send an email via Gmail API using ${credentialName} credentials`,
87
+
88
+ inputSchema: z.object({
89
+ to: EmailSchema.describe('Recipient email address'),
90
+ subject: z.string().describe('Email subject line'),
91
+ body: z.string().describe('Email body (HTML supported)'),
92
+ cc: EmailSchema.optional().describe('Optional CC recipient'),
93
+ from: z.string().optional().describe('Optional sender display name (defaults to "me")')
94
+ }),
95
+
96
+ outputSchema: z.object({
97
+ messageId: z.string().describe('Gmail message ID'),
98
+ threadId: z.string().describe('Gmail thread ID')
99
+ }),
100
+
101
+ integration: 'gmail' as const,
102
+ method: 'sendEmail' as const,
103
+ credentialName: credentialName
104
+ })
105
+ }