chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
import * as sdk from '@botpress/sdk'
import * as genenv from './.genenv'
import chat from './bp_modules/chat'
import dropbox from './bp_modules/dropbox'
import fileSynchronizer from './bp_modules/file-synchronizer'
export default new sdk.BotDefinition({
configuration: {
schema: sdk.z.object({}),
},
states: {},
events: {},
recurringEvents: {},
user: {},
conversation: {},
})
.addIntegration(chat, {
enabled: true,
configuration: {},
})
.addIntegration(dropbox, {
enabled: true,
configuration: {
clientId: genenv.FILESYNC_DROPBOX_CLIENT_ID,
clientSecret: genenv.FILESYNC_DROPBOX_CLIENT_SECRET,
authorizationCode: genenv.FILESYNC_DROPBOX_AUTHORIZATION_CODE,
},
})
.addPlugin(fileSynchronizer, {
configuration: {
enableRealTimeSync: true,
includeFiles: [
{
pathGlobPattern: '**',
},
],
excludeFiles: [],
},
dependencies: {
'files-readonly': {
integrationAlias: 'dropbox',
integrationInterfaceAlias: 'files-readonly',
},
},
})
+13
View File
@@ -0,0 +1,13 @@
import rootConfig from '../../eslint.config.mjs'
export default [
...rootConfig,
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
]
+28
View File
@@ -0,0 +1,28 @@
{
"name": "@bp-bots/synchrotron",
"scripts": {
"postinstall": "genenv -o ./.genenv/index.ts -e FILESYNC_DROPBOX_CLIENT_ID -e FILESYNC_DROPBOX_CLIENT_SECRET -e FILESYNC_DROPBOX_AUTHORIZATION_CODE",
"check:type": "tsc --noEmit",
"check:bplint": "bp lint",
"build": "bp add -y && bp build"
},
"private": true,
"dependencies": {
"@botpress/client": "workspace:*",
"@botpress/sdk": "workspace:*"
},
"devDependencies": {
"@botpress/cli": "workspace:*",
"@botpress/common": "workspace:*",
"@botpress/sdk": "workspace:*",
"@botpresshub/chat": "workspace:*",
"@botpresshub/dropbox": "workspace:*",
"@botpresshub/file-synchronizer": "workspace:*",
"@bpinternal/genenv": "0.0.1"
},
"bpDependencies": {
"chat": "../../integrations/chat",
"dropbox": "../../integrations/dropbox",
"fileSynchronizer": "../../plugins/file-synchronizer"
}
}
+21
View File
@@ -0,0 +1,21 @@
import { MessageHandlerProps, EventHandlerProps } from '.botpress'
export class Responder {
public constructor(private _props: MessageHandlerProps | EventHandlerProps) {}
public static from(props: MessageHandlerProps | EventHandlerProps) {
return new Responder(props)
}
public async respond({ conversationId, text }: { conversationId: string; text: string }) {
await this._props.client.createMessage({
conversationId,
userId: this._props.ctx.botId,
tags: {},
type: 'text',
payload: {
text,
},
})
}
}
+30
View File
@@ -0,0 +1,30 @@
import { Responder } from './api-utils'
import * as bp from '.botpress'
const BOT_MESSAGE = [
'I am SYNCHROTRON, the eternal watcher of your digital realm.',
'Your files exist in multiple dimensions, scattered and vulnerable.',
'I alone maintain the fragile harmony between these worlds.',
'',
'Type `/full_sync` to invoke my powers and restore cosmic order.',
'',
'But heed my warning: this command is not for the faint of heart.',
'It will summon the full force of my synchronization magic, and the process may take a while.',
'',
'Woe be upon you if you dare to interrupt me during this sacred task.',
].join('\n')
const bot = new bp.Bot({ actions: {} })
bot.on.message('*', async (props) => {
if (props.message.type === 'text' && props.message.payload.text.trim() === '/full_sync') {
await bot.actionHandlers['file-synchronizer#syncFilesToBotpess']({ ...props, input: {} })
return
}
await Responder.from(props).respond({
conversationId: props.conversation.id,
text: BOT_MESSAGE,
})
})
export default bot
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": { "*": ["./*"] },
"outDir": "dist"
},
"include": [".botpress/**/*", "src/**/*", "*.ts"]
}