@botpress/adk-cli 1.5.10 → 1.5.12
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/cli.js +102 -71
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -314312,7 +314312,7 @@ var import_const, import_const2, __create4, __defProp6, __getOwnPropDesc3, __get
|
|
|
314312
314312
|
Object.assign(wf3, response.workflow);
|
|
314313
314313
|
}
|
|
314314
314314
|
return response;
|
|
314315
|
-
}, DEFAULT_MAX_ATTEMPTS = 5, MIN_STEP_REMAINING_TIME_MS = 1e4, storage2, step = async (name2, run, options = {}) => {
|
|
314315
|
+
}, import_ms22, DEFAULT_MAX_ATTEMPTS = 5, MIN_STEP_REMAINING_TIME_MS = 1e4, storage2, step = async (name2, run, options = {}) => {
|
|
314316
314316
|
return _step(name2, run, options);
|
|
314317
314317
|
}, workflowStepContextSchema, workflowExecutionContextSchema, StepSymbol, BaseWorkflowInstance, Definitions, TableSource, nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", nameChar, nameRegexp, regexName, isName = function(string) {
|
|
314318
314318
|
const match22 = regexName.exec(string);
|
|
@@ -315684,7 +315684,7 @@ var init_internal = __esm(() => {
|
|
|
315684
315684
|
});
|
|
315685
315685
|
init_define_PACKAGE_VERSIONS = __esm2({
|
|
315686
315686
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
315687
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.3.
|
|
315687
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.3.12", adk: "not-installed", sdk: "4.17.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
|
|
315688
315688
|
}
|
|
315689
315689
|
});
|
|
315690
315690
|
init_globalThis = __esm2({
|
|
@@ -338765,41 +338765,41 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
338765
338765
|
return;
|
|
338766
338766
|
}
|
|
338767
338767
|
}
|
|
338768
|
-
function fmtShort(
|
|
338769
|
-
var msAbs = Math.abs(
|
|
338768
|
+
function fmtShort(ms32) {
|
|
338769
|
+
var msAbs = Math.abs(ms32);
|
|
338770
338770
|
if (msAbs >= d3) {
|
|
338771
|
-
return Math.round(
|
|
338771
|
+
return Math.round(ms32 / d3) + "d";
|
|
338772
338772
|
}
|
|
338773
338773
|
if (msAbs >= h3) {
|
|
338774
|
-
return Math.round(
|
|
338774
|
+
return Math.round(ms32 / h3) + "h";
|
|
338775
338775
|
}
|
|
338776
338776
|
if (msAbs >= m2) {
|
|
338777
|
-
return Math.round(
|
|
338777
|
+
return Math.round(ms32 / m2) + "m";
|
|
338778
338778
|
}
|
|
338779
338779
|
if (msAbs >= s2) {
|
|
338780
|
-
return Math.round(
|
|
338780
|
+
return Math.round(ms32 / s2) + "s";
|
|
338781
338781
|
}
|
|
338782
|
-
return
|
|
338782
|
+
return ms32 + "ms";
|
|
338783
338783
|
}
|
|
338784
|
-
function fmtLong(
|
|
338785
|
-
var msAbs = Math.abs(
|
|
338784
|
+
function fmtLong(ms32) {
|
|
338785
|
+
var msAbs = Math.abs(ms32);
|
|
338786
338786
|
if (msAbs >= d3) {
|
|
338787
|
-
return plural(
|
|
338787
|
+
return plural(ms32, msAbs, d3, "day");
|
|
338788
338788
|
}
|
|
338789
338789
|
if (msAbs >= h3) {
|
|
338790
|
-
return plural(
|
|
338790
|
+
return plural(ms32, msAbs, h3, "hour");
|
|
338791
338791
|
}
|
|
338792
338792
|
if (msAbs >= m2) {
|
|
338793
|
-
return plural(
|
|
338793
|
+
return plural(ms32, msAbs, m2, "minute");
|
|
338794
338794
|
}
|
|
338795
338795
|
if (msAbs >= s2) {
|
|
338796
|
-
return plural(
|
|
338796
|
+
return plural(ms32, msAbs, s2, "second");
|
|
338797
338797
|
}
|
|
338798
|
-
return
|
|
338798
|
+
return ms32 + " ms";
|
|
338799
338799
|
}
|
|
338800
|
-
function plural(
|
|
338800
|
+
function plural(ms32, msAbs, n3, name2) {
|
|
338801
338801
|
var isPlural = msAbs >= n3 * 1.5;
|
|
338802
|
-
return Math.round(
|
|
338802
|
+
return Math.round(ms32 / n3) + " " + name2 + (isPlural ? "s" : "");
|
|
338803
338803
|
}
|
|
338804
338804
|
}
|
|
338805
338805
|
});
|
|
@@ -338842,8 +338842,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
338842
338842
|
}
|
|
338843
338843
|
const self2 = debug;
|
|
338844
338844
|
const curr = Number(/* @__PURE__ */ new Date);
|
|
338845
|
-
const
|
|
338846
|
-
self2.diff =
|
|
338845
|
+
const ms32 = curr - (prevTime || curr);
|
|
338846
|
+
self2.diff = ms32;
|
|
338847
338847
|
self2.prev = prevTime;
|
|
338848
338848
|
self2.curr = curr;
|
|
338849
338849
|
prevTime = curr;
|
|
@@ -351164,6 +351164,7 @@ ${iteration.status.execution_error.stack}`;
|
|
|
351164
351164
|
init_define_PACKAGE_VERSIONS();
|
|
351165
351165
|
init_define_BUILD();
|
|
351166
351166
|
init_define_PACKAGE_VERSIONS();
|
|
351167
|
+
import_ms22 = __toESM4(require_ms2(), 1);
|
|
351167
351168
|
init_define_BUILD();
|
|
351168
351169
|
init_define_PACKAGE_VERSIONS();
|
|
351169
351170
|
init_define_BUILD();
|
|
@@ -351201,10 +351202,10 @@ ${iteration.status.execution_error.stack}`;
|
|
|
351201
351202
|
workflowControlContext.abort();
|
|
351202
351203
|
throw createStepSignal();
|
|
351203
351204
|
};
|
|
351204
|
-
step.sleep = async (name2,
|
|
351205
|
+
step.sleep = async (name2, ms32) => {
|
|
351205
351206
|
await _step(name2, async () => {
|
|
351206
351207
|
const remainingTime = context.get("runtime").getRemainingExecutionTimeInMs();
|
|
351207
|
-
if (remainingTime - MIN_STEP_REMAINING_TIME_MS <=
|
|
351208
|
+
if (remainingTime - MIN_STEP_REMAINING_TIME_MS <= ms32 || ms32 >= 1e4) {
|
|
351208
351209
|
const client = context.get("client");
|
|
351209
351210
|
const workflowControlContext = context.get("workflowControlContext");
|
|
351210
351211
|
await client.createEvent({
|
|
@@ -351212,7 +351213,7 @@ ${iteration.status.execution_error.stack}`;
|
|
|
351212
351213
|
payload: {},
|
|
351213
351214
|
workflowId: workflowControlContext.workflow.id,
|
|
351214
351215
|
schedule: {
|
|
351215
|
-
delay:
|
|
351216
|
+
delay: ms32
|
|
351216
351217
|
}
|
|
351217
351218
|
});
|
|
351218
351219
|
await updateWorkflow({
|
|
@@ -351221,15 +351222,15 @@ ${iteration.status.execution_error.stack}`;
|
|
|
351221
351222
|
});
|
|
351222
351223
|
workflowControlContext.abort();
|
|
351223
351224
|
} else {
|
|
351224
|
-
await new Promise((resolve) => void setTimeout(resolve,
|
|
351225
|
+
await new Promise((resolve) => void setTimeout(resolve, ms32));
|
|
351225
351226
|
}
|
|
351226
351227
|
}, {}, {
|
|
351227
351228
|
stepType: "sleep"
|
|
351228
351229
|
});
|
|
351229
351230
|
};
|
|
351230
351231
|
step.sleepUntil = async (name2, date) => {
|
|
351231
|
-
const
|
|
351232
|
-
await step.sleep(name2,
|
|
351232
|
+
const ms32 = Math.max(0, new Date(date).getTime() - Date.now() - MIN_STEP_REMAINING_TIME_MS);
|
|
351233
|
+
await step.sleep(name2, ms32);
|
|
351233
351234
|
};
|
|
351234
351235
|
step.waitForWorkflow = async (name2, workflowId) => {
|
|
351235
351236
|
const workflowControlContext = context.get("workflowControlContext");
|
|
@@ -366417,14 +366418,14 @@ class ValidationErrors {
|
|
|
366417
366418
|
context: { integration, version }
|
|
366418
366419
|
};
|
|
366419
366420
|
}
|
|
366420
|
-
static unknownIntegration(integration, source) {
|
|
366421
|
+
static unknownIntegration(integration, source, detailedMessage) {
|
|
366421
366422
|
return {
|
|
366422
366423
|
$type: ValidationErrors.$type,
|
|
366423
366424
|
code: "UNKNOWN_INTEGRATION",
|
|
366424
366425
|
severity: "error",
|
|
366425
|
-
message: `Unknown integration '${integration}' from source '${source}'`,
|
|
366426
|
+
message: detailedMessage || `Unknown integration '${integration}' from source '${source}'`,
|
|
366426
366427
|
file: "dependencies.json",
|
|
366427
|
-
hint: `Check if the integration name is correct or if it exists in ${source}`,
|
|
366428
|
+
hint: detailedMessage ? undefined : `Check if the integration name is correct or if it exists in ${source}`,
|
|
366428
366429
|
context: { integration, source }
|
|
366429
366430
|
};
|
|
366430
366431
|
}
|
|
@@ -366691,7 +366692,8 @@ class IntegrationManager {
|
|
|
366691
366692
|
if (error instanceof Error && error.message.includes("version")) {
|
|
366692
366693
|
errors.push(ValidationErrors.integrationVersionError(integration.alias, error.message));
|
|
366693
366694
|
} else {
|
|
366694
|
-
|
|
366695
|
+
const errorMessage = error instanceof Error ? error.message : undefined;
|
|
366696
|
+
errors.push(ValidationErrors.unknownIntegration(integration.alias, integration.ref.fullName, errorMessage));
|
|
366695
366697
|
}
|
|
366696
366698
|
}
|
|
366697
366699
|
});
|
|
@@ -366711,51 +366713,80 @@ class IntegrationManager {
|
|
|
366711
366713
|
}
|
|
366712
366714
|
}
|
|
366713
366715
|
const client = await this.getClient();
|
|
366714
|
-
|
|
366715
|
-
|
|
366716
|
+
const integration = await this._findPrivateOrPublicIntegration(client, ref);
|
|
366717
|
+
if (!integration) {
|
|
366718
|
+
throw await this._buildIntegrationNotFoundError(client, ref);
|
|
366719
|
+
}
|
|
366720
|
+
await this.cache.setResolution(ref.name, ref.version, ref.workspace, integration.id, integration.updatedAt);
|
|
366721
|
+
const definition = integration;
|
|
366722
|
+
await this.cache.setDefinition(integration.id, integration.updatedAt, definition);
|
|
366723
|
+
return definition;
|
|
366724
|
+
}
|
|
366725
|
+
async _findPrivateOrPublicIntegration(client, ref) {
|
|
366726
|
+
const privateIntegration = await this._findPrivateIntegration(client, ref);
|
|
366727
|
+
if (privateIntegration) {
|
|
366728
|
+
return privateIntegration;
|
|
366729
|
+
}
|
|
366730
|
+
const publicIntegration = await this._findPublicIntegration(client, ref);
|
|
366731
|
+
if (publicIntegration) {
|
|
366732
|
+
return publicIntegration;
|
|
366733
|
+
}
|
|
366734
|
+
return;
|
|
366735
|
+
}
|
|
366736
|
+
async _findPrivateIntegration(client, ref) {
|
|
366716
366737
|
try {
|
|
366717
|
-
|
|
366738
|
+
const version = ref.workspace && ref.version !== "latest" ? "latest" : ref.version;
|
|
366739
|
+
const response = await client.getIntegrationByName({
|
|
366740
|
+
name: ref.fullName,
|
|
366741
|
+
version
|
|
366742
|
+
});
|
|
366743
|
+
return response.integration;
|
|
366744
|
+
} catch (error) {
|
|
366745
|
+
if (this._isResourceNotFoundError(error)) {
|
|
366746
|
+
return;
|
|
366747
|
+
}
|
|
366748
|
+
throw error;
|
|
366749
|
+
}
|
|
366750
|
+
}
|
|
366751
|
+
async _findPublicIntegration(client, ref) {
|
|
366752
|
+
try {
|
|
366753
|
+
const response = await client.getPublicIntegration({
|
|
366718
366754
|
name: ref.fullName,
|
|
366719
366755
|
version: ref.version
|
|
366720
366756
|
});
|
|
366721
|
-
|
|
366722
|
-
|
|
366723
|
-
|
|
366724
|
-
|
|
366725
|
-
version: ref.version
|
|
366726
|
-
});
|
|
366727
|
-
} catch (publicError) {
|
|
366728
|
-
versionError = publicError;
|
|
366757
|
+
return response.integration;
|
|
366758
|
+
} catch (error) {
|
|
366759
|
+
if (this._isResourceNotFoundError(error)) {
|
|
366760
|
+
return;
|
|
366729
366761
|
}
|
|
366762
|
+
throw error;
|
|
366730
366763
|
}
|
|
366731
|
-
|
|
366732
|
-
|
|
366733
|
-
|
|
366734
|
-
|
|
366735
|
-
|
|
366736
|
-
|
|
366737
|
-
|
|
366738
|
-
|
|
366739
|
-
|
|
366740
|
-
|
|
366741
|
-
|
|
366742
|
-
|
|
366743
|
-
|
|
366744
|
-
|
|
366745
|
-
|
|
366746
|
-
|
|
366747
|
-
|
|
366748
|
-
|
|
366749
|
-
}
|
|
366764
|
+
}
|
|
366765
|
+
_isResourceNotFoundError(error) {
|
|
366766
|
+
if (error && typeof error === "object" && "type" in error) {
|
|
366767
|
+
return error.type === "ResourceNotFound";
|
|
366768
|
+
}
|
|
366769
|
+
return false;
|
|
366770
|
+
}
|
|
366771
|
+
async _buildIntegrationNotFoundError(client, ref) {
|
|
366772
|
+
if (!ref.workspace) {
|
|
366773
|
+
return new Error(`Integration "${ref.name}" not found in the official Botpress hub`);
|
|
366774
|
+
}
|
|
366775
|
+
let currentWorkspaceHandle;
|
|
366776
|
+
try {
|
|
366777
|
+
const credentials = this.options.credentials || await auth.getActiveCredentials();
|
|
366778
|
+
const workspaceId = this.options.workspaceId || credentials.workspaceId;
|
|
366779
|
+
if (workspaceId) {
|
|
366780
|
+
const currentWorkspace = await client.getWorkspace({ id: workspaceId });
|
|
366781
|
+
currentWorkspaceHandle = currentWorkspace?.handle;
|
|
366750
366782
|
}
|
|
366751
|
-
|
|
366752
|
-
|
|
366783
|
+
} catch {
|
|
366784
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}"`);
|
|
366753
366785
|
}
|
|
366754
|
-
|
|
366755
|
-
|
|
366756
|
-
|
|
366757
|
-
|
|
366758
|
-
return definition;
|
|
366786
|
+
if (currentWorkspaceHandle === ref.workspace) {
|
|
366787
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". Are you sure you published the integration? Run 'adk deploy' to publish it to your workspace.`);
|
|
366788
|
+
}
|
|
366789
|
+
return new Error(`Integration "${ref.name}" not found in workspace "${ref.workspace}". This integration may be private. Private integrations can only be installed in the same workspace. If you want to share this integration with other workspaces, deploy it with --visibility="unlisted" or --visibility="public".`);
|
|
366759
366790
|
}
|
|
366760
366791
|
validateIntegration(integration) {
|
|
366761
366792
|
const errors = [];
|
|
@@ -367778,7 +367809,7 @@ class AgentProjectGenerator {
|
|
|
367778
367809
|
deploy: "adk deploy"
|
|
367779
367810
|
},
|
|
367780
367811
|
dependencies: {
|
|
367781
|
-
"@botpress/runtime": "^1.3.
|
|
367812
|
+
"@botpress/runtime": "^1.3.12"
|
|
367782
367813
|
},
|
|
367783
367814
|
devDependencies: {
|
|
367784
367815
|
typescript: "^5.0.0"
|
|
@@ -377019,7 +377050,7 @@ var init_Separator = __esm(async () => {
|
|
|
377019
377050
|
var require_package3 = __commonJS((exports, module) => {
|
|
377020
377051
|
module.exports = {
|
|
377021
377052
|
name: "@botpress/adk",
|
|
377022
|
-
version: "1.3.
|
|
377053
|
+
version: "1.3.12",
|
|
377023
377054
|
description: "Core ADK library for building AI agents on Botpress",
|
|
377024
377055
|
type: "module",
|
|
377025
377056
|
main: "dist/index.js",
|
|
@@ -380244,7 +380275,7 @@ function checkRuntimeVersion(agentRoot) {
|
|
|
380244
380275
|
`));
|
|
380245
380276
|
}
|
|
380246
380277
|
}
|
|
380247
|
-
var semver, EXPECTED_RUNTIME_VERSION = "1.3.
|
|
380278
|
+
var semver, EXPECTED_RUNTIME_VERSION = "1.3.12";
|
|
380248
380279
|
var init_runtime_version_check = __esm(() => {
|
|
380249
380280
|
init_source();
|
|
380250
380281
|
semver = __toESM(require_semver3(), 1);
|
|
@@ -395785,7 +395816,7 @@ function formatHelp(cmd, version) {
|
|
|
395785
395816
|
// src/cli.ts
|
|
395786
395817
|
var __filename2 = fileURLToPath9(import.meta.url);
|
|
395787
395818
|
var __dirname5 = dirname3(__filename2);
|
|
395788
|
-
var CLI_VERSION = "1.5.
|
|
395819
|
+
var CLI_VERSION = "1.5.12";
|
|
395789
395820
|
program.name("adk").description("Botpress Agent Development Kit (ADK) - CLI for building AI agents").version(CLI_VERSION).option("--no-cache", "Disable caching for integration lookups").configureHelp({
|
|
395790
395821
|
formatHelp: () => formatHelp(program, CLI_VERSION)
|
|
395791
395822
|
});
|