From 77c7e28e16e21b49d6d3fa05e4b5cf5e861ffba0 Mon Sep 17 00:00:00 2001 From: Sylvain Perron <1315508+slvnperron@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:18:10 -0400 Subject: [PATCH 1/3] fix(cli): reload worker when dist changes (#14303) --- packages/cli/package.json | 2 +- .../src/command-implementations/dev-command.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index f1480abc7e8..914c15b0736 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cli", - "version": "4.17.17", + "version": "4.17.18", "description": "Botpress CLI", "scripts": { "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen", diff --git a/packages/cli/src/command-implementations/dev-command.ts b/packages/cli/src/command-implementations/dev-command.ts index 67113e8fdce..9afe286a250 100644 --- a/packages/cli/src/command-implementations/dev-command.ts +++ b/packages/cli/src/command-implementations/dev-command.ts @@ -18,7 +18,7 @@ import { ProjectCommand, ProjectDefinition } from './project-command' const DEFAULT_BOT_PORT = 8075 const DEFAULT_INTEGRATION_PORT = 8076 const TUNNEL_HELLO_INTERVAL = 5000 -const FILEWATCHER_DEBOUNCE_MS = 2000 +const FILEWATCHER_DEBOUNCE_MS = 500 export type DevCommandDefinition = typeof commandDefinitions.dev export class DevCommand extends ProjectCommand { @@ -147,15 +147,17 @@ export class DevCommand extends ProjectCommand { } const typescriptEvents = events.filter((e) => pathlib.extname(e.path) === '.ts') - if (typescriptEvents.length === 0) { - return + const distEvents = events.filter((e) => e.path.startsWith(this.projectPaths.abs.outDir)) + + if (typescriptEvents.length > 0) { + this.logger.log('Changes detected, rebuilding') + await this._restart(api, worker, httpTunnelUrl) + } else if (distEvents.length > 0) { + this.logger.log('Changes detected in output directory, reloading worker') + await worker.reload() } - - this.logger.log('Changes detected, rebuilding') - await this._restart(api, worker, httpTunnelUrl) }, { - ignore: [this.projectPaths.abs.outDir], debounceMs: FILEWATCHER_DEBOUNCE_MS, } ) From 51acbb7871c208860fc05ffbf040381d0480b9e9 Mon Sep 17 00:00:00 2001 From: Yann Allard <42552874+allardy@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:38:04 -0400 Subject: [PATCH 2/3] fix(cognitive): fix list models (#14305) --- packages/cognitive/package.json | 2 +- packages/cognitive/src/cognitive-v2/index.ts | 11 +++-------- packages/cognitive/src/cognitive-v2/types.ts | 4 ++++ packages/llmz/package.json | 2 +- packages/zai/package.json | 4 ++-- pnpm-lock.yaml | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/cognitive/package.json b/packages/cognitive/package.json index b8e96df4aa1..47e6c86ae39 100644 --- a/packages/cognitive/package.json +++ b/packages/cognitive/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cognitive", - "version": "0.1.41", + "version": "0.1.42", "description": "Wrapper around the Botpress Client to call LLMs", "main": "./dist/index.cjs", "module": "./dist/index.mjs", diff --git a/packages/cognitive/src/cognitive-v2/index.ts b/packages/cognitive/src/cognitive-v2/index.ts index bf373151c2a..3e9bad6384b 100644 --- a/packages/cognitive/src/cognitive-v2/index.ts +++ b/packages/cognitive/src/cognitive-v2/index.ts @@ -62,17 +62,12 @@ export class CognitiveBeta { return data } - public async listModels(input: void, options: RequestOptions = {}) { - const signal = options.signal ?? AbortSignal.timeout(this._timeout) - + public async listModels() { const { data } = await this._withServerRetry(() => - this._axiosClient.post('/v2/cognitive/models', input, { - signal, - timeout: options.timeout ?? this._timeout, - }) + this._axiosClient.get<{ models: Model[] }>('/v2/cognitive/models') ) - return data + return data.models } public async *generateTextStream( diff --git a/packages/cognitive/src/cognitive-v2/types.ts b/packages/cognitive/src/cognitive-v2/types.ts index 6b73840bca6..a0d52c32d67 100644 --- a/packages/cognitive/src/cognitive-v2/types.ts +++ b/packages/cognitive/src/cognitive-v2/types.ts @@ -167,6 +167,10 @@ export type Model = { id: string name: string description: string + /** + * Aliases that are also resolving to this model + */ + aliases?: string[] tags: ( | 'recommended' | 'deprecated' diff --git a/packages/llmz/package.json b/packages/llmz/package.json index c6ebbcabcb3..a489484ce1e 100644 --- a/packages/llmz/package.json +++ b/packages/llmz/package.json @@ -67,7 +67,7 @@ "tsx": "^4.19.2" }, "peerDependencies": { - "@botpress/cognitive": "0.1.41", + "@botpress/cognitive": "0.1.42", "@bpinternal/thicktoken": "^1.0.5", "@bpinternal/zui": "^1.0.1" }, diff --git a/packages/zai/package.json b/packages/zai/package.json index cc294d7d123..4f34e3f69c0 100644 --- a/packages/zai/package.json +++ b/packages/zai/package.json @@ -1,7 +1,7 @@ { "name": "@botpress/zai", "description": "Zui AI (zai) – An LLM utility library written on top of Zui and the Botpress API", - "version": "2.1.11", + "version": "2.1.12", "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { @@ -29,7 +29,7 @@ "author": "", "license": "ISC", "dependencies": { - "@botpress/cognitive": "0.1.41", + "@botpress/cognitive": "0.1.42", "json5": "^2.2.3", "jsonrepair": "^3.10.0", "lodash-es": "^4.17.21" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af91dede6a7..af174aaba0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2474,7 +2474,7 @@ importers: specifier: 1.25.0 version: link:../client '@botpress/cognitive': - specifier: 0.1.41 + specifier: 0.1.42 version: link:../cognitive '@bpinternal/thicktoken': specifier: ^1.0.5 @@ -2648,7 +2648,7 @@ importers: packages/zai: dependencies: '@botpress/cognitive': - specifier: 0.1.41 + specifier: 0.1.42 version: link:../cognitive '@bpinternal/thicktoken': specifier: ^1.0.0 From b57325d1d7896dc72ea219598ae0673d7db91d2e Mon Sep 17 00:00:00 2001 From: Sylvain Perron <1315508+slvnperron@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:59:45 -0400 Subject: [PATCH 3/3] fix(cli): rebuild loop (#14306) --- packages/cli/package.json | 2 +- packages/cli/src/command-implementations/dev-command.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 914c15b0736..a559d082d72 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@botpress/cli", - "version": "4.17.18", + "version": "4.17.19", "description": "Botpress CLI", "scripts": { "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen", diff --git a/packages/cli/src/command-implementations/dev-command.ts b/packages/cli/src/command-implementations/dev-command.ts index 9afe286a250..505bd99770c 100644 --- a/packages/cli/src/command-implementations/dev-command.ts +++ b/packages/cli/src/command-implementations/dev-command.ts @@ -146,8 +146,11 @@ export class DevCommand extends ProjectCommand { return } - const typescriptEvents = events.filter((e) => pathlib.extname(e.path) === '.ts') - const distEvents = events.filter((e) => e.path.startsWith(this.projectPaths.abs.outDir)) + const typescriptEvents = events + .filter((e) => !e.path.startsWith(this.projectPaths.abs.outDir)) + .filter((e) => pathlib.extname(e.path) === '.ts') + + const distEvents = events.filter((e) => e.path.startsWith(this.projectPaths.abs.distDir)) if (typescriptEvents.length > 0) { this.logger.log('Changes detected, rebuilding')