@botpress/runtime 1.7.2 → 1.7.4
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/definition.js +59 -8
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +55 -6
- package/dist/internal.js.map +4 -4
- package/dist/library.d.ts +2 -0
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +57 -6
- package/dist/library.js.map +4 -4
- package/dist/runtime/actions/computed-columns.d.ts.map +1 -1
- package/dist/runtime/actions/order-recompute-columns.d.ts +30 -0
- package/dist/runtime/actions/order-recompute-columns.d.ts.map +1 -0
- package/dist/runtime.js +59 -8
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
package/dist/definition.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.7.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.7.4", adk: "1.7.2", sdk: "4.18.1", llmz: "0.0.27", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -40379,6 +40379,8 @@ ${issues.join("\n")}`;
|
|
|
40379
40379
|
init_define_BUILD();
|
|
40380
40380
|
init_define_PACKAGE_VERSIONS();
|
|
40381
40381
|
import { z as z19 } from "@botpress/sdk";
|
|
40382
|
+
import { Cognitive as Cognitive2 } from "@botpress/cognitive";
|
|
40383
|
+
import { Zai } from "@botpress/zai";
|
|
40382
40384
|
|
|
40383
40385
|
// src/primitives/index.ts
|
|
40384
40386
|
init_define_BUILD();
|
|
@@ -44547,7 +44549,7 @@ var KnowledgeIndexingWorkflow = new BaseWorkflow({
|
|
|
44547
44549
|
});
|
|
44548
44550
|
|
|
44549
44551
|
// src/runtime/adk.ts
|
|
44550
|
-
import { Zai } from "@botpress/zai";
|
|
44552
|
+
import { Zai as Zai2 } from "@botpress/zai";
|
|
44551
44553
|
|
|
44552
44554
|
// src/runtime/actions/index.ts
|
|
44553
44555
|
init_define_BUILD();
|
|
@@ -44557,6 +44559,33 @@ init_define_PACKAGE_VERSIONS();
|
|
|
44557
44559
|
init_define_BUILD();
|
|
44558
44560
|
init_define_PACKAGE_VERSIONS();
|
|
44559
44561
|
import { z as z24 } from "@botpress/sdk";
|
|
44562
|
+
|
|
44563
|
+
// src/runtime/actions/order-recompute-columns.ts
|
|
44564
|
+
init_define_BUILD();
|
|
44565
|
+
init_define_PACKAGE_VERSIONS();
|
|
44566
|
+
function orderRecomputeColumns(toRecompute, staleColumns, columns) {
|
|
44567
|
+
const ordered = [];
|
|
44568
|
+
const visited = /* @__PURE__ */ new Set();
|
|
44569
|
+
function visit(colName) {
|
|
44570
|
+
if (visited.has(colName)) return;
|
|
44571
|
+
visited.add(colName);
|
|
44572
|
+
const deps = columns[colName]?.dependencies || [];
|
|
44573
|
+
for (const dep of deps) {
|
|
44574
|
+
if (staleColumns.has(dep)) {
|
|
44575
|
+
visit(dep);
|
|
44576
|
+
}
|
|
44577
|
+
}
|
|
44578
|
+
if (staleColumns.has(colName) || toRecompute.includes(colName)) {
|
|
44579
|
+
ordered.push(colName);
|
|
44580
|
+
}
|
|
44581
|
+
}
|
|
44582
|
+
for (const col of toRecompute) {
|
|
44583
|
+
visit(col);
|
|
44584
|
+
}
|
|
44585
|
+
return ordered;
|
|
44586
|
+
}
|
|
44587
|
+
|
|
44588
|
+
// src/runtime/actions/computed-columns.ts
|
|
44560
44589
|
var tablesRecomputeRows = new BaseAction({
|
|
44561
44590
|
name: "tablesRecomputeRows",
|
|
44562
44591
|
// skynet/packages/tables-api/src/services/computed/compute-stale-rows.ts
|
|
@@ -44581,26 +44610,48 @@ var tablesRecomputeRows = new BaseAction({
|
|
|
44581
44610
|
const table = adk.project.tables.find((x) => x.name === remoteTable.name);
|
|
44582
44611
|
async function computeRow(row, columnsToRecompute) {
|
|
44583
44612
|
const newRow = { id: row.id };
|
|
44584
|
-
|
|
44613
|
+
const recompute = orderRecomputeColumns(
|
|
44614
|
+
columnsToRecompute,
|
|
44615
|
+
new Set(row.stale ?? []),
|
|
44616
|
+
table?.columns || {}
|
|
44617
|
+
);
|
|
44618
|
+
for (const colName of recompute) {
|
|
44585
44619
|
const col = table?.columns[colName];
|
|
44586
44620
|
if (!col || !col.computed) {
|
|
44587
44621
|
newRow[colName] = { status: "error", error: "Column not found or not computed" };
|
|
44588
44622
|
continue;
|
|
44589
44623
|
}
|
|
44624
|
+
const value = await col.value(row);
|
|
44625
|
+
row[colName] = value;
|
|
44590
44626
|
newRow[colName] = {
|
|
44591
44627
|
status: "computed",
|
|
44592
|
-
value
|
|
44628
|
+
value
|
|
44593
44629
|
};
|
|
44594
44630
|
}
|
|
44595
44631
|
return newRow;
|
|
44596
44632
|
}
|
|
44597
|
-
const
|
|
44633
|
+
const MIN_REMAINING_TIME_MS = 5e3;
|
|
44634
|
+
const BUFFER_TIME_MS = 5e3;
|
|
44635
|
+
let recomputed = [];
|
|
44636
|
+
let isFinished = true;
|
|
44637
|
+
const remainingTime = context2.get("runtime").getRemainingExecutionTimeInMs();
|
|
44638
|
+
if (remainingTime && remainingTime < MIN_REMAINING_TIME_MS) {
|
|
44639
|
+
return { isFinished: false, rows: [] };
|
|
44640
|
+
}
|
|
44641
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
44642
|
+
setTimeout(() => {
|
|
44643
|
+
isFinished = false;
|
|
44644
|
+
resolve();
|
|
44645
|
+
}, remainingTime - BUFFER_TIME_MS);
|
|
44646
|
+
});
|
|
44647
|
+
const allRowsPromise = Promise.all(
|
|
44598
44648
|
requests.map(async (r) => {
|
|
44599
44649
|
const computedRow = await computeRow(r.row, r.columnsToRecompute);
|
|
44600
|
-
|
|
44650
|
+
recomputed.push(computedRow);
|
|
44601
44651
|
})
|
|
44602
44652
|
);
|
|
44603
|
-
|
|
44653
|
+
await Promise.race([timeoutPromise, allRowsPromise]);
|
|
44654
|
+
return { isFinished, rows: recomputed };
|
|
44604
44655
|
}
|
|
44605
44656
|
});
|
|
44606
44657
|
|
|
@@ -44625,7 +44676,7 @@ var adk = {
|
|
|
44625
44676
|
return Environment;
|
|
44626
44677
|
},
|
|
44627
44678
|
get zai() {
|
|
44628
|
-
return new
|
|
44679
|
+
return new Zai2({
|
|
44629
44680
|
client: context2.get("cognitive"),
|
|
44630
44681
|
modelId: Array.isArray(adk.project.config.defaultModels.zai) ? adk.project.config.defaultModels.zai[0] ?? "auto" : adk.project.config.defaultModels.zai
|
|
44631
44682
|
});
|