chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
@@ -0,0 +1,99 @@
import type {
DocuSignCreateFromTemplateParams,
DocuSignCreateFromTemplateResponse,
} from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignCreateFromTemplateTool: ToolConfig<
DocuSignCreateFromTemplateParams,
DocuSignCreateFromTemplateResponse
> = {
id: 'docusign_create_from_template',
name: 'Send from DocuSign Template',
description: 'Create and send a DocuSign envelope using a pre-built template',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
templateId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'DocuSign template ID to use',
},
emailSubject: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Override email subject (uses template default if not set)',
},
emailBody: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Override email body message',
},
templateRoles: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'JSON array of template roles, e.g. [{"roleName":"Signer","name":"John","email":"john@example.com"}]',
},
status: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Envelope status: "sent" to send immediately, "created" for draft (default: "sent")',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'create_from_template',
templateId: params.templateId,
emailSubject: params.emailSubject,
emailBody: params.emailBody,
templateRoles: params.templateRoles,
status: params.status,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to create envelope from template')
}
return {
success: true,
output: {
envelopeId: data.envelopeId ?? null,
status: data.status ?? null,
statusDateTime: data.statusDateTime ?? null,
uri: data.uri ?? null,
},
}
},
outputs: {
envelopeId: { type: 'string', description: 'Created envelope ID' },
status: { type: 'string', description: 'Envelope status' },
statusDateTime: { type: 'string', description: 'Status change datetime', optional: true },
uri: { type: 'string', description: 'Envelope URI', optional: true },
},
}
@@ -0,0 +1,59 @@
/**
* @vitest-environment node
*/
import { describe, expect, it } from 'vitest'
import { docusignDownloadDocumentTool } from '@/tools/docusign/download_document'
describe('DocuSign download document tool', () => {
it('forwards execution context to the internal route', () => {
const body = docusignDownloadDocumentTool.request.body?.({
accessToken: 'token',
envelopeId: 'envelope-1',
documentId: 'combined',
_context: {
workspaceId: 'workspace-1',
workflowId: 'workflow-1',
executionId: 'execution-1',
},
})
expect(body).toMatchObject({
accessToken: 'token',
operation: 'download_document',
envelopeId: 'envelope-1',
documentId: 'combined',
workspaceId: 'workspace-1',
workflowId: 'workflow-1',
executionId: 'execution-1',
})
})
it('returns file outputs from execution-context downloads', async () => {
const file = {
id: 'file-1',
name: 'signed.pdf',
size: 128,
type: 'application/pdf',
url: '/api/files/serve/execution/file-1',
key: 'execution/workflow/file-1',
context: 'execution',
}
const response = new Response(
JSON.stringify({
file,
mimeType: 'application/pdf',
fileName: 'signed.pdf',
}),
{ status: 200, headers: { 'content-type': 'application/json' } }
)
const result = await docusignDownloadDocumentTool.transformResponse?.(response)
expect(result?.output).toEqual({
file,
mimeType: 'application/pdf',
fileName: 'signed.pdf',
})
expect(result?.output.base64Content).toBeUndefined()
})
})
@@ -0,0 +1,98 @@
import type {
DocuSignDownloadDocumentParams,
DocuSignDownloadDocumentResponse,
} from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
function getExecutionContext(params: DocuSignDownloadDocumentParams): {
workspaceId?: string
workflowId?: string
executionId?: string
} {
const context = params._context
return {
workspaceId: typeof context?.workspaceId === 'string' ? context.workspaceId : undefined,
workflowId: typeof context?.workflowId === 'string' ? context.workflowId : undefined,
executionId: typeof context?.executionId === 'string' ? context.executionId : undefined,
}
}
export const docusignDownloadDocumentTool: ToolConfig<
DocuSignDownloadDocumentParams,
DocuSignDownloadDocumentResponse
> = {
id: 'docusign_download_document',
name: 'Download DocuSign Document',
description: 'Download a signed document from a completed DocuSign envelope',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
envelopeId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The envelope ID containing the document',
},
documentId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Specific document ID to download, or "combined" for all documents merged (default: "combined")',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => {
const context = getExecutionContext(params)
return {
accessToken: params.accessToken,
operation: 'download_document',
envelopeId: params.envelopeId,
documentId: params.documentId,
...context,
}
},
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to download document')
}
return {
success: true,
output: {
...(data.file ? { file: data.file } : {}),
...(typeof data.base64Content === 'string' ? { base64Content: data.base64Content } : {}),
mimeType: data.mimeType ?? 'application/pdf',
fileName: data.fileName ?? 'document.pdf',
},
}
},
outputs: {
file: { type: 'file', description: 'Stored downloaded document file', optional: true },
base64Content: {
type: 'string',
description: 'Deprecated legacy inline content. New downloads return file.',
optional: true,
},
mimeType: { type: 'string', description: 'MIME type of the document' },
fileName: { type: 'string', description: 'Original file name' },
},
}
+85
View File
@@ -0,0 +1,85 @@
import type { DocuSignGetEnvelopeParams, DocuSignGetEnvelopeResponse } from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignGetEnvelopeTool: ToolConfig<
DocuSignGetEnvelopeParams,
DocuSignGetEnvelopeResponse
> = {
id: 'docusign_get_envelope',
name: 'Get DocuSign Envelope',
description: 'Get the details and status of a DocuSign envelope',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
envelopeId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The envelope ID to retrieve',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'get_envelope',
envelopeId: params.envelopeId,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to get envelope')
}
return {
success: true,
output: {
envelopeId: data.envelopeId ?? null,
status: data.status ?? null,
emailSubject: data.emailSubject ?? null,
sentDateTime: data.sentDateTime ?? null,
completedDateTime: data.completedDateTime ?? null,
createdDateTime: data.createdDateTime ?? null,
statusChangedDateTime: data.statusChangedDateTime ?? null,
voidedReason: data.voidedReason ?? null,
signerCount: data.recipients?.signers?.length ?? 0,
documentCount: data.envelopeDocuments?.length ?? 0,
},
}
},
outputs: {
envelopeId: { type: 'string', description: 'Envelope ID' },
status: {
type: 'string',
description: 'Envelope status (created, sent, delivered, completed, declined, voided)',
},
emailSubject: { type: 'string', description: 'Email subject line' },
sentDateTime: { type: 'string', description: 'When the envelope was sent', optional: true },
completedDateTime: {
type: 'string',
description: 'When all recipients completed signing',
optional: true,
},
createdDateTime: { type: 'string', description: 'When the envelope was created' },
statusChangedDateTime: { type: 'string', description: 'When the status last changed' },
voidedReason: { type: 'string', description: 'Reason the envelope was voided', optional: true },
signerCount: { type: 'number', description: 'Number of signers' },
documentCount: { type: 'number', description: 'Number of documents' },
},
}
+9
View File
@@ -0,0 +1,9 @@
export { docusignCreateFromTemplateTool } from './create_from_template'
export { docusignDownloadDocumentTool } from './download_document'
export { docusignGetEnvelopeTool } from './get_envelope'
export { docusignListEnvelopesTool } from './list_envelopes'
export { docusignListRecipientsTool } from './list_recipients'
export { docusignListTemplatesTool } from './list_templates'
export { docusignSendEnvelopeTool } from './send_envelope'
export * from './types'
export { docusignVoidEnvelopeTool } from './void_envelope'
+105
View File
@@ -0,0 +1,105 @@
import type {
DocuSignListEnvelopesParams,
DocuSignListEnvelopesResponse,
} from '@/tools/docusign/types'
import { ENVELOPES_ARRAY_OUTPUT } from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignListEnvelopesTool: ToolConfig<
DocuSignListEnvelopesParams,
DocuSignListEnvelopesResponse
> = {
id: 'docusign_list_envelopes',
name: 'List DocuSign Envelopes',
description: 'List envelopes from your DocuSign account with optional filters',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
fromDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Start date filter (ISO 8601). Defaults to 30 days ago',
},
toDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'End date filter (ISO 8601)',
},
envelopeStatus: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by status: created, sent, delivered, completed, declined, voided',
},
searchText: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Search text to filter envelopes',
},
count: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of envelopes to return (default: 25)',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'list_envelopes',
fromDate: params.fromDate,
toDate: params.toDate,
envelopeStatus: params.envelopeStatus,
searchText: params.searchText,
count: params.count,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to list envelopes')
}
const envelopes = (data.envelopes ?? []).map((env: Record<string, unknown>) => ({
envelopeId: env.envelopeId ?? null,
status: env.status ?? null,
emailSubject: env.emailSubject ?? null,
sentDateTime: env.sentDateTime ?? null,
completedDateTime: env.completedDateTime ?? null,
createdDateTime: env.createdDateTime ?? null,
statusChangedDateTime: env.statusChangedDateTime ?? null,
}))
return {
success: true,
output: {
envelopes,
totalSetSize: Number(data.totalSetSize) || 0,
resultSetSize: Number(data.resultSetSize) || envelopes.length,
},
}
},
outputs: {
envelopes: ENVELOPES_ARRAY_OUTPUT,
totalSetSize: { type: 'number', description: 'Total number of matching envelopes' },
resultSetSize: { type: 'number', description: 'Number of envelopes returned in this response' },
},
}
@@ -0,0 +1,92 @@
import type {
DocuSignListRecipientsParams,
DocuSignListRecipientsResponse,
} from '@/tools/docusign/types'
import { RECIPIENTS_ARRAY_OUTPUT } from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignListRecipientsTool: ToolConfig<
DocuSignListRecipientsParams,
DocuSignListRecipientsResponse
> = {
id: 'docusign_list_recipients',
name: 'List DocuSign Recipients',
description: 'Get the recipient status details for a DocuSign envelope',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
envelopeId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The envelope ID to get recipients for',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'list_recipients',
envelopeId: params.envelopeId,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to list recipients')
}
const signers = (data.signers ?? []).map((s: Record<string, unknown>) => ({
recipientId: s.recipientId ?? null,
name: s.name ?? null,
email: s.email ?? null,
status: s.status ?? null,
signedDateTime: s.signedDateTime ?? null,
deliveredDateTime: s.deliveredDateTime ?? null,
}))
const carbonCopies = (data.carbonCopies ?? []).map((cc: Record<string, unknown>) => ({
recipientId: cc.recipientId ?? null,
name: cc.name ?? null,
email: cc.email ?? null,
status: cc.status ?? null,
}))
return {
success: true,
output: {
signers,
carbonCopies,
},
}
},
outputs: {
signers: RECIPIENTS_ARRAY_OUTPUT,
carbonCopies: {
type: 'array',
description: 'Array of carbon copy recipients',
items: {
type: 'object',
properties: {
recipientId: { type: 'string', description: 'Recipient ID' },
name: { type: 'string', description: 'Recipient name' },
email: { type: 'string', description: 'Recipient email' },
status: { type: 'string', description: 'Recipient status' },
},
},
},
},
}
+83
View File
@@ -0,0 +1,83 @@
import type {
DocuSignListTemplatesParams,
DocuSignListTemplatesResponse,
} from '@/tools/docusign/types'
import { TEMPLATES_ARRAY_OUTPUT } from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignListTemplatesTool: ToolConfig<
DocuSignListTemplatesParams,
DocuSignListTemplatesResponse
> = {
id: 'docusign_list_templates',
name: 'List DocuSign Templates',
description: 'List available templates in your DocuSign account',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
searchText: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Search text to filter templates by name',
},
count: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of templates to return',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'list_templates',
searchText: params.searchText,
count: params.count,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to list templates')
}
const templates = (data.envelopeTemplates ?? []).map((t: Record<string, unknown>) => ({
templateId: t.templateId ?? null,
name: t.name ?? null,
description: t.description ?? null,
shared: t.shared === 'true' || t.shared === true,
created: t.created ?? null,
lastModified: t.lastModified ?? null,
}))
return {
success: true,
output: {
templates,
totalSetSize: Number(data.totalSetSize) || 0,
resultSetSize: Number(data.resultSetSize) || templates.length,
},
}
},
outputs: {
templates: TEMPLATES_ARRAY_OUTPUT,
totalSetSize: { type: 'number', description: 'Total number of matching templates' },
resultSetSize: { type: 'number', description: 'Number of templates returned in this response' },
},
}
+119
View File
@@ -0,0 +1,119 @@
import type {
DocuSignSendEnvelopeParams,
DocuSignSendEnvelopeResponse,
} from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignSendEnvelopeTool: ToolConfig<
DocuSignSendEnvelopeParams,
DocuSignSendEnvelopeResponse
> = {
id: 'docusign_send_envelope',
name: 'Send DocuSign Envelope',
description: 'Create and send a DocuSign envelope with a document for e-signature',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
emailSubject: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email subject for the envelope',
},
emailBody: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Email body message',
},
signerEmail: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email address of the signer',
},
signerName: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Full name of the signer',
},
ccEmail: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Email address of carbon copy recipient',
},
ccName: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Full name of carbon copy recipient',
},
file: {
type: 'file',
required: false,
visibility: 'user-or-llm',
description: 'Document file to send for signature',
},
status: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Envelope status: "sent" to send immediately, "created" for draft (default: "sent")',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'send_envelope',
emailSubject: params.emailSubject,
emailBody: params.emailBody,
signerEmail: params.signerEmail,
signerName: params.signerName,
ccEmail: params.ccEmail,
ccName: params.ccName,
file: params.file,
status: params.status,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to send envelope')
}
return {
success: true,
output: {
envelopeId: data.envelopeId ?? null,
status: data.status ?? null,
statusDateTime: data.statusDateTime ?? null,
uri: data.uri ?? null,
},
}
},
outputs: {
envelopeId: { type: 'string', description: 'Created envelope ID' },
status: { type: 'string', description: 'Envelope status' },
statusDateTime: { type: 'string', description: 'Status change datetime', optional: true },
uri: { type: 'string', description: 'Envelope URI', optional: true },
},
}
+262
View File
@@ -0,0 +1,262 @@
import type { UserFile } from '@/executor/types'
import type { OutputProperty, ToolResponse } from '@/tools/types'
/** Common envelope output properties */
export const ENVELOPE_OUTPUT_PROPERTIES = {
envelopeId: { type: 'string', description: 'Unique envelope identifier' },
status: {
type: 'string',
description: 'Envelope status (created, sent, delivered, completed, declined, voided)',
},
emailSubject: { type: 'string', description: 'Email subject line' },
sentDateTime: {
type: 'string',
description: 'ISO 8601 datetime when envelope was sent',
optional: true,
},
completedDateTime: {
type: 'string',
description: 'ISO 8601 datetime when envelope was completed',
optional: true,
},
createdDateTime: { type: 'string', description: 'ISO 8601 datetime when envelope was created' },
statusChangedDateTime: { type: 'string', description: 'ISO 8601 datetime of last status change' },
} as const satisfies Record<string, OutputProperty>
export const RECIPIENT_OUTPUT_PROPERTIES = {
recipientId: { type: 'string', description: 'Recipient identifier' },
name: { type: 'string', description: 'Recipient name' },
email: { type: 'string', description: 'Recipient email address' },
status: {
type: 'string',
description: 'Recipient signing status (sent, delivered, completed, declined)',
},
signedDateTime: {
type: 'string',
description: 'ISO 8601 datetime when recipient signed',
optional: true,
},
deliveredDateTime: {
type: 'string',
description: 'ISO 8601 datetime when delivered to recipient',
optional: true,
},
} as const satisfies Record<string, OutputProperty>
export const TEMPLATE_OUTPUT_PROPERTIES = {
templateId: { type: 'string', description: 'Template identifier' },
name: { type: 'string', description: 'Template name' },
description: { type: 'string', description: 'Template description', optional: true },
shared: { type: 'boolean', description: 'Whether template is shared', optional: true },
created: { type: 'string', description: 'ISO 8601 creation date' },
lastModified: { type: 'string', description: 'ISO 8601 last modified date' },
} as const satisfies Record<string, OutputProperty>
export const ENVELOPE_OBJECT_OUTPUT: OutputProperty = {
type: 'object',
description: 'DocuSign envelope',
properties: ENVELOPE_OUTPUT_PROPERTIES,
}
export const ENVELOPES_ARRAY_OUTPUT: OutputProperty = {
type: 'array',
description: 'Array of DocuSign envelopes',
items: {
type: 'object',
properties: ENVELOPE_OUTPUT_PROPERTIES,
},
}
export const RECIPIENT_OBJECT_OUTPUT: OutputProperty = {
type: 'object',
description: 'DocuSign recipient',
properties: RECIPIENT_OUTPUT_PROPERTIES,
}
export const RECIPIENTS_ARRAY_OUTPUT: OutputProperty = {
type: 'array',
description: 'Array of DocuSign recipients',
items: {
type: 'object',
properties: RECIPIENT_OUTPUT_PROPERTIES,
},
}
export const TEMPLATES_ARRAY_OUTPUT: OutputProperty = {
type: 'array',
description: 'Array of DocuSign templates',
items: {
type: 'object',
properties: TEMPLATE_OUTPUT_PROPERTIES,
},
}
/** Params interfaces */
export interface DocuSignSendEnvelopeParams {
accessToken: string
emailSubject: string
emailBody?: string
signerEmail: string
signerName: string
ccEmail?: string
ccName?: string
file?: unknown
status?: string
}
export interface DocuSignCreateFromTemplateParams {
accessToken: string
templateId: string
emailSubject?: string
emailBody?: string
templateRoles: string
status?: string
}
export interface DocuSignGetEnvelopeParams {
accessToken: string
envelopeId: string
}
export interface DocuSignListEnvelopesParams {
accessToken: string
fromDate?: string
toDate?: string
envelopeStatus?: string
searchText?: string
count?: string
}
export interface DocuSignVoidEnvelopeParams {
accessToken: string
envelopeId: string
voidedReason: string
}
export interface DocuSignDownloadDocumentParams {
accessToken: string
envelopeId: string
documentId?: string
_context?: Record<string, unknown>
}
export interface DocuSignListTemplatesParams {
accessToken: string
searchText?: string
count?: string
}
export interface DocuSignListRecipientsParams {
accessToken: string
envelopeId: string
}
/** Response interfaces */
export interface DocuSignSendEnvelopeResponse extends ToolResponse {
output: {
envelopeId: string
status: string
statusDateTime: string | null
uri: string | null
}
}
export interface DocuSignCreateFromTemplateResponse extends ToolResponse {
output: {
envelopeId: string
status: string
statusDateTime: string | null
uri: string | null
}
}
export interface DocuSignGetEnvelopeResponse extends ToolResponse {
output: {
envelopeId: string
status: string
emailSubject: string | null
sentDateTime: string | null
completedDateTime: string | null
createdDateTime: string | null
statusChangedDateTime: string | null
voidedReason: string | null
signerCount: number
documentCount: number
}
}
export interface DocuSignListEnvelopesResponse extends ToolResponse {
output: {
envelopes: Array<{
envelopeId: string
status: string
emailSubject: string | null
sentDateTime: string | null
completedDateTime: string | null
createdDateTime: string | null
statusChangedDateTime: string | null
}>
totalSetSize: number
resultSetSize: number
}
}
export interface DocuSignVoidEnvelopeResponse extends ToolResponse {
output: {
envelopeId: string
status: string
}
}
export interface DocuSignDownloadDocumentResponse extends ToolResponse {
output: {
base64Content?: string
file?: UserFile
mimeType: string
fileName: string
}
}
export interface DocuSignListTemplatesResponse extends ToolResponse {
output: {
templates: Array<{
templateId: string
name: string
description: string | null
shared: boolean
created: string | null
lastModified: string | null
}>
totalSetSize: number
resultSetSize: number
}
}
export interface DocuSignListRecipientsResponse extends ToolResponse {
output: {
signers: Array<{
recipientId: string
name: string
email: string
status: string
signedDateTime: string | null
deliveredDateTime: string | null
}>
carbonCopies: Array<{
recipientId: string
name: string
email: string
status: string
}>
}
}
export type DocuSignResponse =
| DocuSignSendEnvelopeResponse
| DocuSignCreateFromTemplateResponse
| DocuSignGetEnvelopeResponse
| DocuSignListEnvelopesResponse
| DocuSignVoidEnvelopeResponse
| DocuSignDownloadDocumentResponse
| DocuSignListTemplatesResponse
| DocuSignListRecipientsResponse
+72
View File
@@ -0,0 +1,72 @@
import type {
DocuSignVoidEnvelopeParams,
DocuSignVoidEnvelopeResponse,
} from '@/tools/docusign/types'
import type { ToolConfig } from '@/tools/types'
export const docusignVoidEnvelopeTool: ToolConfig<
DocuSignVoidEnvelopeParams,
DocuSignVoidEnvelopeResponse
> = {
id: 'docusign_void_envelope',
name: 'Void DocuSign Envelope',
description: 'Void (cancel) a sent DocuSign envelope that has not yet been completed',
version: '1.0.0',
oauth: {
required: true,
provider: 'docusign',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'DocuSign OAuth access token',
},
envelopeId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The envelope ID to void',
},
voidedReason: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Reason for voiding the envelope',
},
},
request: {
url: '/api/tools/docusign',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
accessToken: params.accessToken,
operation: 'void_envelope',
envelopeId: params.envelopeId,
voidedReason: params.voidedReason,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (data.success === false) {
throw new Error(data.error || 'Failed to void envelope')
}
return {
success: true,
output: {
envelopeId: data.envelopeId ?? null,
status: data.status ?? 'voided',
},
}
},
outputs: {
envelopeId: { type: 'string', description: 'Voided envelope ID' },
status: { type: 'string', description: 'Envelope status (voided)' },
},
}