import { ZodObject } from 'zod'; import KnockMgmt from '@knocklabs/mgmt'; import { Knock } from '@knocklabs/node'; type KnockClient = ReturnType; declare const createKnockClient: (config: Config) => KnockMgmt & { publicApi: (environmentSlug?: string) => Promise; }; interface KnockToolDefinition { /** * The method name of the tool. This is a machine-readable string. */ method: string; /** * The name of the tool. This can be used to reference the tool in the code. * A descriptive LLM-readable string. */ name: string; /** * A descriptive prompt explaining the tool's purpose, including examples where useful. */ description: string; /** * A descriptive prompt explaining the tool's purpose, usage and input parameters. * Ths is intended to be used by the underlying LLM. */ fullDescription: string; /** * The Zod schema for the input parameters of the tool */ parameters?: ZodObject; /** * The actual implementation of the tool. */ execute: (knockClient: KnockClient, config: Config) => (input: any) => Promise; } interface KnockTool extends Omit { bindExecute: (knockClient: KnockClient, config: Config) => (input: any) => Promise; } declare const KnockTool: (args: Omit) => KnockTool; declare const tools: { channels: { listChannels: KnockTool; }; commits: { listCommits: KnockTool; commitAllChanges: KnockTool; promoteAllCommits: KnockTool; }; documentation: { searchDocumentation: KnockTool; }; emailLayouts: { getEmailLayout: KnockTool; listEmailLayouts: KnockTool; createOrUpdateEmailLayout: KnockTool; }; environments: { listEnvironments: KnockTool; }; guides: { listGuides: KnockTool; getGuide: KnockTool; createOrUpdateGuide: KnockTool; }; messages: { getMessage: KnockTool; getMessageContent: KnockTool; getMessageDeliveryLogs: KnockTool; getMessageEvents: KnockTool; }; messageTypes: { listMessageTypes: KnockTool; createOrUpdateMessageType: KnockTool; }; objects: { listObjects: KnockTool; getObject: KnockTool; createOrUpdateObject: KnockTool; subscribeUsersToObject: KnockTool; unsubscribeUsersFromObject: KnockTool; }; partials: { getPartial: KnockTool; listPartials: KnockTool; createOrUpdatePartial: KnockTool; }; tenants: { getTenant: KnockTool; listTenants: KnockTool; createOrUpdateTenant: KnockTool; }; users: { getUser: KnockTool; createOrUpdateUser: KnockTool; getUserPreferences: KnockTool; setUserPreferences: KnockTool; getUserMessages: KnockTool; }; workflows: { createOneOffWorkflowSchedule: KnockTool; createOrUpdateEmailStepInWorkflow: KnockTool; createOrUpdateSmsStepInWorkflow: KnockTool; createOrUpdatePushStepInWorkflow: KnockTool; createOrUpdateInAppFeedStepInWorkflow: KnockTool; createOrUpdateChatStepInWorkflow: KnockTool; createOrUpdateDelayStepInWorkflow: KnockTool; createOrUpdateBatchStepInWorkflow: KnockTool; listWorkflows: KnockTool; getWorkflow: KnockTool; triggerWorkflow: KnockTool; createWorkflow: KnockTool; }; }; declare const allTools: { createOneOffWorkflowSchedule: KnockTool; createOrUpdateEmailStepInWorkflow: KnockTool; createOrUpdateSmsStepInWorkflow: KnockTool; createOrUpdatePushStepInWorkflow: KnockTool; createOrUpdateInAppFeedStepInWorkflow: KnockTool; createOrUpdateChatStepInWorkflow: KnockTool; createOrUpdateDelayStepInWorkflow: KnockTool; createOrUpdateBatchStepInWorkflow: KnockTool; listWorkflows: KnockTool; getWorkflow: KnockTool; triggerWorkflow: KnockTool; createWorkflow: KnockTool; getUser: KnockTool; createOrUpdateUser: KnockTool; getUserPreferences: KnockTool; setUserPreferences: KnockTool; getUserMessages: KnockTool; getTenant: KnockTool; listTenants: KnockTool; createOrUpdateTenant: KnockTool; getPartial: KnockTool; listPartials: KnockTool; createOrUpdatePartial: KnockTool; listObjects: KnockTool; getObject: KnockTool; createOrUpdateObject: KnockTool; subscribeUsersToObject: KnockTool; unsubscribeUsersFromObject: KnockTool; getMessage: KnockTool; getMessageContent: KnockTool; getMessageDeliveryLogs: KnockTool; getMessageEvents: KnockTool; listMessageTypes: KnockTool; createOrUpdateMessageType: KnockTool; listGuides: KnockTool; getGuide: KnockTool; createOrUpdateGuide: KnockTool; listEnvironments: KnockTool; getEmailLayout: KnockTool; listEmailLayouts: KnockTool; createOrUpdateEmailLayout: KnockTool; searchDocumentation: KnockTool; listCommits: KnockTool; commitAllChanges: KnockTool; promoteAllCommits: KnockTool; listChannels: KnockTool; }; declare const toolPermissions: { channels: { read: string[]; }; commits: { read: string[]; manage: string[]; }; documentation: { read: string[]; }; emailLayouts: { read: string[]; manage: string[]; }; environments: { read: string[]; }; guides: { read: string[]; manage: string[]; }; messages: { read: string[]; }; messageTypes: { read: string[]; manage: string[]; }; objects: { read: string[]; manage: string[]; }; partials: { read: string[]; manage: string[]; }; tenants: { read: string[]; manage: string[]; }; users: { read: string[]; manage: string[]; }; workflows: { read: string[]; manage: string[]; trigger: never[]; }; }; interface Config { /** * The token to use to authenticate with the service. If not provided, the `serviceToken` * will be resolved from `KNOCK_SERVICE_TOKEN` environment variable. */ serviceToken?: string | undefined; /** * When set calls will be made as this user. */ userId?: string | undefined; /** * When set calls will be made in this tenant context. */ tenantId?: string | undefined; /** * The environment to use as the basis for the API calls. When not defined, will default to * the `development` environment. */ environment?: string | undefined; /** * Whether to hide user data from LLM responses. When true, the LLM will not have access to user * data and only the ID will be returned. Defaults to `false`. */ hideUserData?: boolean | undefined; } type TransformPermissions = { [K in keyof T]?: { [P in keyof T[K]]?: boolean; }; }; interface ToolkitConfig extends Config { /** * The permissions to use for the toolkit. */ permissions: Omit, "workflows"> & { workflows?: { /** * Whether to allow reading workflows. */ read?: boolean | undefined; /** * Whether to allow managing workflows. */ manage?: boolean | undefined; /** * Optionally specify a list of workflow keys to turn into workflow trigger tools * * If true, all workflows will be allowed. */ trigger?: string[] | undefined; }; }; } type ToolCategory = keyof typeof toolPermissions; export { type Config as C, type KnockClient as K, type ToolkitConfig as T, type ToolCategory as a, KnockTool as b, type TransformPermissions as c, allTools as d, toolPermissions as e, createKnockClient as f, type KnockToolDefinition as g, tools as t };