@botpress/adk 1.18.0-beta.7 → 1.18.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/bot-generator/generator.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAoC1D,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,UAAU,CAAC,CAAwC;IAC3D,OAAO,CAAC,SAAS,CAAC,CAAe;gBAErB,OAAO,EAAE,mBAAmB;YAO1B,kBAAkB;YAuBlB,sBAAsB;IAsB9B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAqCjB,yBAAyB;YAkEzB,oBAAoB;YA8DpB,kBAAkB;YAKlB,oBAAoB;YAKpB,gBAAgB;YAKhB,kBAAkB;YAKlB,0BAA0B;YAK1B,mBAAmB;YAKnB,kBAAkB;YAKlB,qBAAqB;YAKrB,yBAAyB;YAKzB,sBAAsB;YAKtB,mBAAmB;YAMnB,8BAA8B;YAM9B,yBAAyB;YAKzB,qBAAqB;YAKrB,oBAAoB;YAyEpB,uBAAuB;YAgGvB,8BAA8B;YA4B9B,yBAAyB;YA0BzB,4BAA4B;IA2B1C;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;YAiDhB,qBAAqB;YAufrB,gBAAgB;YAyChB,mBAAmB;YAgBnB,gBAAgB;YAmChB,mBAAmB;YAyBnB,UAAU;YAWV,aAAa;IAgBrB,kBAAkB,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B;YAmChB,mBAAmB;YAyBnB,UAAU;YAWV,aAAa;IAgBrB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;YAwd3B,0BAA0B;IAgBlC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAuBzC;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DpF"}
@@ -1,4 +1,8 @@
1
1
  export declare function generateAssetsTypes(projectPath: string): Promise<void>;
2
- export declare function generateAssetsRuntime(projectPath: string, botId?: string, workspaceId?: string): Promise<void>;
3
- export declare function initAssets(projectPath: string, botId?: string, workspaceId?: string): Promise<void>;
2
+ export declare function generateAssetsRuntime(projectPath: string, botId?: string, workspaceId?: string, options?: {
3
+ dev?: boolean;
4
+ }): Promise<void>;
5
+ export declare function initAssets(projectPath: string, botId?: string, workspaceId?: string, options?: {
6
+ dev?: boolean;
7
+ }): Promise<void>;
4
8
  //# sourceMappingURL=assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/generators/assets.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5E;AAED,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDpH;AAED,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDzG"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/generators/assets.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5E;AAED,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8Ef;AAED,wBAAsB,UAAU,CAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAyDf"}
package/dist/index.js CHANGED
@@ -1328,7 +1328,7 @@ class AssetsManager {
1328
1328
  name: localFile.name,
1329
1329
  size: localFile.size.toString()
1330
1330
  },
1331
- index: true
1331
+ index: false
1332
1332
  });
1333
1333
  }
