@botpress/runtime 1.13.2 → 1.13.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 +75 -20
- package/dist/definition.js.map +3 -3
- package/dist/internal.js +75 -20
- package/dist/internal.js.map +2 -2
- package/dist/library.js +75 -20
- package/dist/library.js.map +2 -2
- package/dist/runtime/configuration.d.ts +6 -1
- package/dist/runtime/configuration.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime.js +75 -20
- package/dist/runtime.js.map +3 -3
- package/package.json +6 -6
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Configuration as ConfigurationType } from '../_types/configuration';
|
|
2
2
|
/**
|
|
3
3
|
* Access the bot's configuration
|
|
4
|
-
* Configuration is
|
|
4
|
+
* Configuration is available both during request handling (from context)
|
|
5
|
+
* and at module load time (from ADK_CONFIGURATION env var set by adk dev/run)
|
|
5
6
|
* Types are auto-generated from agent.config.ts configuration schema
|
|
7
|
+
*
|
|
8
|
+
* Note: Returns undefined for properties when configuration is not available
|
|
9
|
+
* (e.g., during build/codegen phase). Code should handle undefined gracefully
|
|
10
|
+
* or only access configuration during request handling.
|
|
6
11
|
*/
|
|
7
12
|
export declare const configuration: ConfigurationType;
|
|
8
13
|
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/runtime/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/runtime/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAsD5E;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,iBAkC1B,CAAA"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
package/dist/runtime.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.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.13.4", adk: "1.13.4", sdk: "5.0.2", llmz: "0.0.35", zai: "2.5.6", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -35656,7 +35656,7 @@ function resolveNameSpace(tagname) {
|
|
|
35656
35656
|
}
|
|
35657
35657
|
return tagname;
|
|
35658
35658
|
}
|
|
35659
|
-
function buildAttributesMap(attrStr, jPath
|
|
35659
|
+
function buildAttributesMap(attrStr, jPath) {
|
|
35660
35660
|
if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
35661
35661
|
const matches = getAllMatches(attrStr, attrsRegx);
|
|
35662
35662
|
const len = matches.length;
|
|
@@ -35734,12 +35734,9 @@ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
|
35734
35734
|
}
|
|
35735
35735
|
return textData;
|
|
35736
35736
|
}
|
|
35737
|
-
function isItStopNode(
|
|
35738
|
-
|
|
35739
|
-
|
|
35740
|
-
const stopNodeExp = stopNodes[stopNodePath];
|
|
35741
|
-
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
35742
|
-
}
|
|
35737
|
+
function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
|
|
35738
|
+
if (stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
|
|
35739
|
+
if (stopNodesExact && stopNodesExact.has(jPath)) return true;
|
|
35743
35740
|
return false;
|
|
35744
35741
|
}
|
|
35745
35742
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
@@ -35913,6 +35910,19 @@ var init_OrderedObjParser = __esm({
|
|
|
35913
35910
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
35914
35911
|
this.addChild = addChild;
|
|
35915
35912
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
35913
|
+
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
35914
|
+
this.stopNodesExact = /* @__PURE__ */ new Set();
|
|
35915
|
+
this.stopNodesWildcard = /* @__PURE__ */ new Set();
|
|
35916
|
+
for (let i = 0; i < this.options.stopNodes.length; i++) {
|
|
35917
|
+
const stopNodeExp = this.options.stopNodes[i];
|
|
35918
|
+
if (typeof stopNodeExp !== "string") continue;
|
|
35919
|
+
if (stopNodeExp.startsWith("*.")) {
|
|
35920
|
+
this.stopNodesWildcard.add(stopNodeExp.substring(2));
|
|
35921
|
+
} else {
|
|
35922
|
+
this.stopNodesExact.add(stopNodeExp);
|
|
35923
|
+
}
|
|
35924
|
+
}
|
|
35925
|
+
}
|
|
35916
35926
|
}
|
|
35917
35927
|
};
|
|
35918
35928
|
attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
@@ -35965,7 +35975,7 @@ var init_OrderedObjParser = __esm({
|
|
|
35965
35975
|
const childNode = new XmlNode(tagData.tagName);
|
|
35966
35976
|
childNode.add(this.options.textNodeName, "");
|
|
35967
35977
|
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
35968
|
-
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath
|
|
35978
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath);
|
|
35969
35979
|
}
|
|
35970
35980
|
this.addChild(currentNode, childNode, jPath, i);
|
|
35971
35981
|
}
|
|
@@ -36002,7 +36012,11 @@ var init_OrderedObjParser = __esm({
|
|
|
36002
36012
|
let attrExpPresent = result.attrExpPresent;
|
|
36003
36013
|
let closeIndex = result.closeIndex;
|
|
36004
36014
|
if (this.options.transformTagName) {
|
|
36005
|
-
|
|
36015
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
36016
|
+
if (tagExp === tagName) {
|
|
36017
|
+
tagExp = newTagName;
|
|
36018
|
+
}
|
|
36019
|
+
tagName = newTagName;
|
|
36006
36020
|
}
|
|
36007
36021
|
if (currentNode && textData) {
|
|
36008
36022
|
if (currentNode.tagname !== "!xml") {
|
|
@@ -36018,7 +36032,7 @@ var init_OrderedObjParser = __esm({
|
|
|
36018
36032
|
jPath += jPath ? "." + tagName : tagName;
|
|
36019
36033
|
}
|
|
36020
36034
|
const startIndex = i;
|
|
36021
|
-
if (this.isItStopNode(this.
|
|
36035
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
|
|
36022
36036
|
let tagContent = "";
|
|
36023
36037
|
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
36024
36038
|
if (tagName[tagName.length - 1] === "/") {
|
|
@@ -36039,7 +36053,10 @@ var init_OrderedObjParser = __esm({
|
|
|
36039
36053
|
}
|
|
36040
36054
|
const childNode = new XmlNode(tagName);
|
|
36041
36055
|
if (tagName !== tagExp && attrExpPresent) {
|
|
36042
|
-
childNode[":@"] = this.buildAttributesMap(
|
|
36056
|
+
childNode[":@"] = this.buildAttributesMap(
|
|
36057
|
+
tagExp,
|
|
36058
|
+
jPath
|
|
36059
|
+
);
|
|
36043
36060
|
}
|
|
36044
36061
|
if (tagContent) {
|
|
36045
36062
|
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
@@ -36057,11 +36074,15 @@ var init_OrderedObjParser = __esm({
|
|
|
36057
36074
|
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
36058
36075
|
}
|
|
36059
36076
|
if (this.options.transformTagName) {
|
|
36060
|
-
|
|
36077
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
36078
|
+
if (tagExp === tagName) {
|
|
36079
|
+
tagExp = newTagName;
|
|
36080
|
+
}
|
|
36081
|
+
tagName = newTagName;
|
|
36061
36082
|
}
|
|
36062
36083
|
const childNode = new XmlNode(tagName);
|
|
36063
36084
|
if (tagName !== tagExp && attrExpPresent) {
|
|
36064
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
36085
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
36065
36086
|
}
|
|
36066
36087
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
36067
36088
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
@@ -36069,7 +36090,7 @@ var init_OrderedObjParser = __esm({
|
|
|
36069
36090
|
const childNode = new XmlNode(tagName);
|
|
36070
36091
|
this.tagsNodeStack.push(currentNode);
|
|
36071
36092
|
if (tagName !== tagExp && attrExpPresent) {
|
|
36072
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
36093
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
36073
36094
|
}
|
|
36074
36095
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
36075
36096
|
currentNode = childNode;
|
|
@@ -45091,18 +45112,51 @@ var init_state = __esm({
|
|
|
45091
45112
|
});
|
|
45092
45113
|
|
|
45093
45114
|
// src/runtime/configuration.ts
|
|
45094
|
-
|
|
45115
|
+
function getEnvConfig() {
|
|
45116
|
+
const cache = getEnvConfigCache();
|
|
45117
|
+
if (cache.attempted) {
|
|
45118
|
+
return cache.parsed;
|
|
45119
|
+
}
|
|
45120
|
+
cache.attempted = true;
|
|
45121
|
+
const envConfig = process.env.ADK_CONFIGURATION;
|
|
45122
|
+
if (!envConfig) {
|
|
45123
|
+
return null;
|
|
45124
|
+
}
|
|
45125
|
+
try {
|
|
45126
|
+
cache.parsed = JSON.parse(envConfig);
|
|
45127
|
+
return cache.parsed;
|
|
45128
|
+
} catch {
|
|
45129
|
+
console.warn("[ADK] Failed to parse ADK_CONFIGURATION environment variable");
|
|
45130
|
+
return null;
|
|
45131
|
+
}
|
|
45132
|
+
}
|
|
45133
|
+
function getConfig() {
|
|
45134
|
+
const contextConfig = context2.get("configuration", { optional: true });
|
|
45135
|
+
if (contextConfig) {
|
|
45136
|
+
return contextConfig;
|
|
45137
|
+
}
|
|
45138
|
+
return getEnvConfig();
|
|
45139
|
+
}
|
|
45140
|
+
var getEnvConfigCache, configuration;
|
|
45095
45141
|
var init_configuration = __esm({
|
|
45096
45142
|
"src/runtime/configuration.ts"() {
|
|
45097
45143
|
"use strict";
|
|
45098
45144
|
init_define_BUILD();
|
|
45099
45145
|
init_define_PACKAGE_VERSIONS();
|
|
45100
45146
|
init_context3();
|
|
45147
|
+
init_singletons();
|
|
45148
|
+
getEnvConfigCache = () => getSingleton("__ADK_GLOBAL_ENV_CONFIG_CACHE", () => ({
|
|
45149
|
+
parsed: null,
|
|
45150
|
+
attempted: false
|
|
45151
|
+
}));
|
|
45101
45152
|
configuration = new Proxy({}, {
|
|
45102
45153
|
get(_target, prop) {
|
|
45103
|
-
|
|
45154
|
+
if (typeof prop === "symbol") {
|
|
45155
|
+
return void 0;
|
|
45156
|
+
}
|
|
45157
|
+
const config = getConfig();
|
|
45104
45158
|
if (!config) {
|
|
45105
|
-
|
|
45159
|
+
return void 0;
|
|
45106
45160
|
}
|
|
45107
45161
|
return config[prop];
|
|
45108
45162
|
},
|
|
@@ -45110,11 +45164,11 @@ var init_configuration = __esm({
|
|
|
45110
45164
|
throw new Error(`Cannot set configuration property "${prop}". Configuration is read-only.`);
|
|
45111
45165
|
},
|
|
45112
45166
|
ownKeys() {
|
|
45113
|
-
const config =
|
|
45167
|
+
const config = getConfig();
|
|
45114
45168
|
return config ? Object.keys(config) : [];
|
|
45115
45169
|
},
|
|
45116
45170
|
getOwnPropertyDescriptor(_target, prop) {
|
|
45117
|
-
const config =
|
|
45171
|
+
const config = getConfig();
|
|
45118
45172
|
if (!config || !(prop in config)) {
|
|
45119
45173
|
return void 0;
|
|
45120
45174
|
}
|
|
@@ -49025,6 +49079,7 @@ var init_runtime = __esm({
|
|
|
49025
49079
|
init_handlers();
|
|
49026
49080
|
init_promises();
|
|
49027
49081
|
init_chat2();
|
|
49082
|
+
init_configuration();
|
|
49028
49083
|
init_handlers2();
|
|
49029
49084
|
init_interfaces();
|
|
49030
49085
|
init_tracked_state();
|