@wabot-dev/framework 0.9.14 → 0.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -244,16 +244,17 @@ class ProjectRunner {
244
244
  }
245
245
  }
246
246
  async resolveDefaultChatAdapters() {
247
- if (this.preloaded) {
248
- logger.warn('preloaded mode is enabled but no chatAdapters were provided in config; ' +
249
- 'default adapters will not be auto-loaded. Pass chatAdapters explicitly.');
250
- return [];
251
- }
252
247
  const keys = Object.keys(DEFAULT_ADAPTER_LOADERS);
248
+ const emptyKeys = [];
253
249
  const results = await Promise.all(keys.map(async (key) => {
254
250
  const { apiKeyEnv, load } = DEFAULT_ADAPTER_LOADERS[key];
255
- if (!process.env[apiKeyEnv])
251
+ const value = process.env[apiKeyEnv];
252
+ if (value === undefined)
253
+ return null;
254
+ if (value.trim() === '') {
255
+ emptyKeys.push(apiKeyEnv);
256
256
  return null;
257
+ }
257
258
  try {
258
259
  const adapter = await load();
259
260
  if (!adapter)
@@ -265,6 +266,10 @@ class ProjectRunner {
265
266
  return null;
266
267
  }
267
268
  }));
269
+ if (emptyKeys.length > 0) {
270
+ throw new Error(`Chat adapter API key(s) defined but empty: ${emptyKeys.join(', ')}. ` +
271
+ `Set a value in your .env or remove the variable entirely.`);
272
+ }
268
273
  return results.filter((a) => a != null);
269
274
  }
270
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -50,9 +50,9 @@
50
50
  "fmt": "prettier --write .",
51
51
  "fmt:check": "prettier --check .",
52
52
  "types:check": "tsc --noEmit",
53
- "elia:dev": "node --import @yucacodes/ts --import ./env.mjs ./test/elia/run.ts",
54
- "elia:watch": "node --watch --import @yucacodes/ts --import ./env.mjs ./test/elia/run.ts",
55
- "cmd:channel": "node --import @yucacodes/ts ./test/cmd.ts"
53
+ "elia:dev": "node --import @yucacodes/ts --import ./env.mjs ./test/elia/_run_.ts",
54
+ "elia:watch": "node --watch --import @yucacodes/ts --import ./env.mjs ./test/elia/_run_.ts",
55
+ "elia:cmd:channel": "node --import @yucacodes/ts ./test/elia/_cmd_.ts"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@rollup/plugin-alias": "5.1.1",