@botpress/runtime 1.10.4 → 1.11.0
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/constants.d.ts +9 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/definition.js +336 -239
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +166 -53
- package/dist/internal.js.map +4 -4
- package/dist/library.js +166 -53
- package/dist/library.js.map +4 -4
- package/dist/primitives/data-sources/source-base.d.ts +12 -6
- package/dist/primitives/data-sources/source-base.d.ts.map +1 -1
- package/dist/primitives/data-sources/source-directory.d.ts +6 -3
- package/dist/primitives/data-sources/source-directory.d.ts.map +1 -1
- package/dist/primitives/data-sources/source-table.d.ts +6 -3
- package/dist/primitives/data-sources/source-table.d.ts.map +1 -1
- package/dist/primitives/data-sources/source-website.d.ts +10 -4
- package/dist/primitives/data-sources/source-website.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +6 -3
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/knowledge.d.ts +6 -2
- package/dist/primitives/knowledge.d.ts.map +1 -1
- package/dist/runtime/autonomous.d.ts.map +1 -1
- package/dist/runtime/tracked-state.d.ts +2 -0
- package/dist/runtime/tracked-state.d.ts.map +1 -1
- package/dist/runtime/workflows/knowledge-indexing.d.ts +3 -0
- package/dist/runtime/workflows/knowledge-indexing.d.ts.map +1 -1
- package/dist/runtime.js +144 -47
- 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.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.11.0", adk: "1.11.0", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -855,9 +855,9 @@ var require_combined_stream = __commonJS({
|
|
|
855
855
|
}
|
|
856
856
|
});
|
|
857
857
|
|
|
858
|
-
// ../../node_modules/mime-db/db.json
|
|
858
|
+
// ../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/db.json
|
|
859
859
|
var require_db = __commonJS({
|
|
860
|
-
"../../node_modules/mime-db/db.json"(exports2, module) {
|
|
860
|
+
"../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/db.json"(exports2, module) {
|
|
861
861
|
module.exports = {
|
|
862
862
|
"application/1d-interleaved-parityfec": {
|
|
863
863
|
source: "iana"
|
|
@@ -9380,18 +9380,18 @@ var require_db = __commonJS({
|
|
|
9380
9380
|
}
|
|
9381
9381
|
});
|
|
9382
9382
|
|
|
9383
|
-
// ../../node_modules/mime-db/index.js
|
|
9383
|
+
// ../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js
|
|
9384
9384
|
var require_mime_db = __commonJS({
|
|
9385
|
-
"../../node_modules/mime-db/index.js"(exports2, module) {
|
|
9385
|
+
"../../node_modules/form-data/node_modules/mime-types/node_modules/mime-db/index.js"(exports2, module) {
|
|
9386
9386
|
init_define_BUILD();
|
|
9387
9387
|
init_define_PACKAGE_VERSIONS();
|
|
9388
9388
|
module.exports = require_db();
|
|
9389
9389
|
}
|
|
9390
9390
|
});
|
|
9391
9391
|
|
|
9392
|
-
// ../../node_modules/mime-types/index.js
|
|
9392
|
+
// ../../node_modules/form-data/node_modules/mime-types/index.js
|
|
9393
9393
|
var require_mime_types = __commonJS({
|
|
9394
|
-
"../../node_modules/mime-types/index.js"(exports2) {
|
|
9394
|
+
"../../node_modules/form-data/node_modules/mime-types/index.js"(exports2) {
|
|
9395
9395
|
"use strict";
|
|
9396
9396
|
init_define_BUILD();
|
|
9397
9397
|
init_define_PACKAGE_VERSIONS();
|
|
@@ -33301,15 +33301,14 @@ var init_constants = __esm({
|
|
|
33301
33301
|
WellKnownTags = {
|
|
33302
33302
|
knowledge: {
|
|
33303
33303
|
/**
|
|
33304
|
-
* All knowledge base have this tag (with value "
|
|
33305
|
-
* @example "
|
|
33304
|
+
* All knowledge base have this tag (with value "knowledge-base") to identify them as knowledge-related records.
|
|
33305
|
+
* @example "source": "knowledge-base"
|
|
33306
33306
|
*/
|
|
33307
|
-
KNOWLEDGE: "
|
|
33307
|
+
KNOWLEDGE: "source",
|
|
33308
33308
|
/**
|
|
33309
33309
|
* The ID of the knowledge base the record belongs to.
|
|
33310
|
-
* This is the ID of the Knowledge Base primitive
|
|
33310
|
+
* This is the ID of the Knowledge Base primitive from Botpress.
|
|
33311
33311
|
* @example "kbId": "kb_01K6RT9T39KF7K0A7R7D71TDZ1"
|
|
33312
|
-
* @deprecated Use KNOWLEDGE_BASE_NAME for now, as we will be moving to IDs later.
|
|
33313
33312
|
*/
|
|
33314
33313
|
KNOWLEDGE_BASE_ID: "kbId",
|
|
33315
33314
|
/**
|
|
@@ -33319,15 +33318,15 @@ var init_constants = __esm({
|
|
|
33319
33318
|
KNOWLEDGE_BASE_NAME: "kbName",
|
|
33320
33319
|
/**
|
|
33321
33320
|
* The ID of the Data Source the record was ingested from.
|
|
33322
|
-
* @example "
|
|
33321
|
+
* @example "dsId": "docs"
|
|
33323
33322
|
*/
|
|
33324
|
-
KNOWLEDGE_SOURCE_ID: "
|
|
33323
|
+
KNOWLEDGE_SOURCE_ID: "dsId",
|
|
33325
33324
|
/**
|
|
33326
33325
|
* The type of the Data Source the record was ingested from.
|
|
33327
|
-
* Possible values are: "
|
|
33328
|
-
* @example "
|
|
33326
|
+
* Possible values are: "document", "rich-text", "web-page", etc.
|
|
33327
|
+
* @example "dsType": "document"
|
|
33329
33328
|
*/
|
|
33330
|
-
KNOWLEDGE_SOURCE_TYPE: "
|
|
33329
|
+
KNOWLEDGE_SOURCE_TYPE: "dsType"
|
|
33331
33330
|
}
|
|
33332
33331
|
};
|
|
33333
33332
|
WellKnownMetadata = {
|
|
@@ -33424,7 +33423,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
33424
33423
|
includeBreadcrumb: true,
|
|
33425
33424
|
contextDepth: 4,
|
|
33426
33425
|
tags: {
|
|
33427
|
-
[WellKnownTags.knowledge.KNOWLEDGE]: "
|
|
33426
|
+
[WellKnownTags.knowledge.KNOWLEDGE]: "knowledge-base",
|
|
33428
33427
|
[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: kbNames
|
|
33429
33428
|
}
|
|
33430
33429
|
});
|
|
@@ -33459,11 +33458,14 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
33459
33458
|
if (tags[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]) {
|
|
33460
33459
|
citationMetadata.knowledgeBase = tags[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME];
|
|
33461
33460
|
}
|
|
33461
|
+
if (tags[WellKnownTags.knowledge.KNOWLEDGE_BASE_ID]) {
|
|
33462
|
+
citationMetadata.knowledgeBaseId = tags[WellKnownTags.knowledge.KNOWLEDGE_BASE_ID];
|
|
33463
|
+
}
|
|
33462
33464
|
if (tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]) {
|
|
33463
|
-
citationMetadata.
|
|
33465
|
+
citationMetadata.dsType = tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE];
|
|
33464
33466
|
}
|
|
33465
33467
|
if (tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]) {
|
|
33466
|
-
citationMetadata.
|
|
33468
|
+
citationMetadata.dsId = tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID];
|
|
33467
33469
|
}
|
|
33468
33470
|
for (const key in citationMetadata) {
|
|
33469
33471
|
let value = citationMetadata[key];
|
|
@@ -34441,8 +34443,9 @@ var init_source_base = __esm({
|
|
|
34441
34443
|
size: z9.number()
|
|
34442
34444
|
});
|
|
34443
34445
|
SyncInput = z9.object({
|
|
34444
|
-
|
|
34446
|
+
dsId: z9.string(),
|
|
34445
34447
|
kbName: z9.string(),
|
|
34448
|
+
kbId: z9.string(),
|
|
34446
34449
|
force: z9.boolean().optional().describe("Force re-indexing even if files haven't changed").default(false)
|
|
34447
34450
|
});
|
|
34448
34451
|
SyncOutput = z9.object({
|
|
@@ -34459,18 +34462,16 @@ var init_source_base = __esm({
|
|
|
34459
34462
|
state: props.state,
|
|
34460
34463
|
timeout: "120m",
|
|
34461
34464
|
async handler(execProps) {
|
|
34462
|
-
const { kbName,
|
|
34465
|
+
const { kbName, kbId, dsId } = execProps.input;
|
|
34463
34466
|
const kb = adk.project.knowledge.find((kb2) => kb2.name === kbName);
|
|
34464
34467
|
if (!kb) {
|
|
34465
34468
|
throw new Error(`Knowledge base '${kbName}' not found`);
|
|
34466
34469
|
}
|
|
34467
|
-
const source = kb.sources.find((s) => s.id ===
|
|
34470
|
+
const source = kb.sources.find((s) => s.id === dsId);
|
|
34468
34471
|
if (!source) {
|
|
34469
|
-
throw new Error(`Data source with ID '${
|
|
34472
|
+
throw new Error(`Data source with ID '${dsId}' not found in knowledge base '${kbName}'`);
|
|
34470
34473
|
}
|
|
34471
|
-
console.log(
|
|
34472
|
-
`\u{1F504} Starting sync for data source '${sourceId}' of type '${source.type}' in knowledge base '${kbName}'`
|
|
34473
|
-
);
|
|
34474
|
+
console.log(`\u{1F504} Starting sync for data source '${dsId}' of type '${source.type}' in knowledge base '${kbName}' (${kbId})`);
|
|
34474
34475
|
return await props.handler.bind(source)(execProps);
|
|
34475
34476
|
}
|
|
34476
34477
|
});
|
|
@@ -36161,6 +36162,7 @@ var init_source_website = __esm({
|
|
|
36161
36162
|
init_constants();
|
|
36162
36163
|
init_fxp();
|
|
36163
36164
|
init_library();
|
|
36165
|
+
init_context3();
|
|
36164
36166
|
init_html_fetch();
|
|
36165
36167
|
State = z11.object({
|
|
36166
36168
|
urls: z11.array(
|
|
@@ -36177,6 +36179,7 @@ var init_source_website = __esm({
|
|
|
36177
36179
|
mode;
|
|
36178
36180
|
baseUrl;
|
|
36179
36181
|
sitemapUrl;
|
|
36182
|
+
llmsTxtUrl;
|
|
36180
36183
|
urls;
|
|
36181
36184
|
filterFn;
|
|
36182
36185
|
customFetch;
|
|
@@ -36185,10 +36188,11 @@ var init_source_website = __esm({
|
|
|
36185
36188
|
maxDepth;
|
|
36186
36189
|
transformFn;
|
|
36187
36190
|
constructor(id, mode, options) {
|
|
36188
|
-
super(id, "
|
|
36191
|
+
super(id, "web-page");
|
|
36189
36192
|
this.mode = mode;
|
|
36190
36193
|
this.baseUrl = options.baseUrl ?? void 0;
|
|
36191
36194
|
this.sitemapUrl = options.sitemapUrl ?? void 0;
|
|
36195
|
+
this.llmsTxtUrl = options.llmsTxtUrl ?? void 0;
|
|
36192
36196
|
this.urls = options.urls ?? void 0;
|
|
36193
36197
|
this.filterFn = "filter" in options ? options.filter : void 0;
|
|
36194
36198
|
if (typeof options.fetch === "string") {
|
|
@@ -36217,6 +36221,9 @@ var init_source_website = __esm({
|
|
|
36217
36221
|
} else if (this.mode === "sitemap") {
|
|
36218
36222
|
config.sitemapUrl = this.sitemapUrl;
|
|
36219
36223
|
config.maxPages = this.maxPages;
|
|
36224
|
+
} else if (this.mode === "llms-txt") {
|
|
36225
|
+
config.llmsTxtUrl = this.llmsTxtUrl;
|
|
36226
|
+
config.maxPages = this.maxPages;
|
|
36220
36227
|
} else if (this.mode === "urls") {
|
|
36221
36228
|
config.urls = this.urls;
|
|
36222
36229
|
}
|
|
@@ -36268,7 +36275,7 @@ var init_source_website = __esm({
|
|
|
36268
36275
|
/**
|
|
36269
36276
|
* Fetch content from a URL for sitemap parsing (raw content needed)
|
|
36270
36277
|
*/
|
|
36271
|
-
async
|
|
36278
|
+
async fetchRaw(url2) {
|
|
36272
36279
|
if (this.customFetch) {
|
|
36273
36280
|
try {
|
|
36274
36281
|
return await this.customFetch(url2);
|
|
@@ -36386,6 +36393,21 @@ var init_source_website = __esm({
|
|
|
36386
36393
|
}
|
|
36387
36394
|
return { urls };
|
|
36388
36395
|
}
|
|
36396
|
+
parseLlmsTxt(content) {
|
|
36397
|
+
const urls = [];
|
|
36398
|
+
const lines = content.split("\n");
|
|
36399
|
+
const urlRegex = /https?:\/\/[^\s)]+\.md/g;
|
|
36400
|
+
for (const line of lines) {
|
|
36401
|
+
const matches = line.matchAll(urlRegex);
|
|
36402
|
+
for (const match2 of matches) {
|
|
36403
|
+
const [url2] = match2;
|
|
36404
|
+
if (url2) {
|
|
36405
|
+
urls.push(url2);
|
|
36406
|
+
}
|
|
36407
|
+
}
|
|
36408
|
+
}
|
|
36409
|
+
return { urls };
|
|
36410
|
+
}
|
|
36389
36411
|
/**
|
|
36390
36412
|
* Discover URLs from a website using browser integration
|
|
36391
36413
|
*/
|
|
@@ -36443,6 +36465,28 @@ var init_source_website = __esm({
|
|
|
36443
36465
|
if (this.mode === "website") {
|
|
36444
36466
|
return this.discoverUrlsFromWebsite(step2);
|
|
36445
36467
|
}
|
|
36468
|
+
if (this.mode === "llms-txt") {
|
|
36469
|
+
if (!this.llmsTxtUrl) {
|
|
36470
|
+
throw new Error("No llms.txt URL provided");
|
|
36471
|
+
}
|
|
36472
|
+
const { content } = await step2("fetch llms.txt", () => this.fetchRaw(this.llmsTxtUrl));
|
|
36473
|
+
const { urls } = this.parseLlmsTxt(content);
|
|
36474
|
+
console.log(`Parsed ${urls.length} URLs from llms.txt`);
|
|
36475
|
+
const filteredUrls = [];
|
|
36476
|
+
for (const url2 of urls) {
|
|
36477
|
+
if (filteredUrls.length >= this.maxPages) {
|
|
36478
|
+
console.log(`Reached maxPages limit (${this.maxPages}), stopping`);
|
|
36479
|
+
break;
|
|
36480
|
+
}
|
|
36481
|
+
const filterContext = { url: url2 };
|
|
36482
|
+
if (!this.filterFn || this.filterFn(filterContext)) {
|
|
36483
|
+
filteredUrls.push({ loc: url2 });
|
|
36484
|
+
} else {
|
|
36485
|
+
console.log(`Skipped URL (filtered): ${url2}`);
|
|
36486
|
+
}
|
|
36487
|
+
}
|
|
36488
|
+
return filteredUrls;
|
|
36489
|
+
}
|
|
36446
36490
|
if (!this.sitemapUrl) {
|
|
36447
36491
|
throw new Error("No sitemap URL provided");
|
|
36448
36492
|
}
|
|
@@ -36456,7 +36500,7 @@ var init_source_website = __esm({
|
|
|
36456
36500
|
}
|
|
36457
36501
|
await step2(`processing sitemap ${item.url}`, async () => {
|
|
36458
36502
|
try {
|
|
36459
|
-
const { content, contentType } = await this.
|
|
36503
|
+
const { content, contentType } = await this.fetchRaw(item.url);
|
|
36460
36504
|
console.log(`Fetched sitemap ${item.url} (${content.length} bytes), processing... ${contentType}`);
|
|
36461
36505
|
console.log(content, contentType);
|
|
36462
36506
|
try {
|
|
@@ -36525,15 +36569,16 @@ var init_source_website = __esm({
|
|
|
36525
36569
|
console.log(
|
|
36526
36570
|
`Starting sync for WebsiteSource [${this.id}] in mode [${this.mode}, maxPages=${this.maxPages}, maxDepth=${this.maxDepth}, baseUrl=${this.baseUrl}, sitemapUrl=${this.sitemapUrl}]`
|
|
36527
36571
|
);
|
|
36528
|
-
console.log(`Using knowledge base: ${input.kbName}, force reindex: ${!!input.force}, ${input.
|
|
36572
|
+
console.log(`Using knowledge base: ${input.kbName}, force reindex: ${!!input.force}, ${input.dsId}`);
|
|
36529
36573
|
if (input.force) {
|
|
36530
36574
|
console.log("\u{1F504} FORCE MODE: Re-indexing all files regardless of changes");
|
|
36531
36575
|
}
|
|
36532
36576
|
const tags = {
|
|
36533
|
-
[WellKnownTags.knowledge.KNOWLEDGE]: "
|
|
36577
|
+
[WellKnownTags.knowledge.KNOWLEDGE]: "knowledge-base",
|
|
36578
|
+
[WellKnownTags.knowledge.KNOWLEDGE_BASE_ID]: input.kbId,
|
|
36579
|
+
[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: input.kbName,
|
|
36534
36580
|
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]: this.id,
|
|
36535
|
-
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: this.type
|
|
36536
|
-
[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: input.kbName
|
|
36581
|
+
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: this.type
|
|
36537
36582
|
};
|
|
36538
36583
|
const discoveredUrls = await step2("discover urls from sitemap", () => this.discoverUrls(step2, state));
|
|
36539
36584
|
console.log(`Discovered ${discoveredUrls.length} URLs from sitemap`);
|
|
@@ -36579,6 +36624,7 @@ var init_source_website = __esm({
|
|
|
36579
36624
|
console.log(
|
|
36580
36625
|
`To fetch: ${toFetch.length}, To remove: ${toRemove.length}, Skipped (unchanged): ${skippedUnchanged}${input.force ? " [FORCE MODE]" : ""}`
|
|
36581
36626
|
);
|
|
36627
|
+
console.log(`[SYNC DEBUG] Starting 'deleting removed urls' step...`);
|
|
36582
36628
|
const deleted = await step2.map(
|
|
36583
36629
|
"deleting removed urls",
|
|
36584
36630
|
toRemove,
|
|
@@ -36592,6 +36638,7 @@ var init_source_website = __esm({
|
|
|
36592
36638
|
),
|
|
36593
36639
|
{ concurrency: 5 }
|
|
36594
36640
|
);
|
|
36641
|
+
console.log(`[SYNC DEBUG] Deleted ${deleted.length} URLs, starting fetch phase...`);
|
|
36595
36642
|
const fetchAndIndex = async (sitemapUrl) => {
|
|
36596
36643
|
try {
|
|
36597
36644
|
const {
|
|
@@ -36638,8 +36685,8 @@ var init_source_website = __esm({
|
|
|
36638
36685
|
...fetchMetadata?.[WellKnownMetadata.knowledge.FAVICON] && {
|
|
36639
36686
|
[WellKnownMetadata.knowledge.FAVICON]: fetchMetadata[WellKnownMetadata.knowledge.FAVICON]
|
|
36640
36687
|
},
|
|
36641
|
-
|
|
36642
|
-
|
|
36688
|
+
dsId: this.id,
|
|
36689
|
+
dsType: this.type
|
|
36643
36690
|
}
|
|
36644
36691
|
});
|
|
36645
36692
|
return {
|
|
@@ -36653,13 +36700,53 @@ var init_source_website = __esm({
|
|
|
36653
36700
|
return null;
|
|
36654
36701
|
}
|
|
36655
36702
|
};
|
|
36703
|
+
console.log(`[SYNC DEBUG] Starting 'fetching and indexing pages' for ${toFetch.slice(0, this.maxPages).length} URLs...`);
|
|
36656
36704
|
const indexed = await step2.map(
|
|
36657
36705
|
"fetching and indexing pages",
|
|
36658
36706
|
toFetch.slice(0, this.maxPages),
|
|
36659
36707
|
(url2) => fetchAndIndex(url2),
|
|
36660
36708
|
{ concurrency: 20, maxAttempts: 2 }
|
|
36661
36709
|
);
|
|
36710
|
+
console.log(`[SYNC DEBUG] Fetch complete. ${indexed.length} attempted, ${indexed.filter((f) => f !== null).length} successful`);
|
|
36662
36711
|
const successful = indexed.filter((f) => f !== null);
|
|
36712
|
+
console.log(`[SYNC DEBUG] Starting dsData registration...`);
|
|
36713
|
+
await step2("register web page source", async () => {
|
|
36714
|
+
try {
|
|
36715
|
+
const botId = context2.get("botId");
|
|
36716
|
+
const getStateResult = await client._inner.getState({ id: botId, type: "bot", name: "dsData" }).catch(() => ({ state: null }));
|
|
36717
|
+
const freshState = getStateResult.state;
|
|
36718
|
+
const existingPayload = freshState?.payload || {};
|
|
36719
|
+
const kbPayload = existingPayload[input.kbId] || {};
|
|
36720
|
+
const websiteUrl = this.baseUrl || this.sitemapUrl || this.urls?.[0] || "";
|
|
36721
|
+
const getTitle = () => {
|
|
36722
|
+
if (!websiteUrl) return "Website";
|
|
36723
|
+
try {
|
|
36724
|
+
const urlWithProtocol = websiteUrl.includes("://") ? websiteUrl : `https://${websiteUrl}`;
|
|
36725
|
+
return new URL(urlWithProtocol).hostname;
|
|
36726
|
+
} catch {
|
|
36727
|
+
return websiteUrl;
|
|
36728
|
+
}
|
|
36729
|
+
};
|
|
36730
|
+
kbPayload[this.id] = {
|
|
36731
|
+
type: "web-page",
|
|
36732
|
+
title: getTitle(),
|
|
36733
|
+
createdOn: kbPayload[this.id]?.createdOn || Date.now(),
|
|
36734
|
+
// Preserve original creation time
|
|
36735
|
+
data: { websiteUrl, pages: [], indexingJobs: [] }
|
|
36736
|
+
};
|
|
36737
|
+
existingPayload[input.kbId] = kbPayload;
|
|
36738
|
+
await client._inner.setState({
|
|
36739
|
+
id: botId,
|
|
36740
|
+
type: "bot",
|
|
36741
|
+
name: "dsData",
|
|
36742
|
+
payload: existingPayload
|
|
36743
|
+
});
|
|
36744
|
+
console.log(`Registered web page source "${this.id}" in dsData for KB ${input.kbId}`);
|
|
36745
|
+
} catch (err) {
|
|
36746
|
+
console.warn("Failed to register web page source in dsData state:", err);
|
|
36747
|
+
}
|
|
36748
|
+
});
|
|
36749
|
+
console.log(`[SYNC DEBUG] \u2705 WebsiteSource sync complete for "${this.id}". Processed: ${discoveredUrls.length}, Added: ${successful.length}, Deleted: ${deleted.length}`);
|
|
36663
36750
|
return {
|
|
36664
36751
|
processed: discoveredUrls.length,
|
|
36665
36752
|
deleted,
|
|
@@ -36678,6 +36765,10 @@ var init_source_website = __esm({
|
|
|
36678
36765
|
const id = options.id || `sitemap_${sitemapUrl.replace(/https?:\/\//, "").replace(/\//g, "_")}`;
|
|
36679
36766
|
return new _WebsiteSource(id, "sitemap", { ...options, sitemapUrl });
|
|
36680
36767
|
}
|
|
36768
|
+
static fromLlmsTxt(llmsTxtUrl, options = {}) {
|
|
36769
|
+
const id = options.id || `llmstxt_${llmsTxtUrl.replace(/https?:\/\//, "").replace(/\//g, "_")}`;
|
|
36770
|
+
return new _WebsiteSource(id, "llms-txt", { ...options, llmsTxtUrl });
|
|
36771
|
+
}
|
|
36681
36772
|
static fromUrls(urls, options = {}) {
|
|
36682
36773
|
let defaultId = `urls_${urls.length}_pages`;
|
|
36683
36774
|
if (urls.length > 0) {
|
|
@@ -43497,7 +43588,7 @@ var init_source_directory = __esm({
|
|
|
43497
43588
|
_directoryPath;
|
|
43498
43589
|
_filterFn;
|
|
43499
43590
|
constructor(id, directoryPath, options = {}) {
|
|
43500
|
-
super(id, "
|
|
43591
|
+
super(id, "document");
|
|
43501
43592
|
this._directoryPath = directoryPath;
|
|
43502
43593
|
this._filterFn = options.filter ?? void 0;
|
|
43503
43594
|
}
|
|
@@ -43542,10 +43633,11 @@ var init_source_directory = __esm({
|
|
|
43542
43633
|
const crypto3 = await import("crypto");
|
|
43543
43634
|
const directory = path4.resolve(adk.environment.agent.directory, this.directoryPath);
|
|
43544
43635
|
const tags = {
|
|
43545
|
-
[WellKnownTags.knowledge.KNOWLEDGE]: "
|
|
43636
|
+
[WellKnownTags.knowledge.KNOWLEDGE]: "knowledge-base",
|
|
43637
|
+
[WellKnownTags.knowledge.KNOWLEDGE_BASE_ID]: input.kbId,
|
|
43638
|
+
[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: input.kbName,
|
|
43546
43639
|
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]: this.id,
|
|
43547
|
-
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: this.type
|
|
43548
|
-
[WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: input.kbName
|
|
43640
|
+
[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: this.type
|
|
43549
43641
|
};
|
|
43550
43642
|
if (!directory.startsWith(adk.environment.agent.directory)) {
|
|
43551
43643
|
throw new Error("Directory path must be within the agent's directory");
|
|
@@ -43629,8 +43721,8 @@ var init_source_directory = __esm({
|
|
|
43629
43721
|
},
|
|
43630
43722
|
metadata: {
|
|
43631
43723
|
hash,
|
|
43632
|
-
|
|
43633
|
-
|
|
43724
|
+
dsId: this.id,
|
|
43725
|
+
dsType: this.type,
|
|
43634
43726
|
relPath: local.rel,
|
|
43635
43727
|
[WellKnownMetadata.knowledge.TITLE]: title
|
|
43636
43728
|
}
|
|
@@ -43667,10 +43759,10 @@ var init_source_directory = __esm({
|
|
|
43667
43759
|
|
|
43668
43760
|
// src/primitives/data-sources/index.ts
|
|
43669
43761
|
function isDirectorySource(source) {
|
|
43670
|
-
return source.type === "
|
|
43762
|
+
return source.type === "document";
|
|
43671
43763
|
}
|
|
43672
43764
|
function isWebsiteSource(source) {
|
|
43673
|
-
return source.type === "
|
|
43765
|
+
return source.type === "web-page";
|
|
43674
43766
|
}
|
|
43675
43767
|
function isTableSource(source) {
|
|
43676
43768
|
return source.type === "table";
|
|
@@ -43872,177 +43964,6 @@ var init_conversation = __esm({
|
|
|
43872
43964
|
}
|
|
43873
43965
|
});
|
|
43874
43966
|
|
|
43875
|
-
// src/primitives/knowledge.ts
|
|
43876
|
-
var Typings3;
|
|
43877
|
-
var init_knowledge = __esm({
|
|
43878
|
-
"src/primitives/knowledge.ts"() {
|
|
43879
|
-
"use strict";
|
|
43880
|
-
init_define_BUILD();
|
|
43881
|
-
init_define_PACKAGE_VERSIONS();
|
|
43882
|
-
init_knowledge_indexing();
|
|
43883
|
-
((Typings8) => {
|
|
43884
|
-
Typings8.Primitive = "knowledge";
|
|
43885
|
-
})(Typings3 || (Typings3 = {}));
|
|
43886
|
-
}
|
|
43887
|
-
});
|
|
43888
|
-
|
|
43889
|
-
// src/primitives/action.ts
|
|
43890
|
-
import { transforms } from "@botpress/sdk";
|
|
43891
|
-
var Typings4, BaseAction;
|
|
43892
|
-
var init_action = __esm({
|
|
43893
|
-
"src/primitives/action.ts"() {
|
|
43894
|
-
"use strict";
|
|
43895
|
-
init_define_BUILD();
|
|
43896
|
-
init_define_PACKAGE_VERSIONS();
|
|
43897
|
-
((Typings8) => {
|
|
43898
|
-
Typings8.Primitive = "action";
|
|
43899
|
-
})(Typings4 || (Typings4 = {}));
|
|
43900
|
-
BaseAction = class {
|
|
43901
|
-
name;
|
|
43902
|
-
title;
|
|
43903
|
-
description;
|
|
43904
|
-
attributes;
|
|
43905
|
-
input;
|
|
43906
|
-
output;
|
|
43907
|
-
cached;
|
|
43908
|
-
handler;
|
|
43909
|
-
constructor(props) {
|
|
43910
|
-
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(props.name)) {
|
|
43911
|
-
throw new Error(`Action name "${props.name}" must be alphanumeric with no special characters or spaces`);
|
|
43912
|
-
}
|
|
43913
|
-
this.name = props.name;
|
|
43914
|
-
if (props.title !== void 0) {
|
|
43915
|
-
this.title = props.title;
|
|
43916
|
-
}
|
|
43917
|
-
if (props.description !== void 0) {
|
|
43918
|
-
this.description = props.description;
|
|
43919
|
-
}
|
|
43920
|
-
if (props.attributes !== void 0) {
|
|
43921
|
-
this.attributes = props.attributes;
|
|
43922
|
-
}
|
|
43923
|
-
this.input = props.input;
|
|
43924
|
-
this.output = props.output;
|
|
43925
|
-
this.cached = props.cached ?? false;
|
|
43926
|
-
this.handler = props.handler;
|
|
43927
|
-
}
|
|
43928
|
-
/** @internal */
|
|
43929
|
-
getDefinition() {
|
|
43930
|
-
const def = {
|
|
43931
|
-
type: "action",
|
|
43932
|
-
name: this.name
|
|
43933
|
-
};
|
|
43934
|
-
if (this.title !== void 0) {
|
|
43935
|
-
def.title = this.title;
|
|
43936
|
-
}
|
|
43937
|
-
if (this.description !== void 0) {
|
|
43938
|
-
def.description = this.description;
|
|
43939
|
-
}
|
|
43940
|
-
if (this.input) {
|
|
43941
|
-
def.input = transforms.toJSONSchema(this.input);
|
|
43942
|
-
}
|
|
43943
|
-
if (this.output) {
|
|
43944
|
-
def.output = transforms.toJSONSchema(this.output);
|
|
43945
|
-
}
|
|
43946
|
-
if (this.cached !== void 0) {
|
|
43947
|
-
def.cached = this.cached;
|
|
43948
|
-
}
|
|
43949
|
-
if (this.attributes !== void 0) {
|
|
43950
|
-
def.attributes = this.attributes;
|
|
43951
|
-
}
|
|
43952
|
-
return def;
|
|
43953
|
-
}
|
|
43954
|
-
/**
|
|
43955
|
-
* Execute the action with input validation and output validation
|
|
43956
|
-
*/
|
|
43957
|
-
async execute({ input, client }) {
|
|
43958
|
-
return await this.handler({ input, client });
|
|
43959
|
-
}
|
|
43960
|
-
};
|
|
43961
|
-
}
|
|
43962
|
-
});
|
|
43963
|
-
|
|
43964
|
-
// src/primitives/table.ts
|
|
43965
|
-
import { transforms as transforms2, z as z15 } from "@bpinternal/zui";
|
|
43966
|
-
var Typings5;
|
|
43967
|
-
var init_table = __esm({
|
|
43968
|
-
"src/primitives/table.ts"() {
|
|
43969
|
-
"use strict";
|
|
43970
|
-
init_define_BUILD();
|
|
43971
|
-
init_define_PACKAGE_VERSIONS();
|
|
43972
|
-
init_context3();
|
|
43973
|
-
init_errors();
|
|
43974
|
-
((Typings8) => {
|
|
43975
|
-
Typings8.Primitive = "table";
|
|
43976
|
-
})(Typings5 || (Typings5 = {}));
|
|
43977
|
-
}
|
|
43978
|
-
});
|
|
43979
|
-
|
|
43980
|
-
// src/primitives/trigger.ts
|
|
43981
|
-
import { z as z16 } from "@botpress/sdk";
|
|
43982
|
-
var Typings6, TriggerSchema;
|
|
43983
|
-
var init_trigger = __esm({
|
|
43984
|
-
"src/primitives/trigger.ts"() {
|
|
43985
|
-
"use strict";
|
|
43986
|
-
init_define_BUILD();
|
|
43987
|
-
init_define_PACKAGE_VERSIONS();
|
|
43988
|
-
init_errors();
|
|
43989
|
-
((Typings8) => {
|
|
43990
|
-
Typings8.Primitive = "trigger";
|
|
43991
|
-
})(Typings6 || (Typings6 = {}));
|
|
43992
|
-
TriggerSchema = z16.object({
|
|
43993
|
-
name: z16.string().min(3, "Trigger name must be at least 3 characters").max(255, "Trigger name must be less than 255 characters").regex(/^[a-zA-Z0-9_]+$/, "Trigger name must contain only alphanumeric characters and underscores"),
|
|
43994
|
-
description: z16.string().max(1024, "Description must be less than 1024 characters").optional(),
|
|
43995
|
-
events: z16.array(z16.string()),
|
|
43996
|
-
handler: z16.function().describe("Handler function for the trigger")
|
|
43997
|
-
});
|
|
43998
|
-
}
|
|
43999
|
-
});
|
|
44000
|
-
|
|
44001
|
-
// src/primitives/index.ts
|
|
44002
|
-
var Primitives, DataSource2;
|
|
44003
|
-
var init_primitives = __esm({
|
|
44004
|
-
"src/primitives/index.ts"() {
|
|
44005
|
-
"use strict";
|
|
44006
|
-
init_define_BUILD();
|
|
44007
|
-
init_define_PACKAGE_VERSIONS();
|
|
44008
|
-
init_asset();
|
|
44009
|
-
init_workflow_instance();
|
|
44010
|
-
init_conversation_instance();
|
|
44011
|
-
init_reference();
|
|
44012
|
-
init_definition();
|
|
44013
|
-
init_data_sources();
|
|
44014
|
-
init_conversation();
|
|
44015
|
-
init_knowledge();
|
|
44016
|
-
init_workflow();
|
|
44017
|
-
init_action();
|
|
44018
|
-
init_table();
|
|
44019
|
-
init_trigger();
|
|
44020
|
-
init_conversation();
|
|
44021
|
-
init_knowledge();
|
|
44022
|
-
init_table();
|
|
44023
|
-
init_workflow();
|
|
44024
|
-
init_trigger();
|
|
44025
|
-
((Primitives2) => {
|
|
44026
|
-
Primitives2.Definitions = Definitions;
|
|
44027
|
-
Primitives2.Conversation = Typings2;
|
|
44028
|
-
Primitives2.Knowledge = Typings3;
|
|
44029
|
-
Primitives2.Workflow = Typings7;
|
|
44030
|
-
Primitives2.Action = Typings4;
|
|
44031
|
-
Primitives2.Table = Typings5;
|
|
44032
|
-
Primitives2.Trigger = Typings6;
|
|
44033
|
-
})(Primitives || (Primitives = {}));
|
|
44034
|
-
((DataSource3) => {
|
|
44035
|
-
DataSource3.createSyncWorkflow = createSyncWorkflow;
|
|
44036
|
-
DataSource3.Table = TableSource;
|
|
44037
|
-
DataSource3.Website = WebsiteSource;
|
|
44038
|
-
DataSource3.Directory = DirectorySource;
|
|
44039
|
-
DataSource3.isDirectory = isDirectorySource;
|
|
44040
|
-
DataSource3.isWebsite = isWebsiteSource;
|
|
44041
|
-
DataSource3.isTable = isTableSource;
|
|
44042
|
-
})(DataSource2 || (DataSource2 = {}));
|
|
44043
|
-
}
|
|
44044
|
-
});
|
|
44045
|
-
|
|
44046
43967
|
// src/globals.ts
|
|
44047
43968
|
var DefinedGlobalObjects;
|
|
44048
43969
|
var init_globals = __esm({
|
|
@@ -44219,7 +44140,7 @@ var init_validate_tag_name = __esm({
|
|
|
44219
44140
|
});
|
|
44220
44141
|
|
|
44221
44142
|
// src/define-config.ts
|
|
44222
|
-
import { z as
|
|
44143
|
+
import { z as z14 } from "@botpress/sdk";
|
|
44223
44144
|
var zuiSchema, modelSchema, tagDefinitionSchema, configSchema, AGENT_CONFIG_BRAND;
|
|
44224
44145
|
var init_define_config = __esm({
|
|
44225
44146
|
"src/define-config.ts"() {
|
|
@@ -44227,7 +44148,7 @@ var init_define_config = __esm({
|
|
|
44227
44148
|
init_define_BUILD();
|
|
44228
44149
|
init_define_PACKAGE_VERSIONS();
|
|
44229
44150
|
init_validate_tag_name();
|
|
44230
|
-
zuiSchema =
|
|
44151
|
+
zuiSchema = z14.custom(
|
|
44231
44152
|
(val) => {
|
|
44232
44153
|
if (typeof val === "object" && val !== null && "parse" in val) {
|
|
44233
44154
|
return true;
|
|
@@ -44238,41 +44159,41 @@ var init_define_config = __esm({
|
|
|
44238
44159
|
message: "Invalid ZUI Schema, must be an instance of z.object()"
|
|
44239
44160
|
}
|
|
44240
44161
|
);
|
|
44241
|
-
modelSchema =
|
|
44162
|
+
modelSchema = z14.custom(
|
|
44242
44163
|
(val) => typeof val === "string" && val.length > 0 || Array.isArray(val) && val.every((m) => typeof m === "string" && m.length > 0),
|
|
44243
44164
|
{
|
|
44244
44165
|
message: "Model must be a non-empty string, or an array of non-empty strings"
|
|
44245
44166
|
}
|
|
44246
44167
|
);
|
|
44247
|
-
tagDefinitionSchema =
|
|
44248
|
-
|
|
44249
|
-
|
|
44250
|
-
title:
|
|
44251
|
-
description:
|
|
44168
|
+
tagDefinitionSchema = z14.record(
|
|
44169
|
+
z14.string(),
|
|
44170
|
+
z14.object({
|
|
44171
|
+
title: z14.string(),
|
|
44172
|
+
description: z14.string().optional()
|
|
44252
44173
|
})
|
|
44253
44174
|
);
|
|
44254
|
-
configSchema =
|
|
44255
|
-
name:
|
|
44256
|
-
description:
|
|
44257
|
-
user:
|
|
44175
|
+
configSchema = z14.object({
|
|
44176
|
+
name: z14.string().optional(),
|
|
44177
|
+
description: z14.string().optional(),
|
|
44178
|
+
user: z14.object({
|
|
44258
44179
|
state: zuiSchema.optional(),
|
|
44259
44180
|
tags: tagDefinitionSchema.optional()
|
|
44260
44181
|
}).optional(),
|
|
44261
|
-
bot:
|
|
44182
|
+
bot: z14.object({
|
|
44262
44183
|
state: zuiSchema.optional(),
|
|
44263
44184
|
tags: tagDefinitionSchema.optional()
|
|
44264
44185
|
}).optional(),
|
|
44265
|
-
conversation:
|
|
44186
|
+
conversation: z14.object({
|
|
44266
44187
|
tags: tagDefinitionSchema.optional()
|
|
44267
44188
|
}).optional(),
|
|
44268
|
-
message:
|
|
44189
|
+
message: z14.object({
|
|
44269
44190
|
tags: tagDefinitionSchema.optional()
|
|
44270
44191
|
}).optional(),
|
|
44271
|
-
workflow:
|
|
44192
|
+
workflow: z14.object({
|
|
44272
44193
|
tags: tagDefinitionSchema.optional()
|
|
44273
44194
|
}).optional(),
|
|
44274
|
-
configuration:
|
|
44275
|
-
schema:
|
|
44195
|
+
configuration: z14.object({
|
|
44196
|
+
schema: z14.custom(
|
|
44276
44197
|
(val) => {
|
|
44277
44198
|
if (typeof val === "object" && val !== null && "parse" in val && "_def" in val) {
|
|
44278
44199
|
return val._def?.typeName === "ZodObject";
|
|
@@ -44284,21 +44205,21 @@ var init_define_config = __esm({
|
|
|
44284
44205
|
}
|
|
44285
44206
|
)
|
|
44286
44207
|
}).optional(),
|
|
44287
|
-
defaultModels:
|
|
44208
|
+
defaultModels: z14.object({
|
|
44288
44209
|
zai: modelSchema,
|
|
44289
44210
|
autonomous: modelSchema
|
|
44290
44211
|
}).optional().transform((val) => ({
|
|
44291
44212
|
zai: val?.zai ?? "openai:gpt-4.1-2025-04-14",
|
|
44292
44213
|
autonomous: val?.autonomous ?? "openai:gpt-4.1-mini-2025-04-14"
|
|
44293
44214
|
})),
|
|
44294
|
-
dependencies:
|
|
44215
|
+
dependencies: z14.custom()
|
|
44295
44216
|
});
|
|
44296
44217
|
AGENT_CONFIG_BRAND = Symbol.for("@botpress/runtime/AgentConfig");
|
|
44297
44218
|
}
|
|
44298
44219
|
});
|
|
44299
44220
|
|
|
44300
44221
|
// src/runtime.ts
|
|
44301
|
-
import { z as
|
|
44222
|
+
import { z as z15 } from "@botpress/sdk";
|
|
44302
44223
|
var init_runtime = __esm({
|
|
44303
44224
|
"src/runtime.ts"() {
|
|
44304
44225
|
"use strict";
|
|
@@ -44324,6 +44245,178 @@ var init_runtime = __esm({
|
|
|
44324
44245
|
}
|
|
44325
44246
|
});
|
|
44326
44247
|
|
|
44248
|
+
// src/primitives/knowledge.ts
|
|
44249
|
+
var Typings3;
|
|
44250
|
+
var init_knowledge = __esm({
|
|
44251
|
+
"src/primitives/knowledge.ts"() {
|
|
44252
|
+
"use strict";
|
|
44253
|
+
init_define_BUILD();
|
|
44254
|
+
init_define_PACKAGE_VERSIONS();
|
|
44255
|
+
init_knowledge_indexing();
|
|
44256
|
+
init_runtime();
|
|
44257
|
+
((Typings8) => {
|
|
44258
|
+
Typings8.Primitive = "knowledge";
|
|
44259
|
+
})(Typings3 || (Typings3 = {}));
|
|
44260
|
+
}
|
|
44261
|
+
});
|
|
44262
|
+
|
|
44263
|
+
// src/primitives/action.ts
|
|
44264
|
+
import { transforms } from "@botpress/sdk";
|
|
44265
|
+
var Typings4, BaseAction;
|
|
44266
|
+
var init_action = __esm({
|
|
44267
|
+
"src/primitives/action.ts"() {
|
|
44268
|
+
"use strict";
|
|
44269
|
+
init_define_BUILD();
|
|
44270
|
+
init_define_PACKAGE_VERSIONS();
|
|
44271
|
+
((Typings8) => {
|
|
44272
|
+
Typings8.Primitive = "action";
|
|
44273
|
+
})(Typings4 || (Typings4 = {}));
|
|
44274
|
+
BaseAction = class {
|
|
44275
|
+
name;
|
|
44276
|
+
title;
|
|
44277
|
+
description;
|
|
44278
|
+
attributes;
|
|
44279
|
+
input;
|
|
44280
|
+
output;
|
|
44281
|
+
cached;
|
|
44282
|
+
handler;
|
|
44283
|
+
constructor(props) {
|
|
44284
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(props.name)) {
|
|
44285
|
+
throw new Error(`Action name "${props.name}" must be alphanumeric with no special characters or spaces`);
|
|
44286
|
+
}
|
|
44287
|
+
this.name = props.name;
|
|
44288
|
+
if (props.title !== void 0) {
|
|
44289
|
+
this.title = props.title;
|
|
44290
|
+
}
|
|
44291
|
+
if (props.description !== void 0) {
|
|
44292
|
+
this.description = props.description;
|
|
44293
|
+
}
|
|
44294
|
+
if (props.attributes !== void 0) {
|
|
44295
|
+
this.attributes = props.attributes;
|
|
44296
|
+
}
|
|
44297
|
+
this.input = props.input;
|
|
44298
|
+
this.output = props.output;
|
|
44299
|
+
this.cached = props.cached ?? false;
|
|
44300
|
+
this.handler = props.handler;
|
|
44301
|
+
}
|
|
44302
|
+
/** @internal */
|
|
44303
|
+
getDefinition() {
|
|
44304
|
+
const def = {
|
|
44305
|
+
type: "action",
|
|
44306
|
+
name: this.name
|
|
44307
|
+
};
|
|
44308
|
+
if (this.title !== void 0) {
|
|
44309
|
+
def.title = this.title;
|
|
44310
|
+
}
|
|
44311
|
+
if (this.description !== void 0) {
|
|
44312
|
+
def.description = this.description;
|
|
44313
|
+
}
|
|
44314
|
+
if (this.input) {
|
|
44315
|
+
def.input = transforms.toJSONSchema(this.input);
|
|
44316
|
+
}
|
|
44317
|
+
if (this.output) {
|
|
44318
|
+
def.output = transforms.toJSONSchema(this.output);
|
|
44319
|
+
}
|
|
44320
|
+
if (this.cached !== void 0) {
|
|
44321
|
+
def.cached = this.cached;
|
|
44322
|
+
}
|
|
44323
|
+
if (this.attributes !== void 0) {
|
|
44324
|
+
def.attributes = this.attributes;
|
|
44325
|
+
}
|
|
44326
|
+
return def;
|
|
44327
|
+
}
|
|
44328
|
+
/**
|
|
44329
|
+
* Execute the action with input validation and output validation
|
|
44330
|
+
*/
|
|
44331
|
+
async execute({ input, client }) {
|
|
44332
|
+
return await this.handler({ input, client });
|
|
44333
|
+
}
|
|
44334
|
+
};
|
|
44335
|
+
}
|
|
44336
|
+
});
|
|
44337
|
+
|
|
44338
|
+
// src/primitives/table.ts
|
|
44339
|
+
import { transforms as transforms2, z as z17 } from "@bpinternal/zui";
|
|
44340
|
+
var Typings5;
|
|
44341
|
+
var init_table = __esm({
|
|
44342
|
+
"src/primitives/table.ts"() {
|
|
44343
|
+
"use strict";
|
|
44344
|
+
init_define_BUILD();
|
|
44345
|
+
init_define_PACKAGE_VERSIONS();
|
|
44346
|
+
init_context3();
|
|
44347
|
+
init_errors();
|
|
44348
|
+
((Typings8) => {
|
|
44349
|
+
Typings8.Primitive = "table";
|
|
44350
|
+
})(Typings5 || (Typings5 = {}));
|
|
44351
|
+
}
|
|
44352
|
+
});
|
|
44353
|
+
|
|
44354
|
+
// src/primitives/trigger.ts
|
|
44355
|
+
import { z as z18 } from "@botpress/sdk";
|
|
44356
|
+
var Typings6, TriggerSchema;
|
|
44357
|
+
var init_trigger = __esm({
|
|
44358
|
+
"src/primitives/trigger.ts"() {
|
|
44359
|
+
"use strict";
|
|
44360
|
+
init_define_BUILD();
|
|
44361
|
+
init_define_PACKAGE_VERSIONS();
|
|
44362
|
+
init_errors();
|
|
44363
|
+
((Typings8) => {
|
|
44364
|
+
Typings8.Primitive = "trigger";
|
|
44365
|
+
})(Typings6 || (Typings6 = {}));
|
|
44366
|
+
TriggerSchema = z18.object({
|
|
44367
|
+
name: z18.string().min(3, "Trigger name must be at least 3 characters").max(255, "Trigger name must be less than 255 characters").regex(/^[a-zA-Z0-9_]+$/, "Trigger name must contain only alphanumeric characters and underscores"),
|
|
44368
|
+
description: z18.string().max(1024, "Description must be less than 1024 characters").optional(),
|
|
44369
|
+
events: z18.array(z18.string()),
|
|
44370
|
+
handler: z18.function().describe("Handler function for the trigger")
|
|
44371
|
+
});
|
|
44372
|
+
}
|
|
44373
|
+
});
|
|
44374
|
+
|
|
44375
|
+
// src/primitives/index.ts
|
|
44376
|
+
var Primitives, DataSource2;
|
|
44377
|
+
var init_primitives = __esm({
|
|
44378
|
+
"src/primitives/index.ts"() {
|
|
44379
|
+
"use strict";
|
|
44380
|
+
init_define_BUILD();
|
|
44381
|
+
init_define_PACKAGE_VERSIONS();
|
|
44382
|
+
init_asset();
|
|
44383
|
+
init_workflow_instance();
|
|
44384
|
+
init_conversation_instance();
|
|
44385
|
+
init_reference();
|
|
44386
|
+
init_definition();
|
|
44387
|
+
init_data_sources();
|
|
44388
|
+
init_conversation();
|
|
44389
|
+
init_knowledge();
|
|
44390
|
+
init_workflow();
|
|
44391
|
+
init_action();
|
|
44392
|
+
init_table();
|
|
44393
|
+
init_trigger();
|
|
44394
|
+
init_conversation();
|
|
44395
|
+
init_knowledge();
|
|
44396
|
+
init_table();
|
|
44397
|
+
init_workflow();
|
|
44398
|
+
init_trigger();
|
|
44399
|
+
((Primitives2) => {
|
|
44400
|
+
Primitives2.Definitions = Definitions;
|
|
44401
|
+
Primitives2.Conversation = Typings2;
|
|
44402
|
+
Primitives2.Knowledge = Typings3;
|
|
44403
|
+
Primitives2.Workflow = Typings7;
|
|
44404
|
+
Primitives2.Action = Typings4;
|
|
44405
|
+
Primitives2.Table = Typings5;
|
|
44406
|
+
Primitives2.Trigger = Typings6;
|
|
44407
|
+
})(Primitives || (Primitives = {}));
|
|
44408
|
+
((DataSource3) => {
|
|
44409
|
+
DataSource3.createSyncWorkflow = createSyncWorkflow;
|
|
44410
|
+
DataSource3.Table = TableSource;
|
|
44411
|
+
DataSource3.Website = WebsiteSource;
|
|
44412
|
+
DataSource3.Directory = DirectorySource;
|
|
44413
|
+
DataSource3.isDirectory = isDirectorySource;
|
|
44414
|
+
DataSource3.isWebsite = isWebsiteSource;
|
|
44415
|
+
DataSource3.isTable = isTableSource;
|
|
44416
|
+
})(DataSource2 || (DataSource2 = {}));
|
|
44417
|
+
}
|
|
44418
|
+
});
|
|
44419
|
+
|
|
44327
44420
|
// src/primitives/workflow-utils.ts
|
|
44328
44421
|
var updateWorkflow;
|
|
44329
44422
|
var init_workflow_utils = __esm({
|
|
@@ -45400,12 +45493,13 @@ var init_knowledge_indexing = __esm({
|
|
|
45400
45493
|
description: "Built-in workflow to re-index all data sources in a knowledge base",
|
|
45401
45494
|
input: z24.object({
|
|
45402
45495
|
kbName: z24.string(),
|
|
45496
|
+
kbId: z24.string(),
|
|
45403
45497
|
force: z24.boolean().optional().describe("Force re-indexing even if files haven't changed").default(false)
|
|
45404
45498
|
}),
|
|
45405
45499
|
timeout: "180m",
|
|
45406
45500
|
output: SyncOutput,
|
|
45407
45501
|
handler: async ({ input, step: step2 }) => {
|
|
45408
|
-
const { kbName } = input;
|
|
45502
|
+
const { kbName, kbId } = input;
|
|
45409
45503
|
const kb = adk.project.knowledge.find((x) => x.name === kbName);
|
|
45410
45504
|
if (!kb) {
|
|
45411
45505
|
throw new Error(`Knowledge base '${kbName}' not found`);
|
|
@@ -45421,7 +45515,8 @@ var init_knowledge_indexing = __esm({
|
|
|
45421
45515
|
statuses: ["in_progress", "listening", "pending", "paused"],
|
|
45422
45516
|
input: {
|
|
45423
45517
|
kbName,
|
|
45424
|
-
|
|
45518
|
+
kbId,
|
|
45519
|
+
dsId: source.id,
|
|
45425
45520
|
force: input.force || false
|
|
45426
45521
|
}
|
|
45427
45522
|
}).then((x) => x.id)
|
|
@@ -47531,7 +47626,9 @@ var init_tracked_state = __esm({
|
|
|
47531
47626
|
/** Workflow-specific state (persists across workflow executions) */
|
|
47532
47627
|
workflowState: "workflowState",
|
|
47533
47628
|
/** Workflow cached steps executions */
|
|
47534
|
-
workflowSteps: "workflowSteps"
|
|
47629
|
+
workflowSteps: "workflowSteps",
|
|
47630
|
+
/** Data source metadata for dashboard visibility */
|
|
47631
|
+
dsData: "dsData"
|
|
47535
47632
|
};
|
|
47536
47633
|
TrackedState = class _TrackedState {
|
|
47537
47634
|
type;
|