chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,35 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the creatable item') })
|
||||
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'creatable',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {
|
||||
created: {
|
||||
schema: (args) =>
|
||||
z.object({
|
||||
item: withId(args.item),
|
||||
}),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
create: {
|
||||
input: {
|
||||
schema: (args) => z.object({ item: args.item }),
|
||||
},
|
||||
output: {
|
||||
schema: (args) => z.object({ item: withId(args.item) }),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/creatable",
|
||||
"description": "Creatable interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,31 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the deletable item') })
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'deletable',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {
|
||||
deleted: {
|
||||
schema: () => baseItem,
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
delete: {
|
||||
input: {
|
||||
schema: () => baseItem,
|
||||
},
|
||||
output: {
|
||||
schema: () => z.object({}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/deletable",
|
||||
"description": "Deletable interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,171 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
const BASE_ITEM = (itemType: 'file' | 'folder' | 'item' = 'item') =>
|
||||
sdk.z.object({
|
||||
id: sdk.z
|
||||
.string()
|
||||
.describe(
|
||||
`The ${itemType}'s ID. This could be a unique identifier from the external service, or a relative or absolute path, so long as it's unique.`
|
||||
),
|
||||
type: sdk.z.union([sdk.z.literal('file'), sdk.z.literal('folder')]).describe('The entity type'),
|
||||
name: sdk.z
|
||||
.string()
|
||||
.describe(
|
||||
`The ${itemType}'s name. This will be displayed in the Botpress UI and be used as the ${itemType}'s name on Files API."`
|
||||
),
|
||||
parentId: sdk.z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(`The parent folder ID. Leave empty if the ${itemType} is in the root folder.`),
|
||||
absolutePath: sdk.z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(`The absolute path of the ${itemType}. Leave empty if not available.`),
|
||||
})
|
||||
|
||||
const FOLDER = BASE_ITEM('folder').extend({
|
||||
type: sdk.z.literal('folder'),
|
||||
})
|
||||
|
||||
const FILE = BASE_ITEM('file').extend({
|
||||
type: sdk.z.literal('file'),
|
||||
sizeInBytes: sdk.z.number().optional().describe('The file size in bytes, if available'),
|
||||
lastModifiedDate: sdk.z.string().datetime().optional().describe('The last modified date of the file, if available'),
|
||||
contentHash: sdk.z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('The hash of the file content, or version/revision number, if available'),
|
||||
})
|
||||
|
||||
const FILE_WITH_PATH = FILE.extend({
|
||||
absolutePath: sdk.z.string().describe('The full path of the file'),
|
||||
})
|
||||
|
||||
const FOLDER_WITH_PATH = FOLDER.extend({
|
||||
absolutePath: sdk.z.string().describe('The full path of the folder'),
|
||||
})
|
||||
|
||||
const NEXT_TOKEN = sdk.z.string().optional().describe('The token to get the next page of items.')
|
||||
|
||||
export default new sdk.InterfaceDefinition({
|
||||
name: 'files-readonly',
|
||||
version: '0.3.0',
|
||||
actions: {
|
||||
listItemsInFolder: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
title: 'List items in folder',
|
||||
description: 'List the files and folders in a folder',
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
folderId: FOLDER.shape.id
|
||||
.optional()
|
||||
.title('Folder ID')
|
||||
.describe('The folder ID to list the items from. Leave empty to list items from the root folder.'),
|
||||
filters: sdk.z
|
||||
.object({
|
||||
itemType: BASE_ITEM().shape.type.optional().describe('Filter the items by type'),
|
||||
maxSizeInBytes: FILE.shape.sizeInBytes
|
||||
.optional()
|
||||
.describe('Filter the items by maximum size (in bytes)'),
|
||||
modifiedAfter: FILE.shape.lastModifiedDate
|
||||
.optional()
|
||||
.describe('Filter the items modified after the given date'),
|
||||
})
|
||||
.optional()
|
||||
.title('Search Filters')
|
||||
.describe('Optional search filters'),
|
||||
nextToken: NEXT_TOKEN.title('Next Page Token').describe(
|
||||
'The token to get the next page of items. Leave empty to get the first page.'
|
||||
),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
items: sdk.z
|
||||
.array(sdk.z.union([FILE, FOLDER]))
|
||||
.title('Folder Items')
|
||||
.describe('The files and folders in the folder'),
|
||||
meta: sdk.z
|
||||
.object({
|
||||
nextToken: NEXT_TOKEN,
|
||||
})
|
||||
.title('Metadata')
|
||||
.describe('List items in folder metadata'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
transferFileToBotpress: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
title: 'Transfer file to Botpress',
|
||||
description: 'Transfer a file from an external service to Botpress',
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
file: FILE.title('File to transfer').describe('The file to transfer'),
|
||||
fileKey: sdk.z.string().title('File key').describe('The file key to use in Botpress'),
|
||||
shouldIndex: sdk.z
|
||||
.boolean()
|
||||
.optional()
|
||||
.title('Should index file?')
|
||||
.describe('Whether to index the file in vector storage'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
botpressFileId: sdk.z.string().title('File ID').describe('The file ID of the uploaded file on Botpress'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
events: {
|
||||
fileCreated: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
file: FILE_WITH_PATH.title('Created File').describe('The created file'),
|
||||
}),
|
||||
},
|
||||
fileUpdated: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
file: FILE_WITH_PATH.title('Updated File').describe('The updated file'),
|
||||
}),
|
||||
},
|
||||
fileDeleted: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
file: FILE_WITH_PATH.title('Deleted File').describe('The deleted file'),
|
||||
}),
|
||||
},
|
||||
folderDeletedRecursive: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
folder: FOLDER_WITH_PATH.title('Deleted Folder').describe('The deleted folder'),
|
||||
}),
|
||||
},
|
||||
aggregateFileChanges: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
modifiedItems: sdk.z
|
||||
.object({
|
||||
created: sdk.z.array(FILE_WITH_PATH).describe('The files created'),
|
||||
updated: sdk.z.array(FILE_WITH_PATH).describe('The files updated'),
|
||||
deleted: sdk.z
|
||||
.array(sdk.z.union([FILE_WITH_PATH, FOLDER_WITH_PATH]))
|
||||
.describe('The files and folders deleted'),
|
||||
})
|
||||
.title('Modified Items')
|
||||
.describe('The modified items'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/files-readonly",
|
||||
"description": "Read-only files interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,202 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
const MAX_ADDITIONAL_DATA_SIZE = 500 // corresponds to max message tag size in the runtime API
|
||||
|
||||
type AnyMessageType = { schema: sdk.z.ZodObject }
|
||||
const withHitlSpecific = (s: AnyMessageType) => ({
|
||||
...s,
|
||||
schema: () =>
|
||||
s.schema.extend({
|
||||
userId: sdk.z.string().optional().describe('Allows sending a message pretending to be a certain user'),
|
||||
additionalData: sdk.z
|
||||
.string()
|
||||
.max(MAX_ADDITIONAL_DATA_SIZE)
|
||||
.optional()
|
||||
.describe(
|
||||
'Additional data to send with the message, useful for custom integrations. Must be encoded in a string.'
|
||||
),
|
||||
}),
|
||||
})
|
||||
|
||||
const messageSourceSchema = sdk.z.union([
|
||||
sdk.z.object({ type: sdk.z.literal('user'), userId: sdk.z.string() }),
|
||||
sdk.z.object({ type: sdk.z.literal('bot') }),
|
||||
])
|
||||
|
||||
const allMessages = {
|
||||
...sdk.messages.defaults,
|
||||
markdown: sdk.messages.markdown,
|
||||
bloc: sdk.messages.markdownBloc,
|
||||
} satisfies Record<string, { schema: sdk.z.AnyZodObject }>
|
||||
|
||||
type Tuple<T> = [T, T, ...T[]]
|
||||
const messagePayloadSchemas: sdk.z.AnyZodObject[] = Object.entries(allMessages).map(([k, v]) =>
|
||||
sdk.z.object({
|
||||
source: messageSourceSchema,
|
||||
type: sdk.z.literal(k),
|
||||
payload: v.schema,
|
||||
})
|
||||
)
|
||||
|
||||
const messageSchema = sdk.z.union(messagePayloadSchemas as Tuple<sdk.z.AnyZodObject>)
|
||||
|
||||
export default new sdk.InterfaceDefinition({
|
||||
name: 'hitl',
|
||||
version: '2.1.0',
|
||||
entities: {
|
||||
hitlSession: {
|
||||
title: 'HITL session',
|
||||
description: 'A HITL session, often referred to as a ticket or conversation in external systems',
|
||||
schema: sdk.z.object({}),
|
||||
},
|
||||
},
|
||||
events: {
|
||||
hitlAssigned: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
// Also known as downstreamConversationId:
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('HITL session ID')
|
||||
.describe('ID of the Botpress conversation representing the HITL session'),
|
||||
|
||||
// Also known as humanAgentUserId:
|
||||
userId: sdk.z
|
||||
.string()
|
||||
.title('Human agent user ID')
|
||||
.describe('ID of the Botpress user representing the human agent assigned to the HITL session'),
|
||||
}),
|
||||
},
|
||||
hitlStopped: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
// Also known as downstreamConversationId:
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('HITL session ID')
|
||||
.describe('ID of the Botpress conversation representing the HITL session'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// TODO: allow for an interface to extend 'proactiveUser' and reuse its actions
|
||||
createUser: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
title: 'Create external user', // <= this is a downstream user
|
||||
description: 'Create an end user in the external service and in Botpress',
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
name: sdk.z.string().title('Display name').describe('Display name of the end user'),
|
||||
pictureUrl: sdk.z.string().title('Picture URL').describe("URL of the end user's avatar").optional(),
|
||||
email: sdk.z.string().title('Email address').describe('Email address of the end user').optional(),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
userId: sdk.z
|
||||
.string()
|
||||
.title('Botpress user ID')
|
||||
.describe('ID of the Botpress user representing the end user'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
startHitl: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
title: 'Start new HITL session', // <= this is a downstream conversation / ticket
|
||||
description: 'Create a new HITL session in the external service and in Botpress',
|
||||
input: {
|
||||
schema: (entities) =>
|
||||
sdk.z.object({
|
||||
// Also known as downstreamUserId:
|
||||
userId: sdk.z.string().title('User ID').describe('ID of the Botpress user representing the end user'),
|
||||
|
||||
// Ticket title:
|
||||
title: sdk.z
|
||||
.string()
|
||||
.title('Title')
|
||||
.describe('Title of the HITL session. This corresponds to a ticket title in systems that use tickets.')
|
||||
.optional(),
|
||||
|
||||
// Ticket description:
|
||||
description: sdk.z
|
||||
.string()
|
||||
.title('Description')
|
||||
.describe(
|
||||
'Description of the HITL session. This corresponds to a ticket description in systems that use tickets.'
|
||||
)
|
||||
.optional(),
|
||||
|
||||
hitlSession: entities.hitlSession
|
||||
.optional()
|
||||
.title('Extra configuration')
|
||||
.describe('Configuration of the HITL session'),
|
||||
|
||||
// All messages sent prior to HITL session creation:
|
||||
messageHistory: sdk.z
|
||||
.array(messageSchema)
|
||||
.title('Conversation history')
|
||||
.describe(
|
||||
'History of all messages in the conversation up to this point. Should be displayed to the human agent in the external service.'
|
||||
),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
// Also known as downstreamConversationId:
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('HITL session ID')
|
||||
.describe('ID of the Botpress conversation representing the HITL session'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
stopHitl: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
title: 'Stop HITL session',
|
||||
description: 'Stop an existing HITL session in the external service',
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
// Also known as downstreamConversationId:
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('HITL session ID')
|
||||
.describe('ID of the Botpress conversation representing the HITL session'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () => sdk.z.object({}),
|
||||
},
|
||||
},
|
||||
},
|
||||
channels: {
|
||||
hitl: {
|
||||
messages: {
|
||||
text: withHitlSpecific(sdk.messages.defaults.text),
|
||||
image: withHitlSpecific(sdk.messages.defaults.image),
|
||||
audio: withHitlSpecific(sdk.messages.defaults.audio),
|
||||
video: withHitlSpecific(sdk.messages.defaults.video),
|
||||
file: withHitlSpecific(sdk.messages.defaults.file),
|
||||
bloc: withHitlSpecific(sdk.messages.markdownBloc), // TODO: use the actual bloc message when bumping a version of the interface
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@botpresshub/hitl",
|
||||
"description": "HITL interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,45 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the listable item') })
|
||||
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)
|
||||
const nextToken = z.string().optional()
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'listable',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {},
|
||||
actions: {
|
||||
list: {
|
||||
input: {
|
||||
schema: () =>
|
||||
z.object({
|
||||
nextToken: nextToken
|
||||
.title('List Token')
|
||||
.describe('The token to get a given list of items (e.g. a parent record ID, or a page index).'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: (args) =>
|
||||
z.object({
|
||||
items: z.array(withId(args.item)),
|
||||
meta: z
|
||||
.object({
|
||||
nextToken: nextToken
|
||||
.title('List Token')
|
||||
.describe('The token to get a given list of items (e.g. a parent record ID, or a page index).'),
|
||||
})
|
||||
.title('Metadata')
|
||||
.describe('Metadata for the list operation'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/listable",
|
||||
"description": "Listable interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,39 @@
|
||||
import * as common from '@botpress/common'
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'llm',
|
||||
version: '10.0.0',
|
||||
entities: {
|
||||
modelRef: {
|
||||
schema: common.llm.schemas.ModelRefSchema,
|
||||
},
|
||||
},
|
||||
events: {},
|
||||
actions: {
|
||||
generateContent: {
|
||||
billable: true,
|
||||
cacheable: true,
|
||||
input: {
|
||||
schema: ({ modelRef }) => common.llm.schemas.GenerateContentInputSchema(modelRef),
|
||||
},
|
||||
output: {
|
||||
schema: () => common.llm.schemas.GenerateContentOutputSchema,
|
||||
},
|
||||
},
|
||||
listLanguageModels: {
|
||||
input: {
|
||||
schema: () => z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: ({ modelRef }) =>
|
||||
z.object({
|
||||
models: z.array(z.intersection(common.llm.schemas.ModelSchema, modelRef)),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@botpresshub/llm",
|
||||
"description": "LLM interface for Botpress integrations",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/common": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,31 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'proactive-conversation',
|
||||
version: '0.0.4',
|
||||
entities: {
|
||||
conversation: {
|
||||
title: 'Conversation',
|
||||
description: 'The conversation object fields',
|
||||
schema: z.object({}).title('Conversation').describe('The conversation object fields'),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
getOrCreateConversation: {
|
||||
title: 'Get or Create a Conversation',
|
||||
description: 'Proactively create a conversation from a bot',
|
||||
input: {
|
||||
schema: ({ conversation }) =>
|
||||
z.object({
|
||||
conversation: conversation.title('Conversation').describe('The conversation object fields'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
z.object({
|
||||
conversationId: z.string().title('Conversation ID').describe('The Botpress ID of the created conversation'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@botpresshub/proactive-conversation",
|
||||
"description": "interface that allows the bot to proactively create a conversation in the integration",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,37 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'proactive-user',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
user: {
|
||||
title: 'User',
|
||||
description: 'A user of the system',
|
||||
schema: z.object({}).title('User').describe('The user object fields'),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
getOrCreateUser: {
|
||||
title: 'Get or Create a User',
|
||||
description: 'Proactively create a user from a bot',
|
||||
input: {
|
||||
schema: ({ user }) =>
|
||||
z.object({
|
||||
name: z.string().optional().title('Name').describe('The name of the user'),
|
||||
pictureUrl: z.string().optional().title('Picture URL').describe('The URL of the user profile picture'),
|
||||
email: z.string().optional().title('Email').describe('The email of the user'),
|
||||
user: user.title('User').describe('The user object fields'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () =>
|
||||
z.object({
|
||||
userId: z.string().title('User ID').describe('The Botpress ID of the created user'),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@botpresshub/proactive-user",
|
||||
"description": "interface that allows the bot to proactively create a user in the integration",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the readable item') })
|
||||
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'readable',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {},
|
||||
actions: {
|
||||
read: {
|
||||
input: {
|
||||
schema: () => baseItem,
|
||||
},
|
||||
output: {
|
||||
schema: (args) => z.object({ item: withId(args.item) }),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/readable",
|
||||
"description": "Readable interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,39 @@
|
||||
import * as common from '@botpress/common'
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'speech-to-text',
|
||||
version: '2.0.2',
|
||||
entities: {
|
||||
speechToTextModelRef: {
|
||||
schema: common.speechToText.schemas.SpeechModelRefSchema,
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
transcribeAudio: {
|
||||
billable: true,
|
||||
cacheable: true,
|
||||
input: {
|
||||
schema: ({ speechToTextModelRef }) =>
|
||||
common.speechToText.schemas.TranscribeAudioInputSchema(speechToTextModelRef),
|
||||
},
|
||||
output: {
|
||||
schema: () => common.speechToText.schemas.TranscribeAudioOutputSchema,
|
||||
},
|
||||
},
|
||||
listSpeechToTextModels: {
|
||||
input: {
|
||||
schema: () => z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: ({ speechToTextModelRef }) =>
|
||||
z.object({
|
||||
models: z.array(z.intersection(common.speechToText.schemas.SpeechToTextModelSchema, speechToTextModelRef)),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@botpresshub/speech-to-text",
|
||||
"description": "Speech-to-text interface for Botpress integrations",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/common": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,42 @@
|
||||
import * as common from '@botpress/common'
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'text-to-image',
|
||||
version: '2.1.2',
|
||||
entities: {
|
||||
imageModelRef: {
|
||||
schema: common.textToImage.schemas.ImageModelRefSchema,
|
||||
},
|
||||
imageGenerationParams: {
|
||||
schema: common.textToImage.schemas.ImageGenerationParamsSchema,
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
generateImage: {
|
||||
billable: true,
|
||||
cacheable: true,
|
||||
input: {
|
||||
schema: ({ imageModelRef, imageGenerationParams }) =>
|
||||
common.textToImage.schemas.GenerateImageInputSchema(imageModelRef, imageGenerationParams),
|
||||
},
|
||||
output: {
|
||||
schema: () => common.textToImage.schemas.GenerateImageOutputSchema,
|
||||
},
|
||||
},
|
||||
listImageModels: {
|
||||
input: {
|
||||
schema: () => z.object({}),
|
||||
},
|
||||
output: {
|
||||
schema: ({ imageModelRef }) =>
|
||||
z.object({
|
||||
models: z.array(z.intersection(common.textToImage.schemas.ImageModelSchema, imageModelRef)),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@botpresshub/text-to-image",
|
||||
"description": "Text-to-image interface for Botpress integrations",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/common": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
import * as sdk from '@botpress/sdk'
|
||||
|
||||
export default new sdk.InterfaceDefinition({
|
||||
name: 'typing-indicator',
|
||||
version: '0.0.4',
|
||||
entities: {},
|
||||
events: {},
|
||||
actions: {
|
||||
startTypingIndicator: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('Conversation ID')
|
||||
.describe('The ID of the conversation where the typing indicator should be shown'),
|
||||
messageId: sdk.z
|
||||
.string()
|
||||
.title('Message ID')
|
||||
.describe('The message ID to which the typing indicator should be attached'),
|
||||
timeout: sdk.z
|
||||
.number()
|
||||
.optional()
|
||||
.title('Typing Indicator Timeout')
|
||||
.describe('The timeout in milliseconds after which the typing indicator should stop'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () => sdk.z.object({}),
|
||||
},
|
||||
},
|
||||
stopTypingIndicator: {
|
||||
attributes: {
|
||||
...sdk.WELL_KNOWN_ATTRIBUTES.HIDDEN_IN_STUDIO,
|
||||
},
|
||||
input: {
|
||||
schema: () =>
|
||||
sdk.z.object({
|
||||
conversationId: sdk.z
|
||||
.string()
|
||||
.title('Conversation ID')
|
||||
.describe('The ID of the conversation where the typing indicator should be removed'),
|
||||
messageId: sdk.z
|
||||
.string()
|
||||
.title('Message ID')
|
||||
.describe('The message ID from which the typing indicator should be removed'),
|
||||
}),
|
||||
},
|
||||
output: {
|
||||
schema: () => sdk.z.object({}),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/typing-indicator",
|
||||
"description": "Typing indicator interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import rootConfig from '../../eslint.config.mjs'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,35 @@
|
||||
import { z, InterfaceDefinition } from '@botpress/sdk'
|
||||
|
||||
const baseItem = z.object({ id: z.string().title('Item ID').describe('The unique identifier for the updatable item') })
|
||||
const withId = (schema: z.ZodTypeAny) => z.intersection(schema, baseItem)
|
||||
|
||||
export default new InterfaceDefinition({
|
||||
name: 'updatable',
|
||||
version: '0.0.3',
|
||||
entities: {
|
||||
item: {
|
||||
schema: baseItem,
|
||||
},
|
||||
},
|
||||
events: {
|
||||
updated: {
|
||||
schema: (args) =>
|
||||
z.object({
|
||||
item: withId(args.item),
|
||||
}),
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
update: {
|
||||
input: {
|
||||
schema: (args) => baseItem.extend({ item: args.item }),
|
||||
},
|
||||
output: {
|
||||
schema: (args) => z.object({ item: withId(args.item) }),
|
||||
},
|
||||
},
|
||||
},
|
||||
__advanced: {
|
||||
useLegacyZuiTransformer: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@botpresshub/updatable",
|
||||
"description": "Updatable interface for Botpress",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check:type": "tsc --noEmit",
|
||||
"check:bplint": "bp lint"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@botpress/sdk": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@botpress/cli": "workspace:*",
|
||||
"@botpress/sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": { "*": ["./*"] },
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user