1334
1334
  async generateTypes() {
@@ -1348,11 +1348,11 @@ ${paths}
1348
1348
  // Runtime asset access
1349
1349
  declare global {
1350
1350
  const assets: {
1351
- get<T extends AssetPaths>(path: T): Asset;
1351
+ get<T extends AssetPaths>(path: T): Promise<Asset>;
1352
1352
  list(): Asset[];
1353
- getSyncStatus(): {
1354
- synced: boolean;
1355
- neverSynced: string[];
1353
+ getSyncStatus(): {
1354
+ synced: boolean;
1355
+ neverSynced: string[];
1356
1356
  stale: string[];
1357
1357
  upToDate: string[];
1358
1358
  };
@@ -2148,7 +2148,7 @@ var _format = null, _formatLoaded = false, formatCode = async (code, filepath) =
2148
2148
  `));
2149
2149
  return code;
2150
2150
  }
2151
- }, ADK_VERSION = "1.18.0-beta.7", relative2 = (from, to) => {
2151
+ }, ADK_VERSION = "1.18.1", relative2 = (from, to) => {
2152
2152
  const fromDir = path9.dirname(from);
2153
2153
  const relative3 = path9.relative(fromDir, to);
2154
2154
  return relative3.startsWith(".") ? relative3 : `./${relative3}`;
@@ -4996,7 +4996,7 @@ var init_integration_action_types = __esm(() => {
4996
4996
  var require_package = __commonJS((exports, module) => {
4997
4997
  module.exports = {
4998
4998
  name: "@botpress/adk",
4999
- version: "1.18.0-beta.7",
4999
+ version: "1.18.1",
5000
5000
  description: "Core ADK library for building AI agents on Botpress",
5001
5001
  keywords: [
5002
5002
  "adk",
@@ -5045,7 +5045,7 @@ var require_package = __commonJS((exports, module) => {
5045
5045
  "@botpress/cli": "~6.3.2",
5046
5046
  "@botpress/client": "~1.39.0",
5047
5047
  "@botpress/cognitive": "~0.5.2",
5048
- "@botpress/runtime": "^1.18.0-beta.7",
5048
+ "@botpress/runtime": "^1.18.1",
5049
5049
  "@botpress/sdk": "~6.4.4",
5050
5050
  "@bpinternal/jex": "^1.2.4",
5051
5051
  "@bpinternal/yargs-extra": "^0.0.21",
@@ -6836,7 +6836,7 @@ ${names || " (none found)"}`);
6836
6836
  async copyTemplateFiles(templateDir) {
6837
6837
  const substitutions = {
6838
6838
  "{{projectName}}": this.projectName,
6839
- "{{runtimeVersion}}": "1.18.0-beta.7",
6839
+ "{{runtimeVersion}}": "1.18.1",
6840
6840
  "{{packageManager}}": this.packageManager
6841
6841
  };
6842
6842
  await this.copyDirRecursive(templateDir, this.projectPath, substitutions);
@@ -7162,8 +7162,9 @@ async function generateAssetsTypes(projectPath) {
7162
7162
  const typesPath = path19.join(projectPath, defaultAdkFolder, "assets.d.ts");
7163
7163
  await createFile(typesPath, typesCode);
7164
7164
  }
7165
- async function generateAssetsRuntime(projectPath, botId, workspaceId) {
7165
+ async function generateAssetsRuntime(projectPath, botId, workspaceId, options) {
7166
7166
  const assetsManager = new AssetsManager({ projectPath, botId, workspaceId });
7167
+ const dev = options?.dev ?? false;
7167
7168
  const enrichedAssets = await assetsManager.getEnrichedLocalAssets();
7168
7169
  const assetsMap = {};
7169
7170
  const localHashesMap = {};
@@ -7176,9 +7177,29 @@ async function generateAssetsRuntime(projectPath, botId, workspaceId) {
7176
7177
  localHashesMap[asset.path] = cacheEntry.localHash;
7177
7178
  }
7178
7179
  }
7180
+ const initCall = dev ? `const refresher = async (): Promise<Record<string, Partial<Asset>>> => {
7181
+ const updates: Record<string, Partial<Asset>> = {};
7182
+ let nextToken: string | undefined;
7183
+ do {
7184
+ const { files, meta } = await client.listFiles({
7185
+ tags: { adk: 'true', type: 'asset' },
7186
+ nextToken,
7187
+ });
7188
+ for (const f of files) {
7189
+ const p = f.tags?.path;
7190
+ if (p) {
7191
+ updates[p] = { url: f.url, fileId: f.id, updatedAt: f.updatedAt };
7192
+ }
7193
+ }
7194
+ nextToken = meta?.nextToken;
7195
+ } while (nextToken);
7196
+ return updates;
7197
+ };
7198
+ initAssets(globalObj, assetsMetadata, localHashes, { refresher });` : `initAssets(globalObj, assetsMetadata, localHashes);`;
7199
+ const imports = dev ? `import { Asset, initAssets, client } from '@botpress/runtime/runtime';` : `import { Asset, initAssets } from '@botpress/runtime/runtime';`;
7179
7200
  const runtimeCode = `
7180
7201
  // Auto-generated assets metadata
7181
- import { Asset, initAssets } from '@botpress/runtime/runtime';
7202
+ ${imports}
7182
7203
 
7183
7204
  // Static asset metadata (populated at build time)
7184
7205
  export const assetsMetadata: Record<string, Asset> = ${JSON.stringify(assetsMap, null, 2)};
@@ -7189,7 +7210,7 @@ export const localHashes: Record<string, string> = ${JSON.stringify(localHashesM
7189
7210
  // Initialize the assets runtime with metadata and local hashes
7190
7211
  // The global object should be passed by the agent initialization code
7191
7212
  export function initializeAssets(globalObj: any = globalThis) {
7192
- initAssets(globalObj, assetsMetadata, localHashes);
7213
+ ${initCall}
7193
7214
  }
7194
7215
 
7195
7216
  // Auto-initialize if running in a supported environment
@@ -7202,11 +7223,11 @@ if (typeof globalThis !== 'undefined') {
7202
7223
  const runtimePath = path19.join(projectPath, defaultAdkFolder, "assets-runtime.ts");
7203
7224
  await createFile(runtimePath, runtimeCode);
7204
7225
  }
7205
- async function initAssets(projectPath, botId, workspaceId) {
7226
+ async function initAssets(projectPath, botId, workspaceId, options) {
7206
7227
  const assetsManager = new AssetsManager({ projectPath, botId, workspaceId });
7207
7228
  if (await assetsManager.hasAssetsDirectory()) {
7208
7229
  await generateAssetsTypes(projectPath);
7209
- await generateAssetsRuntime(projectPath, botId, workspaceId);
7230
+ await generateAssetsRuntime(projectPath, botId, workspaceId, options);
7210
7231
  } else {
7211
7232
  const emptyTypesCode = `// No assets directory found
7212
7233
  import { Asset } from '@botpress/runtime';
@@ -7218,11 +7239,11 @@ export interface AssetPathMap {}
7218
7239
  // Runtime asset access
7219
7240
  declare global {
7220
7241
  const assets: {
7221
- get<T extends AssetPaths>(path: T): Asset;
7242
+ get<T extends AssetPaths>(path: T): Promise<Asset>;
7222
7243
  list(): Asset[];
7223
- getSyncStatus(): {
7224
- synced: boolean;
7225
- neverSynced: string[];
7244
+ getSyncStatus(): {
7245
+ synced: boolean;
7246
+ neverSynced: string[];
7226
7247
  stale: string[];
7227
7248
  upToDate: string[];
7228
7249
  };
@@ -7233,7 +7254,7 @@ declare global {
7233
7254
  await createFile(typesPath, emptyTypesCode);
7234
7255
  const emptyRuntimeCode = `
7235
7256
  // No assets available
7236
- import { Asset, initAssets } from '@botpress/runtime';
7257
+ import { Asset, initAssets } from '@botpress/runtime/runtime';
7237
7258
 
7238
7259
  // Empty asset metadata
7239
7260
  export const assetsMetadata: Record<string, Asset> = {};
@@ -10810,6 +10831,13 @@ export default bot;`;
10810
10831
  }
10811
10832
  async copyAssetsRuntime() {
10812
10833
  const assetsRuntimePath = path42.join(this.projectPath, ".adk", "assets-runtime.ts");
10834
+ const isShippingBuild = this.adkCommand !== "adk-dev";
10835
+ if (isShippingBuild) {
10836
+ const project = await AgentProject.load(this.projectPath);
10837
+ await initAssets(this.projectPath, project.agentInfo?.botId, project.agentInfo?.workspaceId, {
10838
+ dev: false
10839
+ });
10840
+ }
10813
10841
  if (existsSync9(assetsRuntimePath)) {
10814
10842
  const content = await fs19.readFile(assetsRuntimePath, "utf-8");
10815
10843
  await createFile(path42.join(this.outputPath, "src", "assets-runtime.ts"), await formatCode(content));
@@ -12833,11 +12861,14 @@ class ScriptRunner {
12833
12861
  if (needsRegenerate) {
12834
12862
  try {
12835
12863
  await generateAssetsTypes(project.path);
12836
- await generateAssetsRuntime(project.path, project.agentInfo?.botId, project.agentInfo?.workspaceId);
12864
+ await generateAssetsRuntime(project.path, project.agentInfo?.botId, project.agentInfo?.workspaceId, {
12865
+ dev: true
12866
+ });
12837
12867
  } catch {}
12838
12868
  await generateBotProject({
12839
12869
  projectPath: project.path,
12840
- outputPath: botPath
12870
+ outputPath: botPath,
12871
+ adkCommand: "adk-dev"
12841
12872
  });
12842
12873
  await this.generateScriptRunner(botPath);
12843
12874
  await this.runBpBuild(botPath);
@@ -13184,4 +13215,4 @@ export {
13184
13215
  AgentProject
13185
13216
  };
13186
13217
 
13187
- //# debugId=8BA5B4B61CC8EC4F64756E2164756E21
13218
+ //# debugId=3AFEA6995BBE1B0064756E2164756E21