diff --git a/bots/hit-looper/src/index.ts b/bots/hit-looper/src/index.ts index 067543d3d78..20915da6356 100644 --- a/bots/hit-looper/src/index.ts +++ b/bots/hit-looper/src/index.ts @@ -63,6 +63,7 @@ bot.on.message('*', async (props) => { userId: upstreamUser.id, }, }) + return } @@ -73,6 +74,7 @@ bot.on.message('*', async (props) => { conversationId: upstreamConversation.id, }, }) + return } diff --git a/package.json b/package.json index f757278bb0f..a765733c750 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@aws-sdk/client-dynamodb": "^3.564.0", - "@botpress/api": "1.34.0", + "@botpress/api": "1.37.0", "@botpress/cli": "workspace:*", "@botpress/client": "workspace:*", "@botpress/sdk": "workspace:*", diff --git a/packages/cli/package.json b/packages/cli/package.json index 1ed6f23463c..0fb88d97398 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cli", - "version": "4.16.2", + "version": "4.17.0", "description": "Botpress CLI", "scripts": { "build": "pnpm run bundle && pnpm run template:gen", @@ -21,7 +21,7 @@ "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.7.0", "@botpress/chat": "0.5.1", - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@botpress/sdk": "4.15.2", "@bpinternal/const": "^0.1.0", "@bpinternal/tunnel": "^0.1.1", diff --git a/packages/cli/src/api/bot-body.ts b/packages/cli/src/api/bot-body.ts index 6a256a7f9fb..03e5d60f3f0 100644 --- a/packages/cli/src/api/bot-body.ts +++ b/packages/cli/src/api/bot-body.ts @@ -1,6 +1,5 @@ import * as client from '@botpress/client' import * as sdk from '@botpress/sdk' -import { PluginTagNames } from '../command-implementations/project-command' import * as utils from '../utils' import * as types from './types' @@ -47,65 +46,33 @@ export const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise ({ ...localBot, - shouldMergePlugins: true, - states: _setNullOnMissingValuesAndOmitPluginDefs(localBot.states, remoteBot.states), - recurringEvents: _setNullOnMissingValuesAndOmitPluginDefs(localBot.recurringEvents, remoteBot.recurringEvents), + states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states), + recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents), events: utils.attributes.prepareAttributeUpdateBody({ - localItems: _setNullOnMissingValuesAndOmitPluginDefs(localBot.events, remoteBot.events), + localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events), remoteItems: remoteBot.events, }), actions: utils.attributes.prepareAttributeUpdateBody({ - localItems: _setNullOnMissingValuesAndOmitPluginDefs(localBot.actions, remoteBot.actions), + localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions), remoteItems: remoteBot.actions, }), user: { ...localBot.user, - tags: _setNullOnMissingValuesAndOmitImmutableTags( - localBot.user?.tags, - remoteBot.user?.tags, - localBot.immutableTags.user - ), + tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags), }, conversation: { ...localBot.conversation, - tags: _setNullOnMissingValuesAndOmitImmutableTags( - localBot.conversation?.tags, - remoteBot.conversation?.tags, - localBot.immutableTags.conversation - ), + tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags), }, message: { ...localBot.message, - tags: _setNullOnMissingValuesAndOmitImmutableTags( - localBot.message?.tags, - remoteBot.message?.tags, - localBot.immutableTags.message - ), + tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags), }, - integrations: _setNullOnMissingValuesAndOmitPluginDefs(localBot.integrations, remoteBot.integrations), - plugins: _setNullOnMissingValuesAndOmitPluginDefs(localBot.plugins, remoteBot.plugins), + integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations), + plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins), tags: localBot.tags, // TODO: allow removing bot tags (aka attributes) by setting to null }) - -export const _setNullOnMissingValuesAndOmitPluginDefs: typeof utils.records.setNullOnMissingValues = ( - record, - oldRecord = {} -) => - utils.records.setNullOnMissingValues( - record, - Object.fromEntries(Object.entries(oldRecord).filter(([key]) => !key.includes('#'))) - ) - -export const _setNullOnMissingValuesAndOmitImmutableTags = ( - record: Record = {}, - oldRecord: Record = {}, - immutableTags: string[] = [] -): Record => - utils.records.setNullOnMissingValues( - record, - Object.fromEntries(Object.entries(oldRecord).filter(([key]) => !immutableTags.includes(key))) - ) diff --git a/packages/cli/src/command-implementations/add-command.ts b/packages/cli/src/command-implementations/add-command.ts index b63ad638147..10e892a1236 100644 --- a/packages/cli/src/command-implementations/add-command.ts +++ b/packages/cli/src/command-implementations/add-command.ts @@ -113,6 +113,11 @@ export class AddCommand extends GlobalCommand { await this._uninstall(installPath) } + if (ref.type === 'name') { + // Preserve the semver version expression in the generated code: + targetPackage.pkg.version = ref.version + } + let files: codegen.File[] if (targetPackage.type === 'integration') { files = await codegen.generateIntegrationPackage(targetPackage.pkg) diff --git a/packages/cli/src/command-implementations/project-command.ts b/packages/cli/src/command-implementations/project-command.ts index 291e72480ca..5ef06730d69 100644 --- a/packages/cli/src/command-implementations/project-command.ts +++ b/packages/cli/src/command-implementations/project-command.ts @@ -33,10 +33,6 @@ export type ProjectDefinition = LintIgnoredConfig & | { type: 'plugin'; definition: sdk.PluginDefinition } ) -export type PluginTagNames = { - immutableTags: { user: string[]; conversation: string[]; message: string[] } -} - class ProjectPaths extends utils.path.PathStore { public constructor(argv: CommandArgv) { const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir) @@ -345,7 +341,7 @@ export abstract class ProjectCommand extends protected async prepareBotDependencies( botDef: sdk.BotDefinition, api: apiUtils.ApiClient - ): Promise & PluginTagNames> { + ): Promise> { const integrations = await this._fetchDependencies(botDef.integrations ?? {}, ({ name, version }) => api.getPublicOrPrivateIntegration({ type: 'name', name, version }) ) @@ -383,30 +379,6 @@ export abstract class ProjectCommand extends integrationId: iface.id, })), })), - // Tags that are defined by plugins and that cannot be updated: - immutableTags: { - user: [ - ...new Set( - Object.values(pluginsWithBackingIntegrations).flatMap((plugin) => - Object.keys(plugin.definition.user?.tags ?? {}) - ) - ), - ], - conversation: [ - ...new Set( - Object.values(pluginsWithBackingIntegrations).flatMap((plugin) => - Object.keys(plugin.definition.conversation?.tags ?? {}) - ) - ), - ], - message: [ - ...new Set( - Object.values(pluginsWithBackingIntegrations).flatMap((plugin) => - Object.keys(plugin.definition.message?.tags ?? {}) - ) - ), - ], - }, } } diff --git a/packages/cli/templates/empty-bot/package.json b/packages/cli/templates/empty-bot/package.json index 7436889ab49..ad010603bb5 100644 --- a/packages/cli/templates/empty-bot/package.json +++ b/packages/cli/templates/empty-bot/package.json @@ -5,7 +5,7 @@ }, "private": true, "dependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@botpress/sdk": "4.15.2" }, "devDependencies": { diff --git a/packages/cli/templates/empty-integration/package.json b/packages/cli/templates/empty-integration/package.json index 999a155a266..5d334597e84 100644 --- a/packages/cli/templates/empty-integration/package.json +++ b/packages/cli/templates/empty-integration/package.json @@ -6,7 +6,7 @@ }, "private": true, "dependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@botpress/sdk": "4.15.2" }, "devDependencies": { diff --git a/packages/cli/templates/hello-world/package.json b/packages/cli/templates/hello-world/package.json index 88adda03c75..d868ae4ad04 100644 --- a/packages/cli/templates/hello-world/package.json +++ b/packages/cli/templates/hello-world/package.json @@ -6,7 +6,7 @@ }, "private": true, "dependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@botpress/sdk": "4.15.2" }, "devDependencies": { diff --git a/packages/cli/templates/webhook-message/package.json b/packages/cli/templates/webhook-message/package.json index 00bab145065..d43bb1a1ec4 100644 --- a/packages/cli/templates/webhook-message/package.json +++ b/packages/cli/templates/webhook-message/package.json @@ -6,7 +6,7 @@ }, "private": true, "dependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@botpress/sdk": "4.15.2", "axios": "^1.6.8" }, diff --git a/packages/client/package.json b/packages/client/package.json index c290f7fbc72..1c294366dce 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/client", - "version": "1.21.0", + "version": "1.22.0", "description": "Botpress Client", "main": "./dist/index.cjs", "module": "./dist/index.mjs", diff --git a/packages/llmz/package.json b/packages/llmz/package.json index e211f68282f..89d8227b504 100644 --- a/packages/llmz/package.json +++ b/packages/llmz/package.json @@ -34,7 +34,7 @@ "@babel/standalone": "^7.26.4", "@babel/traverse": "^7.26.4", "@babel/types": "^7.26.3", - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "bytes": "^3.1.2", "exponential-backoff": "^3.1.1", "handlebars": "^4.7.8", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 7eb54f7989c..ee7c8547d18 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -16,7 +16,7 @@ "author": "", "license": "MIT", "dependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "browser-or-node": "^2.1.1" }, "devDependencies": { diff --git a/packages/vai/package.json b/packages/vai/package.json index 50d30a22fed..ae642779421 100644 --- a/packages/vai/package.json +++ b/packages/vai/package.json @@ -36,7 +36,7 @@ "tsup": "^8.0.2" }, "peerDependencies": { - "@botpress/client": "1.21.0", + "@botpress/client": "1.22.0", "@bpinternal/thicktoken": "^1.0.1", "@bpinternal/zui": "^1.0.1", "lodash": "^4.17.21", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 675d1d5d5e0..1aafe998a79 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,8 +17,8 @@ importers: specifier: ^3.564.0 version: 3.709.0 '@botpress/api': - specifier: 1.34.0 - version: 1.34.0(openapi-types@12.1.3) + specifier: 1.37.0 + version: 1.37.0(openapi-types@12.1.3) '@botpress/cli': specifier: workspace:* version: link:packages/cli @@ -2019,7 +2019,7 @@ importers: specifier: 0.5.1 version: link:../chat-client '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../client '@botpress/sdk': specifier: 4.15.2 @@ -2134,7 +2134,7 @@ importers: packages/cli/templates/empty-bot: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../../../client '@botpress/sdk': specifier: 4.15.2 @@ -2150,7 +2150,7 @@ importers: packages/cli/templates/empty-integration: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../../../client '@botpress/sdk': specifier: 4.15.2 @@ -2179,7 +2179,7 @@ importers: packages/cli/templates/hello-world: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../../../client '@botpress/sdk': specifier: 4.15.2 @@ -2195,7 +2195,7 @@ importers: packages/cli/templates/webhook-message: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../../../client '@botpress/sdk': specifier: 4.15.2 @@ -2333,7 +2333,7 @@ importers: specifier: ^7.26.3 version: 7.26.9 '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../client '@botpress/cognitive': specifier: 0.1.31 @@ -2436,7 +2436,7 @@ importers: packages/sdk: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../client '@bpinternal/zui': specifier: ^1.0.1 @@ -2467,7 +2467,7 @@ importers: packages/vai: dependencies: '@botpress/client': - specifier: 1.21.0 + specifier: 1.22.0 version: link:../client '@bpinternal/thicktoken': specifier: ^1.0.1 @@ -4581,8 +4581,8 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@botpress/api@1.34.0(openapi-types@12.1.3): - resolution: {integrity: sha512-tMGLhdKc7aKESzS81Lpk08zkyCMM2FSShHH0ZGSDoRwGpBI2pMnXY65GdBD3yMUC5GJTUFnrawo+Ooj3Qtnnag==} + /@botpress/api@1.37.0(openapi-types@12.1.3): + resolution: {integrity: sha512-d5sUsxz/XAeB3Rp/mweY+zLf5moRtxnXvi6k4TFrM3eCkVuGWuuspEkQLcThSS33EsDrYL7Ys2K1kn+YFtBudg==} dependencies: '@bpinternal/opapi': 0.14.0(openapi-types@12.1.3) transitivePeerDependencies: