@botpress/runtime 1.13.11 → 1.13.13

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.
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
48
48
  var define_PACKAGE_VERSIONS_default;
49
49
  var init_define_PACKAGE_VERSIONS = __esm({
50
50
  "<define:__PACKAGE_VERSIONS__>"() {
51
- define_PACKAGE_VERSIONS_default = { runtime: "1.13.11", adk: "1.13.11", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.13.13", adk: "1.13.13", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
52
52
  }
53
53
  });
54
54
 
@@ -32802,7 +32802,10 @@ var init_context3 = __esm({
32802
32802
  return storage.run(data, callback);
32803
32803
  },
32804
32804
  getAll: () => {
32805
- const store = storage.getStore();
32805
+ let store = storage.getStore();
32806
+ if (!store && defaultContext.value) {
32807
+ store = defaultContext.value;
32808
+ }
32806
32809
  if (!store) throw new Error("No context found. Did you forget to call `context.run()`?");
32807
32810
  return store;
32808
32811
  },
@@ -37078,7 +37081,8 @@ var init_source_website = __esm({
37078
37081
  toFetch.push(url2);
37079
37082
  } else {
37080
37083
  const existingMetadata = existing.metadata;
37081
- if (url2.lastmod && existingMetadata?.lastmod !== url2.lastmod) {
37084
+ const isFailed = existing.status === "indexing_failed" || existing.status === "upload_failed" || existing.status === "upload_pending";
37085
+ if (isFailed || url2.lastmod && existingMetadata?.lastmod !== url2.lastmod) {
37082
37086
  toFetch.push(url2);
37083
37087
  } else {
37084
37088
  skippedUnchanged++;
@@ -37165,14 +37169,18 @@ var init_source_website = __esm({
37165
37169
  return null;
37166
37170
  }
37167
37171
  };
37168
- console.log(`[SYNC DEBUG] Starting 'fetching and indexing pages' for ${toFetch.slice(0, this.maxPages).length} URLs...`);
37172
+ console.log(
37173
+ `[SYNC DEBUG] Starting 'fetching and indexing pages' for ${toFetch.slice(0, this.maxPages).length} URLs...`
37174
+ );
37169
37175
  const indexed = await step2.map(
37170
37176
  "fetching and indexing pages",
37171
37177
  toFetch.slice(0, this.maxPages),
37172
37178
  (url2) => fetchAndIndex(url2),
37173
37179
  { concurrency: 20, maxAttempts: 2 }
37174
37180
  );
37175
- console.log(`[SYNC DEBUG] Fetch complete. ${indexed.length} attempted, ${indexed.filter((f) => f !== null).length} successful`);
37181
+ console.log(
37182
+ `[SYNC DEBUG] Fetch complete. ${indexed.length} attempted, ${indexed.filter((f) => f !== null).length} successful`
37183
+ );
37176
37184
  const successful = indexed.filter((f) => f !== null);
37177
37185
  console.log(`[SYNC DEBUG] Starting dsData registration...`);
37178
37186
  await step2("register web page source", async () => {
@@ -37211,7 +37219,9 @@ var init_source_website = __esm({
37211
37219
  console.warn("Failed to register web page source in dsData state:", err);
37212
37220
  }
37213
37221
  });
37214
- console.log(`[SYNC DEBUG] \u2705 WebsiteSource sync complete for "${this.id}". Processed: ${discoveredUrls.length}, Added: ${successful.length}, Deleted: ${deleted.length}`);
37222
+ console.log(
37223
+ `[SYNC DEBUG] \u2705 WebsiteSource sync complete for "${this.id}". Processed: ${discoveredUrls.length}, Added: ${successful.length}, Deleted: ${deleted.length}`
37224
+ );
37215
37225
  return {
37216
37226
  processed: discoveredUrls.length,
37217
37227
  deleted,
@@ -44173,11 +44183,14 @@ var init_source_directory = __esm({
44173
44183
  const content = await fs3.readFile(local.abs);
44174
44184
  const hash = crypto2.createHash("sha256").update(content).digest("hex");
44175
44185
  const { file } = await client2.getFile({ id: key }).catch(() => ({ file: null }));
44176
- if (!input.force && file?.metadata?.hash === hash) {
44186
+ const isFailed = file?.status === "indexing_failed" || file?.status === "upload_failed" || file?.status === "upload_pending";
44187
+ if (!input.force && !isFailed && file?.metadata?.hash === hash) {
44177
44188
  console.log(`Skipping unchanged file: ${local.rel}`);
44178
44189
  return null;
44179
44190
  }
44180
- if (input.force && file?.metadata?.hash === hash) {
44191
+ if (isFailed) {
44192
+ console.log(`Re-indexing failed file (status: ${file?.status}): ${local.rel}`);
44193
+ } else if (input.force && file?.metadata?.hash === hash) {
44181
44194
  console.log(`Force re-indexing file (unchanged): ${local.rel}`);
44182
44195
  }
44183
44196
  const title = path4.basename(local.name, path4.extname(local.name));