@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.
- package/dist/index.d.ts +1718 -19
- package/dist/index.js +369 -25
- package/dist/organization-model/index.d.ts +1718 -19
- package/dist/organization-model/index.js +369 -25
- package/dist/test-utils/index.d.ts +1108 -371
- package/dist/test-utils/index.js +357 -17
- package/package.json +5 -1
- package/src/__tests__/publish.test.ts +14 -13
- package/src/__tests__/template-core-compatibility.test.ts +4 -4
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1109 -882
- package/src/auth/multi-tenancy/index.ts +3 -0
- package/src/auth/multi-tenancy/theme-presets.ts +45 -0
- package/src/auth/multi-tenancy/types.ts +57 -83
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
- package/src/business/acquisition/activity-events.ts +13 -4
- package/src/business/acquisition/api-schemas.test.ts +315 -4
- package/src/business/acquisition/api-schemas.ts +122 -8
- package/src/business/acquisition/build-templates.ts +44 -0
- package/src/business/acquisition/crm-next-action.test.ts +262 -0
- package/src/business/acquisition/crm-next-action.ts +220 -0
- package/src/business/acquisition/crm-priority.test.ts +216 -0
- package/src/business/acquisition/crm-priority.ts +349 -0
- package/src/business/acquisition/crm-state-actions.test.ts +151 -160
- package/src/business/acquisition/deal-ownership.test.ts +351 -0
- package/src/business/acquisition/deal-ownership.ts +120 -0
- package/src/business/acquisition/derive-actions.test.ts +101 -37
- package/src/business/acquisition/derive-actions.ts +102 -87
- package/src/business/acquisition/index.ts +10 -0
- package/src/business/acquisition/types.ts +400 -366
- package/src/business/crm/api-schemas.ts +40 -0
- package/src/business/crm/index.ts +1 -0
- package/src/business/deals/api-schemas.ts +79 -0
- package/src/business/deals/index.ts +1 -0
- package/src/business/projects/types.ts +124 -88
- package/src/execution/core/runner-types.ts +61 -80
- package/src/execution/engine/index.ts +4 -3
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
- package/src/execution/engine/tools/integration/tool.ts +255 -253
- package/src/execution/engine/tools/lead-service-types.ts +939 -924
- package/src/execution/engine/tools/messages.ts +43 -0
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
- package/src/execution/engine/tools/platform/acquisition/types.ts +5 -2
- package/src/execution/engine/tools/platform/email/types.ts +97 -96
- package/src/execution/engine/tools/registry.ts +4 -3
- package/src/execution/engine/tools/tool-maps.ts +3 -1
- package/src/execution/engine/tools/types.ts +234 -233
- package/src/execution/engine/workflow/types.ts +195 -193
- package/src/execution/external/api-schemas.ts +40 -0
- package/src/execution/external/index.ts +1 -0
- package/src/knowledge/README.md +32 -0
- package/src/knowledge/__tests__/queries.test.ts +504 -0
- package/src/knowledge/format.ts +99 -0
- package/src/knowledge/index.ts +5 -0
- package/src/knowledge/queries.ts +256 -0
- package/src/organization-model/__tests__/defaults.test.ts +172 -172
- package/src/organization-model/__tests__/foundation.test.ts +7 -7
- package/src/organization-model/__tests__/icons.test.ts +27 -0
- package/src/organization-model/__tests__/knowledge.test.ts +214 -0
- package/src/organization-model/contracts.ts +17 -15
- package/src/organization-model/defaults.ts +74 -19
- package/src/organization-model/domains/knowledge.ts +53 -0
- package/src/organization-model/domains/navigation.ts +416 -399
- package/src/organization-model/domains/prospecting.ts +204 -1
- package/src/organization-model/domains/sales.test.ts +29 -0
- package/src/organization-model/domains/sales.ts +102 -0
- package/src/organization-model/domains/shared.ts +6 -5
- package/src/organization-model/foundation.ts +10 -6
- package/src/organization-model/graph/build.ts +209 -182
- package/src/organization-model/graph/schema.ts +37 -34
- package/src/organization-model/graph/types.ts +47 -31
- package/src/organization-model/icons.ts +81 -0
- package/src/organization-model/index.ts +8 -3
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +103 -86
- package/src/organization-model/schema.ts +90 -85
- package/src/organization-model/types.ts +42 -35
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/index.ts +23 -27
- package/src/platform/registry/index.ts +0 -4
- package/src/platform/registry/resource-registry.ts +0 -77
- package/src/platform/registry/serialized-types.ts +148 -219
- package/src/platform/registry/stats-types.ts +60 -60
- package/src/reference/_generated/contracts.md +829 -595
- package/src/supabase/database.types.ts +2978 -2958
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool message protocol types (SSOT)
|
|
3
|
+
*
|
|
4
|
+
* Shared by worker-side (packages/sdk) and parent-side (apps/api) to
|
|
5
|
+
* describe the postMessage() messages that cross the worker thread boundary.
|
|
6
|
+
*
|
|
7
|
+
* ToolCallMessage — worker → parent (outbound request)
|
|
8
|
+
* ToolCallResponse — parent → worker (inbound response)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ToolingErrorType } from './types'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Token usage metadata optionally attached to a ToolCallResponse.
|
|
15
|
+
* Populated for LLM tool calls where cost accounting is available.
|
|
16
|
+
*/
|
|
17
|
+
export interface TokenUsage {
|
|
18
|
+
inputTokens: number
|
|
19
|
+
outputTokens: number
|
|
20
|
+
cost?: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Outbound tool-call from worker to parent */
|
|
24
|
+
export interface ToolCallMessage {
|
|
25
|
+
type: 'tool-call'
|
|
26
|
+
id: string
|
|
27
|
+
tool: string
|
|
28
|
+
method: string
|
|
29
|
+
params: unknown
|
|
30
|
+
credential?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Inbound tool-result from parent to worker */
|
|
34
|
+
export interface ToolCallResponse {
|
|
35
|
+
type: 'tool-result'
|
|
36
|
+
id: string
|
|
37
|
+
result?: unknown
|
|
38
|
+
error?: string
|
|
39
|
+
/** Structured error code from platform (ToolingErrorType) */
|
|
40
|
+
code?: ToolingErrorType
|
|
41
|
+
/** Token usage metadata (LLM tool calls only) */
|
|
42
|
+
usage?: TokenUsage
|
|
43
|
+
}
|
|
@@ -38,13 +38,14 @@ export function createAcqListCreateTool(): Tool {
|
|
|
38
38
|
if (!leadService) throw serviceUnavailable('LeadService')
|
|
39
39
|
if (!executionContext?.organizationId) throw serviceUnavailable('ExecutionContext', { reason: 'organizationId required for multi-tenant isolation' })
|
|
40
40
|
|
|
41
|
-
const typedInput = input as { name: string; description?: string }
|
|
41
|
+
const typedInput = input as { name: string; description?: string; buildTemplateId?: string }
|
|
42
42
|
|
|
43
43
|
const result = await leadService.createList({
|
|
44
|
-
organizationId: executionContext.organizationId,
|
|
45
|
-
name: typedInput.name,
|
|
46
|
-
description: typedInput.description
|
|
47
|
-
|
|
44
|
+
organizationId: executionContext.organizationId,
|
|
45
|
+
name: typedInput.name,
|
|
46
|
+
description: typedInput.description,
|
|
47
|
+
buildTemplateId: typedInput.buildTemplateId
|
|
48
|
+
})
|
|
48
49
|
|
|
49
50
|
return {
|
|
50
51
|
id: result.id,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
+
import { isProspectingBuildTemplateId } from '../../../../../business/acquisition/build-templates'
|
|
3
|
+
import { EmailSchema } from '../../../../../platform/utils/validation'
|
|
2
4
|
|
|
3
5
|
// ============================================
|
|
4
6
|
// LIST SCHEMAS
|
|
@@ -6,7 +8,8 @@ import { z } from 'zod'
|
|
|
6
8
|
|
|
7
9
|
export const CreateListInputSchema = z.object({
|
|
8
10
|
name: z.string().min(1),
|
|
9
|
-
description: z.string().optional()
|
|
11
|
+
description: z.string().optional(),
|
|
12
|
+
buildTemplateId: z.string().refine(isProspectingBuildTemplateId).optional()
|
|
10
13
|
})
|
|
11
14
|
|
|
12
15
|
export const UpdateListInputSchema = z.object({
|
|
@@ -132,7 +135,7 @@ export const CompanyArrayOutputSchema = z.array(CompanyOutputSchema)
|
|
|
132
135
|
// ============================================
|
|
133
136
|
|
|
134
137
|
export const CreateContactInputSchema = z.object({
|
|
135
|
-
email:
|
|
138
|
+
email: EmailSchema,
|
|
136
139
|
companyId: z.string().uuid().optional(),
|
|
137
140
|
firstName: z.string().optional(),
|
|
138
141
|
lastName: z.string().optional(),
|
|
@@ -1,96 +1,97 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform Email Tool Types
|
|
3
|
-
*
|
|
4
|
-
* Zod schemas and inferred types for platform email sending.
|
|
5
|
-
* Supports three targeting modes: explicit userIds, role-based, or broadcast.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { z } from 'zod'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
name
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Platform Email Tool Types
|
|
3
|
+
*
|
|
4
|
+
* Zod schemas and inferred types for platform email sending.
|
|
5
|
+
* Supports three targeting modes: explicit userIds, role-based, or broadcast.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod'
|
|
9
|
+
import { EmailSchema } from '../../../../../platform/utils/validation'
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// INPUT SCHEMA
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Input schema for sending platform emails
|
|
17
|
+
*
|
|
18
|
+
* Targeting modes (exactly one required):
|
|
19
|
+
* - userIds: Explicit list of user IDs to email
|
|
20
|
+
* - targetRole: Role to target (e.g., "admin")
|
|
21
|
+
* - targetAll: Send to all org members
|
|
22
|
+
*
|
|
23
|
+
* Content (at least one required):
|
|
24
|
+
* - html: HTML email body
|
|
25
|
+
* - text: Plain text email body
|
|
26
|
+
*/
|
|
27
|
+
export const SendPlatformEmailInputSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
// Targeting (exactly one required)
|
|
30
|
+
userIds: z.array(z.string().uuid()).optional().describe('Explicit list of user IDs to email'),
|
|
31
|
+
targetRole: z.string().optional().describe('Role to target (e.g., "admin")'),
|
|
32
|
+
targetAll: z.boolean().optional().describe('Send to all org members'),
|
|
33
|
+
|
|
34
|
+
// Content
|
|
35
|
+
subject: z.string().min(1).max(200),
|
|
36
|
+
html: z.string().optional(),
|
|
37
|
+
text: z.string().optional(),
|
|
38
|
+
|
|
39
|
+
// Optional
|
|
40
|
+
replyTo: EmailSchema.optional(),
|
|
41
|
+
tags: z
|
|
42
|
+
.array(
|
|
43
|
+
z.object({
|
|
44
|
+
name: z.string(),
|
|
45
|
+
value: z.string()
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
.optional()
|
|
49
|
+
})
|
|
50
|
+
.refine(
|
|
51
|
+
(data) => {
|
|
52
|
+
const modes = [data.userIds?.length, data.targetRole, data.targetAll].filter(Boolean)
|
|
53
|
+
return modes.length === 1
|
|
54
|
+
},
|
|
55
|
+
{ message: 'Exactly one targeting mode required: userIds, targetRole, or targetAll' }
|
|
56
|
+
)
|
|
57
|
+
.refine((data) => data.html || data.text, { message: 'Must provide either html or text body' })
|
|
58
|
+
|
|
59
|
+
export type SendPlatformEmailInput = z.infer<typeof SendPlatformEmailInputSchema>
|
|
60
|
+
|
|
61
|
+
// =============================================================================
|
|
62
|
+
// OUTPUT SCHEMA
|
|
63
|
+
// =============================================================================
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Output schema for platform email send result
|
|
67
|
+
* Follows partial success pattern (similar to BatchProcessResult)
|
|
68
|
+
*/
|
|
69
|
+
export const SendPlatformEmailOutputSchema = z.object({
|
|
70
|
+
sent: z.number().int(),
|
|
71
|
+
failed: z.number().int(),
|
|
72
|
+
errors: z
|
|
73
|
+
.array(
|
|
74
|
+
z.object({
|
|
75
|
+
userId: z.string().uuid(),
|
|
76
|
+
email: EmailSchema,
|
|
77
|
+
error: z.string()
|
|
78
|
+
})
|
|
79
|
+
)
|
|
80
|
+
.optional()
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
export type SendPlatformEmailOutput = z.infer<typeof SendPlatformEmailOutputSchema>
|
|
84
|
+
|
|
85
|
+
// =============================================================================
|
|
86
|
+
// TOOL CONFIG
|
|
87
|
+
// =============================================================================
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for creating a platform email tool
|
|
91
|
+
*/
|
|
92
|
+
export interface PlatformEmailToolConfig {
|
|
93
|
+
/** Unique name for the tool */
|
|
94
|
+
name: string
|
|
95
|
+
/** Description of what the tool does (shown to LLM) */
|
|
96
|
+
description: string
|
|
97
|
+
}
|
|
@@ -557,9 +557,10 @@ export {
|
|
|
557
557
|
type UpdateProposalDataParams,
|
|
558
558
|
type MarkProposalSentParams,
|
|
559
559
|
type MarkProposalReviewedParams,
|
|
560
|
-
type UpdateCloseLostReasonParams,
|
|
561
|
-
type UpdateFeesParams,
|
|
562
|
-
type
|
|
560
|
+
type UpdateCloseLostReasonParams,
|
|
561
|
+
type UpdateFeesParams,
|
|
562
|
+
type CacheInstantlyThreadIdsParams,
|
|
563
|
+
type TransitionItemParams,
|
|
563
564
|
type SetContactNurtureParams,
|
|
564
565
|
type CancelSchedulesAndHitlByEmailParams,
|
|
565
566
|
type CancelHitlByDealIdParams,
|
|
@@ -243,6 +243,7 @@ import type {
|
|
|
243
243
|
MarkProposalReviewedParams,
|
|
244
244
|
UpdateCloseLostReasonParams,
|
|
245
245
|
UpdateFeesParams,
|
|
246
|
+
CacheInstantlyThreadIdsParams,
|
|
246
247
|
TransitionItemParams,
|
|
247
248
|
SetContactNurtureParams,
|
|
248
249
|
CancelSchedulesAndHitlByEmailParams,
|
|
@@ -567,7 +568,7 @@ export type MillionVerifierToolMap = {
|
|
|
567
568
|
}
|
|
568
569
|
|
|
569
570
|
// ---------------------------------------------------------------------------
|
|
570
|
-
// Lead (platform tool,
|
|
571
|
+
// Lead (platform tool, 56 methods)
|
|
571
572
|
// ---------------------------------------------------------------------------
|
|
572
573
|
|
|
573
574
|
export type LeadToolMap = {
|
|
@@ -628,6 +629,7 @@ export type LeadToolMap = {
|
|
|
628
629
|
markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
|
|
629
630
|
updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
|
|
630
631
|
updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
|
|
632
|
+
cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
|
|
631
633
|
transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
|
|
632
634
|
setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
|
|
633
635
|
cancelSchedulesAndHitlByEmail: {
|