@botpress/adk 1.2.4 → 1.2.5
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/agent-project/agent-project.d.ts +6 -0
- package/dist/agent-project/agent-project.d.ts.map +1 -1
- package/dist/bot-generator/generator.d.ts +1 -0
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/generators/conversation-types.d.ts +3 -0
- package/dist/generators/conversation-types.d.ts.map +1 -0
- package/dist/generators/event-types.d.ts.map +1 -1
- package/dist/generators/integration-action-types.d.ts.map +1 -1
- package/dist/index.js +196 -112
- package/dist/index.js.map +8 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ var exports_action_types = {};
|
|
|
241
241
|
__export(exports_action_types, {
|
|
242
242
|
generateActionTypes: () => generateActionTypes
|
|
243
243
|
});
|
|
244
|
-
import
|
|
244
|
+
import path27 from "path";
|
|
245
245
|
async function generateActionTypes(project) {
|
|
246
246
|
const actionDefs = [];
|
|
247
247
|
for (const action of project.actions) {
|
|
@@ -249,7 +249,7 @@ async function generateActionTypes(project) {
|
|
|
249
249
|
continue;
|
|
250
250
|
}
|
|
251
251
|
try {
|
|
252
|
-
const absolutePath =
|
|
252
|
+
const absolutePath = path27.join(project.path, action.path);
|
|
253
253
|
const actionModule = await import(`${absolutePath}?t=${Date.now()}`);
|
|
254
254
|
const actionInstance = actionModule[action.export] || actionModule.default;
|
|
255
255
|
if (actionInstance && actionInstance.input && actionInstance.output) {
|
|
@@ -294,7 +294,7 @@ ${actionDefs.join(`
|
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
296
|
`;
|
|
297
|
-
const actionTypesPath =
|
|
297
|
+
const actionTypesPath = path27.join(project.path, ".adk", "action-types.d.ts");
|
|
298
298
|
await createFile(actionTypesPath, await formatCode(content));
|
|
299
299
|
}
|
|
300
300
|
var init_action_types = __esm(() => {
|
|
@@ -307,7 +307,7 @@ var exports_integration_action_types = {};
|
|
|
307
307
|
__export(exports_integration_action_types, {
|
|
308
308
|
generateIntegrationActionTypes: () => generateIntegrationActionTypes
|
|
309
309
|
});
|
|
310
|
-
import
|
|
310
|
+
import path28 from "path";
|
|
311
311
|
async function generateIntegrationActionTypes(project) {
|
|
312
312
|
const content = `
|
|
313
313
|
////////////////////////////////////////////////////////
|
|
@@ -317,6 +317,8 @@ async function generateIntegrationActionTypes(project) {
|
|
|
317
317
|
// Generated at: ${new Date().toISOString()}
|
|
318
318
|
////////////////////////////////////////////////////////
|
|
319
319
|
|
|
320
|
+
type Integrations = import("@botpress/runtime/_types/integrations").Integrations;
|
|
321
|
+
|
|
320
322
|
declare module "@botpress/runtime/_types/integration-actions" {
|
|
321
323
|
|
|
322
324
|
export interface CallableAction<I, O> {
|
|
@@ -339,7 +341,7 @@ type IntegrationsMap<T> = {
|
|
|
339
341
|
export type IntegrationActions = IntegrationsMap<Integrations>;
|
|
340
342
|
}
|
|
341
343
|
`;
|
|
342
|
-
const integrationActionTypesPath =
|
|
344
|
+
const integrationActionTypesPath = path28.join(project.path, ".adk", "integration-action-types.d.ts");
|
|
343
345
|
await createFile(integrationActionTypesPath, await formatCode(content));
|
|
344
346
|
}
|
|
345
347
|
var init_integration_action_types = __esm(() => {
|
|
@@ -4136,6 +4138,15 @@ class AgentProject {
|
|
|
4136
4138
|
console.warn(`Failed to register data source workflows for ${kbPath}:`, error);
|
|
4137
4139
|
}
|
|
4138
4140
|
}
|
|
4141
|
+
getChannelsList(channelSpec) {
|
|
4142
|
+
if (channelSpec === "*") {
|
|
4143
|
+
return ["*"];
|
|
4144
|
+
} else if (Array.isArray(channelSpec)) {
|
|
4145
|
+
return channelSpec;
|
|
4146
|
+
} else {
|
|
4147
|
+
return [channelSpec];
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4139
4150
|
async loadAgentPrimitives() {
|
|
4140
4151
|
if (this._options.adkCommand) {
|
|
4141
4152
|
setAdkCommand(this._options.adkCommand);
|
|
@@ -4201,13 +4212,17 @@ class AgentProject {
|
|
|
4201
4212
|
throw error;
|
|
4202
4213
|
}
|
|
4203
4214
|
if (Primitives2.Definitions.isConversationDefinition(definition)) {
|
|
4204
|
-
const
|
|
4205
|
-
|
|
4215
|
+
const overlapping = this._conversations.find((p) => {
|
|
4216
|
+
const existingChannels = this.getChannelsList(p.definition.channel);
|
|
4217
|
+
const newChannels = this.getChannelsList(definition.channel);
|
|
4218
|
+
return existingChannels.some((ch) => newChannels.includes(ch));
|
|
4219
|
+
});
|
|
4220
|
+
if (overlapping) {
|
|
4206
4221
|
this._warnings.push({
|
|
4207
4222
|
$type: "ValidationError",
|
|
4208
4223
|
code: "DUPLICATE_PRIMITIVE" /* DUPLICATE_PRIMITIVE */,
|
|
4209
4224
|
severity: "warning" /* WARNING */,
|
|
4210
|
-
message: `
|
|
4225
|
+
message: `Overlapping conversation channels found: ${filename} -> ${key} overlaps with ${overlapping.path} -> ${overlapping.export}`,
|
|
4211
4226
|
file: relPath
|
|
4212
4227
|
});
|
|
4213
4228
|
continue;
|
|
@@ -4961,7 +4976,7 @@ Description: ${tag?.description}`);
|
|
|
4961
4976
|
import dedent from "dedent";
|
|
4962
4977
|
import { existsSync as existsSync5 } from "fs";
|
|
4963
4978
|
import fs15 from "fs/promises";
|
|
4964
|
-
import
|
|
4979
|
+
import path29 from "path";
|
|
4965
4980
|
|
|
4966
4981
|
// src/generators/interface-types.ts
|
|
4967
4982
|
import { transforms as transforms2 } from "@botpress/sdk";
|
|
@@ -5341,10 +5356,78 @@ ${typeDefinitions || " // No workflows defined yet"}
|
|
|
5341
5356
|
await createFile(workflowTypesPath, await formatCode(content));
|
|
5342
5357
|
}
|
|
5343
5358
|
|
|
5344
|
-
// src/generators/
|
|
5359
|
+
// src/generators/conversation-types.ts
|
|
5345
5360
|
init_utils();
|
|
5346
5361
|
init_fs();
|
|
5347
5362
|
import path22 from "path";
|
|
5363
|
+
async function generateConversationTypes(project) {
|
|
5364
|
+
const conversationTypes = {};
|
|
5365
|
+
for (const conversationRef of project.conversations) {
|
|
5366
|
+
console.log(`[ConversationTypes] Processing conversation: ${conversationRef.export}`);
|
|
5367
|
+
try {
|
|
5368
|
+
const conversationPath = path22.join(project.path, conversationRef.path);
|
|
5369
|
+
const conversationModule = await import(`${conversationPath}?t=${Date.now()}`);
|
|
5370
|
+
const conversationInstance = conversationModule[conversationRef.export] || conversationModule.default;
|
|
5371
|
+
if (!conversationInstance) {
|
|
5372
|
+
continue;
|
|
5373
|
+
}
|
|
5374
|
+
const channel = conversationInstance.channel;
|
|
5375
|
+
const stateType = conversationInstance.schema ? conversationInstance.schema.toTypescriptType?.() || "any" : "{}";
|
|
5376
|
+
let channels;
|
|
5377
|
+
if (channel === "*") {
|
|
5378
|
+
channels = ["*"];
|
|
5379
|
+
} else if (Array.isArray(channel)) {
|
|
5380
|
+
channels = channel;
|
|
5381
|
+
} else {
|
|
5382
|
+
channels = [channel];
|
|
5383
|
+
}
|
|
5384
|
+
for (const ch of channels) {
|
|
5385
|
+
conversationTypes[ch] = {
|
|
5386
|
+
channel: ch,
|
|
5387
|
+
state: stateType
|
|
5388
|
+
};
|
|
5389
|
+
}
|
|
5390
|
+
} catch (error) {
|
|
5391
|
+
console.error(`Failed to process conversation ${conversationRef.export}:`, error);
|
|
5392
|
+
}
|
|
5393
|
+
}
|
|
5394
|
+
const channelDefinitions = Object.entries(conversationTypes).filter(([channel]) => channel !== "*").map(([channel, info]) => {
|
|
5395
|
+
const [integration, channelName] = channel.split(".");
|
|
5396
|
+
return ` "${channel}": {
|
|
5397
|
+
channel: "${channel}";
|
|
5398
|
+
integration: "${integration}";
|
|
5399
|
+
state: ${info.state};
|
|
5400
|
+
tags: Integrations["${integration}"]["channels"]["${channelName}"]["conversation"]["tags"];
|
|
5401
|
+
messageTags: Integrations["${integration}"]["channels"]["${channelName}"]["message"]["tags"];
|
|
5402
|
+
messages: Integrations["${integration}"]["channels"]["${channelName}"]["messages"];
|
|
5403
|
+
events: Integrations["${integration}"]["events"];
|
|
5404
|
+
};`;
|
|
5405
|
+
}).join(`
|
|
5406
|
+
`);
|
|
5407
|
+
const content = `
|
|
5408
|
+
////////////////////////////////////////////////////////
|
|
5409
|
+
// DO NOT EDIT THIS FILE DIRECTLY
|
|
5410
|
+
// This file is auto-generated from the Botpress ADK
|
|
5411
|
+
// ADK Version: ${ADK_VERSION}
|
|
5412
|
+
// Generated at: ${new Date().toISOString()}
|
|
5413
|
+
////////////////////////////////////////////////////////
|
|
5414
|
+
|
|
5415
|
+
type Integrations = import("@botpress/runtime/_types/integrations").Integrations;
|
|
5416
|
+
|
|
5417
|
+
declare module "@botpress/runtime/_types/conversations" {
|
|
5418
|
+
export type ConversationDefinitions = {
|
|
5419
|
+
${channelDefinitions || " // No conversations defined yet"}
|
|
5420
|
+
};
|
|
5421
|
+
}
|
|
5422
|
+
`;
|
|
5423
|
+
const conversationTypesPath = path22.join(project.path, ".adk", "conversation-types.d.ts");
|
|
5424
|
+
await createFile(conversationTypesPath, await formatCode(content));
|
|
5425
|
+
}
|
|
5426
|
+
|
|
5427
|
+
// src/generators/event-types.ts
|
|
5428
|
+
init_utils();
|
|
5429
|
+
init_fs();
|
|
5430
|
+
import path23 from "path";
|
|
5348
5431
|
async function generateEventTypes(project) {
|
|
5349
5432
|
const integrationEvents = [];
|
|
5350
5433
|
for (const int of project.integrations) {
|
|
@@ -5360,6 +5443,8 @@ async function generateEventTypes(project) {
|
|
|
5360
5443
|
// Generated at: ${new Date().toISOString()}
|
|
5361
5444
|
////////////////////////////////////////////////////////
|
|
5362
5445
|
|
|
5446
|
+
type Integrations = import("@botpress/runtime/_types/integrations").Integrations;
|
|
5447
|
+
|
|
5363
5448
|
declare module "@botpress/runtime/_types/events" {
|
|
5364
5449
|
/**
|
|
5365
5450
|
* Global Events type that includes all integration events.
|
|
@@ -5381,7 +5466,7 @@ ${integrationEvents.join(`
|
|
|
5381
5466
|
export type EventPayload<T extends EventName> = Events[T];
|
|
5382
5467
|
}
|
|
5383
5468
|
`;
|
|
5384
|
-
const eventTypesPath =
|
|
5469
|
+
const eventTypesPath = path23.join(project.path, ".adk", "event-types.d.ts");
|
|
5385
5470
|
await createFile(eventTypesPath, await formatCode(content));
|
|
5386
5471
|
}
|
|
5387
5472
|
|
|
@@ -5389,7 +5474,7 @@ ${integrationEvents.join(`
|
|
|
5389
5474
|
init_fs();
|
|
5390
5475
|
|
|
5391
5476
|
// src/bot-generator/dev-id-manager.ts
|
|
5392
|
-
import
|
|
5477
|
+
import path24 from "path";
|
|
5393
5478
|
import fs12 from "fs/promises";
|
|
5394
5479
|
import { existsSync as existsSync2 } from "fs";
|
|
5395
5480
|
import { Client as Client9 } from "@botpress/client";
|
|
@@ -5401,7 +5486,7 @@ class DevIdManager {
|
|
|
5401
5486
|
constructor(projectPath, botProjectPath) {
|
|
5402
5487
|
this.projectPath = projectPath;
|
|
5403
5488
|
this.botProjectPath = botProjectPath;
|
|
5404
|
-
this.projectCachePath =
|
|
5489
|
+
this.projectCachePath = path24.join(botProjectPath, ".botpress", "project.cache.json");
|
|
5405
5490
|
}
|
|
5406
5491
|
async getClient() {
|
|
5407
5492
|
if (!this.client) {
|
|
@@ -5435,7 +5520,7 @@ class DevIdManager {
|
|
|
5435
5520
|
}
|
|
5436
5521
|
async saveProjectCache(cache2) {
|
|
5437
5522
|
try {
|
|
5438
|
-
await fs12.mkdir(
|
|
5523
|
+
await fs12.mkdir(path24.dirname(this.projectCachePath), { recursive: true });
|
|
5439
5524
|
await fs12.writeFile(this.projectCachePath, JSON.stringify(cache2, null, 2));
|
|
5440
5525
|
} catch (error) {
|
|
5441
5526
|
console.error("Error saving project.cache.json:", error);
|
|
@@ -5489,7 +5574,7 @@ class DevIdManager {
|
|
|
5489
5574
|
}
|
|
5490
5575
|
|
|
5491
5576
|
// src/bot-generator/integration-sync.ts
|
|
5492
|
-
import
|
|
5577
|
+
import path25 from "path";
|
|
5493
5578
|
import fs13 from "fs/promises";
|
|
5494
5579
|
import { existsSync as existsSync3 } from "fs";
|
|
5495
5580
|
class IntegrationSync {
|
|
@@ -5499,7 +5584,7 @@ class IntegrationSync {
|
|
|
5499
5584
|
constructor(projectPath, botProjectPath) {
|
|
5500
5585
|
this.projectPath = projectPath;
|
|
5501
5586
|
this.botProjectPath = botProjectPath;
|
|
5502
|
-
this.bpModulesPath =
|
|
5587
|
+
this.bpModulesPath = path25.join(botProjectPath, "bp_modules");
|
|
5503
5588
|
}
|
|
5504
5589
|
async parseIntegrations() {
|
|
5505
5590
|
const project = await AgentProject.load(this.projectPath);
|
|
@@ -5530,12 +5615,12 @@ class IntegrationSync {
|
|
|
5530
5615
|
return integrations;
|
|
5531
5616
|
}
|
|
5532
5617
|
async isIntegrationSynced(integration) {
|
|
5533
|
-
const targetFolder =
|
|
5618
|
+
const targetFolder = path25.join(this.bpModulesPath, `integration_${integration.alias}`);
|
|
5534
5619
|
if (!existsSync3(targetFolder)) {
|
|
5535
5620
|
return false;
|
|
5536
5621
|
}
|
|
5537
5622
|
try {
|
|
5538
|
-
const indexPath =
|
|
5623
|
+
const indexPath = path25.join(targetFolder, "index.ts");
|
|
5539
5624
|
if (!existsSync3(indexPath)) {
|
|
5540
5625
|
return false;
|
|
5541
5626
|
}
|
|
@@ -5568,8 +5653,8 @@ class IntegrationSync {
|
|
|
5568
5653
|
}
|
|
5569
5654
|
async renameIntegrationFolder(integration) {
|
|
5570
5655
|
console.log(integration.name, integration.alias);
|
|
5571
|
-
const sourceFolder =
|
|
5572
|
-
const targetFolder =
|
|
5656
|
+
const sourceFolder = path25.join(this.bpModulesPath, integration.name.replace("/", "-"));
|
|
5657
|
+
const targetFolder = path25.join(this.bpModulesPath, `integration_${integration.alias}`);
|
|
5573
5658
|
if (!existsSync3(sourceFolder)) {
|
|
5574
5659
|
throw new Error(`Integration folder not found: ${sourceFolder}`);
|
|
5575
5660
|
}
|
|
@@ -5579,7 +5664,7 @@ class IntegrationSync {
|
|
|
5579
5664
|
await fs13.rename(sourceFolder, targetFolder);
|
|
5580
5665
|
}
|
|
5581
5666
|
async removeIntegrationFolder(alias) {
|
|
5582
|
-
const targetFolder =
|
|
5667
|
+
const targetFolder = path25.join(this.bpModulesPath, `integration_${alias}`);
|
|
5583
5668
|
if (existsSync3(targetFolder)) {
|
|
5584
5669
|
await fs13.rm(targetFolder, { recursive: true, force: true });
|
|
5585
5670
|
}
|
|
@@ -5613,7 +5698,7 @@ class IntegrationSync {
|
|
|
5613
5698
|
}
|
|
5614
5699
|
|
|
5615
5700
|
// src/bot-generator/interface-sync.ts
|
|
5616
|
-
import
|
|
5701
|
+
import path26 from "path";
|
|
5617
5702
|
import fs14 from "fs/promises";
|
|
5618
5703
|
import { existsSync as existsSync4 } from "fs";
|
|
5619
5704
|
import { spawn } from "child_process";
|
|
@@ -5624,7 +5709,7 @@ class InterfaceSync {
|
|
|
5624
5709
|
constructor(projectPath, botProjectPath) {
|
|
5625
5710
|
this.projectPath = projectPath;
|
|
5626
5711
|
this.botProjectPath = botProjectPath;
|
|
5627
|
-
this.bpModulesPath =
|
|
5712
|
+
this.bpModulesPath = path26.join(botProjectPath, "bp_modules");
|
|
5628
5713
|
}
|
|
5629
5714
|
async parseInterfaces() {
|
|
5630
5715
|
const interfaces = [];
|
|
@@ -5642,12 +5727,12 @@ class InterfaceSync {
|
|
|
5642
5727
|
return interfaces;
|
|
5643
5728
|
}
|
|
5644
5729
|
async isInterfaceSynced(interfaceInfo) {
|
|
5645
|
-
const targetFolder =
|
|
5730
|
+
const targetFolder = path26.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
|
|
5646
5731
|
if (!existsSync4(targetFolder)) {
|
|
5647
5732
|
return false;
|
|
5648
5733
|
}
|
|
5649
5734
|
try {
|
|
5650
|
-
const indexPath =
|
|
5735
|
+
const indexPath = path26.join(targetFolder, "index.ts");
|
|
5651
5736
|
if (!existsSync4(indexPath)) {
|
|
5652
5737
|
return false;
|
|
5653
5738
|
}
|
|
@@ -5710,8 +5795,8 @@ class InterfaceSync {
|
|
|
5710
5795
|
});
|
|
5711
5796
|
}
|
|
5712
5797
|
async renameInterfaceFolder(interfaceInfo) {
|
|
5713
|
-
const sourceFolder =
|
|
5714
|
-
const targetFolder =
|
|
5798
|
+
const sourceFolder = path26.join(this.bpModulesPath, interfaceInfo.name);
|
|
5799
|
+
const targetFolder = path26.join(this.bpModulesPath, `interface_${pascalCase(interfaceInfo.alias)}`);
|
|
5715
5800
|
if (!existsSync4(sourceFolder)) {
|
|
5716
5801
|
throw new Error(`Interface folder not found: ${sourceFolder}`);
|
|
5717
5802
|
}
|
|
@@ -5721,7 +5806,7 @@ class InterfaceSync {
|
|
|
5721
5806
|
await fs14.rename(sourceFolder, targetFolder);
|
|
5722
5807
|
}
|
|
5723
5808
|
async removeInterfaceFolder(alias) {
|
|
5724
|
-
const targetFolder =
|
|
5809
|
+
const targetFolder = path26.join(this.bpModulesPath, `interface_${pascalCase(alias)}`);
|
|
5725
5810
|
if (existsSync4(targetFolder)) {
|
|
5726
5811
|
await fs14.rm(targetFolder, { recursive: true, force: true });
|
|
5727
5812
|
}
|
|
@@ -5769,8 +5854,8 @@ class BotGenerator {
|
|
|
5769
5854
|
projectPath;
|
|
5770
5855
|
outputPath;
|
|
5771
5856
|
constructor(options) {
|
|
5772
|
-
this.projectPath =
|
|
5773
|
-
this.outputPath =
|
|
5857
|
+
this.projectPath = path29.resolve(options.projectPath);
|
|
5858
|
+
this.outputPath = path29.resolve(options.outputPath || path29.join(this.projectPath, ".adk"));
|
|
5774
5859
|
}
|
|
5775
5860
|
async listFilesRecursive(rootDir) {
|
|
5776
5861
|
try {
|
|
@@ -5780,8 +5865,8 @@ class BotGenerator {
|
|
|
5780
5865
|
const walk = async (dir, relativeBase) => {
|
|
5781
5866
|
const entries = await fs15.readdir(dir, { withFileTypes: true });
|
|
5782
5867
|
for (const entry of entries) {
|
|
5783
|
-
const abs =
|
|
5784
|
-
const rel =
|
|
5868
|
+
const abs = path29.join(dir, entry.name);
|
|
5869
|
+
const rel = path29.join(relativeBase, entry.name);
|
|
5785
5870
|
if (entry.isDirectory()) {
|
|
5786
5871
|
await walk(abs, rel);
|
|
5787
5872
|
} else {
|
|
@@ -5802,7 +5887,7 @@ class BotGenerator {
|
|
|
5802
5887
|
const entries = await fs15.readdir(dir, { withFileTypes: true });
|
|
5803
5888
|
for (const entry of entries) {
|
|
5804
5889
|
if (entry.isDirectory()) {
|
|
5805
|
-
const subdir =
|
|
5890
|
+
const subdir = path29.join(dir, entry.name);
|
|
5806
5891
|
await removeIfEmpty(subdir);
|
|
5807
5892
|
}
|
|
5808
5893
|
}
|
|
@@ -5827,6 +5912,7 @@ class BotGenerator {
|
|
|
5827
5912
|
await this.generateTriggerTypes();
|
|
5828
5913
|
await this.generateStateTypes();
|
|
5829
5914
|
await this.generateWorkflowTypes();
|
|
5915
|
+
await this.generateConversationTypes();
|
|
5830
5916
|
await this.generateActionTypes();
|
|
5831
5917
|
await this.generateEventTypes();
|
|
5832
5918
|
await this.generateIntegrationActionTypes();
|
|
@@ -5841,19 +5927,18 @@ class BotGenerator {
|
|
|
5841
5927
|
const project = await AgentProject.load(this.projectPath);
|
|
5842
5928
|
const manager2 = new IntegrationManager;
|
|
5843
5929
|
const integrations = await manager2.loadIntegrations(project.dependencies || {});
|
|
5844
|
-
const integrationsDir =
|
|
5930
|
+
const integrationsDir = path29.join(this.projectPath, ".adk", "integrations");
|
|
5845
5931
|
const existingIntegrationFiles = await this.listFilesRecursive(integrationsDir);
|
|
5846
|
-
let imports = new Set;
|
|
5847
5932
|
let aliases = new Set;
|
|
5848
5933
|
let files = new Set;
|
|
5849
5934
|
for (const integration of integrations.integrations) {
|
|
5850
5935
|
if (integration.enabled && integration.definition) {
|
|
5851
5936
|
const types6 = await generateIntegrationTypes(integration);
|
|
5852
|
-
|
|
5853
|
-
aliases.add(`"${integration.alias}": ${types6.names.typings.index}`);
|
|
5937
|
+
const importPath = `./${path29.join("integrations", types6.names.paths.index)}`;
|
|
5938
|
+
aliases.add(`"${integration.alias}": import("${importPath}").${types6.names.typings.index}`);
|
|
5854
5939
|
for (const [filePath, content] of Object.entries(types6.files)) {
|
|
5855
|
-
const fullPath =
|
|
5856
|
-
const dir =
|
|
5940
|
+
const fullPath = path29.join(this.projectPath, ".adk", "integrations", filePath);
|
|
5941
|
+
const dir = path29.dirname(fullPath);
|
|
5857
5942
|
await fs15.mkdir(dir, { recursive: true });
|
|
5858
5943
|
await createFile(fullPath, content);
|
|
5859
5944
|
files.add(filePath);
|
|
@@ -5867,20 +5952,17 @@ class BotGenerator {
|
|
|
5867
5952
|
// File: integrations.ts
|
|
5868
5953
|
////////////////////////////////////////////////////////
|
|
5869
5954
|
|
|
5870
|
-
|
|
5871
|
-
`)}
|
|
5872
|
-
|
|
5873
|
-
declare global {
|
|
5955
|
+
declare module "@botpress/runtime/_types/integrations" {
|
|
5874
5956
|
export type Integrations = {
|
|
5875
5957
|
${Array.from(aliases).join(`, `)}
|
|
5876
5958
|
};
|
|
5877
5959
|
}
|
|
5878
5960
|
`;
|
|
5879
|
-
await createFile(
|
|
5961
|
+
await createFile(path29.join(this.projectPath, ".adk", "integrations.d.ts"), await formatCode(types5));
|
|
5880
5962
|
const staleIntegrationFiles = existingIntegrationFiles.filter((f) => !files.has(f));
|
|
5881
5963
|
if (staleIntegrationFiles.length > 0) {
|
|
5882
5964
|
for (const rel of staleIntegrationFiles) {
|
|
5883
|
-
const abs =
|
|
5965
|
+
const abs = path29.join(integrationsDir, rel);
|
|
5884
5966
|
try {
|
|
5885
5967
|
await fs15.rm(abs, { force: true });
|
|
5886
5968
|
} catch {}
|
|
@@ -5908,6 +5990,10 @@ class BotGenerator {
|
|
|
5908
5990
|
const project = await AgentProject.load(this.projectPath);
|
|
5909
5991
|
await generateWorkflowTypes(project);
|
|
5910
5992
|
}
|
|
5993
|
+
async generateConversationTypes() {
|
|
5994
|
+
const project = await AgentProject.load(this.projectPath);
|
|
5995
|
+
await generateConversationTypes(project);
|
|
5996
|
+
}
|
|
5911
5997
|
async generateActionTypes() {
|
|
5912
5998
|
const project = await AgentProject.load(this.projectPath);
|
|
5913
5999
|
const { generateActionTypes: generateActionTypes2 } = await Promise.resolve().then(() => (init_action_types(), exports_action_types));
|
|
@@ -5920,10 +6006,22 @@ class BotGenerator {
|
|
|
5920
6006
|
}
|
|
5921
6007
|
async generateRuntimeTypes() {
|
|
5922
6008
|
const project = await AgentProject.load(this.projectPath);
|
|
6009
|
+
const manager2 = new IntegrationManager;
|
|
6010
|
+
const integrations = await manager2.loadIntegrations(project.dependencies || {});
|
|
6011
|
+
const channels = [];
|
|
6012
|
+
for (const integration of integrations.integrations) {
|
|
6013
|
+
if (integration.enabled && integration.definition) {
|
|
6014
|
+
const alias = integration.alias;
|
|
6015
|
+
for (const channelName of Object.keys(integration.definition.channels || {})) {
|
|
6016
|
+
channels.push(`"${alias}.${channelName}"`);
|
|
6017
|
+
}
|
|
6018
|
+
}
|
|
6019
|
+
}
|
|
6020
|
+
const channelsType = channels.length > 0 ? channels.join(" | ") : "never";
|
|
5923
6021
|
let botStateType = "{}";
|
|
5924
6022
|
let userStateType = "{}";
|
|
5925
6023
|
try {
|
|
5926
|
-
const configPath =
|
|
6024
|
+
const configPath = path29.join(project.path, "agent.config.ts");
|
|
5927
6025
|
const configModule = await import(`${configPath}?t=${Date.now()}`);
|
|
5928
6026
|
const config = configModule.default;
|
|
5929
6027
|
if (config?.bot?.state) {
|
|
@@ -5949,38 +6047,23 @@ class BotGenerator {
|
|
|
5949
6047
|
// Generated at: ${new Date().toISOString()}
|
|
5950
6048
|
////////////////////////////////////////////////////////
|
|
5951
6049
|
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
export type Channels = {
|
|
5956
|
-
[K in keyof Integrations]: {
|
|
5957
|
-
[C in keyof Integrations[K]["channels"]]: C extends string
|
|
5958
|
-
? \`\${K}.\${C}\`
|
|
5959
|
-
: never;
|
|
5960
|
-
}[keyof Integrations[K]["channels"]];
|
|
5961
|
-
}[keyof Integrations];
|
|
5962
|
-
|
|
5963
|
-
export class Conversation<
|
|
5964
|
-
T extends Channels = Channels,
|
|
5965
|
-
Schema extends ZuiType = ZuiType,
|
|
5966
|
-
> extends Primitives.BaseConversation<Integrations, T, Schema> {}
|
|
5967
|
-
|
|
6050
|
+
declare module "@botpress/runtime/_types/channels" {
|
|
6051
|
+
export type Channels = ${channelsType};
|
|
6052
|
+
export type ChannelSpec = Channels | readonly Channels[] | '*';
|
|
5968
6053
|
}
|
|
5969
6054
|
|
|
5970
6055
|
declare module "@botpress/runtime/_types/state" {
|
|
5971
6056
|
export type BotState = ${botStateType};
|
|
5972
6057
|
export type UserState = ${userStateType};
|
|
5973
6058
|
}
|
|
5974
|
-
|
|
5975
|
-
export {};
|
|
5976
6059
|
`;
|
|
5977
|
-
await createFile(
|
|
6060
|
+
await createFile(path29.join(this.projectPath, ".adk", "runtime.d.ts"), await formatCode(types5));
|
|
5978
6061
|
}
|
|
5979
6062
|
async generateInterfacesTypes() {
|
|
5980
6063
|
const project = await AgentProject.load(this.projectPath);
|
|
5981
6064
|
const integrationManager = new IntegrationManager;
|
|
5982
6065
|
const manager2 = new InterfaceManager;
|
|
5983
|
-
const interfacesDir =
|
|
6066
|
+
const interfacesDir = path29.join(this.projectPath, ".adk", "interfaces");
|
|
5984
6067
|
const existingInterfaceFiles = await this.listFilesRecursive(interfacesDir);
|
|
5985
6068
|
const interfaces = await manager2.loadInterfaces(project.dependencies || {}).then((result) => result.interfaces.filter((int) => int.definition).map((x) => x.definition));
|
|
5986
6069
|
const integrations = await integrationManager.loadIntegrations(project.dependencies || {}).then((result) => result.integrations.filter((int) => int.enabled && int.definition).map((x) => x.definition));
|
|
@@ -5989,11 +6072,11 @@ export {};
|
|
|
5989
6072
|
let files = new Set;
|
|
5990
6073
|
for (const int of interfaces) {
|
|
5991
6074
|
const types6 = await generateInterfaceTypes(int, integrations);
|
|
5992
|
-
imports.add(`import { ${types6.names.typings.index} } from "./${
|
|
6075
|
+
imports.add(`import { ${types6.names.typings.index} } from "./${path29.join("interfaces", types6.names.paths.index)}";`);
|
|
5993
6076
|
aliases.add(`"${types6.names.name}": ${types6.names.typings.index}`);
|
|
5994
6077
|
for (const [filePath, content] of Object.entries(types6.files)) {
|
|
5995
|
-
const fullPath =
|
|
5996
|
-
const dir =
|
|
6078
|
+
const fullPath = path29.join(this.projectPath, ".adk", "interfaces", filePath);
|
|
6079
|
+
const dir = path29.dirname(fullPath);
|
|
5997
6080
|
await fs15.mkdir(dir, { recursive: true });
|
|
5998
6081
|
await createFile(fullPath, content);
|
|
5999
6082
|
files.add(filePath);
|
|
@@ -6030,12 +6113,12 @@ export {};
|
|
|
6030
6113
|
`)}
|
|
6031
6114
|
};
|
|
6032
6115
|
`;
|
|
6033
|
-
await createFile(
|
|
6034
|
-
await createFile(
|
|
6116
|
+
await createFile(path29.join(this.projectPath, ".adk", "interfaces.d.ts"), await formatCode(types5));
|
|
6117
|
+
await createFile(path29.join(this.projectPath, ".adk", "interfaces.ts"), await formatCode(consts));
|
|
6035
6118
|
const staleInterfaceFiles = existingInterfaceFiles.filter((f) => !files.has(f));
|
|
6036
6119
|
if (staleInterfaceFiles.length > 0) {
|
|
6037
6120
|
for (const rel of staleInterfaceFiles) {
|
|
6038
|
-
const abs =
|
|
6121
|
+
const abs = path29.join(interfacesDir, rel);
|
|
6039
6122
|
try {
|
|
6040
6123
|
await fs15.rm(abs, { force: true });
|
|
6041
6124
|
} catch {}
|
|
@@ -6064,7 +6147,7 @@ export {};
|
|
|
6064
6147
|
`) : ""}
|
|
6065
6148
|
} as Record<string, IntegrationPackage>;
|
|
6066
6149
|
`;
|
|
6067
|
-
await createFile(
|
|
6150
|
+
await createFile(path29.join(this.outputPath, "src", "integrations.ts"), content);
|
|
6068
6151
|
}
|
|
6069
6152
|
async generateInterfacesDefinition() {
|
|
6070
6153
|
const interfaces = BUILTIN_INTERFACES;
|
|
@@ -6087,7 +6170,7 @@ export {};
|
|
|
6087
6170
|
`) : ""}
|
|
6088
6171
|
} as Record<string, InterfacePackage>;
|
|
6089
6172
|
`;
|
|
6090
|
-
await createFile(
|
|
6173
|
+
await createFile(path29.join(this.outputPath, "src", "interfaces.ts"), await formatCode(content));
|
|
6091
6174
|
}
|
|
6092
6175
|
async generateBotDefinition() {
|
|
6093
6176
|
const project = await AgentProject.load(this.projectPath);
|
|
@@ -6121,7 +6204,7 @@ export {};
|
|
|
6121
6204
|
if (isBuiltinWorkflow2(workflow.definition.name)) {
|
|
6122
6205
|
continue;
|
|
6123
6206
|
}
|
|
6124
|
-
const workflowPath =
|
|
6207
|
+
const workflowPath = path29.join(project.path, workflow.path);
|
|
6125
6208
|
const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
|
|
6126
6209
|
const workflowInstance = workflowModule.default || workflowModule[workflow.export];
|
|
6127
6210
|
if (workflowInstance) {
|
|
@@ -6180,6 +6263,7 @@ export {};
|
|
|
6180
6263
|
const content = dedent`
|
|
6181
6264
|
import { BotDefinition, z } from "@botpress/sdk";
|
|
6182
6265
|
import {
|
|
6266
|
+
BUILT_IN_STATES,
|
|
6183
6267
|
TranscriptSchema,
|
|
6184
6268
|
TrackedStateSchema,
|
|
6185
6269
|
WorkflowCallbackEvent,
|
|
@@ -6273,7 +6357,7 @@ export {};
|
|
|
6273
6357
|
* This is defined by the users at build-time when they define conversations.
|
|
6274
6358
|
* Because each conversation can have its own state schema, we use \`z.any()\`
|
|
6275
6359
|
*/
|
|
6276
|
-
|
|
6360
|
+
[BUILT_IN_STATES.conversation]: {
|
|
6277
6361
|
type: "conversation",
|
|
6278
6362
|
schema: TrackedStateSchema,
|
|
6279
6363
|
},
|
|
@@ -6281,7 +6365,7 @@ export {};
|
|
|
6281
6365
|
/**
|
|
6282
6366
|
* Bot-wide global state that persists across all conversations
|
|
6283
6367
|
*/
|
|
6284
|
-
|
|
6368
|
+
[BUILT_IN_STATES.bot]: {
|
|
6285
6369
|
type: "bot",
|
|
6286
6370
|
schema: TrackedStateSchema,
|
|
6287
6371
|
},
|
|
@@ -6289,7 +6373,7 @@ export {};
|
|
|
6289
6373
|
/**
|
|
6290
6374
|
* User-specific state that persists across conversations for each user
|
|
6291
6375
|
*/
|
|
6292
|
-
|
|
6376
|
+
[BUILT_IN_STATES.user]: {
|
|
6293
6377
|
type: "user",
|
|
6294
6378
|
schema: TrackedStateSchema,
|
|
6295
6379
|
},
|
|
@@ -6297,7 +6381,7 @@ export {};
|
|
|
6297
6381
|
/**
|
|
6298
6382
|
* Workflow-specific state that persists across workflow executions
|
|
6299
6383
|
*/
|
|
6300
|
-
workflowState: {
|
|
6384
|
+
[BUILT_IN_STATES.workflowState]: {
|
|
6301
6385
|
type: "workflow",
|
|
6302
6386
|
schema: TrackedStateSchema,
|
|
6303
6387
|
},
|
|
@@ -6305,7 +6389,7 @@ export {};
|
|
|
6305
6389
|
/**
|
|
6306
6390
|
* Workflow cached steps executions
|
|
6307
6391
|
*/
|
|
6308
|
-
workflowSteps: {
|
|
6392
|
+
[BUILT_IN_STATES.workflowSteps]: {
|
|
6309
6393
|
type: "workflow",
|
|
6310
6394
|
schema: TrackedStateSchema,
|
|
6311
6395
|
},
|
|
@@ -6319,7 +6403,7 @@ export {};
|
|
|
6319
6403
|
|
|
6320
6404
|
export default bot;
|
|
6321
6405
|
`;
|
|
6322
|
-
await createFile(
|
|
6406
|
+
await createFile(path29.join(this.outputPath, "bot.definition.ts"), await formatCode(content));
|
|
6323
6407
|
}
|
|
6324
6408
|
async generateBotIndex() {
|
|
6325
6409
|
const project = await AgentProject.load(this.projectPath);
|
|
@@ -6362,7 +6446,7 @@ export {};
|
|
|
6362
6446
|
|
|
6363
6447
|
export default bot
|
|
6364
6448
|
`;
|
|
6365
|
-
await createFile(
|
|
6449
|
+
await createFile(path29.join(this.outputPath, "src", "index.ts"), await formatCode(content));
|
|
6366
6450
|
}
|
|
6367
6451
|
async generatePackageJson(project) {
|
|
6368
6452
|
const packageJson = {
|
|
@@ -6381,7 +6465,7 @@ export {};
|
|
|
6381
6465
|
typescript: "^5.6.3"
|
|
6382
6466
|
}
|
|
6383
6467
|
};
|
|
6384
|
-
await createFile(
|
|
6468
|
+
await createFile(path29.join(this.outputPath, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
6385
6469
|
}
|
|
6386
6470
|
async generateTsConfig() {
|
|
6387
6471
|
const tsConfig = {
|
|
@@ -6418,7 +6502,7 @@ export {};
|
|
|
6418
6502
|
"./*.json"
|
|
6419
6503
|
]
|
|
6420
6504
|
};
|
|
6421
|
-
await createFile(
|
|
6505
|
+
await createFile(path29.join(this.outputPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
|
|
6422
6506
|
}
|
|
6423
6507
|
async generateGlobalTypes() {
|
|
6424
6508
|
const content = dedent`
|
|
@@ -6441,11 +6525,11 @@ export {};
|
|
|
6441
6525
|
|
|
6442
6526
|
export {};
|
|
6443
6527
|
`;
|
|
6444
|
-
await createFile(
|
|
6528
|
+
await createFile(path29.join(this.outputPath, "global.d.ts"), await formatCode(content));
|
|
6445
6529
|
}
|
|
6446
6530
|
async copyAssets() {
|
|
6447
|
-
const assetsPath =
|
|
6448
|
-
const targetPath =
|
|
6531
|
+
const assetsPath = path29.join(this.projectPath, "assets");
|
|
6532
|
+
const targetPath = path29.join(this.outputPath, "assets");
|
|
6449
6533
|
if (existsSync5(assetsPath)) {
|
|
6450
6534
|
await fs15.mkdir(targetPath, { recursive: true });
|
|
6451
6535
|
await this.copyDirectory(assetsPath, targetPath);
|
|
@@ -6454,8 +6538,8 @@ export {};
|
|
|
6454
6538
|
async copyDirectory(src, dest) {
|
|
6455
6539
|
const entries = await fs15.readdir(src, { withFileTypes: true });
|
|
6456
6540
|
for (const entry of entries) {
|
|
6457
|
-
const srcPath =
|
|
6458
|
-
const destPath =
|
|
6541
|
+
const srcPath = path29.join(src, entry.name);
|
|
6542
|
+
const destPath = path29.join(dest, entry.name);
|
|
6459
6543
|
if (entry.isDirectory()) {
|
|
6460
6544
|
await fs15.mkdir(destPath, { recursive: true });
|
|
6461
6545
|
await this.copyDirectory(srcPath, destPath);
|
|
@@ -6467,16 +6551,16 @@ export {};
|
|
|
6467
6551
|
async generateAdkRuntime() {
|
|
6468
6552
|
const project = new AgentProject(this.projectPath);
|
|
6469
6553
|
await project.reload();
|
|
6470
|
-
const srcDir =
|
|
6554
|
+
const srcDir = path29.join(this.outputPath, "src");
|
|
6471
6555
|
{
|
|
6472
|
-
const dest =
|
|
6556
|
+
const dest = path29.join(srcDir, "conversations.ts");
|
|
6473
6557
|
const imports = new Map;
|
|
6474
6558
|
const exports = new Set;
|
|
6475
6559
|
let index = 1;
|
|
6476
6560
|
for (const conversation of project.conversations) {
|
|
6477
6561
|
if (!imports.has(conversation.path)) {
|
|
6478
6562
|
const name = `conversations_${index++}`;
|
|
6479
|
-
const importPath =
|
|
6563
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, conversation.path)).replace(/\.ts$/, "");
|
|
6480
6564
|
imports.set(conversation.path, {
|
|
6481
6565
|
name,
|
|
6482
6566
|
statement: `import * as ${name} from "${importPath}";`
|
|
@@ -6502,14 +6586,14 @@ export {};
|
|
|
6502
6586
|
await createFile(dest, await formatCode(content2));
|
|
6503
6587
|
}
|
|
6504
6588
|
{
|
|
6505
|
-
const dest =
|
|
6589
|
+
const dest = path29.join(srcDir, "knowledge.ts");
|
|
6506
6590
|
const imports = new Map;
|
|
6507
6591
|
const exports = new Set;
|
|
6508
6592
|
let index = 1;
|
|
6509
6593
|
for (const knowledge of project.knowledge) {
|
|
6510
6594
|
if (!imports.has(knowledge.path)) {
|
|
6511
6595
|
const name = `knowledge_${index++}`;
|
|
6512
|
-
const importPath =
|
|
6596
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, knowledge.path)).replace(/\.ts$/, "");
|
|
6513
6597
|
imports.set(knowledge.path, {
|
|
6514
6598
|
name,
|
|
6515
6599
|
statement: `import * as ${name} from "${importPath}";`
|
|
@@ -6535,7 +6619,7 @@ export {};
|
|
|
6535
6619
|
await createFile(dest, await formatCode(content2));
|
|
6536
6620
|
}
|
|
6537
6621
|
{
|
|
6538
|
-
const dest =
|
|
6622
|
+
const dest = path29.join(srcDir, "triggers.ts");
|
|
6539
6623
|
const { transforms: transforms4 } = await import("@botpress/sdk");
|
|
6540
6624
|
const imports = new Map;
|
|
6541
6625
|
const exports = new Set;
|
|
@@ -6544,7 +6628,7 @@ export {};
|
|
|
6544
6628
|
for (const trigger of project.triggers) {
|
|
6545
6629
|
if (!imports.has(trigger.path)) {
|
|
6546
6630
|
const name = `triggers_${index++}`;
|
|
6547
|
-
const importPath =
|
|
6631
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, trigger.path)).replace(/\.ts$/, "");
|
|
6548
6632
|
imports.set(trigger.path, {
|
|
6549
6633
|
name,
|
|
6550
6634
|
statement: `import * as ${name} from "${importPath}";`
|
|
@@ -6554,7 +6638,7 @@ export {};
|
|
|
6554
6638
|
}
|
|
6555
6639
|
for (const trigger of project.triggers) {
|
|
6556
6640
|
try {
|
|
6557
|
-
const absolutePath =
|
|
6641
|
+
const absolutePath = path29.join(project.path, trigger.path);
|
|
6558
6642
|
const triggerModule = await import(`${absolutePath}?t=${Date.now()}`);
|
|
6559
6643
|
const triggerInstance = triggerModule[trigger.export] || triggerModule.default;
|
|
6560
6644
|
if (triggerInstance && triggerInstance.payload) {
|
|
@@ -6597,7 +6681,7 @@ export {};
|
|
|
6597
6681
|
await createFile(dest, await formatCode(content2));
|
|
6598
6682
|
}
|
|
6599
6683
|
{
|
|
6600
|
-
const dest =
|
|
6684
|
+
const dest = path29.join(srcDir, "workflows.ts");
|
|
6601
6685
|
const imports = new Map;
|
|
6602
6686
|
const exports = new Set;
|
|
6603
6687
|
let index = 1;
|
|
@@ -6607,7 +6691,7 @@ export {};
|
|
|
6607
6691
|
}
|
|
6608
6692
|
if (!imports.has(workflow.path)) {
|
|
6609
6693
|
const name = `workflows_${index++}`;
|
|
6610
|
-
const importPath =
|
|
6694
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, workflow.path)).replace(/\.ts$/, "");
|
|
6611
6695
|
const statement = `import * as ${name} from "${importPath}";`;
|
|
6612
6696
|
imports.set(workflow.path, {
|
|
6613
6697
|
name,
|
|
@@ -6641,14 +6725,14 @@ export {};
|
|
|
6641
6725
|
await createFile(dest, await formatCode(content2));
|
|
6642
6726
|
}
|
|
6643
6727
|
{
|
|
6644
|
-
const dest =
|
|
6728
|
+
const dest = path29.join(srcDir, "actions.ts");
|
|
6645
6729
|
const imports = new Map;
|
|
6646
6730
|
const exports = new Set;
|
|
6647
6731
|
let index = 1;
|
|
6648
6732
|
for (const action of project.actions) {
|
|
6649
6733
|
if (!imports.has(action.path)) {
|
|
6650
6734
|
const name = `actions_${index++}`;
|
|
6651
|
-
const importPath =
|
|
6735
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, action.path)).replace(/\.ts$/, "");
|
|
6652
6736
|
imports.set(action.path, {
|
|
6653
6737
|
name,
|
|
6654
6738
|
statement: `import * as ${name} from "${importPath}";`
|
|
@@ -6674,14 +6758,14 @@ export {};
|
|
|
6674
6758
|
await createFile(dest, await formatCode(content2));
|
|
6675
6759
|
}
|
|
6676
6760
|
{
|
|
6677
|
-
const dest =
|
|
6761
|
+
const dest = path29.join(srcDir, "tables.ts");
|
|
6678
6762
|
const imports = new Map;
|
|
6679
6763
|
const exports = new Set;
|
|
6680
6764
|
let index = 1;
|
|
6681
6765
|
for (const table of project.tables) {
|
|
6682
6766
|
if (!imports.has(table.path)) {
|
|
6683
6767
|
const name = `tables_${index++}`;
|
|
6684
|
-
const importPath =
|
|
6768
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, table.path)).replace(/\.ts$/, "");
|
|
6685
6769
|
imports.set(table.path, {
|
|
6686
6770
|
name,
|
|
6687
6771
|
statement: `import * as ${name} from "${importPath}";`
|
|
@@ -6707,8 +6791,8 @@ export {};
|
|
|
6707
6791
|
await createFile(dest, await formatCode(content2));
|
|
6708
6792
|
}
|
|
6709
6793
|
{
|
|
6710
|
-
const dest =
|
|
6711
|
-
const importPath =
|
|
6794
|
+
const dest = path29.join(srcDir, "config.ts");
|
|
6795
|
+
const importPath = path29.relative(path29.dirname(dest), path29.join(project.path, "agent.config.ts")).replace(/\.ts$/, "");
|
|
6712
6796
|
const content2 = `
|
|
6713
6797
|
////////////////////////////////////////////////////////
|
|
6714
6798
|
// DO NOT EDIT THIS FILE DIRECTLY
|
|
@@ -6773,13 +6857,13 @@ export {};
|
|
|
6773
6857
|
handlers.workflow.setup(bot);
|
|
6774
6858
|
}
|
|
6775
6859
|
`;
|
|
6776
|
-
await createFile(
|
|
6860
|
+
await createFile(path29.join(this.outputPath, "src", "adk-runtime.ts"), await formatCode(content));
|
|
6777
6861
|
}
|
|
6778
6862
|
async copyAssetsRuntime() {
|
|
6779
|
-
const assetsRuntimePath =
|
|
6863
|
+
const assetsRuntimePath = path29.join(this.projectPath, ".adk", "assets-runtime.ts");
|
|
6780
6864
|
if (existsSync5(assetsRuntimePath)) {
|
|
6781
6865
|
const content = await fs15.readFile(assetsRuntimePath, "utf-8");
|
|
6782
|
-
await createFile(
|
|
6866
|
+
await createFile(path29.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
|
|
6783
6867
|
}
|
|
6784
6868
|
}
|
|
6785
6869
|
}
|
|
@@ -6788,9 +6872,9 @@ async function generateBotProject(options) {
|
|
|
6788
6872
|
await generator.generate();
|
|
6789
6873
|
await generator.generateAdkRuntime();
|
|
6790
6874
|
await generator.copyAssetsRuntime();
|
|
6791
|
-
const devIdManager = new DevIdManager(options.projectPath, options.outputPath ||
|
|
6875
|
+
const devIdManager = new DevIdManager(options.projectPath, options.outputPath || path29.join(options.projectPath, ".adk", "bot"));
|
|
6792
6876
|
await devIdManager.restoreDevId();
|
|
6793
|
-
const integrationSync = new IntegrationSync(options.projectPath, options.outputPath ||
|
|
6877
|
+
const integrationSync = new IntegrationSync(options.projectPath, options.outputPath || path29.join(options.projectPath, ".adk", "bot"));
|
|
6794
6878
|
const integrationSyncResult = await integrationSync.syncIntegrations();
|
|
6795
6879
|
if (integrationSyncResult.errors.length > 0) {
|
|
6796
6880
|
console.warn(`⚠️ Some integrations failed to sync:`);
|
|
@@ -6798,7 +6882,7 @@ async function generateBotProject(options) {
|
|
|
6798
6882
|
console.warn(` - ${alias}: ${error}`);
|
|
6799
6883
|
});
|
|
6800
6884
|
}
|
|
6801
|
-
const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath ||
|
|
6885
|
+
const interfaceSync = new InterfaceSync(options.projectPath, options.outputPath || path29.join(options.projectPath, ".adk", "bot"));
|
|
6802
6886
|
const interfaceSyncResult = await interfaceSync.syncInterfaces();
|
|
6803
6887
|
if (interfaceSyncResult.errors.length > 0) {
|
|
6804
6888
|
console.warn(`⚠️ Some interfaces failed to sync:`);
|
|
@@ -7193,5 +7277,5 @@ export {
|
|
|
7193
7277
|
AgentProject
|
|
7194
7278
|
};
|
|
7195
7279
|
|
|
7196
|
-
//# debugId=
|
|
7280
|
+
//# debugId=457481A453B1622564756E2164756E21
|
|
7197
7281
|
//# sourceMappingURL=index.js.map
|