@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.
package/dist/internal.js CHANGED
@@ -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
 
@@ -402,7 +402,10 @@ var init_context = __esm({
402
402
  return storage.run(data, callback);
403
403
  },
404
404
  getAll: () => {
405
- const store = storage.getStore();
405
+ let store = storage.getStore();
406
+ if (!store && defaultContext.value) {
407
+ store = defaultContext.value;
408
+ }
406
409
  if (!store) throw new Error("No context found. Did you forget to call `context.run()`?");
407
410
  return store;
408
411
  },
@@ -41146,7 +41149,8 @@ var init_source_website = __esm({
41146
41149
  toFetch.push(url2);
41147
41150
  } else {
41148
41151
  const existingMetadata = existing.metadata;
41149
- if (url2.lastmod && existingMetadata?.lastmod !== url2.lastmod) {
41152
+ const isFailed = existing.status === "indexing_failed" || existing.status === "upload_failed" || existing.status === "upload_pending";
41153
+ if (isFailed || url2.lastmod && existingMetadata?.lastmod !== url2.lastmod) {
41150
41154
  toFetch.push(url2);
41151
41155
  } else {
41152
41156
  skippedUnchanged++;
@@ -41233,14 +41237,18 @@ var init_source_website = __esm({
41233
41237
  return null;
41234
41238
  }
41235
41239
  };
41236
- console.log(`[SYNC DEBUG] Starting 'fetching and indexing pages' for ${toFetch.slice(0, this.maxPages).length} URLs...`);
41240
+ console.log(
41241
+ `[SYNC DEBUG] Starting 'fetching and indexing pages' for ${toFetch.slice(0, this.maxPages).length} URLs...`
41242
+ );
41237
41243
  const indexed = await step2.map(
41238
41244
  "fetching and indexing pages",
41239
41245
  toFetch.slice(0, this.maxPages),
41240
41246
  (url2) => fetchAndIndex(url2),
41241
41247
  { concurrency: 20, maxAttempts: 2 }
41242
41248
  );
41243
- console.log(`[SYNC DEBUG] Fetch complete. ${indexed.length} attempted, ${indexed.filter((f) => f !== null).length} successful`);
41249
+ console.log(
41250
+ `[SYNC DEBUG] Fetch complete. ${indexed.length} attempted, ${indexed.filter((f) => f !== null).length} successful`
41251
+ );
41244
41252
  const successful = indexed.filter((f) => f !== null);
41245
41253
  console.log(`[SYNC DEBUG] Starting dsData registration...`);
41246
41254
  await step2("register web page source", async () => {
@@ -41279,7 +41287,9 @@ var init_source_website = __esm({
41279
41287
  console.warn("Failed to register web page source in dsData state:", err);
41280
41288
  }
41281
41289
  });
41282
- console.log(`[SYNC DEBUG] \u2705 WebsiteSource sync complete for "${this.id}". Processed: ${discoveredUrls.length}, Added: ${successful.length}, Deleted: ${deleted.length}`);
41290
+ console.log(
41291
+ `[SYNC DEBUG] \u2705 WebsiteSource sync complete for "${this.id}". Processed: ${discoveredUrls.length}, Added: ${successful.length}, Deleted: ${deleted.length}`
41292
+ );
41283
41293
  return {
41284
41294
  processed: discoveredUrls.length,
41285
41295
  deleted,
@@ -48241,11 +48251,14 @@ var init_source_directory = __esm({
48241
48251
  const content = await fs3.readFile(local.abs);
48242
48252
  const hash = crypto2.createHash("sha256").update(content).digest("hex");
48243
48253
  const { file } = await client2.getFile({ id: key }).catch(() => ({ file: null }));
48244
- if (!input.force && file?.metadata?.hash === hash) {
48254
+ const isFailed = file?.status === "indexing_failed" || file?.status === "upload_failed" || file?.status === "upload_pending";
48255
+ if (!input.force && !isFailed && file?.metadata?.hash === hash) {
48245
48256
  console.log(`Skipping unchanged file: ${local.rel}`);
48246
48257
  return null;
48247
48258
  }
48248
- if (input.force && file?.metadata?.hash === hash) {
48259
+ if (isFailed) {
48260
+ console.log(`Re-indexing failed file (status: ${file?.status}): ${local.rel}`);
48261
+ } else if (input.force && file?.metadata?.hash === hash) {
48249
48262
  console.log(`Force re-indexing file (unchanged): ${local.rel}`);
48250
48263
  }
48251
48264
  const title = path5.basename(local.name, path5.extname(local.name));