@botpress/adk 1.13.17 → 1.13.19
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.
- package/dist/bot-generator/generator.d.ts +8 -0
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/commands/base-command.d.ts +1 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/bp-dev-command.d.ts.map +1 -1
- package/dist/index.js +138 -39
- package/dist/index.js.map +10 -9
- package/dist/integrations/checker.d.ts.map +1 -1
- package/dist/integrations/config-utils.d.ts +26 -0
- package/dist/integrations/config-utils.d.ts.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/sync-manager.d.ts.map +1 -1
- package/dist/preflight/checker.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { SyncCallbacks } from '../preflight/types.js';
|
|
1
2
|
export interface BotGeneratorOptions {
|
|
2
3
|
projectPath: string;
|
|
3
4
|
outputPath?: string;
|
|
4
5
|
adkCommand?: 'adk-dev' | 'adk-build' | 'adk-deploy';
|
|
6
|
+
callbacks?: SyncCallbacks;
|
|
5
7
|
}
|
|
6
8
|
export declare class BotGenerator {
|
|
7
9
|
private projectPath;
|
|
8
10
|
private outputPath;
|
|
11
|
+
private callbacks?;
|
|
9
12
|
constructor(options: BotGeneratorOptions);
|
|
10
13
|
private listFilesRecursive;
|
|
11
14
|
private removeEmptyDirectories;
|
|
@@ -25,6 +28,11 @@ export declare class BotGenerator {
|
|
|
25
28
|
private generateInterfacesTypes;
|
|
26
29
|
private generateIntegrationsDefinition;
|
|
27
30
|
private generateInterfacesDefinition;
|
|
31
|
+
/**
|
|
32
|
+
* Report the result of fetching and merging server-side integration configs.
|
|
33
|
+
* Only emits messages when there's something meaningful to report.
|
|
34
|
+
*/
|
|
35
|
+
private reportServerConfigSync;
|
|
28
36
|
private generateBotDefinition;
|
|
29
37
|
private generateBotIndex;
|
|
30
38
|
private generatePackageJson;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AA0B1D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;IACnD,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B;AAoBD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,SAAS,CAAC,CAAe;gBAErB,OAAO,EAAE,mBAAmB;YAM1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,yBAAyB;YAkEzB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,mBAAmB;YAMnB,8BAA8B;YAM9B,oBAAoB;YAyEpB,uBAAuB;YAkGvB,8BAA8B;YAiC9B,4BAA4B;IA2B1C;;;OAGG;IACH,OAAO,CAAC,sBAAsB;YA8ChB,qBAAqB;YAkZrB,gBAAgB;YAyChB,mBAAmB;YAgBnB,gBAAgB;YAiChB,mBAAmB;YAyBnB,UAAU;YAWV,aAAa;IAgBrB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6ZnC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAOzC;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CpF"}
|
|
@@ -19,6 +19,7 @@ export declare abstract class BaseCommand<TProgress extends BaseProgressEvent =
|
|
|
19
19
|
protected events: EventEmitter<[never]>;
|
|
20
20
|
private deferred;
|
|
21
21
|
on<K extends keyof BaseCommandEvents<TProgress, TDone>>(event: K, listener: BaseCommandEvents<TProgress, TDone>[K]): void;
|
|
22
|
+
off<K extends keyof BaseCommandEvents<TProgress, TDone>>(event: K, listener: BaseCommandEvents<TProgress, TDone>[K]): void;
|
|
22
23
|
protected emit<K extends keyof BaseCommandEvents<TProgress, TDone>>(event: K, ...args: Parameters<BaseCommandEvents<TProgress, TDone>[K]>): void;
|
|
23
24
|
output(): Promise<TDone>;
|
|
24
25
|
abstract run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/commands/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB,CAAC,SAAS,SAAS,iBAAiB,GAAG,iBAAiB,EAAE,KAAK,GAAG,KAAK;IACvG,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACpC,KAAK,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAC7E,IAAI,EAA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AClB,CAAA;CACF,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF,GACD;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF,CAAA;AAEL,qBAAa,YAAa,SAAQ,WAAW,CAAC,kBAAkB,CAAC;IASnD,OAAO,CAAC,OAAO;IAR3B,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAK;IAGtC,OAAO,CAAC,cAAc,CAAiE;gBAEnE,OAAO,EAAE,mBAAmB;IAI1C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4J1B,OAAO,CAAC,WAAW;YA8GL,yBAAyB;IAqBvC,IAAI,CAAC,MAAM,GAAE,MAAM,CAAC,OAAmB,GAAG,IAAI;IAOxC,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;IAUtC,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,kBAAkB,GAAG,SAAS;IAIlF,oBAAoB,IAAI,kBAAkB,EAAE;CAG7C"}
|
package/dist/index.js
CHANGED
|
@@ -666,7 +666,7 @@ var PRETTIER_CONFIG, formatCode = async (code, filepath) => {
|
|
|
666
666
|
`));
|
|
667
667
|
return code;
|
|
668
668
|
}
|
|
669
|
-
}, ADK_VERSION = "1.13.
|
|
669
|
+
}, ADK_VERSION = "1.13.19", relative2 = (from, to) => {
|
|
670
670
|
const fromDir = path10.dirname(from);
|
|
671
671
|
const relative3 = path10.relative(fromDir, to);
|
|
672
672
|
return relative3.startsWith(".") ? relative3 : `./${relative3}`;
|
|
@@ -809,7 +809,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
809
809
|
var require_package = __commonJS((exports, module) => {
|
|
810
810
|
module.exports = {
|
|
811
811
|
name: "@botpress/adk",
|
|
812
|
-
version: "1.13.
|
|
812
|
+
version: "1.13.19",
|
|
813
813
|
description: "Core ADK library for building AI agents on Botpress",
|
|
814
814
|
type: "module",
|
|
815
815
|
main: "dist/index.js",
|
|
@@ -856,7 +856,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
856
856
|
"@botpress/cli": "^5.2.0",
|
|
857
857
|
"@botpress/client": "^1.28.0",
|
|
858
858
|
"@botpress/cognitive": "^0.3.3",
|
|
859
|
-
"@botpress/runtime": "^1.13.
|
|
859
|
+
"@botpress/runtime": "^1.13.19",
|
|
860
860
|
"@botpress/sdk": "^5.1.0",
|
|
861
861
|
"@bpinternal/jex": "^1.2.4",
|
|
862
862
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -1072,6 +1072,9 @@ class BaseCommand {
|
|
|
1072
1072
|
on(event, listener) {
|
|
1073
1073
|
this.events.on(event, listener);
|
|
1074
1074
|
}
|
|
1075
|
+
off(event, listener) {
|
|
1076
|
+
this.events.off(event, listener);
|
|
1077
|
+
}
|
|
1075
1078
|
emit(event, ...args) {
|
|
1076
1079
|
if (event === "done") {
|
|
1077
1080
|
this.deferred.resolve(args[0]);
|
|
@@ -1617,7 +1620,16 @@ class BpDevCommand extends BaseCommand {
|
|
|
1617
1620
|
if (this.childProcess.stdout) {
|
|
1618
1621
|
this.childProcess.stdout.on("data", (data) => {
|
|
1619
1622
|
const text = data.toString();
|
|
1620
|
-
|
|
1623
|
+
if (text.includes('"worker_stats"')) {
|
|
1624
|
+
const nonWorkerStatsText = text.split(`
|
|
1625
|
+
`).filter((line) => !line.includes('"type":"worker_stats"') && !line.includes('"type": "worker_stats"')).join(`
|
|
1626
|
+
`);
|
|
1627
|
+
if (nonWorkerStatsText.trim()) {
|
|
1628
|
+
this.parseOutput(nonWorkerStatsText);
|
|
1629
|
+
}
|
|
1630
|
+
} else {
|
|
1631
|
+
this.parseOutput(text);
|
|
1632
|
+
}
|
|
1621
1633
|
this.emit("stdout", text);
|
|
1622
1634
|
});
|
|
1623
1635
|
}
|
|
@@ -3426,7 +3438,62 @@ class IntegrationOperations {
|
|
|
3426
3438
|
}
|
|
3427
3439
|
}
|
|
3428
3440
|
// src/integrations/checker.ts
|
|
3441
|
+
import { Client as Client9 } from "@botpress/client";
|
|
3442
|
+
|
|
3443
|
+
// src/integrations/config-utils.ts
|
|
3429
3444
|
import { Client as Client8 } from "@botpress/client";
|
|
3445
|
+
function mergeIntegrationConfig(current, desired) {
|
|
3446
|
+
if (desired === undefined) {
|
|
3447
|
+
return current || {};
|
|
3448
|
+
}
|
|
3449
|
+
return { ...current || {}, ...desired };
|
|
3450
|
+
}
|
|
3451
|
+
function configsMatch(current, desired, schemaDefaults = {}) {
|
|
3452
|
+
return Object.keys(desired).every((key) => {
|
|
3453
|
+
const currentValue = current?.[key] ?? schemaDefaults[key];
|
|
3454
|
+
const desiredValue = desired[key] ?? schemaDefaults[key];
|
|
3455
|
+
return JSON.stringify(currentValue) === JSON.stringify(desiredValue);
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
async function fetchServerIntegrationConfigs(project) {
|
|
3459
|
+
const { devId, botId } = project.agentInfo ?? {};
|
|
3460
|
+
const targetId = devId || botId;
|
|
3461
|
+
if (!targetId) {
|
|
3462
|
+
return { configs: {}, fetched: false, skipped: true };
|
|
3463
|
+
}
|
|
3464
|
+
try {
|
|
3465
|
+
const credentials = await auth.getActiveCredentials();
|
|
3466
|
+
const client = new Client8({
|
|
3467
|
+
token: credentials.token,
|
|
3468
|
+
apiUrl: credentials.apiUrl,
|
|
3469
|
+
workspaceId: project.agentInfo?.workspaceId || credentials.workspaceId,
|
|
3470
|
+
headers: { "x-multiple-integrations": "true" }
|
|
3471
|
+
});
|
|
3472
|
+
try {
|
|
3473
|
+
return await fetchBotConfigs(client, targetId);
|
|
3474
|
+
} catch (err) {
|
|
3475
|
+
if (devId && botId && devId !== botId) {
|
|
3476
|
+
return await fetchBotConfigs(client, botId);
|
|
3477
|
+
}
|
|
3478
|
+
throw err;
|
|
3479
|
+
}
|
|
3480
|
+
} catch (err) {
|
|
3481
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3482
|
+
return { configs: {}, fetched: false, skipped: false, error: message };
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
async function fetchBotConfigs(client, botId) {
|
|
3486
|
+
const { bot } = await client.getBot({ id: botId });
|
|
3487
|
+
const configs = {};
|
|
3488
|
+
for (const [alias, integration] of Object.entries(bot.integrations || {})) {
|
|
3489
|
+
if (integration.configuration && Object.keys(integration.configuration).length > 0) {
|
|
3490
|
+
configs[alias] = integration.configuration;
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
return { configs, fetched: true, skipped: false };
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
// src/integrations/checker.ts
|
|
3430
3497
|
class IntegrationChecker {
|
|
3431
3498
|
projectPath;
|
|
3432
3499
|
client;
|
|
@@ -3441,7 +3508,7 @@ class IntegrationChecker {
|
|
|
3441
3508
|
if (!workspaceId) {
|
|
3442
3509
|
throw new Error('No workspace ID found. Please login with "adk login"');
|
|
3443
3510
|
}
|
|
3444
|
-
this.client = new
|
|
3511
|
+
this.client = new Client9({
|
|
3445
3512
|
token: credentials.token,
|
|
3446
3513
|
apiUrl: credentials.apiUrl,
|
|
3447
3514
|
workspaceId,
|
|
@@ -3579,17 +3646,8 @@ class IntegrationChecker {
|
|
|
3579
3646
|
if (config !== undefined) {
|
|
3580
3647
|
const configType = configurationType ?? installedIntegration.configurationType;
|
|
3581
3648
|
const schema = configType && definition.configurations?.[configType]?.schema || definition.configurations?.["default"]?.schema || definition.configuration?.schema;
|
|
3582
|
-
const
|
|
3583
|
-
|
|
3584
|
-
...Object.keys(installedIntegration.configuration || {}),
|
|
3585
|
-
...Object.keys(config || {})
|
|
3586
|
-
]);
|
|
3587
|
-
const configsMatch = Array.from(allKeys).every((key) => {
|
|
3588
|
-
const currentValue = installedIntegration.configuration?.[key] ?? schemaProperties[key]?.default;
|
|
3589
|
-
const desiredValue = config?.[key] ?? schemaProperties[key]?.default;
|
|
3590
|
-
return JSON.stringify(currentValue) === JSON.stringify(desiredValue);
|
|
3591
|
-
});
|
|
3592
|
-
if (!configsMatch) {
|
|
3649
|
+
const schemaDefaults = Object.fromEntries(Object.entries(schema?.properties || {}).flatMap(([k, v]) => v?.default !== undefined ? [[k, v.default]] : []));
|
|
3650
|
+
if (!configsMatch(installedIntegration.configuration, config, schemaDefaults)) {
|
|
3593
3651
|
result.needsConfiguration = true;
|
|
3594
3652
|
}
|
|
3595
3653
|
}
|
|
@@ -3605,7 +3663,7 @@ class IntegrationChecker {
|
|
|
3605
3663
|
}
|
|
3606
3664
|
}
|
|
3607
3665
|
// src/integrations/sync-manager.ts
|
|
3608
|
-
import { Client as
|
|
3666
|
+
import { Client as Client10 } from "@botpress/client";
|
|
3609
3667
|
function normalizeConfigurationType(configType) {
|
|
3610
3668
|
if (configType === "default" || configType === null) {
|
|
3611
3669
|
return;
|
|
@@ -3627,7 +3685,7 @@ class IntegrationSyncManager {
|
|
|
3627
3685
|
if (!workspaceId) {
|
|
3628
3686
|
throw new Error('No workspace ID found. Please login with "adk login"');
|
|
3629
3687
|
}
|
|
3630
|
-
this.client = new
|
|
3688
|
+
this.client = new Client10({
|
|
3631
3689
|
token: credentials.token,
|
|
3632
3690
|
apiUrl: credentials.apiUrl,
|
|
3633
3691
|
workspaceId,
|
|
@@ -3670,7 +3728,7 @@ class IntegrationSyncManager {
|
|
|
3670
3728
|
[result.alias]: {
|
|
3671
3729
|
integrationId: result.desiredIntegrationId || result.definition.id,
|
|
3672
3730
|
enabled: result.desiredInstallStatus === "enabled",
|
|
3673
|
-
configuration: result.desiredConfiguration
|
|
3731
|
+
configuration: mergeIntegrationConfig(result.currentConfiguration, result.desiredConfiguration),
|
|
3674
3732
|
configurationType: normalizeConfigurationType(result.desiredConfigurationType)
|
|
3675
3733
|
}
|
|
3676
3734
|
}
|
|
@@ -3689,7 +3747,7 @@ class IntegrationSyncManager {
|
|
|
3689
3747
|
[result.alias]: {
|
|
3690
3748
|
integrationId: result.desiredIntegrationId || result.definition.id,
|
|
3691
3749
|
enabled: result.desiredInstallStatus === "enabled",
|
|
3692
|
-
configuration: result.desiredConfiguration
|
|
3750
|
+
configuration: mergeIntegrationConfig(result.currentConfiguration, result.desiredConfiguration),
|
|
3693
3751
|
configurationType: normalizeConfigurationType(result.desiredConfigurationType)
|
|
3694
3752
|
}
|
|
3695
3753
|
}
|
|
@@ -3706,7 +3764,7 @@ class IntegrationSyncManager {
|
|
|
3706
3764
|
}
|
|
3707
3765
|
}
|
|
3708
3766
|
// src/interfaces/manager.ts
|
|
3709
|
-
import { Client as
|
|
3767
|
+
import { Client as Client11 } from "@botpress/client";
|
|
3710
3768
|
|
|
3711
3769
|
// src/interfaces/enhanced-cache.ts
|
|
3712
3770
|
import fs9 from "fs/promises";
|
|
@@ -3877,7 +3935,7 @@ class InterfaceManager {
|
|
|
3877
3935
|
if (!this.options.workspaceId && !credentials.workspaceId) {
|
|
3878
3936
|
throw new Error('No workspace ID found in current profile. Please login again with "adk login"');
|
|
3879
3937
|
}
|
|
3880
|
-
this.client = new
|
|
3938
|
+
this.client = new Client11({
|
|
3881
3939
|
token: credentials.token,
|
|
3882
3940
|
apiUrl: credentials.apiUrl,
|
|
3883
3941
|
workspaceId: this.options.workspaceId || credentials.workspaceId,
|
|
@@ -4875,7 +4933,7 @@ init_validation_errors();
|
|
|
4875
4933
|
init_agent_resolver();
|
|
4876
4934
|
init_types();
|
|
4877
4935
|
// src/config/manager.ts
|
|
4878
|
-
import { Client as
|
|
4936
|
+
import { Client as Client12 } from "@botpress/client";
|
|
4879
4937
|
import { sync as jex } from "@bpinternal/jex";
|
|
4880
4938
|
class ConfigManager {
|
|
4881
4939
|
botId;
|
|
@@ -4886,7 +4944,7 @@ class ConfigManager {
|
|
|
4886
4944
|
async getClient() {
|
|
4887
4945
|
if (!this.client) {
|
|
4888
4946
|
const credentials = await auth.getActiveCredentials();
|
|
4889
|
-
this.client = new
|
|
4947
|
+
this.client = new Client12({
|
|
4890
4948
|
token: credentials.token,
|
|
4891
4949
|
apiUrl: credentials.apiUrl,
|
|
4892
4950
|
botId: this.botId,
|
|
@@ -6347,7 +6405,7 @@ class AgentProjectGenerator {
|
|
|
6347
6405
|
deploy: "adk deploy"
|
|
6348
6406
|
},
|
|
6349
6407
|
dependencies: {
|
|
6350
|
-
"@botpress/runtime": `^${"1.13.
|
|
6408
|
+
"@botpress/runtime": `^${"1.13.19"}`
|
|
6351
6409
|
},
|
|
6352
6410
|
devDependencies: {
|
|
6353
6411
|
typescript: "^5.9.3"
|
|
@@ -7694,7 +7752,7 @@ async function linkSdk(agentDir, botDir) {
|
|
|
7694
7752
|
import path28 from "path";
|
|
7695
7753
|
import fs13 from "fs/promises";
|
|
7696
7754
|
import { existsSync as existsSync4 } from "fs";
|
|
7697
|
-
import { Client as
|
|
7755
|
+
import { Client as Client13 } from "@botpress/client";
|
|
7698
7756
|
class DevIdManager {
|
|
7699
7757
|
projectPath;
|
|
7700
7758
|
botProjectPath;
|
|
@@ -7713,7 +7771,7 @@ class DevIdManager {
|
|
|
7713
7771
|
if (!workspaceId) {
|
|
7714
7772
|
throw new Error('No workspace ID found in agent.json or current profile. Please login again with "adk login"');
|
|
7715
7773
|
}
|
|
7716
|
-
this.client = new
|
|
7774
|
+
this.client = new Client13({
|
|
7717
7775
|
token: credentials.token,
|
|
7718
7776
|
apiUrl: credentials.apiUrl,
|
|
7719
7777
|
workspaceId,
|
|
@@ -8042,6 +8100,7 @@ import { transforms as transforms3 } from "@botpress/sdk";
|
|
|
8042
8100
|
init_constants();
|
|
8043
8101
|
import { BuiltInActions as BuiltInActions2, BuiltInWorkflows as BuiltInWorkflows3, Primitives as Primitives3 } from "@botpress/runtime/internal";
|
|
8044
8102
|
import { BUILT_IN_TAGS as BUILT_IN_TAGS2 } from "@botpress/runtime/definition";
|
|
8103
|
+
var plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
8045
8104
|
function isBuiltinWorkflow2(name) {
|
|
8046
8105
|
return !!Object.values(BuiltInWorkflows3).find((x) => x.name === name);
|
|
8047
8106
|
}
|
|
@@ -8055,9 +8114,11 @@ function getImportPath(from, to) {
|
|
|
8055
8114
|
class BotGenerator {
|
|
8056
8115
|
projectPath;
|
|
8057
8116
|
outputPath;
|
|
8117
|
+
callbacks;
|
|
8058
8118
|
constructor(options) {
|
|
8059
8119
|
this.projectPath = path33.resolve(options.projectPath);
|
|
8060
8120
|
this.outputPath = path33.resolve(options.outputPath || path33.join(this.projectPath, ".adk"));
|
|
8121
|
+
this.callbacks = options.callbacks;
|
|
8061
8122
|
}
|
|
8062
8123
|
async listFilesRecursive(rootDir) {
|
|
8063
8124
|
try {
|
|
@@ -8395,17 +8456,54 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
8395
8456
|
`;
|
|
8396
8457
|
await createFile(path33.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
|
|
8397
8458
|
}
|
|
8459
|
+
reportServerConfigSync(serverConfigResult, integrations) {
|
|
8460
|
+
if (!this.callbacks) {
|
|
8461
|
+
return;
|
|
8462
|
+
}
|
|
8463
|
+
if (serverConfigResult.error) {
|
|
8464
|
+
this.callbacks.onError?.(`Failed to fetch remote configs: ${serverConfigResult.error}. Server-only config values may be overwritten.`);
|
|
8465
|
+
return;
|
|
8466
|
+
}
|
|
8467
|
+
if (!serverConfigResult.fetched) {
|
|
8468
|
+
return;
|
|
8469
|
+
}
|
|
8470
|
+
const configCount = Object.keys(serverConfigResult.configs).length;
|
|
8471
|
+
if (configCount === 0) {
|
|
8472
|
+
return;
|
|
8473
|
+
}
|
|
8474
|
+
this.callbacks.onSuccess?.(`Preserved remote configs for ${plural(configCount, "integration")}`);
|
|
8475
|
+
for (const { alias, config: localConfig } of integrations) {
|
|
8476
|
+
const serverConfig = serverConfigResult.configs[alias];
|
|
8477
|
+
if (!serverConfig || Object.keys(serverConfig).length === 0) {
|
|
8478
|
+
continue;
|
|
8479
|
+
}
|
|
8480
|
+
const preserved = Object.keys(serverConfig).filter((key) => !localConfig || !(key in localConfig));
|
|
8481
|
+
if (preserved.length > 0) {
|
|
8482
|
+
this.callbacks.onProgress?.(` ${alias}: preserved ${plural(preserved.length, "remote field")} (${preserved.join(", ")})`);
|
|
8483
|
+
}
|
|
8484
|
+
if (localConfig) {
|
|
8485
|
+
const overridden = Object.keys(localConfig).filter((key) => (key in serverConfig) && localConfig[key] !== serverConfig[key]);
|
|
8486
|
+
if (overridden.length > 0) {
|
|
8487
|
+
this.callbacks.onProgress?.(` ${alias}: local overrides ${plural(overridden.length, "field")} (${overridden.join(", ")})`);
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
}
|
|
8491
|
+
}
|
|
8398
8492
|
async generateBotDefinition() {
|
|
8399
8493
|
const project = await AgentProject.load(this.projectPath);
|
|
8400
8494
|
const integrations = project.integrations;
|
|
8495
|
+
const enabledIntegrations = integrations.filter((i) => i.enabled);
|
|
8496
|
+
const serverConfigResult = await fetchServerIntegrationConfigs(project);
|
|
8497
|
+
this.reportServerConfigSync(serverConfigResult, enabledIntegrations);
|
|
8401
8498
|
const imports = [];
|
|
8402
8499
|
const addIntegrations = [];
|
|
8403
|
-
for (const integration of
|
|
8500
|
+
for (const integration of enabledIntegrations) {
|
|
8404
8501
|
const { alias, configurationType, config } = integration;
|
|
8405
8502
|
const importName = `integration_${getIntegrationAlias(alias)}`;
|
|
8406
8503
|
imports.push(`import ${importName} from "./bp_modules/${importName}";`);
|
|
8407
8504
|
const configType = configurationType && configurationType !== "default" ? `, configurationType: "${configurationType}"` : "";
|
|
8408
|
-
const
|
|
8505
|
+
const mergedConfig = mergeIntegrationConfig(serverConfigResult.configs[alias], config);
|
|
8506
|
+
const configData = Object.keys(mergedConfig).length > 0 ? `, configuration: ${JSON.stringify(mergedConfig)}` : "";
|
|
8409
8507
|
addIntegrations.push(`bot.addIntegration(${importName}, { alias: "${alias}", enabled: true${configType}${configData} });`);
|
|
8410
8508
|
}
|
|
8411
8509
|
const botTags = {};
|
|
@@ -9183,7 +9281,7 @@ async function generateBotProject(options) {
|
|
|
9183
9281
|
}
|
|
9184
9282
|
}
|
|
9185
9283
|
// src/tables/table-manager.ts
|
|
9186
|
-
import { Client as
|
|
9284
|
+
import { Client as Client14 } from "@botpress/client";
|
|
9187
9285
|
import { transforms as transforms4 } from "@botpress/sdk";
|
|
9188
9286
|
class TableManager {
|
|
9189
9287
|
client;
|
|
@@ -9197,7 +9295,7 @@ class TableManager {
|
|
|
9197
9295
|
if (!this.client) {
|
|
9198
9296
|
const credentials = await auth.getActiveCredentials();
|
|
9199
9297
|
this.assertBotId("initialize client");
|
|
9200
|
-
this.client = new
|
|
9298
|
+
this.client = new Client14({
|
|
9201
9299
|
token: credentials.token,
|
|
9202
9300
|
apiUrl: credentials.apiUrl,
|
|
9203
9301
|
botId: this.botId,
|
|
@@ -9685,7 +9783,7 @@ import crypto4 from "crypto";
|
|
|
9685
9783
|
import path34 from "path";
|
|
9686
9784
|
import fs17 from "fs/promises";
|
|
9687
9785
|
import { glob } from "glob";
|
|
9688
|
-
import { Client as
|
|
9786
|
+
import { Client as Client15 } from "@botpress/client";
|
|
9689
9787
|
import { DataSource } from "@botpress/runtime";
|
|
9690
9788
|
|
|
9691
9789
|
// src/knowledge/types.ts
|
|
@@ -9730,7 +9828,7 @@ class KnowledgeManager {
|
|
|
9730
9828
|
if (!this.client) {
|
|
9731
9829
|
const credentials = await auth.getActiveCredentials();
|
|
9732
9830
|
this.assertBotId("initialize client");
|
|
9733
|
-
this.client = new
|
|
9831
|
+
this.client = new Client15({
|
|
9734
9832
|
token: credentials.token,
|
|
9735
9833
|
apiUrl: credentials.apiUrl,
|
|
9736
9834
|
botId: this.botId,
|
|
@@ -10616,7 +10714,7 @@ class FileWatcher2 extends EventEmitter3 {
|
|
|
10616
10714
|
}
|
|
10617
10715
|
}
|
|
10618
10716
|
// src/preflight/checker.ts
|
|
10619
|
-
import { Client as
|
|
10717
|
+
import { Client as Client16 } from "@botpress/client";
|
|
10620
10718
|
import path35 from "path";
|
|
10621
10719
|
|
|
10622
10720
|
// src/preflight/types.ts
|
|
@@ -10831,7 +10929,7 @@ class PreflightChecker {
|
|
|
10831
10929
|
if (!workspaceId) {
|
|
10832
10930
|
throw new Error('No workspace ID found. Please login with "adk login"');
|
|
10833
10931
|
}
|
|
10834
|
-
this.client = new
|
|
10932
|
+
this.client = new Client16({
|
|
10835
10933
|
token: credentials.token,
|
|
10836
10934
|
apiUrl: credentials.apiUrl,
|
|
10837
10935
|
workspaceId,
|
|
@@ -10979,7 +11077,8 @@ class PreflightChecker {
|
|
|
10979
11077
|
options?.onProgress?.("Regenerating bot project...");
|
|
10980
11078
|
await generateBotProject({
|
|
10981
11079
|
projectPath: this.projectPath,
|
|
10982
|
-
outputPath: path35.join(this.projectPath, ".adk", "bot")
|
|
11080
|
+
outputPath: path35.join(this.projectPath, ".adk", "bot"),
|
|
11081
|
+
callbacks: options
|
|
10983
11082
|
});
|
|
10984
11083
|
options?.onSuccess?.("Bot project regenerated");
|
|
10985
11084
|
}
|
|
@@ -11184,10 +11283,10 @@ class ScriptRunner {
|
|
|
11184
11283
|
const runtimeModule = await import("@botpress/runtime/runtime");
|
|
11185
11284
|
const { Autonomous } = await import("@botpress/runtime");
|
|
11186
11285
|
const { context, agentRegistry } = runtimeModule;
|
|
11187
|
-
const { Client:
|
|
11286
|
+
const { Client: Client17 } = await import("@botpress/client");
|
|
11188
11287
|
const { BotSpecificClient, BotLogger } = await import("@botpress/sdk");
|
|
11189
11288
|
const { Cognitive } = await import("@botpress/cognitive");
|
|
11190
|
-
const vanillaClient = new
|
|
11289
|
+
const vanillaClient = new Client17({
|
|
11191
11290
|
token: this.credentials.token,
|
|
11192
11291
|
apiUrl: this.credentials.apiUrl,
|
|
11193
11292
|
botId
|
|
@@ -11368,4 +11467,4 @@ export {
|
|
|
11368
11467
|
AgentProject
|
|
11369
11468
|
};
|
|
11370
11469
|
|
|
11371
|
-
//# debugId=
|
|
11470
|
+
//# debugId=FB5A010697544F3364756E2164756E21
|