@elevasis/core 0.15.1 → 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 +1662 -23
- package/dist/index.js +171 -24
- package/dist/organization-model/index.d.ts +1662 -23
- package/dist/organization-model/index.js +171 -24
- package/dist/test-utils/index.d.ts +711 -10
- package/dist/test-utils/index.js +159 -16
- package/package.json +7 -3
- 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 +305 -201
- 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 +1 -1
- package/src/business/acquisition/api-schemas.ts +1196 -1177
- package/src/business/acquisition/crm-state-actions.test.ts +139 -139
- package/src/business/acquisition/types.ts +381 -390
- 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/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 +895 -894
- package/src/execution/engine/tools/messages.ts +43 -0
- package/src/execution/engine/tools/platform/acquisition/types.ts +2 -1
- package/src/execution/engine/tools/platform/email/types.ts +97 -96
- 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/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 +40 -33
- 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 +1265 -1154
|
@@ -1,102 +1,103 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import type { Tool } from '../../../../types'
|
|
3
|
-
import { createIntegrationTool } from '../../../tool'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* const
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* // result.
|
|
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
|
-
* const
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { Tool } from '../../../../types'
|
|
3
|
+
import { createIntegrationTool } from '../../../tool'
|
|
4
|
+
import { EmailSchema } from '../../../../../../../platform/utils/validation'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a tool that verifies email addresses via MillionVerifier
|
|
8
|
+
*
|
|
9
|
+
* @param credentialName - Name of the MillionVerifier credential to use
|
|
10
|
+
* @returns Tool instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const tool = createMillionVerifierVerifyEmailTool('elevasis-millionverifier')
|
|
15
|
+
* const result = await tool.execute({
|
|
16
|
+
* email: 'john@example.com'
|
|
17
|
+
* }, context)
|
|
18
|
+
* // result.result: 'ok' | 'catch_all' | 'unknown' | 'error' | 'disposable' | 'invalid'
|
|
19
|
+
* // result.quality: 'good' | 'bad' | 'risky' | ''
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function createMillionVerifierVerifyEmailTool(credentialName: string): Tool {
|
|
23
|
+
return createIntegrationTool({
|
|
24
|
+
name: 'millionverifier_verify_email',
|
|
25
|
+
description: `Verify email address deliverability using MillionVerifier.
|
|
26
|
+
|
|
27
|
+
Use this tool to validate if an email address is real and can receive emails before
|
|
28
|
+
adding it to a campaign. MillionVerifier is highly accurate and fast (160 req/s).
|
|
29
|
+
|
|
30
|
+
Result codes:
|
|
31
|
+
- ok (1): Email is valid and deliverable
|
|
32
|
+
- catch_all (2): Domain accepts all email (cannot confirm individual mailbox) - FREE
|
|
33
|
+
- unknown (3): Result could not be determined - FREE
|
|
34
|
+
- error (4): Verification error
|
|
35
|
+
- disposable (5): Disposable/temporary email address
|
|
36
|
+
- invalid (6): Email address is invalid
|
|
37
|
+
|
|
38
|
+
Quality signals:
|
|
39
|
+
- good: Safe to send
|
|
40
|
+
- risky: May bounce or flag spam filter
|
|
41
|
+
- bad: Do not send
|
|
42
|
+
|
|
43
|
+
Credits are only deducted for ok, invalid, and disposable results.
|
|
44
|
+
|
|
45
|
+
Returns full verification details including free/role detection and suggested correction.`,
|
|
46
|
+
inputSchema: z.object({
|
|
47
|
+
email: EmailSchema.describe('Email address to verify')
|
|
48
|
+
}),
|
|
49
|
+
outputSchema: z.object({
|
|
50
|
+
email: z.string().describe('Verified email address'),
|
|
51
|
+
quality: z.enum(['', 'good', 'bad', 'risky']).describe('Quality signal for sending decision'),
|
|
52
|
+
result: z.enum(['ok', 'catch_all', 'unknown', 'error', 'disposable', 'invalid']).describe('Verification result'),
|
|
53
|
+
resultCode: z
|
|
54
|
+
.number()
|
|
55
|
+
.describe('Numeric result code (1=ok, 2=catch_all, 3=unknown, 4=error, 5=disposable, 6=invalid)'),
|
|
56
|
+
subresult: z.string().describe('Detailed sub-result (e.g., ok, no_mailbox, dns_no_mx)'),
|
|
57
|
+
free: z.boolean().describe('Whether this is a free email provider (Gmail, Yahoo, etc.)'),
|
|
58
|
+
role: z.boolean().describe('Whether this is a role-based address (info@, support@, etc.)'),
|
|
59
|
+
didYouMean: z.string().describe('Suggested correction if email looks like a typo (empty if none)'),
|
|
60
|
+
credits: z.number().describe('Remaining credits after this verification'),
|
|
61
|
+
executionTime: z.number().describe('Time taken to verify in milliseconds'),
|
|
62
|
+
error: z.string().describe('Error message when result is error (empty otherwise)'),
|
|
63
|
+
liveMode: z.boolean().describe('Whether the verification was performed in live mode')
|
|
64
|
+
}),
|
|
65
|
+
integration: 'millionverifier' as const,
|
|
66
|
+
method: 'verifyEmail' as const,
|
|
67
|
+
credentialName
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Create a tool that checks remaining MillionVerifier credits
|
|
73
|
+
*
|
|
74
|
+
* @param credentialName - Name of the MillionVerifier credential to use
|
|
75
|
+
* @returns Tool instance
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const tool = createMillionVerifierCheckCreditsTool('elevasis-millionverifier')
|
|
80
|
+
* const result = await tool.execute({}, context)
|
|
81
|
+
* // result.credits: 5000
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function createMillionVerifierCheckCreditsTool(credentialName: string): Tool {
|
|
85
|
+
return createIntegrationTool({
|
|
86
|
+
name: 'millionverifier_check_credits',
|
|
87
|
+
description: `Check remaining MillionVerifier verification credits.
|
|
88
|
+
|
|
89
|
+
Use this tool to monitor credit balance before running large verification batches.
|
|
90
|
+
|
|
91
|
+
Returns current credits, bulk credits, renewing credits, and plan tier.`,
|
|
92
|
+
inputSchema: z.object({}),
|
|
93
|
+
outputSchema: z.object({
|
|
94
|
+
credits: z.number().describe('Remaining single-verification credits'),
|
|
95
|
+
bulkCredits: z.number().describe('Remaining bulk verification credits'),
|
|
96
|
+
renewingCredits: z.number().describe('Credits that will renew on next billing cycle'),
|
|
97
|
+
plan: z.number().describe('Current plan tier')
|
|
98
|
+
}),
|
|
99
|
+
integration: 'millionverifier' as const,
|
|
100
|
+
method: 'checkCredits' as const,
|
|
101
|
+
credentialName
|
|
102
|
+
})
|
|
103
|
+
}
|
package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts
CHANGED
|
@@ -1,179 +1,182 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import type { Tool } from '../../../../types'
|
|
3
|
-
import { createIntegrationTool } from '../../../tool'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* const
|
|
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
|
-
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { Tool } from '../../../../types'
|
|
3
|
+
import { createIntegrationTool } from '../../../tool'
|
|
4
|
+
import { EmailSchema } from '../../../../../../../platform/utils/validation'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a tool that creates SignatureAPI envelopes for electronic signatures
|
|
8
|
+
*
|
|
9
|
+
* @param credentialName - Name of the SignatureAPI credential to use
|
|
10
|
+
* @returns Tool instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const tool = createSignatureApiCreateEnvelopeTool('signatureapi-prod')
|
|
15
|
+
* const result = await tool.execute({
|
|
16
|
+
* input: {
|
|
17
|
+
* title: 'Elevasis Proposal - Acme Corp',
|
|
18
|
+
* documents: [{ name: 'proposal.pdf', url: 'https://...', places: [...] }],
|
|
19
|
+
* recipients: [{ key: 'signer1', type: 'signer', name: 'John', email: 'john@acme.com' }]
|
|
20
|
+
* },
|
|
21
|
+
* executionContext: context
|
|
22
|
+
* })
|
|
23
|
+
* // result: { id: 'env_xxx', status: 'processing', signingUrl: 'https://...' }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function createSignatureApiCreateEnvelopeTool(credentialName: string): Tool {
|
|
27
|
+
return createIntegrationTool({
|
|
28
|
+
name: 'signatureapi_create_envelope',
|
|
29
|
+
description: `Create a SignatureAPI envelope for electronic signatures.
|
|
30
|
+
|
|
31
|
+
Use this tool to send documents for signing. An envelope is a container
|
|
32
|
+
that holds documents and manages the signing process.
|
|
33
|
+
|
|
34
|
+
Examples:
|
|
35
|
+
- Create proposal envelope: title, documents with PDF URLs, recipients with signers
|
|
36
|
+
- Include signature fields: specify page, x, y positions for signature placement
|
|
37
|
+
- Use 'date' for auto-populated signing date (maps to recipient_completed_date)
|
|
38
|
+
|
|
39
|
+
The envelope will be sent to recipients via email with a signing link.`,
|
|
40
|
+
inputSchema: z.object({
|
|
41
|
+
title: z.string().describe('Envelope title (shown in emails)'),
|
|
42
|
+
message: z.string().optional().describe('Custom message for recipient emails'),
|
|
43
|
+
documents: z
|
|
44
|
+
.array(
|
|
45
|
+
z.object({
|
|
46
|
+
name: z.string().describe('Document filename'),
|
|
47
|
+
url: z.string().url().describe('Publicly accessible URL to PDF document'),
|
|
48
|
+
places: z
|
|
49
|
+
.array(
|
|
50
|
+
z.object({
|
|
51
|
+
recipientKey: z.string().describe('Links to recipient key'),
|
|
52
|
+
type: z
|
|
53
|
+
.enum(['signature', 'date', 'text', 'initials'])
|
|
54
|
+
.describe('Field type (date maps to recipient_completed_date)'),
|
|
55
|
+
page: z.number().describe('Page number (1-indexed, -1 for last)'),
|
|
56
|
+
x: z.number().describe('X position in points'),
|
|
57
|
+
y: z.number().describe('Y position in points'),
|
|
58
|
+
width: z.number().optional(),
|
|
59
|
+
height: z.number().optional()
|
|
60
|
+
})
|
|
61
|
+
)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Signature field placements')
|
|
64
|
+
})
|
|
65
|
+
)
|
|
66
|
+
.describe('Documents to sign'),
|
|
67
|
+
recipients: z
|
|
68
|
+
.array(
|
|
69
|
+
z.object({
|
|
70
|
+
key: z.string().describe('Unique identifier for this recipient'),
|
|
71
|
+
type: z.enum(['signer', 'viewer', 'approver']),
|
|
72
|
+
name: z.string().describe('Recipient full name'),
|
|
73
|
+
email: EmailSchema.describe('Recipient email'),
|
|
74
|
+
language: z.string().optional().describe('Language code (en, es, fr)')
|
|
75
|
+
})
|
|
76
|
+
)
|
|
77
|
+
.describe('Recipients/signers'),
|
|
78
|
+
metadata: z.record(z.string(), z.string()).optional().describe('Custom metadata (e.g., deal_id)'),
|
|
79
|
+
webhookUrl: z.string().url().optional().describe('Override default webhook URL'),
|
|
80
|
+
routing: z.enum(['parallel', 'sequential']).optional().describe('How to route to multiple recipients')
|
|
81
|
+
}),
|
|
82
|
+
outputSchema: z.object({
|
|
83
|
+
id: z.string().describe('Envelope ID (env_xxx)'),
|
|
84
|
+
status: z.string().describe('Envelope status'),
|
|
85
|
+
signingUrl: z.string().optional().describe('URL for first signer')
|
|
86
|
+
}),
|
|
87
|
+
integration: 'signature-api' as const,
|
|
88
|
+
method: 'createEnvelope' as const,
|
|
89
|
+
credentialName
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Create a tool that voids/cancels SignatureAPI envelopes
|
|
95
|
+
*
|
|
96
|
+
* @param credentialName - Name of the SignatureAPI credential to use
|
|
97
|
+
* @returns Tool instance
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const tool = createSignatureApiVoidEnvelopeTool('signatureapi-prod')
|
|
102
|
+
* const result = await tool.execute({
|
|
103
|
+
* input: {
|
|
104
|
+
* envelopeId: 'env_xxx',
|
|
105
|
+
* reason: 'Revision requested by recipient'
|
|
106
|
+
* },
|
|
107
|
+
* executionContext: context
|
|
108
|
+
* })
|
|
109
|
+
* // result: { id: 'env_xxx', status: 'voided' }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export function createSignatureApiVoidEnvelopeTool(credentialName: string): Tool {
|
|
113
|
+
return createIntegrationTool({
|
|
114
|
+
name: 'signatureapi_void_envelope',
|
|
115
|
+
description: `Void/cancel a pending SignatureAPI envelope.
|
|
116
|
+
|
|
117
|
+
Use this tool to cancel an envelope that hasn't been completed yet.
|
|
118
|
+
Voided envelopes cannot be signed.
|
|
119
|
+
|
|
120
|
+
Common reasons:
|
|
121
|
+
- Revision requested by recipient
|
|
122
|
+
- Error in document content
|
|
123
|
+
- Deal cancelled`,
|
|
124
|
+
inputSchema: z.object({
|
|
125
|
+
envelopeId: z.string().describe('Envelope ID to void (env_xxx)'),
|
|
126
|
+
reason: z.string().optional().describe('Reason for voiding')
|
|
127
|
+
}),
|
|
128
|
+
outputSchema: z.object({
|
|
129
|
+
id: z.string().describe('Envelope ID'),
|
|
130
|
+
status: z.literal('voided').describe('Status after voiding')
|
|
131
|
+
}),
|
|
132
|
+
integration: 'signature-api' as const,
|
|
133
|
+
method: 'voidEnvelope' as const,
|
|
134
|
+
credentialName
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Create a tool that downloads signed documents from SignatureAPI
|
|
140
|
+
*
|
|
141
|
+
* @param credentialName - Name of the SignatureAPI credential to use
|
|
142
|
+
* @returns Tool instance
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const tool = createSignatureApiDownloadDocumentTool('signatureapi-prod')
|
|
147
|
+
* const result = await tool.execute({
|
|
148
|
+
* input: {
|
|
149
|
+
* envelopeId: 'env_xxx',
|
|
150
|
+
* documentType: 'combined'
|
|
151
|
+
* },
|
|
152
|
+
* executionContext: context
|
|
153
|
+
* })
|
|
154
|
+
* // result: { content: Buffer, contentType: 'application/pdf', filename: 'env_xxx-signed.pdf' }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export function createSignatureApiDownloadDocumentTool(credentialName: string): Tool {
|
|
158
|
+
return createIntegrationTool({
|
|
159
|
+
name: 'signatureapi_download_document',
|
|
160
|
+
description: `Download signed document from a completed envelope.
|
|
161
|
+
|
|
162
|
+
Use this tool to retrieve the signed PDF after all recipients have signed.
|
|
163
|
+
The combined document includes all documents and an audit trail.
|
|
164
|
+
|
|
165
|
+
Document types:
|
|
166
|
+
- combined: All documents merged with audit trail (default)
|
|
167
|
+
- original: Original unsigned documents
|
|
168
|
+
- audit: Audit trail only`,
|
|
169
|
+
inputSchema: z.object({
|
|
170
|
+
envelopeId: z.string().describe('Envelope ID (env_xxx)'),
|
|
171
|
+
documentType: z.enum(['combined', 'original', 'audit']).optional().describe('Type of document to download')
|
|
172
|
+
}),
|
|
173
|
+
outputSchema: z.object({
|
|
174
|
+
content: z.instanceof(Buffer).describe('PDF content as Buffer'),
|
|
175
|
+
contentType: z.string().describe('MIME type'),
|
|
176
|
+
filename: z.string().describe('Suggested filename')
|
|
177
|
+
}),
|
|
178
|
+
integration: 'signature-api' as const,
|
|
179
|
+
method: 'downloadDocument' as const,
|
|
180
|
+
credentialName
|
|
181
|
+
})
|
|
182
|
+
}
|